line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package VSGDR::UnitTest::TestSet::Test::TestCondition::RowCount; |
2
|
|
|
|
|
|
|
|
3
|
1
|
|
|
1
|
|
1200
|
use 5.010; |
|
1
|
|
|
|
|
3
|
|
4
|
1
|
|
|
1
|
|
4
|
use strict; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
29
|
|
5
|
1
|
|
|
1
|
|
5
|
use warnings; |
|
1
|
|
|
|
|
12
|
|
|
1
|
|
|
|
|
28
|
|
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
#our \$VERSION = '1.01'; |
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
|
11
|
1
|
|
|
1
|
|
5
|
use parent qw(VSGDR::UnitTest::TestSet::Test::TestCondition) ; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
5
|
|
12
|
|
|
|
|
|
|
BEGIN { |
13
|
1
|
|
|
1
|
|
85
|
*AUTOLOAD = \&VSGDR::UnitTest::TestSet::Test::TestCondition::AUTOLOAD ; |
14
|
|
|
|
|
|
|
} |
15
|
|
|
|
|
|
|
|
16
|
1
|
|
|
1
|
|
5
|
use Data::Dumper ; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
43
|
|
17
|
1
|
|
|
1
|
|
4
|
use Carp ; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
64
|
|
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
|
20
|
1
|
|
|
1
|
|
4
|
use vars qw($AUTOLOAD %ok_field); |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
532
|
|
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
# Authorize constructor hash fields |
24
|
|
|
|
|
|
|
my %ok_params = () ; |
25
|
|
|
|
|
|
|
for my $attr ( qw(CONDITIONTESTACTIONNAME CONDITIONNAME CONDITIONENABLED CONDITIONROWCOUNT CONDITIONRESULTSET) ) { $ok_params{$attr}++; } |
26
|
|
|
|
|
|
|
my %ok_fields = () ; |
27
|
|
|
|
|
|
|
my %ok_fields_type = () ; |
28
|
|
|
|
|
|
|
# Authorize attribute fields |
29
|
|
|
|
|
|
|
for my $attr ( qw(conditionTestActionName conditionName conditionEnabled conditionResultSet conditionRowCount) ) { $ok_fields{$attr}++; $ok_fields_type{$attr} = 'plain'; } |
30
|
|
|
|
|
|
|
$ok_fields_type{conditionName} = 'quoted'; |
31
|
|
|
|
|
|
|
$ok_fields_type{conditionEnabled} = 'bool'; |
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
sub _init { |
34
|
|
|
|
|
|
|
|
35
|
0
|
|
|
0
|
|
|
local $_ = undef ; |
36
|
|
|
|
|
|
|
|
37
|
0
|
|
|
|
|
|
my $self = shift ; |
38
|
0
|
|
0
|
|
|
|
my $class = ref($self) || $self ; |
39
|
0
|
0
|
|
|
|
|
my $ref = shift or croak "no arg"; |
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}} ; |
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
45
|
0
|
0
|
|
|
|
|
croak "bad args" |
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
|
|
|
0
|
0
|
|
return 'RowCount' ; |
67
|
|
|
|
|
|
|
} |
68
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
sub testConditionMSType { |
70
|
0
|
|
|
0
|
0
|
|
return 'RowCountCondition' ; |
71
|
|
|
|
|
|
|
} |
72
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
sub check { |
75
|
0
|
|
|
0
|
0
|
|
local $_ = undef ; |
76
|
0
|
|
|
|
|
|
my $self = shift ; |
77
|
0
|
|
|
|
|
|
my $ra_res = shift ; |
78
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
#warn Dumper $ra_res ; |
80
|
0
|
0
|
|
|
|
|
if ( $self->conditionISEnabled() ) { |
81
|
0
|
0
|
|
|
|
|
if ( scalar @{$ra_res->[$self->conditionResultSet()-1] } == $self->conditionRowCount() ) { |
|
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]}).'"' ; |
|
0
|
|
|
|
|
|
|
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 ; |
97
|
|
|
|
|
|
|
|
98
|
|
|
|
|
|
|
__DATA__ |