]>
Commit | Line | Data |
---|---|---|
22827fb1 AJ |
1 | /* |
2 | WCSNCAT: wchar_t *wcsncat (wchar_t *ws1, const wchar_t *ws2, size_t n); | |
3 | */ | |
4 | ||
5 | #define TST_FUNCTION wcsncat | |
6 | ||
7 | #include "tsp_common.c" | |
8 | #include "dat_wcsncat.c" | |
9 | ||
10 | int | |
11 | tst_wcsncat (FILE * fp, int debug_flg) | |
12 | { | |
13 | TST_DECL_VARS (wchar_t *); | |
14 | wchar_t *ws1, *ws2, *ws_ex; | |
15 | int n, i, err; | |
16 | ||
17 | TST_DO_TEST (wcsncat) | |
18 | { | |
19 | TST_HEAD_LOCALE (wcsncat, S_WCSNCAT); | |
20 | TST_DO_REC (wcsncat) | |
21 | { | |
22 | TST_GET_ERRET (wcsncat); | |
23 | ws1 = TST_INPUT (wcsncat).ws1; /* external value: size WCSSIZE */ | |
24 | ws2 = TST_INPUT (wcsncat).ws2; | |
25 | n = TST_INPUT (wcsncat).n; | |
26 | ret = wcsncat (ws1, ws2, n); | |
27 | ||
28 | TST_IF_RETURN (S_WCSNCAT) | |
29 | { | |
30 | if (ret == ws1) | |
31 | { | |
32 | Result (C_SUCCESS, S_WCSNCAT, CASE_3, MS_PASSED); | |
33 | } | |
34 | else | |
35 | { | |
36 | err_count++; | |
37 | Result (C_FAILURE, S_WCSNCAT, CASE_3, | |
38 | "the return address may not be correct"); | |
39 | } | |
40 | } | |
41 | ||
42 | if (ret == ws1) | |
43 | { | |
44 | ws_ex = TST_EXPECT (wcsncat).ws; | |
45 | ||
46 | for (err = 0, i = 0; | |
47 | (ws1[i] != 0L || ws_ex[i] != 0L) && i < WCSSIZE; i++) | |
48 | { | |
49 | if (debug_flg) | |
50 | { | |
0e16ecfa | 51 | fprintf (stderr, "ws1[%d] = 0x%lx\n", i, ws1[i]); |
22827fb1 AJ |
52 | } |
53 | ||
54 | if (ws1[i] != ws_ex[i]) | |
55 | { | |
56 | err++; | |
57 | err_count++; | |
58 | Result (C_FAILURE, S_WCSNCAT, CASE_4, | |
59 | "the concatinated string has " | |
60 | "different value from an expected string"); | |
61 | break; | |
62 | } | |
63 | } | |
64 | ||
65 | if (!err) | |
66 | { | |
67 | Result (C_SUCCESS, S_WCSNCAT, CASE_4, MS_PASSED); | |
68 | } | |
69 | } | |
70 | } | |
71 | } | |
72 | ||
73 | return err_count; | |
74 | } |