blib/lib/Games/ABC_Path/Solver/Base.pm

filter: Statementstmt 92.8% 26 / 28 Branchbran n/a Conditioncond 100% 3 / 3 MC/DCmcdc 100% 2 / 2 Subroutinesub 90.9% 10 / 11 Podpod 100% 1 / 1 totaltotal 93.3% 42 / 45 CC 2 SCAR 2.2
CC
2
Cov
94%
_to_xy
2.0
_x_in_range
2.0
BEGIN
1.0
CRAP 1.2
« blib/lib/Games/ABC_Path/Solver/Coord.pm ↑ Summary bin/abc-path-solve »
1 package Games::ABC_Path::Solver::Base;
2 16 $Games::ABC_Path::Solver::Base::VERSION = '0.6.2';
3 16 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 16 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
5  
6 16 ▶use Games::ABC_Path::Solver::Constants;
Subroutine BEGIN: called CC=1 SCAR=0.0
7  
8  
9 sub new
10 {
11 34064 ▶ my $class = shift;
Subroutine new: called CC=1 SCAR=0.0
Pod documented
12  
13 34064 my $self = bless {}, $class;
14  
15 34064 $self->_init(@_);
16  
17 34064 return $self;
18 }
19  
20 16 ▶use integer;
Subroutine BEGIN: called CC=1 SCAR=0.0
21  
22 sub _xy_to_int
23 {
24 43692 ▶ my ( $self, $xy ) = @_;
Subroutine _xy_to_int: called CC=1 SCAR=0.0
25  
26  
27 43692 return $xy->[$Y] * $LEN + $xy->[$X];
28 }
29  
30 sub _to_xy
31 {
32 0 ▶ my ( $self, $int ) = @_;
Subroutine _to_xy: not called CC=1 SCAR=6.9
33  
34 0 return ( ( $int / $LEN ), ( $int % $LEN ) );
35 }
36  
37 sub _y_indexes
38 {
39 1765 ▶ return ( 0 .. $LEN_LIM );
Subroutine _y_indexes: called CC=1 SCAR=0.0
40 }
41  
42 sub _x_indexes
43 {
44 6726 ▶ return ( 0 .. $LEN_LIM );
Subroutine _x_indexes: called CC=1 SCAR=0.0
45 }
46  
47 sub _x_in_range
48 {
49 10632 ▶ my ( $self, $x ) = @_;
Subroutine _x_in_range: called CC=2 SCAR=6.9
50  
51 10632 ▶ return ( $x >= 0 and $x < $LEN );
Condition100%3/3
$x >= 0 && $x < $Games::ABC_Path::Solver::Base::LEN
!ll&&!rl&&r
6726119349
MC/DC100%2/2
$x >= 0 && $x < $Games::ABC_Path::Solver::Base::LEN
$x >= 0 $x < $Games::ABC_Path::Solver::Base::LEN
Truth table100%3/3
A && B
A= $x >= 0B= $x < $Games::ABC_Path::Solver::Base::LEN
ABresult
0X0
100
111
52 }
53  
54 sub _y_in_range
55 {
56 4989 ▶ my ( $self, $y ) = @_;
Subroutine _y_in_range: called CC=1 SCAR=0.0
57  
58 4989 return $self->_x_in_range($y);
59 }
60  
61  
62 16 1; # End of Games::ABC_Path::Solver::Base
63  
64 __END__
« blib/lib/Games/ABC_Path/Solver/Coord.pm ↑ Summary bin/abc-path-solve »