aarch64: Use an ifunc/VDSO to implement gettimeofday in shared glibc.
[glibc.git] / stdlib / tst-strtod6.c
blob9bfbdc2b38288a40be75e8dc60421b92a21a8d22
1 #include <math.h>
2 #include <stdio.h>
3 #include <stdlib.h>
4 #include <string.h>
6 #include "tst-strtod.h"
8 #define TEST_STRTOD(FSUF, FTYPE, FTOSTR, LSUF, CSUF) \
9 static int \
10 test_strto ## FSUF (const char str[]) \
11 { \
12 char *endp; \
13 int result = 0; \
14 puts (str); \
15 FTYPE d = strto ## FSUF (str, &endp); \
16 if (!isnan (d)) \
17 { \
18 puts ("strto" #FSUF " did not return NAN"); \
19 result = 1; \
20 } \
21 if (issignaling (d)) \
22 { \
23 puts ("strto" #FSUF " returned a sNAN"); \
24 result = 1; \
25 } \
26 if (strcmp (endp, "something") != 0) \
27 { \
28 puts ("strto" #FSUF " set incorrect end pointer"); \
29 result = 1; \
30 } \
31 return result; \
34 GEN_TEST_STRTOD_FOREACH (TEST_STRTOD);
36 static int
37 do_test (void)
39 int result = 0;
41 result |= STRTOD_TEST_FOREACH (test_strto, "NaN(blabla)something");
42 result |= STRTOD_TEST_FOREACH (test_strto, "NaN(1234)something");
43 /* UINT32_MAX. */
44 result |= STRTOD_TEST_FOREACH (test_strto, "NaN(4294967295)something");
45 /* UINT64_MAX. */
46 result |= STRTOD_TEST_FOREACH (test_strto,
47 "NaN(18446744073709551615)something");
48 /* The case of zero is special in that "something" has to be done to make the
49 mantissa different from zero, which would mean infinity instead of
50 NaN. */
51 result |= STRTOD_TEST_FOREACH (test_strto, "NaN(0)something");
53 return result;
56 #define TEST_FUNCTION do_test ()
57 #include "../test-skeleton.c"