Compare/THRESHOLD_COUNT.pm untested

filter: Statementstmt 0.0% 0 / 18 Branchbran 0.0% 0 / 2 Conditioncond 0.0% 0 / 2 MC/DCmcdc n/a Subroutinesub 0.0% 0 / 6 Podpod 0.0% 0 / 3 totaltotal 0.0% 0 / 31 CC 2 SCAR 11.5
CC
2
Cov
0%
accumulate
6.0
setup
2.0
get_result
2.0
CRAP 3.1
1 package Image::Compare::THRESHOLD_COUNT;
2  
3 use warnings;
4 use strict;
5  
6 use base qw/Image::Compare::THRESHOLD/;
7  
8 sub setup {
9 my $self = shift;
10 $self->{count} = 0;
11 }
12  
13 sub accumulate {
14 my $self = shift;
15 # The superclass returns 0 if it's over the threshold and undef otherwise.
16 # Not really optimal return values, but we're kind of cheating by looking
17 # at it in this context, so hey.
18 if (defined($self->SUPER::accumulate(@_))) {
19 $self->{count}++;
20 }
21 # Always continue.
22 return undef;
23 }
24  
25 sub get_result {
26 my $self = shift;
27 return $self->{count} || 0;
28 }
29  
30 1;
31  
32 __END__