This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Updated Unicode-Collate to CPAN version 0.76
[perl5.git] / cpan / Unicode-Collate / t / loc_zhst.t
1
2 BEGIN {
3     unless ("A" eq pack('U', 0x41)) {
4         print "1..0 # Unicode::Collate " .
5             "cannot stringify a Unicode code point\n";
6         exit 0;
7     }
8     if ($ENV{PERL_CORE}) {
9         chdir('t') if -d 't';
10         @INC = $^O eq 'MacOS' ? qw(::lib) : qw(../lib);
11     }
12 }
13
14 use Test;
15 BEGIN { plan tests => 291 };
16
17 use strict;
18 use warnings;
19 use Unicode::Collate::Locale;
20
21 ok(1);
22
23 #########################
24
25 my $objZhS = Unicode::Collate::Locale->
26     new(locale => 'ZH__stroke', normalization => undef);
27
28 ok($objZhS->getlocale, 'zh__stroke');
29
30 $objZhS->change(level => 1);
31
32 ok($objZhS->eq("a\x{304}", "a\x{301}"));
33 ok($objZhS->eq("a\x{301}", "a\x{30C}"));
34 ok($objZhS->eq("a\x{30C}", "a\x{300}"));
35 ok($objZhS->eq("a\x{300}", "a"));
36 ok($objZhS->eq("e\x{304}", "e\x{301}"));
37 ok($objZhS->eq("e\x{301}", "e\x{30C}"));
38 ok($objZhS->eq("e\x{30C}", "e\x{300}"));
39 ok($objZhS->eq("e\x{300}", "e"));
40 ok($objZhS->eq("e\x{302}\x{304}", "e\x{302}\x{301}"));
41 ok($objZhS->eq("e\x{302}\x{301}", "e\x{302}\x{30C}"));
42 ok($objZhS->eq("e\x{302}\x{30C}", "e\x{302}\x{300}"));
43 ok($objZhS->eq("e\x{302}\x{300}", "e\x{302}"));
44 ok($objZhS->eq("i\x{304}", "i\x{301}"));
45 ok($objZhS->eq("i\x{301}", "i\x{30C}"));
46 ok($objZhS->eq("i\x{30C}", "i\x{300}"));
47 ok($objZhS->eq("i\x{300}", "i"));
48 ok($objZhS->eq("m\x{304}", "m\x{301}"));
49 ok($objZhS->eq("m\x{301}", "m\x{30C}"));
50 ok($objZhS->eq("m\x{30C}", "m\x{300}"));
51 ok($objZhS->eq("m\x{300}", "m"));
52 ok($objZhS->eq("n\x{304}", "n\x{301}"));
53 ok($objZhS->eq("n\x{301}", "n\x{30C}"));
54 ok($objZhS->eq("n\x{30C}", "n\x{300}"));
55 ok($objZhS->eq("n\x{300}", "n"));
56 ok($objZhS->eq("o\x{304}", "o\x{301}"));
57 ok($objZhS->eq("o\x{301}", "o\x{30C}"));
58 ok($objZhS->eq("o\x{30C}", "o\x{300}"));
59 ok($objZhS->eq("o\x{300}", "o"));
60 ok($objZhS->eq("u\x{304}", "u\x{301}"));
61 ok($objZhS->eq("u\x{301}", "u\x{30C}"));
62 ok($objZhS->eq("u\x{30C}", "u\x{300}"));
63 ok($objZhS->eq("u\x{300}", "u"));
64 ok($objZhS->eq("u\x{308}\x{304}", "u\x{308}\x{301}"));
65 ok($objZhS->eq("u\x{308}\x{301}", "u\x{308}\x{30C}"));
66 ok($objZhS->eq("u\x{308}\x{30C}", "u\x{308}\x{300}"));
67 ok($objZhS->eq("u\x{308}\x{300}", "u\x{308}"));
68
69 # 38
70
71 $objZhS->change(level => 2);
72
73 ok($objZhS->lt("a\x{304}", "a\x{301}"));
74 ok($objZhS->lt("a\x{301}", "a\x{30C}"));
75 ok($objZhS->lt("a\x{30C}", "a\x{300}"));
76 ok($objZhS->lt("a\x{300}", "a"));
77 ok($objZhS->lt("e\x{304}", "e\x{301}"));
78 ok($objZhS->lt("e\x{301}", "e\x{30C}"));
79 ok($objZhS->lt("e\x{30C}", "e\x{300}"));
80 ok($objZhS->lt("e\x{300}", "e"));
81 ok($objZhS->lt("e\x{302}\x{304}", "e\x{302}\x{301}"));
82 ok($objZhS->lt("e\x{302}\x{301}", "e\x{302}\x{30C}"));
83 ok($objZhS->lt("e\x{302}\x{30C}", "e\x{302}\x{300}"));
84 ok($objZhS->lt("e\x{302}\x{300}", "e\x{302}"));
85 ok($objZhS->lt("i\x{304}", "i\x{301}"));
86 ok($objZhS->lt("i\x{301}", "i\x{30C}"));
87 ok($objZhS->lt("i\x{30C}", "i\x{300}"));
88 ok($objZhS->lt("i\x{300}", "i"));
89 ok($objZhS->lt("m\x{304}", "m\x{301}"));
90 ok($objZhS->lt("m\x{301}", "m\x{30C}"));
91 ok($objZhS->lt("m\x{30C}", "m\x{300}"));
92 ok($objZhS->lt("m\x{300}", "m"));
93 ok($objZhS->lt("n\x{304}", "n\x{301}"));
94 ok($objZhS->lt("n\x{301}", "n\x{30C}"));
95 ok($objZhS->lt("n\x{30C}", "n\x{300}"));
96 ok($objZhS->lt("n\x{300}", "n"));
97 ok($objZhS->lt("o\x{304}", "o\x{301}"));
98 ok($objZhS->lt("o\x{301}", "o\x{30C}"));
99 ok($objZhS->lt("o\x{30C}", "o\x{300}"));
100 ok($objZhS->lt("o\x{300}", "o"));
101 ok($objZhS->lt("u\x{304}", "u\x{301}"));
102 ok($objZhS->lt("u\x{301}", "u\x{30C}"));
103 ok($objZhS->lt("u\x{30C}", "u\x{300}"));
104 ok($objZhS->lt("u\x{300}", "u"));
105 ok($objZhS->lt("u\x{308}\x{304}", "u\x{308}\x{301}"));
106 ok($objZhS->lt("u\x{308}\x{301}", "u\x{308}\x{30C}"));
107 ok($objZhS->lt("u\x{308}\x{30C}", "u\x{308}\x{300}"));
108 ok($objZhS->lt("u\x{308}\x{300}", "u\x{308}"));
109
110 # 74
111
112 ok($objZhS->eq("a\x{304}", "A\x{304}"));
113 ok($objZhS->eq("a\x{301}", "A\x{301}"));
114 ok($objZhS->eq("a\x{30C}", "A\x{30C}"));
115 ok($objZhS->eq("a\x{300}", "A\x{300}"));
116 ok($objZhS->eq("e\x{304}", "E\x{304}"));
117 ok($objZhS->eq("e\x{301}", "E\x{301}"));
118 ok($objZhS->eq("e\x{30C}", "E\x{30C}"));
119 ok($objZhS->eq("e\x{300}", "E\x{300}"));
120 ok($objZhS->eq("e\x{302}\x{304}", "E\x{302}\x{304}"));
121 ok($objZhS->eq("e\x{302}\x{301}", "E\x{302}\x{301}"));
122 ok($objZhS->eq("e\x{302}\x{30C}", "E\x{302}\x{30C}"));
123 ok($objZhS->eq("e\x{302}\x{300}", "E\x{302}\x{300}"));
124 ok($objZhS->eq("e\x{302}", "E\x{302}"));
125 ok($objZhS->eq("i\x{304}", "I\x{304}"));
126 ok($objZhS->eq("i\x{301}", "I\x{301}"));
127 ok($objZhS->eq("i\x{30C}", "I\x{30C}"));
128 ok($objZhS->eq("i\x{300}", "I\x{300}"));
129 ok($objZhS->eq("m\x{304}", "M\x{304}"));
130 ok($objZhS->eq("m\x{301}", "M\x{301}"));
131 ok($objZhS->eq("m\x{30C}", "M\x{30C}"));
132 ok($objZhS->eq("m\x{300}", "M\x{300}"));
133 ok($objZhS->eq("n\x{304}", "N\x{304}"));
134 ok($objZhS->eq("n\x{301}", "N\x{301}"));
135 ok($objZhS->eq("n\x{30C}", "N\x{30C}"));
136 ok($objZhS->eq("n\x{300}", "N\x{300}"));
137 ok($objZhS->eq("o\x{304}", "O\x{304}"));
138 ok($objZhS->eq("o\x{301}", "O\x{301}"));
139 ok($objZhS->eq("o\x{30C}", "O\x{30C}"));
140 ok($objZhS->eq("o\x{300}", "O\x{300}"));
141 ok($objZhS->eq("u\x{304}", "U\x{304}"));
142 ok($objZhS->eq("u\x{301}", "U\x{301}"));
143 ok($objZhS->eq("u\x{30C}", "U\x{30C}"));
144 ok($objZhS->eq("u\x{300}", "U\x{300}"));
145 ok($objZhS->eq("u\x{308}\x{304}", "U\x{308}\x{304}"));
146 ok($objZhS->eq("u\x{308}\x{301}", "U\x{308}\x{301}"));
147 ok($objZhS->eq("u\x{308}\x{30C}", "U\x{308}\x{30C}"));
148 ok($objZhS->eq("u\x{308}\x{300}", "U\x{308}\x{300}"));
149 ok($objZhS->eq("u\x{308}", "U\x{308}"));
150
151 # 112
152
153 $objZhS->change(level => 3);
154
155 ok($objZhS->lt("a\x{304}", "A\x{304}"));
156 ok($objZhS->lt("a\x{301}", "A\x{301}"));
157 ok($objZhS->lt("a\x{30C}", "A\x{30C}"));
158 ok($objZhS->lt("a\x{300}", "A\x{300}"));
159 ok($objZhS->lt("e\x{304}", "E\x{304}"));
160 ok($objZhS->lt("e\x{301}", "E\x{301}"));
161 ok($objZhS->lt("e\x{30C}", "E\x{30C}"));
162 ok($objZhS->lt("e\x{300}", "E\x{300}"));
163 ok($objZhS->lt("e\x{302}\x{304}", "E\x{302}\x{304}"));
164 ok($objZhS->lt("e\x{302}\x{301}", "E\x{302}\x{301}"));
165 ok($objZhS->lt("e\x{302}\x{30C}", "E\x{302}\x{30C}"));
166 ok($objZhS->lt("e\x{302}\x{300}", "E\x{302}\x{300}"));
167 ok($objZhS->lt("e\x{302}", "E\x{302}"));
168 ok($objZhS->lt("i\x{304}", "I\x{304}"));
169 ok($objZhS->lt("i\x{301}", "I\x{301}"));
170 ok($objZhS->lt("i\x{30C}", "I\x{30C}"));
171 ok($objZhS->lt("i\x{300}", "I\x{300}"));
172 ok($objZhS->lt("m\x{304}", "M\x{304}"));
173 ok($objZhS->lt("m\x{301}", "M\x{301}"));
174 ok($objZhS->lt("m\x{30C}", "M\x{30C}"));
175 ok($objZhS->lt("m\x{300}", "M\x{300}"));
176 ok($objZhS->lt("n\x{304}", "N\x{304}"));
177 ok($objZhS->lt("n\x{301}", "N\x{301}"));
178 ok($objZhS->lt("n\x{30C}", "N\x{30C}"));
179 ok($objZhS->lt("n\x{300}", "N\x{300}"));
180 ok($objZhS->lt("o\x{304}", "O\x{304}"));
181 ok($objZhS->lt("o\x{301}", "O\x{301}"));
182 ok($objZhS->lt("o\x{30C}", "O\x{30C}"));
183 ok($objZhS->lt("o\x{300}", "O\x{300}"));
184 ok($objZhS->lt("u\x{304}", "U\x{304}"));
185 ok($objZhS->lt("u\x{301}", "U\x{301}"));
186 ok($objZhS->lt("u\x{30C}", "U\x{30C}"));
187 ok($objZhS->lt("u\x{300}", "U\x{300}"));
188 ok($objZhS->lt("u\x{308}\x{304}", "U\x{308}\x{304}"));
189 ok($objZhS->lt("u\x{308}\x{301}", "U\x{308}\x{301}"));
190 ok($objZhS->lt("u\x{308}\x{30C}", "U\x{308}\x{30C}"));
191 ok($objZhS->lt("u\x{308}\x{300}", "U\x{308}\x{300}"));
192 ok($objZhS->lt("u\x{308}", "U\x{308}"));
193
194 # 150
195
196 ok($objZhS->eq("a\x{304}", "\x{101}"));
197 ok($objZhS->eq("A\x{304}", "\x{100}"));
198 ok($objZhS->eq("a\x{301}", pack('U', 0xE1)));
199 ok($objZhS->eq("a\x{301}", "a\x{341}"));
200 ok($objZhS->eq("A\x{301}", pack('U', 0xC1)));
201 ok($objZhS->eq("A\x{301}", "A\x{341}"));
202 ok($objZhS->eq("a\x{30C}", "\x{1CE}"));
203 ok($objZhS->eq("A\x{30C}", "\x{1CD}"));
204 ok($objZhS->eq("a\x{300}", pack('U', 0xE0)));
205 ok($objZhS->eq("a\x{300}", "a\x{340}"));
206 ok($objZhS->eq("A\x{300}", pack('U', 0xC0)));
207 ok($objZhS->eq("A\x{300}", "A\x{340}"));
208 ok($objZhS->eq("e\x{304}", "\x{113}"));
209 ok($objZhS->eq("E\x{304}", "\x{112}"));
210 ok($objZhS->eq("e\x{301}", pack('U', 0xE9)));
211 ok($objZhS->eq("e\x{301}", "e\x{341}"));
212 ok($objZhS->eq("E\x{301}", pack('U', 0xC9)));
213 ok($objZhS->eq("E\x{301}", "E\x{341}"));
214 ok($objZhS->eq("e\x{30C}", "\x{11B}"));
215 ok($objZhS->eq("E\x{30C}", "\x{11A}"));
216 ok($objZhS->eq("e\x{300}", pack('U', 0xE8)));
217 ok($objZhS->eq("e\x{300}", "e\x{340}"));
218 ok($objZhS->eq("E\x{300}", pack('U', 0xC8)));
219 ok($objZhS->eq("E\x{300}", "E\x{340}"));
220 ok($objZhS->eq("e\x{302}\x{304}", pack('U*', 0xEA, 0x304)));
221 ok($objZhS->eq("E\x{302}\x{304}", pack('U*', 0xCA, 0x304)));
222 ok($objZhS->eq("e\x{302}\x{301}", "\x{1EBF}"));
223 ok($objZhS->eq("e\x{302}\x{301}", pack('U*', 0xEA, 0x301)));
224 ok($objZhS->eq("e\x{302}\x{301}", "e\x{302}\x{341}"));
225 ok($objZhS->eq("E\x{302}\x{301}", "\x{1EBE}"));
226 ok($objZhS->eq("E\x{302}\x{301}", pack('U*', 0xCA, 0x301)));
227 ok($objZhS->eq("E\x{302}\x{301}", "E\x{302}\x{341}"));
228 ok($objZhS->eq("e\x{302}\x{30C}", pack('U*', 0xEA, 0x30C)));
229 ok($objZhS->eq("E\x{302}\x{30C}", pack('U*', 0xCA, 0x30C)));
230 ok($objZhS->eq("e\x{302}\x{300}", "\x{1EC1}"));
231 ok($objZhS->eq("e\x{302}\x{300}", pack('U*', 0xEA, 0x300)));
232 ok($objZhS->eq("e\x{302}\x{300}", "e\x{302}\x{340}"));
233 ok($objZhS->eq("E\x{302}\x{300}", "\x{1EC0}"));
234 ok($objZhS->eq("E\x{302}\x{300}", pack('U*', 0xCA, 0x300)));
235 ok($objZhS->eq("E\x{302}\x{300}", "E\x{302}\x{340}"));
236 ok($objZhS->eq("e\x{302}", pack('U', 0xEA)));
237 ok($objZhS->eq("E\x{302}", pack('U', 0xCA)));
238 ok($objZhS->eq("i\x{304}", "\x{12B}"));
239 ok($objZhS->eq("I\x{304}", "\x{12A}"));
240 ok($objZhS->eq("i\x{301}", pack('U', 0xED)));
241 ok($objZhS->eq("i\x{301}", "i\x{341}"));
242 ok($objZhS->eq("I\x{301}", pack('U', 0xCD)));
243 ok($objZhS->eq("I\x{301}", "I\x{341}"));
244 ok($objZhS->eq("i\x{30C}", "\x{1D0}"));
245 ok($objZhS->eq("I\x{30C}", "\x{1CF}"));
246 ok($objZhS->eq("i\x{300}", pack('U', 0xEC)));
247 ok($objZhS->eq("i\x{300}", "i\x{340}"));
248 ok($objZhS->eq("I\x{300}", pack('U', 0xCC)));
249 ok($objZhS->eq("I\x{300}", "I\x{340}"));
250 ok($objZhS->eq("m\x{301}", "\x{1E3F}"));
251 ok($objZhS->eq("m\x{301}", "m\x{341}"));
252 ok($objZhS->eq("M\x{301}", "\x{1E3E}"));
253 ok($objZhS->eq("M\x{301}", "M\x{341}"));
254 ok($objZhS->eq("m\x{300}", "m\x{340}"));
255 ok($objZhS->eq("M\x{300}", "M\x{340}"));
256 ok($objZhS->eq("n\x{301}", "\x{144}"));
257 ok($objZhS->eq("n\x{301}", "n\x{341}"));
258 ok($objZhS->eq("N\x{301}", "\x{143}"));
259 ok($objZhS->eq("N\x{301}", "N\x{341}"));
260 ok($objZhS->eq("n\x{30C}", "\x{148}"));
261 ok($objZhS->eq("N\x{30C}", "\x{147}"));
262 ok($objZhS->eq("n\x{300}", "\x{1F9}"));
263 ok($objZhS->eq("n\x{300}", "n\x{340}"));
264 ok($objZhS->eq("N\x{300}", "\x{1F8}"));
265 ok($objZhS->eq("N\x{300}", "N\x{340}"));
266 ok($objZhS->eq("o\x{304}", "\x{14D}"));
267 ok($objZhS->eq("O\x{304}", "\x{14C}"));
268 ok($objZhS->eq("o\x{301}", pack('U', 0xF3)));
269 ok($objZhS->eq("o\x{301}", "o\x{341}"));
270 ok($objZhS->eq("O\x{301}", pack('U', 0xD3)));
271 ok($objZhS->eq("O\x{301}", "O\x{341}"));
272 ok($objZhS->eq("o\x{30C}", "\x{1D2}"));
273 ok($objZhS->eq("O\x{30C}", "\x{1D1}"));
274 ok($objZhS->eq("o\x{300}", pack('U', 0xF2)));
275 ok($objZhS->eq("o\x{300}", "o\x{340}"));
276 ok($objZhS->eq("O\x{300}", pack('U', 0xD2)));
277 ok($objZhS->eq("O\x{300}", "O\x{340}"));
278 ok($objZhS->eq("u\x{304}", "\x{16B}"));
279 ok($objZhS->eq("U\x{304}", "\x{16A}"));
280 ok($objZhS->eq("u\x{301}", pack('U', 0xFA)));
281 ok($objZhS->eq("u\x{301}", "u\x{341}"));
282 ok($objZhS->eq("U\x{301}", pack('U', 0xDA)));
283 ok($objZhS->eq("U\x{301}", "U\x{341}"));
284 ok($objZhS->eq("u\x{30C}", "\x{1D4}"));
285 ok($objZhS->eq("U\x{30C}", "\x{1D3}"));
286 ok($objZhS->eq("u\x{300}", pack('U', 0xF9)));
287 ok($objZhS->eq("u\x{300}", "u\x{340}"));
288 ok($objZhS->eq("U\x{300}", pack('U', 0xD9)));
289 ok($objZhS->eq("U\x{300}", "U\x{340}"));
290 ok($objZhS->eq("u\x{308}\x{304}", "\x{1D6}"));
291 ok($objZhS->eq("u\x{308}\x{304}", pack('U*', 0xFC, 0x304)));
292 ok($objZhS->eq("U\x{308}\x{304}", "\x{1D5}"));
293 ok($objZhS->eq("U\x{308}\x{304}", pack('U*', 0xDC, 0x304)));
294 ok($objZhS->eq("u\x{308}\x{301}", "\x{1D8}"));
295 ok($objZhS->eq("u\x{308}\x{301}", pack('U*', 0xFC, 0x301)));
296 ok($objZhS->eq("u\x{308}\x{301}", "u\x{308}\x{341}"));
297 ok($objZhS->eq("U\x{308}\x{301}", "\x{1D7}"));
298 ok($objZhS->eq("U\x{308}\x{301}", pack('U*', 0xDC, 0x301)));
299 ok($objZhS->eq("U\x{308}\x{301}", "U\x{308}\x{341}"));
300 ok($objZhS->eq("u\x{308}\x{30C}", "\x{1DA}"));
301 ok($objZhS->eq("u\x{308}\x{30C}", pack('U*', 0xFC, 0x30C)));
302 ok($objZhS->eq("U\x{308}\x{30C}", "\x{1D9}"));
303 ok($objZhS->eq("U\x{308}\x{30C}", pack('U*', 0xDC, 0x30C)));
304 ok($objZhS->eq("u\x{308}\x{300}", "\x{1DC}"));
305 ok($objZhS->eq("u\x{308}\x{300}", pack('U*', 0xFC, 0x300)));
306 ok($objZhS->eq("u\x{308}\x{300}", "u\x{308}\x{340}"));
307 ok($objZhS->eq("U\x{308}\x{300}", "\x{1DB}"));
308 ok($objZhS->eq("U\x{308}\x{300}", pack('U*', 0xDC, 0x300)));
309 ok($objZhS->eq("U\x{308}\x{300}", "U\x{308}\x{340}"));
310 ok($objZhS->eq("u\x{308}", pack('U', 0xFC)));
311 ok($objZhS->eq("U\x{308}", pack('U', 0xDC)));
312
313 # 266
314
315 ok($objZhS->eq("e\x{302}\x{303}", "\x{1EC5}"));
316 ok($objZhS->eq("E\x{302}\x{303}", "\x{1EC4}"));
317 ok($objZhS->eq("e\x{302}\x{309}", "\x{1EC3}"));
318 ok($objZhS->eq("E\x{302}\x{309}", "\x{1EC2}"));
319 ok($objZhS->eq("e\x{302}\x{323}", "\x{1EC7}"));
320 ok($objZhS->eq("E\x{302}\x{323}", "\x{1EC6}"));
321
322 # 272
323
324 $objZhS->change(level => 1);
325
326 ok($objZhS->lt("\x{A000}", "\x{4E00}"));
327
328 ok($objZhS->lt("\x{4E00}", "\x{4E59}"));
329 ok($objZhS->lt("\x{4E59}", "\x{4E01}"));
330 ok($objZhS->lt("\x{4E01}", "\x{4E03}"));
331 ok($objZhS->lt("\x{4E03}", "\x{4E43}"));
332 ok($objZhS->lt("\x{4E43}", "\x{4E5D}"));
333 ok($objZhS->lt("\x{4E5D}", "\x{4E86}"));
334 ok($objZhS->lt("\x{4E86}", "\x{4E8C}"));
335 ok($objZhS->lt("\x{4E8C}", "\x{4EBA}"));
336 ok($objZhS->lt("\x{4EBA}", "\x{513F}"));
337 ok($objZhS->lt("\x{513F}", "\x{5165}"));
338
339 ok($objZhS->lt("\x{9E1D}", "\x{7069}"));
340 ok($objZhS->lt("\x{7069}", "\x{706A}"));
341 ok($objZhS->lt("\x{706A}", "\x{7C72}"));
342 ok($objZhS->lt("\x{7C72}", "\x{7229}"));
343 ok($objZhS->lt("\x{7229}", "\x{9EA4}"));
344 ok($objZhS->lt("\x{9EA4}", "\x{9F7E}"));
345 ok($objZhS->lt("\x{9F7E}", "\x{9F49}"));
346 ok($objZhS->lt("\x{9F49}", "\x{9F98}"));
347
348 # 291