Verify/LinesIter.pm

filter: Statementstmt 93.7% 30 / 32 Branchbran 50.0% 2 / 4 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 8 / 8 Podpod 100% 1 / 1 totaltotal 91.1% 41 / 45 CC 3 SCAR 3.6
CC
3
Cov
89%
_assert_empty_line
2.1
_compare_line
2.1
BEGIN
1.0
CRAP 1.4
« Verify/Solution/Base.pm ↑ Summary Verify/Solution/ExpandMultiCardMoves/Lax.pm »
1 package Games::Solitaire::Verify::LinesIter;
2 4 $Games::Solitaire::Verify::LinesIter::VERSION = '0.2601';
3 4 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 4 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 4 ▶use autodie;
Subroutine BEGIN: called CC=1 SCAR=0.0
6  
7 sub new
8 6 ▶{
Subroutine new: called CC=1 SCAR=0.0
Pod documented
9 6 my $class = shift;
10  
11 6 my $self = bless {}, $class;
12  
13 6 $self->_init(@_);
14  
15 6 return $self;
16 }
17  
18 sub _init
19 6 ▶{
Subroutine _init: called CC=1 SCAR=0.0
20 6 my ( $self, $args ) = @_;
21  
22 6 $self->{_get} = $args->{_get};
23 6 $self->{_line_num} = 0;
24  
25 6 return;
26 }
27  
28 sub _get_line
29 3814 ▶{
Subroutine _get_line: called CC=1 SCAR=0.0
30 3814 my ( $self, ) = @_;
31  
32 3814 my $ret = $self->{_get}->();
33 3814 return ( $ret, ++$self->{_line_num} );
34 }
35  
36 sub _assert_empty_line
37 1156 ▶{
Subroutine _assert_empty_line: called CC=2 SCAR=7.4
38 1156 my ( $self, ) = @_;
39  
40 1156 my ( $s, $line_idx ) = $self->_get_line;
41  
42 1156 ▶ if ( $s ne '' )
Branch: 1 branch
BranchTrueFalseTotal
if ($s ne "") 0 1156 1156
43 {
44 0 Carp::confess("Line '$line_idx' is not empty, but '$s'");
45 }
46  
47 1156 return;
48 }
49  
50 sub _compare_line
51 1842 ▶{
Subroutine _compare_line: called CC=2 SCAR=7.4
52 1842 my ( $self, $wanted_line, $title, ) = @_;
53  
54 1842 my ( $line, $line_idx ) = $self->_get_line;
55 1842 ▶ if ( $line ne $wanted_line )
Branch: 1 branch
BranchTrueFalseTotal
if ($line ne $wanted_line) 0 1842 1842
56 {
57 0 Carp::confess(
58 "$title string is '$line' vs. '$wanted_line' at line no. $line_idx"
59 );
60 }
61  
62 1842 return;
63 }
64  
65 4 1;
66  
67 __END__
« Verify/Solution/Base.pm ↑ Summary Verify/Solution/ExpandMultiCardMoves/Lax.pm »