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
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
|
use Unicode::UCD;
use Test;
use strict;
BEGIN { plan tests => 111 };
use Unicode::UCD 'charinfo';
my $charinfo;
$charinfo = charinfo(0x41);
ok($charinfo->{code}, '0041');
ok($charinfo->{name}, 'LATIN CAPITAL LETTER A');
ok($charinfo->{category}, 'Lu');
ok($charinfo->{combining}, '0');
ok($charinfo->{bidi}, 'L');
ok($charinfo->{decomposition}, '');
ok($charinfo->{decimal}, '');
ok($charinfo->{digit}, '');
ok($charinfo->{numeric}, '');
ok($charinfo->{mirrored}, 'N');
ok($charinfo->{unicode10}, '');
ok($charinfo->{comment}, '');
ok($charinfo->{upper}, '');
ok($charinfo->{lower}, '0061');
ok($charinfo->{title}, '');
ok($charinfo->{block}, 'Basic Latin');
ok($charinfo->{script}, 'Latin');
$charinfo = charinfo(0x100);
ok($charinfo->{code}, '0100');
ok($charinfo->{name}, 'LATIN CAPITAL LETTER A WITH MACRON');
ok($charinfo->{category}, 'Lu');
ok($charinfo->{combining}, '0');
ok($charinfo->{bidi}, 'L');
ok($charinfo->{decomposition}, '0041 0304');
ok($charinfo->{decimal}, '');
ok($charinfo->{digit}, '');
ok($charinfo->{numeric}, '');
ok($charinfo->{mirrored}, 'N');
ok($charinfo->{unicode10}, 'LATIN CAPITAL LETTER A MACRON');
ok($charinfo->{comment}, '');
ok($charinfo->{upper}, '');
ok($charinfo->{lower}, '0101');
ok($charinfo->{title}, '');
ok($charinfo->{block}, 'Latin Extended-A');
ok($charinfo->{script}, 'Latin');
# 0x0590 is in the Hebrew block but unused.
$charinfo = charinfo(0x590);
ok($charinfo->{code}, undef);
ok($charinfo->{name}, undef);
ok($charinfo->{category}, undef);
ok($charinfo->{combining}, undef);
ok($charinfo->{bidi}, undef);
ok($charinfo->{decomposition}, undef);
ok($charinfo->{decimal}, undef);
ok($charinfo->{digit}, undef);
ok($charinfo->{numeric}, undef);
ok($charinfo->{mirrored}, undef);
ok($charinfo->{unicode10}, undef);
ok($charinfo->{comment}, undef);
ok($charinfo->{upper}, undef);
ok($charinfo->{lower}, undef);
ok($charinfo->{title}, undef);
ok($charinfo->{block}, undef);
ok($charinfo->{script}, undef);
# 0x05d0 is in the Hebrew block and used.
$charinfo = charinfo(0x5d0);
ok($charinfo->{code}, '05D0');
ok($charinfo->{name}, 'HEBREW LETTER ALEF');
ok($charinfo->{category}, 'Lo');
ok($charinfo->{combining}, '0');
ok($charinfo->{bidi}, 'R');
ok($charinfo->{decomposition}, '');
ok($charinfo->{decimal}, '');
ok($charinfo->{digit}, '');
ok($charinfo->{numeric}, '');
ok($charinfo->{mirrored}, 'N');
ok($charinfo->{unicode10}, '');
ok($charinfo->{comment}, '');
ok($charinfo->{upper}, '');
ok($charinfo->{lower}, '');
ok($charinfo->{title}, '');
ok($charinfo->{block}, 'Hebrew');
ok($charinfo->{script}, 'Hebrew');
use Unicode::UCD qw(charblock charscript);
# 0x0590 is in the Hebrew block but unused.
ok(charblock(0x590), 'Hebrew');
ok(charscript(0x590), undef);
$charinfo = charinfo(0xbe);
ok($charinfo->{code}, '00BE');
ok($charinfo->{name}, 'VULGAR FRACTION THREE QUARTERS');
ok($charinfo->{category}, 'No');
ok($charinfo->{combining}, '0');
ok($charinfo->{bidi}, 'ON');
ok($charinfo->{decomposition}, '<fraction> 0033 2044 0034');
ok($charinfo->{decimal}, '');
ok($charinfo->{digit}, '');
ok($charinfo->{numeric}, '3/4');
ok($charinfo->{mirrored}, 'N');
ok($charinfo->{unicode10}, 'FRACTION THREE QUARTERS');
ok($charinfo->{comment}, '');
ok($charinfo->{upper}, '');
ok($charinfo->{lower}, '');
ok($charinfo->{title}, '');
ok($charinfo->{block}, 'Latin-1 Supplement');
ok($charinfo->{script}, undef);
use Unicode::UCD qw(charblocks charscripts);
my $charblocks = charblocks();
ok(exists $charblocks->{Thai});
ok($charblocks->{Thai}->[0]->[0], hex('0e00'));
ok(!exists $charblocks->{PigLatin});
my $charscripts = charscripts();
ok(exists $charscripts->{Armenian});
ok($charscripts->{Armenian}->[0]->[0], hex('0531'));
ok(!exists $charscripts->{PigLatin});
my $charscript;
$charscript = charscript("12ab");
ok($charscript, 'Ethiopic');
$charscript = charscript("0x12ab");
ok($charscript, 'Ethiopic');
$charscript = charscript("U+12ab");
ok($charscript, 'Ethiopic');
my $ranges;
$ranges = charscript('Ogham');
ok($ranges->[0]->[0], hex('1681'));
ok($ranges->[0]->[1], hex('169a'));
use Unicode::UCD qw(charinrange);
$ranges = charscript('Cherokee');
ok(!charinrange($ranges, "139f"));
ok( charinrange($ranges, "13a0"));
ok( charinrange($ranges, "13f4"));
ok(!charinrange($ranges, "13f5"));
ok(Unicode::UCD::UnicodeVersion, 3.1);
use Unicode::UCD qw(compexcl);
ok(!compexcl(0x0100));
ok( compexcl(0x0958));
use Unicode::UCD qw(casefold);
my $casefold;
$casefold = casefold(0x41);
ok($casefold->{code} eq '0041' &&
$casefold->{status} eq 'C' &&
$casefold->{mapping} eq '0061');
$casefold = casefold(0xdf);
ok($casefold->{code} eq '00DF' &&
$casefold->{status} eq 'F' &&
$casefold->{mapping} eq '0073 0073');
ok(!casefold(0x20));
use Unicode::UCD qw(casespec);
my $casespec;
ok(!casespec(0x41));
$casespec = casespec(0xdf);
ok($casespec->{code} eq '00DF' &&
$casespec->{lower} eq '00DF' &&
$casespec->{title} eq '0053 0073' &&
$casespec->{upper} eq '0053 0053' &&
$casespec->{condition} eq undef);
$casespec = casespec(0x307);
ok($casespec->{code} eq '0307' &&
$casespec->{lower} eq '0307' &&
$casespec->{title} eq '' &&
$casespec->{upper} eq '' &&
$casespec->{condition} eq 'lt AFTER_i');
|