Class/MethodInfo.pm

filter: Statementstmt 100% 30 / 30 Branchbran 100% 8 / 8 Conditioncond 100% 2 / 2 MC/DCmcdc 100% 1 / 1 Subroutinesub 100% 10 / 10 Podpod 100% 7 / 7 totaltotal 100% 58 / 58 CC 6 SCAR 7.9
CC
6
Cov
100%
new
4.0
num_tests
3.0
BEGIN
1.0
CRAP 2.2
« Class.pm ↑ Summary Class/Load.pm »
1 56 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
2 56 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
3  
4 package Test::Class::MethodInfo;
5 56 ▶use Carp;
Subroutine BEGIN: called CC=1 SCAR=0.0
6  
7 56 our $VERSION = '0.52';
8  
9 131 ▶sub new {
Subroutine new: called CC=4 SCAR=13.9
Pod documented
10 131 my ( $class, %param ) = @_;
11 my $self = bless {
12 name => $param{ name },
13 131 ▶ type => $param{ type } || 'test',
Condition100%2/2
$param{'type'} || 'test'
l!l
5180
MC/DC100%1/1
$param{'type'} || 'test'
$param{'type'}
Truth table100%2/2
A
A= $param{'type'}
Aresult
11
00
14 }, $class;
15 131 ▶ unless ( defined $param{num_tests} ) {
Branch: 1 branch
BranchTrueFalseTotal
unless (defined $param{"num_tests"}) 28 103 131
16 28 ▶ $param{ num_tests } = $self->is_type('test') ? 1 : 0;
Branch: 1 branch
BranchTrueFalseTotal
$self->is_type('test') ? : 21 7 28
17 };
18 131 $self->num_tests( $param{num_tests} );
19 131 return $self;
20 };
21  
22 807 ▶sub name { shift->{name} };
Subroutine name: called CC=1 SCAR=0.0
Pod documented
23  
24 807 ▶sub type { shift->{type} };
Subroutine type: called CC=1 SCAR=0.0
Pod documented
25  
26 457 ▶sub num_tests {
Subroutine num_tests: called CC=3 SCAR=11.0
Pod documented
27 457 my ( $self, $n ) = @_;
28 457 ▶ if ( defined $n ) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $n) 137 320 457
29 137 ▶ croak "$n not valid number of tests"
Branch: 1 branch
BranchTrueFalseTotal
unless $self->is_num_tests($n) 1 136 137
30 unless $self->is_num_tests($n);
31 136 $self->{ num_tests } = $n;
32 };
33 456 return $self->{ num_tests };
34 };
35  
36 936 ▶sub is_type {
Subroutine is_type: called CC=1 SCAR=0.0
Pod documented
37 936 my ( $self, $type ) = @_;
38 936 return $self->{ type } eq $type;
39 };
40  
41 52 ▶sub is_method_type {
Subroutine is_method_type: called CC=1 SCAR=0.0
Pod documented
42 52 my ( $self, $type ) = @_;
43 52 return $type =~ m/^(startup|setup|test|teardown|shutdown)$/s;
44 };
45  
46 292 ▶sub is_num_tests {
Subroutine is_num_tests: called CC=1 SCAR=0.0
Pod documented
47 292 my ( $self, $num_tests ) = @_;
48 292 return $num_tests =~ m/^(no_plan)|(\+?\d+)$/s;
49 };
50  
51 56 1;
52 __END__
« Class.pm ↑ Summary Class/Load.pm »