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..36\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 $objMl = Unicode::Collate::Locale->
37    new(locale => 'ML', normalization => undef);
38
39ok($objMl->getlocale, 'ml');
40
41$objMl->change(level => 1);
42
43ok($objMl->lt("\x{D4B}", "\x{D57}"));
44
45# 3
46
47ok($objMl->eq("\x{D03}",        "\x{D3D}"));
48ok($objMl->eq("\x{D15}\x{D4D}", "\x{D15}\x{D4D}\x{200D}"));
49ok($objMl->eq("\x{D23}\x{D4D}", "\x{D23}\x{D4D}\x{200D}"));
50ok($objMl->eq("\x{D28}\x{D4D}", "\x{D28}\x{D4D}\x{200D}"));
51ok($objMl->eq("\x{D30}\x{D4D}", "\x{D30}\x{D4D}\x{200D}"));
52ok($objMl->eq("\x{D32}\x{D4D}", "\x{D32}\x{D4D}\x{200D}"));
53ok($objMl->eq("\x{D33}\x{D4D}", "\x{D33}\x{D4D}\x{200D}"));
54ok($objMl->eq("\x{D2E}\x{D4D}", "\x{D02}"));
55
56# 11
57
58$objMl->change(level => 2);
59
60ok($objMl->lt("\x{D03}",        "\x{D3D}"));
61ok($objMl->lt("\x{D15}\x{D4D}", "\x{D15}\x{D4D}\x{200D}"));
62ok($objMl->lt("\x{D23}\x{D4D}", "\x{D23}\x{D4D}\x{200D}"));
63ok($objMl->lt("\x{D28}\x{D4D}", "\x{D28}\x{D4D}\x{200D}"));
64ok($objMl->lt("\x{D30}\x{D4D}", "\x{D30}\x{D4D}\x{200D}"));
65ok($objMl->lt("\x{D32}\x{D4D}", "\x{D32}\x{D4D}\x{200D}"));
66ok($objMl->lt("\x{D33}\x{D4D}", "\x{D33}\x{D4D}\x{200D}"));
67ok($objMl->lt("\x{D2E}\x{D4D}", "\x{D02}"));
68
69# 19
70
71ok($objMl->eq("\x{D57}",                "\x{D4C}"));
72ok($objMl->eq("\x{D15}\x{D4D}\x{200D}", "\x{D7F}"));
73ok($objMl->eq("\x{D23}\x{D4D}\x{200D}", "\x{D7A}"));
74ok($objMl->eq("\x{D28}\x{D4D}\x{200D}", "\x{D7B}"));
75ok($objMl->eq("\x{D30}\x{D4D}\x{200D}", "\x{D7C}"));
76ok($objMl->eq("\x{D32}\x{D4D}\x{200D}", "\x{D7D}"));
77ok($objMl->eq("\x{D33}\x{D4D}\x{200D}", "\x{D7E}"));
78ok($objMl->eq("\x{D28}\x{D4D}",         "\x{D7B}\x{D4D}"));
79
80# 27
81
82$objMl->change(level => 3);
83
84ok($objMl->lt("\x{D57}",                "\x{D4C}"));
85ok($objMl->lt("\x{D15}\x{D4D}\x{200D}", "\x{D7F}"));
86ok($objMl->lt("\x{D23}\x{D4D}\x{200D}", "\x{D7A}"));
87ok($objMl->lt("\x{D28}\x{D4D}\x{200D}", "\x{D7B}"));
88ok($objMl->lt("\x{D30}\x{D4D}\x{200D}", "\x{D7C}"));
89ok($objMl->lt("\x{D32}\x{D4D}\x{200D}", "\x{D7D}"));
90ok($objMl->lt("\x{D33}\x{D4D}\x{200D}", "\x{D7E}"));
91ok($objMl->lt("\x{D28}\x{D4D}",         "\x{D7B}\x{D4D}"));
92
93# 35
94
95ok($objMl->eq("\x{D4C}", "\x{D46}\x{D57}"));
96
97# 36
98