* sysdeps/unix/sysv/linux/sparc/bits/shm.h: Define SHM_NORESERVE.
[glibc.git] / localedata / tests-mbwc / tst_wcstod.c
blob1648d353979b80e2e883d40f8fd47e5c4a86bbdd
1 /*
2 WCSTOD: double wcstod (wchar_t *np, const wchar_t **endp);
3 */
5 #define TST_FUNCTION wcstod
7 #include "tsp_common.c"
8 #include "dat_wcstod.c"
10 int
11 tst_wcstod (FILE * fp, int debug_flg)
13 TST_DECL_VARS (double);
14 wchar_t *np, *endp, fwc;
15 double val;
17 TST_DO_TEST (wcstod)
19 TST_HEAD_LOCALE (wcstod, S_WCSTOD);
20 TST_DO_REC (wcstod)
22 TST_GET_ERRET (wcstod);
23 np = TST_INPUT (wcstod).np;
25 TST_CLEAR_ERRNO;
26 ret = wcstod (np, &endp);
27 TST_SAVE_ERRNO;
29 if (debug_flg)
31 fprintf (stdout, "wcstod() [ %s : %d ] ret = %f\n", locale,
32 rec + 1, ret);
33 fprintf (stdout, " *endp = 0x%lx\n",
34 (unsigned long int) *endp);
37 TST_IF_RETURN (S_WCSTOD)
39 if (ret != 0)
41 val = ret - TST_EXPECT (wcstod).val;
42 if (TST_ABS (val) < TST_DBL_EPS)
44 Result (C_SUCCESS, S_WCSTOD, CASE_3, MS_PASSED);
46 else
48 err_count++;
49 Result (C_FAILURE, S_WCSTOD, CASE_3, "return value is wrong");
54 fwc = TST_EXPECT (wcstod).fwc;
56 if (fwc == *endp)
58 Result (C_SUCCESS, S_WCSTOD, CASE_4, MS_PASSED);
60 else
62 err_count++;
63 Result (C_FAILURE, S_WCSTOD, CASE_4, "a final wc is wrong.");
68 return err_count;