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_da.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 => 117 };
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 $objDa = Unicode::Collate::Locale->
43 new(locale => 'DA', normalization => undef);
44
6484f676
CBW
45ok($objDa->getlocale, 'da');
46
47$objDa->change(level => 1);
48
49ok($objDa->lt('z', $ae));
50ok($objDa->lt($ae, $ostk));
51ok($objDa->lt($ostk, $arng));
19265284 52ok($objDa->lt($arng, "\x{1C0}"));
6484f676
CBW
53
54# 6
55
56ok($objDa->eq('d', "\x{111}"));
57ok($objDa->eq("\x{111}", $eth));
58ok($objDa->eq('y', $uuml));
59ok($objDa->eq($uuml, "\x{171}"));
60ok($objDa->eq($ae, $auml));
61ok($objDa->eq($auml, "\x{119}"));
62ok($objDa->eq($ostk, $ouml));
63ok($objDa->eq($ouml, "\x{151}"));
64ok($objDa->eq("\x{151}", "\x{153}"));
65
66# 15
67
68$objDa->change(level => 2);
69
70ok($objDa->lt('d', "\x{111}"));
71ok($objDa->lt("\x{111}", $eth));
72ok($objDa->lt('y', $uuml));
73ok($objDa->lt($uuml, "\x{171}"));
74ok($objDa->lt($ae, $auml));
75ok($objDa->lt($auml, "\x{119}"));
76ok($objDa->lt($ostk, $ouml));
77ok($objDa->lt($ouml, "\x{151}"));
78ok($objDa->lt("\x{151}", "\x{153}"));
79
80# 24
81
82ok($objDa->eq("\x{111}", "\x{110}"));
83ok($objDa->eq($eth, $ETH));
84ok($objDa->eq('th', $thrn));
85ok($objDa->eq($thrn, 'TH'));
86ok($objDa->eq('TH', $THRN));
87ok($objDa->eq($uuml, $Uuml));
88ok($objDa->eq("\x{171}", "\x{170}"));
89ok($objDa->eq($ae, $AE));
90ok($objDa->eq($AE, "\x{1D2D}"));
91ok($objDa->eq($auml, $Auml));
92ok($objDa->eq("\x{119}", "\x{118}"));
93ok($objDa->eq($ostk, $Ostk));
94ok($objDa->eq($ouml, $Ouml));
95ok($objDa->eq("\x{151}", "\x{150}"));
96ok($objDa->eq("\x{153}", "\x{152}"));
97ok($objDa->eq($arng, $Arng));
98ok($objDa->eq($Arng, 'AA'));
99ok($objDa->eq('AA', 'aA'));
100ok($objDa->eq('aA', 'Aa'));
101ok($objDa->eq('Aa', $arng));
102ok($objDa->eq($arng, 'aa'));
103
104# 45
105
106$objDa->change(level => 3);
107
108ok($objDa->gt("\x{111}", "\x{110}"));
109ok($objDa->gt($eth, $ETH));
110ok($objDa->lt('th', $thrn));
111ok($objDa->gt($thrn, 'TH'));
112ok($objDa->lt('TH', $THRN));
113ok($objDa->gt($uuml, $Uuml));
114ok($objDa->gt("\x{171}", "\x{170}"));
115ok($objDa->gt($ae, $AE));
116ok($objDa->lt($AE, "\x{1D2D}"));
117ok($objDa->gt($auml, $Auml));
118ok($objDa->gt("\x{119}", "\x{118}"));
119ok($objDa->gt($ostk, $Ostk));
120ok($objDa->gt($ouml, $Ouml));
121ok($objDa->gt("\x{151}", "\x{150}"));
122ok($objDa->gt("\x{153}", "\x{152}"));
123ok($objDa->gt($arng, $Arng));
124ok($objDa->lt($Arng, 'AA'));
125ok($objDa->lt('AA', 'aA'));
126ok($objDa->lt('aA', 'Aa'));
127ok($objDa->lt('Aa', $arng));
128ok($objDa->lt($arng, 'aa'));
129
130# 66
131
132ok($objDa->eq("d\x{335}", "\x{111}"));
133ok($objDa->eq("D\x{335}", "\x{110}"));
134ok($objDa->eq("u\x{308}", $uuml));
135ok($objDa->eq("U\x{308}", $Uuml));
1393fe00
CBW
136ok($objDa->eq("u\x{30B}", "\x{171}"));
137ok($objDa->eq("U\x{30B}", "\x{170}"));
138ok($objDa->eq("a\x{308}", $auml));
139ok($objDa->eq("A\x{308}", $Auml));
140ok($objDa->eq("e\x{328}", "\x{119}"));
141ok($objDa->eq("E\x{328}", "\x{118}"));
142ok($objDa->eq("o\x{338}", $ostk));
143ok($objDa->eq("O\x{338}", $Ostk));
144ok($objDa->eq("o\x{308}", $ouml));
145ok($objDa->eq("O\x{308}", $Ouml));
146ok($objDa->eq("o\x{30B}", "\x{151}"));
147ok($objDa->eq("O\x{30B}", "\x{150}"));
148ok($objDa->eq("a\x{30A}", $arng));
149ok($objDa->eq("A\x{30A}", $Arng));
150
151# 84
152
f1a7422f
CBW
153ok($objDa->eq("u\x{308}\x{300}", "\x{1DC}"));
154ok($objDa->eq("U\x{308}\x{300}", "\x{1DB}"));
155ok($objDa->eq("u\x{308}\x{301}", "\x{1D8}"));
156ok($objDa->eq("U\x{308}\x{301}", "\x{1D7}"));
157ok($objDa->eq("u\x{308}\x{304}", "\x{1D6}"));
158ok($objDa->eq("U\x{308}\x{304}", "\x{1D5}"));
159ok($objDa->eq("u\x{308}\x{30C}", "\x{1DA}"));
160ok($objDa->eq("U\x{308}\x{30C}", "\x{1D9}"));
6484f676
CBW
161ok($objDa->eq("\x{1FD}", "$ae\x{301}"));
162ok($objDa->eq("\x{1FC}", "$AE\x{301}"));
163ok($objDa->eq("\x{1E3}", "$ae\x{304}"));
164ok($objDa->eq("\x{1E2}", "$AE\x{304}"));
f1a7422f
CBW
165ok($objDa->eq("a\x{308}\x{304}", "\x{1DF}"));
166ok($objDa->eq("A\x{308}\x{304}", "\x{1DE}"));
6484f676
CBW
167ok($objDa->eq("o\x{338}\x{301}", "\x{1FF}"));
168ok($objDa->eq("O\x{338}\x{301}", "\x{1FE}"));
f1a7422f
CBW
169ok($objDa->eq("o\x{308}\x{304}", "\x{22B}"));
170ok($objDa->eq("O\x{308}\x{304}", "\x{22A}"));
6484f676
CBW
171ok($objDa->eq("A\x{30A}", "\x{212B}"));
172ok($objDa->eq("a\x{30A}\x{301}", "\x{1FB}"));
173ok($objDa->eq("A\x{30A}\x{301}", "\x{1FA}"));
174
f1a7422f 175# 105
6484f676
CBW
176
177ok($objDa->gt("a", "A"));
178ok($objDa->gt("b", "B"));
179ok($objDa->gt("c", "C"));
180ok($objDa->gt("x", "X"));
181ok($objDa->gt("y", "Y"));
182ok($objDa->gt("z", "Z"));
183
f1a7422f 184# 111
68adb2b0
CBW
185
186$objDa->change(upper_before_lower => 0);
187
188ok($objDa->lt("a", "A"));
189ok($objDa->lt("b", "B"));
190ok($objDa->lt("c", "C"));
191ok($objDa->lt("x", "X"));
192ok($objDa->lt("y", "Y"));
193ok($objDa->lt("z", "Z"));
194
195# 117