Maker/Linear.pm

filter: Statementstmt 100% 28 / 28 Branchbran 75.0% 3 / 4 Conditioncond 37.5% 3 / 8 MC/DCmcdc 0.0% 0 / 5 Subroutinesub 100% 7 / 7 Podpod 0.0% 0 / 1 totaltotal 77.3% 41 / 53 CC 6 SCAR 13.5
CC
6
Cov
85%
init
6.7
__ANON__
1.1
BEGIN
1.0
CRAP 3.9
« Maker/Cycle.pm ↑ Summary Maker/Disconnected.pm »
1 package Graph::Maker::Linear;
2
3 5 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 5 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 5 ▶use Carp qw/croak/;
Subroutine BEGIN: called CC=1 SCAR=0.0
6 5 ▶use base qw/Graph::Maker/;
Subroutine BEGIN: called CC=1 SCAR=0.0
7 5 ▶use Graph;
Subroutine BEGIN: called CC=1 SCAR=0.0
8
9 5 our $VERSION = '0.01';
10
11 sub init
12 24 ▶{
Subroutine init: called CC=6 SCAR=19.1
Pod undocumented
13 24 my ($self, %params) = @_;
14
15 24 ▶ my $N = delete($params{N}) || 0;
Condition50%1/2
delete $params{'N'} || 0
l!l
240
MC/DC0%0/1
delete $params{'N'} || 0
delete $params{'N'}
Truth table50%1/2
A
A= delete $params{'N'}
Aresult
11
00
16 24 my $gm = delete($params{graph_maker});
17 24 ▶ 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 24 24
Condition33%1/3
$gm and ref $gm ne "CODE"
!ll&&!rl&&r
2400
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 24 ▶ $gm ||= sub { new Graph(@_); };
Subroutine __ANON__: called CC=1 SCAR=0.6
Condition33%1/3
$gm ||= sub { "Graph"->new(@_); }
l!l&&r!l&&!r
0240
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 24 my $g = $gm->(%params);
21 24 $g->add_path(1..$N);
22 24 ▶ $g->add_path(reverse 1..$N) unless $g->is_undirected();
Branch: 1 branch
BranchTrueFalseTotal
unless $g->is_undirected 9 15 24
23 24 return $g;
24 }
25
26 5 Graph::Maker->add_factory_type( 'linear' => __PACKAGE__ );
27
28 5 1;
29
30 __DATA__
« Maker/Cycle.pm ↑ Summary Maker/Disconnected.pm »