X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=t%2Fop%2Ford.t;h=455666417fb3df072956ee2befda2eddf39c3a9f;hb=3444c34c7da9f235e181b5c175a1fa1357e7a055;hp=67b8e246862dfae501446024a78bf4ed853e28e2;hpb=79072805bf63abe5b5978b5928ab00d360ea3e7f;p=p5sagit%2Fp5-mst-13.2.git diff --git a/t/op/ord.t b/t/op/ord.t index 67b8e24..4556664 100755 --- a/t/op/ord.t +++ b/t/op/ord.t @@ -1,14 +1,35 @@ #!./perl -# $RCSfile: ord.t,v $$Revision: 4.1 $$Date: 92/08/07 18:28:09 $ +BEGIN { + chdir 't' if -d 't'; + @INC = qw(. ../lib); # ../lib needed for test.deparse + require "test.pl"; +} -print "1..2\n"; +plan tests => 7; # compile time evaluation -if (ord('A') == 65) {print "ok 1\n";} else {print "not ok 1\n";} +# 'A' 65 ASCII +# 'A' 193 EBCDIC + +ok(ord('A') == 65 || ord('A') == 193, "ord('A') is ".ord('A')); + +is(ord(chr(500)), 500, "compile time chr 500"); # run time evaluation $x = 'ABC'; -if (ord($x) == 65) {print "ok 2\n";} else {print "not ok 2\n";} + +ok(ord($x) == 65 || ord($x) == 193, "ord('$x') is ".ord($x)); + +ok(chr 65 eq 'A' || chr 193 eq 'A', "chr can produce 'A'"); + +$x = 500; +is(ord(chr($x)), $x, "runtime chr $x"); + +is(ord("\x{1234}"), 0x1234, 'compile time ord \x{....}'); + +$x = "\x{1234}"; +is(ord($x), 0x1234, 'runtime ord \x{....}'); +