From 474c8d0073b0fb4b14b65b79c7e620db1332e4f3 Mon Sep 17 00:00:00 2001
From: Anonymous Maarten <[EMAIL REDACTED]>
Date: Sun, 27 Aug 2023 23:42:23 +0200
Subject: [PATCH] testautomation: don't do float equality tests
---
test/testautomation_math.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/test/testautomation_math.c b/test/testautomation_math.c
index 1f92a1d1e334..07a5c5a9902b 100644
--- a/test/testautomation_math.c
+++ b/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);