3 unless ("A" eq pack('U', 0x41)) {
4 print "1..0 # Unicode::Normalize " .
5 "cannot stringify a Unicode code point\n";
11 if ($ENV{PERL_CORE}) {
13 @INC = $^O eq 'MacOS' ? qw(::lib) : qw(../lib);
17 #########################
22 BEGIN { plan tests => 35 };
23 use Unicode::Normalize qw(:all);
24 ok(1); # If we made it this far, we're ok.
26 sub _pack_U { Unicode::Normalize::pack_U(@_) }
27 sub _unpack_U { Unicode::Normalize::unpack_U(@_) }
28 sub answer { defined $_[0] ? $_[0] ? "YES" : "NO" : "MAYBE" }
30 #########################
32 ok(answer(checkFCD('')), 'YES');
33 ok(answer(checkFCD('A')), 'YES');
34 ok(answer(checkFCD("\x{030A}")), 'YES'); # 030A;COMBINING RING ABOVE
35 ok(answer(checkFCD("\x{0327}")), 'YES'); # 0327;COMBINING CEDILLA
36 ok(answer(checkFCD(_pack_U(0x00C5))), 'YES'); # A with ring above
37 ok(answer(checkFCD(_pack_U(0x41, 0x30A))), 'YES'); # A+ring
38 ok(answer(checkFCD(_pack_U(0x41, 0x327, 0x30A))), 'YES'); # A+cedilla+ring
39 ok(answer(checkFCD(_pack_U(0x41, 0x30A, 0x327))), 'NO'); # A+ring+cedilla
40 ok(answer(checkFCD(_pack_U(0xC5, 0x0327))), 'NO'); # A-ring+cedilla
41 ok(answer(checkNFC(_pack_U(0xC5, 0x0327))), 'MAYBE'); # NFC: A-ring+cedilla
42 ok(answer(check("FCD", _pack_U(0xC5, 0x0327))), 'NO');
43 ok(answer(check("NFC", _pack_U(0xC5, 0x0327))), 'MAYBE');
44 ok(answer(checkFCD("\x{AC01}\x{1100}\x{1161}")), 'YES'); # hangul
45 ok(answer(checkFCD("\x{212B}\x{F900}")), 'YES'); # compat
53 ok(answer(checkFCD(_pack_U(0x1EA7, 0x05AE, 0x0315, 0x0062))), "NO");
54 ok(answer(checkFCC(_pack_U(0x1EA7, 0x05AE, 0x0315, 0x0062))), "NO");
56 ok(FCC(_pack_U(0xC5, 0x327)), _pack_U(0x41, 0x327, 0x30A));
57 ok(FCC(_pack_U(0x45, 0x304, 0x300)), _pack_U(0x1E14));
58 ok(FCC("\x{1100}\x{1161}\x{1100}\x{1173}\x{11AF}"), "\x{AC00}\x{AE00}");
60 ok(answer(checkFCC('')), 'YES');
61 ok(answer(checkFCC('A')), 'YES');
62 ok(answer(checkFCC("\x{030A}")), 'MAYBE'); # 030A;COMBINING RING ABOVE
63 ok(answer(checkFCC("\x{0327}")), 'MAYBE'); # 0327;COMBINING CEDILLA
64 ok(answer(checkFCC(_pack_U(0x00C5))), 'YES'); # A with ring above
65 ok(answer(checkFCC(_pack_U(0x41, 0x30A))), 'MAYBE'); # A+ring
66 ok(answer(checkFCC(_pack_U(0x41, 0x327, 0x30A))), 'MAYBE'); # A+cedilla+ring
67 ok(answer(checkFCC(_pack_U(0x41, 0x30A, 0x327))), 'NO'); # A+ring+cedilla
68 ok(answer(checkFCC(_pack_U(0xC5, 0x0327))), 'NO'); # A-ring+cedilla
69 ok(answer(checkFCC("\x{AC01}\x{1100}\x{1161}")), 'MAYBE'); # hangul
70 ok(answer(checkFCC("\x{212B}\x{F900}")), 'NO'); # compat