diff options
author | Rajalakshmi Srinivasaraghavan <raji@linux.vnet.ibm.com> | 2016-08-30 11:43:21 +0530 |
---|---|---|
committer | Gabriel F. T. Gomes <gftg@linux.vnet.ibm.com> | 2016-10-25 17:05:47 -0200 |
commit | bf5eea32ac456b68ede40ee99031b0cd7726bcdd (patch) | |
tree | 4d3276ac9c5455bf994b7fa7def7ef5e6867070d /stdlib/tst-strtod-round-skeleton.c | |
parent | 6962682ffe5e5f0373047a0b894fee7a774be254 (diff) | |
download | glibc-bf5eea32ac456b68ede40ee99031b0cd7726bcdd.tar.gz glibc-bf5eea32ac456b68ede40ee99031b0cd7726bcdd.tar.xz glibc-bf5eea32ac456b68ede40ee99031b0cd7726bcdd.zip |
Refactor strtod tests
This patch changes strtod* tests to use strfrom* functions.
Diffstat (limited to 'stdlib/tst-strtod-round-skeleton.c')
-rw-r--r-- | stdlib/tst-strtod-round-skeleton.c | 24 |
1 files changed, 11 insertions, 13 deletions
diff --git a/stdlib/tst-strtod-round-skeleton.c b/stdlib/tst-strtod-round-skeleton.c index 1853c529c2..2e99dbdc21 100644 --- a/stdlib/tst-strtod-round-skeleton.c +++ b/stdlib/tst-strtod-round-skeleton.c @@ -58,11 +58,11 @@ /* Generator to create an FTYPE member variabled named FSUF used to populate struct member variables. */ -#define FTYPE_MEMBER(FSUF, FTYPE, FTOSTR, FTOSTRM, LSUF, CSUF) \ +#define FTYPE_MEMBER(FSUF, FTYPE, FTOSTR, LSUF, CSUF) \ FTYPE FSUF; /* Likewise, but each member is of type bool. */ -#define BOOL_MEMBER(FSUF, FTYPE, FTOSTR, FTOSTRM, LSUF, CSUF) \ +#define BOOL_MEMBER(FSUF, FTYPE, FTOSTR, LSUF, CSUF) \ bool FSUF; #define STRUCT_FOREACH_FLOAT_FTYPE GEN_TEST_STRTOD_FOREACH (FTYPE_MEMBER) @@ -96,13 +96,13 @@ /* long double is special, and handled above. */ /* Selector for expected result field of a given type. */ -#define _ENTRY(FSUF, FTYPE, FTOSTR, FTOSTRM, LSUF, CSUF, ...) \ +#define _ENTRY(FSUF, FTYPE, FTOSTR, LSUF, CSUF, ...) \ CONCAT (CHOOSE_ ## FSUF (__VA_ARGS__), LSUF), #define ENTRY(...) \ GEN_TEST_STRTOD_FOREACH (_ENTRY, __VA_ARGS__) /* Selector for boolean exact tag of expected results. */ -#define _XNTRY(FSUF, FTYPE, FTOSTR, FTOSTRM, LSUF, CSUF, ...) \ +#define _XNTRY(FSUF, FTYPE, FTOSTR, LSUF, CSUF, ...) \ CHOOSE_ ## FSUF (__VA_ARGS__), #define XNTRY(...) \ GEN_TEST_STRTOD_FOREACH (_XNTRY, __VA_ARGS__) @@ -157,21 +157,19 @@ struct test { #define STR(x) STRX (x) #define FNPFXS STR (FNPFX) -#define GEN_ONE_TEST(FSUF, FTYPE, FTOSTR, FTOSTRM, LSUF, CSUF) \ +#define GEN_ONE_TEST(FSUF, FTYPE, FTOSTR, LSUF, CSUF) \ { \ FTYPE f = STRTO (FSUF) (s, NULL); \ if (f != expected->FSUF \ || (copysign ## CSUF) (1.0 ## LSUF, f) \ != (copysign ## CSUF) (1.0 ## LSUF, expected->FSUF)) \ { \ - CHAR efstr[FSTRLENMAX]; \ - CHAR fstr[FSTRLENMAX]; \ - FTOSTR (efstr, FSTRLENMAX, L_("%") L_(FTOSTRM) L_("a"), \ - expected->FSUF); \ - FTOSTR (fstr, FSTRLENMAX, L_("%") L_(FTOSTRM) L_("a"), f);\ - printf (FNPFXS "to" #FSUF " (" STRM ") returned " STRM \ - " not " STRM " (%s)\n", \ - s, fstr, efstr, mode_name); \ + char efstr[FSTRLENMAX]; \ + char fstr[FSTRLENMAX]; \ + FTOSTR (efstr, FSTRLENMAX, "%a", expected->FSUF); \ + FTOSTR (fstr, FSTRLENMAX, "%a", f); \ + printf (FNPFXS "to" #FSUF " (" STRM ") returned %s not " \ + "%s (%s)\n", s, fstr, efstr, mode_name); \ if (ROUNDING_TESTS (FTYPE, rnd_mode) || exact->FSUF) \ result = 1; \ else \ |