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