line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package VSGDR::UnitTest::TestSet::Test::TestCondition::Checksum; |
2
|
|
|
|
|
|
|
|
3
|
1
|
|
|
1
|
|
1090
|
use 5.010; |
|
1
|
|
|
|
|
3
|
|
4
|
1
|
|
|
1
|
|
5
|
use strict; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
20
|
|
5
|
1
|
|
|
1
|
|
5
|
use warnings; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
38
|
|
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
#our \$VERSION = '1.01'; |
9
|
|
|
|
|
|
|
|
10
|
1
|
|
|
1
|
|
6
|
use parent qw(VSGDR::UnitTest::TestSet::Test::TestCondition) ; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
6
|
|
11
|
|
|
|
|
|
|
BEGIN { |
12
|
1
|
|
|
1
|
|
87
|
*AUTOLOAD = \&VSGDR::UnitTest::TestSet::Test::TestCondition::AUTOLOAD ; |
13
|
|
|
|
|
|
|
} |
14
|
|
|
|
|
|
|
|
15
|
1
|
|
|
1
|
|
5
|
use Data::Dumper ; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
43
|
|
16
|
1
|
|
|
1
|
|
5
|
use Carp ; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
59
|
|
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
|
19
|
1
|
|
|
1
|
|
5
|
use vars qw($AUTOLOAD %ok_field); |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
446
|
|
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
# Authorize constructor hash fields |
22
|
|
|
|
|
|
|
my %ok_params = () ; |
23
|
|
|
|
|
|
|
for my $attr ( qw(CONDITIONTESTACTIONNAME CONDITIONNAME CONDITIONENABLED CONDITIONCHECKSUM) ) { $ok_params{$attr}++; } |
24
|
|
|
|
|
|
|
my %ok_fields = () ; |
25
|
|
|
|
|
|
|
my %ok_fields_type = () ; |
26
|
|
|
|
|
|
|
# Authorize attribute fields |
27
|
|
|
|
|
|
|
for my $attr ( qw(conditionTestActionName conditionName conditionEnabled conditionChecksum) ) { $ok_fields{$attr}++; $ok_fields_type{$attr} = 'plain'; } |
28
|
|
|
|
|
|
|
$ok_fields_type{conditionName} = 'quoted'; |
29
|
|
|
|
|
|
|
$ok_fields_type{conditionEnabled} = 'bool'; |
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
sub _init { |
33
|
|
|
|
|
|
|
|
34
|
0
|
|
|
0
|
|
|
local $_ = undef ; |
35
|
|
|
|
|
|
|
|
36
|
0
|
|
|
|
|
|
my $self = shift ; |
37
|
0
|
|
0
|
|
|
|
my $class = ref($self) || $self ; |
38
|
0
|
0
|
|
|
|
|
my $ref = shift or croak "no arg"; |
39
|
|
|
|
|
|
|
|
40
|
0
|
|
|
|
|
|
$self->{OK_PARAMS} = \%ok_params ; |
41
|
0
|
|
|
|
|
|
$self->{OK_FIELDS} = \%ok_fields ; |
42
|
0
|
|
|
|
|
|
$self->{OK_FIELDS_TYPE} = \%ok_fields_type ; |
43
|
0
|
|
|
|
|
|
my @validargs = grep { exists($$ref{$_}) } keys %{$self->{OK_PARAMS}} ; |
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
44
|
0
|
0
|
|
|
|
|
croak "bad args" |
45
|
|
|
|
|
|
|
if scalar(@validargs) != 4 ; |
46
|
|
|
|
|
|
|
|
47
|
0
|
|
|
|
|
|
my ${Name} = $$ref{CONDITIONNAME}; |
48
|
0
|
|
|
|
|
|
my ${TestActionName} = $$ref{CONDITIONTESTACTIONNAME}; |
49
|
0
|
|
|
|
|
|
my ${Enabled} = $$ref{CONDITIONENABLED}; |
50
|
0
|
|
|
|
|
|
my ${Checksum} = $$ref{CONDITIONCHECKSUM}; |
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
|
53
|
0
|
|
|
|
|
|
$self->conditionName(${Name}) ; |
54
|
0
|
|
|
|
|
|
$self->conditionTestActionName(${TestActionName}) ; |
55
|
0
|
|
|
|
|
|
$self->conditionEnabled(${Enabled}) ; |
56
|
0
|
|
|
|
|
|
$self->conditionChecksum(${Checksum}) ; |
57
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
|
59
|
0
|
|
|
|
|
|
return ; |
60
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
} |
62
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
sub testConditionType { |
64
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
65
|
0
|
|
|
|
|
|
return 'Checksum' ; |
66
|
|
|
|
|
|
|
} |
67
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
sub testConditionMSType { |
69
|
0
|
|
|
0
|
0
|
|
return 'ChecksumCondition' ; |
70
|
|
|
|
|
|
|
} |
71
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
sub check { |
73
|
0
|
|
|
0
|
0
|
|
local $_ = undef ; |
74
|
0
|
|
|
|
|
|
my $self = shift ; |
75
|
0
|
|
|
|
|
|
my $ra_res = shift ; |
76
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
#warn Dumper $ra_res ; |
78
|
|
|
|
|
|
|
|
79
|
0
|
0
|
|
|
|
|
if ( $self->conditionISEnabled() ) { |
80
|
0
|
|
|
|
|
|
return scalar 1 ; |
81
|
|
|
|
|
|
|
} |
82
|
|
|
|
|
|
|
else { |
83
|
0
|
|
|
|
|
|
return scalar -1 ; |
84
|
|
|
|
|
|
|
} |
85
|
|
|
|
|
|
|
} |
86
|
|
|
|
|
|
|
|
87
|
|
|
|
|
|
|
1 ; |
88
|
|
|
|
|
|
|
|
89
|
|
|
|
|
|
|
__DATA__ |