Initialize Tizen 2.3
[framework/base/tizen-locale.git] / localedata / tests-mbwc / dat_wcscoll.c
1 /*
2  *  TEST SUITE FOR MB/WC FUNCTIONS IN C LIBRARY
3  *
4  *       FILE: dat_wcscoll.c
5  *
6  *       WCSCOLL:  int  wcscoll (const wchar_t *ws1, const wchar_t *ws2);
7  */
8
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.
14  *
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.
29  *
30  *
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  *           -------------------------------------------
39  */
40
41
42 TST_WCSCOLL tst_wcscoll_loc [] = {
43
44     {   { Twcscoll, TST_LOC_de },
45         {
46           { /*input.*/ { { 0x00E1,0x00E2,0x00E3,0x0000 },
47                          { 0x00E1,0x00E2,0x00E3,0x0000 }, },  /* #1 */
48             /*expect*/ { 0,1,0, 0,                        },
49           },
50           { /*input.*/ { { 0x0000,0x00E1,0x00E3,0x0000 },
51                          { 0x0000,0x00E2,0x00E3,0x0000 }, },  /* #2 */
52             /*expect*/ { 0,1,0, 0,                        },
53           },
54           { /*input.*/ { { 0x00E1,0x00E1,0x00E3,0x0000 },
55                          { 0x0000,0x00E2,0x00E3,0x0000 }, },  /* #3 */
56             /*expect*/ { 0,0,0, +1,                       },
57           },
58           { /*input.*/ { { 0x0000,0x00E2,0x00E3,0x0000 },
59                          { 0x00E1,0x00E1,0x00E3,0x0000 }, },  /* #4 */
60             /*expect*/ { 0,0,0, -1,                       },
61           },
62           { /*input.*/ { { 0x00E1,0x0042,0x00E3,0x0000 },
63                          { 0x00E1,0x0061,0x00E3,0x0000 }, },  /* #5 */
64             /*expect*/ { 0,0,0, +1,                       },
65           },
66           { /*input.*/ { { 0x00E1,0x0061,0x00E3,0x0000 },
67                          { 0x00E1,0x0042,0x00E3,0x0000 }, },  /* #6 */
68             /*expect*/ { 0,0,0, -1,                       },
69           },
70           { /*input.*/ { { 0x00E1,0x00E2,0x0000        },
71                          { 0x00E1,0x00E2,0x00E9,0x0000 }, },  /* #7 */
72             /*expect*/ { 0,0,0, -1,                       },
73           },
74           { /*input.*/ { { 0x00E1,0x00E2,0x00E9,0x0000 },
75                          { 0x00E1,0x00E2,0x0000        }, },  /* #8 */
76             /*expect*/ { 0,0,0, +1,                       },
77           },
78           { /*input.*/ { { 0x00E1,0x0092,0x00E9,0x0000 },
79                          { 0x00E1,0x008E,0x00E9,0x0000 }, },  /* #9 */
80             /*expect*/ { 0,0,0, +1,                    },
81           },
82           { /*input.*/ { { 0x00E1,0x008E,0x00E9,0x0000 },
83                          { 0x00E1,0x0092,0x00E9,0x0000 }, },  /* #10 */
84             /*expect*/ { 0,0,0, -1,                    },
85           },
86           { .is_last = 1 }
87         }
88     },
89     {   { Twcscoll, TST_LOC_enUS },
90         {
91           { /*input.*/ { { 0x0041,0x0042,0x0043,0x0000 },
92                          { 0x0041,0x0042,0x0043,0x0000 }, },  /* #1 */
93             /*expect*/ { 0,1,0, 0,                        },
94           },
95           { /*input.*/ { { 0x0000,0x0041,0x0043,0x0000 },
96                          { 0x0000,0x0042,0x0043,0x0000 }, },  /* #2 */
97             /*expect*/ { 0,1,0, 0,                        },
98           },
99           { /*input.*/ { { 0x0041,0x0041,0x0043,0x0000 },
100                          { 0x0000,0x0042,0x0043,0x0000 }, },  /* #3 */
101             /*expect*/ { 0,0,0, +1,                       },
102           },
103           { /*input.*/ { { 0x0000,0x0042,0x0043,0x0000 },
104                          { 0x0041,0x0041,0x0043,0x0000 }, },  /* #4 */
105             /*expect*/ { 0,0,0, -1,                       },
106           },
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,                       },
112           },
113           /* <WAIVER> */ /* assume ascii */
114           { /*input.*/ { { 0x0041,0x0061,0x0043,0x0000 },
115                          { 0x0041,0x0042,0x0043,0x0000 }, },  /* #6 */
116             /*expect*/ { 0,0,0, +1,                       },
117           },
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,                       },
123           },
124           { /*input.*/ { { 0x0041,0x0061,0x0043,0x0000 },
125                          { 0x0041,0x0042,0x0043,0x0000 }, },  /* #6 */
126             /*expect*/ { 0,0,0, -1,                       },
127           },
128 #endif
129           { /*input.*/ { { 0x0041,0x0042,0x0000        },
130                          { 0x0041,0x0042,0x0049,0x0000 }, },  /* #7 */
131             /*expect*/ { 0,0,0, -1,                       },
132           },
133           { /*input.*/ { { 0x0041,0x0042,0x0049,0x0000 },
134                          { 0x0041,0x0042,0x0000        }, },  /* #8 */
135             /*expect*/ { 0,0,0, +1,                       },
136           },
137 #ifdef SHOJI_IS_RIGHT
138           { /*input.*/ { { 0x0041,0x0092,0x0049,0x0000 },
139                          { 0x0041,0x008E,0x0049,0x0000 }, },  /* #9 */
140             /*expect*/ { 0,0,0, +1,                    },
141           },
142           { /*input.*/ { { 0x0041,0x008E,0x0049,0x0000 },
143                          { 0x0041,0x0092,0x0049,0x0000 }, },  /* #10 */
144             /*expect*/ { 0,0,0, -1,                    },
145           },
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,                     },
151           },
152           { /*input.*/ { { 0x0041,0x008E,0x0049,0x0000 },
153                          { 0x0041,0x0092,0x0049,0x0000 }, },  /* #10 */
154             /*expect*/ { 0,0,0, 0,                     },
155           },
156 #endif
157           { .is_last = 1 }
158         }
159     },
160     {   { Twcscoll, TST_LOC_eucJP },
161         {
162           { /*input.*/ { { 0x3041,0x3042,0x3043,0x0000 },
163                          { 0x3041,0x3042,0x3043,0x0000 }, },  /* #1 */
164             /*expect*/ { 0,1,0, 0,                        },
165           },
166           { /*input.*/ { { 0x0000,0x3041,0x3043,0x0000 },
167                          { 0x0000,0x3042,0x3043,0x0000 }, },  /* #2 */
168             /*expect*/ { 0,1,0, 0,                        },
169           },
170           { /*input.*/ { { 0x3041,0x3041,0x3043,0x0000 },
171                          { 0x0000,0x3042,0x3043,0x0000 }, },  /* #3 */
172             /*expect*/ { 0,0,0, +1,                       },
173           },
174           { /*input.*/ { { 0x0000,0x3042,0x3043,0x0000 },
175                          { 0x3041,0x3041,0x3043,0x0000 }, },  /* #4 */
176             /*expect*/ { 0,0,0, -1,                       },
177           },
178           { /*input.*/ { { 0x3041,0x0042,0x3043,0x0000 },
179                          { 0x3041,0x0061,0x3043,0x0000 }, },  /* #5 */
180             /*expect*/ { 0,0,0, -1,                       },
181           },
182           { /*input.*/ { { 0x3041,0x0061,0x3043,0x0000 },
183                          { 0x3041,0x0042,0x3043,0x0000 }, },  /* #6 */
184             /*expect*/ { 0,0,0, +1,                       },
185           },
186           { /*input.*/ { { 0x3041,0x3042,0xFF71,0x0000 },
187                          { 0x3041,0x3042,0x30A2,0x0000 }, },  /* #7 */
188             /*expect*/ { 0,0,0, -1,                       },
189           },
190           { /*input.*/ { { 0x3041,0x3042,0x30A2,0x0000 },
191                          { 0x3041,0x3042,0xFF71,0x0000 }, },  /* #8 */
192             /*expect*/ { 0,0,0, +1,                       },
193           },
194           { /*input.*/ { { 0x30FF,0x3092,0x3049,0x0000 },
195                          { 0x3041,0x308E,0x3049,0x0000 }, },  /* #9 */
196             /*expect*/ { 0,0,0, -1,                    },
197           },
198           { /*input.*/ { { 0x3041,0x308E,0x3049,0x0000 },
199                          { 0x30FF,0x3092,0x3049,0x0000 }, },  /* #10 */
200             /*expect*/ { 0,0,0, +1,                    },
201           },
202           { .is_last = 1 }
203         }
204     },
205     {   { Twcscoll, TST_LOC_end } }
206 };