File Coverage

blib/lib/Image/Compare/THRESHOLD_COUNT.pm
Criterion Covered Total %
statement 17 17 100.0
branch 2 2 100.0
condition 2 2 100.0
subroutine 6 6 100.0
pod 3 3 100.0
total 30 30 100.0


line stmt bran cond sub pod time code
1             package Image::Compare::THRESHOLD_COUNT;
2              
3 8     8   27 use warnings;
  8         7  
  8         194  
4 8     8   21 use strict;
  8         10  
  8         125  
5              
6 8     8   66 use base qw/Image::Compare::THRESHOLD/;
  8         6  
  8         1098  
7              
8             sub setup {
9 3     3 1 4 my $self = shift;
10 3         5 $self->{count} = 0;
11             }
12              
13             sub accumulate {
14 11     11 1 10 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 11 100       25 if (defined($self->SUPER::accumulate(@_))) {
19 4         5 $self->{count}++;
20             }
21             # Always continue.
22 11         27 return undef;
23             }
24              
25             sub get_result {
26 3     3 1 4 my $self = shift;
27 3   100     21 return $self->{count} || 0;
28             }
29              
30             1;
31              
32             __END__