|
Server : Apache/2.2.22 (Unix) mod_ssl/2.2.22 OpenSSL/1.0.0-fips mod_auth_passthrough/2.1 mod_bwlimited/1.4 System : Linux server.jackjohnson.com 2.6.32-279.5.2.el6.x86_64 #1 SMP Fri Aug 24 01:07:11 UTC 2012 x86_64 User : jackjohn ( 502) PHP Version : 5.3.17 Disable Function : NONE Directory : /installd/perl588installer/perl-5.8.8/t/op/ |
Upload File : |
#!./perl
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
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';
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{....}');