TileMap/Role/Checks.pm

filter: Statementstmt 100% 28 / 28 Branchbran 100% 4 / 4 Conditioncond 100% 12 / 12 MC/DCmcdc 100% 8 / 8 Subroutinesub 100% 8 / 8 Podpod 0.0% 0 / 2 totaltotal 96.7% 60 / 62 SCAR 19.5
CC
7
Cov
100%
check_within_map
4.0
check_can_be_accessed
4.0
BEGIN
1.0
CRAP 7.0
« TileMap.pm ↑ Summary TileMap/Legend.pm »
1 package Game::TileMap::Role::Checks;
2 2 $Game::TileMap::Role::Checks::VERSION = '0.002';
3 2 ▶use v5.10;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 2 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 2 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
6  
7 2 ▶use Moo::Role;
Subroutine BEGIN: called CC=1 SCAR=0.0
8 2 ▶use Mooish::AttributeBuilder -standard;
Subroutine BEGIN: called CC=1 SCAR=0.0
9  
10 2 ▶use Game::TileMap::Legend;
Subroutine BEGIN: called CC=1 SCAR=0.0
11  
12 2 requires qw(
13 coordinates
14 );
15  
16 sub check_within_map
17 {
18 9 ▶ my ($self, $x, $y) = @_;
Subroutine check_within_map: called CC=4 SCAR=13.9
Pod undocumented
19  
20 9 ▶ return !!0 if $x < 0 || $y < 0;
Branch: 1 branch
BranchTrueFalseTotal
if $x < 0 or $y < 0 2 7 9
Condition100%3/3
$x < 0 or $y < 0
l!l&&r!l&&!r
117
MC/DC100%2/2
$x < 0 or $y < 0
$x < 0 $y < 0
Truth table100%3/3
A or B
A= $x < 0B= $y < 0
ABresult
1X1
011
000
21  
22 7 my $obj = $self->coordinates->[$x][$y];
23 7 ▶ return $obj && $obj->type ne Game::TileMap::Legend::WALL_OBJECT;
Condition100%3/3
$obj && $obj->type ne ''
!ll&&!rl&&r
214
MC/DC100%2/2
$obj && $obj->type ne ''
$obj $obj->type ne ''
Truth table100%3/3
A && B
A= $objB= $obj->type ne ''
ABresult
0X0
100
111
24 }
25  
26 sub check_can_be_accessed
27 {
28 9 ▶ my ($self, $x, $y) = @_;
Subroutine check_can_be_accessed: called CC=4 SCAR=13.9
Pod undocumented
29  
30 9 ▶ return !!0 if $x < 0 || $y < 0;
Branch: 1 branch
BranchTrueFalseTotal
if $x < 0 or $y < 0 2 7 9
Condition100%3/3
$x < 0 or $y < 0
l!l&&r!l&&!r
117
MC/DC100%2/2
$x < 0 or $y < 0
$x < 0 $y < 0
Truth table100%3/3
A or B
A= $x < 0B= $y < 0
ABresult
1X1
011
000
31  
32 7 my $obj = $self->coordinates->[$x][$y];
33 7 ▶ return $obj && $obj->type;
Condition100%3/3
$obj && $obj->type
!ll&&!rl&&r
223
MC/DC100%2/2
$obj && $obj->type
$obj $obj->type
Truth table100%3/3
A && B
A= $objB= $obj->type
ABresult
0X0
100
111
34 }
35  
36 2 1;
37  
« TileMap.pm ↑ Summary TileMap/Legend.pm »