3 unless ("A" eq pack('U', 0x41)) {
4 print "1..0 # Unicode::Collate " .
5 "cannot stringify a Unicode code point\n";
10 @INC = $^O eq 'MacOS' ? qw(::lib) : qw(../lib);
15 BEGIN { plan tests => 23 };
23 #########################
25 my $Collator = Unicode::Collate->new(
27 normalization => undef,
31 # rearrange : 0x0E40..0x0E44, 0x0EC0..0x0EC4 (default)
35 my %old_rearrange = $Collator->change(rearrange => undef);
37 ok($Collator->gt("\x{0E41}A", "\x{0E40}B"));
38 ok($Collator->gt("A\x{0E41}A", "A\x{0E40}B"));
40 $Collator->change(rearrange => [ 0x61 ]);
41 # U+0061, 'a': This is a Unicode value, never a native value.
43 ok($Collator->gt("ab", "AB")); # as 'ba' > 'AB'
45 $Collator->change(%old_rearrange);
47 ok($Collator->lt("ab", "AB"));
48 ok($Collator->lt("\x{0E40}", "\x{0E41}"));
49 ok($Collator->lt("\x{0E40}A", "\x{0E41}B"));
50 ok($Collator->lt("\x{0E41}A", "\x{0E40}B"));
51 ok($Collator->lt("A\x{0E41}A", "A\x{0E40}B"));
55 my $all_undef_8 = Unicode::Collate->new(
57 normalization => undef,
59 overrideHangul => undef,
63 ok($all_undef_8->lt("\x{0E40}", "\x{0E41}"));
64 ok($all_undef_8->lt("\x{0E40}A", "\x{0E41}B"));
65 ok($all_undef_8->lt("\x{0E41}A", "\x{0E40}B"));
66 ok($all_undef_8->lt("A\x{0E41}A", "A\x{0E40}B"));
70 my $no_rearrange = Unicode::Collate->new(
72 normalization => undef,
77 ok($no_rearrange->lt("A", "B"));
78 ok($no_rearrange->lt("\x{0E40}", "\x{0E41}"));
79 ok($no_rearrange->lt("\x{0E40}A", "\x{0E41}B"));
80 ok($no_rearrange->gt("\x{0E41}A", "\x{0E40}B"));
81 ok($no_rearrange->gt("A\x{0E41}A", "A\x{0E40}B"));
85 my $undef_rearrange = Unicode::Collate->new(
87 normalization => undef,
92 ok($undef_rearrange->lt("A", "B"));
93 ok($undef_rearrange->lt("\x{0E40}", "\x{0E41}"));
94 ok($undef_rearrange->lt("\x{0E40}A", "\x{0E41}B"));
95 ok($undef_rearrange->gt("\x{0E41}A", "\x{0E40}B"));
96 ok($undef_rearrange->gt("A\x{0E41}A", "A\x{0E40}B"));