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