Maker/Grid.pm

filter: Statementstmt 100% 43 / 43 Branchbran 66.6% 4 / 6 Conditioncond 33.3% 2 / 6 MC/DCmcdc 0.0% 0 / 3 Subroutinesub 100% 10 / 10 Podpod 0.0% 0 / 1 totaltotal 85.5% 59 / 69 CC 7 SCAR 13.7
CC
7
Cov
89%
init
7.7
BEGIN
1.0
BEGIN
1.0
CRAP 3.9
« Maker/Star.pm ↑ Summary Maker/Cycle.pm »
1 package Graph::Maker::Grid;
2
3 4 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 4 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 4 ▶use Carp qw/croak/;
Subroutine BEGIN: called CC=1 SCAR=0.0
6 4 ▶use base qw/Graph::Maker/;
Subroutine BEGIN: called CC=1 SCAR=0.0
7 4 ▶use Graph;
Subroutine BEGIN: called CC=1 SCAR=0.0
8 4 ▶use Graph::Maker;
Subroutine BEGIN: called CC=1 SCAR=0.0
9 4 ▶use Graph::Maker::Utils qw/cartesian_product/;
Subroutine BEGIN: called CC=1 SCAR=0.0
10 4 ▶use Graph::Maker::Cycle;
Subroutine BEGIN: called CC=1 SCAR=0.0
11 4 ▶use Graph::Maker::Linear;
Subroutine BEGIN: called CC=1 SCAR=0.0
12
13 4 our $VERSION = '0.01';
14
15 sub init
16 13 ▶{
Subroutine init: called CC=7 SCAR=20.4
Pod undocumented
17 13 my ($self, %params) = @_;
18
19 13 my $dims = delete($params{dims});
20 13 ▶ my $per = delete($params{cyclic}) ? 'cycle' : 'linear';
Branch: 1 branch
BranchTrueFalseTotal
delete $params{'cyclic'} ? : 4 9 13
21
22 croak "dims must be an ARRAYREF specifying the dimension with positive numbers" unless defined($dims)
23 && ref($dims) eq 'ARRAY'
24 13 ▶ && 0 == grep {$_ <= 0} @$dims;
Branch: 1 branch
BranchTrueFalseTotal
unless defined $dims and ref $dims eq "ARRAY" and 0 == grep({$_ <= 0;} @$dims) 0 13 13
Condition33%2/6
defined $dims and ref $dims eq "ARRAY" and 0 == grep({$_ <= 0;} @$dims)
!ll&&!rl&&r
0013
defined $dims and ref $dims eq "ARRAY"
!ll&&!rl&&r
0013
MC/DC0%0/3
defined $dims and ref $dims eq "ARRAY" and 0 == grep({$_ <= 0;} @$dims)
defined $dims ref $dims eq "ARRAY" 0 == grep({$_ <= 0;} @$dims)
Truth table25%1/4
A and B and C
A= defined $dimsB= ref $dims eq "ARRAY"C= 0 == grep({$_ <= 0;} @$dims)
ABCresult
0XX0
10X0
1100
1111
25
26 13 my $g = new Graph::Maker($per, N => $dims->[0], %params);
27 13 ▶ return $g if @$dims == 0;
Branch: 1 branch
BranchTrueFalseTotal
if @$dims == 0 0 13 13
28
29 13 my ($gn, $go);
30
31 13 foreach my $d(@$dims[1..@$dims-1])
32 {
33 17 $gn = Graph::Maker->new($per, N => $d, %params);
34 17 $go = $g->copy();
35 17 $g = cartesian_product($gn, $go);
36 }
37
38 13 return $g;
39 }
40
41 4 Graph::Maker->add_factory_type( 'grid' => __PACKAGE__ );
42
43 4 1;
44
45 __DATA__
« Maker/Star.pm ↑ Summary Maker/Cycle.pm »