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
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
|
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 Test;
BEGIN { plan tests => 66 };
use strict;
use warnings;
use Unicode::Collate;
ok(1);
##### 2..6
my $ignoreCJK = Unicode::Collate->new(
table => undef,
normalization => undef,
overrideCJK => sub {()},
entry => <<'ENTRIES',
5B57 ; [.0107.0020.0002.5B57] # CJK Ideograph "Letter"
ENTRIES
);
# All CJK Unified Ideographs except U+5B57 are ignored.
ok($ignoreCJK->eq("\x{4E00}", ""));
ok($ignoreCJK->lt("\x{4E00}", "\0"));
ok($ignoreCJK->eq("Pe\x{4E00}rl", "Perl")); # U+4E00 is a CJK.
ok($ignoreCJK->gt("\x{4DFF}", "\x{4E00}")); # U+4DFF is not CJK.
ok($ignoreCJK->lt("Pe\x{5B57}rl", "Perl")); # 'r' is unassigned.
##### 7..20
ok($ignoreCJK->eq("\x{3400}", ""));
ok($ignoreCJK->eq("\x{4DB5}", ""));
ok($ignoreCJK->eq("\x{9FA5}", ""));
ok($ignoreCJK->eq("\x{9FA6}", "")); # UI since Unicode 4.1.0
ok($ignoreCJK->eq("\x{9FBB}", "")); # UI since Unicode 4.1.0
ok($ignoreCJK->eq("\x{9FBC}", "")); # UI since Unicode 5.1.0
ok($ignoreCJK->eq("\x{9FC3}", "")); # UI since Unicode 5.1.0
ok($ignoreCJK->eq("\x{9FC4}", "")); # UI since Unicode 5.2.0
ok($ignoreCJK->eq("\x{9FCB}", "")); # UI since Unicode 5.2.0
ok($ignoreCJK->gt("\x{9FCC}", "Perl"));
ok($ignoreCJK->eq("\x{20000}", "")); # ExtB since Unicode 3.1.0
ok($ignoreCJK->eq("\x{2A6D6}", "")); # ExtB since Unicode 3.1.0
ok($ignoreCJK->eq("\x{2A700}", "")); # ExtC since Unicode 5.2.0
ok($ignoreCJK->eq("\x{2B734}", "")); # ExtC since Unicode 5.2.0
##### 21..30
$ignoreCJK->change(UCA_Version => 8);
ok($ignoreCJK->eq("\x{3400}", ""));
ok($ignoreCJK->eq("\x{4DB5}", ""));
ok($ignoreCJK->eq("\x{9FA5}", ""));
ok($ignoreCJK->gt("\x{9FA6}", "Perl"));
ok($ignoreCJK->gt("\x{9FBB}", "Perl"));
ok($ignoreCJK->gt("\x{9FBC}", "Perl"));
ok($ignoreCJK->gt("\x{9FC3}", "Perl"));
ok($ignoreCJK->gt("\x{9FC4}", "Perl"));
ok($ignoreCJK->eq("\x{20000}", "")); # ExtB since Unicode 3.1.0
ok($ignoreCJK->eq("\x{2A6D6}", "")); # ExtB since Unicode 3.1.0
##### 31..40
$ignoreCJK->change(UCA_Version => 9);
ok($ignoreCJK->eq("\x{3400}", ""));
ok($ignoreCJK->eq("\x{4DB5}", ""));
ok($ignoreCJK->eq("\x{9FA5}", ""));
ok($ignoreCJK->gt("\x{9FA6}", "Perl"));
ok($ignoreCJK->gt("\x{9FBB}", "Perl"));
ok($ignoreCJK->gt("\x{9FBC}", "Perl"));
ok($ignoreCJK->gt("\x{9FC3}", "Perl"));
ok($ignoreCJK->gt("\x{9FC4}", "Perl"));
ok($ignoreCJK->eq("\x{20000}", "")); # ExtB since Unicode 3.1.0
ok($ignoreCJK->eq("\x{2A6D6}", "")); # ExtB since Unicode 3.1.0
##### 41..52
$ignoreCJK->change(UCA_Version => 14);
ok($ignoreCJK->eq("\x{3400}", ""));
ok($ignoreCJK->eq("\x{4DB5}", ""));
ok($ignoreCJK->eq("\x{9FA5}", ""));
ok($ignoreCJK->eq("\x{9FA6}", "")); # UI since Unicode 4.1.0
ok($ignoreCJK->eq("\x{9FBB}", "")); # UI since Unicode 4.1.0
ok($ignoreCJK->gt("\x{9FBC}", "Perl"));
ok($ignoreCJK->gt("\x{9FC3}", "Perl"));
ok($ignoreCJK->gt("\x{9FC4}", "Perl"));
ok($ignoreCJK->eq("\x{20000}", "")); # ExtB since Unicode 3.1.0
ok($ignoreCJK->eq("\x{2A6D6}", "")); # ExtB since Unicode 3.1.0
ok($ignoreCJK->gt("\x{2A700}", "Perl"));
ok($ignoreCJK->gt("\x{2B734}", "Perl"));
##### 53..66
$ignoreCJK->change(UCA_Version => 18);
ok($ignoreCJK->eq("\x{3400}", ""));
ok($ignoreCJK->eq("\x{4DB5}", ""));
ok($ignoreCJK->eq("\x{9FA5}", ""));
ok($ignoreCJK->eq("\x{9FA6}", "")); # UI since Unicode 4.1.0
ok($ignoreCJK->eq("\x{9FBB}", "")); # UI since Unicode 4.1.0
ok($ignoreCJK->eq("\x{9FBC}", "")); # UI since Unicode 5.1.0
ok($ignoreCJK->eq("\x{9FC3}", "")); # UI since Unicode 5.1.0
ok($ignoreCJK->gt("\x{9FC4}", "Perl"));
ok($ignoreCJK->gt("\x{9FCB}", "Perl"));
ok($ignoreCJK->gt("\x{9FCC}", "Perl"));
ok($ignoreCJK->eq("\x{20000}", "")); # ExtB since Unicode 3.1.0
ok($ignoreCJK->eq("\x{2A6D6}", "")); # ExtB since Unicode 3.1.0
ok($ignoreCJK->gt("\x{2A700}", "Perl"));
ok($ignoreCJK->gt("\x{2B734}", "Perl"));
|