Commit | Line | Data |
---|---|---|
68adb2b0 CBW |
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 => 50 }; | |
16 | ||
f1a7422f CBW |
17 | use strict; |
18 | use warnings; | |
19 | use Unicode::Collate::Locale; | |
20 | ||
68adb2b0 CBW |
21 | ok(1); |
22 | ||
23 | ######################### | |
f1a7422f CBW |
24 | |
25 | my $objMt = Unicode::Collate::Locale-> | |
26 | new(locale => 'MT', normalization => undef); | |
27 | ||
f1a7422f CBW |
28 | ok($objMt->getlocale, 'mt'); |
29 | ||
30 | $objMt->change(level => 1); | |
31 | ||
32 | ok($objMt->lt("c", "c\x{307}")); | |
33 | ok($objMt->gt("d", "c\x{307}")); | |
34 | ok($objMt->lt("f", "g\x{307}")); | |
35 | ok($objMt->gt("g", "g\x{307}")); | |
36 | ok($objMt->lt("g", "gh\x{335}")); | |
37 | ok($objMt->gt("h", "gh\x{335}")); | |
38 | ok($objMt->lt("h", "h\x{335}")); | |
39 | ok($objMt->gt("i", "h\x{335}")); | |
40 | ok($objMt->lt("y", "z\x{307}")); | |
41 | ok($objMt->gt("z", "z\x{307}")); | |
42 | ||
43 | # 12 | |
44 | ||
45 | $objMt->change(level => 2); | |
46 | ||
47 | ok($objMt->eq("c\x{307}", "C\x{307}")); | |
48 | ok($objMt->eq("g\x{307}", "G\x{307}")); | |
49 | ok($objMt->eq("gh\x{335}","gH\x{335}")); | |
50 | ok($objMt->eq("gH\x{335}","Gh\x{335}")); | |
51 | ok($objMt->eq("Gh\x{335}","GH\x{335}")); | |
52 | ok($objMt->eq("h\x{335}", "H\x{335}")); | |
53 | ok($objMt->eq("z\x{307}", "Z\x{307}")); | |
54 | ||
55 | # 19 | |
56 | ||
57 | $objMt->change(level => 3); | |
58 | ||
59 | ok($objMt->gt("c\x{307}", "C\x{307}")); | |
60 | ok($objMt->gt("g\x{307}", "G\x{307}")); | |
61 | ok($objMt->gt("gh\x{335}","gH\x{335}")); | |
62 | ok($objMt->gt("gH\x{335}","Gh\x{335}")); | |
63 | ok($objMt->gt("Gh\x{335}","GH\x{335}")); | |
64 | ok($objMt->gt("h\x{335}", "H\x{335}")); | |
65 | ok($objMt->gt("z\x{307}", "Z\x{307}")); | |
66 | ||
67 | # 26 | |
68 | ||
69 | ok($objMt->eq("c\x{307}", "\x{10B}")); | |
70 | ok($objMt->eq("C\x{307}", "\x{10A}")); | |
71 | ok($objMt->eq("g\x{307}", "\x{121}")); | |
72 | ok($objMt->eq("G\x{307}", "\x{120}")); | |
73 | ok($objMt->eq("gh\x{335}","g\x{127}")); | |
74 | ok($objMt->eq("gH\x{335}","g\x{126}")); | |
75 | ok($objMt->eq("Gh\x{335}","G\x{127}")); | |
76 | ok($objMt->eq("GH\x{335}","G\x{126}")); | |
77 | ok($objMt->eq("h\x{335}", "\x{127}")); | |
78 | ok($objMt->eq("H\x{335}", "\x{126}")); | |
79 | ok($objMt->eq("z\x{307}", "\x{17C}")); | |
80 | ok($objMt->eq("Z\x{307}", "\x{17B}")); | |
81 | ||
82 | # 38 | |
83 | ||
84 | ok($objMt->gt("a", "A")); | |
85 | ok($objMt->gt("b", "B")); | |
86 | ok($objMt->gt("c", "C")); | |
87 | ok($objMt->gt("x", "X")); | |
88 | ok($objMt->gt("y", "Y")); | |
89 | ok($objMt->gt("z", "Z")); | |
90 | ||
91 | # 44 | |
68adb2b0 CBW |
92 | |
93 | $objMt->change(upper_before_lower => 0); | |
94 | ||
95 | ok($objMt->lt("a", "A")); | |
96 | ok($objMt->lt("b", "B")); | |
97 | ok($objMt->lt("c", "C")); | |
98 | ok($objMt->lt("x", "X")); | |
99 | ok($objMt->lt("y", "Y")); | |
100 | ok($objMt->lt("z", "Z")); | |
101 | ||
102 | # 50 |