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