This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
b85a308f120735d860bb30761a9f431c8eb4b6ba
[perl5.git] / cpan / Unicode-Collate / t / hangtype.t
1
2 BEGIN {
3     unless ("A" eq pack('U', 0x41)) {
4         print "1..0 # Unicode::Collate " .
5             "cannot stringify a Unicode code point\n";
6         exit 0;
7     }
8     if ($ENV{PERL_CORE}) {
9         chdir('t') if -d 't';
10         @INC = $^O eq 'MacOS' ? qw(::lib) : qw(../lib);
11     }
12 }
13
14 use strict;
15 use warnings;
16 BEGIN { $| = 1; print "1..451\n"; } # 1 + 50 x @Versions
17 my $count = 0;
18 sub ok ($;$) {
19     my $p = my $r = shift;
20     if (@_) {
21         my $x = shift;
22         $p = !defined $x ? !defined $r : !defined $r ? 0 : $r eq $x;
23     }
24     print $p ? "ok" : "not ok", ' ', ++$count, "\n";
25 }
26
27 use Unicode::Collate;
28
29 ok(1);
30
31 #########################
32
33 my @Versions = (8, 9, 11, 14, 16, 18, 20, 22, 24);
34
35 for my $v (@Versions) {
36     ok(Unicode::Collate::getHST(0x0000, $v), '');
37     ok(Unicode::Collate::getHST(0x0100, $v), '');
38     ok(Unicode::Collate::getHST(0x1000, $v), '');
39     ok(Unicode::Collate::getHST(0x10FF, $v), '');
40     ok(Unicode::Collate::getHST(0x1100, $v), 'L');
41     ok(Unicode::Collate::getHST(0x1101, $v), 'L');
42     ok(Unicode::Collate::getHST(0x1159, $v), 'L');
43     ok(Unicode::Collate::getHST(0x115A, $v), ($v >= 20 ? 'L' : ''));
44     ok(Unicode::Collate::getHST(0x115E, $v), ($v >= 20 ? 'L' : ''));
45     ok(Unicode::Collate::getHST(0x115F, $v), 'L');
46     ok(Unicode::Collate::getHST(0x1160, $v), 'V');
47     ok(Unicode::Collate::getHST(0x1161, $v), 'V');
48     ok(Unicode::Collate::getHST(0x11A0, $v), 'V');
49     ok(Unicode::Collate::getHST(0x11A2, $v), 'V');
50     ok(Unicode::Collate::getHST(0x11A3, $v), ($v >= 20 ? 'V' : ''));
51     ok(Unicode::Collate::getHST(0x11A7, $v), ($v >= 20 ? 'V' : ''));
52     ok(Unicode::Collate::getHST(0x11A8, $v), 'T');
53     ok(Unicode::Collate::getHST(0x11AF, $v), 'T');
54     ok(Unicode::Collate::getHST(0x11E0, $v), 'T');
55     ok(Unicode::Collate::getHST(0x11F9, $v), 'T');
56     ok(Unicode::Collate::getHST(0x11FA, $v), ($v >= 20 ? 'T' : ''));
57     ok(Unicode::Collate::getHST(0x11FF, $v), ($v >= 20 ? 'T' : ''));
58     ok(Unicode::Collate::getHST(0x3011, $v), '');
59     ok(Unicode::Collate::getHST(0xA960, $v), ($v >= 20 ? 'L' : ''));
60     ok(Unicode::Collate::getHST(0xA961, $v), ($v >= 20 ? 'L' : ''));
61     ok(Unicode::Collate::getHST(0xA97C, $v), ($v >= 20 ? 'L' : ''));
62     ok(Unicode::Collate::getHST(0xA97F, $v), '');
63     ok(Unicode::Collate::getHST(0xABFF, $v), '');
64     ok(Unicode::Collate::getHST(0xAC00, $v), 'LV');
65     ok(Unicode::Collate::getHST(0xAC01, $v), 'LVT');
66     ok(Unicode::Collate::getHST(0xAC1B, $v), 'LVT');
67     ok(Unicode::Collate::getHST(0xAC1C, $v), 'LV');
68     ok(Unicode::Collate::getHST(0xD7A3, $v), 'LVT');
69     ok(Unicode::Collate::getHST(0xD7A4, $v), '');
70     ok(Unicode::Collate::getHST(0xD7AF, $v), '');
71     ok(Unicode::Collate::getHST(0xD7B0, $v), ($v >= 20 ? 'V' : ''));
72     ok(Unicode::Collate::getHST(0xD7C0, $v), ($v >= 20 ? 'V' : ''));
73     ok(Unicode::Collate::getHST(0xD7C6, $v), ($v >= 20 ? 'V' : ''));
74     ok(Unicode::Collate::getHST(0xD7C7, $v), '');
75     ok(Unicode::Collate::getHST(0xD7CA, $v), '');
76     ok(Unicode::Collate::getHST(0xD7CB, $v), ($v >= 20 ? 'T' : ''));
77     ok(Unicode::Collate::getHST(0xD7DD, $v), ($v >= 20 ? 'T' : ''));
78     ok(Unicode::Collate::getHST(0xD7FB, $v), ($v >= 20 ? 'T' : ''));
79     ok(Unicode::Collate::getHST(0xD7FC, $v), '');
80     ok(Unicode::Collate::getHST(0xD7FF, $v), '');
81     ok(Unicode::Collate::getHST(0xFFFF, $v), '');
82     ok(Unicode::Collate::getHST(0x11100, $v), '');
83     ok(Unicode::Collate::getHST(0x111FF, $v), '');
84     ok(Unicode::Collate::getHST(0x2AC00, $v), '');
85     ok(Unicode::Collate::getHST(0x10D7A3, $v), '');
86 }
87