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; 24BEGIN { $| = 1; print "1..48\n"; } 25my $count = 0; 26sub ok ($;$) { 27 my $p = my $r = shift; 28 if (@_) { 29 my $x = shift; 30 $p = !defined $x ? !defined $r : !defined $r ? 0 : $r eq $x; 31 } 32 print $p ? "ok" : "not ok", ' ', ++$count, "\n"; 33} 34 35use Unicode::Normalize qw(:all); 36 37ok(1); 38 39######################### 40 41# unary op. RING-CEDILLA 42ok( "\x{30A}\x{327}" ne "\x{327}\x{30A}"); 43ok(NFD "\x{30A}\x{327}" eq "\x{327}\x{30A}"); 44ok(NFC "\x{30A}\x{327}" eq "\x{327}\x{30A}"); 45ok(NFKD "\x{30A}\x{327}" eq "\x{327}\x{30A}"); 46ok(NFKC "\x{30A}\x{327}" eq "\x{327}\x{30A}"); 47ok(FCD "\x{30A}\x{327}" eq "\x{327}\x{30A}"); 48ok(FCC "\x{30A}\x{327}" eq "\x{327}\x{30A}"); 49ok(reorder "\x{30A}\x{327}" eq "\x{327}\x{30A}"); 50 51# 9 52 53ok(prototype \&normalize,'$$'); 54ok(prototype \&NFD, '$'); 55ok(prototype \&NFC, '$'); 56ok(prototype \&NFKD, '$'); 57ok(prototype \&NFKC, '$'); 58ok(prototype \&FCD, '$'); 59ok(prototype \&FCC, '$'); 60 61ok(prototype \&check, '$$'); 62ok(prototype \&checkNFD, '$'); 63ok(prototype \&checkNFC, '$'); 64ok(prototype \&checkNFKD,'$'); 65ok(prototype \&checkNFKC,'$'); 66ok(prototype \&checkFCD, '$'); 67ok(prototype \&checkFCC, '$'); 68 69ok(prototype \&decompose, '$;$'); 70ok(prototype \&reorder, '$'); 71ok(prototype \&compose, '$'); 72ok(prototype \&composeContiguous, '$'); 73 74# 27 75 76ok(prototype \&getCanon, '$'); 77ok(prototype \&getCompat, '$'); 78ok(prototype \&getComposite, '$$'); 79ok(prototype \&getCombinClass,'$'); 80ok(prototype \&isExclusion, '$'); 81ok(prototype \&isSingleton, '$'); 82ok(prototype \&isNonStDecomp, '$'); 83ok(prototype \&isComp2nd, '$'); 84ok(prototype \&isComp_Ex, '$'); 85ok(prototype \&isNFD_NO, '$'); 86ok(prototype \&isNFC_NO, '$'); 87ok(prototype \&isNFC_MAYBE, '$'); 88ok(prototype \&isNFKD_NO, '$'); 89ok(prototype \&isNFKC_NO, '$'); 90ok(prototype \&isNFKC_MAYBE, '$'); 91ok(prototype \&splitOnLastStarter, undef); 92ok(prototype \&normalize_partial, '$$'); 93ok(prototype \&NFD_partial, '$'); 94ok(prototype \&NFC_partial, '$'); 95ok(prototype \&NFKD_partial, '$'); 96ok(prototype \&NFKC_partial, '$'); 97 98# 48 99 100