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.
This commit is contained in:
Pierre Wendling 2022-05-15 17:00:12 -04:00 committed by Sam Lantinga
parent 5ecc75a4fc
commit c389c32d30
1 changed files with 19 additions and 16 deletions

View File

@ -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;
}
}