test: Don't accept results that are much less than expected
While looking at the other tests in this file, I noticed that instead of checking for a result in the range of expected ± FLT_EPSILON as I would have expected, these tests would accept any result strictly less than expected + FLT_EPSILON, for example a wrong result that is very large and negative. This is presumably not what was intended, so add the SDL_fabs() that I assume was meant to be here. Fixes: 474c8d00 "testautomation: don't do float equality tests" Signed-off-by: Simon McVittie <smcv@collabora.com>
This commit is contained in:
parent
f1f9e27128
commit
b66dba2a9d
@ -77,7 +77,7 @@ helper_dtod(const char *func_name, d_to_d_func func,
|
||||
Uint32 i;
|
||||
for (i = 0; i < cases_size; i++) {
|
||||
const double result = func(cases[i].input);
|
||||
SDLTest_AssertCheck((result - cases[i].expected) < FLT_EPSILON,
|
||||
SDLTest_AssertCheck(SDL_fabs(result - cases[i].expected) < FLT_EPSILON,
|
||||
"%s(%f), expected %f, got %f",
|
||||
func_name,
|
||||
cases[i].input,
|
||||
@ -1154,7 +1154,7 @@ log_baseCases(void *args)
|
||||
1.0, 0.0, result);
|
||||
|
||||
result = SDL_log(EULER);
|
||||
SDLTest_AssertCheck((result - 1.) < FLT_EPSILON,
|
||||
SDLTest_AssertCheck(SDL_fabs(result - 1.) < FLT_EPSILON,
|
||||
"Log(%f), expected %f, got %f",
|
||||
EULER, 1.0, result);
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user