diff options
author | RĂ©mi Verschelde <remi@verschelde.fr> | 2022-01-17 16:55:34 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-01-17 16:55:34 +0100 |
commit | 24f8a5979c5cfab3f7b3bccdfb27973918d3ae0c (patch) | |
tree | 8c68dbbdacd2a7e028d4a0e12007c0c331abca09 /tests/core/math | |
parent | b315295ffcd53b74af8c36fa2abac5e957f88613 (diff) | |
parent | 13939734e05e231f63e5bd7275d182491600e206 (diff) |
Merge pull request #56809 from aaronfranke/replace-num-real
Diffstat (limited to 'tests/core/math')
-rw-r--r-- | tests/core/math/test_vector2.h | 19 | ||||
-rw-r--r-- | tests/core/math/test_vector3.h | 19 |
2 files changed, 38 insertions, 0 deletions
diff --git a/tests/core/math/test_vector2.h b/tests/core/math/test_vector2.h index 7dd14736e8..cb447acd17 100644 --- a/tests/core/math/test_vector2.h +++ b/tests/core/math/test_vector2.h @@ -246,6 +246,25 @@ TEST_CASE("[Vector2] Operators") { CHECK_MESSAGE( Vector2(Vector2i(1, 2)) == Vector2(1, 2), "Vector2 constructed from Vector2i should work as expected."); + + CHECK_MESSAGE( + ((String)decimal1) == "(2.3, 4.9)", + "Vector2 cast to String should work as expected."); + CHECK_MESSAGE( + ((String)decimal2) == "(1.2, 3.4)", + "Vector2 cast to String should work as expected."); + CHECK_MESSAGE( + ((String)Vector2(9.8, 9.9)) == "(9.8, 9.9)", + "Vector2 cast to String should work as expected."); +#ifdef REAL_T_IS_DOUBLE + CHECK_MESSAGE( + ((String)Vector2(Math_PI, Math_TAU)) == "(3.14159265358979, 6.28318530717959)", + "Vector2 cast to String should print the correct amount of digits for real_t = double."); +#else + CHECK_MESSAGE( + ((String)Vector2(Math_PI, Math_TAU)) == "(3.141593, 6.283185)", + "Vector2 cast to String should print the correct amount of digits for real_t = float."); +#endif // REAL_T_IS_DOUBLE } TEST_CASE("[Vector2] Other methods") { diff --git a/tests/core/math/test_vector3.h b/tests/core/math/test_vector3.h index 97da035046..136a531946 100644 --- a/tests/core/math/test_vector3.h +++ b/tests/core/math/test_vector3.h @@ -271,6 +271,25 @@ TEST_CASE("[Vector3] Operators") { CHECK_MESSAGE( Vector3(Vector3i(1, 2, 3)) == Vector3(1, 2, 3), "Vector3 constructed from Vector3i should work as expected."); + + CHECK_MESSAGE( + ((String)decimal1) == "(2.3, 4.9, 7.8)", + "Vector3 cast to String should work as expected."); + CHECK_MESSAGE( + ((String)decimal2) == "(1.2, 3.4, 5.6)", + "Vector3 cast to String should work as expected."); + CHECK_MESSAGE( + ((String)Vector3(9.7, 9.8, 9.9)) == "(9.7, 9.8, 9.9)", + "Vector3 cast to String should work as expected."); +#ifdef REAL_T_IS_DOUBLE + CHECK_MESSAGE( + ((String)Vector3(Math_E, Math_SQRT2, Math_SQRT3)) == "(2.71828182845905, 1.4142135623731, 1.73205080756888)", + "Vector3 cast to String should print the correct amount of digits for real_t = double."); +#else + CHECK_MESSAGE( + ((String)Vector3(Math_E, Math_SQRT2, Math_SQRT3)) == "(2.718282, 1.414214, 1.732051)", + "Vector3 cast to String should print the correct amount of digits for real_t = float."); +#endif // REAL_T_IS_DOUBLE } TEST_CASE("[Vector3] Other methods") { |