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