1 | /* |
2 | WCSCAT: wchar_t *wcscat (wchar_t *ws1, const wchar_t *ws2); |
3 | */ |
4 | |
5 | #define TST_FUNCTION wcscat |
6 | |
7 | #include "tsp_common.c" |
8 | #include "dat_wcscat.c" |
9 | |
10 | int |
11 | tst_wcscat (FILE * fp, int debug_flg) |
12 | { |
13 | TST_DECL_VARS (wchar_t *); |
14 | wchar_t *ws1, *ws2, *ws_ex; |
15 | int i, err; |
16 | |
17 | TST_DO_TEST (wcscat) |
18 | { |
19 | TST_HEAD_LOCALE (wcscat, S_WCSCAT); |
20 | TST_DO_REC (wcscat) |
21 | { |
22 | TST_GET_ERRET (wcscat); |
23 | ws1 = TST_INPUT (wcscat).ws1; /* external value: size WCSSIZE */ |
24 | ws2 = TST_INPUT (wcscat).ws2; |
25 | |
26 | TST_CLEAR_ERRNO; |
27 | ret = wcscat (dest: ws1, src: ws2); |
28 | TST_SAVE_ERRNO; |
29 | |
30 | TST_IF_RETURN (S_WCSCAT) |
31 | { |
32 | if (ret == ws1) |
33 | { |
34 | Result (C_SUCCESS, S_WCSCAT, CASE_3, MS_PASSED); |
35 | } |
36 | else |
37 | { |
38 | err_count++; |
39 | Result (C_FAILURE, S_WCSCAT, CASE_3, |
40 | "the return address may not be correct" ); |
41 | } |
42 | } |
43 | |
44 | /* function specific test cases here */ |
45 | |
46 | if (ret == ws1) |
47 | { |
48 | ws_ex = TST_EXPECT (wcscat).ws; |
49 | for (err = 0, i = 0; |
50 | (ws1[i] != 0L || ws_ex[i] != 0L) && i < WCSSIZE; i++) |
51 | { |
52 | if (debug_flg) |
53 | { |
54 | fprintf (stdout, "tst_wcscat() : ws1[%d] = 0x%lx\n" , i, |
55 | (unsigned long int) ws1[i]); |
56 | } |
57 | |
58 | if (ws1[i] != ws_ex[i]) |
59 | { |
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; |
66 | } |
67 | } |
68 | |
69 | if (!err) |
70 | { |
71 | Result (C_SUCCESS, S_WCSCAT, CASE_4, MS_PASSED); |
72 | } |
73 | } |
74 | } |
75 | } |
76 | |
77 | return err_count; |
78 | } |
79 | |