Support expected failures in .test-result files.
[glibc.git] / localedata / tests-mbwc / tst_wcscpy.c
blobd5705a55dcfcb6f2ab0c9673862034df18985cd6
1 /*-------------------------------------------------------------------------------------*/
2 /* WCSCPY: wchar_t *wcscpy( wchar_t *ws1, const wchar_t *ws2 ) */
3 /*-------------------------------------------------------------------------------------*/
4 #define TST_FUNCTION wcscpy
6 #include "tsp_common.c"
7 #include "dat_wcscpy.c"
9 int
10 tst_wcscpy (FILE * fp, int debug_flg)
12 TST_DECL_VARS (wchar_t *);
13 wchar_t ws1[WCSSIZE], *ws2, *ws_ex;
14 int err, i;
16 TST_DO_TEST (wcscpy)
18 TST_HEAD_LOCALE (wcscpy, S_WCSCPY);
19 TST_DO_REC (wcscpy)
21 TST_GET_ERRET (wcscpy);
22 ws2 = TST_INPUT (wcscpy).ws; /* external value: size WCSSIZE */
23 ret = wcscpy (ws1, ws2);
25 TST_IF_RETURN (S_WCSCPY)
27 if (ret == ws1)
29 Result (C_SUCCESS, S_WCSCPY, CASE_3, MS_PASSED);
31 else
33 err_count++;
34 Result (C_FAILURE, S_WCSCPY, CASE_3,
35 "the return address may not be correct");
39 if (ret == ws1)
41 ws_ex = TST_EXPECT (wcscpy).ws;
43 for (err = 0, i = 0;
44 (ws1[i] != 0L || ws_ex[i] != 0L) && i < WCSSIZE; i++)
46 if (debug_flg)
48 fprintf (stderr,
49 "ws1[ %d ] = 0x%lx <-> wx_ex[ %d ] = 0x%lx\n", i,
50 (unsigned long int) ws1[i], i,
51 (unsigned long int) ws_ex[i]);
54 if (ws1[i] != ws_ex[i])
56 err++;
57 err_count++;
58 Result (C_FAILURE, S_WCSCPY, CASE_4,
59 "copied string is different from an"
60 " expected string");
61 break;
65 if (!err)
67 Result (C_SUCCESS, S_WCSCPY, CASE_4, MS_PASSED);
70 if (ws1[i] == 0L)
72 Result (C_SUCCESS, S_WCSCPY, CASE_5, MS_PASSED);
74 else
76 err_count++;
77 Result (C_FAILURE, S_WCSCPY, CASE_5,
78 "copied string is not null-terminated");
84 return err_count;