summaryrefslogtreecommitdiff
path: root/cpan/Unicode-Collate/t/loc_ca.t
blob: 092d75d0e8008e2f53cfab7ab7255e4cf82200ee (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

BEGIN {
    unless ("A" eq pack('U', 0x41)) {
	print "1..0 # Unicode::Collate " .
	    "cannot stringify 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 Test;
BEGIN { plan tests => 41 };

use strict;
use warnings;
use Unicode::Collate::Locale;

ok(1);

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

my $dot  = pack 'U', 0xB7;

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

ok($objCa->getlocale, 'ca');

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

ok($objCa->lt("c",  "ch"));
ok($objCa->lt("cz", "ch"));
ok($objCa->gt("d", "ch"));
ok($objCa->lt("l",  "ll"));
ok($objCa->lt("lz", "ll"));
ok($objCa->gt("m", "ll"));

# 8

ok($objCa->eq("a\x{300}a", "aa\x{300}"));

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

ok($objCa->lt("a\x{300}a", "aa\x{300}"));
ok($objCa->gt("Ca\x{300}ca\x{302}", "ca\x{302}ca\x{300}"));
ok($objCa->gt("ca\x{300}ca\x{302}", "Ca\x{302}ca\x{300}"));

# 12

ok($objCa->eq("ch", "cH"));
ok($objCa->eq("cH", "Ch"));
ok($objCa->eq("Ch", "CH"));

ok($objCa->eq("ll", "lL"));
ok($objCa->eq("lL", "Ll"));
ok($objCa->eq("Ll", "LL"));
ok($objCa->eq("l${dot}l", "lL"));
ok($objCa->eq("l${dot}L", "Ll"));
ok($objCa->eq("L${dot}l", "LL"));
ok($objCa->eq("ll","l${dot}l"));
ok($objCa->eq("lL","l${dot}L"));
ok($objCa->eq("Ll","L${dot}l"));
ok($objCa->eq("LL","L${dot}L"));

# 25

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

ok($objCa->lt("ch", "cH"));
ok($objCa->lt("cH", "Ch"));
ok($objCa->lt("Ch", "CH"));

ok($objCa->lt("ll", "lL"));
ok($objCa->lt("lL", "Ll"));
ok($objCa->lt("Ll", "LL"));
ok($objCa->lt("l${dot}l", "lL"));
ok($objCa->lt("l${dot}L", "Ll"));
ok($objCa->lt("L${dot}l", "LL"));
ok($objCa->lt("ll","l${dot}l"));
ok($objCa->lt("lL","l${dot}L"));
ok($objCa->lt("Ll","L${dot}l"));
ok($objCa->lt("LL","L${dot}L"));

# 38

$objCa->change(backwards => undef, level => 2);

ok($objCa->gt("a\x{300}a", "aa\x{300}"));
ok($objCa->lt("Ca\x{300}ca\x{302}", "ca\x{302}ca\x{300}"));
ok($objCa->lt("ca\x{300}ca\x{302}", "Ca\x{302}ca\x{300}"));

# 41