2.9
[glibc/nacl-glibc.git] / localedata / tests-mbwc / dat_wcscoll.c
blobcfc3f85c90eff8b4a18d043c701af8fff4794aca
1 /*
2 * TEST SUITE FOR MB/WC FUNCTIONS IN C LIBRARY
4 * FILE: dat_wcscoll.c
6 * WCSCOLL: int wcscoll (const wchar_t *ws1, const wchar_t *ws2);
7 */
9 /*
10 * CAUTION:
11 * When LC_COLLATE (or LC_ALL) is set for ja_JP.EUC,
12 * wcscoll() core-dumps for big values such as 0x3041
13 * (0x0041 is okay) in glibc 2.1.2.
15 * NOTE:
16 * a) When 0 is expected as a return value, set ret_flg=1.
17 * - the return value is compared with an expected value: ret_val.
18 * b) When a positive value is expected as a return value,
19 * set ret_flg=0 and set cmp_flg=+1.
20 * - the return value is not compared with the expected value
21 * (can not be compared); instead, the test program checks
22 * if the return value is positive when cmp_flg=+1.
23 * c) When a negative value is expected as a return value,
24 * ......
25 * d) When data contains invalid values, set err_val to the expected errno.
26 * Set ret_flg=0 and cmp_flg=0 so that it doesn't compare
27 * the return value with an expected value or doesn't check
28 * the sign of the return value.
31 * -------------------------------------------
32 * CASE err_val ret_flg ret_val cmp_flg
33 * -------------------------------------------
34 * a) 0 1 0 0
35 * b) 0 0 0 +1
36 * c) 0 0 0 -1
37 * d) EINVAL 0 0 0
38 * -------------------------------------------
42 TST_WCSCOLL tst_wcscoll_loc [] = {
44 { { Twcscoll, TST_LOC_de },
46 { /*input.*/ { { 0x00E1,0x00E2,0x00E3,0x0000 },
47 { 0x00E1,0x00E2,0x00E3,0x0000 }, }, /* #1 */
48 /*expect*/ { 0,1,0, 0, },
50 { /*input.*/ { { 0x0000,0x00E1,0x00E3,0x0000 },
51 { 0x0000,0x00E2,0x00E3,0x0000 }, }, /* #2 */
52 /*expect*/ { 0,1,0, 0, },
54 { /*input.*/ { { 0x00E1,0x00E1,0x00E3,0x0000 },
55 { 0x0000,0x00E2,0x00E3,0x0000 }, }, /* #3 */
56 /*expect*/ { 0,0,0, +1, },
58 { /*input.*/ { { 0x0000,0x00E2,0x00E3,0x0000 },
59 { 0x00E1,0x00E1,0x00E3,0x0000 }, }, /* #4 */
60 /*expect*/ { 0,0,0, -1, },
62 { /*input.*/ { { 0x00E1,0x0042,0x00E3,0x0000 },
63 { 0x00E1,0x0061,0x00E3,0x0000 }, }, /* #5 */
64 /*expect*/ { 0,0,0, +1, },
66 { /*input.*/ { { 0x00E1,0x0061,0x00E3,0x0000 },
67 { 0x00E1,0x0042,0x00E3,0x0000 }, }, /* #6 */
68 /*expect*/ { 0,0,0, -1, },
70 { /*input.*/ { { 0x00E1,0x00E2,0x0000 },
71 { 0x00E1,0x00E2,0x00E9,0x0000 }, }, /* #7 */
72 /*expect*/ { 0,0,0, -1, },
74 { /*input.*/ { { 0x00E1,0x00E2,0x00E9,0x0000 },
75 { 0x00E1,0x00E2,0x0000 }, }, /* #8 */
76 /*expect*/ { 0,0,0, +1, },
78 { /*input.*/ { { 0x00E1,0x0092,0x00E9,0x0000 },
79 { 0x00E1,0x008E,0x00E9,0x0000 }, }, /* #9 */
80 /*expect*/ { 0,0,0, +1, },
82 { /*input.*/ { { 0x00E1,0x008E,0x00E9,0x0000 },
83 { 0x00E1,0x0092,0x00E9,0x0000 }, }, /* #10 */
84 /*expect*/ { 0,0,0, -1, },
86 { .is_last = 1 }
89 { { Twcscoll, TST_LOC_enUS },
91 { /*input.*/ { { 0x0041,0x0042,0x0043,0x0000 },
92 { 0x0041,0x0042,0x0043,0x0000 }, }, /* #1 */
93 /*expect*/ { 0,1,0, 0, },
95 { /*input.*/ { { 0x0000,0x0041,0x0043,0x0000 },
96 { 0x0000,0x0042,0x0043,0x0000 }, }, /* #2 */
97 /*expect*/ { 0,1,0, 0, },
99 { /*input.*/ { { 0x0041,0x0041,0x0043,0x0000 },
100 { 0x0000,0x0042,0x0043,0x0000 }, }, /* #3 */
101 /*expect*/ { 0,0,0, +1, },
103 { /*input.*/ { { 0x0000,0x0042,0x0043,0x0000 },
104 { 0x0041,0x0041,0x0043,0x0000 }, }, /* #4 */
105 /*expect*/ { 0,0,0, -1, },
107 #ifdef SHOJI_IS_RIGHT
108 /* <WAIVER> */ /* assume ascii */
109 { /*input.*/ { { 0x0041,0x0042,0x0043,0x0000 },
110 { 0x0041,0x0061,0x0043,0x0000 }, }, /* #5 */
111 /*expect*/ { 0,0,0, -1, },
113 /* <WAIVER> */ /* assume ascii */
114 { /*input.*/ { { 0x0041,0x0061,0x0043,0x0000 },
115 { 0x0041,0x0042,0x0043,0x0000 }, }, /* #6 */
116 /*expect*/ { 0,0,0, +1, },
118 #else
119 /* XXX Correct order is lowercase before uppercase. */
120 { /*input.*/ { { 0x0041,0x0042,0x0043,0x0000 },
121 { 0x0041,0x0061,0x0043,0x0000 }, }, /* #5 */
122 /*expect*/ { 0,0,0, +1, },
124 { /*input.*/ { { 0x0041,0x0061,0x0043,0x0000 },
125 { 0x0041,0x0042,0x0043,0x0000 }, }, /* #6 */
126 /*expect*/ { 0,0,0, -1, },
128 #endif
129 { /*input.*/ { { 0x0041,0x0042,0x0000 },
130 { 0x0041,0x0042,0x0049,0x0000 }, }, /* #7 */
131 /*expect*/ { 0,0,0, -1, },
133 { /*input.*/ { { 0x0041,0x0042,0x0049,0x0000 },
134 { 0x0041,0x0042,0x0000 }, }, /* #8 */
135 /*expect*/ { 0,0,0, +1, },
137 #ifdef SHOJI_IS_RIGHT
138 { /*input.*/ { { 0x0041,0x0092,0x0049,0x0000 },
139 { 0x0041,0x008E,0x0049,0x0000 }, }, /* #9 */
140 /*expect*/ { 0,0,0, +1, },
142 { /*input.*/ { { 0x0041,0x008E,0x0049,0x0000 },
143 { 0x0041,0x0092,0x0049,0x0000 }, }, /* #10 */
144 /*expect*/ { 0,0,0, -1, },
146 #else
147 /* Do not assume position of character out of range. */
148 { /*input.*/ { { 0x0041,0x0092,0x0049,0x0000 },
149 { 0x0041,0x008E,0x0049,0x0000 }, }, /* #9 */
150 /*expect*/ { 0,0,0, 0, },
152 { /*input.*/ { { 0x0041,0x008E,0x0049,0x0000 },
153 { 0x0041,0x0092,0x0049,0x0000 }, }, /* #10 */
154 /*expect*/ { 0,0,0, 0, },
156 #endif
157 { .is_last = 1 }
160 { { Twcscoll, TST_LOC_eucJP },
162 { /*input.*/ { { 0x3041,0x3042,0x3043,0x0000 },
163 { 0x3041,0x3042,0x3043,0x0000 }, }, /* #1 */
164 /*expect*/ { 0,1,0, 0, },
166 { /*input.*/ { { 0x0000,0x3041,0x3043,0x0000 },
167 { 0x0000,0x3042,0x3043,0x0000 }, }, /* #2 */
168 /*expect*/ { 0,1,0, 0, },
170 { /*input.*/ { { 0x3041,0x3041,0x3043,0x0000 },
171 { 0x0000,0x3042,0x3043,0x0000 }, }, /* #3 */
172 /*expect*/ { 0,0,0, +1, },
174 { /*input.*/ { { 0x0000,0x3042,0x3043,0x0000 },
175 { 0x3041,0x3041,0x3043,0x0000 }, }, /* #4 */
176 /*expect*/ { 0,0,0, -1, },
178 { /*input.*/ { { 0x3041,0x0042,0x3043,0x0000 },
179 { 0x3041,0x0061,0x3043,0x0000 }, }, /* #5 */
180 /*expect*/ { 0,0,0, -1, },
182 { /*input.*/ { { 0x3041,0x0061,0x3043,0x0000 },
183 { 0x3041,0x0042,0x3043,0x0000 }, }, /* #6 */
184 /*expect*/ { 0,0,0, +1, },
186 { /*input.*/ { { 0x3041,0x3042,0xFF71,0x0000 },
187 { 0x3041,0x3042,0x30A2,0x0000 }, }, /* #7 */
188 /*expect*/ { 0,0,0, -1, },
190 { /*input.*/ { { 0x3041,0x3042,0x30A2,0x0000 },
191 { 0x3041,0x3042,0xFF71,0x0000 }, }, /* #8 */
192 /*expect*/ { 0,0,0, +1, },
194 { /*input.*/ { { 0x30FF,0x3092,0x3049,0x0000 },
195 { 0x3041,0x308E,0x3049,0x0000 }, }, /* #9 */
196 /*expect*/ { 0,0,0, -1, },
198 { /*input.*/ { { 0x3041,0x308E,0x3049,0x0000 },
199 { 0x30FF,0x3092,0x3049,0x0000 }, }, /* #10 */
200 /*expect*/ { 0,0,0, +1, },
202 { .is_last = 1 }
205 { { Twcscoll, TST_LOC_end } }