m68k: update libm test ULPs
[glibc.git] / stdlib / bug-strtod2.c
bloba1f037cdc8d611b1dabf74cbfad7b36649f0ccce
1 #include <locale.h>
2 #include <math.h>
3 #include <stdio.h>
4 #include <stdlib.h>
6 static const char *tests[] =
8 "inf", "Inf", "iNf", "inF", "INf", "iNF", "INF", "InF",
9 "infinity", "Infinity", "InfInity", "INFINITY"
11 #define ntests (sizeof (tests) / sizeof (tests[0]))
13 static int
14 do_test (void)
16 /* The Turkish locale is notorious because tolower() maps 'I' to the
17 dotless lowercase 'i' and toupper() maps 'i' to an 'I' with a dot
18 above. */
19 if (setlocale (LC_ALL, "tr_TR.UTF-8") == NULL)
21 puts ("cannot set locale");
22 return 0;
25 int res = 0;
26 for (int i = 0; i < ntests; ++i)
28 char *endp;
29 double d = strtod (tests[i], &endp);
30 if (*endp != '\0')
32 printf ("did not consume all of '%s'\n", tests[i]);
33 res = 1;
35 if (!isinf (d))
37 printf ("'%s' does not pass isinf\n", tests[i]);
38 res = 1;
42 return res;
45 #define TEST_FUNCTION do_test ()
46 #include "../test-skeleton.c"