diff options
author | David Fioramonti | 2019-04-06 20:31:23 -0700 |
---|---|---|
committer | David Fioramonti | 2019-04-06 20:34:08 -0700 |
commit | 07f806697d73d746807e105ed9b876ddb12a81aa (patch) | |
tree | 9b20362302c5facbe2ddcc5af3b7228581687bc6 /test/common | |
parent | 9c0c249a96b33ffd9e827a8ad62caaff03c10a81 (diff) | |
download | scummvm-rg350-07f806697d73d746807e105ed9b876ddb12a81aa.tar.gz scummvm-rg350-07f806697d73d746807e105ed9b876ddb12a81aa.tar.bz2 scummvm-rg350-07f806697d73d746807e105ed9b876ddb12a81aa.zip |
TESTS: Use M_PI for Common math tests
Instead of defining a new variable constant pi we use M_PI.
Diffstat (limited to 'test/common')
-rw-r--r-- | test/common/math.h | 13 |
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); } }; |