Convert _Complex cosine functions to generated code
[glibc.git] / stdlib / tst-strtod2.c
bloba7df82ebbde14c5f624d4fdf397ee00ec218e122
1 #include <stdio.h>
2 #include <stdlib.h>
4 struct test
6 const char *str;
7 double result;
8 size_t offset;
9 } tests[] =
11 { "0xy", 0.0, 1 },
12 { "0x.y", 0.0, 1 },
13 { "0x0.y", 0.0, 4 },
14 { "0x.0y", 0.0, 4 },
15 { ".y", 0.0, 0 },
16 { "0.y", 0.0, 2 },
17 { ".0y", 0.0, 2 }
20 static int
21 do_test (void)
23 int status = 0;
24 for (size_t i = 0; i < sizeof (tests) / sizeof (tests[0]); ++i)
26 char *ep;
27 double r = strtod (tests[i].str, &ep);
28 if (r != tests[i].result)
30 printf ("test %zu r = %g, expect %g\n", i, r, tests[i].result);
31 status = 1;
33 if (ep != tests[i].str + tests[i].offset)
35 printf ("test %zu strtod parsed %tu characters, expected %zu\n",
36 i, ep - tests[i].str, tests[i].offset);
37 status = 1;
40 return status;
43 #define TEST_FUNCTION do_test ()
44 #include "../test-skeleton.c"