1
2BEGIN {
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
10BEGIN {
11    if ($ENV{PERL_CORE}) {
12        chdir('t') if -d 't';
13        @INC = $^O eq 'MacOS' ? qw(::lib) : qw(../lib);
14    }
15}
16
17BEGIN {
18    unless (5.006001 <= $]) {
19	print "1..0 # skipped: Perl 5.6.1 or later".
20		" needed for this test\n";
21	exit;
22    }
23}
24
25#########################
26
27use strict;
28use Unicode::Normalize qw(:all);
29
30print "1..8\n";
31print "ok 1\n";
32
33#########################
34
35no warnings qw(utf8);
36
37# U+3042 is 3-byte length (in UTF-8/UTF-EBCDIC)
38our $a = pack 'U0C', unpack 'C', "\x{3042}";
39
40print NFD($a) eq "\0"
41   ? "ok" : "not ok", " 2\n";
42
43print NFKD($a) eq "\0"
44   ? "ok" : "not ok", " 3\n";
45
46print NFC($a) eq "\0"
47   ? "ok" : "not ok", " 4\n";
48
49print NFKC($a) eq "\0"
50   ? "ok" : "not ok", " 5\n";
51
52print decompose($a) eq "\0"
53   ? "ok" : "not ok", " 6\n";
54
55print reorder($a) eq "\0"
56   ? "ok" : "not ok", " 7\n";
57
58print compose($a) eq "\0"
59   ? "ok" : "not ok", " 8\n";
60
61