]> Savannah Git Hosting - gnulib.git/commitdiff
strtof, strtod, strtold tests: Strengthen tests.
authorBruno Haible <bruno@clisp.org>
Tue, 23 Jul 2024 18:16:22 +0000 (20:16 +0200)
committerBruno Haible <bruno@clisp.org>
Tue, 23 Jul 2024 18:19:11 +0000 (20:19 +0200)
* 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.

ChangeLog
tests/test-strtod.h
tests/test-strtof.h
tests/test-strtold.h

index a69e600c547fa88b6835aea2e56ca4e454af4dbf..73d70911a137c03e4c7b6d123f6d3c6e8bf97b6d 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2024-07-23  Bruno Haible  <bruno@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.
+
 2024-07-23  Bruno Haible  <bruno@clisp.org>
 
        doc: Update for glibc 2.40.
index 211d9230c74636ab8dd26274f69542ab1a96d41f..fa1170defc689fa9e0d0cb01fe7b4e99a58f7a43 100644 (file)
@@ -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 */
index fd04f07873e9a8d41e64449befaa4c10cb589607..8ff4aa8f8b65cf4ed40c0d5a933cc1967af3a1cc 100644 (file)
@@ -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 */
index a872f8a882420aa47a1738f9e895186d49877780..580701dcc9acf00ad735163ff8fbb3d2837d181e 100644 (file)
@@ -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 */