Deep/Cache.pm

filter: Statementstmt 100% 36 / 36 Branchbran 100% 6 / 6 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 9 / 9 Podpod 0.0% 0 / 6 totaltotal 89.4% 51 / 57 CC 7 SCAR 7.3
CC
7
Cov
100%
cmp
3.0
finish
3.0
local
2.0
CRAP 2.1
« Deep/All.pm ↑ Summary Deep/Any.pm »
1 41 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
2 41 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
3  
4 package Test::Deep::Cache 1.205;
5  
6 41 ▶use Test::Deep::Cache::Simple;
Subroutine BEGIN: called CC=1 SCAR=0.0
7  
8 sub new
9 454 ▶{
Subroutine new: called CC=1 SCAR=0.0
Pod undocumented
10 454 my $pkg = shift;
11  
12 454 my $self = bless {}, $pkg;
13  
14 454 $self->{expects} = [Test::Deep::Cache::Simple->new];
15 454 $self->{normal} = [Test::Deep::Cache::Simple->new];
16  
17 454 $self->local;
18  
19 454 return $self;
20 }
21  
22 sub add
23 1137 ▶{
Subroutine add: called CC=1 SCAR=0.0
Pod undocumented
24 1137 my $self = shift;
25  
26 1137 my $type = $self->type;
27  
28 1137 $self->{$type}->[-1]->add(@_);
29 }
30  
31 sub cmp
32 1176 ▶{
Subroutine cmp: called CC=3 SCAR=11.0
Pod undocumented
33 # go through all the caches to see if we know this one
34  
35 1176 my $self = shift;
36  
37 1176 my $type = $self->type;
38  
39 1176 foreach my $cache (@{$self->{$type}})
40 {
41 2506 ▶ return 1 if $cache->cmp(@_);
Branch: 1 branch
BranchTrueFalseTotal
if $cache->cmp(@_) 40 2466 2506
42 }
43  
44 1136 return 0
45 }
46  
47 sub local
48 877 ▶{
Subroutine local: called CC=2 SCAR=6.9
Pod undocumented
49 877 my $self = shift;
50  
51 877 foreach my $type (qw( expects normal ))
52 {
53 1754 push(@{$self->{$type}}, Test::Deep::Cache::Simple->new);
54 }
55 }
56  
57 sub finish
58 423 ▶{
Subroutine finish: called CC=3 SCAR=11.0
Pod undocumented
59 423 my $self = shift;
60  
61 423 my $keep = shift;
62  
63 423 foreach my $type (qw( expects normal ))
64 {
65 846 my $caches = $self->{$type};
66  
67 846 my $last = pop @$caches;
68  
69 846 ▶ $caches->[-1]->absorb($last) if $keep;
Branch: 1 branch
BranchTrueFalseTotal
if $keep 304 542 846
70 }
71 }
72  
73 sub type
74 2313 ▶{
Subroutine type: called CC=2 SCAR=6.9
Pod undocumented
75 2313 ▶ return $Test::Deep::Expects ? "expects" : "normal";
Branch: 1 branch
BranchTrueFalseTotal
$Test::Deep::Expects ? : 166 2147 2313
76 }
77  
78 41 1;
79  
80 __END__
« Deep/All.pm ↑ Summary Deep/Any.pm »