File Coverage

blib/lib/App/RecordStream/Test/Aggregator/ArrayHelper.pm
Criterion Covered Total %
statement 21 21 100.0
branch 2 2 100.0
condition n/a
subroutine 6 6 100.0
pod 0 1 0.0
total 29 30 96.6


line stmt bran cond sub pod time code
1 2     2   1890 use strict;
  2         4  
  2         91  
2 2     2   11 use warnings;
  2         4  
  2         65  
3              
4             package App::RecordStream::Test::Aggregator::ArrayHelper;
5 2     2   10 use App::RecordStream::Record;
  2         4  
  2         33  
6 2     2   9 use Test::More ();
  2         4  
  2         25  
7 2     2   7 use base 'Exporter';
  2         5  
  2         343  
8              
9             our @EXPORT = qw< array_agg_ok >;
10              
11             sub array_agg_ok {
12 8     8 0 839 my ($aggr, $input, $expected, $desc) = @_;
13              
14 8 100       43 $aggr = "App::RecordStream::Aggregator::$aggr"->new("x")
15             unless ref $aggr;
16              
17 8         38 my $cookie = $aggr->initial();
18             $cookie = $aggr->combine($cookie, App::RecordStream::Record->new("x" => $_))
19 8         51 for @$input;
20              
21 8         22 local $Test::Builder::Level = $Test::Builder::Level + 1;
22              
23 8         35 Test::More::is_deeply($aggr->squish($cookie), $expected, $desc);
24             }