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

filter: Statementstmt 50.0% 33 / 66 Branchbran 0.0% 0 / 6 Conditioncond 0.0% 0 / 3 MC/DCmcdc 0.0% 0 / 2 Subroutinesub 61.5% 8 / 13 Podpod 0.0% 0 / 4 totaltotal 43.6% 41 / 94 SCAR 22.4
CC
5
Cov
44%
_init
20.0
check
6.0
testConditionType
2.0
CRAP 9.4
« lib/VSGDR/UnitTest/TestSet/Test/TestCondition/NotEmptyResultSet.pm ↑ Summary lib/VSGDR/UnitTest/TestSet/Test/TestCondition/Checksum.pm »
1 package VSGDR::UnitTest::TestSet::Test::TestCondition::ExpectedSchema;
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 # Authorize constructor hash fields
23 1 my %ok_params = () ;
24 1 for my $attr ( qw(CONDITIONTESTACTIONNAME CONDITIONNAME CONDITIONENABLED CONDITIONVERBOSE CONDITIONAPPLYRESOURCES) ) { $ok_params{$attr}++; }
25 1 my %ok_fields = () ;
26 1 my %ok_fields_type = () ;
27 # Authorize attribute fields
28 1 for my $attr ( qw(conditionTestActionName conditionName conditionEnabled conditionVerbose conditionApplyResources) ) { $ok_fields{$attr}++; $ok_fields_type{$attr} = 'plain'; }
29 1 $ok_fields_type{conditionName} = 'quoted';
30 1 $ok_fields_type{conditionEnabled} = 'bool';
31 1 $ok_fields_type{conditionApplyResources} = 'literalcode';
32  
33  
34 sub _init {
35  
36 0 ▶ local $_ = undef ;
Subroutine _init: not called CC=4 SCAR=30.0
37  
38 0 my $self = shift ;
39 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
40 0 ▶ my $ref = shift or croak "no arg";
Branch: 1 branch
BranchTrueFalseTotal
my $ref = shift() or croak("no arg") 0 0 0
41  
42 0 $self->{OK_PARAMS} = \%ok_params ;
43 0 $self->{OK_FIELDS} = \%ok_fields ;
44 0 $self->{OK_FIELDS_TYPE} = \%ok_fields_type ;
45 0 my @validargs = grep { exists($$ref{$_}) } keys %{$self->{OK_PARAMS}} ;
46 #warn Dumper @validargs;
47 0 ▶ croak "bad args"
Branch: 1 branch
BranchTrueFalseTotal
if scalar @validargs != 4 0 0 0
48 if scalar(@validargs) != 4 ;
49 #warn Dumper @validargs;
50 0 my ${Name} = $$ref{CONDITIONNAME};
51 0 my ${TestActionName} = $$ref{CONDITIONTESTACTIONNAME};
52 0 my ${Enabled} = $$ref{CONDITIONENABLED};
53 0 my ${Verbose} = $$ref{CONDITIONVERBOSE};
54  
55 0 $self->conditionName(${Name}) ;
56 0 $self->conditionTestActionName(${TestActionName}) ;
57 0 $self->conditionEnabled(${Enabled}) ;
58 0 $self->conditionVerbose(${Verbose}) ;
59  
60
61 0 return ;
62
63 }
64  
65 sub testConditionType {
66 0 ▶ my $self = shift;
Subroutine testConditionType: not called CC=1 SCAR=6.9
Pod undocumented
67 0 return 'ExpectedSchema' ;
68 }
69  
70 sub testConditionMSType {
71 0 ▶ return 'ExpectedSchemaCondition' ;
Subroutine testConditionMSType: not called CC=1 SCAR=6.9
Pod undocumented
72 }
73  
74 sub check {
75 0 ▶ local $_ = undef ;
Subroutine check: not called CC=2 SCAR=17.9
Pod undocumented
76 0 my $self = shift ;
77 0 my $ra_res = shift ;
78  
79 #warn Dumper $ra_res ;
80  
81 0 ▶ if ( $self->conditionISEnabled() ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->conditionISEnabled) { } 0 0 0
82 #say 'Condition is ', $self->conditionName() ;
83 #say 'value is ', '"'.$ra_res->[$self->conditionResultSet()-1]->[$self->conditionRowNumber()-1]->[$self->conditionColumnNumber()-1].'"' ;
84 #say 'expected was ', $self->conditionExpectedValue() ;
85 0 return scalar 1 ;
86 }
87 else {
88 #say 'Condition ', $self->conditionName(), ' is disabled' ;
89 0 return scalar -1 ;
90 }
91 }
92  
93 ## local override for unstorable attribute - when called upon - just derive it.
94 ## luckily we can get away with this it's the same for vb and c#
95  
96 sub conditionApplyResources {
97 0 ▶ local $_ = undef ;
Subroutine conditionApplyResources: not called CC=1 SCAR=6.9
Pod undocumented
98 0 my $self = shift ;
99 0 my $ra_res = shift ;
100 0 return "resources.ApplyResources(" . $self->conditionName() . ', "' . $self->conditionName() . '")' ;
101 }
102  
103  
104  
105  
106 1 1 ;
107  
108 __DATA__
« lib/VSGDR/UnitTest/TestSet/Test/TestCondition/NotEmptyResultSet.pm ↑ Summary lib/VSGDR/UnitTest/TestSet/Test/TestCondition/Checksum.pm »