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