1BEGIN { 2 chdir 't' if -d 't'; 3 @INC = '../lib' if -d '../lib'; 4} 5 6use Devel::PPPort; 7use strict; 8 9print "1..17\n"; 10 11my $total = 0; 12my $good = 0; 13 14my $test = 0; 15sub ok { 16 my ($name, $test_sub) = @_; 17 my $line = (caller)[2]; 18 my $value; 19 20 eval { $value = &{ $test_sub }() } ; 21 22 ++ $test ; 23 24 if ($@) { 25 printf "not ok $test # Testing '$name', line $line $@\n"; 26 } 27 elsif ($value != 1){ 28 printf "not ok $test # Testing '$name', line $line, value != 1 ($value)\n"; 29 } 30 else { 31 print "ok $test\n"; 32 } 33 34} 35 36ok "Static newCONSTSUB()", 37 sub { Devel::PPPort::test1(); Devel::PPPort::test_value_1() == 1} ; 38 39ok "Global newCONSTSUB()", 40 sub { Devel::PPPort::test2(); Devel::PPPort::test_value_2() == 2} ; 41 42ok "Extern newCONSTSUB()", 43 sub { Devel::PPPort::test3(); Devel::PPPort::test_value_3() == 3} ; 44 45ok "newRV_inc()", sub { Devel::PPPort::test4()} ; 46 47ok "newRV_noinc()", sub { Devel::PPPort::test5()} ; 48 49ok "PL_sv_undef", sub { not defined Devel::PPPort::test6()} ; 50 51ok "PL_sv_yes", sub { Devel::PPPort::test7()} ; 52 53ok "PL_sv_no", sub { !Devel::PPPort::test8()} ; 54 55ok "PL_na", sub { Devel::PPPort::test9("abcd") == 4} ; 56 57ok "boolSV 1", sub { Devel::PPPort::test10(1) } ; 58 59ok "boolSV 0", sub { ! Devel::PPPort::test10(0) } ; 60 61ok "newSVpvn", sub { Devel::PPPort::test11("abcde", 3) eq "abc" } ; 62 63ok "DEFSV", sub { $_ = "Fred"; Devel::PPPort::test12() eq "Fred" } ; 64 65ok "ERRSV", sub { eval { 1; }; ! Devel::PPPort::test13() }; 66 67ok "ERRSV", sub { eval { fred() }; Devel::PPPort::test13() }; 68 69ok "CXT 1", sub { Devel::PPPort::test14()} ; 70 71ok "CXT 2", sub { Devel::PPPort::test15()} ; 72 73__END__ 74# TODO 75 76PERL_VERSION 77PERL_BCDVERSION 78 79PL_stdingv 80PL_hints 81PL_curcop 82PL_curstash 83PL_copline 84PL_Sv 85PL_compiling 86PL_dirty 87 88PTR2IV 89INT2PTR 90 91dTHR 92gv_stashpvn 93NOOP 94SAVE_DEFSV 95PERL_UNUSED_DECL 96dNOOP 97 98call_argv 99call_method 100call_pv 101call_sv 102 103get_cv 104get_av 105get_hv 106get_sv 107 108grok_hex 109grok_oct 110grok_bin 111 112grok_number 113grok_numeric_radix 114