1#!./perl 2 3BEGIN { 4 chdir 't' if -d 't'; 5 @INC = qw(. ../lib); # ../lib needed for test.deparse 6 require "test.pl"; 7} 8 9plan tests => 7; 10 11# compile time evaluation 12 13# 'A' 65 ASCII 14# 'A' 193 EBCDIC 15 16ok(ord('A') == 65 || ord('A') == 193, "ord('A') is ".ord('A')); 17 18is(ord(chr(500)), 500, "compile time chr 500"); 19 20# run time evaluation 21 22$x = 'ABC'; 23 24ok(ord($x) == 65 || ord($x) == 193, "ord('$x') is ".ord($x)); 25 26ok(chr 65 eq 'A' || chr 193 eq 'A', "chr can produce 'A'"); 27 28$x = 500; 29is(ord(chr($x)), $x, "runtime chr $x"); 30 31is(ord("\x{1234}"), 0x1234, 'compile time ord \x{....}'); 32 33$x = "\x{1234}"; 34is(ord($x), 0x1234, 'runtime ord \x{....}'); 35 36