malloc/Makefile: Split and sort tests
[glibc.git] / localedata / tests-mbwc / dat_wcswidth.c
blobc030b3ba2e1e699ad454ca0cc88687a14f7d7a15
1 /*
2 * TEST SUITE FOR MB/WC FUNCTIONS IN C LIBRARY
4 * FILE: dat_wcswidth.c
6 * WCSWIDTH: int wcswidth (const wchar_t *ws, size_t n);
7 */
9 TST_WCSWIDTH tst_wcswidth_loc [] = {
11 { Twcswidth, TST_LOC_de },
13 { /*input.*/ { { 0x00C1,0x00C2,0x00C3,0x0000 }, 0 }, /* 01 */
14 /*expect*/ { 0,1,0 },
16 { /*input.*/ { { 0x00C1,0x00C2,0x00C3,0x0000 }, 1 }, /* 02 */
17 /*expect*/ { 0,1,1 },
19 { /*input.*/ { { 0x00C1,0x00C2,0x00C3,0x0000 }, 2 }, /* 03 */
20 /*expect*/ { 0,1,2 },
22 { /*input.*/ { { 0x00C1,0x00C2,0x00C3,0x0000 }, 3 }, /* 04 */
23 /*expect*/ { 0,1,3 },
25 { /*input.*/ { { 0x00C1,0x00C2,0x00C3,0x0000 }, 4 }, /* 05 */
26 /*expect*/ { 0,1,3 },
28 { /*input.*/ { { 0x0000 }, 1 }, /* 06 */
29 /*expect*/ { 0,1,0 },
31 { /*input.*/ { { 0x00C1,0x0001,0x0000 }, 2 }, /* 07 */
32 /*expect*/ { 0,1,-1 },
34 { /*input.*/ { { 0x00C1,0x0001,0x0000 }, 1 }, /* 08 */
35 /*expect*/ { 0,1,1 },
37 { /*input.*/ { { 0x00C1,0x0001,0x0000 }, 2 }, /* 09 */
38 /*expect*/ { 0,1,-1 },
40 { /*input.*/ { { 0x00C1,0x0092,0x0000 }, 2 }, /* 10 */
41 /*expect*/ { 0,1,-1 },
43 { /*input.*/ { { 0x00C1,0x0020,0x0000 }, 2 }, /* 11 */
44 /*expect*/ { 0,1,2 },
46 { /*input.*/ { { 0x00C1,0x0021,0x0000 }, 2 }, /* 12 */
47 /*expect*/ { 0,1,2 },
49 { /*input.*/ { { 0x00C1,0x007E,0x0000 }, 2 }, /* 13 */
50 /*expect*/ { 0,1,2 },
52 { /*input.*/ { { 0x00C1,0x007F,0x0000 }, 2 }, /* 14 */
53 /*expect*/ { 0,1,-1 },
55 { /*input.*/ { { 0x00C1,0x0080,0x0000 }, 2 }, /* 15 */
56 /*expect*/ { 0,1,-1 },
58 { /*input.*/ { { 0x00C1,0x00A0,0x0000 }, 2 }, /* 16 */
59 /*expect*/ { 0,1,2 },
61 { /*input.*/ { { 0x00C1,0x00A1,0x0000 }, 2 }, /* 17 */
62 /*expect*/ { 0,1,2 },
64 { /*input.*/ { { 0x00C1,0x00FF,0x0000 }, 2 }, /* 18 */
65 /*expect*/ { 0,1,2 },
67 { /*input.*/ { { 0x00C1,0x3042,0x0000 }, 2 }, /* 19 */
68 /*expect*/ { 0,1,-1 },
70 { /*input.*/ { { 0x00C1,0x3044,0x0000 }, 2 }, /* 20 */
71 /*expect*/ { 0,1,-1 },
73 { .is_last = 1 }
77 { Twcswidth, TST_LOC_enUS },
79 { /*input.*/ { { 0x0041,0x0042,0x00C3,0x0000 }, 0 }, /* 01 */
80 /*expect*/ { 0,1,0 },
82 { /*input.*/ { { 0x0041,0x0042,0x00C3,0x0000 }, 1 }, /* 02 */
83 /*expect*/ { 0,1,1 },
85 { /*input.*/ { { 0x0041,0x0042,0x00C3,0x0000 }, 2 }, /* 03 */
86 /*expect*/ { 0,1,2 },
88 { /*input.*/ { { 0x0041,0x0042,0x00C3,0x0000 }, 3 }, /* 04 */
89 /*expect*/ { 0,1,-1 },
91 { /*input.*/ { { 0x0041,0x0042,0x0043,0x0000 }, 4 }, /* 05 */
92 /*expect*/ { 0,1,3 },
94 { /*input.*/ { { 0x0000 }, 1 }, /* 06 */
95 /*expect*/ { 0,1,0 },
97 { /*input.*/ { { 0x0041,0x0001,0x0000 }, 2 }, /* 07 */
98 /*expect*/ { 0,1,-1 },
100 { /*input.*/ { { 0x0041,0x0001,0x0000 }, 1 }, /* 08 */
101 /*expect*/ { 0,1,1 },
103 { /*input.*/ { { 0x0041,0x0001,0x0000 }, 2 }, /* 09 */
104 /*expect*/ { 0,1,-1 },
106 { /*input.*/ { { 0x0041,0x0092,0x0000 }, 2 }, /* 10 */
107 /*expect*/ { 0,1,-1 },
109 { /*input.*/ { { 0x0041,0x0020,0x0000 }, 2 }, /* 11 */
110 /*expect*/ { 0,1,2 },
112 { /*input.*/ { { 0x0041,0x0021,0x0000 }, 2 }, /* 12 */
113 /*expect*/ { 0,1,2 },
115 { /*input.*/ { { 0x0041,0x007E,0x0000 }, 2 }, /* 13 */
116 /*expect*/ { 0,1,2 },
118 { /*input.*/ { { 0x0041,0x007F,0x0000 }, 2 }, /* 14 */
119 /*expect*/ { 0,1,-1 },
121 { /*input.*/ { { 0x0041,0x0080,0x0000 }, 2 }, /* 15 */
122 /*expect*/ { 0,1,-1 },
124 { /*input.*/ { { 0x0041,0x00A0,0x0000 }, 2 }, /* 16 */
125 /*expect*/ { 0,1,-1 },
127 { /*input.*/ { { 0x0041,0x007E,0x0000 }, 2 }, /* 17 */
128 /*expect*/ { 0,1,2 },
130 { /*input.*/ { { 0x0041,0x0020,0x0000 }, 2 }, /* 18 */
131 /*expect*/ { 0,1,2 },
133 { /*input.*/ { { 0x0041,0x3042,0x0000 }, 2 }, /* 19 */
134 /*expect*/ { 0,1,-1 },
136 { /*input.*/ { { 0x0041,0x3044,0x0000 }, 2 }, /* 20 */
137 /*expect*/ { 0,1,-1 },
139 { .is_last = 1 }
143 { Twcswidth, TST_LOC_eucJP },
145 { /*input.*/ { { 0x3041,0x3042,0x3043,0x0000 }, 0 }, /* 01 */
146 /*expect*/ { 0,1,0 },
148 { /*input.*/ { { 0x3041,0x3042,0x3043,0x0000 }, 1 }, /* 02 */
149 /*expect*/ { 0,1,2 },
151 { /*input.*/ { { 0x3041,0x3042,0x3043,0x0000 }, 2 }, /* 03 */
152 /*expect*/ { 0,1,4 },
154 { /*input.*/ { { 0x3041,0x3042,0x3043,0x0000 }, 3 }, /* 04 */
155 /*expect*/ { 0,1,6 },
157 { /*input.*/ { { 0x3041,0x3042,0x3043,0x0000 }, 4 }, /* 05 */
158 /*expect*/ { 0,1,6 },
160 { /*input.*/ { { 0x0000 }, 1 }, /* 06 */
161 /*expect*/ { 0,1,0 },
163 { /*input.*/ { { 0x008E,0x0001,0x0000 }, 2 }, /* 07 */
164 /*expect*/ { 0,1,-1 },
166 { /*input.*/ { { 0x3041,0x008E,0x0000 }, 1 }, /* 08 */
167 /*expect*/ { 0,1,2 },
169 { /*input.*/ { { 0x3041,0x008E,0x0000 }, 2 }, /* 09 */
170 /*expect*/ { 0,1,-1 },
172 { /*input.*/ { { 0x3041,0x0001,0x0000 }, 2 }, /* 10 */
173 /*expect*/ { 0,1,-1 },
175 { /*input.*/ { { 0x3041,0x3000,0x0000 }, 2 }, /* 11 */
176 /*expect*/ { 0,1,4 },
178 { /*input.*/ { { 0x0041,0x0021,0x0000 }, 2 }, /* 12 */
179 /*expect*/ { 0,1,2 },
181 { /*input.*/ { { 0x0041,0x007E,0x0000 }, 2 }, /* 13 */
182 /*expect*/ { 0,1,2 },
184 { /*input.*/ { { 0x0041,0x007F,0x0000 }, 2 }, /* 14 */
185 /*expect*/ { 0,1,-1 },
187 { /*input.*/ { { 0x0041,0x0080,0x0000 }, 2 }, /* 15 */
188 /*expect*/ { 0,1,-1 },
190 { /*input.*/ { { 0x0041,0x00A0,0x0000 }, 2 }, /* 16 */
191 /*expect*/ { 0,1,-1 },
193 #ifdef NO_WAIVER
194 /* <NO_WAIVER> */ /* returns 3 */
195 { /*input.*/ { { 0x0041,0x00A1,0x0000 }, 2 }, /* 17 */
196 /*expect*/ { 0,1,-1 },
198 #else
199 /* XXX U00A1 is valid -> /x8f/xa2/xc4 in JIS X 0212 */
200 { /*input.*/ { { 0x0041,0x00A1,0x0000 }, 2 }, /* 17 */
201 /*expect*/ { 0,1,3 },
203 #endif
204 { /*input.*/ { { 0x0041,0xFF71,0x0000 }, 2 }, /* 18 */
205 /*expect*/ { 0,1,2 },
207 { /*input.*/ { { 0x0041,0x3042,0x0000 }, 2 }, /* 19 */
208 /*expect*/ { 0,1,3 },
210 { /*input.*/ { { 0x0041,0x3044,0x0000 }, 2 }, /* 20 */
211 /*expect*/ { 0,1,3 },
213 { .is_last = 1 }
217 { Twcswidth, TST_LOC_end }