This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
(perl #129125) copy form data if it might be freed
[perl5.git] / t / op / chars.t
CommitLineData
da0838f1
PP
1#!./perl
2
9dd59c34
CK
3BEGIN {
4 chdir 't' if -d 't';
9dd59c34 5 require './test.pl';
624c42e2 6 set_up_inc('../lib');
9dd59c34
CK
7}
8
28db5ecb 9plan tests => 34;
da0838f1
PP
10
11# because of ebcdic.c these should be the same on asciiish
12# and ebcdic machines.
13# Peter Prymmer <pvhp@best.com>.
14
15my $c = "\c@";
9dd59c34 16is (ord($c), 0, '\c@');
da0838f1 17$c = "\cA";
9dd59c34 18is (ord($c), 1, '\cA');
da0838f1 19$c = "\cB";
9dd59c34 20is (ord($c), 2, '\cB');
da0838f1 21$c = "\cC";
9dd59c34 22is (ord($c), 3, '\cC');
da0838f1 23$c = "\cD";
9dd59c34 24is (ord($c), 4, '\cD');
da0838f1 25$c = "\cE";
9dd59c34 26is (ord($c), 5, '\cE');
da0838f1 27$c = "\cF";
9dd59c34 28is (ord($c), 6, '\cF');
da0838f1 29$c = "\cG";
9dd59c34 30is (ord($c), 7, '\cG');
da0838f1 31$c = "\cH";
9dd59c34 32is (ord($c), 8, '\cH');
da0838f1 33$c = "\cI";
9dd59c34 34is (ord($c), 9, '\cI');
da0838f1 35$c = "\cJ";
9dd59c34 36is (ord($c), 10, '\cJ');
da0838f1 37$c = "\cK";
9dd59c34 38is (ord($c), 11, '\cK');
da0838f1 39$c = "\cL";
9dd59c34 40is (ord($c), 12, '\cL');
da0838f1 41$c = "\cM";
9dd59c34 42is (ord($c), 13, '\cM');
da0838f1 43$c = "\cN";
9dd59c34 44is (ord($c), 14, '\cN');
da0838f1 45$c = "\cO";
9dd59c34 46is (ord($c), 15, '\cO');
da0838f1 47$c = "\cP";
9dd59c34 48is (ord($c), 16, '\cP');
da0838f1 49$c = "\cQ";
9dd59c34 50is (ord($c), 17, '\cQ');
da0838f1 51$c = "\cR";
9dd59c34 52is (ord($c), 18, '\cR');
da0838f1 53$c = "\cS";
9dd59c34 54is (ord($c), 19, '\cS');
da0838f1 55$c = "\cT";
9dd59c34 56is (ord($c), 20, '\cT');
da0838f1 57$c = "\cU";
9dd59c34 58is (ord($c), 21, '\cU');
da0838f1 59$c = "\cV";
9dd59c34 60is (ord($c), 22, '\cV');
da0838f1 61$c = "\cW";
9dd59c34 62is (ord($c), 23, '\cW');
da0838f1 63$c = "\cX";
9dd59c34 64is (ord($c), 24, '\cX');
da0838f1 65$c = "\cY";
9dd59c34 66is (ord($c), 25, '\cY');
da0838f1 67$c = "\cZ";
9dd59c34 68is (ord($c), 26, '\cZ');
da0838f1 69$c = "\c[";
9dd59c34 70is (ord($c), 27, '\c[');
da0838f1 71$c = "\c\\";
9dd59c34 72is (ord($c), 28, '\c\\');
da0838f1 73$c = "\c]";
9dd59c34 74is (ord($c), 29, '\c]');
da0838f1 75$c = "\c^";
9dd59c34 76is (ord($c), 30, '\c^');
da0838f1 77$c = "\c_";
9dd59c34 78is (ord($c), 31, '\c_');
2bd1cbf6
KW
79
80# '\c?' is an outlier, and is treated differently on each platform.
81# It's DEL on ASCII, and APC on EBCDIC
6c0c4c65
KW
82$c = "\c?";
83is (ord($c), ($::IS_ASCII)
84 ? 127
85 : utf8::unicode_to_native(0x9F),
2bd1cbf6 86 '\c?');
28db5ecb
JK
87$c = '';
88is (ord($c), 0, 'ord("") is 0');