line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package VSGDR::UnitTest::TestSet::Representation::NET; |
2
|
|
|
|
|
|
|
|
3
|
1
|
|
|
1
|
|
1647
|
use 5.010; |
|
1
|
|
|
|
|
3
|
|
4
|
1
|
|
|
1
|
|
5
|
use strict; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
22
|
|
5
|
1
|
|
|
1
|
|
5
|
use warnings; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
31
|
|
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
#our \$VERSION = '1.01'; |
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
|
11
|
1
|
|
|
1
|
|
5
|
use parent qw(VSGDR::UnitTest::TestSet::Representation) ; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
5
|
|
12
|
|
|
|
|
|
|
|
13
|
1
|
|
|
1
|
|
61
|
use Carp ; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
61
|
|
14
|
|
|
|
|
|
|
|
15
|
1
|
|
|
1
|
|
5
|
use VSGDR::UnitTest::TestSet; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
31
|
|
16
|
1
|
|
|
1
|
|
584
|
use VSGDR::UnitTest::TestSet::Test; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
45
|
|
17
|
1
|
|
|
1
|
|
5
|
use VSGDR::UnitTest::TestSet::Representation; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
40
|
|
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
|
20
|
1
|
|
|
1
|
|
1002
|
use Storable qw(dclone); |
|
1
|
|
|
|
|
3431
|
|
|
1
|
|
|
|
|
69
|
|
21
|
|
|
|
|
|
|
|
22
|
1
|
|
|
1
|
|
7
|
use Data::Dumper ; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
44
|
|
23
|
1
|
|
|
1
|
|
5
|
use autodie ; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
7
|
|
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
our %Globals ; ## temp |
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
#TODO: 1. This needs abstracting away - $condition->testConditionAttributeType(${conditionAttribute}) eq 'quoted' ne 'literalcode' |
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
sub parser1 { |
32
|
0
|
|
|
0
|
0
|
|
local $_ = undef; |
33
|
0
|
0
|
|
|
|
|
my $self = shift or croak 'no self'; |
34
|
0
|
|
|
|
|
|
return $self->{PARSER1} ; |
35
|
|
|
|
|
|
|
} |
36
|
|
|
|
|
|
|
sub parser2 { |
37
|
0
|
|
|
0
|
0
|
|
local $_ = undef; |
38
|
0
|
0
|
|
|
|
|
my $self = shift or croak 'no self'; |
39
|
0
|
|
|
|
|
|
return $self->{PARSER2} ; |
40
|
|
|
|
|
|
|
} |
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
sub parse { |
44
|
0
|
|
|
0
|
0
|
|
local $_ = undef; |
45
|
0
|
0
|
|
|
|
|
my $self = shift or croak 'no self'; |
46
|
0
|
0
|
|
|
|
|
my $code = shift or croak 'no code' ; |
47
|
|
|
|
|
|
|
|
48
|
0
|
|
|
|
|
|
$code = $self->trim($code) ; |
49
|
|
|
|
|
|
|
|
50
|
0
|
|
|
|
|
|
my $res1 = $self->parser1()->start(${code}); |
51
|
0
|
0
|
|
|
|
|
croak "Failed to parse .Net representation" if ! defined $res1 ; |
52
|
0
|
|
|
|
|
|
my $globals = dclone($res1->{GLOBALS}); |
53
|
0
|
|
|
|
|
|
my $res2 = $self->parser2()->start(${code},1,$globals); |
54
|
|
|
|
|
|
|
|
55
|
0
|
|
|
|
|
|
my $res ; |
56
|
0
|
|
|
|
|
|
$res->{GLOBALS} = $res1->{GLOBALS}; |
57
|
0
|
|
|
|
|
|
$res->{ACTIONS} = $res2->{ACTIONS}; |
58
|
0
|
|
|
|
|
|
$res->{TESTACTIONS} = $res2->{TESTACTIONS}; |
59
|
0
|
|
|
|
|
|
$res->{RESOURCES} = $res2->{RESOURCES}; |
60
|
0
|
|
|
|
|
|
$res->{TESTCONDITIONS} = $res2->{TESTCONDITIONS}; |
61
|
0
|
|
|
|
|
|
$res->{TESTCONDITIONS_DETAILS} = $res2->{TESTCONDITIONS_DETAILS}; |
62
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
# my $res=$self->start(${code}); |
64
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
#warn Dumper $res1 ; |
66
|
|
|
|
|
|
|
#warn Dumper $res ; |
67
|
|
|
|
|
|
|
#exit; |
68
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
|
70
|
0
|
|
|
|
|
|
my $nameSpace = $$res{GLOBALS}{NAMESPACE} ; |
71
|
0
|
|
|
|
|
|
my $className = $$res{GLOBALS}{CLASSNAME} ; |
72
|
0
|
|
|
|
|
|
my $cleanupAction = $$res{GLOBALS}{CLEANUPACTION} ; |
73
|
0
|
|
|
|
|
|
my $initializeAction = $$res{GLOBALS}{INITIALIZEACTION} ; |
74
|
|
|
|
|
|
|
|
75
|
0
|
|
|
|
|
|
my $testSet = VSGDR::UnitTest::TestSet->new( { NAMESPACE => $nameSpace |
76
|
|
|
|
|
|
|
, CLASSNAME => $className |
77
|
|
|
|
|
|
|
} |
78
|
|
|
|
|
|
|
) ; |
79
|
0
|
|
|
|
|
|
my @tests = keys %{$$res{GLOBALS}{TESTS}} ; |
|
0
|
|
|
|
|
|
|
80
|
0
|
|
|
|
|
|
my %testActions = map { $_ => $$res{GLOBALS}{TESTS}{$_}{ACTION}} keys %{$$res{GLOBALS}{TESTS}} ; |
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
81
|
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
|
83
|
0
|
|
|
|
|
|
my %testActionLinkage = map { $_ => $$res{TESTACTIONS}{$_}} keys %{$$res{TESTACTIONS}} ; |
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
84
|
|
|
|
|
|
|
|
85
|
|
|
|
|
|
|
#warn Dumper %testActions ; |
86
|
|
|
|
|
|
|
#warn Dumper %testActionLinkage ; |
87
|
0
|
|
|
|
|
|
my %revTestActions = map { $$res{GLOBALS}{TESTS}{$_}{ACTION} => $_ } keys %{$$res{GLOBALS}{TESTS}} ; |
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
88
|
0
|
|
|
|
|
|
my %testActionsData = map { $revTestActions{$_} => $$res{ACTIONS}{$_}} values %testActions ; |
|
0
|
|
|
|
|
|
|
89
|
|
|
|
|
|
|
#warn Dumper $$res{ACTIONS} ; |
90
|
|
|
|
|
|
|
#warn Dumper %testActionsData ; |
91
|
|
|
|
|
|
|
|
92
|
0
|
|
|
|
|
|
my %conditions = () ; |
93
|
|
|
|
|
|
|
#warn Dumper $$res{RESOURCES}{CONDITIONS} ; |
94
|
0
|
0
|
|
|
|
|
%conditions = %{$$res{RESOURCES}{CONDITIONS}} if defined $$res{RESOURCES}{CONDITIONS} ; |
|
0
|
|
|
|
|
|
|
95
|
0
|
|
|
|
|
|
my %testSetActions = () ; |
96
|
0
|
|
|
|
|
|
%testSetActions = map { $_ => $$res{RESOURCES}{$_} } |
97
|
0
|
|
|
|
|
|
grep { $_ ne 'CONDITIONS'} keys %{$$res{RESOURCES}} |
|
0
|
|
|
|
|
|
|
98
|
0
|
0
|
|
|
|
|
if defined $$res{RESOURCES} ; |
99
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
|
101
|
0
|
0
|
|
|
|
|
if ( exists $testSetActions{testInitializeAction} ) { |
102
|
0
|
|
|
|
|
|
$testSet->initializeAction('testInitializeAction') ; |
103
|
|
|
|
|
|
|
} |
104
|
0
|
0
|
|
|
|
|
if ( exists $testSetActions{testCleanupAction} ) { |
105
|
0
|
|
|
|
|
|
$testSet->cleanupAction('testCleanupAction') ; |
106
|
|
|
|
|
|
|
} |
107
|
|
|
|
|
|
|
|
108
|
|
|
|
|
|
|
#warn Dumper %testSetActions; |
109
|
|
|
|
|
|
|
#warn Dumper $testSet->initializeAction() ; |
110
|
|
|
|
|
|
|
#exit; |
111
|
0
|
|
|
|
|
|
my %testSetConditions = map { $_ => $$res{RESOURCES}{CONDITIONS}{$_} } qw(testInitializeAction testCleanupAction) ; |
|
0
|
|
|
|
|
|
|
112
|
|
|
|
|
|
|
|
113
|
|
|
|
|
|
|
|
114
|
0
|
|
|
|
|
|
my %testConditions = map { $_ => $$res{RESOURCES}{CONDITIONS}{$_} } |
115
|
0
|
0
|
|
|
|
|
grep { $_ ne 'testInitializeAction'and $_ ne 'testCleanupAction'} keys %{$$res{RESOURCES}{CONDITIONS}} ; |
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
116
|
|
|
|
|
|
|
|
117
|
0
|
|
|
|
|
|
my %testConditionTypes = %{$$res{TESTCONDITIONS}} ; |
|
0
|
|
|
|
|
|
|
118
|
0
|
|
|
|
|
|
my %testConditionDetails = %{$$res{TESTCONDITIONS_DETAILS}} ; |
|
0
|
|
|
|
|
|
|
119
|
|
|
|
|
|
|
|
120
|
|
|
|
|
|
|
|
121
|
0
|
|
|
|
|
|
my @testInitObjects = () ; |
122
|
0
|
|
|
|
|
|
my @testCleanupObjects = () ; |
123
|
0
|
|
|
|
|
|
foreach my $testCondition ( @{$testSetConditions{'testInitializeAction'}} ) { |
|
0
|
|
|
|
|
|
|
124
|
0
|
|
|
|
|
|
my %testConditionConstructor = map { ( my $key = "CONDITION" . uc($_) ) ; |
125
|
0
|
|
|
|
|
|
( my $val = $testConditionDetails{$testCondition}{$_} ) =~ s/^\s*(.*?)\s*$/$1/x; |
126
|
0
|
|
|
|
|
|
$key => $val ; |
127
|
0
|
|
|
|
|
|
} keys %{$testConditionDetails{$testCondition}} ; |
|
0
|
|
|
|
|
|
|
128
|
|
|
|
|
|
|
|
129
|
0
|
|
|
|
|
|
( my $testConditionType = $testConditionTypes{$testCondition} ) =~ s{Condition$}{}x; |
130
|
0
|
|
|
|
|
|
$testConditionConstructor{TESTCONDITIONTYPE} = $testConditionType ; |
131
|
0
|
|
|
|
|
|
$testConditionConstructor{CONDITIONNAME} = $testCondition ; |
132
|
0
|
|
|
|
|
|
$testConditionConstructor{CONDITIONTESTACTIONNAME} = 'testInitializeAction' ; |
133
|
0
|
|
|
|
|
|
my $testConditionObject = VSGDR::UnitTest::TestSet::Test::TestCondition->make(\%testConditionConstructor) ; |
134
|
|
|
|
|
|
|
|
135
|
0
|
|
|
|
|
|
unshift @testInitObjects, $testConditionObject ; |
136
|
|
|
|
|
|
|
} |
137
|
0
|
|
|
|
|
|
$testSet->initializeConditions(\@testInitObjects); |
138
|
0
|
|
|
|
|
|
foreach my $testCondition ( @{$testSetConditions{'testCleanupAction'}} ) { |
|
0
|
|
|
|
|
|
|
139
|
0
|
|
|
|
|
|
my %testConditionConstructor = map { ( my $key = "CONDITION" . uc($_) ) ; |
140
|
0
|
|
|
|
|
|
( my $val = $testConditionDetails{$testCondition}{$_} ) =~ s{^\s*(.*?)\s*$}{$1}x; |
141
|
0
|
|
|
|
|
|
$key => $val ; |
142
|
0
|
|
|
|
|
|
} keys %{$testConditionDetails{$testCondition}} ; |
|
0
|
|
|
|
|
|
|
143
|
|
|
|
|
|
|
|
144
|
0
|
|
|
|
|
|
( my $testConditionType = $testConditionTypes{$testCondition} ) =~ s{Condition$}{}x; |
145
|
0
|
|
|
|
|
|
$testConditionConstructor{TESTCONDITIONTYPE} = $testConditionType ; |
146
|
0
|
|
|
|
|
|
$testConditionConstructor{CONDITIONNAME} = $testCondition ; |
147
|
0
|
|
|
|
|
|
$testConditionConstructor{CONDITIONTESTACTIONNAME} = 'testCleanupAction' ; |
148
|
0
|
|
|
|
|
|
my $testConditionObject = VSGDR::UnitTest::TestSet::Test::TestCondition->make(\%testConditionConstructor) ; |
149
|
|
|
|
|
|
|
|
150
|
0
|
|
|
|
|
|
unshift @testCleanupObjects, $testConditionObject ; |
151
|
|
|
|
|
|
|
} |
152
|
0
|
|
|
|
|
|
$testSet->cleanupConditions(\@testCleanupObjects); |
153
|
|
|
|
|
|
|
|
154
|
0
|
|
|
|
|
|
my @testObjects = () ; |
155
|
|
|
|
|
|
|
|
156
|
0
|
|
|
|
|
|
my @preTest_testConditionObjects = undef ; |
157
|
0
|
|
|
|
|
|
my @test_testConditionObjects = undef ; |
158
|
0
|
|
|
|
|
|
my @postTest_testConditionObjects = undef ; |
159
|
|
|
|
|
|
|
|
160
|
0
|
|
|
|
|
|
foreach my $test (@tests) { |
161
|
|
|
|
|
|
|
# my @testConditionObjects = () ; |
162
|
|
|
|
|
|
|
#warn Dumper $test ; |
163
|
|
|
|
|
|
|
#warn Dumper $testActions{$test} ; |
164
|
|
|
|
|
|
|
#warn Dumper $testActionsData{$test} ; |
165
|
0
|
|
|
|
|
|
@preTest_testConditionObjects = () ; |
166
|
0
|
|
|
|
|
|
@test_testConditionObjects = () ; |
167
|
0
|
|
|
|
|
|
@postTest_testConditionObjects = () ; |
168
|
|
|
|
|
|
|
|
169
|
|
|
|
|
|
|
my $testObject = VSGDR::UnitTest::TestSet::Test->new( { TESTNAME => $test |
170
|
|
|
|
|
|
|
, TESTACTIONDATANAME => $testActions{$test} |
171
|
|
|
|
|
|
|
, PRETESTACTION => $testActionsData{$test}{PretestAction} |
172
|
|
|
|
|
|
|
, TESTACTION => $testActionsData{$test}{TestAction} |
173
|
|
|
|
|
|
|
, POSTTESTACTION => $testActionsData{$test}{PosttestAction} |
174
|
0
|
|
|
|
|
|
} ) ; |
175
|
|
|
|
|
|
|
|
176
|
|
|
|
|
|
|
# foreach my $testAction ( keys %testConditions ) { |
177
|
|
|
|
|
|
|
#warn Dumper keys %testConditions ; |
178
|
|
|
|
|
|
|
# foreach my $testAction ( grep { $_ =~ m{^${test}_(?:Test|Pretest|PostTest)Action}x } keys %testConditions ) { |
179
|
0
|
|
|
|
|
|
foreach my $testAction ( grep { my $x = $_ ; |
|
0
|
|
|
|
|
|
|
180
|
0
|
|
|
|
|
|
$x =~ s{ _(?: Test|Pretest|PostTest ) Action \z}{}x ; |
181
|
0
|
|
|
|
|
|
$testActionLinkage{$x} =~ m{^${test}Data}x |
182
|
|
|
|
|
|
|
} keys %testConditions ) { |
183
|
0
|
|
|
|
|
|
foreach my $testCondition ( @{$conditions{$testAction}} ) { |
|
0
|
|
|
|
|
|
|
184
|
|
|
|
|
|
|
#warn Dumper $testCondition ; |
185
|
0
|
|
|
|
|
|
my %testConditionConstructor = map { ( my $key = "CONDITION" . uc($_) ) ; |
186
|
0
|
|
|
|
|
|
( my $val = $testConditionDetails{$testCondition}{$_} ) =~ s/^\s*(.*?)\s*$/$1/x; |
187
|
0
|
|
|
|
|
|
$key => $val ; |
188
|
0
|
|
|
|
|
|
} keys %{$testConditionDetails{$testCondition}} ; |
|
0
|
|
|
|
|
|
|
189
|
|
|
|
|
|
|
|
190
|
0
|
|
|
|
|
|
( my $testConditionType = $testConditionTypes{$testCondition} ) =~ s{Condition$}{}x; |
191
|
0
|
|
|
|
|
|
$testConditionConstructor{TESTCONDITIONTYPE} = $testConditionType ; |
192
|
0
|
|
|
|
|
|
$testConditionConstructor{CONDITIONNAME} = $testCondition ; |
193
|
0
|
|
|
|
|
|
$testConditionConstructor{CONDITIONTESTACTIONNAME} = $testAction ; |
194
|
|
|
|
|
|
|
#warn Dumper %testConditionConstructor ; |
195
|
0
|
|
|
|
|
|
my $testConditionObject = VSGDR::UnitTest::TestSet::Test::TestCondition->make(\%testConditionConstructor) ; |
196
|
|
|
|
|
|
|
|
197
|
|
|
|
|
|
|
|
198
|
|
|
|
|
|
|
#warn Dumper $testConditionObject->conditionName() ; |
199
|
|
|
|
|
|
|
#warn Dumper $testAction ; |
200
|
0
|
|
|
|
|
|
( my $testActionBase = $testAction ) =~ s{ _(?: Test|Pretest|PostTest ) Action \z}{}x ; |
201
|
|
|
|
|
|
|
|
202
|
|
|
|
|
|
|
#warn Dumper $test ; |
203
|
|
|
|
|
|
|
#warn Dumper $testActionBase ; |
204
|
|
|
|
|
|
|
#warn Dumper %testActionLinkage ; |
205
|
|
|
|
|
|
|
#warn Dumper $$res{ACTIONS}{$testActionLinkage{$testActionBase}} ; |
206
|
|
|
|
|
|
|
#warn Dumper $testActionLinkage{$testActionBase} ; |
207
|
|
|
|
|
|
|
#warn Dumper $testObject->testActionLiteral() ; |
208
|
|
|
|
|
|
|
#warn Dumper $testActionLinkage{$testActionBase} ; |
209
|
|
|
|
|
|
|
|
210
|
|
|
|
|
|
|
# this needs simlifying ! |
211
|
|
|
|
|
|
|
# if ( $test ."_". $testObject->testActionLiteral() eq $testAction ) { |
212
|
0
|
0
|
|
|
|
|
if ( $$res{ACTIONS}{ $testActionLinkage{$testActionBase} }{$testObject->testActionLiteral()} eq $testAction ) { |
213
|
0
|
|
|
|
|
|
unshift @test_testConditionObjects, $testConditionObject ; |
214
|
|
|
|
|
|
|
} |
215
|
|
|
|
|
|
|
# if ( $test ."_". $testObject->preTestActionLiteral() eq $testAction ) { |
216
|
0
|
0
|
|
|
|
|
if ( $$res{ACTIONS}{ $testActionLinkage{$testActionBase} }{$testObject->preTestActionLiteral()} eq $testAction ) { |
217
|
0
|
|
|
|
|
|
unshift @preTest_testConditionObjects, $testConditionObject ; |
218
|
|
|
|
|
|
|
} |
219
|
|
|
|
|
|
|
# if ( $test ."_". $testObject->postTestActionLiteral() eq $testAction ) { |
220
|
0
|
0
|
|
|
|
|
if ( $$res{ACTIONS}{ $testActionLinkage{$testActionBase} }{$testObject->postTestActionLiteral()} eq $testAction ) { |
221
|
0
|
|
|
|
|
|
unshift @postTest_testConditionObjects, $testConditionObject ; |
222
|
|
|
|
|
|
|
} |
223
|
|
|
|
|
|
|
|
224
|
|
|
|
|
|
|
} |
225
|
0
|
|
|
|
|
|
$testObject->preTest_conditions(\@preTest_testConditionObjects) ; |
226
|
0
|
|
|
|
|
|
$testObject->test_conditions(\@test_testConditionObjects) ; |
227
|
0
|
|
|
|
|
|
$testObject->postTest_conditions(\@postTest_testConditionObjects) ; |
228
|
|
|
|
|
|
|
|
229
|
|
|
|
|
|
|
} |
230
|
|
|
|
|
|
|
#warn Dumper $testObject ; |
231
|
0
|
|
|
|
|
|
unshift @testObjects, $testObject ; |
232
|
|
|
|
|
|
|
} |
233
|
|
|
|
|
|
|
|
234
|
0
|
|
|
|
|
|
$testSet->tests(\@testObjects) ; |
235
|
|
|
|
|
|
|
# $testSet->actions(\%testSetActions) ; |
236
|
|
|
|
|
|
|
#print Dumper $testSet ; |
237
|
0
|
|
|
|
|
|
return $testSet ; |
238
|
|
|
|
|
|
|
|
239
|
|
|
|
|
|
|
} |
240
|
|
|
|
|
|
|
|
241
|
|
|
|
|
|
|
|
242
|
|
|
|
|
|
|
|
243
|
|
|
|
|
|
|
sub deparse { |
244
|
0
|
0
|
|
0
|
0
|
|
my $self = shift or croak 'no self' ; |
245
|
0
|
0
|
|
|
|
|
my $testSet = shift or croak 'no test' ; |
246
|
0
|
|
|
|
|
|
my $ast = $testSet->AST() ; |
247
|
|
|
|
|
|
|
|
248
|
|
|
|
|
|
|
#print Dumper $ast ; |
249
|
|
|
|
|
|
|
|
250
|
|
|
|
|
|
|
#print Dumper keys %$ast; |
251
|
|
|
|
|
|
|
#print Dumper $$ast{INITIALIZECONDITIONS} ; |
252
|
|
|
|
|
|
|
#print Dumper $$ast{CLEANUPCONDITIONS} ; |
253
|
|
|
|
|
|
|
#exit ; |
254
|
|
|
|
|
|
|
|
255
|
|
|
|
|
|
|
return $self->Header($$ast{HEAD}{NAMESPACE},$$ast{HEAD}{CLASSNAME}) . |
256
|
|
|
|
|
|
|
$self->Tests($$ast{BODY}) . |
257
|
|
|
|
|
|
|
$self->icHeader() . |
258
|
|
|
|
|
|
|
$self->icResourceModel($testSet) . |
259
|
|
|
|
|
|
|
$self->icDeclareTestActions($testSet) . |
260
|
|
|
|
|
|
|
$self->icDeclareTestConditions($testSet) . |
261
|
|
|
|
|
|
|
$self->icInitialiseTestActionData($testSet) . |
262
|
|
|
|
|
|
|
$self->icInitialiseTestActions($testSet) . |
263
|
|
|
|
|
|
|
$self->icInitialiseTestConditions($testSet) . |
264
|
|
|
|
|
|
|
$self->icAssignTestActions($testSet) . |
265
|
|
|
|
|
|
|
$self->icAddTestActionConditions($testSet) . |
266
|
|
|
|
|
|
|
$self->icDefineTestConditions($testSet) . |
267
|
|
|
|
|
|
|
$self->icDefineTestInitialiseCleanupActions($testSet) . |
268
|
|
|
|
|
|
|
$self->icFooter() . |
269
|
0
|
|
|
|
|
|
$self->Footer($$ast{BODY}) ; |
270
|
|
|
|
|
|
|
|
271
|
|
|
|
|
|
|
} |
272
|
|
|
|
|
|
|
|
273
|
|
|
|
|
|
|
|
274
|
|
|
|
|
|
|
sub icDefineTestInitialiseCleanupActions { |
275
|
|
|
|
|
|
|
|
276
|
0
|
|
|
0
|
0
|
|
local $_ = undef; |
277
|
0
|
0
|
|
|
|
|
my $self = shift or croak 'no self' ; |
278
|
0
|
0
|
|
|
|
|
my $testSet = shift or croak 'no testSet' ; |
279
|
0
|
|
|
|
|
|
my $ra_tests = $testSet->tests() ; |
280
|
0
|
|
|
|
|
|
my @tests = @$ra_tests; |
281
|
|
|
|
|
|
|
|
282
|
0
|
|
|
|
|
|
my $p3 = ' '; |
283
|
0
|
|
|
|
|
|
my $res = "" ; |
284
|
|
|
|
|
|
|
|
285
|
0
|
0
|
0
|
|
|
|
if ( $testSet->initializeAction() or $testSet->cleanupAction() ) { |
286
|
0
|
|
|
|
|
|
$res .= $testSet->commentifyClassName($self->quoteChars()); |
287
|
0
|
0
|
|
|
|
|
if ( $testSet->initializeAction() ) { |
288
|
0
|
|
|
|
|
|
$res .= "${p3}" . $self->selfKeyWord() . ".TestInitializeAction = " . $testSet->initializeAction() . $self->lineTerminator() . "\n" ; |
289
|
|
|
|
|
|
|
} |
290
|
0
|
0
|
|
|
|
|
if ( $testSet->cleanupAction() ) { |
291
|
0
|
|
|
|
|
|
$res .= "${p3}" . $self->selfKeyWord() . ".TestCleanupAction = " . $testSet->cleanupAction() . $self->lineTerminator() . "\n" ; |
292
|
|
|
|
|
|
|
} |
293
|
|
|
|
|
|
|
} |
294
|
|
|
|
|
|
|
|
295
|
0
|
|
|
|
|
|
return $res; |
296
|
|
|
|
|
|
|
} |
297
|
|
|
|
|
|
|
|
298
|
|
|
|
|
|
|
|
299
|
|
|
|
|
|
|
sub icInitialiseTestActionData { |
300
|
0
|
|
|
0
|
0
|
|
local $_ = undef; |
301
|
0
|
0
|
|
|
|
|
my $self = shift or croak 'no self' ; |
302
|
0
|
0
|
|
|
|
|
my $testSet = shift or croak 'no testSet'; |
303
|
0
|
|
|
|
|
|
my $ra_tests = $testSet->tests() ; #@{$$ast{BODY}} ; |
304
|
0
|
|
|
|
|
|
my @tests = @$ra_tests; |
305
|
0
|
|
|
|
|
|
my $ra_cleanupConditions = $testSet->cleanupConditions(); |
306
|
0
|
|
|
|
|
|
my $ra_initializeConditions = $testSet->initializeConditions(); |
307
|
0
|
|
|
|
|
|
my @cleanupConditions = @{$ra_cleanupConditions} ; |
|
0
|
|
|
|
|
|
|
308
|
0
|
|
|
|
|
|
my @initializeConditions = @{$ra_initializeConditions} ; |
|
0
|
|
|
|
|
|
|
309
|
|
|
|
|
|
|
|
310
|
0
|
|
|
|
|
|
my $p3 = ' '; |
311
|
0
|
|
|
|
|
|
my $res = "" ; |
312
|
|
|
|
|
|
|
|
313
|
|
|
|
|
|
|
|
314
|
0
|
|
|
|
|
|
foreach my $test (@tests) { |
315
|
0
|
|
|
|
|
|
$res .= "${p3}" . $self->selfKeyWord() . "." . $test->testActionDataName() . " = " . $self->newKeyWord() . " Microsoft.Data.Schema.UnitTesting.DatabaseTestActions" . $self->functionDelimiters() . $self->lineTerminator() . "\n"; |
316
|
|
|
|
|
|
|
} |
317
|
|
|
|
|
|
|
|
318
|
0
|
|
|
|
|
|
return $res ; |
319
|
|
|
|
|
|
|
} |
320
|
|
|
|
|
|
|
|
321
|
|
|
|
|
|
|
|
322
|
|
|
|
|
|
|
sub icDefineTestConditions { |
323
|
|
|
|
|
|
|
|
324
|
0
|
|
|
0
|
0
|
|
local $_ = undef; |
325
|
0
|
0
|
|
|
|
|
my $self = shift or croak 'no self' ; |
326
|
0
|
0
|
|
|
|
|
my $testSet = shift or croak 'no testSet'; |
327
|
0
|
|
|
|
|
|
my $ra_tests = $testSet->tests() ; #@{$$ast{BODY}} ; |
328
|
0
|
|
|
|
|
|
my @tests = @$ra_tests; |
329
|
0
|
|
|
|
|
|
my $ra_cleanupConditions = $testSet->cleanupConditions(); |
330
|
0
|
|
|
|
|
|
my $ra_initializeConditions = $testSet->initializeConditions(); |
331
|
0
|
|
|
|
|
|
my @cleanupConditions = @{$ra_cleanupConditions} ; |
|
0
|
|
|
|
|
|
|
332
|
0
|
|
|
|
|
|
my @initializeConditions = @{$ra_initializeConditions} ; |
|
0
|
|
|
|
|
|
|
333
|
|
|
|
|
|
|
|
334
|
0
|
|
|
|
|
|
my $p3 = ' '; |
335
|
0
|
|
|
|
|
|
my $res = "" ; |
336
|
|
|
|
|
|
|
|
337
|
|
|
|
|
|
|
|
338
|
0
|
|
|
|
|
|
foreach my $condition (@initializeConditions, @cleanupConditions ) { |
339
|
|
|
|
|
|
|
|
340
|
0
|
|
|
|
|
|
$res .= $condition->commentifyName($self->quoteChars()); |
341
|
|
|
|
|
|
|
|
342
|
|
|
|
|
|
|
#warn "\n"; |
343
|
|
|
|
|
|
|
|
344
|
0
|
|
|
|
|
|
foreach my $conditionAttribute ( grep { $_ ne 'conditionTestActionName' } @{[$condition->testConditionAttributes()]} ) { |
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
345
|
0
|
|
|
|
|
|
my $conditionAttributeName = $condition->testConditionAttributeName(${conditionAttribute}); |
346
|
|
|
|
|
|
|
#warn Dumper $conditionAttributeName; |
347
|
|
|
|
|
|
|
#warn Dumper $condition->$conditionAttribute(); |
348
|
|
|
|
|
|
|
#This needs some heavy method subtyping now................. |
349
|
|
|
|
|
|
|
|
350
|
0
|
0
|
|
|
|
|
if ( $condition->testConditionAttributeType(${conditionAttribute}) ne 'literalcode' ) { |
351
|
0
|
0
|
|
|
|
|
$res .= "${p3}" . $condition->conditionName() . ".${conditionAttributeName}" . " = " |
|
|
0
|
|
|
|
|
|
352
|
|
|
|
|
|
|
. ( ( $condition->testConditionAttributeType(${conditionAttribute}) eq 'quoted' ) ? '"' : '' ) |
353
|
|
|
|
|
|
|
. $self->convertKeyWord($condition->$conditionAttribute() ) |
354
|
|
|
|
|
|
|
. ( ( $condition->testConditionAttributeType(${conditionAttribute}) eq 'quoted' ) ? '"' : '' ) |
355
|
|
|
|
|
|
|
. "" . $self->lineTerminator() . "\n" ; |
356
|
|
|
|
|
|
|
} |
357
|
|
|
|
|
|
|
else { |
358
|
0
|
|
|
|
|
|
$res .= "${p3}" . $self->convertKeyWord($condition->$conditionAttribute() ) |
359
|
|
|
|
|
|
|
. "" . $self->lineTerminator() . "\n" ; |
360
|
|
|
|
|
|
|
} |
361
|
|
|
|
|
|
|
|
362
|
|
|
|
|
|
|
} |
363
|
|
|
|
|
|
|
} |
364
|
|
|
|
|
|
|
|
365
|
|
|
|
|
|
|
|
366
|
0
|
|
|
|
|
|
foreach my $test (@tests) { |
367
|
|
|
|
|
|
|
|
368
|
|
|
|
|
|
|
#warn "\n\n"; |
369
|
0
|
|
|
|
|
|
my $ra_conditions = $test->conditions() ; |
370
|
0
|
|
|
|
|
|
foreach my $condition (@$ra_conditions) { |
371
|
|
|
|
|
|
|
|
372
|
0
|
|
|
|
|
|
$res .= $condition->commentifyName($self->quoteChars()); |
373
|
|
|
|
|
|
|
|
374
|
|
|
|
|
|
|
#warn "\n"; |
375
|
|
|
|
|
|
|
|
376
|
0
|
|
|
|
|
|
foreach my $conditionAttribute ( grep { $_ ne 'conditionTestActionName' } @{[$condition->testConditionAttributes()]} ) { |
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
377
|
0
|
|
|
|
|
|
my $conditionAttributeName = $condition->testConditionAttributeName(${conditionAttribute}); |
378
|
|
|
|
|
|
|
#warn Dumper $conditionAttributeName; |
379
|
|
|
|
|
|
|
#warn Dumper $condition->$conditionAttribute(); |
380
|
|
|
|
|
|
|
|
381
|
|
|
|
|
|
|
#This needs some heavy method subtyping now................. |
382
|
|
|
|
|
|
|
|
383
|
0
|
0
|
|
|
|
|
if ( $condition->testConditionAttributeType(${conditionAttribute}) ne 'literalcode' ) { |
384
|
0
|
0
|
|
|
|
|
$res .= "${p3}" . $condition->conditionName() . ".${conditionAttributeName}" . " = " |
|
|
0
|
|
|
|
|
|
385
|
|
|
|
|
|
|
. ( ( $condition->testConditionAttributeType(${conditionAttribute}) eq 'quoted' ) ? '"' : '' ) |
386
|
|
|
|
|
|
|
. $self->convertKeyWord($condition->$conditionAttribute() ) |
387
|
|
|
|
|
|
|
. ( ( $condition->testConditionAttributeType(${conditionAttribute}) eq 'quoted' ) ? '"' : '' ) |
388
|
|
|
|
|
|
|
. "" . $self->lineTerminator() . "\n" ; |
389
|
|
|
|
|
|
|
} |
390
|
|
|
|
|
|
|
else { |
391
|
0
|
|
|
|
|
|
$res .= "${p3}" . $self->convertKeyWord($condition->$conditionAttribute() ) |
392
|
|
|
|
|
|
|
. "" . $self->lineTerminator() . "\n" ; |
393
|
|
|
|
|
|
|
} |
394
|
|
|
|
|
|
|
|
395
|
|
|
|
|
|
|
} |
396
|
|
|
|
|
|
|
} |
397
|
|
|
|
|
|
|
} |
398
|
|
|
|
|
|
|
|
399
|
0
|
|
|
|
|
|
return $res; |
400
|
|
|
|
|
|
|
} |
401
|
|
|
|
|
|
|
|
402
|
|
|
|
|
|
|
|
403
|
|
|
|
|
|
|
sub icInitialiseTestConditions { |
404
|
|
|
|
|
|
|
|
405
|
0
|
|
|
0
|
0
|
|
local $_ = undef; |
406
|
0
|
0
|
|
|
|
|
my $self = shift or croak 'no self' ; |
407
|
0
|
0
|
|
|
|
|
my $testSet = shift or croak 'no testSet'; |
408
|
0
|
|
|
|
|
|
my $ra_tests = $testSet->tests() ; #@{$$ast{BODY}} ; |
409
|
0
|
|
|
|
|
|
my @tests = @$ra_tests; |
410
|
|
|
|
|
|
|
|
411
|
0
|
|
|
|
|
|
my $ra_cleanupConditions = $testSet->cleanupConditions(); |
412
|
0
|
|
|
|
|
|
my $ra_initializeConditions = $testSet->initializeConditions(); |
413
|
0
|
|
|
|
|
|
my @cleanupConditions = @{$ra_cleanupConditions} ; |
|
0
|
|
|
|
|
|
|
414
|
0
|
|
|
|
|
|
my @initializeConditions = @{$ra_initializeConditions} ; |
|
0
|
|
|
|
|
|
|
415
|
|
|
|
|
|
|
|
416
|
0
|
|
|
|
|
|
my $p3 = ' '; |
417
|
0
|
|
|
|
|
|
my $res = "" ; |
418
|
|
|
|
|
|
|
|
419
|
|
|
|
|
|
|
|
420
|
0
|
|
|
|
|
|
foreach my $condition (@initializeConditions, @cleanupConditions ) { |
421
|
0
|
|
|
|
|
|
$res .= "${p3}" . $condition->conditionName() . " = " . $self->newKeyWord() . " Microsoft.Data.Schema.UnitTesting.Conditions.". $condition->testConditionMSType() . $self->functionDelimiters() . $self->lineTerminator() . "\n"; |
422
|
|
|
|
|
|
|
} |
423
|
|
|
|
|
|
|
|
424
|
|
|
|
|
|
|
|
425
|
0
|
|
|
|
|
|
foreach my $test (@tests) { |
426
|
0
|
|
|
|
|
|
my $ra_conditions = $test->conditions() ; |
427
|
0
|
|
|
|
|
|
foreach my $condition (@$ra_conditions) { |
428
|
0
|
|
|
|
|
|
$res .= "${p3}" . $condition->conditionName() . " = " . $self->newKeyWord() . " Microsoft.Data.Schema.UnitTesting.Conditions.". $condition->testConditionMSType() . $self->functionDelimiters() . $self->lineTerminator() . "\n"; |
429
|
|
|
|
|
|
|
} |
430
|
|
|
|
|
|
|
|
431
|
|
|
|
|
|
|
} |
432
|
|
|
|
|
|
|
|
433
|
|
|
|
|
|
|
|
434
|
0
|
|
|
|
|
|
return $res; |
435
|
|
|
|
|
|
|
} |
436
|
|
|
|
|
|
|
|
437
|
|
|
|
|
|
|
sub icDeclareTestConditions { |
438
|
|
|
|
|
|
|
|
439
|
0
|
|
|
0
|
0
|
|
local $_ = undef; |
440
|
0
|
0
|
|
|
|
|
my $self = shift or croak 'no self' ; |
441
|
0
|
0
|
|
|
|
|
my $testSet = shift or croak 'no testSet'; |
442
|
0
|
|
|
|
|
|
my $ra_tests = $testSet->tests() ; #@{$$ast{BODY}} ; |
443
|
0
|
|
|
|
|
|
my @tests = @$ra_tests; |
444
|
0
|
|
|
|
|
|
my $ra_cleanupConditions = $testSet->cleanupConditions(); |
445
|
0
|
|
|
|
|
|
my $ra_initializeConditions = $testSet->initializeConditions(); |
446
|
|
|
|
|
|
|
#print Dumper $testSet; |
447
|
|
|
|
|
|
|
#print Dumper $ra_initializeConditions; |
448
|
|
|
|
|
|
|
#print Dumper $ra_cleanupConditions; |
449
|
0
|
|
|
|
|
|
my @cleanupConditions = @{$ra_cleanupConditions} ; |
|
0
|
|
|
|
|
|
|
450
|
0
|
|
|
|
|
|
my @initializeConditions = @{$ra_initializeConditions} ; |
|
0
|
|
|
|
|
|
|
451
|
|
|
|
|
|
|
|
452
|
0
|
|
|
|
|
|
my $p3 = ' '; |
453
|
0
|
|
|
|
|
|
my $res = "" ; |
454
|
|
|
|
|
|
|
|
455
|
|
|
|
|
|
|
|
456
|
0
|
|
|
|
|
|
foreach my $condition (@initializeConditions, @cleanupConditions ) { |
457
|
|
|
|
|
|
|
# $res .= "${p3}Microsoft.Data.Schema.UnitTesting.Conditions.". $condition->testConditionMSType() . " " . $condition->conditionName() . $self->lineTerminator() . "\n"; |
458
|
0
|
|
|
|
|
|
$res .= "${p3}" . $self->declareVariable( "Microsoft.Data.Schema.UnitTesting.Conditions.". $condition->testConditionMSType() |
459
|
|
|
|
|
|
|
, $condition->conditionName() |
460
|
|
|
|
|
|
|
) . $self->lineTerminator() . "\n"; |
461
|
|
|
|
|
|
|
} |
462
|
0
|
|
|
|
|
|
foreach my $test (@tests) { |
463
|
0
|
|
|
|
|
|
my $ra_conditions = $test->conditions() ; |
464
|
|
|
|
|
|
|
#warn Dumper $ra_conditions ; |
465
|
0
|
|
|
|
|
|
foreach my $condition (@$ra_conditions) { |
466
|
|
|
|
|
|
|
#warn Dumper $condition ; |
467
|
|
|
|
|
|
|
# $res .= "${p3}Microsoft.Data.Schema.UnitTesting.Conditions.". $condition->testConditionMSType() . " " . $condition->conditionName() . $self->lineTerminator() . "\n"; |
468
|
0
|
|
|
|
|
|
$res .= "${p3}" . $self->declareVariable( "Microsoft.Data.Schema.UnitTesting.Conditions.". $condition->testConditionMSType() |
469
|
|
|
|
|
|
|
, $condition->conditionName() |
470
|
|
|
|
|
|
|
) . $self->lineTerminator() . "\n"; |
471
|
|
|
|
|
|
|
} |
472
|
|
|
|
|
|
|
} |
473
|
|
|
|
|
|
|
|
474
|
0
|
|
|
|
|
|
return $res; |
475
|
|
|
|
|
|
|
} |
476
|
|
|
|
|
|
|
|
477
|
|
|
|
|
|
|
|
478
|
|
|
|
|
|
|
sub icDeclareTestActions { |
479
|
|
|
|
|
|
|
|
480
|
0
|
|
|
0
|
0
|
|
local $_ = undef; |
481
|
0
|
0
|
|
|
|
|
my $self = shift or croak 'no self' ; |
482
|
0
|
0
|
|
|
|
|
my $testSet = shift or croak 'no testSet'; |
483
|
0
|
|
|
|
|
|
my $ra_tests = $testSet->tests() ; #@{$$ast{BODY}} ; |
484
|
0
|
|
|
|
|
|
my @tests = @$ra_tests; |
485
|
|
|
|
|
|
|
|
486
|
0
|
|
|
|
|
|
my $p3 = ' '; |
487
|
0
|
|
|
|
|
|
my $res = "" ; |
488
|
|
|
|
|
|
|
|
489
|
|
|
|
|
|
|
|
490
|
0
|
0
|
|
|
|
|
if ( $testSet->initializeAction() ) { |
491
|
0
|
|
|
|
|
|
$res .= "${p3}" . $self->declareVariable("Microsoft.Data.Schema.UnitTesting.DatabaseTestAction", $testSet->initializeAction()) . $self->lineTerminator() . "\n" ; |
492
|
|
|
|
|
|
|
} |
493
|
0
|
0
|
|
|
|
|
if ( $testSet->cleanupAction() ) { |
494
|
0
|
|
|
|
|
|
$res .= "${p3}". $self->declareVariable("Microsoft.Data.Schema.UnitTesting.DatabaseTestAction", $testSet->cleanupAction()) . $self->lineTerminator() . "\n" ; |
495
|
|
|
|
|
|
|
} |
496
|
|
|
|
|
|
|
|
497
|
0
|
|
|
|
|
|
foreach my $test (@tests) { |
498
|
0
|
0
|
0
|
|
|
|
if ( defined $test->preTestAction() and $test->preTestAction() !~ m{^null|nothing$}ix) { |
499
|
0
|
|
|
|
|
|
$res .= "${p3}" . $self->declareVariable("Microsoft.Data.Schema.UnitTesting.DatabaseTestAction", $test->preTestAction()) . $self->lineTerminator() . "\n" ; |
500
|
|
|
|
|
|
|
} |
501
|
0
|
0
|
0
|
|
|
|
if ( defined $test->testAction() and $test->testAction() !~ m{^null|nothing$}ix) { |
502
|
0
|
|
|
|
|
|
$res .= "${p3}" . $self->declareVariable("Microsoft.Data.Schema.UnitTesting.DatabaseTestAction", $test->testAction()) . $self->lineTerminator() . "\n" ; |
503
|
|
|
|
|
|
|
} |
504
|
0
|
0
|
0
|
|
|
|
if ( defined $test->postTestAction() and $test->postTestAction() !~ m{^null|nothing$}ix) { |
505
|
0
|
|
|
|
|
|
$res .= "${p3}" . $self->declareVariable("Microsoft.Data.Schema.UnitTesting.DatabaseTestAction", $test->postTestAction()) . $self->lineTerminator() . "\n" ; |
506
|
|
|
|
|
|
|
} |
507
|
|
|
|
|
|
|
} |
508
|
|
|
|
|
|
|
|
509
|
0
|
|
|
|
|
|
return $res; |
510
|
|
|
|
|
|
|
} |
511
|
|
|
|
|
|
|
|
512
|
|
|
|
|
|
|
|
513
|
|
|
|
|
|
|
sub icInitialiseTestActions { |
514
|
|
|
|
|
|
|
|
515
|
0
|
|
|
0
|
0
|
|
local $_ = undef; |
516
|
0
|
0
|
|
|
|
|
my $self = shift or croak 'no self' ; |
517
|
0
|
0
|
|
|
|
|
my $testSet = shift or croak 'no testSet' ; |
518
|
0
|
|
|
|
|
|
my $ra_tests = $testSet->tests() ; #@{$$ast{BODY}} ; |
519
|
0
|
|
|
|
|
|
my @tests = @$ra_tests; |
520
|
|
|
|
|
|
|
|
521
|
0
|
|
|
|
|
|
my $p3 = ' '; |
522
|
0
|
|
|
|
|
|
my $res = "" ; |
523
|
|
|
|
|
|
|
|
524
|
|
|
|
|
|
|
|
525
|
0
|
0
|
|
|
|
|
if ( $testSet->initializeAction() ) { |
526
|
0
|
|
|
|
|
|
$res .= "${p3}".$testSet->initializeAction() . " = " . $self->newKeyWord() . " Microsoft.Data.Schema.UnitTesting.DatabaseTestAction" . $self->functionDelimiters() . $self->lineTerminator() . "\n" ; |
527
|
|
|
|
|
|
|
} |
528
|
0
|
0
|
|
|
|
|
if ($testSet->cleanupAction() ) { |
529
|
0
|
|
|
|
|
|
$res .= "${p3}".$testSet->cleanupAction() . " = " . $self->newKeyWord() . " Microsoft.Data.Schema.UnitTesting.DatabaseTestAction" . $self->functionDelimiters() . $self->lineTerminator() . "\n" ; |
530
|
|
|
|
|
|
|
} |
531
|
|
|
|
|
|
|
|
532
|
0
|
|
|
|
|
|
foreach my $test (@tests) { |
533
|
|
|
|
|
|
|
|
534
|
0
|
0
|
0
|
|
|
|
if ( defined $test->preTestAction() and $test->preTestAction() !~ m{^null|nothing$}ix) { |
535
|
0
|
|
|
|
|
|
$res .= "${p3}" . $test->preTestAction() . " = " . $self->newKeyWord() . " Microsoft.Data.Schema.UnitTesting.DatabaseTestAction" . $self->functionDelimiters() . $self->lineTerminator() . "\n" ; |
536
|
|
|
|
|
|
|
} |
537
|
0
|
0
|
0
|
|
|
|
if ( defined $test->testAction() and $test->testAction() !~ m{^null|nothing$}ix) { |
538
|
0
|
|
|
|
|
|
$res .= "${p3}" . $test->testAction() . " = " . $self->newKeyWord() . " Microsoft.Data.Schema.UnitTesting.DatabaseTestAction" . $self->functionDelimiters() . $self->lineTerminator() . "\n" ; |
539
|
|
|
|
|
|
|
} |
540
|
0
|
0
|
0
|
|
|
|
if ( defined $test->postTestAction() and $test->postTestAction() !~ m{^null|nothing$}ix) { |
541
|
0
|
|
|
|
|
|
$res .= "${p3}" . $test->postTestAction() . " = " . $self->newKeyWord() . " Microsoft.Data.Schema.UnitTesting.DatabaseTestAction" . $self->functionDelimiters() . $self->lineTerminator() . "\n" ; |
542
|
|
|
|
|
|
|
} |
543
|
|
|
|
|
|
|
|
544
|
|
|
|
|
|
|
} |
545
|
|
|
|
|
|
|
|
546
|
0
|
|
|
|
|
|
return $res; |
547
|
|
|
|
|
|
|
} |
548
|
|
|
|
|
|
|
|
549
|
|
|
|
|
|
|
|
550
|
|
|
|
|
|
|
sub icAssignTestActions { |
551
|
|
|
|
|
|
|
|
552
|
0
|
|
|
0
|
0
|
|
local $_ = undef; |
553
|
0
|
0
|
|
|
|
|
my $self = shift or croak 'no self' ; |
554
|
0
|
0
|
|
|
|
|
my $testSet = shift or croak 'no testSet'; |
555
|
0
|
|
|
|
|
|
my $ra_tests = $testSet->tests() ; #@{$$ast{BODY}} ; |
556
|
0
|
|
|
|
|
|
my @tests = @$ra_tests; |
557
|
|
|
|
|
|
|
|
558
|
0
|
|
|
|
|
|
my $p3 = ' '; |
559
|
0
|
|
|
|
|
|
my $res = "" ; |
560
|
|
|
|
|
|
|
|
561
|
0
|
|
|
|
|
|
foreach my $test (@tests) { |
562
|
|
|
|
|
|
|
|
563
|
0
|
|
|
|
|
|
$res .= $test->commentifyActionDataName($self->quoteChars()); |
564
|
0
|
0
|
0
|
|
|
|
if ( defined $test->preTestAction() and $test->preTestAction() !~ m{^null|nothing$}ix) { |
565
|
0
|
|
|
|
|
|
$res .= "${p3}" . $self->selfKeyWord() . "." . $test->testActionDataName() . "." . $test->preTestActionLiteral() . " = " . $test->preTestAction(). "" . $self->lineTerminator() . "\n" ; |
566
|
|
|
|
|
|
|
} |
567
|
|
|
|
|
|
|
else { |
568
|
0
|
|
|
|
|
|
$res .= "${p3}" . $self->selfKeyWord() . "." . $test->testActionDataName() . "." . $test->preTestActionLiteral() . " = " . $self->null() . "" . $self->lineTerminator() . "\n" ; |
569
|
|
|
|
|
|
|
} |
570
|
0
|
0
|
0
|
|
|
|
if ( defined $test->testAction() and $test->testAction() !~ m{^null|nothing$}ix) { |
571
|
0
|
|
|
|
|
|
$res .= "${p3}" . $self->selfKeyWord() . "." . $test->testActionDataName() . "." . $test->testActionLiteral() . " = " . $test->testAction(). "" . $self->lineTerminator() . "\n" ; |
572
|
|
|
|
|
|
|
} |
573
|
|
|
|
|
|
|
else { |
574
|
0
|
|
|
|
|
|
$res .= "${p3}" . $self->selfKeyWord() . "." . $test->testActionDataName() . "." . $test->testActionLiteral() . " = " . $self->null() . "" . $self->lineTerminator() . "\n" ; |
575
|
|
|
|
|
|
|
} |
576
|
0
|
0
|
0
|
|
|
|
if ( defined $test->postTestAction() and $test->postTestAction() !~ m{^null|nothing$}ix) { |
577
|
0
|
|
|
|
|
|
$res .= "${p3}" . $self->selfKeyWord() . "." . $test->testActionDataName() . "." . $test->postTestActionLiteral() . " = " . $test->postTestAction(). "" . $self->lineTerminator() . "\n" ; |
578
|
|
|
|
|
|
|
} |
579
|
|
|
|
|
|
|
else { |
580
|
0
|
|
|
|
|
|
$res .= "${p3}" . $self->selfKeyWord() . "." . $test->testActionDataName() . "." . $test->postTestActionLiteral() . " = " . $self->null() . "" . $self->lineTerminator() . "\n" ; |
581
|
|
|
|
|
|
|
} |
582
|
|
|
|
|
|
|
|
583
|
|
|
|
|
|
|
} |
584
|
|
|
|
|
|
|
|
585
|
0
|
|
|
|
|
|
return $res; |
586
|
|
|
|
|
|
|
} |
587
|
|
|
|
|
|
|
|
588
|
|
|
|
|
|
|
sub icAddTestActionConditions { |
589
|
|
|
|
|
|
|
|
590
|
0
|
|
|
0
|
0
|
|
local $_ = undef; |
591
|
0
|
0
|
|
|
|
|
my $self = shift or croak 'no self' ; |
592
|
0
|
0
|
|
|
|
|
my $testSet = shift or croak 'no testSet' ; |
593
|
0
|
|
|
|
|
|
my $ra_tests = $testSet->tests() ; #@{$$ast{BODY}} ; |
594
|
0
|
|
|
|
|
|
my @tests = @$ra_tests; |
595
|
0
|
|
|
|
|
|
my $ra_cleanupConditions = $testSet->cleanupConditions(); |
596
|
0
|
|
|
|
|
|
my $ra_initializeConditions = $testSet->initializeConditions(); |
597
|
0
|
|
|
|
|
|
my @cleanupConditions = @{$ra_cleanupConditions} ; |
|
0
|
|
|
|
|
|
|
598
|
0
|
|
|
|
|
|
my @initializeConditions = @{$ra_initializeConditions} ; |
|
0
|
|
|
|
|
|
|
599
|
|
|
|
|
|
|
|
600
|
0
|
|
|
|
|
|
my $p3 = ' '; |
601
|
0
|
|
|
|
|
|
my $res = "" ; |
602
|
|
|
|
|
|
|
|
603
|
|
|
|
|
|
|
|
604
|
|
|
|
|
|
|
|
605
|
0
|
|
|
|
|
|
my $rh_actions = $testSet->actions(); |
606
|
0
|
|
|
|
|
|
my %actions = %{$rh_actions} ; |
|
0
|
|
|
|
|
|
|
607
|
|
|
|
|
|
|
# my %Usedactions = (); |
608
|
|
|
|
|
|
|
|
609
|
|
|
|
|
|
|
|
610
|
0
|
0
|
|
|
|
|
if ($testSet->initializeAction() ) { |
611
|
0
|
|
|
|
|
|
$res .= $testSet->commentifyInitializeAction($self->quoteChars()) ; |
612
|
0
|
|
|
|
|
|
foreach my $condition (@initializeConditions) { |
613
|
0
|
|
|
|
|
|
$res .= "${p3}".$condition->testAction(). ".Conditions.Add(".$condition->conditionName() . ")" . $self->lineTerminator() . "\n" ; |
614
|
|
|
|
|
|
|
} |
615
|
0
|
|
|
|
|
|
$res .= "${p3}resources.ApplyResources(" . $testSet->initializeAction() . ', "'.$testSet->initializeAction() . '")' . $self->lineTerminator() ."\n"; |
616
|
|
|
|
|
|
|
# $Usedactions{$testSet->initializeAction()}{PROCESSED} = 1; |
617
|
|
|
|
|
|
|
} |
618
|
0
|
0
|
|
|
|
|
if ($testSet->cleanupAction() ) { |
619
|
0
|
|
|
|
|
|
$res .= $testSet->commentifyCleanupAction($self->quoteChars()) ; |
620
|
0
|
|
|
|
|
|
foreach my $condition (@cleanupConditions ) { |
621
|
0
|
|
|
|
|
|
$res .= "${p3}".$condition->testAction(). ".Conditions.Add(".$condition->conditionName() . ")" . $self->lineTerminator() ."\n" ; |
622
|
|
|
|
|
|
|
} |
623
|
0
|
|
|
|
|
|
$res .= "${p3}resources.ApplyResources(" . $testSet->cleanupAction() . ', "'.$testSet->cleanupAction() . '")'. $self->lineTerminator() ."\n"; |
624
|
|
|
|
|
|
|
# $Usedactions{$testSet->cleanupAction()}{PROCESSED} = 1; |
625
|
|
|
|
|
|
|
} |
626
|
|
|
|
|
|
|
|
627
|
|
|
|
|
|
|
|
628
|
0
|
|
|
|
|
|
foreach my $test (@tests) { |
629
|
|
|
|
|
|
|
|
630
|
0
|
0
|
|
|
|
|
if ( $test->preTestAction() !~ m{^null|nothing$}ix ) { |
631
|
0
|
|
|
|
|
|
$res .= $test->commentifyPreTestAction($self->quoteChars()); |
632
|
0
|
|
|
|
|
|
my $conditions = $test->preTest_conditions() ; |
633
|
0
|
|
|
|
|
|
foreach my $condition (@$conditions) { |
634
|
0
|
|
|
|
|
|
$res .= "${p3}".$condition->testAction(). ".Conditions.Add(".$condition->conditionName() . ")" . $self->lineTerminator(). "\n" ; |
635
|
|
|
|
|
|
|
} |
636
|
0
|
|
|
|
|
|
$res .= "${p3}resources.ApplyResources(" . $test->preTestAction() . ', "'.$test->preTestAction() . '")'. $self->lineTerminator() ."\n"; |
637
|
|
|
|
|
|
|
# $Usedactions{$test->preTestAction()}{PROCESSED} = 1; |
638
|
|
|
|
|
|
|
} |
639
|
|
|
|
|
|
|
|
640
|
0
|
0
|
|
|
|
|
if ( $test->testAction() !~ m{^null|nothing$}ix ) { |
641
|
0
|
|
|
|
|
|
$res .= $test->commentifyTestAction($self->quoteChars()); |
642
|
0
|
|
|
|
|
|
my $conditions = $test->test_conditions() ; |
643
|
0
|
|
|
|
|
|
foreach my $condition (@$conditions) { |
644
|
0
|
|
|
|
|
|
$res .= "${p3}".$condition->testAction(). ".Conditions.Add(".$condition->conditionName(). ")" . $self->lineTerminator(). "\n" ; |
645
|
|
|
|
|
|
|
} |
646
|
0
|
|
|
|
|
|
$res .= "${p3}resources.ApplyResources(" . $test->testAction() . ', "'.$test->testAction() . '")' . $self->lineTerminator() ."\n"; |
647
|
|
|
|
|
|
|
# $Usedactions{$test->testAction()}{PROCESSED} = 1; |
648
|
|
|
|
|
|
|
} |
649
|
0
|
0
|
|
|
|
|
if ( $test->postTestAction() !~ m{^null|nothing$}ix ) { |
650
|
0
|
|
|
|
|
|
$res .= $test->commentifyPostTestAction($self->quoteChars()); |
651
|
0
|
|
|
|
|
|
my $conditions = $test->postTest_conditions() ; |
652
|
0
|
|
|
|
|
|
foreach my $condition (@$conditions) { |
653
|
0
|
|
|
|
|
|
$res .= "${p3}".$condition->testAction(). ".Conditions.Add(".$condition->conditionName(). ")" . $self->lineTerminator() . "\n" ; |
654
|
|
|
|
|
|
|
} |
655
|
0
|
|
|
|
|
|
$res .= "${p3}resources.ApplyResources(" . $test->postTestAction() . ', "'.$test->postTestAction() . '")' . $self->lineTerminator() ."\n"; |
656
|
|
|
|
|
|
|
# $Usedactions{$test->postTestAction()}{PROCESSED} = 1; |
657
|
|
|
|
|
|
|
} |
658
|
|
|
|
|
|
|
} |
659
|
|
|
|
|
|
|
|
660
|
|
|
|
|
|
|
# foreach my $action ( keys %actions ) { |
661
|
|
|
|
|
|
|
# if ( not defined ($Usedactions{$action}{PROCESSED})) { |
662
|
|
|
|
|
|
|
# $res .= $testSet->commentifyAny($self->quoteChars(),$action); |
663
|
|
|
|
|
|
|
# $res .= "${p3}resources.ApplyResources(" . $action . ', "'.$action . '")' . $self->lineTerminator() ."\n"; |
664
|
|
|
|
|
|
|
# } |
665
|
|
|
|
|
|
|
# } |
666
|
|
|
|
|
|
|
|
667
|
0
|
|
|
|
|
|
return $res; |
668
|
|
|
|
|
|
|
} |
669
|
|
|
|
|
|
|
|
670
|
|
|
|
|
|
|
|
671
|
|
|
|
|
|
|
sub icResourceModel { |
672
|
|
|
|
|
|
|
|
673
|
0
|
|
|
0
|
0
|
|
local $_ = undef; |
674
|
0
|
0
|
|
|
|
|
my $self = shift or croak 'no self' ; |
675
|
|
|
|
|
|
|
# my $Class = shift or croak 'no class' ; |
676
|
0
|
0
|
|
|
|
|
my $testSet = shift or croak 'no test set' ; |
677
|
0
|
|
|
|
|
|
my $Class = $testSet->className(); |
678
|
|
|
|
|
|
|
|
679
|
0
|
|
|
|
|
|
my $p3 = ' '; |
680
|
0
|
|
|
|
|
|
my $res = "" ; |
681
|
|
|
|
|
|
|
|
682
|
0
|
|
|
|
|
|
my $ra_tests = $testSet->tests() ; #@{$$ast{BODY}} ; |
683
|
0
|
|
|
|
|
|
my @tests = @$ra_tests; |
684
|
|
|
|
|
|
|
|
685
|
|
|
|
|
|
|
# only output this if we have test action that needs resources creating |
686
|
|
|
|
|
|
|
# horrible code esp :- |
687
|
|
|
|
|
|
|
# $testSet->initializeAction() ne '' or $testSet->cleanupAction() ne '' |
688
|
|
|
|
|
|
|
|
689
|
0
|
|
|
|
|
|
foreach my $test (@tests) { |
690
|
0
|
0
|
0
|
|
|
|
if ( $test->testAction() !~ m{^null|nothing$}ix or $test->preTestAction() !~ m{^null|nothing$}ix or $test->postTestAction() !~ m{^null|nothing$}ix or |
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
691
|
|
|
|
|
|
|
defined $testSet->initializeAction() or defined $testSet->cleanupAction() |
692
|
|
|
|
|
|
|
) { |
693
|
0
|
|
|
|
|
|
$res = "${p3}" . $self->declareAndCreateVariable( 'System.ComponentModel.ComponentResourceManager' |
694
|
|
|
|
|
|
|
, 'resources' |
695
|
0
|
|
|
|
|
|
, "System.ComponentModel.ComponentResourceManager(@{[$self->typeExtractor()]}(${Class}))" |
696
|
|
|
|
|
|
|
) . $self->lineTerminator() . "\n"; |
697
|
|
|
|
|
|
|
} |
698
|
|
|
|
|
|
|
} |
699
|
|
|
|
|
|
|
|
700
|
0
|
|
|
|
|
|
return $res ; |
701
|
|
|
|
|
|
|
|
702
|
|
|
|
|
|
|
} |
703
|
|
|
|
|
|
|
|
704
|
|
|
|
|
|
|
|
705
|
|
|
|
|
|
|
|
706
|
|
|
|
|
|
|
1; |
707
|
|
|
|
|
|
|
|
708
|
|
|
|
|
|
|
|
709
|
|
|
|
|
|
|
########################################################### |
710
|
|
|
|
|
|
|
########################################################### |
711
|
|
|
|
|
|
|
########################################################### |
712
|
|
|
|
|
|
|
########################################################### |
713
|
|
|
|
|
|
|
########################################################### |
714
|
|
|
|
|
|
|
########################################################### |
715
|
|
|
|
|
|
|
########################################################### |
716
|
|
|
|
|
|
|
########################################################### |
717
|
|
|
|
|
|
|
########################################################### |
718
|
|
|
|
|
|
|
########################################################### |
719
|
|
|
|
|
|
|
|
720
|
|
|
|
|
|
|
__DATA__ |