1 # Before `make install' is performed this script should be runnable with
2 # `make test'. After `make install' it should work as `perl test.pl'
4 #########################
9 BEGIN { plan tests => 18 };
10 use Unicode::Normalize qw(normalize);
11 ok(1); # If we made it this far, we're ok.
13 #########################
15 ok(normalize('C', ""), "");
16 ok(normalize('D', ""), "");
19 join " ", map sprintf("%04X", $_),
20 unpack 'U*', normalize 'C', pack 'U*', map hex(), split ' ', shift;
23 join " ", map sprintf("%04X", $_),
24 unpack 'U*', normalize 'NFD', pack 'U*', map hex(), split ' ', shift;
28 my $ASCII = $ordA == 0x41;
29 my $EBCDIC = $ordA == 0xc1;
32 ok(hexNFC("0061 0315 0300 05AE 05C4 0062"), "00E0 05AE 05C4 0315 0062");
33 ok(hexNFC("00E0 05AE 05C4 0315 0062"), "00E0 05AE 05C4 0315 0062");
34 ok(hexNFC("0061 05AE 0300 05C4 0315 0062"), "00E0 05AE 05C4 0315 0062");
36 # A WITH GRAVE is 0044 in EBCDIC, not 00E0
37 # SMALL LATIN B is 0082 in EBCDIC, not 0062
38 ok(hexNFC("0061 0315 0300 05AE 05C4 0062"), "0044 05AE 05C4 0315 0082");
39 ok(hexNFC("00E0 05AE 05C4 0315 0062"), "0044 05AE 05C4 0315 0082");
40 ok(hexNFC("0061 05AE 0300 05C4 0315 0062"), "0044 05AE 05C4 0315 0082");
42 skip("Neither ASCII nor EBCDIC based") for 1..3;
45 ok(hexNFC("0045 0304 0300 AC00 11A8"), "1E14 AC01");
46 ok(hexNFC("1100 1161 1100 1173 11AF"), "AC00 AE00");
47 ok(hexNFC("1100 0300 1161 1173 11AF"), "1100 0300 1161 1173 11AF");
49 ok(hexNFD("0061 0315 0300 05AE 05C4 0062"), "0061 05AE 0300 05C4 0315 0062");
50 ok(hexNFD("00E0 05AE 05C4 0315 0062"), "0061 05AE 0300 05C4 0315 0062");
51 ok(hexNFD("0061 05AE 0300 05C4 0315 0062"), "0061 05AE 0300 05C4 0315 0062");
54 ok(hexNFC("0061 05C4 0315 0300 05AE 0062"), "0061 05AE 05C4 0300 0315 0062");
55 ok(hexNFC("0061 05AE 05C4 0300 0315 0062"), "0061 05AE 05C4 0300 0315 0062");
57 # SMALL LATIN A is 0081 in EBCDIC, not 0061
58 # SMALL LATIN B is 0082 in EBCDIC, not 0062
59 ok(hexNFC("0061 05C4 0315 0300 05AE 0062"), "0081 05AE 05C4 0300 0315 0082");
60 ok(hexNFC("0061 05AE 05C4 0300 0315 0062"), "0081 05AE 05C4 0300 0315 0082");
62 skip("Neither ASCII nor EBCDIC based") for 1..2;
65 ok(hexNFD("0061 05C4 0315 0300 05AE 0062"), "0061 05AE 05C4 0300 0315 0062");
66 ok(hexNFD("0061 05AE 05C4 0300 0315 0062"), "0061 05AE 05C4 0300 0315 0062");
69 ok(hexNFC("0000 0041 0000 0000"), "0000 0041 0000 0000");
71 # CAPITAL LATIN A is 00C1 in EBCDIC, not 0041
72 ok(hexNFC("0000 0041 0000 0000"), "0000 00C1 0000 0000");
74 skip("Neither ASCII nor EBCDIC based");
77 ok(hexNFD("0000 0041 0000 0000"), "0000 0041 0000 0000");