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..50\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 $objLv = Unicode::Collate::Locale->
37    new(locale => 'LV', normalization => undef);
38
39ok($objLv->getlocale, 'lv');
40
41$objLv->change(level => 1);
42
43ok($objLv->lt("c", "c\x{30C}"));
44ok($objLv->gt("d", "c\x{30C}"));
45ok($objLv->lt("g", "g\x{327}"));
46ok($objLv->gt("h", "g\x{327}"));
47ok($objLv->lt("k", "k\x{327}"));
48ok($objLv->gt("l", "k\x{327}"));
49ok($objLv->lt("l", "l\x{327}"));
50ok($objLv->gt("m", "l\x{327}"));
51ok($objLv->lt("n", "n\x{327}"));
52ok($objLv->gt("o", "n\x{327}"));
53ok($objLv->lt("r", "r\x{327}"));
54ok($objLv->gt("s", "r\x{327}"));
55ok($objLv->lt("s", "s\x{30C}"));
56ok($objLv->gt("t", "s\x{30C}"));
57ok($objLv->lt("z", "z\x{30C}"));
58ok($objLv->lt("z\x{30C}", "\x{292}"));
59
60# 18
61
62$objLv->change(level => 2);
63
64ok($objLv->eq("c\x{30C}", "C\x{30C}"));
65ok($objLv->eq("g\x{327}", "G\x{327}"));
66ok($objLv->eq("k\x{327}", "K\x{327}"));
67ok($objLv->eq("l\x{327}", "L\x{327}"));
68ok($objLv->eq("n\x{327}", "N\x{327}"));
69ok($objLv->eq("r\x{327}", "R\x{327}"));
70ok($objLv->eq("s\x{30C}", "S\x{30C}"));
71ok($objLv->eq("z\x{30C}", "Z\x{30C}"));
72
73# 26
74
75$objLv->change(level => 3);
76
77ok($objLv->lt("c\x{30C}", "C\x{30C}"));
78ok($objLv->lt("g\x{327}", "G\x{327}"));
79ok($objLv->lt("k\x{327}", "K\x{327}"));
80ok($objLv->lt("l\x{327}", "L\x{327}"));
81ok($objLv->lt("n\x{327}", "N\x{327}"));
82ok($objLv->lt("r\x{327}", "R\x{327}"));
83ok($objLv->lt("s\x{30C}", "S\x{30C}"));
84ok($objLv->lt("z\x{30C}", "Z\x{30C}"));
85
86# 34
87
88ok($objLv->eq("c\x{30C}", "\x{10D}"));
89ok($objLv->eq("C\x{30C}", "\x{10C}"));
90ok($objLv->eq("g\x{327}", "\x{123}"));
91ok($objLv->eq("G\x{327}", "\x{122}"));
92ok($objLv->eq("k\x{327}", "\x{137}"));
93ok($objLv->eq("K\x{327}", "\x{136}"));
94ok($objLv->eq("l\x{327}", "\x{13C}"));
95ok($objLv->eq("L\x{327}", "\x{13B}"));
96ok($objLv->eq("n\x{327}", "\x{146}"));
97ok($objLv->eq("N\x{327}", "\x{145}"));
98ok($objLv->eq("r\x{327}", "\x{157}"));
99ok($objLv->eq("R\x{327}", "\x{156}"));
100ok($objLv->eq("s\x{30C}", "\x{161}"));
101ok($objLv->eq("S\x{30C}", "\x{160}"));
102ok($objLv->eq("z\x{30C}", "\x{17E}"));
103ok($objLv->eq("Z\x{30C}", "\x{17D}"));
104
105# 50
106