2 * TEST SUITE FOR MB/WC FUNCTIONS IN C LIBRARY
6 * WCSWIDTH: int wcswidth (const wchar_t *ws, size_t n);
9 TST_WCSWIDTH tst_wcswidth_loc
[] = {
11 { Twcswidth
, TST_LOC_de
},
13 { /*input.*/ { { 0x00C1,0x00C2,0x00C3,0x0000 }, 0 }, /* 01 */
16 { /*input.*/ { { 0x00C1,0x00C2,0x00C3,0x0000 }, 1 }, /* 02 */
19 { /*input.*/ { { 0x00C1,0x00C2,0x00C3,0x0000 }, 2 }, /* 03 */
22 { /*input.*/ { { 0x00C1,0x00C2,0x00C3,0x0000 }, 3 }, /* 04 */
25 { /*input.*/ { { 0x00C1,0x00C2,0x00C3,0x0000 }, 4 }, /* 05 */
28 { /*input.*/ { { 0x0000 }, 1 }, /* 06 */
31 { /*input.*/ { { 0x00C1,0x0001,0x0000 }, 2 }, /* 07 */
32 /*expect*/ { 0,1,-1 },
34 { /*input.*/ { { 0x00C1,0x0001,0x0000 }, 1 }, /* 08 */
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 */
46 { /*input.*/ { { 0x00C1,0x0021,0x0000 }, 2 }, /* 12 */
49 { /*input.*/ { { 0x00C1,0x007E,0x0000 }, 2 }, /* 13 */
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 */
60 /*expect*/ { 0,1,-1 },
65 { /*input.*/ { { 0x00C1,0x00A1,0x0000 }, 2 }, /* 17 */
68 { /*input.*/ { { 0x00C1,0x00FF,0x0000 }, 2 }, /* 18 */
71 { /*input.*/ { { 0x00C1,0x3042,0x0000 }, 2 }, /* 19 */
72 /*expect*/ { 0,1,-1 },
74 { /*input.*/ { { 0x00C1,0x3044,0x0000 }, 2 }, /* 20 */
75 /*expect*/ { 0,1,-1 },
81 { Twcswidth
, TST_LOC_enUS
},
83 { /*input.*/ { { 0x0041,0x0042,0x00C3,0x0000 }, 0 }, /* 01 */
86 { /*input.*/ { { 0x0041,0x0042,0x00C3,0x0000 }, 1 }, /* 02 */
89 { /*input.*/ { { 0x0041,0x0042,0x00C3,0x0000 }, 2 }, /* 03 */
93 { /*input.*/ { { 0x0041,0x0042,0x00C3,0x0000 }, 3 }, /* 04 */
96 { /*input.*/ { { 0x0041,0x0042,0x00C3,0x0000 }, 4 }, /* 05 */
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 },
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 },
148 { /*input.*/ { { 0x0041,0x007E,0x0000 }, 2 }, /* 17 */
149 /*expect*/ { 0,1,2 },
151 { /*input.*/ { { 0x0041,0x0020,0x0000 }, 2 }, /* 18 */
152 /*expect*/ { 0,1,2 },
155 { /*input.*/ { { 0x0041,0x3042,0x0000 }, 2 }, /* 19 */
156 /*expect*/ { 0,1,-1 },
158 { /*input.*/ { { 0x0041,0x3044,0x0000 }, 2 }, /* 20 */
159 /*expect*/ { 0,1,-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 },
216 /* <NO_WAIVER> */ /* returns 3 */
217 { /*input.*/ { { 0x0041,0x00A1,0x0000 }, 2 }, /* 17 */
218 /*expect*/ { 0,1,-1 },
221 /* XXX U00A1 is valid -> /x8f/xa2/xc4 in JIS X 0212 */
222 { /*input.*/ { { 0x0041,0x00A1,0x0000 }, 2 }, /* 17 */
223 /*expect*/ { 0,1,3 },
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 },
239 { Twcswidth
, TST_LOC_end
}