File Coverage

blib/lib/Language/Befunge/lib/TEST.pm
Criterion Covered Total %
statement 23 23 100.0
branch 2 2 100.0
condition n/a
subroutine 7 7 100.0
pod 4 4 100.0
total 36 36 100.0


line stmt bran cond sub pod time code
1             package Language::Befunge::lib::TEST;
2              
3 3     3   3413 use strict;
  3         5  
  3         108  
4 3     3   15 use warnings;
  3         5  
  3         82  
5 3     3   2353 use Test::Builder;
  3         30652  
  3         39  
6              
7             my $Tester = Test::Builder->new();
8              
9 6     6 1 25 sub new { return bless {}, shift; }
10              
11             # P = plan()
12             # num -
13             sub P {
14 2     2 1 6 my ( $self, $interp ) = @_;
15 2         20 my $tests = $interp->get_curip()->spop();
16 2 100       15 $Tester->plan( $tests ? ( tests => $tests ) : 'no_plan' );
17             }
18              
19             # O = ok()
20             # 0gnirts bool -
21             sub O {
22 2     2 1 5 my ( $self, $interp ) = @_;
23 2         11 my $ip = $interp->get_curip();
24              
25             # pop the args and output the test result
26 2         8 my $ok = $ip->spop();
27 2         11 my $msg = $ip->spop_gnirts();
28 2         14 $Tester->ok( $ok, $msg );
29             }
30              
31             # I = is()
32             # 0gnirts expected got -
33             sub I {
34 2     2 1 5 my ( $self, $interp ) = @_;
35 2         9 my $ip = $interp->get_curip();
36              
37 2         10 my ( $got, $expected ) = ( $ip->spop(), $ip->spop() );
38 2         12 my $msg = $ip->spop_gnirts();
39 2         13 $Tester->is_eq( $got, $expected, $msg );
40             }
41              
42             'ok';
43              
44             __END__