Fix guards for qecvt
[platform/upstream/glibc.git] / stdlib / tst-strtod6.c
1 #include <math.h>
2 #include <stdio.h>
3 #include <stdlib.h>
4 #include <string.h>
5
6 static int
7 do_test (void)
8 {
9   static const char str[] = "NaN(blabla)something";
10   char *endp;
11   int result = 0;
12
13   double d = strtod (str, &endp);
14   if (!isnan (d))
15     {
16       puts ("strtod did not return NAN");
17       result = 1;
18     }
19   if (issignaling (d))
20     {
21       puts ("strtod returned a sNAN");
22       result = 1;
23     }
24   if (strcmp (endp, "something") != 0)
25     {
26       puts  ("strtod set incorrect end pointer");
27       result = 1;
28     }
29
30   float f = strtof (str, &endp);
31   if (!isnanf (f))
32     {
33       puts ("strtof did not return NAN");
34       result = 1;
35     }
36   if (issignaling (f))
37     {
38       puts ("strtof returned a sNAN");
39       result = 1;
40     }
41   if (strcmp (endp, "something") != 0)
42     {
43       puts  ("strtof set incorrect end pointer");
44       result = 1;
45     }
46
47   long double ld = strtold (str, &endp);
48   if (!isnan (ld))
49     {
50       puts ("strtold did not return NAN");
51       result = 1;
52     }
53   if (issignaling (ld))
54     {
55       puts ("strtold returned a sNAN");
56       result = 1;
57     }
58   if (strcmp (endp, "something") != 0)
59     {
60       puts  ("strtold set incorrect end pointer");
61       result = 1;
62     }
63
64   return result;
65 }
66
67 #define TEST_FUNCTION do_test ()
68 #include "../test-skeleton.c"