소스 검색

testautomation: don't do float equality tests

Anonymous Maarten 2 년 전
부모
커밋
474c8d0073
1개의 변경된 파일2개의 추가작업 그리고 2개의 파일을 삭제
  1. 2 2
      test/testautomation_math.c

+ 2 - 2
test/testautomation_math.c

@@ -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,
+        SDLTest_AssertCheck((result - cases[i].expected) < FLT_EPSILON,
                             "%s(%f), expected %f, got %f",
                             func_name,
                             cases[i].input,
@@ -1139,7 +1139,7 @@ log_baseCases(void *args)
                         1.0, 0.0, result);
 
     result = SDL_log(EULER);
-    SDLTest_AssertCheck(1.0 == result,
+    SDLTest_AssertCheck((result - 1.) < FLT_EPSILON,
                         "Log(%f), expected %f, got %f",
                         EULER, 1.0, result);