Updated to fedora-glibc-20041218T1131
[glibc.git] / localedata / tests-mbwc / tst_wcsncat.c
bloba2f6ba020ba630f3e10932840ae6fbd1b7cde4fe
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,
52 (unsigned long int) ws1[i]);
55 if (ws1[i] != ws_ex[i])
57 err++;
58 err_count++;
59 Result (C_FAILURE, S_WCSNCAT, CASE_4,
60 "the concatinated string has "
61 "different value from an expected string");
62 break;
66 if (!err)
68 Result (C_SUCCESS, S_WCSNCAT, CASE_4, MS_PASSED);
74 return err_count;