summaryrefslogtreecommitdiff
path: root/cpan/Unicode-Collate/t/loc_ro.t
blob: c92085873f8714c54f272ebdc79dfb9f11e6f0a4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131

BEGIN {
    unless ('A' eq pack('U', 0x41)) {
	print "1..0 # Unicode::Collate cannot pack a Unicode code point\n";
	exit 0;
    }
    unless (0x41 == unpack('U', 'A')) {
	print "1..0 # Unicode::Collate cannot get a Unicode code point\n";
	exit 0;
    }
    if ($ENV{PERL_CORE}) {
	chdir('t') if -d 't';
	@INC = $^O eq 'MacOS' ? qw(::lib) : qw(../lib);
    }
}

use strict;
use warnings;
BEGIN { $| = 1; print "1..71\n"; }
my $count = 0;
sub ok ($;$) {
    my $p = my $r = shift;
    if (@_) {
	my $x = shift;
	$p = !defined $x ? !defined $r : !defined $r ? 0 : $r eq $x;
    }
    print $p ? "ok" : "not ok", ' ', ++$count, "\n";
}

use Unicode::Collate::Locale;

ok(1);

#########################

my $objRo = Unicode::Collate::Locale->
    new(locale => 'RO', normalization => undef);

ok($objRo->getlocale, 'ro');

$objRo->change(level => 1);

ok($objRo->lt("a", "a\x{306}"));
ok($objRo->lt("a\x{306}", "a\x{302}"));
ok($objRo->gt("b", "a\x{302}"));
ok($objRo->eq("d", "d\x{335}")); # not tailored in CLDR 2.0
ok($objRo->gt("e", "d\x{335}"));
ok($objRo->lt("i", "i\x{302}"));
ok($objRo->gt("j", "i\x{302}"));
ok($objRo->lt("s", "s\x{327}"));
ok($objRo->gt("t", "s\x{327}"));
ok($objRo->lt("t", "t\x{327}"));
ok($objRo->gt("u", "t\x{327}"));
ok($objRo->eq("z", "z\x{307}")); # not tailored in CLDR 2.0
ok($objRo->lt("z\x{307}", "\x{292}")); # U+0292 EZH

# 15

$objRo->change(level => 2);

ok($objRo->eq("a\x{306}", "A\x{306}"));
ok($objRo->eq("a\x{302}", "A\x{302}"));
ok($objRo->eq("d\x{335}", "D\x{335}"));
ok($objRo->eq("i\x{302}", "I\x{302}"));
ok($objRo->eq("s\x{327}", "S\x{327}"));
ok($objRo->eq("t\x{327}", "T\x{327}"));
ok($objRo->eq("z\x{307}", "Z\x{307}"));

# 22

$objRo->change(level => 3);

ok($objRo->lt("a\x{306}", "A\x{306}"));
ok($objRo->lt("a\x{302}", "A\x{302}"));
ok($objRo->lt("d\x{335}", "D\x{335}"));
ok($objRo->lt("i\x{302}", "I\x{302}"));
ok($objRo->lt("s\x{327}", "S\x{327}"));
ok($objRo->lt("t\x{327}", "T\x{327}"));
ok($objRo->lt("z\x{307}", "Z\x{307}"));

ok($objRo->eq("s\x{327}", "s\x{326}"));
ok($objRo->eq("S\x{327}", "S\x{326}"));
ok($objRo->eq("t\x{327}", "t\x{326}"));
ok($objRo->eq("T\x{327}", "T\x{326}"));

# 33

ok($objRo->eq("a\x{306}", "\x{103}"));
ok($objRo->eq("A\x{306}", "\x{102}"));
ok($objRo->eq("a\x{302}", pack('U', 0xE2)));
ok($objRo->eq("A\x{302}", pack('U', 0xC2)));
ok($objRo->eq("d\x{335}", "\x{111}"));
ok($objRo->eq("D\x{335}", "\x{110}"));
ok($objRo->eq("i\x{302}", pack('U', 0xEE)));
ok($objRo->eq("I\x{302}", pack('U', 0xCE)));
ok($objRo->eq("s\x{327}", "\x{15F}"));
ok($objRo->eq("s\x{326}", "\x{219}"));
ok($objRo->eq("S\x{327}", "\x{15E}"));
ok($objRo->eq("S\x{326}", "\x{218}"));
ok($objRo->eq("t\x{327}", "\x{163}"));
ok($objRo->eq("t\x{326}", "\x{21B}"));
ok($objRo->eq("T\x{327}", "\x{162}"));
ok($objRo->eq("T\x{326}", "\x{21A}"));
ok($objRo->eq("z\x{307}", "\x{17C}"));
ok($objRo->eq("Z\x{307}", "\x{17B}"));

# 51

ok($objRo->eq("a\x{306}\x{300}", "\x{1EB1}"));
ok($objRo->eq("A\x{306}\x{300}", "\x{1EB0}"));
ok($objRo->eq("a\x{306}\x{301}", "\x{1EAF}"));
ok($objRo->eq("A\x{306}\x{301}", "\x{1EAE}"));
ok($objRo->eq("a\x{306}\x{303}", "\x{1EB5}"));
ok($objRo->eq("A\x{306}\x{303}", "\x{1EB4}"));
ok($objRo->eq("a\x{306}\x{309}", "\x{1EB3}"));
ok($objRo->eq("A\x{306}\x{309}", "\x{1EB2}"));
ok($objRo->eq("a\x{306}\x{323}", "\x{1EB7}"));
ok($objRo->eq("A\x{306}\x{323}", "\x{1EB6}"));

ok($objRo->eq("a\x{302}\x{300}", "\x{1EA7}"));
ok($objRo->eq("A\x{302}\x{300}", "\x{1EA6}"));
ok($objRo->eq("a\x{302}\x{301}", "\x{1EA5}"));
ok($objRo->eq("A\x{302}\x{301}", "\x{1EA4}"));
ok($objRo->eq("a\x{302}\x{303}", "\x{1EAB}"));
ok($objRo->eq("A\x{302}\x{303}", "\x{1EAA}"));
ok($objRo->eq("a\x{302}\x{309}", "\x{1EA9}"));
ok($objRo->eq("A\x{302}\x{309}", "\x{1EA8}"));
ok($objRo->eq("a\x{302}\x{323}", "\x{1EAD}"));
ok($objRo->eq("A\x{302}\x{323}", "\x{1EAC}"));

# 71