Commit | Line | Data |
a06d4b7f |
1 | BEGIN { |
2 | chdir 't' if -d 't'; |
3 | @INC = '../lib' if -d '../lib'; |
4 | } |
44284200 |
5 | |
6 | use Devel::PPPort; |
44284200 |
7 | use strict; |
8 | |
9 | print "1..17\n"; |
10 | |
44284200 |
11 | my $total = 0; |
12 | my $good = 0; |
13 | |
14 | my $test = 0; |
15 | sub 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 | |
36 | ok "Static newCONSTSUB()", |
37 | sub { Devel::PPPort::test1(); Devel::PPPort::test_value_1() == 1} ; |
38 | |
39 | ok "Global newCONSTSUB()", |
40 | sub { Devel::PPPort::test2(); Devel::PPPort::test_value_2() == 2} ; |
41 | |
42 | ok "Extern newCONSTSUB()", |
43 | sub { Devel::PPPort::test3(); Devel::PPPort::test_value_3() == 3} ; |
44 | |
45 | ok "newRV_inc()", sub { Devel::PPPort::test4()} ; |
46 | |
47 | ok "newRV_noinc()", sub { Devel::PPPort::test5()} ; |
48 | |
49 | ok "PL_sv_undef", sub { not defined Devel::PPPort::test6()} ; |
50 | |
51 | ok "PL_sv_yes", sub { Devel::PPPort::test7()} ; |
52 | |
53 | ok "PL_sv_no", sub { !Devel::PPPort::test8()} ; |
54 | |
55 | ok "PL_na", sub { Devel::PPPort::test9("abcd") == 4} ; |
56 | |
57 | ok "boolSV 1", sub { Devel::PPPort::test10(1) } ; |
58 | |
59 | ok "boolSV 0", sub { ! Devel::PPPort::test10(0) } ; |
60 | |
61 | ok "newSVpvn", sub { Devel::PPPort::test11("abcde", 3) eq "abc" } ; |
62 | |
63 | ok "DEFSV", sub { $_ = "Fred"; Devel::PPPort::test12() eq "Fred" } ; |
64 | |
65 | ok "ERRSV", sub { eval { 1; }; ! Devel::PPPort::test13() }; |
66 | |
67 | ok "ERRSV", sub { eval { fred() }; Devel::PPPort::test13() }; |
68 | |
69 | ok "CXT 1", sub { Devel::PPPort::test14()} ; |
70 | |
71 | ok "CXT 2", sub { Devel::PPPort::test15()} ; |
72 | |
73 | __END__ |
74 | # TODO |
75 | |
76 | PERL_VERSION |
77 | PERL_BCDVERSION |
78 | |
79 | PL_stdingv |
80 | PL_hints |
81 | PL_curcop |
82 | PL_curstash |
83 | PL_copline |
84 | PL_Sv |
85 | PL_compiling |
86 | PL_dirty |
87 | |
88 | PTR2IV |
89 | INT2PTR |
90 | |
91 | dTHR |
92 | gv_stashpvn |
93 | NOOP |
94 | SAVE_DEFSV |
95 | PERL_UNUSED_DECL |
96 | dNOOP |
e1fd986f |
97 | |
98 | get_cv |
99 | get_av |
100 | get_hv |
101 | get_sv |
7dcda430 |
102 | |
103 | grok_hex |
104 | grok_oct |
105 | grok_bin |