1/*
2 WCSPBRK: wchar_t *wcspbrk (const wchar_t *ws1, const wchar_t *ws2);
3*/
4
5#define TST_FUNCTION wcspbrk
6
7#include "tsp_common.c"
8#include "dat_wcspbrk.c"
9
10int
11tst_wcspbrk (FILE * fp, int debug_flg)
12{
13 TST_DECL_VARS (wchar_t *);
14 wchar_t *ws1, *ws2;
15 int err;
16 wchar_t wc_ex;
17
18 TST_DO_TEST (wcspbrk)
19 {
20 TST_HEAD_LOCALE (wcspbrk, S_WCSPBRK);
21 TST_DO_REC (wcspbrk)
22 {
23 TST_GET_ERRET (wcspbrk);
24 ws1 = TST_INPUT (wcspbrk).ws1;
25 ws2 = TST_INPUT (wcspbrk).ws2;
26
27 ret = wcspbrk (ws1, ws2);
28
29 if (debug_flg)
30 {
31 fprintf (stdout, "wcspbrk() [ %s : %d ] ret = %s\n", locale,
32 rec + 1, (ret == NULL) ? "null" : "not null");
33 if (ret)
34 fprintf (stderr,
35 " ret[0] = 0x%lx : 0x%lx = ws2[0]\n",
36 (unsigned long int) ret[0], (unsigned long int) ws2[0]);
37 }
38
39 TST_IF_RETURN (S_WCSPBRK)
40 {
41 if (ws2[0] == 0)
42 {
43 if (ret == ws1)
44 {
45 Result (C_SUCCESS, S_WCSPBRK, CASE_3, MS_PASSED);
46 }
47 else
48 {
49 err_count++;
50 Result (C_FAILURE, S_WCSPBRK, CASE_3,
51 "return address is not same address as ws1");
52 }
53
54 continue;
55 }
56
57 wc_ex = TST_EXPECT (wcspbrk).wc;
58
59 if (debug_flg)
60 fprintf (stdout,
61 " *ret = 0x%lx <-> 0x%lx = wc_ex\n",
62 (unsigned long int) *ret, (unsigned long int) wc_ex);
63
64 if (*ret != wc_ex)
65 {
66 err++;
67 err_count++;
68 Result (C_FAILURE, S_WCSPBRK, CASE_4, "the pointed wc is "
69 "different from an expected wc");
70 }
71 else
72 {
73 Result (C_SUCCESS, S_WCSPBRK, CASE_4, MS_PASSED);
74 }
75 }
76 }
77 }
78
79 return err_count;
80}
81

source code of glibc/localedata/tests-mbwc/tst_wcspbrk.c