Mention more bugs which are fixed.
[glibc.git] / localedata / tests-mbwc / tst_wcsstr.c
blobf8b00c4b75d9439a381bf22d29890cb73d57b802
1 /*
2 WCSSTR: wchar_t *wcsstr (const wchar_t *ws1, const wchar_t *ws2);
3 */
5 #define TST_FUNCTION wcsstr
7 #include "tsp_common.c"
8 #include "dat_wcsstr.c"
10 int
11 tst_wcsstr (FILE * fp, int debug_flg)
13 TST_DECL_VARS (wchar_t *);
14 wchar_t *ws1, *ws2;
15 int err, i;
17 TST_DO_TEST (wcsstr)
19 TST_HEAD_LOCALE (wcsstr, S_WCSSTR);
20 TST_DO_REC (wcsstr)
22 TST_GET_ERRET (wcsstr);
23 ws1 = TST_INPUT (wcsstr).ws1;
24 ws2 = TST_INPUT (wcsstr).ws2; /* external value: size WCSSIZE */
25 ret = wcsstr (ws1, ws2);
27 if (debug_flg)
29 fprintf (stderr, "wcsstr: %d : ret = %s\n", rec + 1,
30 (ret == NULL) ? "null" : "not null");
31 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]);
39 TST_IF_RETURN (S_WCSSTR)
41 if (ws2[0] == 0)
43 if (ret == ws1)
45 Result (C_SUCCESS, S_WCSSTR, CASE_3, MS_PASSED);
47 else
49 err_count++;
50 Result (C_FAILURE, S_WCSSTR, CASE_3,
51 "return address is not same address as ws1");
54 continue;
57 for (i = 0, err = 0; *(ws2 + i) != 0 && i < WCSSIZE; i++)
59 if (debug_flg)
61 fprintf (stderr,
62 " : ret[ %d ] = 0x%lx <-> 0x%lx = ws2[ %d ]\n",
63 i, (unsigned long int) ret[i],
64 (unsigned long int) ws2[i], i);
67 if (ret[i] != ws2[i])
69 err++;
70 err_count++;
71 Result (C_FAILURE, S_WCSSTR, CASE_4, "pointed sub-string is "
72 "different from an expected sub-string");
73 break;
77 if (!err)
79 Result (C_SUCCESS, S_WCSSTR, CASE_4, MS_PASSED);
85 return err_count;