2.9
[glibc/nacl-glibc.git] / localedata / tests-mbwc / tst_wcscat.c
blob3dc98091c23e60bb99409aa05f65358f8e735018
1 /*
2 WCSCAT: wchar_t *wcscat (wchar_t *ws1, const wchar_t *ws2);
3 */
5 #define TST_FUNCTION wcscat
7 #include "tsp_common.c"
8 #include "dat_wcscat.c"
10 int
11 tst_wcscat (FILE * fp, int debug_flg)
13 TST_DECL_VARS (wchar_t *);
14 wchar_t *ws1, *ws2, *ws_ex;
15 int i, err;
17 TST_DO_TEST (wcscat)
19 TST_HEAD_LOCALE (wcscat, S_WCSCAT);
20 TST_DO_REC (wcscat)
22 TST_GET_ERRET (wcscat);
23 ws1 = TST_INPUT (wcscat).ws1; /* external value: size WCSSIZE */
24 ws2 = TST_INPUT (wcscat).ws2;
26 TST_CLEAR_ERRNO;
27 ret = wcscat (ws1, ws2);
28 TST_SAVE_ERRNO;
30 TST_IF_RETURN (S_WCSCAT)
32 if (ret == ws1)
34 Result (C_SUCCESS, S_WCSCAT, CASE_3, MS_PASSED);
36 else
38 err_count++;
39 Result (C_FAILURE, S_WCSCAT, CASE_3,
40 "the return address may not be correct");
44 /* function specific test cases here */
46 if (ret == ws1)
48 ws_ex = TST_EXPECT (wcscat).ws;
49 for (err = 0, i = 0;
50 (ws1[i] != 0L || ws_ex[i] != 0L) && i < WCSSIZE; i++)
52 if (debug_flg)
54 fprintf (stdout, "tst_wcscat() : ws1[%d] = 0x%lx\n", i,
55 (unsigned long int) ws1[i]);
58 if (ws1[i] != ws_ex[i])
60 err++;
61 err_count++;
62 Result (C_FAILURE, S_WCSCAT, CASE_4,
63 "concatinated string is different from an "
64 "expected string");
65 break;
69 if (!err)
71 Result (C_SUCCESS, S_WCSCAT, CASE_4, MS_PASSED);
77 return err_count;