36 TS_ASSERT_DELTA(xms::MagSquared(1, 2, 3, 4), 30.0, 0.001);
37 TS_ASSERT_DELTA(xms::MagSquared(1, 2, 3), 14.0, 0.001);
38 TS_ASSERT_DELTA(xms::MagSquared(1, 2), 5.0, 0.001);
40 TS_ASSERT_DELTA(xms::Mag(1, 2, 3, 4), 5.4772, 0.001);
41 TS_ASSERT_DELTA(xms::Mag(1, 2, 3), 3.7416, 0.001);
42 TS_ASSERT_DELTA(xms::Mag(1, 2), 2.2360, 0.001);
44 TS_ASSERT_EQUALS(xms::Clamp(5, 1, 8), 5);
45 TS_ASSERT_EQUALS(xms::Clamp(5, 5, 8), 5);
46 TS_ASSERT_EQUALS(xms::Clamp(5, 1, 5), 5);
47 TS_ASSERT_EQUALS(xms::Clamp(5, 6, 8), 6);
48 TS_ASSERT_EQUALS(xms::Clamp(5, 1, 2), 2);
52 const double D = 1e-5;
53 TS_ASSERT_EQUALS(xms::EQ_EPS(1.0, 1.0, D),
true);
54 TS_ASSERT_EQUALS(xms::EQ_EPS(1.12345, 1.12345, D),
true);
55 TS_ASSERT_EQUALS(xms::EQ_EPS(1.12345, 1.12346, D),
true);
56 TS_ASSERT_EQUALS(xms::EQ_EPS(1.12345, 1.12347, D),
true);
57 TS_ASSERT_EQUALS(xms::EQ_EPS(1.0, 2.0, D),
false);
58 TS_ASSERT_EQUALS(xms::EQ_EPS(1.0, 1.0, D),
true);
59 TS_ASSERT_EQUALS(xms::EQ_EPS(2.0, 1.0, D),
false);
61 TS_ASSERT_EQUALS(xms::LT_EPS(1.0, 1.0, D),
false);
62 TS_ASSERT_EQUALS(xms::LT_EPS(1.12345, 1.12345, D),
false);
63 TS_ASSERT_EQUALS(xms::LT_EPS(1.12345, 1.12346, D),
false);
64 TS_ASSERT_EQUALS(xms::LT_EPS(1.12345, 1.12347, D),
false);
65 TS_ASSERT_EQUALS(xms::LT_EPS(1.0, 2.0, D),
true);
66 TS_ASSERT_EQUALS(xms::LT_EPS(1.0, 1.0, D),
false);
67 TS_ASSERT_EQUALS(xms::LT_EPS(2.0, 1.0, D),
false);
69 TS_ASSERT_EQUALS(xms::GT_EPS(1.0, 1.0, D),
false);
70 TS_ASSERT_EQUALS(xms::GT_EPS(1.12345, 1.12345, D),
false);
71 TS_ASSERT_EQUALS(xms::GT_EPS(1.12345, 1.12346, D),
false);
72 TS_ASSERT_EQUALS(xms::GT_EPS(1.12345, 1.12347, D),
false);
73 TS_ASSERT_EQUALS(xms::GT_EPS(1.12347, 1.12345, D),
false);
74 TS_ASSERT_EQUALS(xms::GT_EPS(1.0, 2.0, D),
false);
75 TS_ASSERT_EQUALS(xms::GT_EPS(1.0, 1.0, D),
false);
76 TS_ASSERT_EQUALS(xms::GT_EPS(2.0, 1.0, D),
true);
79 TS_ASSERT_EQUALS(xms::EQ_TOL(1.0, 1.0, D),
true);
80 TS_ASSERT_EQUALS(xms::EQ_TOL(1.12345, 1.12345, D),
true);
81 TS_ASSERT_EQUALS(xms::EQ_TOL(1.12345, 1.12346, D),
true);
82 TS_ASSERT_EQUALS(xms::EQ_TOL(1.12345, 1.12347, D),
false);
83 TS_ASSERT_EQUALS(xms::EQ_TOL(1.0, 2.0, D),
false);
84 TS_ASSERT_EQUALS(xms::EQ_TOL(1.0, 1.0, D),
true);
85 TS_ASSERT_EQUALS(xms::EQ_TOL(2.0, 1.0, D),
false);
87 TS_ASSERT_EQUALS(xms::LT_TOL(1.0, 1.0, D),
false);
88 TS_ASSERT_EQUALS(xms::LT_TOL(1.12345, 1.12345, D),
false);
89 TS_ASSERT_EQUALS(xms::LT_TOL(1.12345, 1.12346, D),
false);
90 TS_ASSERT_EQUALS(xms::LT_TOL(1.12345, 1.12347, D),
true);
91 TS_ASSERT_EQUALS(xms::LT_TOL(1.0, 2.0, D),
true);
92 TS_ASSERT_EQUALS(xms::LT_TOL(1.0, 1.0, D),
false);
93 TS_ASSERT_EQUALS(xms::LT_TOL(2.0, 1.0, D),
false);
95 TS_ASSERT_EQUALS(xms::GT_TOL(1.0, 1.0, D),
false);
96 TS_ASSERT_EQUALS(xms::GT_TOL(1.12345, 1.12345, D),
false);
97 TS_ASSERT_EQUALS(xms::GT_TOL(1.12345, 1.12346, D),
false);
98 TS_ASSERT_EQUALS(xms::GT_TOL(1.12345, 1.12347, D),
false);
99 TS_ASSERT_EQUALS(xms::GT_TOL(1.12347, 1.12345, D),
true);
100 TS_ASSERT_EQUALS(xms::GT_TOL(1.0, 2.0, D),
false);
101 TS_ASSERT_EQUALS(xms::GT_TOL(1.0, 1.0, D),
false);
102 TS_ASSERT_EQUALS(xms::GT_TOL(2.0, 1.0, D),
true);
void TestIt()
Test xmscore math functions.