Deep/Code.pm

filter: Statementstmt 100% 28 / 28 Branchbran 100% 2 / 2 Conditioncond 50.0% 1 / 2 MC/DCmcdc 0.0% 0 / 1 Subroutinesub 100% 6 / 6 Podpod 0.0% 0 / 3 totaltotal 88.1% 37 / 42 CC 3 SCAR 4.1
CC
3
Cov
97%
init
2.0
diagnostics
2.0
BEGIN
1.0
CRAP 1.5
« Deep/Boolean.pm ↑ Summary Deep/Number.pm »
1 1 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
2 1 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
3  
4 package Test::Deep::Code 1.205;
5  
6 1 ▶use Test::Deep::Cmp;
Subroutine BEGIN: called CC=1 SCAR=0.0
7  
8 sub init
9 3 ▶{
Subroutine init: called CC=2 SCAR=7.1
Pod undocumented
10 3 my $self = shift;
11  
12 3 ▶ my $code = shift || die "No coderef supplied";
Condition50%1/2
shift() || die('No coderef supplied')
l!l
30
MC/DC0%0/1
shift() || die('No coderef supplied')
shift()
Truth table50%1/2
A
A= shift()
Aresult
11
00
13  
14 3 $self->{code} = $code;
15 }
16  
17 sub descend
18 3 ▶{
Subroutine descend: called CC=1 SCAR=0.0
Pod undocumented
19 3 my $self = shift;
20 3 my $got = shift;
21  
22 3 my ($ok, $diag) = &{$self->{code}}($got);
23  
24 3 $self->data->{diag} = $diag;
25  
26 3 return $ok;
27 }
28  
29 sub diagnostics
30 2 ▶{
Subroutine diagnostics: called CC=2 SCAR=6.9
Pod undocumented
31 2 my $self = shift;
32 2 my ($where, $last) = @_;
33  
34 2 my $error = $last->{diag};
35 2 my $data = Test::Deep::render_val($last->{got});
36 2 my $diag = <<EOM;
37 Ran coderef at $where on
38  
39 $data
40 EOM
41 2 ▶ if (defined($error))
Branch: 1 branch
BranchTrueFalseTotal
if (defined $error) { } 1 1 2
42 {
43 1 $diag .= <<EOM;
44 and it said
45 $error
46 EOM
47 }
48 else
49 {
50 1 $diag .= <<EOM;
51 it failed but it didn't say why.
52 EOM
53 }
54  
55 2 return $diag;
56 }
57  
58 1 1;
59  
60 __END__
« Deep/Boolean.pm ↑ Summary Deep/Number.pm »