Csistck/Role.pm

filter: Statementstmt 93.7% 30 / 32 Branchbran 50.0% 1 / 2 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 77.7% 7 / 9 Podpod 40.0% 2 / 5 totaltotal 83.3% 40 / 48 SCAR 11.0
CC
3
Cov
91%
new
3.0
defaults
2.0
tests
2.0
CRAP 3.0
« Csistck/Test/Script.pm ↑ Summary Csistck/Config.pm »
1 package Csistck::Role;
2  
3 17 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 17 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 17 ▶use 5.010;
Subroutine BEGIN: called CC=1 SCAR=0.0
6  
7 17 ▶use Csistck;
Subroutine BEGIN: called CC=1 SCAR=0.0
8  
9  
10 sub new {
11 1 ▶ my $class = shift;
Subroutine new: called CC=3 SCAR=11.0
Pod undocumented
12 1 my %args = @_;
13 1 my $args = \%args;
14  
15 1 my $self = {};
16 1 $self->{tests} = [];
17 1 bless($self, $class);
18  
19 # We won't add keys that overlap with required keys,
20 # drop silently for now. Set up tests after
21 1 $self->defaults();
22 1 foreach my $key (keys (%{$args})) {
23 1 ▶ $self->{$key} = $args->{$key}
Branch: 1 branch
BranchTrueFalseTotal
unless $key =~ /^tests$/ 1 0 1
24 unless ($key =~ /^tests$/);
25 }
26 1 $self->tests();
27  
28 1 return $self;
29 }
30  
31 # For overriding
32 0 ▶sub defaults { return; };
Subroutine defaults: not called CC=1 SCAR=6.9
Pod documented
33 0 ▶sub tests { return; };
Subroutine tests: not called CC=1 SCAR=6.9
Pod documented
34  
35 # Add test to object
36 sub add {
37 2 ▶ my $self = shift;
Subroutine add: called CC=1 SCAR=0.0
Pod undocumented
38 2 my @tests = @_;
39 2 push(@{$self->{tests}}, @tests);
40 }
41  
42 # Return tests
43 sub get_tests {
44 2 ▶ my $self = shift;
Subroutine get_tests: called CC=1 SCAR=0.0
Pod undocumented
45 2 return $self->{tests};
46 }
47  
48 17 1;
49 __END__
« Csistck/Test/Script.pm ↑ Summary Csistck/Config.pm »