Future safety in checking ELF header.
[glibc.git] / localedata / tests-mbwc / tst_wcschr.c
blobb57a05a8f9ab1ebd0dbb6108b635e60a453c92cb
1 /*
2 WCSCHR: wchar_t *wcschr (wchar_t *ws, wchar_t wc);
3 */
5 #define TST_FUNCTION wcschr
7 #include "tsp_common.c"
8 #include "dat_wcschr.c"
10 int
11 tst_wcschr (FILE * fp, int debug_flg)
13 TST_DECL_VARS (wchar_t *);
14 wchar_t *ws, wc;
16 TST_DO_TEST (wcschr)
18 TST_HEAD_LOCALE (wcschr, S_WCSCHR);
19 TST_DO_REC (wcschr)
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);
26 if (debug_flg)
28 if (ret)
30 fprintf (stderr, "wcschr: ret = 0x%lx\n",
31 (unsigned long int) *ret);
33 else
35 fprintf (stderr, "wcschr: ret = NULL pointer\n");
39 TST_IF_RETURN (S_WCSCHR)
41 if (ret == NULL)
43 if (debug_flg)
45 fprintf (stderr, "*** Warning *** tst_wcschr: "
46 "set ret_flg=1 to check NULL return value\n");
49 warn_count++;
50 Result (C_INVALID, S_WCSCHR, CASE_3, "(check the test data) "
51 "set ret_flg=1 to check NULL return value");
52 continue;
55 if (*ret == wc)
57 Result (C_SUCCESS, S_WCSCHR, CASE_3, MS_PASSED);
59 else
61 err_count++;
62 Result (C_FAILURE, S_WCSCHR, CASE_3,
63 "the returned address of the string seems to be wrong");
69 return err_count;