blib/lib/App/RecordStream/Test/LastHelper.pm

filter: Statementstmt 100% 30 / 30 Branchbran n/a Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 5 / 5 Podpod 0.0% 0 / 2 totaltotal 94.5% 35 / 37 CC 2 SCAR 2.9
CC
2
Cov
100%
do_test
2.0
BEGIN
1.0
BEGIN
1.0
CRAP 1.3
« blib/lib/App/RecordStream/Aggregator/First.pm ↑ Summary blib/lib/App/RecordStream/Deaggregator/Unarray.pm »
1 package App::RecordStream::Test::LastHelper;
2  
3 2 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 2 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
5  
6 2 ▶use App::RecordStream::Record;
Subroutine BEGIN: called CC=1 SCAR=0.0
7  
8 sub test_aggregator
9 {
10 3 ▶ my $aggr = shift;
Subroutine test_aggregator: called CC=1 SCAR=0.0
Pod undocumented
11 3 my $field = shift;
12  
13 3 do_test($aggr, $field, 'D', 'C', 'B', 'F', 'J', 'A', 'C', 'D', 'D');
14 3 do_test($aggr, $field, 'B', 'B', 'I', 'D', 'J', 'A', 'A', 'B');
15 3 do_test($aggr, $field, 'B', 'E', 'D', 'E', 'A', 'A', 'G', 'D', 'C', 'B');
16 3 do_test($aggr, $field, 'I', 'C', 'B', 'J', 'C', 'B', 'A', 'I');
17 3 do_test($aggr, $field, 'A', 'E', 'I', 'F', 'E', 'H', 'I', 'F', 'H', 'A');
18 3 do_test($aggr, $field, 'A', 'I', 'H', 'H', 'D', 'B', 'J', 'B', 'A', 'A');
19 3 do_test($aggr, $field, 'F', 'G', 'F', 'E', 'E', 'H', 'E', 'F');
20 3 do_test($aggr, $field, 'E', 'B', 'G', 'H', 'D', 'G', 'F', 'D', 'E');
21 3 do_test($aggr, $field, 'I', 'J', 'A', 'G', 'J', 'G', 'A', 'H', 'I');
22 }
23  
24 sub do_test
25 {
26 27 ▶ my $aggr = shift;
Subroutine do_test: called CC=2 SCAR=6.9
Pod undocumented
27 27 my $field = shift;
28 27 my $ans = shift;
29 27 my @v = @_;
30  
31 27 my $cookie = $aggr->initial();
32  
33 27 foreach my $v (@v)
34 {
35 216 $cookie = $aggr->combine($cookie, App::RecordStream::Record->new($field => $v));
36 }
37  
38 27 my $value = $aggr->squish($cookie);
39  
40 27 Test::More::is($value, $ans, "last of " . join(", ", @v));
41 }
42  
43 2 1;
« blib/lib/App/RecordStream/Aggregator/First.pm ↑ Summary blib/lib/App/RecordStream/Deaggregator/Unarray.pm »