And some more unit test tweak:

2024-07-23  Bruno Haible  <br...@clisp.org>

        strtof, strtod, strtold tests: Strengthen tests.
        * tests/test-strtof.h (test_function): Strengthen the flush-to-zero
        underflow tests.
        * tests/test-strtod.h (test_function): Likewise.
        * tests/test-strtold.h (test_function): Likewise.

diff --git a/tests/test-strtod.h b/tests/test-strtod.h
index 211d9230c7..fa1170defc 100644
--- a/tests/test-strtod.h
+++ b/tests/test-strtod.h
@@ -546,7 +546,11 @@ test_function (double (*my_strtod) (const char *, char **))
     double result;
     errno = 0;
     result = my_strtod (input, &ptr);
+#if 1
+    ASSERT (result == 0.0);
+#else /* This is all that ISO C guarantees.  */
     ASSERT (0.0 <= result && result <= DBL_MIN);
+#endif
     ASSERT (!signbit (result));
     ASSERT (ptr == input + 9);
     ASSERT (errno == ERANGE);
@@ -557,7 +561,11 @@ test_function (double (*my_strtod) (const char *, char **))
     double result;
     errno = 0;
     result = my_strtod (input, &ptr);
+#if 1
+    ASSERT (result == 0.0);
+#else /* This is all that ISO C guarantees.  */
     ASSERT (-DBL_MIN <= result && result <= 0.0);
+#endif
     /* Negative underflow.  Expect a negative sign, although POSIX allows +0.0.
        See also <https://sourceware.org/bugzilla/show_bug.cgi?id=5995>.  */
     ASSERT (!!signbit (result) == !!signbit (minus_zerod)); /* glibc-2.3.6, 
mingw */
diff --git a/tests/test-strtof.h b/tests/test-strtof.h
index fd04f07873..8ff4aa8f8b 100644
--- a/tests/test-strtof.h
+++ b/tests/test-strtof.h
@@ -546,7 +546,11 @@ test_function (float (*my_strtof) (const char *, char **))
     float result;
     errno = 0;
     result = my_strtof (input, &ptr);
+#if 1
+    ASSERT (result == 0.0f);
+#else /* This is all that ISO C guarantees.  */
     ASSERT (0.0f <= result && result <= FLT_MIN);
+#endif
     ASSERT (!signbit (result));
     ASSERT (ptr == input + 9);
     ASSERT (errno == ERANGE);
@@ -557,7 +561,11 @@ test_function (float (*my_strtof) (const char *, char **))
     float result;
     errno = 0;
     result = my_strtof (input, &ptr);
+#if 1
+    ASSERT (result == 0.0f);
+#else /* This is all that ISO C guarantees.  */
     ASSERT (-FLT_MIN <= result && result <= 0.0f);
+#endif
     /* Negative underflow.  Expect a negative sign, although POSIX allows 
+0.0f.
        See also <https://sourceware.org/bugzilla/show_bug.cgi?id=5995>.  */
     ASSERT (!!signbit (result) == !!signbit (minus_zerof)); /* glibc-2.3.6, 
mingw */
diff --git a/tests/test-strtold.h b/tests/test-strtold.h
index a872f8a882..580701dcc9 100644
--- a/tests/test-strtold.h
+++ b/tests/test-strtold.h
@@ -554,7 +554,11 @@ test_function (long double (*my_strtold) (const char *, 
char **))
     long double result;
     errno = 0;
     result = my_strtold (input, &ptr);
+#if 1
+    ASSERT (result == 0.0L);
+#else /* This is all that ISO C guarantees.  */
     ASSERT (0.0L <= result && result <= LDBL_MIN);
+#endif
     ASSERT (!signbit (result));
     ASSERT (ptr == input + 9);
     ASSERT (errno == ERANGE);
@@ -565,7 +569,11 @@ test_function (long double (*my_strtold) (const char *, 
char **))
     long double result;
     errno = 0;
     result = my_strtold (input, &ptr);
+#if 1
+    ASSERT (result == 0.0L);
+#else /* This is all that ISO C guarantees.  */
     ASSERT (-LDBL_MIN <= result && result <= 0.0L);
+#endif
     /* Negative underflow.  Expect a negative sign, although POSIX allows 
+0.0L.
        See also <https://sourceware.org/bugzilla/show_bug.cgi?id=5995>.  */
     ASSERT (!!signbit (result) == !!signbit (minus_zerol)); /* glibc-2.3.2, 
Haiku */




Reply via email to