1
2BEGIN {
3    unless ('A' eq pack('U', 0x41)) {
4	print "1..0 # Unicode::Normalize cannot pack a Unicode code point\n";
5	exit 0;
6    }
7    unless (0x41 == unpack('U', 'A')) {
8	print "1..0 # Unicode::Normalize cannot get a Unicode code point\n";
9	exit 0;
10    }
11}
12
13BEGIN {
14    if ($ENV{PERL_CORE}) {
15        chdir('t') if -d 't';
16        @INC = $^O eq 'MacOS' ? qw(::lib) : qw(../lib);
17    }
18}
19
20#########################
21
22use strict;
23use warnings;
24
25use Unicode::Normalize qw(:all);
26print "1..24\n";
27
28print "ok 1\n";
29
30# if $_ is not NULL-terminated, test may fail.
31
32$_ = compose('abc');
33print /c$/ ? "ok" : "not ok", " 2\n";
34
35$_ = decompose('abc');
36print /c$/ ? "ok" : "not ok", " 3\n";
37
38$_ = reorder('abc');
39print /c$/ ? "ok" : "not ok", " 4\n";
40
41$_ = NFD('abc');
42print /c$/ ? "ok" : "not ok", " 5\n";
43
44$_ = NFC('abc');
45print /c$/ ? "ok" : "not ok", " 6\n";
46
47$_ = NFKD('abc');
48print /c$/ ? "ok" : "not ok", " 7\n";
49
50$_ = NFKC('abc');
51print /c$/ ? "ok" : "not ok", " 8\n";
52
53$_ = FCC('abc');
54print /c$/ ? "ok" : "not ok", " 9\n";
55
56$_ = decompose("\x{304C}abc");
57print /c$/ ? "ok" : "not ok", " 10\n";
58
59$_ = decompose("\x{304B}\x{3099}abc");
60print /c$/ ? "ok" : "not ok", " 11\n";
61
62$_ = reorder("\x{304C}abc");
63print /c$/ ? "ok" : "not ok", " 12\n";
64
65$_ = reorder("\x{304B}\x{3099}abc");
66print /c$/ ? "ok" : "not ok", " 13\n";
67
68$_ = compose("\x{304C}abc");
69print /c$/ ? "ok" : "not ok", " 14\n";
70
71$_ = compose("\x{304B}\x{3099}abc");
72print /c$/ ? "ok" : "not ok", " 15\n";
73
74$_ = NFD("\x{304C}abc");
75print /c$/ ? "ok" : "not ok", " 16\n";
76
77$_ = NFC("\x{304C}abc");
78print /c$/ ? "ok" : "not ok", " 17\n";
79
80$_ = NFKD("\x{304C}abc");
81print /c$/ ? "ok" : "not ok", " 18\n";
82
83$_ = NFKC("\x{304C}abc");
84print /c$/ ? "ok" : "not ok", " 19\n";
85
86$_ = FCC("\x{304C}abc");
87print /c$/ ? "ok" : "not ok", " 20\n";
88
89$_ = getCanon(0x100);
90print s/.$// ? "ok" : "not ok", " 21\n";
91
92$_ = getCompat(0x100);
93print s/.$// ? "ok" : "not ok", " 22\n";
94
95$_ = getCanon(0xAC00);
96print s/.$// ? "ok" : "not ok", " 23\n";
97
98$_ = getCompat(0xAC00);
99print s/.$// ? "ok" : "not ok", " 24\n";
100
101