[Scummvm-git-logs] scummvm master -> 07f806697d73d746807e105ed9b876ddb12a81aa

dafioram dafioram at gmail.com
Sun Apr 7 05:37:45 CEST 2019


This automated email contains information about 1 new commit which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .

Summary:
07f806697d TESTS: Use M_PI for Common math tests


Commit: 07f806697d73d746807e105ed9b876ddb12a81aa
    https://github.com/scummvm/scummvm/commit/07f806697d73d746807e105ed9b876ddb12a81aa
Author: David Fioramonti (dafioram at gmail.com)
Date: 2019-04-06T20:34:08-07:00

Commit Message:
TESTS: Use M_PI for Common math tests

Instead of defining a new variable constant pi we use M_PI.

Changed paths:
    test/common/math.h


diff --git a/test/common/math.h b/test/common/math.h
index 11d2b7e..79c0052 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);
 	}
 };





More information about the Scummvm-git-logs mailing list