lib/VSGDR/UnitTest/TestSet/Test/TestCondition/RowCount.pm

filter: Statementstmt 46.3% 32 / 69 Branchbran 0.0% 0 / 8 Conditioncond 0.0% 0 / 3 MC/DCmcdc 0.0% 0 / 2 Subroutinesub 66.6% 8 / 12 Podpod 0.0% 0 / 3 totaltotal 41.2% 40 / 97 SCAR 26.2
CC
6
Cov
40%
_init
20.0
check
12.0
testConditionType
2.0
CRAP 13.8
« script/genGDRTests.pl ↑ Summary lib/VSGDR/UnitTest/TestSet/Test/TestCondition/EmptyResultSet.pm »
1 package VSGDR::UnitTest::TestSet::Test::TestCondition::RowCount;
2  
3 1 ▶use 5.010;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 1 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 1 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
6  
7  
8 #our \$VERSION = '1.01';
9  
10  
11 1 ▶use parent qw(VSGDR::UnitTest::TestSet::Test::TestCondition) ;
Subroutine BEGIN: called CC=1 SCAR=0.0
12 BEGIN {
13 1 ▶*AUTOLOAD = \&VSGDR::UnitTest::TestSet::Test::TestCondition::AUTOLOAD ;
Subroutine BEGIN: called CC=1 SCAR=0.0
14 }
15  
16 1 ▶use Data::Dumper ;
Subroutine BEGIN: called CC=1 SCAR=0.0
17 1 ▶use Carp ;
Subroutine BEGIN: called CC=1 SCAR=0.0
18  
19  
20 1 ▶use vars qw($AUTOLOAD %ok_field);
Subroutine BEGIN: called CC=1 SCAR=0.0
21  
22  
23 # Authorize constructor hash fields
24 1 my %ok_params = () ;
25 1 for my $attr ( qw(CONDITIONTESTACTIONNAME CONDITIONNAME CONDITIONENABLED CONDITIONROWCOUNT CONDITIONRESULTSET) ) { $ok_params{$attr}++; }
26 1 my %ok_fields = () ;
27 1 my %ok_fields_type = () ;
28 # Authorize attribute fields
29 1 for my $attr ( qw(conditionTestActionName conditionName conditionEnabled conditionResultSet conditionRowCount) ) { $ok_fields{$attr}++; $ok_fields_type{$attr} = 'plain'; }
30 1 $ok_fields_type{conditionName} = 'quoted';
31 1 $ok_fields_type{conditionEnabled} = 'bool';
32  
33 sub _init {
34  
35 0 ▶ local $_ = undef ;
Subroutine _init: not called CC=4 SCAR=30.0
36  
37 0 my $self = shift ;
38 0 ▶ my $class = ref($self) || $self ;
Condition0%0/3
ref $self || $self
l!l&&r!l&&!r
000
MC/DC0%0/2
ref $self || $self
ref $self $self
Truth table0%0/3
A || B
A= ref $selfB= $self
ABresult
1X1
011
000
39 0 ▶ my $ref = shift or croak "no arg";
Branch: 1 branch
BranchTrueFalseTotal
my $ref = shift() or croak("no arg") 0 0 0
40  
41 0 $self->{OK_PARAMS} = \%ok_params ;
42 0 $self->{OK_FIELDS} = \%ok_fields ;
43 0 $self->{OK_FIELDS_TYPE} = \%ok_fields_type ;
44 0 my @validargs = grep { exists($$ref{$_}) } keys %{$self->{OK_PARAMS}} ;
45 0 ▶ croak "bad args"
Branch: 1 branch
BranchTrueFalseTotal
if scalar @validargs != 5 0 0 0
46 if scalar(@validargs) != 5 ;
47  
48 0 my ${Name} = $$ref{CONDITIONNAME};
49 0 my ${TestActionName} = $$ref{CONDITIONTESTACTIONNAME};
50 0 my ${Enabled} = $$ref{CONDITIONENABLED};
51 0 my ${ResultSet} = $$ref{CONDITIONRESULTSET};
52 0 my ${RowCount} = $$ref{CONDITIONROWCOUNT};
53  
54  
55 0 $self->conditionName(${Name}) ;
56 0 $self->conditionTestActionName(${TestActionName}) ;
57 0 $self->conditionEnabled(${Enabled}) ;
58 0 $self->conditionResultSet(${ResultSet}) ;
59 0 $self->conditionRowCount(${RowCount}) ;
60  
61 0 return ;
62
63 }
64  
65 sub testConditionType {
66 0 ▶ return 'RowCount' ;
Subroutine testConditionType: not called CC=1 SCAR=6.9
Pod undocumented
67 }
68  
69 sub testConditionMSType {
70 0 ▶ return 'RowCountCondition' ;
Subroutine testConditionMSType: not called CC=1 SCAR=6.9
Pod undocumented
71 }
72  
73  
74 sub check {
75 0 ▶ local $_ = undef ;
Subroutine check: not called CC=3 SCAR=24.8
Pod undocumented
76 0 my $self = shift ;
77 0 my $ra_res = shift ;
78  
79 #warn Dumper $ra_res ;
80 0 ▶ if ( $self->conditionISEnabled() ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->conditionISEnabled) { } 0 0 0
81 0 ▶ if ( scalar @{$ra_res->[$self->conditionResultSet()-1] } == $self->conditionRowCount() ) {
Branch: 1 branch
BranchTrueFalseTotal
if (scalar @{$$ra_res[$self->conditionResultSet - 1];} == $self->conditionRowCount) { } 0 0 0
82 0 return scalar 1 ;
83 }
84 else {
85 0 say 'Condition is ', $self->conditionName() ;
86 0 say 'value is ', '"'.scalar(@{$ra_res->[$self->conditionResultSet()-1]}).'"' ;
87 0 say 'expected was ', '"'.$self->conditionRowCount().'"' ;
88 0 return scalar 0 ;
89 }
90 }
91 else {
92 0 return scalar -1 ;
93 }
94 }
95  
96 1 1 ;
97  
98 __DATA__
« script/genGDRTests.pl ↑ Summary lib/VSGDR/UnitTest/TestSet/Test/TestCondition/EmptyResultSet.pm »