Silence warnings.
[glibc/history.git] / localedata / tests-mbwc / tst_wcstok.c
blob1222b97855dca8b91632f470cd05b467edce8583
1 /*
2 WCSTOK: wchar_t *wcstok (wchar_t *ws, const wchar_t *dlm, wchar_t **pt);
3 */
6 #define TST_FUNCTION wcstok
8 #include "tsp_common.c"
9 #include "dat_wcstok.c"
11 int
12 tst_wcstok (FILE * fp, int debug_flg)
14 TST_DECL_VARS (wchar_t *);
15 char w_flg;
16 wchar_t *ws;
17 wchar_t *dt, *pt;
18 wchar_t *ws_ex;
19 int err, i;
21 TST_DO_TEST (wcstok)
23 TST_HEAD_LOCALE (wcstok, S_WCSTOK);
24 TST_DO_REC (wcstok)
26 TST_DO_SEQ (WCSTOK_SEQNUM)
28 TST_GET_ERRET_SEQ (wcstok);
29 w_flg = TST_INPUT_SEQ (wcstok).w_flg;
30 ws = (w_flg) ? TST_INPUT_SEQ (wcstok).ws : NULL;
31 dt = TST_INPUT_SEQ (wcstok).dt;
33 ret = wcstok (ws, dt, &pt);
35 if (debug_flg)
37 fprintf (stdout, "wcstok() [ %s : %d : %d ] *ret = 0x%lx\n",
38 locale, rec + 1, seq_num + 1, (unsigned long int) *ret);
39 if (pt && *pt)
41 fprintf (stdout, " *pt = 0x%lx\n",
42 (unsigned long int) *pt);
46 TST_IF_RETURN (S_WCSTOK)
50 if (ret != NULL)
52 ws_ex = TST_EXPECT_SEQ (wcstok).ws;
54 /* XXX: REVISIT : insufficient conditions */
55 for (err = 0, i = 0; i < WCSSIZE; i++)
57 if (ret[i] == L'\0' && ws_ex[i] == L'\0')
59 break;
62 if (debug_flg)
64 fprintf (stderr,
65 " ret[%d] = 0x%lx <-> "
66 "0x%lx = ws_ex[%d]\n",
67 i, (unsigned long int) ret[i],
68 (unsigned long int) ws_ex[i], i);
71 if (ret[i] != ws_ex[i])
73 err++;
74 err_count++;
75 Result (C_FAILURE, S_WCSTOK, CASE_3,
76 "the token is different from an expected string");
77 break;
80 if (ret[i] == L'\0' || ws_ex[i] == L'\0')
82 break;
86 if (!err)
88 Result (C_SUCCESS, S_WCSTOK, CASE_3, MS_PASSED);
95 return err_count;