diff options
author | Zack Weinberg <zackw@panix.com> | 2017-06-08 15:39:03 -0400 |
---|---|---|
committer | Zack Weinberg <zackw@panix.com> | 2017-06-08 15:39:03 -0400 |
commit | 5046dbb4a7eba5eccfd258f92f4735c9ffc8d069 (patch) | |
tree | 4470480d904b65cf14ca524f96f79eca818c3eaf /REORG.TODO/localedata/tests-mbwc/tst_wcstod.c | |
parent | 199fc19d3aaaf57944ef036e15904febe877fc93 (diff) | |
download | glibc-zack/build-layout-experiment.tar.gz |
Prepare for radical source tree reorganization.zack/build-layout-experiment
All top-level files and directories are moved into a temporary storage
directory, REORG.TODO, except for files that will certainly still
exist in their current form at top level when we're done (COPYING,
COPYING.LIB, LICENSES, NEWS, README), all old ChangeLog files (which
are moved to the new directory OldChangeLogs, instead), and the
generated file INSTALL (which is just deleted; in the new order, there
will be no generated files checked into version control).
Diffstat (limited to 'REORG.TODO/localedata/tests-mbwc/tst_wcstod.c')
-rw-r--r-- | REORG.TODO/localedata/tests-mbwc/tst_wcstod.c | 69 |
1 files changed, 69 insertions, 0 deletions
diff --git a/REORG.TODO/localedata/tests-mbwc/tst_wcstod.c b/REORG.TODO/localedata/tests-mbwc/tst_wcstod.c new file mode 100644 index 0000000000..1648d35397 --- /dev/null +++ b/REORG.TODO/localedata/tests-mbwc/tst_wcstod.c @@ -0,0 +1,69 @@ +/* + WCSTOD: double wcstod (wchar_t *np, const wchar_t **endp); +*/ + +#define TST_FUNCTION wcstod + +#include "tsp_common.c" +#include "dat_wcstod.c" + +int +tst_wcstod (FILE * fp, int debug_flg) +{ + TST_DECL_VARS (double); + wchar_t *np, *endp, fwc; + double val; + + TST_DO_TEST (wcstod) + { + TST_HEAD_LOCALE (wcstod, S_WCSTOD); + TST_DO_REC (wcstod) + { + TST_GET_ERRET (wcstod); + np = TST_INPUT (wcstod).np; + + TST_CLEAR_ERRNO; + ret = wcstod (np, &endp); + TST_SAVE_ERRNO; + + if (debug_flg) + { + fprintf (stdout, "wcstod() [ %s : %d ] ret = %f\n", locale, + rec + 1, ret); + fprintf (stdout, " *endp = 0x%lx\n", + (unsigned long int) *endp); + } + + TST_IF_RETURN (S_WCSTOD) + { + if (ret != 0) + { + val = ret - TST_EXPECT (wcstod).val; + if (TST_ABS (val) < TST_DBL_EPS) + { + Result (C_SUCCESS, S_WCSTOD, CASE_3, MS_PASSED); + } + else + { + err_count++; + Result (C_FAILURE, S_WCSTOD, CASE_3, "return value is wrong"); + } + } + } + + fwc = TST_EXPECT (wcstod).fwc; + + if (fwc == *endp) + { + Result (C_SUCCESS, S_WCSTOD, CASE_4, MS_PASSED); + } + else + { + err_count++; + Result (C_FAILURE, S_WCSTOD, CASE_4, "a final wc is wrong."); + } + } + } + + return err_count; +} |