1 | /* |
2 | WCSCHR: wchar_t *wcschr (wchar_t *ws, wchar_t wc); |
3 | */ |
4 | |
5 | #define TST_FUNCTION wcschr |
6 | |
7 | #include "tsp_common.c" |
8 | #include "dat_wcschr.c" |
9 | |
10 | int |
11 | tst_wcschr (FILE * fp, int debug_flg) |
12 | { |
13 | TST_DECL_VARS (wchar_t *); |
14 | wchar_t *ws, wc; |
15 | |
16 | TST_DO_TEST (wcschr) |
17 | { |
18 | TST_HEAD_LOCALE (wcschr, S_WCSCHR); |
19 | TST_DO_REC (wcschr) |
20 | { |
21 | TST_GET_ERRET (wcschr); |
22 | ws = TST_INPUT (wcschr).ws; /* external value: size WCSSIZE */ |
23 | wc = TST_INPUT (wcschr).wc; |
24 | ret = wcschr (ws, wc); |
25 | |
26 | if (debug_flg) |
27 | { |
28 | if (ret) |
29 | { |
30 | fprintf (stderr, "wcschr: ret = 0x%lx\n" , |
31 | (unsigned long int) *ret); |
32 | } |
33 | else |
34 | { |
35 | fprintf (stderr, "wcschr: ret = NULL pointer\n" ); |
36 | } |
37 | } |
38 | |
39 | TST_IF_RETURN (S_WCSCHR) |
40 | { |
41 | if (ret == NULL) |
42 | { |
43 | if (debug_flg) |
44 | { |
45 | fprintf (stderr, "*** Warning *** tst_wcschr: " |
46 | "set ret_flg=1 to check NULL return value\n" ); |
47 | } |
48 | |
49 | Result (C_INVALID, S_WCSCHR, CASE_3, "(check the test data) " |
50 | "set ret_flg=1 to check NULL return value" ); |
51 | continue; |
52 | } |
53 | |
54 | if (*ret == wc) |
55 | { |
56 | Result (C_SUCCESS, S_WCSCHR, CASE_3, MS_PASSED); |
57 | } |
58 | else |
59 | { |
60 | err_count++; |
61 | Result (C_FAILURE, S_WCSCHR, CASE_3, |
62 | "the returned address of the string seems to be wrong" ); |
63 | } |
64 | } |
65 | } |
66 | } |
67 | |
68 | return err_count; |
69 | } |
70 | |