]> rtime.felk.cvut.cz Git - l4.git/blob - l4/pkg/uclibc/lib/contrib/uclibc/test/locale-mbwc/tst_wcschr.c
update
[l4.git] / l4 / pkg / uclibc / lib / contrib / uclibc / test / locale-mbwc / tst_wcschr.c
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             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;
53           }
54
55         if (*ret == wc)
56           {
57             Result (C_SUCCESS, S_WCSCHR, CASE_3, MS_PASSED);
58           }
59         else
60           {
61             err_count++;
62             Result (C_FAILURE, S_WCSCHR, CASE_3,
63                     "the returned address of the string seems to be wrong");
64           }
65       }
66     }
67   }
68
69   return err_count;
70 }