2005-02-21 Alan Modra <amodra@bigpond.net.au>
[glibc/history.git] / localedata / tests-mbwc / dat_wcswidth.c
blob68054e797fbef427d470efd89e296a475290edb9
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 #ifdef SHOJI_IS_RIGHT
60 /*expect*/ { 0,1,-1 },
61 #else
62 /*expect*/ { 0,1,2 },
63 #endif
65 { /*input.*/ { { 0x00C1,0x00A1,0x0000 }, 2 }, /* 17 */
66 /*expect*/ { 0,1,2 },
68 { /*input.*/ { { 0x00C1,0x00FF,0x0000 }, 2 }, /* 18 */
69 /*expect*/ { 0,1,2 },
71 { /*input.*/ { { 0x00C1,0x3042,0x0000 }, 2 }, /* 19 */
72 /*expect*/ { 0,1,-1 },
74 { /*input.*/ { { 0x00C1,0x3044,0x0000 }, 2 }, /* 20 */
75 /*expect*/ { 0,1,-1 },
77 { .is_last = 1 }
81 { Twcswidth, TST_LOC_enUS },
83 { /*input.*/ { { 0x0041,0x0042,0x00C3,0x0000 }, 0 }, /* 01 */
84 /*expect*/ { 0,1,0 },
86 { /*input.*/ { { 0x0041,0x0042,0x00C3,0x0000 }, 1 }, /* 02 */
87 /*expect*/ { 0,1,1 },
89 { /*input.*/ { { 0x0041,0x0042,0x00C3,0x0000 }, 2 }, /* 03 */
90 /*expect*/ { 0,1,2 },
92 #ifdef SHOJI_IS_RIGHT
93 { /*input.*/ { { 0x0041,0x0042,0x00C3,0x0000 }, 3 }, /* 04 */
94 /*expect*/ { 0,1,3 },
96 { /*input.*/ { { 0x0041,0x0042,0x00C3,0x0000 }, 4 }, /* 05 */
97 /*expect*/ { 0,1,3 },
99 #else
100 { /*input.*/ { { 0x0041,0x0042,0x00C3,0x0000 }, 3 }, /* 04 */
101 /*expect*/ { 0,1,-1 },
103 { /*input.*/ { { 0x0041,0x0042,0x0043,0x0000 }, 4 }, /* 05 */
104 /*expect*/ { 0,1,3 },
106 #endif
107 { /*input.*/ { { 0x0000 }, 1 }, /* 06 */
108 /*expect*/ { 0,1,0 },
110 { /*input.*/ { { 0x0041,0x0001,0x0000 }, 2 }, /* 07 */
111 /*expect*/ { 0,1,-1 },
113 { /*input.*/ { { 0x0041,0x0001,0x0000 }, 1 }, /* 08 */
114 /*expect*/ { 0,1,1 },
116 { /*input.*/ { { 0x0041,0x0001,0x0000 }, 2 }, /* 09 */
117 /*expect*/ { 0,1,-1 },
119 { /*input.*/ { { 0x0041,0x0092,0x0000 }, 2 }, /* 10 */
120 /*expect*/ { 0,1,-1 },
122 { /*input.*/ { { 0x0041,0x0020,0x0000 }, 2 }, /* 11 */
123 /*expect*/ { 0,1,2 },
125 { /*input.*/ { { 0x0041,0x0021,0x0000 }, 2 }, /* 12 */
126 /*expect*/ { 0,1,2 },
128 { /*input.*/ { { 0x0041,0x007E,0x0000 }, 2 }, /* 13 */
129 /*expect*/ { 0,1,2 },
131 { /*input.*/ { { 0x0041,0x007F,0x0000 }, 2 }, /* 14 */
132 /*expect*/ { 0,1,-1 },
134 { /*input.*/ { { 0x0041,0x0080,0x0000 }, 2 }, /* 15 */
135 /*expect*/ { 0,1,-1 },
137 { /*input.*/ { { 0x0041,0x00A0,0x0000 }, 2 }, /* 16 */
138 /*expect*/ { 0,1,-1 },
140 #ifdef SHOJI_IS_RIGHT
141 { /*input.*/ { { 0x0041,0x00A1,0x0000 }, 2 }, /* 17 */
142 /*expect*/ { 0,1,2 },
144 { /*input.*/ { { 0x0041,0x00FF,0x0000 }, 2 }, /* 18 */
145 /*expect*/ { 0,1,2 },
147 #else
148 { /*input.*/ { { 0x0041,0x007E,0x0000 }, 2 }, /* 17 */
149 /*expect*/ { 0,1,2 },
151 { /*input.*/ { { 0x0041,0x0020,0x0000 }, 2 }, /* 18 */
152 /*expect*/ { 0,1,2 },
154 #endif
155 { /*input.*/ { { 0x0041,0x3042,0x0000 }, 2 }, /* 19 */
156 /*expect*/ { 0,1,-1 },
158 { /*input.*/ { { 0x0041,0x3044,0x0000 }, 2 }, /* 20 */
159 /*expect*/ { 0,1,-1 },
161 { .is_last = 1 }
165 { Twcswidth, TST_LOC_eucJP },
167 { /*input.*/ { { 0x3041,0x3042,0x3043,0x0000 }, 0 }, /* 01 */
168 /*expect*/ { 0,1,0 },
170 { /*input.*/ { { 0x3041,0x3042,0x3043,0x0000 }, 1 }, /* 02 */
171 /*expect*/ { 0,1,2 },
173 { /*input.*/ { { 0x3041,0x3042,0x3043,0x0000 }, 2 }, /* 03 */
174 /*expect*/ { 0,1,4 },
176 { /*input.*/ { { 0x3041,0x3042,0x3043,0x0000 }, 3 }, /* 04 */
177 /*expect*/ { 0,1,6 },
179 { /*input.*/ { { 0x3041,0x3042,0x3043,0x0000 }, 4 }, /* 05 */
180 /*expect*/ { 0,1,6 },
182 { /*input.*/ { { 0x0000 }, 1 }, /* 06 */
183 /*expect*/ { 0,1,0 },
185 { /*input.*/ { { 0x008E,0x0001,0x0000 }, 2 }, /* 07 */
186 /*expect*/ { 0,1,-1 },
188 { /*input.*/ { { 0x3041,0x008E,0x0000 }, 1 }, /* 08 */
189 /*expect*/ { 0,1,2 },
191 { /*input.*/ { { 0x3041,0x008E,0x0000 }, 2 }, /* 09 */
192 /*expect*/ { 0,1,-1 },
194 { /*input.*/ { { 0x3041,0x0001,0x0000 }, 2 }, /* 10 */
195 /*expect*/ { 0,1,-1 },
197 { /*input.*/ { { 0x3041,0x3000,0x0000 }, 2 }, /* 11 */
198 /*expect*/ { 0,1,4 },
200 { /*input.*/ { { 0x0041,0x0021,0x0000 }, 2 }, /* 12 */
201 /*expect*/ { 0,1,2 },
203 { /*input.*/ { { 0x0041,0x007E,0x0000 }, 2 }, /* 13 */
204 /*expect*/ { 0,1,2 },
206 { /*input.*/ { { 0x0041,0x007F,0x0000 }, 2 }, /* 14 */
207 /*expect*/ { 0,1,-1 },
209 { /*input.*/ { { 0x0041,0x0080,0x0000 }, 2 }, /* 15 */
210 /*expect*/ { 0,1,-1 },
212 { /*input.*/ { { 0x0041,0x00A0,0x0000 }, 2 }, /* 16 */
213 /*expect*/ { 0,1,-1 },
215 #ifdef NO_WAIVER
216 /* <NO_WAIVER> */ /* returns 3 */
217 { /*input.*/ { { 0x0041,0x00A1,0x0000 }, 2 }, /* 17 */
218 /*expect*/ { 0,1,-1 },
220 #else
221 /* XXX U00A1 is valid -> /x8f/xa2/xc4 in JIS X 0212 */
222 { /*input.*/ { { 0x0041,0x00A1,0x0000 }, 2 }, /* 17 */
223 /*expect*/ { 0,1,3 },
225 #endif
226 { /*input.*/ { { 0x0041,0xFF71,0x0000 }, 2 }, /* 18 */
227 /*expect*/ { 0,1,2 },
229 { /*input.*/ { { 0x0041,0x3042,0x0000 }, 2 }, /* 19 */
230 /*expect*/ { 0,1,3 },
232 { /*input.*/ { { 0x0041,0x3044,0x0000 }, 2 }, /* 20 */
233 /*expect*/ { 0,1,3 },
235 { .is_last = 1 }
239 { Twcswidth, TST_LOC_end }