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