Update.
[glibc.git] / localedata / tests-mbwc / tst_wcsncat.c
blob4665f72ced5e98827407b903f297e3927923d82e
1 /*
2 WCSNCAT: wchar_t *wcsncat (wchar_t *ws1, const wchar_t *ws2, size_t n);
3 */
5 #define TST_FUNCTION wcsncat
7 #include "tsp_common.c"
8 #include "dat_wcsncat.c"
10 int
11 tst_wcsncat (FILE * fp, int debug_flg)
13 TST_DECL_VARS (wchar_t *);
14 wchar_t *ws1, *ws2, *ws_ex;
15 int n, i, err;
17 TST_DO_TEST (wcsncat)
19 TST_HEAD_LOCALE (wcsncat, S_WCSNCAT);
20 TST_DO_REC (wcsncat)
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);
28 TST_IF_RETURN (S_WCSNCAT)
30 if (ret == ws1)
32 Result (C_SUCCESS, S_WCSNCAT, CASE_3, MS_PASSED);
34 else
36 err_count++;
37 Result (C_FAILURE, S_WCSNCAT, CASE_3,
38 "the return address may not be correct");
42 if (ret == ws1)
44 ws_ex = TST_EXPECT (wcsncat).ws;
46 for (err = 0, i = 0;
47 (ws1[i] != 0L || ws_ex[i] != 0L) && i < WCSSIZE; i++)
49 if (debug_flg)
51 fprintf (stderr, "ws1[%d] = 0x%lx\n", i, ws1[i]);
54 if (ws1[i] != ws_ex[i])
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;
65 if (!err)
67 Result (C_SUCCESS, S_WCSNCAT, CASE_4, MS_PASSED);
73 return err_count;