1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
|
BEGIN {
unless ("A" eq pack('U', 0x41)) {
print "1..0 # Unicode::Collate " .
"cannot stringify a Unicode code point\n";
exit 0;
}
if ($ENV{PERL_CORE}) {
chdir('t') if -d 't';
@INC = $^O eq 'MacOS' ? qw(::lib) : qw(../lib);
}
}
use strict;
use warnings;
BEGIN { $| = 1; print "1..34\n"; }
my $count = 0;
sub ok ($;$) {
my $p = my $r = shift;
if (@_) {
my $x = shift;
$p = !defined $x ? !defined $r : !defined $r ? 0 : $r eq $x;
}
print $p ? "ok" : "not ok", ' ', ++$count, "\n";
}
use Unicode::Collate::Locale;
ok(1);
#########################
my $objCs = Unicode::Collate::Locale->
new(locale => 'CS', normalization => undef);
ok($objCs->getlocale, 'cs');
$objCs->change(level => 1);
ok($objCs->lt("c", "c\x{30C}"));
ok($objCs->gt("d", "c\x{30C}"));
ok($objCs->lt("h", "ch"));
ok($objCs->gt("i", "ch"));
ok($objCs->lt("r", "r\x{30C}"));
ok($objCs->gt("s", "r\x{30C}"));
ok($objCs->lt("s", "s\x{30C}"));
ok($objCs->gt("t", "s\x{30C}"));
ok($objCs->lt("z", "z\x{30C}"));
ok($objCs->lt("z\x{30C}", "\x{292}")); # U+0292 EZH
# 12
$objCs->change(level => 2);
ok($objCs->eq("c\x{30C}", "C\x{30C}"));
ok($objCs->eq("r\x{30C}", "R\x{30C}"));
ok($objCs->eq("s\x{30C}", "S\x{30C}"));
ok($objCs->eq("z\x{30C}", "Z\x{30C}"));
ok($objCs->eq("ch", "cH"));
ok($objCs->eq("cH", "Ch"));
ok($objCs->eq("Ch", "CH"));
# 19
$objCs->change(level => 3);
ok($objCs->lt("c\x{30C}", "C\x{30C}"));
ok($objCs->lt("r\x{30C}", "R\x{30C}"));
ok($objCs->lt("s\x{30C}", "S\x{30C}"));
ok($objCs->lt("z\x{30C}", "Z\x{30C}"));
ok($objCs->lt("ch", "cH"));
ok($objCs->lt("cH", "Ch"));
ok($objCs->lt("Ch", "CH"));
# 26
ok($objCs->eq("c\x{30C}", "\x{10D}"));
ok($objCs->eq("C\x{30C}", "\x{10C}"));
ok($objCs->eq("r\x{30C}", "\x{159}"));
ok($objCs->eq("R\x{30C}", "\x{158}"));
ok($objCs->eq("s\x{30C}", "\x{161}"));
ok($objCs->eq("S\x{30C}", "\x{160}"));
ok($objCs->eq("z\x{30C}", "\x{17E}"));
ok($objCs->eq("Z\x{30C}", "\x{17D}"));
# 34
|