PowerPC: Fix -Wundef warning for __PTHREAD_MUTEX_HAVE_ELISION.
[glibc.git] / stdlib / tst-strtod4.c
blob2d9d54c944dccb23a11ae6d1a87977afac13d21a
1 #include <locale.h>
2 #include <stdio.h>
3 #include <stdlib.h>
4 #include <string.h>
6 #define NBSP "\xc2\xa0"
8 static const struct
10 const char *in;
11 const char *out;
12 double expected;
13 } tests[] =
15 { "000"NBSP"000"NBSP"000", "", 0.0 },
16 { "1"NBSP"000"NBSP"000,5x", "x", 1000000.5 }
18 #define NTESTS (sizeof (tests) / sizeof (tests[0]))
21 static int
22 do_test (void)
24 if (setlocale (LC_ALL, "cs_CZ.UTF-8") == NULL)
26 puts ("could not set locale");
27 return 1;
30 int status = 0;
32 for (int i = 0; i < NTESTS; ++i)
34 char *ep;
35 double r = __strtod_internal (tests[i].in, &ep, 1);
37 if (strcmp (ep, tests[i].out) != 0)
39 printf ("%d: got rest string \"%s\", expected \"%s\"\n",
40 i, ep, tests[i].out);
41 status = 1;
44 if (r != tests[i].expected)
46 printf ("%d: got wrong results %g, expected %g\n",
47 i, r, tests[i].expected);
48 status = 1;
52 return status;
55 #define TEST_FUNCTION do_test ()
56 #include "../test-skeleton.c"