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   1954 use strict;
  2         4  
  2         47  
2 2     2   9 use warnings;
  2         3  
  2         61  
3              
4             package App::RecordStream::Test::Aggregator::ArrayHelper;
5 2     2   11 use App::RecordStream::Record;
  2         4  
  2         28  
6 2     2   8 use Test::More ();
  2         3  
  2         26  
7 2     2   6 use base 'Exporter';
  2         4  
  2         420  
8              
9             our @EXPORT = qw< array_agg_ok >;
10              
11             sub array_agg_ok {
12 8     8 0 942 my ($aggr, $input, $expected, $desc) = @_;
13              
14 8 100       46 $aggr = "App::RecordStream::Aggregator::$aggr"->new("x")
15             unless ref $aggr;
16              
17 8         47 my $cookie = $aggr->initial();
18             $cookie = $aggr->combine($cookie, App::RecordStream::Record->new("x" => $_))
19 8         45 for @$input;
20              
21 8         23 local $Test::Builder::Level = $Test::Builder::Level + 1;
22              
23 8         46 Test::More::is_deeply($aggr->squish($cookie), $expected, $desc);
24             }