This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
parts/inc/misc: Remove extraneous ord() calls
[perl5.git] / dist / Devel-PPPort / t / misc.t
CommitLineData
adfe19db
MHM
1################################################################################
2#
3# !!!!! Do NOT edit this file directly! !!!!!
4#
5# Edit mktests.PL and/or parts/inc/misc instead.
6#
cac25305
MHM
7# This file was automatically generated from the definition files in the
8# parts/inc/ subdirectory by mktests.PL. To learn more about how all this
9# works, please read the F<HACKERS> file that came with this distribution.
10#
adfe19db
MHM
11################################################################################
12
13BEGIN {
14 if ($ENV{'PERL_CORE'}) {
15 chdir 't' if -d 't';
0ff33da8 16 @INC = ('../lib', '../ext/Devel-PPPort/t') if -d '../lib' && -d '../ext';
adfe19db
MHM
17 require Config; import Config;
18 use vars '%Config';
a745474a 19 if (" $Config{'extensions'} " !~ m[ Devel/PPPort ]) {
adfe19db
MHM
20 print "1..0 # Skip -- Perl configured without Devel::PPPort module\n";
21 exit 0;
22 }
23 }
24 else {
25 unshift @INC, 't';
26 }
27
c07deaaf
MHM
28 sub load {
29 eval "use Test";
30 require 'testutil.pl' if $@;
adfe19db 31 }
c07deaaf 32
1eff2a3b 33 if (128) {
c07deaaf 34 load();
1eff2a3b 35 plan(tests => 128);
adfe19db
MHM
36 }
37}
38
39use Devel::PPPort;
40use strict;
91900b62 41BEGIN { $^W = 1; }
adfe19db 42
236afa0a
MHM
43package Devel::PPPort;
44use vars '@ISA';
45require DynaLoader;
46@ISA = qw(DynaLoader);
47bootstrap Devel::PPPort;
48
49package main;
50
adfe19db
MHM
51use vars qw($my_sv @my_av %my_hv);
52
adfe19db
MHM
53ok(&Devel::PPPort::boolSV(1));
54ok(!&Devel::PPPort::boolSV(0));
55
56$_ = "Fred";
57ok(&Devel::PPPort::DEFSV(), "Fred");
58ok(&Devel::PPPort::UNDERBAR(), "Fred");
59
a48dcd62 60if ("$]" >= 5.009002 && "$]" < 5.023 && "$]" < 5.023004) {
0d0f8426 61 eval q{
b2049988 62 no warnings "deprecated";
e5b2cbd0 63 no if $^V > v5.17.9, warnings => "experimental::lexical_topic";
0d0f8426
MHM
64 my $_ = "Tony";
65 ok(&Devel::PPPort::DEFSV(), "Fred");
66 ok(&Devel::PPPort::UNDERBAR(), "Tony");
67 };
68}
69else {
70 ok(1);
71 ok(1);
72}
73
51d6c659
MHM
74my @r = &Devel::PPPort::DEFSV_modify();
75
76ok(@r == 3);
77ok($r[0], 'Fred');
78ok($r[1], 'DEFSV');
79ok($r[2], 'Fred');
80
81ok(&Devel::PPPort::DEFSV(), "Fred");
82
adfe19db
MHM
83eval { 1 };
84ok(!&Devel::PPPort::ERRSV());
85eval { cannot_call_this_one() };
86ok(&Devel::PPPort::ERRSV());
87
88ok(&Devel::PPPort::gv_stashpvn('Devel::PPPort', 0));
89ok(!&Devel::PPPort::gv_stashpvn('does::not::exist', 0));
90ok(&Devel::PPPort::gv_stashpvn('does::not::exist', 1));
91
92$my_sv = 1;
93ok(&Devel::PPPort::get_sv('my_sv', 0));
94ok(!&Devel::PPPort::get_sv('not_my_sv', 0));
95ok(&Devel::PPPort::get_sv('not_my_sv', 1));
96
97@my_av = (1);
98ok(&Devel::PPPort::get_av('my_av', 0));
99ok(!&Devel::PPPort::get_av('not_my_av', 0));
100ok(&Devel::PPPort::get_av('not_my_av', 1));
101
102%my_hv = (a=>1);
103ok(&Devel::PPPort::get_hv('my_hv', 0));
104ok(!&Devel::PPPort::get_hv('not_my_hv', 0));
105ok(&Devel::PPPort::get_hv('not_my_hv', 1));
106
107sub my_cv { 1 };
108ok(&Devel::PPPort::get_cv('my_cv', 0));
109ok(!&Devel::PPPort::get_cv('not_my_cv', 0));
110ok(&Devel::PPPort::get_cv('not_my_cv', 1));
111
9132e1a3 112ok(Devel::PPPort::dXSTARG(42), 43);
0d0f8426
MHM
113ok(Devel::PPPort::dAXMARK(4711), 4710);
114
115ok(Devel::PPPort::prepush(), 42);
116
117ok(join(':', Devel::PPPort::xsreturn(0)), 'test1');
118ok(join(':', Devel::PPPort::xsreturn(1)), 'test1:test2');
9132e1a3 119
f2ab5a41
MHM
120ok(Devel::PPPort::PERL_ABS(42), 42);
121ok(Devel::PPPort::PERL_ABS(-13), 13);
122
a48dcd62
DIM
123ok(Devel::PPPort::SVf(42), "$]" >= 5.004 ? '[42]' : '42');
124ok(Devel::PPPort::SVf('abc'), "$]" >= 5.004 ? '[abc]' : 'abc');
f2ab5a41 125
fd7af155
MHM
126ok(&Devel::PPPort::Perl_ppaddr_t("FOO"), "foo");
127
7bb03b24
MHM
128ok(&Devel::PPPort::ptrtests(), 63);
129
94e22bd6
MH
130ok(&Devel::PPPort::OpSIBLING_tests(), 0);
131
a48dcd62 132if ("$]" >= 5.009000) {
ea4b7f32
JH
133 eval q{
134 ok(&Devel::PPPort::check_HeUTF8("hello"), "norm");
135 ok(&Devel::PPPort::check_HeUTF8("\N{U+263a}"), "utf8");
136 };
137} else {
138 ok(1, 1);
139 ok(1, 1);
140}
141
94e22bd6
MH
142@r = &Devel::PPPort::check_c_array();
143ok($r[0], 4);
144ok($r[1], "13");
145
146ok(!Devel::PPPort::SvRXOK(""));
147ok(!Devel::PPPort::SvRXOK(bless [], "Regexp"));
148
a48dcd62 149if ("$]" < 5.005) {
94e22bd6
MH
150 skip 'no qr// objects in this perl', 0;
151 skip 'no qr// objects in this perl', 0;
152} else {
153 my $qr = eval 'qr/./';
154 ok(Devel::PPPort::SvRXOK($qr));
155 ok(Devel::PPPort::SvRXOK(bless $qr, "Surprise"));
156}
157
db834d60
KW
158ok( Devel::PPPort::isBLANK(ord(" ")));
159ok(! Devel::PPPort::isBLANK(ord("\n")));
9dc2cc38 160
db834d60
KW
161ok( Devel::PPPort::isBLANK_A(ord("\t")));
162ok(! Devel::PPPort::isBLANK_A(ord("\r")));
9dc2cc38 163
db834d60
KW
164ok( Devel::PPPort::isUPPER(ord("A")));
165ok(! Devel::PPPort::isUPPER(ord("a")));
9dc2cc38 166
db834d60 167ok( Devel::PPPort::isUPPER_A(ord("Z")));
9dc2cc38
KW
168
169# One of these two is uppercase in EBCDIC; the other in Latin1, but neither are
170# ASCII uppercase.
ffafe9b2
KW
171ok(! Devel::PPPort::isUPPER_A(0xDC));
172ok(! Devel::PPPort::isUPPER_A(0xFC));
9dc2cc38 173
db834d60
KW
174ok( Devel::PPPort::isLOWER(ord("b")));
175ok(! Devel::PPPort::isLOWER(ord("B")));
9dc2cc38 176
db834d60 177ok( Devel::PPPort::isLOWER_A(ord("y")));
9dc2cc38
KW
178
179# One of these two is lowercase in EBCDIC; the other in Latin1, but neither are
180# ASCII lowercase.
ffafe9b2
KW
181ok(! Devel::PPPort::isLOWER_A(0xDC));
182ok(! Devel::PPPort::isLOWER_A(0xFC));
9dc2cc38 183
db834d60
KW
184ok( Devel::PPPort::isALPHA(ord("C")));
185ok(! Devel::PPPort::isALPHA(ord("1")));
9dc2cc38 186
db834d60
KW
187ok( Devel::PPPort::isALPHA_A(ord("x")));
188ok(! Devel::PPPort::isALPHA_A(0xDC));
9dc2cc38 189
db834d60
KW
190ok( Devel::PPPort::isWORDCHAR(ord("_")));
191ok(! Devel::PPPort::isWORDCHAR(ord("@")));
9dc2cc38 192
db834d60
KW
193ok( Devel::PPPort::isWORDCHAR_A(ord("2")));
194ok(! Devel::PPPort::isWORDCHAR_A(0xFC));
9dc2cc38 195
db834d60
KW
196ok( Devel::PPPort::isALPHANUMERIC(ord("4")));
197ok(! Devel::PPPort::isALPHANUMERIC(ord("_")));
9dc2cc38 198
db834d60
KW
199ok( Devel::PPPort::isALPHANUMERIC_A(ord("l")));
200ok(! Devel::PPPort::isALPHANUMERIC_A(0xDC));
9dc2cc38 201
db834d60
KW
202ok( Devel::PPPort::isALNUM(ord("c")));
203ok(! Devel::PPPort::isALNUM(ord("}")));
9dc2cc38 204
db834d60
KW
205ok( Devel::PPPort::isALNUM_A(ord("5")));
206ok(! Devel::PPPort::isALNUM_A(0xFC));
9dc2cc38 207
db834d60
KW
208ok( Devel::PPPort::isDIGIT(ord("6")));
209ok(! Devel::PPPort::isDIGIT(ord("_")));
9dc2cc38 210
db834d60
KW
211ok( Devel::PPPort::isDIGIT_A(ord("7")));
212ok(! Devel::PPPort::isDIGIT_A(0xDC));
9dc2cc38 213
db834d60
KW
214ok( Devel::PPPort::isOCTAL(ord("7")));
215ok(! Devel::PPPort::isOCTAL(ord("8")));
9dc2cc38 216
db834d60
KW
217ok( Devel::PPPort::isOCTAL_A(ord("0")));
218ok(! Devel::PPPort::isOCTAL_A(ord("9")));
9dc2cc38 219
db834d60
KW
220ok( Devel::PPPort::isIDFIRST(ord("D")));
221ok(! Devel::PPPort::isIDFIRST(ord("1")));
9dc2cc38 222
db834d60
KW
223ok( Devel::PPPort::isIDFIRST_A(ord("_")));
224ok(! Devel::PPPort::isIDFIRST_A(0xFC));
9dc2cc38 225
db834d60
KW
226ok( Devel::PPPort::isIDCONT(ord("e")));
227ok(! Devel::PPPort::isIDCONT(ord("@")));
9dc2cc38 228
db834d60
KW
229ok( Devel::PPPort::isIDCONT_A(ord("2")));
230ok(! Devel::PPPort::isIDCONT_A(0xDC));
9dc2cc38 231
db834d60
KW
232ok( Devel::PPPort::isSPACE(ord(" ")));
233ok(! Devel::PPPort::isSPACE(ord("_")));
9dc2cc38 234
db834d60
KW
235ok( Devel::PPPort::isSPACE_A(ord("\cK")));
236ok(! Devel::PPPort::isSPACE_A(ord("F")));
9dc2cc38
KW
237
238# This stresses the edge for ASCII machines, but happens to work on EBCDIC as
239# well
db834d60
KW
240ok( Devel::PPPort::isASCII(0x7F));
241ok(! Devel::PPPort::isASCII(0x80));
9dc2cc38 242
db834d60 243ok( Devel::PPPort::isASCII_A(ord("9")));
9dc2cc38
KW
244
245# B6 is the PARAGRAPH SIGN in ASCII and EBCDIC
db834d60 246ok(! Devel::PPPort::isASCII_A(0xB6));
9dc2cc38 247
db834d60
KW
248ok( Devel::PPPort::isCNTRL(ord("\e")));
249ok(! Devel::PPPort::isCNTRL(ord(" ")));
9dc2cc38 250
db834d60
KW
251ok( Devel::PPPort::isCNTRL_A(ord("\a")));
252ok(! Devel::PPPort::isCNTRL_A(0xB6));
9dc2cc38 253
db834d60
KW
254ok( Devel::PPPort::isPRINT(ord(" ")));
255ok(! Devel::PPPort::isPRINT(ord("\n")));
9dc2cc38 256
db834d60
KW
257ok( Devel::PPPort::isPRINT_A(ord("G")));
258ok(! Devel::PPPort::isPRINT_A(0xB6));
9dc2cc38 259
db834d60
KW
260ok( Devel::PPPort::isGRAPH(ord("h")));
261ok(! Devel::PPPort::isGRAPH(ord(" ")));
9dc2cc38 262
db834d60
KW
263ok( Devel::PPPort::isGRAPH_A(ord("i")));
264ok(! Devel::PPPort::isGRAPH_A(0xB6));
9dc2cc38 265
db834d60
KW
266ok( Devel::PPPort::isPUNCT(ord("#")));
267ok(! Devel::PPPort::isPUNCT(ord(" ")));
9dc2cc38 268
db834d60
KW
269ok( Devel::PPPort::isPUNCT_A(ord("*")));
270ok(! Devel::PPPort::isPUNCT_A(0xB6));
9dc2cc38 271
db834d60
KW
272ok( Devel::PPPort::isXDIGIT(ord("A")));
273ok(! Devel::PPPort::isXDIGIT(ord("_")));
9dc2cc38 274
db834d60
KW
275ok( Devel::PPPort::isXDIGIT_A(ord("9")));
276ok(! Devel::PPPort::isXDIGIT_A(0xDC));
9dc2cc38 277
db834d60
KW
278ok( Devel::PPPort::isPSXSPC(ord(" ")));
279ok(! Devel::PPPort::isPSXSPC(ord("k")));
9dc2cc38 280
db834d60
KW
281ok( Devel::PPPort::isPSXSPC_A(ord("\cK")));
282ok(! Devel::PPPort::isPSXSPC_A(0xFC));
9dc2cc38 283
1eff2a3b
KW
284ok(&Devel::PPPort::av_top_index([1,2,3]), 2);
285ok(&Devel::PPPort::av_tindex([1,2,3,4]), 3);
286