aboutsummaryrefslogtreecommitdiff
path: root/stdlib/tst-strtod6.c
diff options
context:
space:
mode:
Diffstat (limited to 'stdlib/tst-strtod6.c')
-rw-r--r--stdlib/tst-strtod6.c24
1 files changed, 22 insertions, 2 deletions
diff --git a/stdlib/tst-strtod6.c b/stdlib/tst-strtod6.c
index 1d87266..15e79fd 100644
--- a/stdlib/tst-strtod6.c
+++ b/stdlib/tst-strtod6.c
@@ -4,12 +4,13 @@
#include <string.h>
static int
-do_test (void)
+test (const char str[])
{
- static const char str[] = "NaN(blabla)something";
char *endp;
int result = 0;
+ puts (str);
+
double d = strtod (str, &endp);
if (!isnan (d))
{
@@ -64,5 +65,24 @@ do_test (void)
return result;
}
+static int
+do_test (void)
+{
+ int result = 0;
+
+ result |= test ("NaN(blabla)something");
+ result |= test ("NaN(1234)something");
+ /* UINT32_MAX. */
+ result |= test ("NaN(4294967295)something");
+ /* UINT64_MAX. */
+ result |= test ("NaN(18446744073709551615)something");
+ /* The case of zero is special in that "something" has to be done to make the
+ mantissa different from zero, which would mean infinity instead of
+ NaN. */
+ result |= test ("NaN(0)something");
+
+ return result;
+}
+
#define TEST_FUNCTION do_test ()
#include "../test-skeleton.c"