U0000 is not in class cntrl.
[kopensolaris-gnu/glibc.git] / localedata / tests-mbwc / dat_wcswidth.c
1 /*
2  *  TEST SUITE FOR MB/WC FUNCTIONS IN C LIBRARY
3  *
4  *       FILE:  dat_wcswidth.c
5  *
6  *       WCSWIDTH:  int  wcswidth (const wchar_t *ws, size_t n);
7  */
8
9 TST_WCSWIDTH tst_wcswidth_loc [] = {
10   {
11     { Twcswidth, TST_LOC_de },
12     {
13       { /*input.*/ { { 0x00C1,0x00C2,0x00C3,0x0000 },    0 },  /* 01 */
14         /*expect*/ { 0,0,1,0                               },
15       },
16       { /*input.*/ { { 0x00C1,0x00C2,0x00C3,0x0000 },    1 },  /* 02 */
17         /*expect*/ { 0,0,1,1                               },
18       },
19       { /*input.*/ { { 0x00C1,0x00C2,0x00C3,0x0000 },    2 },  /* 03 */
20         /*expect*/ { 0,0,1,2                               },
21       },
22       { /*input.*/ { { 0x00C1,0x00C2,0x00C3,0x0000 },    3 },  /* 04 */
23         /*expect*/ { 0,0,1,3                               },
24       },
25       { /*input.*/ { { 0x00C1,0x00C2,0x00C3,0x0000 },    4 },  /* 05 */
26         /*expect*/ { 0,0,1,3                               },
27       },
28       { /*input.*/ { { 0x0000 },                         1 },  /* 06 */
29         /*expect*/ { 0,0,1,0                               },
30       },
31       { /*input.*/ { { 0x00C1,0x0001,0x0000 },           2 },  /* 07 */
32         /*expect*/ { 0,0,1,-1                              },
33       },
34       { /*input.*/ { { 0x00C1,0x0001,0x0000 },           1 },  /* 08 */
35         /*expect*/ { 0,0,1,1                               },
36       },
37       { /*input.*/ { { 0x00C1,0x0001,0x0000 },           2 },  /* 09 */
38         /*expect*/ { 0,0,1,-1                              },
39       },
40       { /*input.*/ { { 0x00C1,0x0092,0x0000 },           2 },  /* 10 */
41         /*expect*/ { 0,0,1,-1                              },
42       },
43       { /*input.*/ { { 0x00C1,0x0020,0x0000 },           2 },  /* 11 */
44         /*expect*/ { 0,0,1,2                               },
45       },
46       { /*input.*/ { { 0x00C1,0x0021,0x0000 },           2 },  /* 12 */
47         /*expect*/ { 0,0,1,2                               },
48       },
49       { /*input.*/ { { 0x00C1,0x007E,0x0000 },           2 },  /* 13 */
50         /*expect*/ { 0,0,1,2                               },
51       },
52       { /*input.*/ { { 0x00C1,0x007F,0x0000 },           2 },  /* 14 */
53         /*expect*/ { 0,0,1,-1                              },
54       },
55       { /*input.*/ { { 0x00C1,0x0080,0x0000 },           2 },  /* 15 */
56         /*expect*/ { 0,0,1,-1                              },
57       },
58       { /*input.*/ { { 0x00C1,0x00A0,0x0000 },           2 },  /* 16 */
59         /*expect*/ { 0,0,1,-1                              },
60       },
61       { /*input.*/ { { 0x00C1,0x00A1,0x0000 },           2 },  /* 17 */
62         /*expect*/ { 0,0,1,2                               },
63       },
64       { /*input.*/ { { 0x00C1,0x00FF,0x0000 },           2 },  /* 18 */
65         /*expect*/ { 0,0,1,2                               },
66       },
67       { /*input.*/ { { 0x00C1,0x3042,0x0000 },           2 },  /* 19 */   /* <WAIVER> */  /* returns 2 */
68         /*expect*/ { 0,0,1,-1                              },
69       },
70       { /*input.*/ { { 0x00C1,0x3044,0x0000 },           2 },  /* 20 */   /* <WAIVER> */  /* returns 2 */
71         /*expect*/ { 0,0,1,-1                              },
72       },
73       { is_last: 1 }
74     }
75   },
76   {
77     { Twcswidth, TST_LOC_enUS },
78     {
79       { /*input.*/ { { 0x0041,0x0042,0x00C3,0x0000 },    0 },  /* 01 */
80         /*expect*/ { 0,0,1,0                               },
81       },
82       { /*input.*/ { { 0x0041,0x0042,0x00C3,0x0000 },    1 },  /* 02 */
83         /*expect*/ { 0,0,1,1                               },
84       },
85       { /*input.*/ { { 0x0041,0x0042,0x00C3,0x0000 },    2 },  /* 03 */
86         /*expect*/ { 0,0,1,2                               },
87       },
88       { /*input.*/ { { 0x0041,0x0042,0x00C3,0x0000 },    3 },  /* 04 */
89         /*expect*/ { 0,0,1,3                               },
90       },
91       { /*input.*/ { { 0x0041,0x0042,0x00C3,0x0000 },    4 },  /* 05 */
92         /*expect*/ { 0,0,1,3                               },
93       },
94       { /*input.*/ { { 0x0000 },                         1 },  /* 06 */
95         /*expect*/ { 0,0,1,0                               },
96       },
97       { /*input.*/ { { 0x0041,0x0001,0x0000 },           2 },  /* 07 */
98         /*expect*/ { 0,0,1,-1                              },
99       },
100       { /*input.*/ { { 0x0041,0x0001,0x0000 },           1 },  /* 08 */
101         /*expect*/ { 0,0,1,1                               },
102       },
103       { /*input.*/ { { 0x0041,0x0001,0x0000 },           2 },  /* 09 */
104         /*expect*/ { 0,0,1,-1                              },
105       },
106       { /*input.*/ { { 0x0041,0x0092,0x0000 },           2 },  /* 10 */
107         /*expect*/ { 0,0,1,-1                              },
108       },
109       { /*input.*/ { { 0x0041,0x0020,0x0000 },           2 },  /* 11 */
110         /*expect*/ { 0,0,1,2                               },
111       },
112       { /*input.*/ { { 0x0041,0x0021,0x0000 },           2 },  /* 12 */
113         /*expect*/ { 0,0,1,2                               },
114       },
115       { /*input.*/ { { 0x0041,0x007E,0x0000 },           2 },  /* 13 */
116         /*expect*/ { 0,0,1,2                               },
117       },
118       { /*input.*/ { { 0x0041,0x007F,0x0000 },           2 },  /* 14 */
119         /*expect*/ { 0,0,1,-1                              },
120       },
121       { /*input.*/ { { 0x0041,0x0080,0x0000 },           2 },  /* 15 */
122         /*expect*/ { 0,0,1,-1                              },
123       },
124       { /*input.*/ { { 0x0041,0x00A0,0x0000 },           2 },  /* 16 */
125         /*expect*/ { 0,0,1,-1                              },
126       },
127       { /*input.*/ { { 0x0041,0x00A1,0x0000 },           2 },  /* 17 */
128         /*expect*/ { 0,0,1,2                               },
129       },
130       { /*input.*/ { { 0x0041,0x00FF,0x0000 },           2 },  /* 18 */
131         /*expect*/ { 0,0,1,2                               },
132       },
133       /* <WAIVER> */  /* returns 2 */
134       { /*input.*/ { { 0x0041,0x3042,0x0000 },           2 },  /* 19 */
135         /*expect*/ { 0,0,1,-1                              },
136       },
137       /* <WAIVER> */  /* returns 2 */
138       { /*input.*/ { { 0x0041,0x3044,0x0000 },           2 },  /* 20 */
139         /*expect*/ { 0,0,1,-1                              },
140       },
141       { is_last: 1 }
142     }
143   },
144   {
145     { Twcswidth, TST_LOC_eucJP },
146     {
147       { /*input.*/ { { 0x3041,0x3042,0x3043,0x0000 },    0 },  /* 01 */
148         /*expect*/ { 0,0,1,0                               },
149       },
150       { /*input.*/ { { 0x3041,0x3042,0x3043,0x0000 },    1 },  /* 02 */
151         /*expect*/ { 0,0,1,2                               },
152       },
153       { /*input.*/ { { 0x3041,0x3042,0x3043,0x0000 },    2 },  /* 03 */
154         /*expect*/ { 0,0,1,4                               },
155       },
156       { /*input.*/ { { 0x3041,0x3042,0x3043,0x0000 },    3 },  /* 04 */
157         /*expect*/ { 0,0,1,6                               },
158       },
159       { /*input.*/ { { 0x3041,0x3042,0x3043,0x0000 },    4 },  /* 05 */
160         /*expect*/ { 0,0,1,6                               },
161       },
162       { /*input.*/ { { 0x0000 },                         1 },  /* 06 */
163         /*expect*/ { 0,0,1,0                               },
164       },
165       { /*input.*/ { { 0x008E,0x0001,0x0000 },           2 },  /* 07 */
166         /*expect*/ { 0,0,1,-1                              },
167       },
168       { /*input.*/ { { 0x3041,0x008E,0x0000 },           1 },  /* 08 */
169         /*expect*/ { 0,0,1,2                               },
170       },
171       { /*input.*/ { { 0x3041,0x008E,0x0000 },           2 },  /* 09 */
172         /*expect*/ { 0,0,1,-1                              },
173       },
174       { /*input.*/ { { 0x3041,0x0001,0x0000 },           2 },  /* 10 */
175         /*expect*/ { 0,0,1,-1                              },
176       },
177       { /*input.*/ { { 0x3041,0x3000,0x0000 },           2 },  /* 11 */
178         /*expect*/ { 0,0,1,4                               },
179       },
180       { /*input.*/ { { 0x0041,0x0021,0x0000 },           2 },  /* 12 */
181         /*expect*/ { 0,0,1,2                               },
182       },
183       { /*input.*/ { { 0x0041,0x007E,0x0000 },           2 },  /* 13 */
184         /*expect*/ { 0,0,1,2                               },
185       },
186       { /*input.*/ { { 0x0041,0x007F,0x0000 },           2 },  /* 14 */
187         /*expect*/ { 0,0,1,-1                              },
188       },
189       { /*input.*/ { { 0x0041,0x0080,0x0000 },           2 },  /* 15 */
190         /*expect*/ { 0,0,1,-1                              },
191       },
192       { /*input.*/ { { 0x0041,0x00A0,0x0000 },           2 },  /* 16 */
193         /*expect*/ { 0,0,1,-1                              },
194       },
195       /* <NO_WAIVER> */  /* returns 3 */
196       { /*input.*/ { { 0x0041,0x00A1,0x0000 },           2 },  /* 17 */
197         /*expect*/ { 0,0,1,-1                              },
198       },
199       { /*input.*/ { { 0x0041,0xFF71,0x0000 },           2 },  /* 18 */
200         /*expect*/ { 0,0,1,2                               },
201       },
202       { /*input.*/ { { 0x0041,0x3042,0x0000 },           2 },  /* 19 */
203         /*expect*/ { 0,0,1,3                               },
204       },
205       { /*input.*/ { { 0x0041,0x3044,0x0000 },           2 },  /* 20 */
206         /*expect*/ { 0,0,1,3                               },
207       },
208       { is_last: 1 }
209     }
210   },
211   {
212     { Twcswidth, TST_LOC_end }
213   }
214 };