Commit c389c32d30f2fbd148d7485f460f3a1d9c1ef382

Pierre Wendling 2022-05-15T17:00:12

Test: Change assertion type in range tests. Changes SDLTest_AssertPass(...) to SDLTest_AssertCheck(SDL_FALSE, ...) for failed assertions so the internal counter gets updated properly.

diff --git a/test/testautomation_math.c b/test/testautomation_math.c
index b57ce6c..d8f4fd4 100644
--- a/test/testautomation_math.c
+++ b/test/testautomation_math.c
@@ -128,9 +128,10 @@ helper_range(const char *func_name, d_to_d_func func)
 
         result = func(test_value);
         if (result != test_value) { /* Only log failures to save performances */
-            SDLTest_AssertPass("%s(%.1f), expected %.1f, got %.1f",
-                               func_name, test_value,
-                               test_value, result);
+            SDLTest_AssertCheck(SDL_FALSE,
+                                "%s(%.1f), expected %.1f, got %.1f",
+                                func_name, test_value,
+                                test_value, result);
             return TEST_ABORTED;
         }
     }
@@ -666,17 +667,17 @@ copysign_rangeTest(void *args)
         /* Only log failures to save performances */
         result = SDL_copysign(test_value, 1.0);
         if (result != test_value) {
-            SDLTest_AssertPass("Copysign(%.1f,%.1f), expected %.1f, got %.1f",
-                               test_value, 1.0,
-                               test_value, result);
+            SDLTest_AssertCheck(SDL_FALSE,
+                                "Copysign(%.1f,%.1f), expected %.1f, got %.1f",
+                                test_value, 1.0, test_value, result);
             return TEST_ABORTED;
         }
 
         result = SDL_copysign(test_value, -1.0);
         if (result != -test_value) {
-            SDLTest_AssertPass("Copysign(%.1f,%.1f), expected %.1f, got %.1f",
-                               test_value, -1.0,
-                               -test_value, result);
+            SDLTest_AssertCheck(SDL_FALSE,
+                                "Copysign(%.1f,%.1f), expected %.1f, got %.1f",
+                                test_value, -1.0, -test_value, result);
             return TEST_ABORTED;
         }
     }
@@ -862,9 +863,9 @@ fmod_rangeTest(void *args)
         /* Only log failures to save performances */
         result = SDL_fmod(test_value, 1.0);
         if (0.0 != result) {
-            SDLTest_AssertPass("Fmod(%.1f,%.1f), expected %.1f, got %.1f",
-                               test_value, 1.0,
-                               0.0, result);
+            SDLTest_AssertCheck(SDL_FALSE,
+                                "Fmod(%.1f,%.1f), expected %.1f, got %.1f",
+                                test_value, 1.0, 0.0, result);
             return TEST_ABORTED;
         }
     }
@@ -1527,15 +1528,17 @@ pow_rangeTest(void *args)
         /* Only log failures to save performances */
         result = SDL_pow(test_value, 0.0);
         if (result != 1.0) {
-            SDLTest_AssertPass("Pow(%.1f,%.1f), expected %.1f, got %.1f",
-                               test_value, 1.0, 1.0, result);
+            SDLTest_AssertCheck(SDL_FALSE,
+                                "Pow(%.1f,%.1f), expected %.1f, got %.1f",
+                                test_value, 1.0, 1.0, result);
             return TEST_ABORTED;
         }
 
         result = SDL_pow(test_value, -0.0);
         if (result != 1.0) {
-            SDLTest_AssertPass("Pow(%.1f,%.1f), expected %.1f, got %.1f",
-                               test_value, -0.0, 1.0, result);
+            SDLTest_AssertCheck(SDL_FALSE,
+                                "Pow(%.1f,%.1f), expected %.1f, got %.1f",
+                                test_value, -0.0, 1.0, result);
             return TEST_ABORTED;
         }
     }