From: Jarkko Hietaniemi Date: Mon, 5 Mar 2001 15:58:01 +0000 (+0000) Subject: Add tr tests for EBCDIC, from Karsten Sperling. X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=6b6bd37b3c7005ee8dc71fab8f1db43af72cc6ee;p=p5sagit%2Fp5-mst-13.2.git Add tr tests for EBCDIC, from Karsten Sperling. p4raw-id: //depot/perl@9038 --- diff --git a/t/op/tr.t b/t/op/tr.t index eb5c4ca..e114464 100755 --- a/t/op/tr.t +++ b/t/op/tr.t @@ -5,7 +5,7 @@ BEGIN { @INC = '../lib'; } -print "1..57\n"; +print "1..61\n"; $_ = "abcdefghijklmnopqrstuvwxyz"; @@ -325,3 +325,28 @@ print "ok 56\n"; print "not " unless $a eq "X"; print "ok 57\n"; +# Tricky on EBCDIC: while [a-z] [A-Z] must not match the gap characters, +# (i-j, r-s, I-J, R-S), [\x89-\x91] [\xc9-\xd1] has to match them, +# from Karsten Sperling. + +$c = ($a = "\x89\x8a\x8b\x8c\x8d\x8f\x90\x91") =~ tr/\x89-\x91/X/; +print "not " unless $c == 8 and $a eq "XXXXXXXX"; +print "ok 58\n"; + +$c = ($a = "\xc9\xca\xcb\xcc\xcd\xcf\xd0\xd1") =~ tr/\xc9-\xd1/X/; +print "not " unless $c == 8 and $a eq "XXXXXXXX"; +print "ok 59\n"; + +if (ord('i') == 0x89 & ord('J') == 0xd1) { + +$c = ($a = "\x89\x8a\x8b\x8c\x8d\x8f\x90\x91") =~ tr/i-j/X/; +print "not " unless $c == 2 and $a eq "X\x8a\x8b\x8c\x8d\x8f\x90X"; +print "ok 60\n"; + +$c = ($a = "\xc9\xca\xcb\xcc\xcd\xcf\xd0\xd1") =~ tr/I-J/X/; +print "not " unless $c == 2 and $a eq "X\xca\xcb\xcc\xcd\xcf\xd0X"; +print "ok 61\n"; + +} else { + for (60..61) { print "ok $_ # Skip: not EBCDIC\n" } +}