aboutsummaryrefslogtreecommitdiff
path: root/test/common/math.h
diff options
context:
space:
mode:
Diffstat (limited to 'test/common/math.h')
-rw-r--r--test/common/math.h13
1 files changed, 6 insertions, 7 deletions
diff --git a/test/common/math.h b/test/common/math.h
index 11d2b7e827..79c005206d 100644
--- a/test/common/math.h
+++ b/test/common/math.h
@@ -8,7 +8,6 @@
#define TS_ASSERT_ALMOST_EQUALS(x, y, z) \
TS_ASSERT_LESS_THAN(((x) - (y)) >= 0 ? (x) - (y) : (y) - (x), z)
-const float PI = 3.141592653;
const float MAX_ERROR = 0.000001;
class MathTestSuite : public CxxTest::TestSuite
{
@@ -26,15 +25,15 @@ class MathTestSuite : public CxxTest::TestSuite
void test_rad2deg() {
TS_ASSERT_ALMOST_EQUALS(Common::rad2deg(0), 0, MAX_ERROR);
- TS_ASSERT_ALMOST_EQUALS(Common::rad2deg(PI), 180.0, MAX_ERROR);
- TS_ASSERT_ALMOST_EQUALS(Common::rad2deg(2.0 * PI), 360.0, MAX_ERROR);
- TS_ASSERT_ALMOST_EQUALS(Common::rad2deg(PI / 2.0), 90.0, MAX_ERROR);
+ TS_ASSERT_ALMOST_EQUALS(Common::rad2deg(M_PI), 180.0, MAX_ERROR);
+ TS_ASSERT_ALMOST_EQUALS(Common::rad2deg(2.0 * M_PI), 360.0, MAX_ERROR);
+ TS_ASSERT_ALMOST_EQUALS(Common::rad2deg(M_PI / 2.0), 90.0, MAX_ERROR);
}
void test_deg2rad() {
TS_ASSERT_ALMOST_EQUALS(Common::deg2rad(0), 0, MAX_ERROR);
- TS_ASSERT_ALMOST_EQUALS(Common::deg2rad(180.0), PI, MAX_ERROR);
- TS_ASSERT_ALMOST_EQUALS(Common::deg2rad(360.0), 2.0 * PI, MAX_ERROR);
- TS_ASSERT_ALMOST_EQUALS(Common::deg2rad(90.0), PI / 2.0, MAX_ERROR);
+ TS_ASSERT_ALMOST_EQUALS(Common::deg2rad(180.0), M_PI, MAX_ERROR);
+ TS_ASSERT_ALMOST_EQUALS(Common::deg2rad(360.0), 2.0 * M_PI, MAX_ERROR);
+ TS_ASSERT_ALMOST_EQUALS(Common::deg2rad(90.0), M_PI / 2.0, MAX_ERROR);
}
};