2.9
[glibc/nacl-glibc.git] / localedata / tests-mbwc / tst_wcscoll.c
blob929f80d80076d04b08a08beee22a6e0fe3e5fcfe
1 /*
2 WCSCOLL: int wcscoll (const wchar_t *ws1, const wchar_t *ws2);
3 */
5 #define TST_FUNCTION wcscoll
7 #include "tsp_common.c"
8 #include "dat_wcscoll.c"
10 int
11 tst_wcscoll (FILE * fp, int debug_flg)
13 TST_DECL_VARS (int);
14 wchar_t *ws1, *ws2;
15 int cmp;
17 TST_DO_TEST (wcscoll)
19 TST_HEAD_LOCALE (wcscoll, S_WCSCOLL);
20 TST_DO_REC (wcscoll)
22 TST_GET_ERRET (wcscoll);
23 ws1 = TST_INPUT (wcscoll).ws1; /* external value: size WCSSIZE */
24 ws2 = TST_INPUT (wcscoll).ws2;
26 TST_CLEAR_ERRNO;
27 ret = wcscoll (ws1, ws2);
28 TST_SAVE_ERRNO;
30 if (debug_flg)
32 fprintf (stderr, "tst_wcscoll: ret = %d\n", ret);
35 cmp = TST_EXPECT (wcscoll).cmp_flg;
36 TST_IF_RETURN (S_WCSCOLL)
38 if (cmp != 0)
40 if ((cmp == 1 && ret > 0) || (cmp == -1 && ret < 0))
42 Result (C_SUCCESS, S_WCSCOLL, CASE_3, MS_PASSED);
44 else
46 err_count++;
47 if (cmp == 1)
49 if (ret == 0)
50 Result (C_FAILURE, S_WCSCOLL, CASE_3,
51 "the return value should be positive"
52 " but it's zero.");
53 else
54 Result (C_FAILURE, S_WCSCOLL, CASE_3,
55 "the return value should be positive"
56 " but it's negative.");
58 else
60 if (ret == 0)
61 Result (C_FAILURE, S_WCSCOLL, CASE_3,
62 "the return value should be negative"
63 " but it's zero.");
64 else
65 Result (C_FAILURE, S_WCSCOLL, CASE_3,
66 "the return value should be negative"
67 " but it's positive.");
75 return err_count;