1N/A#!./perl
1N/A
1N/ABEGIN {
1N/A chdir 't' if -d 't';
1N/A @INC = qw(. ../lib); # ../lib needed for test.deparse
1N/A require "test.pl";
1N/A}
1N/A
1N/Aplan tests => 7;
1N/A
1N/A# compile time evaluation
1N/A
1N/A# 'A' 65 ASCII
1N/A# 'A' 193 EBCDIC
1N/A
1N/Aok(ord('A') == 65 || ord('A') == 193, "ord('A') is ".ord('A'));
1N/A
1N/Ais(ord(chr(500)), 500, "compile time chr 500");
1N/A
1N/A# run time evaluation
1N/A
1N/A$x = 'ABC';
1N/A
1N/Aok(ord($x) == 65 || ord($x) == 193, "ord('$x') is ".ord($x));
1N/A
1N/Aok(chr 65 eq 'A' || chr 193 eq 'A', "chr can produce 'A'");
1N/A
1N/A$x = 500;
1N/Ais(ord(chr($x)), $x, "runtime chr $x");
1N/A
1N/Ais(ord("\x{1234}"), 0x1234, 'compile time ord \x{....}');
1N/A
1N/A$x = "\x{1234}";
1N/Ais(ord($x), 0x1234, 'runtime ord \x{....}');
1N/A