diff options
Diffstat (limited to 'stdlib/tst-strtod-nan-locale-main.c')
-rw-r--r-- | stdlib/tst-strtod-nan-locale-main.c | 36 |
1 files changed, 18 insertions, 18 deletions
diff --git a/stdlib/tst-strtod-nan-locale-main.c b/stdlib/tst-strtod-nan-locale-main.c index 8044dad89f..8222174a59 100644 --- a/stdlib/tst-strtod-nan-locale-main.c +++ b/stdlib/tst-strtod-nan-locale-main.c @@ -23,6 +23,8 @@ #include <stdlib.h> #include <wchar.h> +#include <stdlib/tst-strtod.h> + #define STR_(X) #X #define STR(X) STR_(X) #define FNPFXS STR (FNPFX) @@ -30,20 +32,22 @@ #define CONCAT(X, Y) CONCAT_ (X, Y) #define FNX(FN) CONCAT (FNPFX, FN) -#define TEST(LOC, STR, FN, TYPE) \ - do \ +#define TEST_STRTOD(FSUF, FTYPE, FTOSTR, LSUF, CSUF) \ +static int \ +test_strto ## FSUF (const char * loc, CHAR * s) \ +{ \ + CHAR *ep; \ + FTYPE val = FNX (FSUF) (s, &ep); \ + if (isnan (val) && *ep == 0) \ + printf ("PASS: %s: " FNPFXS #FSUF " (" SFMT ")\n", loc, s); \ + else \ { \ - CHAR *ep; \ - TYPE val = FNX (FN) (STR, &ep); \ - if (isnan (val) && *ep == 0) \ - printf ("PASS: %s: " FNPFXS #FN " (" SFMT ")\n", LOC, STR); \ - else \ - { \ - printf ("FAIL: %s: " FNPFXS #FN " (" SFMT ")\n", LOC, STR); \ - result = 1; \ - } \ + printf ("FAIL: %s: " FNPFXS #FSUF " (" SFMT ")\n", loc, s); \ + return 1; \ } \ - while (0) + return 0; \ +} +GEN_TEST_STRTOD_FOREACH (TEST_STRTOD) static int test_one_locale (const char *loc) @@ -64,13 +68,9 @@ test_one_locale (const char *loc) s[4] = L_('A') + i - 10; s[5] = L_(')'); s[6] = 0; - TEST (loc, s, f, float); - TEST (loc, s, d, double); - TEST (loc, s, ld, long double); + result |= STRTOD_TEST_FOREACH (test_strto, loc, s); s[4] = L_('a') + i - 10; - TEST (loc, s, f, float); - TEST (loc, s, d, double); - TEST (loc, s, ld, long double); + result |= STRTOD_TEST_FOREACH (test_strto, loc, s); } return result; } |