5 unshift @INC, "../lib";
10 $_ = "abcdefghijklmnopqrstuvwxyz";
14 print "not " unless $_ eq "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
19 print "not " unless $_ eq "abcdefghijklmnopqrstuvwxyz";
24 print "not " unless $_ eq "aBCDEFGHIJKLMNOPQRSTUVWXYz";
27 # In EBCDIC 'I' is \xc9 and 'J' is \0xd1, 'i' is \x89 and 'j' is \x91.
28 # Yes, discontinuities. Regardless, the \xca in the below should stay
29 # untouched (and not became \x8a).
36 print "not " unless $_ eq "i\xcaj";
41 # make sure that tr cancels IOK and NOK
43 (my $y = 12) =~ tr/1/3/;
44 ($f = 1.5) =~ tr/1/3/;
45 (my $g = 1.5) =~ tr/1/3/;
46 print "not " unless $x + $y + $f + $g == 71;
49 # make sure tr is harmless if not updating - see [ID 20000511.005]
54 print "not " if $_ ne 'Fred';
57 # check tr handles UTF8 correctly
58 ($x = 256.65.258) =~ tr/a/b/;
59 print "not " if $x ne 256.65.258 or length $x != 3;
62 print "not " if $x ne 256.66.258 or length $x != 3;
68 # 9 - changing UTF8 characters in a UTF8 string, same length.
69 $l = chr(300); $r = chr(400);
71 $x =~ tr/\x{12c}/\x{190}/;
72 printf "not (%vd) ", $x if $x ne 200.400.400 or length $x != 3;
75 # 10 - changing UTF8 characters in UTF8 string, more bytes.
77 $x =~ tr/\x{12c}/\x{be8}/;
78 printf "not (%vd) ", $x if $x ne 200.3048.400 or length $x != 3;
81 # 11 - introducing UTF8 characters to non-UTF8 string.
83 $x =~ tr/\x{64}/\x{190}/;
84 printf "not (%vd) ", $x if $x ne 400.125.60 or length $x != 3;
87 # 12 - removing UTF8 characters from UTF8 string
89 $x =~ tr/\x{190}/\x{64}/;
90 printf "not (%vd) ", $x if $x ne 100.125.60 or length $x != 3;
93 # 13 - counting UTF8 chars in UTF8 string
95 $y = $x =~ tr/\x{190}/\x{190}/;
96 print "not " if $y != 2;
99 # 14 - counting non-UTF8 chars in UTF8 string
100 $x = 60.400.125.60.400;
101 $y = $x =~ tr/\x{3c}/\x{3c}/;
102 print "not " if $y != 2;
105 # 15 - counting UTF8 chars in non-UTF8 string
107 $y = $x =~ tr/\x{190}/\x{190}/;
108 print "not " if $y != 0;