Maker/Complete.pm

filter: Statementstmt 100% 31 / 31 Branchbran 83.3% 5 / 6 Conditioncond 37.5% 3 / 8 MC/DCmcdc 0.0% 0 / 5 Subroutinesub 100% 7 / 7 Podpod 0.0% 0 / 1 totaltotal 79.3% 46 / 58 CC 9 SCAR 18.5
CC
9
Cov
87%
init
9.9
__ANON__
1.1
BEGIN
1.0
CRAP 6.3
« Maker/Random.pm ↑ Summary Maker/CompleteBipartite.pm »
1 package Graph::Maker::Complete;
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 2 ▶{
Subroutine init: called CC=9 SCAR=22.9
Pod undocumented
13 2 my ($self, %params) = @_;
14
15 2 ▶ my $n = delete($params{N}) || 0;
Condition50%1/2
delete $params{'N'} || 0
l!l
20
MC/DC0%0/1
delete $params{'N'} || 0
delete $params{'N'}
Truth table50%1/2
A
A= delete $params{'N'}
Aresult
11
00
16 2 my $gm = delete($params{graph_maker});
17 2 ▶ 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 2 2
Condition33%1/3
$gm and ref $gm ne "CODE"
!ll&&!rl&&r
200
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 2 ▶ $gm ||= sub { new Graph(@_); };
Subroutine __ANON__: called CC=1 SCAR=0.6
Condition33%1/3
$gm ||= sub { "Graph"->new(@_); }
l!l&&r!l&&!r
020
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 2 my $g = $gm->(%params);
21
22 2 for my $u(1..$n)
23 {
24 8 ▶ my $min = $g->is_directed() ? 1 : $u+1;
Branch: 1 branch
BranchTrueFalseTotal
$g->is_directed ? : 4 4 8
25 8 for my $v($min..$n)
26 {
27 22 ▶ next if $u == $v;
Branch: 1 branch
BranchTrueFalseTotal
if $u == $v 4 18 22
28 18 $g->add_edge($u, $v);
29 }
30 }
31
32 2 return $g;
33 }
34
35 3 Graph::Maker->add_factory_type( 'complete' => __PACKAGE__ );
36
37 3 1;
38
39 __DATA__
« Maker/Random.pm ↑ Summary Maker/CompleteBipartite.pm »