X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=t%2Fop%2Ford.t;h=455666417fb3df072956ee2befda2eddf39c3a9f;hb=69938bbac29d5bcb76b80f6eccb27c5ff84cee37;hp=f664078d00c0dca6d710ebe94abba7b469a5d162;hpb=0e06870bf080a38cda51c06c6612359afc2334e1;p=p5sagit%2Fp5-mst-13.2.git diff --git a/t/op/ord.t b/t/op/ord.t index f664078..4556664 100755 --- a/t/op/ord.t +++ b/t/op/ord.t @@ -1,34 +1,35 @@ #!./perl -print "1..8\n"; +BEGIN { + chdir 't' if -d 't'; + @INC = qw(. ../lib); # ../lib needed for test.deparse + require "test.pl"; +} + +plan tests => 7; # compile time evaluation # 'A' 65 ASCII # 'A' 193 EBCDIC -if (ord('A') == 65 || ord('A') == 193) {print "ok 1\n";} else {print "not ok 1\n";} -print "not " unless ord(chr(500)) == 500; -print "ok 2\n"; +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 || ord($x) == 193) {print "ok 3\n";} else {print "not ok 3\n";} -if (chr 65 eq 'A' || chr 193 eq 'A') {print "ok 4\n";} else {print "not ok 4\n";} +ok(ord($x) == 65 || ord($x) == 193, "ord('$x') is ".ord($x)); -print "not " unless ord(chr(500)) == 500; -print "ok 5\n"; +ok(chr 65 eq 'A' || chr 193 eq 'A', "chr can produce 'A'"); $x = 500; -print "not " unless ord(chr($x)) == $x; -print "ok 6\n"; +is(ord(chr($x)), $x, "runtime chr $x"); -print "not " unless ord("\x{1234}") == 0x1234; -print "ok 7\n"; +is(ord("\x{1234}"), 0x1234, 'compile time ord \x{....}'); $x = "\x{1234}"; -print "not " unless ord($x) == 0x1234; -print "ok 8\n"; +is(ord($x), 0x1234, 'runtime ord \x{....}');