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_kl.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 => 101 };
16
6484f676
CBW
17use strict;
18use warnings;
19use Unicode::Collate::Locale;
20
68adb2b0
CBW
21ok(1);
22
23#########################
6484f676
CBW
24
25my $eth = pack 'U', 0xF0;
26my $ETH = pack 'U', 0xD0;
27my $thrn = pack 'U', 0xFE;
28my $THRN = pack 'U', 0xDE;
29my $uuml = pack 'U', 0xFC;
30my $Uuml = pack 'U', 0xDC;
31my $ae = pack 'U', 0xE6;
32my $AE = pack 'U', 0xC6;
33my $auml = pack 'U', 0xE4;
34my $Auml = pack 'U', 0xC4;
35my $ostk = pack 'U', 0xF8;
36my $Ostk = pack 'U', 0xD8;
37my $ouml = pack 'U', 0xF6;
38my $Ouml = pack 'U', 0xD6;
39my $arng = pack 'U', 0xE5;
40my $Arng = pack 'U', 0xC5;
41
42my $objKl = Unicode::Collate::Locale->
43 new(locale => 'KL', normalization => undef);
44
6484f676
CBW
45ok($objKl->getlocale, 'kl');
46
47$objKl->change(level => 1);
48
49ok($objKl->lt('z', $ae));
50ok($objKl->lt($ae, $ostk));
51ok($objKl->lt($ostk, $arng));
19265284 52ok($objKl->lt($arng, "\x{1C0}"));
6484f676
CBW
53
54# 6
55
56ok($objKl->eq('d', "\x{111}"));
57ok($objKl->eq("\x{111}", $eth));
58ok($objKl->eq('q', "\x{138}"));
59ok($objKl->eq('q', "K'"));
60ok($objKl->eq('y', $uuml));
61ok($objKl->eq($uuml, "\x{171}"));
62ok($objKl->eq($ae, $auml));
63ok($objKl->eq($auml, "\x{119}"));
64ok($objKl->eq($ostk, $ouml));
65ok($objKl->eq($ouml, "\x{151}"));
66ok($objKl->eq("\x{151}", "\x{153}"));
67
68# 17
69
70$objKl->change(level => 2);
71
72ok($objKl->lt('d', "\x{111}"));
73ok($objKl->lt("\x{111}", $eth));
74ok($objKl->lt('q', "\x{138}"));
75ok($objKl->lt('q', "K'"));
76ok($objKl->lt('y', $uuml));
77ok($objKl->lt($uuml, "\x{171}"));
78ok($objKl->lt($ae, $auml));
79ok($objKl->lt($auml, "\x{119}"));
80ok($objKl->lt($ostk, $ouml));
81ok($objKl->lt($ouml, "\x{151}"));
82ok($objKl->lt("\x{151}", "\x{153}"));
83
84# 28
85
86ok($objKl->eq("\x{111}", "\x{110}"));
87ok($objKl->eq($eth, $ETH));
88ok($objKl->eq("\x{138}", "K'"));
89ok($objKl->eq('th', $thrn));
90ok($objKl->eq($thrn, 'TH'));
91ok($objKl->eq('TH', $THRN));
92ok($objKl->eq($uuml, $Uuml));
93ok($objKl->eq("\x{171}", "\x{170}"));
94ok($objKl->eq($ae, $AE));
95ok($objKl->eq($AE, "\x{1D2D}"));
96ok($objKl->eq($auml, $Auml));
97ok($objKl->eq("\x{119}", "\x{118}"));
98ok($objKl->eq($ostk, $Ostk));
99ok($objKl->eq($ouml, $Ouml));
100ok($objKl->eq("\x{151}", "\x{150}"));
101ok($objKl->eq("\x{153}", "\x{152}"));
102ok($objKl->eq($arng, $Arng));
103
104# 45
105
106$objKl->change(level => 3);
107
108ok($objKl->lt("\x{111}", "\x{110}"));
109ok($objKl->lt($eth, $ETH));
110ok($objKl->lt("\x{138}", "K'"));
111ok($objKl->lt('th', $thrn));
112ok($objKl->lt($thrn, 'TH'));
113ok($objKl->lt('TH', $THRN));
114ok($objKl->lt($uuml, $Uuml));
115ok($objKl->lt("\x{171}", "\x{170}"));
116ok($objKl->lt($ae, $AE));
117ok($objKl->lt($AE, "\x{1D2D}"));
118ok($objKl->lt($auml, $Auml));
119ok($objKl->lt("\x{119}", "\x{118}"));
120ok($objKl->lt($ostk, $Ostk));
121ok($objKl->lt($ouml, $Ouml));
122ok($objKl->lt("\x{151}", "\x{150}"));
123ok($objKl->lt("\x{153}", "\x{152}"));
124ok($objKl->lt($arng, $Arng));
125
126# 62
127
128ok($objKl->eq("d\x{335}", "\x{111}"));
129ok($objKl->eq("D\x{335}", "\x{110}"));
130ok($objKl->eq("u\x{308}", $uuml));
131ok($objKl->eq("U\x{308}", $Uuml));
1393fe00
CBW
132ok($objKl->eq("u\x{30B}", "\x{171}"));
133ok($objKl->eq("U\x{30B}", "\x{170}"));
134ok($objKl->eq("a\x{308}", $auml));
135ok($objKl->eq("A\x{308}", $Auml));
136ok($objKl->eq("e\x{328}", "\x{119}"));
137ok($objKl->eq("E\x{328}", "\x{118}"));
138ok($objKl->eq("o\x{338}", $ostk));
139ok($objKl->eq("O\x{338}", $Ostk));
140ok($objKl->eq("o\x{308}", $ouml));
141ok($objKl->eq("O\x{308}", $Ouml));
142ok($objKl->eq("o\x{30B}", "\x{151}"));
143ok($objKl->eq("O\x{30B}", "\x{150}"));
144ok($objKl->eq("a\x{30A}", $arng));
145ok($objKl->eq("A\x{30A}", $Arng));
146
147# 80
148
f1a7422f
CBW
149ok($objKl->eq("u\x{308}\x{300}", "\x{1DC}"));
150ok($objKl->eq("U\x{308}\x{300}", "\x{1DB}"));
151ok($objKl->eq("u\x{308}\x{301}", "\x{1D8}"));
152ok($objKl->eq("U\x{308}\x{301}", "\x{1D7}"));
153ok($objKl->eq("u\x{308}\x{304}", "\x{1D6}"));
154ok($objKl->eq("U\x{308}\x{304}", "\x{1D5}"));
155ok($objKl->eq("u\x{308}\x{30C}", "\x{1DA}"));
156ok($objKl->eq("U\x{308}\x{30C}", "\x{1D9}"));
6484f676
CBW
157ok($objKl->eq("\x{1FD}", "$ae\x{301}"));
158ok($objKl->eq("\x{1FC}", "$AE\x{301}"));
159ok($objKl->eq("\x{1E3}", "$ae\x{304}"));
160ok($objKl->eq("\x{1E2}", "$AE\x{304}"));
f1a7422f
CBW
161ok($objKl->eq("a\x{308}\x{304}", "\x{1DF}"));
162ok($objKl->eq("A\x{308}\x{304}", "\x{1DE}"));
6484f676
CBW
163ok($objKl->eq("o\x{338}\x{301}", "\x{1FF}"));
164ok($objKl->eq("O\x{338}\x{301}", "\x{1FE}"));
f1a7422f
CBW
165ok($objKl->eq("o\x{308}\x{304}", "\x{22B}"));
166ok($objKl->eq("O\x{308}\x{304}", "\x{22A}"));
6484f676
CBW
167ok($objKl->eq("A\x{30A}", "\x{212B}"));
168ok($objKl->eq("a\x{30A}\x{301}", "\x{1FB}"));
169ok($objKl->eq("A\x{30A}\x{301}", "\x{1FA}"));
170
f1a7422f 171# 101