line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
#!/usr/bin/perl -w |
2
|
1
|
|
|
1
|
|
177459
|
use strict; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
122
|
|
3
|
|
|
|
|
|
|
|
4
|
1
|
|
|
1
|
|
508
|
use Test::More tests => 19; |
|
1
|
|
|
|
|
16526
|
|
|
1
|
|
|
|
|
8
|
|
5
|
1
|
|
|
1
|
|
1191
|
use Test::Exception; |
|
1
|
|
|
|
|
2545
|
|
|
1
|
|
|
|
|
3
|
|
6
|
1
|
|
|
1
|
|
585
|
use Test::Differences; |
|
1
|
|
|
|
|
92909
|
|
|
1
|
|
|
|
|
138
|
|
7
|
|
|
|
|
|
|
|
8
|
1
|
|
|
1
|
|
598
|
use Data::Dumper; |
|
1
|
|
|
|
|
5513
|
|
|
1
|
|
|
|
|
54
|
|
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
|
11
|
1
|
|
|
1
|
|
327
|
use lib "lib"; |
|
1
|
|
|
|
|
568
|
|
|
1
|
|
|
|
|
4
|
|
12
|
|
|
|
|
|
|
|
13
|
1
|
|
|
1
|
|
89034
|
use_ok("Devel::PerlySense"); |
|
1
|
|
|
|
|
1454
|
|
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
8
|
|
14
|
1
|
|
|
1
|
|
290
|
use_ok("Devel::PerlySense::Class"); |
|
1
|
|
|
|
|
81
|
|
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
8
|
|
15
|
1
|
|
|
1
|
|
494
|
use_ok("Devel::PerlySense::Editor::Emacs"); |
|
1
|
|
|
|
|
50577
|
|
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
12
|
|
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
throws_ok( |
20
|
1
|
|
|
1
|
|
44
|
sub { Devel::PerlySense::Editor::Emacs->new( |
21
|
|
|
|
|
|
|
) }, |
22
|
1
|
|
|
|
|
334
|
qr/oPerlySense/, |
23
|
|
|
|
|
|
|
"new fails ok with missing name", |
24
|
|
|
|
|
|
|
); |
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
lives_ok( |
27
|
1
|
|
|
1
|
|
20
|
sub { Devel::PerlySense::Editor::Emacs->new( |
28
|
|
|
|
|
|
|
oPerlySense => Devel::PerlySense->new(), |
29
|
|
|
|
|
|
|
widthDisplay => undef, |
30
|
|
|
|
|
|
|
) }, |
31
|
1
|
|
|
|
|
786
|
"new ok with name", |
32
|
|
|
|
|
|
|
); |
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
|
37
|
1
|
|
|
|
|
195
|
ok(my $oPerlySense = Devel::PerlySense->new(), "Created PerlySense object ok"); |
38
|
1
|
|
|
|
|
199
|
ok( |
39
|
|
|
|
|
|
|
my $oEditor = Devel::PerlySense::Editor::Emacs->new( |
40
|
|
|
|
|
|
|
oPerlySense => $oPerlySense, |
41
|
|
|
|
|
|
|
widthDisplay => 59, |
42
|
|
|
|
|
|
|
), |
43
|
|
|
|
|
|
|
"Created Editor ok", |
44
|
|
|
|
|
|
|
); |
45
|
1
|
|
|
|
|
209
|
$oEditor->widthDisplay(70); |
46
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
|
48
|
1
|
|
|
|
|
4
|
my $s = " "; |
49
|
1
|
|
|
|
|
2
|
my $sNone = " "; |
50
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
{ |
53
|
1
|
|
|
|
|
1
|
my $dirData = "t/data/project-lib"; |
|
1
|
|
|
|
|
1
|
|
54
|
1
|
|
|
|
|
3
|
my $fileOrigin = "$dirData/Game/Object/Worm/ShaiHulud.pm"; |
55
|
|
|
|
|
|
|
|
56
|
1
|
|
|
|
|
5
|
ok( |
57
|
|
|
|
|
|
|
my $oClassOjectWormShai = Devel::PerlySense::Class->newFromFileAt( |
58
|
|
|
|
|
|
|
oPerlySense => $oPerlySense, |
59
|
|
|
|
|
|
|
file => $fileOrigin, |
60
|
|
|
|
|
|
|
row => 20, |
61
|
|
|
|
|
|
|
col => 1, |
62
|
|
|
|
|
|
|
), |
63
|
|
|
|
|
|
|
"newFromFileAt at proper package location ok", |
64
|
|
|
|
|
|
|
); |
65
|
|
|
|
|
|
|
|
66
|
1
|
|
|
|
|
298
|
$oPerlySense->setFindProject(file => $fileOrigin); |
67
|
1
|
|
|
|
|
9
|
local $oPerlySense->rhConfig->{bookmark} = [ |
68
|
|
|
|
|
|
|
{ |
69
|
|
|
|
|
|
|
moniker => "Todo", |
70
|
|
|
|
|
|
|
rex => 'qr/\# \s* TODO: \s* ( .+ )/x', |
71
|
|
|
|
|
|
|
}, |
72
|
|
|
|
|
|
|
{ |
73
|
|
|
|
|
|
|
moniker => "Note", |
74
|
|
|
|
|
|
|
rex => 'qr/\# \s* XXX \s* .+/x', |
75
|
|
|
|
|
|
|
}, |
76
|
|
|
|
|
|
|
]; |
77
|
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
|
79
|
1
|
|
|
|
|
37
|
ok( |
80
|
|
|
|
|
|
|
my $textShai = $oEditor->classOverview( |
81
|
|
|
|
|
|
|
oClass => $oClassOjectWormShai, |
82
|
1
|
|
|
|
|
44
|
raShow => [ @{$oEditor->raClassOverviewShowDefault}, "neighbourhood" ], |
83
|
|
|
|
|
|
|
), |
84
|
|
|
|
|
|
|
" render classOverview ok", |
85
|
|
|
|
|
|
|
); |
86
|
|
|
|
|
|
|
#warn("-----\n$textShai\n-----\n"); |
87
|
1
|
|
|
|
|
295
|
my $textExpected = q/* Inheritance * |
88
|
|
|
|
|
|
|
[ Game::Object ] <-----+ |
89
|
|
|
|
|
|
|
[ Game::Object::Worm ] | |
90
|
|
|
|
|
|
|
[<Game::Object::Worm::ShaiHulud>] --> [ Game::Lawn ] |
91
|
|
|
|
|
|
|
|
92
|
|
|
|
|
|
|
* API * |
93
|
|
|
|
|
|
|
\>color |
94
|
|
|
|
|
|
|
\>height |
95
|
|
|
|
|
|
|
\>isBlocking |
96
|
|
|
|
|
|
|
\>isRealPlayer |
97
|
|
|
|
|
|
|
\>lengthIdeal |
98
|
|
|
|
|
|
|
\>oController |
99
|
|
|
|
|
|
|
\>oDirection |
100
|
|
|
|
|
|
|
\>oEventMove |
101
|
|
|
|
|
|
|
\>oLawn |
102
|
|
|
|
|
|
|
\>oLocation, $value) |
103
|
|
|
|
|
|
|
->oppositeDirection |
104
|
|
|
|
|
|
|
\>oUI |
105
|
|
|
|
|
|
|
->probabilityTurnRandomly |
106
|
|
|
|
|
|
|
->probabilityTurnTowardsPrize |
107
|
|
|
|
|
|
|
\>raBodyChar |
108
|
|
|
|
|
|
|
\>raBodyLocation |
109
|
|
|
|
|
|
|
->randomDirection |
110
|
|
|
|
|
|
|
\>rhGrid |
111
|
|
|
|
|
|
|
\>rhPrize |
112
|
|
|
|
|
|
|
\>score |
113
|
|
|
|
|
|
|
\>width |
114
|
|
|
|
|
|
|
\>awardScorePoints($points) |
115
|
|
|
|
|
|
|
\>buildBodyRight($length, $oLocation, $rcChar) |
116
|
|
|
|
|
|
|
\>checkTick($timeWorld) |
117
|
|
|
|
|
|
|
\>crash() |
118
|
|
|
|
|
|
|
\>END |
119
|
|
|
|
|
|
|
\>grow([$sizeIncrease = 1]) |
120
|
|
|
|
|
|
|
\>isAnythingAt($oLocation) |
121
|
|
|
|
|
|
|
\>isAnythingBlockingAt($oLocation) |
122
|
|
|
|
|
|
|
\>isLocationOnLawn($oLocation) |
123
|
|
|
|
|
|
|
\>isLocationValidForMove($oObject, $oLocation) |
124
|
|
|
|
|
|
|
\>isLocationValidForPlacement($oLocation) |
125
|
|
|
|
|
|
|
\>isObjectAt($oObject, $left, $top) |
126
|
|
|
|
|
|
|
\>isObjectLocationValidForPlacement($oObject) |
127
|
|
|
|
|
|
|
\>lengthActual |
128
|
|
|
|
|
|
|
\>loadFile($file) |
129
|
|
|
|
|
|
|
\>moveForward() |
130
|
|
|
|
|
|
|
->new([$left = 11], [$top = 12], [$direction = "left"], [$length = 3) |
131
|
|
|
|
|
|
|
\>objectHasMoved($oObject) |
132
|
|
|
|
|
|
|
\>oDirectionToPrize($oLocation) |
133
|
|
|
|
|
|
|
\>oLocationRandom() |
134
|
|
|
|
|
|
|
\>oPlacePrize($oLocation, $value) |
135
|
|
|
|
|
|
|
\>oPlaceWorm($left, $top) |
136
|
|
|
|
|
|
|
\>oValidLocationAfterMove() |
137
|
|
|
|
|
|
|
\>placeObjectAt($oObject) |
138
|
|
|
|
|
|
|
\>placeObjectBodyPartAt($oObject, $oLocation, $char) |
139
|
|
|
|
|
|
|
->possiblyTurnRandomly() |
140
|
|
|
|
|
|
|
->possiblyTurnTowardsPrize() |
141
|
|
|
|
|
|
|
\>prizeWasClaimedBy($oPrize, $oObject) |
142
|
|
|
|
|
|
|
\>removeObject($oObject) |
143
|
|
|
|
|
|
|
\>removeObjectBodyPartAt($oObject, $oLocation) |
144
|
|
|
|
|
|
|
\>turn($direction) |
145
|
|
|
|
|
|
|
\>wormHasCrashed($oObject) |
146
|
|
|
|
|
|
|
|
147
|
|
|
|
|
|
|
* Bookmarks * |
148
|
|
|
|
|
|
|
- Todo |
149
|
|
|
|
|
|
|
ShaiHulud.pm:76: Fix something here |
150
|
|
|
|
|
|
|
ShaiHulud.pm:127: Find a Prize |
151
|
|
|
|
|
|
|
ShaiHulud.pm:134: Turn |
152
|
|
|
|
|
|
|
- Note |
153
|
|
|
|
|
|
|
ShaiHulud.pm:96: #XXX fix before checkin |
154
|
|
|
|
|
|
|
|
155
|
|
|
|
|
|
|
* Uses * |
156
|
|
|
|
|
|
|
[ Carp ] [ Class::MethodMaker ] [ Data::Dumper ] |
157
|
|
|
|
|
|
|
|
158
|
|
|
|
|
|
|
* NeighbourHood * |
159
|
|
|
|
|
|
|
[ Game::Object::Prize ] [ Game::Object::Worm::Bot ] -none- |
160
|
|
|
|
|
|
|
[ Game::Object::Wall ] [<Game::Object::Worm::ShaiHulud>] |
161
|
|
|
|
|
|
|
[ Game::Object::Worm ] [ Game::Object::Worm::Shaitan ] |
162
|
|
|
|
|
|
|
[ Game::Object::WormVisible ]/; |
163
|
|
|
|
|
|
|
|
164
|
|
|
|
|
|
|
# The inheritance diagram is a bit flaky, test it separetly from |
165
|
|
|
|
|
|
|
# the rest of the output |
166
|
1
|
|
|
|
|
6
|
my ($expectedInheritance, $expectedRest) = split(/\Q* API */, $textExpected); |
167
|
1
|
|
|
|
|
5
|
my ($shaiInheritance, $shaiRest) = split(/\Q* API */, $textShai); |
168
|
1
|
|
|
|
|
6
|
eq_or_diff( |
169
|
|
|
|
|
|
|
$shaiRest, |
170
|
|
|
|
|
|
|
$expectedRest, |
171
|
|
|
|
|
|
|
" And got correct overview output", |
172
|
|
|
|
|
|
|
); |
173
|
|
|
|
|
|
|
|
174
|
1
|
|
|
|
|
1009
|
note "Don't compare the exact diagram, it's not deterministic."; |
175
|
1
|
|
|
|
|
48
|
note "Just make sure all the classes are on there"; |
176
|
|
|
|
|
|
|
sub get_classes { |
177
|
2
|
|
|
2
|
|
3
|
my ($text) = @_; |
178
|
2
|
|
|
|
|
22
|
return sort ( $text =~ / \[ \s+ ([\w:]+) /xgsm ); |
179
|
|
|
|
|
|
|
} |
180
|
1
|
|
|
|
|
37
|
eq_or_diff( |
181
|
|
|
|
|
|
|
[ get_classes($shaiInheritance) ], |
182
|
|
|
|
|
|
|
[ get_classes($expectedInheritance) ], |
183
|
|
|
|
|
|
|
" And got correct inheritance output", |
184
|
|
|
|
|
|
|
); |
185
|
|
|
|
|
|
|
|
186
|
|
|
|
|
|
|
|
187
|
|
|
|
|
|
|
# * Structure * |
188
|
|
|
|
|
|
|
# ==;"";;;;===;==S{;;;;";;;;}=S{;;{;'{;;";};}";}=S{;{";";";;' |
189
|
|
|
|
|
|
|
# {;;";};}";}; |
190
|
|
|
|
|
|
|
|
191
|
|
|
|
|
|
|
|
192
|
|
|
|
|
|
|
} |
193
|
|
|
|
|
|
|
|
194
|
|
|
|
|
|
|
|
195
|
|
|
|
|
|
|
|
196
|
|
|
|
|
|
|
{ |
197
|
1
|
|
|
|
|
27355
|
my $dirData = "t/data/project-lib"; |
|
1
|
|
|
|
|
4
|
|
198
|
1
|
|
|
|
|
4
|
my $fileOrigin = "$dirData/Game/Object.pm"; |
199
|
|
|
|
|
|
|
|
200
|
1
|
|
|
|
|
13
|
ok( |
201
|
|
|
|
|
|
|
my $oClassOject = Devel::PerlySense::Class->newFromFileAt( |
202
|
|
|
|
|
|
|
oPerlySense => $oPerlySense, |
203
|
|
|
|
|
|
|
file => $fileOrigin, |
204
|
|
|
|
|
|
|
row => 1, |
205
|
|
|
|
|
|
|
col => 1, |
206
|
|
|
|
|
|
|
), |
207
|
|
|
|
|
|
|
"newFromFileAt at proper package location ok", |
208
|
|
|
|
|
|
|
); |
209
|
|
|
|
|
|
|
|
210
|
|
|
|
|
|
|
|
211
|
1
|
|
|
|
|
29
|
ok( |
212
|
|
|
|
|
|
|
my $textShai = $oEditor->classOverview( |
213
|
|
|
|
|
|
|
oClass => $oClassOject, |
214
|
1
|
|
|
|
|
290
|
raShow => [ @{$oEditor->raClassOverviewShowDefault}, "neighbourhood" ], |
215
|
|
|
|
|
|
|
), |
216
|
|
|
|
|
|
|
" render classOverview ok", |
217
|
|
|
|
|
|
|
); |
218
|
|
|
|
|
|
|
#warn("-----\n$textShai\n-----\n"); |
219
|
|
|
|
|
|
|
|
220
|
1
|
|
|
|
|
888
|
my $textInheritance = q/* Inheritance * |
221
|
|
|
|
|
|
|
[<Game::Object>]/; |
222
|
1
|
|
|
|
|
3
|
my $textApi = q/* API * |
223
|
|
|
|
|
|
|
->color ->raBodyChar |
224
|
|
|
|
|
|
|
->isBlocking ->raBodyLocation |
225
|
|
|
|
|
|
|
->oLawn ->buildBodyRight($length, $oLocation, $rcChar) |
226
|
|
|
|
|
|
|
->oLocation ->new($oLocation)/; |
227
|
1
|
|
|
|
|
2
|
my $textBookmarks = q/* Bookmarks */; |
228
|
1
|
|
|
|
|
2
|
my $textUses = q/* Uses * |
229
|
|
|
|
|
|
|
[ Class::MethodMaker ] [ Game::Event::Timed ] |
230
|
|
|
|
|
|
|
[ Data::Dumper ] [ Game::Location ]/; |
231
|
1
|
|
|
|
|
3
|
my $textNeighbourHood = q/* NeighbourHood * |
232
|
|
|
|
|
|
|
-none- [ Game::Application ] [ Game::Object::Prize ] |
233
|
|
|
|
|
|
|
[ Game::Controller ] [ Game::Object::Wall ] |
234
|
|
|
|
|
|
|
[ Game::Direction ] [ Game::Object::Worm ] |
235
|
|
|
|
|
|
|
[ Game::Lawn ] [ Game::Object::WormVisible ] |
236
|
|
|
|
|
|
|
[ Game::Location ] |
237
|
|
|
|
|
|
|
[<Game::Object >] |
238
|
|
|
|
|
|
|
[ Game::ObjectVisible ] |
239
|
|
|
|
|
|
|
[ Game::UI ]/; |
240
|
|
|
|
|
|
|
|
241
|
|
|
|
|
|
|
|
242
|
1
|
|
|
|
|
10
|
my $textExpectedAll = qq/$textInheritance |
243
|
|
|
|
|
|
|
|
244
|
|
|
|
|
|
|
$textApi |
245
|
|
|
|
|
|
|
|
246
|
|
|
|
|
|
|
$textBookmarks |
247
|
|
|
|
|
|
|
|
248
|
|
|
|
|
|
|
$textUses |
249
|
|
|
|
|
|
|
|
250
|
|
|
|
|
|
|
$textNeighbourHood/; |
251
|
|
|
|
|
|
|
|
252
|
1
|
|
|
|
|
191
|
eq_or_diff($textShai, $textExpectedAll, " And got correct output"); |
253
|
|
|
|
|
|
|
|
254
|
|
|
|
|
|
|
# * Structure * |
255
|
|
|
|
|
|
|
# ==;;;;;==;=;=;=;=;=;==S{;;;;";;;;;;;}=S{;;{;;}";;}; |
256
|
|
|
|
|
|
|
|
257
|
|
|
|
|
|
|
|
258
|
1
|
|
|
|
|
1126
|
my $rhTest = { |
259
|
|
|
|
|
|
|
inheritance => $textInheritance, |
260
|
|
|
|
|
|
|
api => $textApi, |
261
|
|
|
|
|
|
|
bookmarks => $textBookmarks, |
262
|
|
|
|
|
|
|
uses => $textUses, |
263
|
|
|
|
|
|
|
neighbourhood => $textNeighbourHood, |
264
|
|
|
|
|
|
|
}; |
265
|
|
|
|
|
|
|
|
266
|
1
|
|
|
|
|
8
|
for my $show (sort keys %$rhTest) { |
267
|
5
|
|
|
|
|
6262
|
note("Testing ($show)"); |
268
|
5
|
|
|
|
|
852
|
my $textRendered = $oEditor->classOverview( |
269
|
|
|
|
|
|
|
oClass => $oClassOject, |
270
|
|
|
|
|
|
|
raShow => [ $show ], |
271
|
|
|
|
|
|
|
); |
272
|
5
|
|
|
|
|
37
|
eq_or_diff($textRendered, $rhTest->{$show}, " And got correct output for ($show)"); |
273
|
|
|
|
|
|
|
} |
274
|
|
|
|
|
|
|
|
275
|
|
|
|
|
|
|
} |
276
|
|
|
|
|
|
|
|
277
|
|
|
|
|
|
|
|
278
|
|
|
|
|
|
|
|
279
|
|
|
|
|
|
|
|
280
|
|
|
|
|
|
|
|
281
|
|
|
|
|
|
|
__END__ |
282
|
|
|
|
|
|
|
|
283
|
|
|
|
|
|
|
|
284
|
|
|
|
|
|
|
+-------------------------------+ |
285
|
|
|
|
|
|
|
[ Game::Object ] <-----+ |
286
|
|
|
|
|
|
|
+-------------------------------+ | |
287
|
|
|
|
|
|
|
^ | |
288
|
|
|
|
|
|
|
| | |
289
|
|
|
|
|
|
|
| | |
290
|
|
|
|
|
|
|
+-------------------------------+ | |
291
|
|
|
|
|
|
|
[ Game::Object::Worm ] | |
292
|
|
|
|
|
|
|
+-------------------------------+ | |
293
|
|
|
|
|
|
|
^ | |
294
|
|
|
|
|
|
|
| | |
295
|
|
|
|
|
|
|
| | |
296
|
|
|
|
|
|
|
+-------------------------------+ +------------+ |
297
|
|
|
|
|
|
|
[ Game::Object::Worm::ShaiHulud ] --> [ Game::Lawn ] |
298
|
|
|
|
|
|
|
+-------------------------------+ +------------+ |
299
|
|
|
|
|
|
|
|
300
|
|
|
|
|
|
|
|
301
|
|
|
|
|
|
|
|
302
|
|
|
|
|
|
|
................................. |
303
|
|
|
|
|
|
|
: Game::Object : <-----+ |
304
|
|
|
|
|
|
|
:...............................: | |
305
|
|
|
|
|
|
|
^ | |
306
|
|
|
|
|
|
|
| | |
307
|
|
|
|
|
|
|
| | |
308
|
|
|
|
|
|
|
................................. | |
309
|
|
|
|
|
|
|
: Game::Object::Worm : | |
310
|
|
|
|
|
|
|
:...............................: | |
311
|
|
|
|
|
|
|
^ | |
312
|
|
|
|
|
|
|
| | |
313
|
|
|
|
|
|
|
| | |
314
|
|
|
|
|
|
|
................................. .............. |
315
|
|
|
|
|
|
|
: Game::Object::Worm::ShaiHulud : --> : Game::Lawn : |
316
|
|
|
|
|
|
|
:...............................: :............: |