1
2BEGIN {
3    unless ('A' eq pack('U', 0x41)) {
4	print "1..0 # Unicode::Collate cannot pack a Unicode code point\n";
5	exit 0;
6    }
7    unless (0x41 == unpack('U', 'A')) {
8	print "1..0 # Unicode::Collate cannot get a Unicode code point\n";
9	exit 0;
10    }
11    if ($ENV{PERL_CORE}) {
12	chdir('t') if -d 't';
13	@INC = $^O eq 'MacOS' ? qw(::lib) : qw(../lib);
14    }
15}
16
17use strict;
18use warnings;
19BEGIN { $| = 1; print "1..65\n"; }
20my $count = 0;
21sub ok ($;$) {
22    my $p = my $r = shift;
23    if (@_) {
24	my $x = shift;
25	$p = !defined $x ? !defined $r : !defined $r ? 0 : $r eq $x;
26    }
27    print $p ? "ok" : "not ok", ' ', ++$count, "\n";
28}
29
30use Unicode::Collate::Locale;
31
32ok(1);
33
34#########################
35
36my $objPl = Unicode::Collate::Locale->
37    new(locale => 'PL', normalization => undef);
38
39ok($objPl->getlocale, 'pl');
40
41$objPl->change(level => 1);
42
43ok($objPl->lt("a", "a\x{328}"));
44ok($objPl->gt("b", "a\x{328}"));
45ok($objPl->lt("c", "c\x{301}"));
46ok($objPl->gt("d", "c\x{301}"));
47ok($objPl->lt("e", "e\x{328}"));
48ok($objPl->gt("f", "e\x{328}"));
49ok($objPl->lt("l", "l\x{335}"));
50ok($objPl->gt("m", "l\x{335}"));
51ok($objPl->lt("n", "n\x{301}"));
52ok($objPl->gt("o", "n\x{301}"));
53ok($objPl->lt("o", "o\x{301}"));
54ok($objPl->gt("p", "o\x{301}"));
55ok($objPl->lt("s", "s\x{301}"));
56ok($objPl->gt("t", "s\x{301}"));
57ok($objPl->lt("z", "z\x{301}"));
58ok($objPl->lt("z\x{301}", "z\x{307}"));
59ok($objPl->lt("z\x{307}", "\x{292}")); # U+0292 EZH
60
61# 19
62
63$objPl->change(level => 2);
64
65ok($objPl->eq("a\x{328}", "A\x{328}"));
66ok($objPl->eq("c\x{301}", "C\x{301}"));
67ok($objPl->eq("e\x{328}", "E\x{328}"));
68ok($objPl->eq("l\x{335}", "L\x{335}"));
69ok($objPl->eq("n\x{301}", "N\x{301}"));
70ok($objPl->eq("o\x{301}", "O\x{301}"));
71ok($objPl->eq("s\x{301}", "S\x{301}"));
72ok($objPl->eq("z\x{301}", "Z\x{301}"));
73ok($objPl->eq("z\x{307}", "Z\x{307}"));
74
75# 28
76
77$objPl->change(level => 3);
78
79ok($objPl->lt("a\x{328}", "A\x{328}"));
80ok($objPl->lt("c\x{301}", "C\x{301}"));
81ok($objPl->lt("e\x{328}", "E\x{328}"));
82ok($objPl->lt("l\x{335}", "L\x{335}"));
83ok($objPl->lt("n\x{301}", "N\x{301}"));
84ok($objPl->lt("o\x{301}", "O\x{301}"));
85ok($objPl->lt("s\x{301}", "S\x{301}"));
86ok($objPl->lt("z\x{301}", "Z\x{301}"));
87ok($objPl->lt("z\x{307}", "Z\x{307}"));
88
89# 37
90
91ok($objPl->eq("a\x{328}", "\x{105}"));
92ok($objPl->eq("A\x{328}", "\x{104}"));
93ok($objPl->eq("c\x{301}", "\x{107}"));
94ok($objPl->eq("c\x{341}", "\x{107}"));
95ok($objPl->eq("C\x{301}", "\x{106}"));
96ok($objPl->eq("C\x{341}", "\x{106}"));
97ok($objPl->eq("e\x{328}", "\x{119}"));
98ok($objPl->eq("E\x{328}", "\x{118}"));
99ok($objPl->eq("l\x{335}", "\x{142}"));
100ok($objPl->eq("L\x{335}", "\x{141}"));
101ok($objPl->eq("n\x{301}", "\x{144}"));
102ok($objPl->eq("n\x{341}", "\x{144}"));
103ok($objPl->eq("N\x{301}", "\x{143}"));
104ok($objPl->eq("N\x{341}", "\x{143}"));
105ok($objPl->eq("o\x{301}", pack('U', 0xF3)));
106ok($objPl->eq("o\x{341}", pack('U', 0xF3)));
107ok($objPl->eq("O\x{301}", pack('U', 0xD3)));
108ok($objPl->eq("O\x{341}", pack('U', 0xD3)));
109ok($objPl->eq("s\x{301}", "\x{15B}"));
110ok($objPl->eq("s\x{341}", "\x{15B}"));
111ok($objPl->eq("S\x{301}", "\x{15A}"));
112ok($objPl->eq("S\x{341}", "\x{15A}"));
113ok($objPl->eq("z\x{301}", "\x{17A}"));
114ok($objPl->eq("z\x{341}", "\x{17A}"));
115ok($objPl->eq("Z\x{301}", "\x{179}"));
116ok($objPl->eq("Z\x{341}", "\x{179}"));
117ok($objPl->eq("z\x{307}", "\x{17C}"));
118ok($objPl->eq("Z\x{307}", "\x{17B}"));
119
120# 65
121