SDL: testautomation_math: Fix misleading log output (58907)

From 58907d2c27a4f0dc96c4046e9a6d821e02449efd Mon Sep 17 00:00:00 2001
From: Simon McVittie <[EMAIL REDACTED]>
Date: Fri, 2 Feb 2024 10:59:21 +0000
Subject: [PATCH] testautomation_math: Fix misleading log output
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

These originally checked for expected ± EPSILON as logged, but since
commit 880c6939 they check for expected ± max_err, where max_err may
need to be greater than EPSILON for very large expected results like
the ones in exp_regularCases().

Also, EPSILON is so small that the default precision of the %f format
(6 decimal places) would never actually have shown its effect, so log
it in scientific notation instead.

Fixes: 880c6939 "testautomation_math: do relative comparison + more precise correct trigonometric values"
Signed-off-by: Simon McVittie <smcv@collabora.com>
---
 test/testautomation_math.c | 10 ++++------
 1 file changed, 4 insertions(+), 6 deletions(-)

diff --git a/test/testautomation_math.c b/test/testautomation_math.c
index 8802ba0f07f8..314d8ba7fd1d 100644
--- a/test/testautomation_math.c
+++ b/test/testautomation_math.c
@@ -117,11 +117,10 @@ helper_dtod_inexact(const char *func_name, d_to_d_func func,
             max_err = -max_err;
         }
         SDLTest_AssertCheck(diff <= max_err,
-                            "%s(%f), expected [%f,%f], got %f",
+                            "%s(%f), expected %f +/- %g, got %f",
                             func_name,
                             cases[i].input,
-                            cases[i].expected - EPSILON,
-                            cases[i].expected + EPSILON,
+                            cases[i].expected, max_err,
                             result);
     }
 
@@ -182,11 +181,10 @@ helper_ddtod_inexact(const char *func_name, dd_to_d_func func,
         }
 
         SDLTest_AssertCheck(diff <= max_err,
-                            "%s(%f,%f), expected [%f,%f], got %f",
+                            "%s(%f,%f), expected %f +/- %g, got %f",
                             func_name,
                             cases[i].x_input, cases[i].y_input,
-                            cases[i].expected - EPSILON,
-                            cases[i].expected + EPSILON,
+                            cases[i].expected, max_err,
                             result);
     }