Enbld/Condition.pm

filter: Statementstmt 97.1% 34 / 35 Branchbran 81.2% 13 / 16 Conditioncond 100% 9 / 9 MC/DCmcdc 100% 5 / 5 Subroutinesub 91.6% 11 / 12 Podpod 0.0% 0 / 9 totaltotal 83.7% 72 / 86 CC 13 SCAR 13.5
CC
13
Cov
93%
is_equal_to
6.2
_is_equal
6.0
serialize
3.0
CRAP 3.8
« Enbld/Target/AttributeExtension/Command.pm ↑ Summary Enbld/Deployed.pm »
1 package Enbld::Condition;
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  
6 86 ▶sub new {
Subroutine new: called CC=1 SCAR=0.0
Pod undocumented
7 86 my $class = shift;
8  
9 86 my $self = {
10 version => 'latest',
11 make_test => undef,
12 module_file => undef,
13 arguments => undef,
14 annotation => undef,
15 @_,
16 };
17  
18 86 bless $self, $class;
19  
20 86 return $self;
21 }
22  
23 0 ▶sub name { return $_[0]->{name} }
Subroutine name: not called CC=1 SCAR=6.9
Pod undocumented
24 34 ▶sub version { return $_[0]->{version} }
Subroutine version: called CC=1 SCAR=0.0
Pod undocumented
25 39 ▶sub make_test { return $_[0]->{make_test} }
Subroutine make_test: called CC=1 SCAR=0.0
Pod undocumented
26 34 ▶sub module_file { return $_[0]->{module_file} }
Subroutine module_file: called CC=1 SCAR=0.0
Pod undocumented
27 35 ▶sub arguments { return $_[0]->{arguments} }
Subroutine arguments: called CC=1 SCAR=0.0
Pod undocumented
28 6 ▶sub annotation { return $_[0]->{annotation} }
Subroutine annotation: called CC=1 SCAR=0.0
Pod undocumented
29  
30 50 ▶sub serialize {
Subroutine serialize: called CC=3 SCAR=11.0
Pod undocumented
31 50 my $self = shift;
32  
33 50 my %serialized;
34 50 foreach my $key ( sort keys %{ $self } ) {
35 254 ▶ next if ( ! $self->{$key} );
Branch: 1 branch
BranchTrueFalseTotal
unless $self->{$key} 198 56 254
36  
37 56 $serialized{$key} = $self->{$key};
38 }
39  
40 50 return \%serialized;
41 }
42  
43 8 ▶sub is_equal_to {
Subroutine is_equal_to: called CC=6 SCAR=18.2
Pod undocumented
44 8 my ( $self, $condition ) = @_;
45  
46 8 ▶ return unless _is_equal( $self->{version}, $condition->version );
Branch: 1 branch
BranchTrueFalseTotal
unless _is_equal($self->{"version"}, $condition->version) 3 5 8
47 5 ▶ return unless _is_equal( $self->{make_test}, $condition->make_test );
Branch: 1 branch
BranchTrueFalseTotal
unless _is_equal($self->{"make_test"}, $condition->make_test) 2 3 5
48 3 ▶ return unless _is_equal( $self->{arguments}, $condition->arguments );
Branch: 1 branch
BranchTrueFalseTotal
unless _is_equal($self->{"arguments"}, $condition->arguments) 0 3 3
49 3 ▶ return unless _is_equal( $self->{annotation}, $condition->annotation );
Branch: 1 branch
BranchTrueFalseTotal
unless _is_equal($self->{"annotation"}, $condition->annotation) 0 3 3
50 3 ▶ return unless _is_equal( $self->{module_file}, $condition->module_file );
Branch: 1 branch
BranchTrueFalseTotal
unless _is_equal($self->{"module_file"}, $condition->module_file) 0 3 3
51  
52 3 return $self;
53 }
54  
55 22 ▶sub _is_equal {
Subroutine _is_equal: called CC=6 SCAR=17.9
56 22 my ( $val1, $val2 ) = @_;
57  
58 22 ▶ return 1 if ( ( ! defined $val1 ) && ( ! defined $val2 ) );
Branch: 1 branch
BranchTrueFalseTotal
unless defined $val1 or defined $val2 11 11 22
Condition100%3/3
defined $val1 or defined $val2
l!l&&r!l&&!r
10111
MC/DC100%2/2
defined $val1 or defined $val2
defined $val1 defined $val2
Truth table100%3/3
A or B
A= defined $val1B= defined $val2
ABresult
1X1
011
000
59 11 ▶ return 1 if ( ( defined $val1 && defined $val2 ) && ( $val1 eq $val2 ));
Branch: 1 branch
BranchTrueFalseTotal
if defined $val1 and defined $val2 and $val1 eq $val2 6 5 11
Condition100%6/6
defined $val1 and defined $val2 and $val1 eq $val2
!ll&&!rl&&r
236
defined $val1 and defined $val2
!ll&&!rl&&r
119
MC/DC100%3/3
defined $val1 and defined $val2 and $val1 eq $val2
defined $val1 defined $val2 $val1 eq $val2
Truth table100%4/4
A and B and C
A= defined $val1B= defined $val2C= $val1 eq $val2
ABCresult
0XX0
10X0
1100
1111
60  
61 5 return;
62 }
63  
64 5 1;
« Enbld/Target/AttributeExtension/Command.pm ↑ Summary Enbld/Deployed.pm »