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
115
|
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 => 491 };
use strict;
use warnings;
use Unicode::Collate;
ok(1);
my @Versions = (8, 9, 11, 14, 16, 18, 20);
# 12 compatibility ideographs are treated as unified ideographs:
# FA0E, FA0F, FA11, FA13, FA14, FA1F, FA21, FA23, FA24, FA27, FA28, FA29.
my $Collator = Unicode::Collate->new(
table => 'keys.txt',
normalization => undef,
);
for my $v (@Versions) {
$Collator->change(UCA_Version => $v);
ok($Collator->lt("\x{4E00}", "\x{1FFF}"));
ok($Collator->lt("\x{9FA5}", "\x{1FFF}"));
ok($Collator->gt("\x{FA00}", "\x{1FFF}"));
ok($Collator->gt("\x{FA0D}", "\x{1FFF}"));
ok($Collator->lt("\x{FA0E}", "\x{1FFF}"));
ok($Collator->lt("\x{FA0F}", "\x{1FFF}"));
ok($Collator->gt("\x{FA10}", "\x{1FFF}"));
ok($Collator->lt("\x{FA11}", "\x{1FFF}"));
ok($Collator->gt("\x{FA12}", "\x{1FFF}"));
ok($Collator->lt("\x{FA13}", "\x{1FFF}"));
ok($Collator->lt("\x{FA14}", "\x{1FFF}"));
ok($Collator->gt("\x{FA15}", "\x{1FFF}"));
ok($Collator->gt("\x{FA16}", "\x{1FFF}"));
ok($Collator->gt("\x{FA17}", "\x{1FFF}"));
ok($Collator->gt("\x{FA18}", "\x{1FFF}"));
ok($Collator->gt("\x{FA19}", "\x{1FFF}"));
ok($Collator->gt("\x{FA1A}", "\x{1FFF}"));
ok($Collator->gt("\x{FA1B}", "\x{1FFF}"));
ok($Collator->gt("\x{FA1C}", "\x{1FFF}"));
ok($Collator->gt("\x{FA1D}", "\x{1FFF}"));
ok($Collator->gt("\x{FA1E}", "\x{1FFF}"));
ok($Collator->lt("\x{FA1F}", "\x{1FFF}"));
ok($Collator->gt("\x{FA20}", "\x{1FFF}"));
ok($Collator->lt("\x{FA21}", "\x{1FFF}"));
ok($Collator->gt("\x{FA22}", "\x{1FFF}"));
ok($Collator->lt("\x{FA23}", "\x{1FFF}"));
ok($Collator->lt("\x{FA24}", "\x{1FFF}"));
ok($Collator->gt("\x{FA25}", "\x{1FFF}"));
ok($Collator->gt("\x{FA26}", "\x{1FFF}"));
ok($Collator->lt("\x{FA27}", "\x{1FFF}"));
ok($Collator->lt("\x{FA28}", "\x{1FFF}"));
ok($Collator->lt("\x{FA29}", "\x{1FFF}"));
ok($Collator->gt("\x{FA2A}", "\x{1FFF}"));
ok($Collator->gt("\x{FA30}", "\x{1FFF}"));
ok($Collator->gt("\x{FAFF}", "\x{1FFF}"));
}
my $IgnoreCJK = Unicode::Collate->new(
table => 'keys.txt',
normalization => undef,
overrideCJK => sub {()},
);
for my $v (@Versions) {
$IgnoreCJK->change(UCA_Version => $v);
ok($IgnoreCJK->eq("\x{4E00}", ""));
ok($IgnoreCJK->eq("\x{9FA5}", ""));
ok($IgnoreCJK->gt("\x{FA00}", "\x{1FFF}"));
ok($IgnoreCJK->gt("\x{FA0D}", "\x{1FFF}"));
ok($IgnoreCJK->eq("\x{FA0E}", ""));
ok($IgnoreCJK->eq("\x{FA0F}", ""));
ok($IgnoreCJK->gt("\x{FA10}", "\x{1FFF}"));
ok($IgnoreCJK->eq("\x{FA11}", ""));
ok($IgnoreCJK->gt("\x{FA12}", "\x{1FFF}"));
ok($IgnoreCJK->eq("\x{FA13}", ""));
ok($IgnoreCJK->eq("\x{FA14}", ""));
ok($IgnoreCJK->gt("\x{FA15}", "\x{1FFF}"));
ok($IgnoreCJK->gt("\x{FA16}", "\x{1FFF}"));
ok($IgnoreCJK->gt("\x{FA17}", "\x{1FFF}"));
ok($IgnoreCJK->gt("\x{FA18}", "\x{1FFF}"));
ok($IgnoreCJK->gt("\x{FA19}", "\x{1FFF}"));
ok($IgnoreCJK->gt("\x{FA1A}", "\x{1FFF}"));
ok($IgnoreCJK->gt("\x{FA1B}", "\x{1FFF}"));
ok($IgnoreCJK->gt("\x{FA1C}", "\x{1FFF}"));
ok($IgnoreCJK->gt("\x{FA1D}", "\x{1FFF}"));
ok($IgnoreCJK->gt("\x{FA1E}", "\x{1FFF}"));
ok($IgnoreCJK->eq("\x{FA1F}", ""));
ok($IgnoreCJK->gt("\x{FA20}", "\x{1FFF}"));
ok($IgnoreCJK->eq("\x{FA21}", ""));
ok($IgnoreCJK->gt("\x{FA22}", "\x{1FFF}"));
ok($IgnoreCJK->eq("\x{FA23}", ""));
ok($IgnoreCJK->eq("\x{FA24}", ""));
ok($IgnoreCJK->gt("\x{FA25}", "\x{1FFF}"));
ok($IgnoreCJK->gt("\x{FA26}", "\x{1FFF}"));
ok($IgnoreCJK->eq("\x{FA27}", ""));
ok($IgnoreCJK->eq("\x{FA28}", ""));
ok($IgnoreCJK->eq("\x{FA29}", ""));
ok($IgnoreCJK->gt("\x{FA2A}", "\x{1FFF}"));
ok($IgnoreCJK->gt("\x{FA30}", "\x{1FFF}"));
ok($IgnoreCJK->gt("\x{FAFF}", "\x{1FFF}"));
}
|