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