Test: Unrolled the array of cases in math suite.
On OS/2, `INFINITY` is a `const double` which cannot be used to instantiate an array.main
parent
c23216bf46
commit
a3a852e912
|
@ -15,13 +15,22 @@
|
||||||
* \brief Checks edge cases (0 and infinity) for themselves.
|
* \brief Checks edge cases (0 and infinity) for themselves.
|
||||||
*/
|
*/
|
||||||
static int floor_edgeCases(void* args) {
|
static int floor_edgeCases(void* args) {
|
||||||
const double edge_cases[] = {INFINITY, -INFINITY, 0.0, -0.0};
|
double result;
|
||||||
for (size_t i = 0; i < SDL_arraysize(edge_cases); i++) {
|
|
||||||
const double result = SDL_floor(edge_cases[i]);
|
result = SDL_floor(INFINITY);
|
||||||
SDLTest_AssertCheck(result == edge_cases[i],
|
SDLTest_AssertCheck(INFINITY == result, "Floor(%f), expected %f, got %f",
|
||||||
"Floor(%.1f), expected %.1f, got %.1f", edge_cases[i],
|
INFINITY, INFINITY, result);
|
||||||
edge_cases[i], result);
|
result = SDL_floor(-INFINITY);
|
||||||
}
|
SDLTest_AssertCheck(-INFINITY == result, "Floor(%f), expected %f, got %f",
|
||||||
|
-INFINITY, -INFINITY, result);
|
||||||
|
|
||||||
|
result = SDL_floor(0.0);
|
||||||
|
SDLTest_AssertCheck(0.0 == result, "Floor(%.1f), expected %.1f, got %.1f",
|
||||||
|
0.0, 0.0, result);
|
||||||
|
result = SDL_floor(-0.0);
|
||||||
|
SDLTest_AssertCheck(-0.0 == result, "Floor(%.1f), expected %.1f, got %.1f",
|
||||||
|
-0.0, -0.0, result);
|
||||||
|
|
||||||
return TEST_COMPLETED;
|
return TEST_COMPLETED;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue