Maker/Ladder.pm

filter: Statementstmt 100% 30 / 30 Branchbran 80.0% 8 / 10 Conditioncond 37.5% 3 / 8 MC/DCmcdc 0.0% 0 / 5 Subroutinesub 100% 7 / 7 Podpod 0.0% 0 / 1 totaltotal 78.6% 48 / 61 CC 12 SCAR 22.6
CC
12
Cov
85%
init
13.8
__ANON__
1.1
BEGIN
1.0
CRAP 9.6
« Maker/Lollipop.pm ↑ Summary Maker/Empty.pm »
1 package Graph::Maker::Ladder;
2
3 3 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 3 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 3 ▶use Carp qw/croak/;
Subroutine BEGIN: called CC=1 SCAR=0.0
6 3 ▶use base qw/Graph::Maker/;
Subroutine BEGIN: called CC=1 SCAR=0.0
7 3 ▶use Graph;
Subroutine BEGIN: called CC=1 SCAR=0.0
8
9 3 our $VERSION = '0.01';
10
11 sub init
12 4 ▶{
Subroutine init: called CC=12 SCAR=26.3
Pod undocumented
13 4 my ($self, %params) = @_;
14
15 4 ▶ my $r = delete($params{rungs}) || 0;
Condition50%1/2
delete $params{'rungs'} || 0
l!l
40
MC/DC0%0/1
delete $params{'rungs'} || 0
delete $params{'rungs'}
Truth table50%1/2
A
A= delete $params{'rungs'}
Aresult
11
00
16 4 my $gm = delete($params{graph_maker});
17 4 ▶ croak "graph_maker must be a reference to a function that creates a Graph.\n" if $gm && ref($gm) ne 'CODE';
Branch: 1 branch
BranchTrueFalseTotal
if $gm and ref $gm ne "CODE" 0 4 4
Condition33%1/3
$gm and ref $gm ne "CODE"
!ll&&!rl&&r
400
MC/DC0%0/2
$gm and ref $gm ne "CODE"
$gm ref $gm ne "CODE"
Truth table33%1/3
A and B
A= $gmB= ref $gm ne "CODE"
ABresult
0X0
100
111
18 4 ▶ $gm ||= sub { new Graph(@_); };
Subroutine __ANON__: called CC=1 SCAR=0.6
Condition33%1/3
$gm ||= sub { "Graph"->new(@_); }
l!l&&r!l&&!r
040
MC/DC0%0/2
$gm ||= sub { "Graph"->new(@_); }
$gm sub { "Graph"->new(@_); }
Truth table33%1/3
A ||= B
A= $gmB= sub { "Graph"->new(@_); }
ABresult
1X1
011
000
19
20 4 my $g = $gm->(%params);
21
22 4 ▶ return $g if $r == 0;
Branch: 1 branch
BranchTrueFalseTotal
if $r == 0 0 4 4
23
24 4 ▶ $g->add_edges($_, $_+1, ($g->is_directed() ? ($_+1,$_) : ())) for (1..$r-1);
Branch: 1 branch
BranchTrueFalseTotal
$g->is_directed ? : 6 6 12
25 4 ▶ $g->add_edges($_, $_+1, ($g->is_directed() ? ($_+1,$_) : ())) for ($r+1..2*$r-1);
Branch: 1 branch
BranchTrueFalseTotal
$g->is_directed ? : 6 6 12
26 4 ▶ $g->add_edges($_, $_+$r, ($g->is_directed() ? ($_+$r,$_) : ())) for (1..$r);
Branch: 1 branch
BranchTrueFalseTotal
$g->is_directed ? : 8 8 16
27
28 4 return $g;
29 }
30
31 3 Graph::Maker->add_factory_type( 'ladder' => __PACKAGE__ );
32
33 3 1;
34
35 __DATA__
« Maker/Lollipop.pm ↑ Summary Maker/Empty.pm »