boardgame 0.0.1 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +35 -0
- data/boardgame.gemspec +15 -0
- data/coverage/.last_run.json +1 -1
- data/coverage/.resultset.json +1 -1
- data/coverage/index.html +617 -151
- data/lib/boardgame.rb +5 -0
- data/lib/{map.rb → boardgame/map.rb} +3 -3
- data/lib/{piece.rb → boardgame/piece.rb} +2 -2
- data/lib/{tile.rb → boardgame/tile.rb} +1 -1
- data/readme.md +36 -0
- data/test/test_helper.rb +1 -1
- data/test/test_map.rb +18 -12
- data/test/test_piece.rb +24 -0
- data/test/test_tile.rb +45 -4
- metadata +10 -6
- data/lib/game.rb +0 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 50e8701bd4c774018c21325cac815432198fb853
|
4
|
+
data.tar.gz: 737e1ba9be6afd445915261a6a17822468eb7ee8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 283990e26001cd59672413495006d8f763c7847e318d189b48862dca78f373dde5e52faa10939d23ef85614d1dbf975271d603a71ec57f3e516993a73217b7a9
|
7
|
+
data.tar.gz: ff5d6458f6b7c414f938a39ba035d24686efee41054f3f22950e02a89889ea1b9341db61ff5e37c92698b887b88041d82989c93e04ad18e8cc3a6046cc46a8c8
|
data/.gitignore
ADDED
@@ -0,0 +1,35 @@
|
|
1
|
+
*.gem
|
2
|
+
*.rbc
|
3
|
+
/.config
|
4
|
+
/coverage/
|
5
|
+
/InstalledFiles
|
6
|
+
/pkg/
|
7
|
+
/spec/reports/
|
8
|
+
/test/tmp/
|
9
|
+
/test/version_tmp/
|
10
|
+
/tmp/
|
11
|
+
|
12
|
+
## Specific to RubyMotion:
|
13
|
+
.dat*
|
14
|
+
.repl_history
|
15
|
+
build/
|
16
|
+
|
17
|
+
## Documentation cache and generated files:
|
18
|
+
/.yardoc/
|
19
|
+
/_yardoc/
|
20
|
+
/doc/
|
21
|
+
/rdoc/
|
22
|
+
|
23
|
+
## Environment normalisation:
|
24
|
+
/.bundle/
|
25
|
+
/lib/bundler/man/
|
26
|
+
|
27
|
+
# for a library or gem, you might want to ignore these files since the code is
|
28
|
+
# intended to run in multiple environments; otherwise, check them in:
|
29
|
+
# Gemfile.lock
|
30
|
+
# .ruby-version
|
31
|
+
# .ruby-gemset
|
32
|
+
|
33
|
+
# unless supporting rvm < 1.11.0 or doing something fancy, ignore this:
|
34
|
+
.rvmrc
|
35
|
+
.DS_Store
|
data/boardgame.gemspec
ADDED
@@ -0,0 +1,15 @@
|
|
1
|
+
$:.push File.expand_path('../lib', __FILE__)
|
2
|
+
|
3
|
+
Gem::Specification.new do |s|
|
4
|
+
s.authors = ['Rick Carlino']
|
5
|
+
s.description = "A simple Ruby object library for board and tile based games."
|
6
|
+
s.email = 'rick.carlino@gmail.com'
|
7
|
+
s.files = `git ls-files`.split("\n")
|
8
|
+
s.homepage = 'http://github.com/rickcarlino/shiny-octo-nemesis'
|
9
|
+
s.license = 'MIT'
|
10
|
+
s.name = 'boardgame'
|
11
|
+
s.require_paths = ['lib']
|
12
|
+
s.summary = "Control logic for board and tile based games using Ruby."
|
13
|
+
s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
14
|
+
s.version = '0.0.2'
|
15
|
+
end
|
data/coverage/.last_run.json
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"result":{"covered_percent":
|
1
|
+
{"result":{"covered_percent":100.0}}
|
data/coverage/.resultset.json
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"Unit Tests":{"coverage":{"/Users/rick/coding/trainride/lib/
|
1
|
+
{"Unit Tests":{"coverage":{"/Users/rick/coding/trainride/lib/boardgame.rb":[1,null,1,1,1],"/Users/rick/coding/trainride/lib/boardgame/piece.rb":[null,1,1,null,1,3,2,2,2,2,null,null,1,4,null,null],"/Users/rick/coding/trainride/lib/boardgame/tile.rb":[null,1,null,1,null,1,148,null,null,1,144,143,null,1,null,143,null,null,1,18,null,null,1,7,7,null,null,1,2,2,null,null],"/Users/rick/coding/trainride/lib/boardgame/map.rb":[null,null,null,null,null,null,1,null,1,null,1,10,10,9,null,null,null,1,27,null,null,null,1,145,143,142,null,null,null,1,321,null,null,1,1,1,4,16,null,4,null,1,null,null,1,null,1,9,9,34,34,138,null,null,null,null,1,13,null,null,1,35,null,null,1,145,null,null,1,10,1,null,null,null],"/Users/rick/coding/trainride/test/test_map.rb":[1,null,1,null,1,20,null,null,1,1,null,null,null,1,1,null,1,null,1,null,1,null,1,null,null,null,1,1,1,null,1,1,null,1,1,null,1,1,null,null,null,1,1,null,1,1,null,1,null,null,null,1,1,1,1,1,null,null,null,null,1,null,null,null,1,1,1,null,null,null],"/Users/rick/coding/trainride/test/test_piece.rb":[1,null,1,1,2,2,null,null,1,1,null,null,1,1,1,null,1,1,1,1,1,1,null,null],"/Users/rick/coding/trainride/test/test_tile.rb":[1,null,1,1,1,null,null,null,1,1,1,1,1,null,null,null,1,1,1,1,1,null,1,1,null,null,null,1,1,1,null,1,1,1,null,null,null,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,null,null,null]},"timestamp":1407607235}}
|
data/coverage/index.html
CHANGED
@@ -14,27 +14,27 @@
|
|
14
14
|
<img src="./assets/0.8.0/loading.gif" alt="loading"/>
|
15
15
|
</div>
|
16
16
|
<div id="wrapper" style="display:none;">
|
17
|
-
<div class="timestamp">Generated <abbr class="timeago" title="2014-08-
|
17
|
+
<div class="timestamp">Generated <abbr class="timeago" title="2014-08-09T13:00:35-05:00">2014-08-09T13:00:35-05:00</abbr></div>
|
18
18
|
<ul class="group_tabs"></ul>
|
19
19
|
|
20
20
|
<div id="content">
|
21
21
|
<div class="file_list_container" id="AllFiles">
|
22
22
|
<h2>
|
23
23
|
<span class="group_name">All Files</span>
|
24
|
-
(<span class="covered_percent"><span class="green">
|
24
|
+
(<span class="covered_percent"><span class="green">100.0%</span></span>
|
25
25
|
covered at
|
26
26
|
<span class="covered_strength">
|
27
27
|
<span class="green">
|
28
|
-
|
28
|
+
12.85
|
29
29
|
</span>
|
30
30
|
</span> hits/line)
|
31
31
|
</h2>
|
32
32
|
<a name="AllFiles"></a>
|
33
33
|
<div>
|
34
|
-
<b>
|
35
|
-
<b>
|
36
|
-
<span class="green"><b>
|
37
|
-
<span class="red"><b>
|
34
|
+
<b>7</b> files in total.
|
35
|
+
<b>158</b> relevant lines.
|
36
|
+
<span class="green"><b>158</b> lines covered</span> and
|
37
|
+
<span class="red"><b>0</b> lines missed </span>
|
38
38
|
</div>
|
39
39
|
<table class="file_list">
|
40
40
|
<thead>
|
@@ -51,61 +51,71 @@
|
|
51
51
|
<tbody>
|
52
52
|
|
53
53
|
<tr>
|
54
|
-
<td class="strong"><a href="#
|
54
|
+
<td class="strong"><a href="#2351f5d7398dd9789e0eceff40301f1e50e19f17" class="src_link" title="lib/boardgame.rb">lib/boardgame.rb</a></td>
|
55
55
|
<td class="green strong">100.0 %</td>
|
56
|
-
<td>
|
57
|
-
<td>
|
58
|
-
<td>
|
56
|
+
<td>5</td>
|
57
|
+
<td>4</td>
|
58
|
+
<td>4</td>
|
59
59
|
<td>0</td>
|
60
60
|
<td>1.0</td>
|
61
61
|
</tr>
|
62
62
|
|
63
63
|
<tr>
|
64
|
-
<td class="strong"><a href="#
|
65
|
-
<td class="green strong">
|
64
|
+
<td class="strong"><a href="#38ce2bfbbe8643bfc9fcb37ff423b1943ed882bd" class="src_link" title="lib/boardgame/map.rb">lib/boardgame/map.rb</a></td>
|
65
|
+
<td class="green strong">100.0 %</td>
|
66
66
|
<td>74</td>
|
67
67
|
<td>37</td>
|
68
|
-
<td>
|
69
|
-
<td>
|
70
|
-
<td>
|
68
|
+
<td>37</td>
|
69
|
+
<td>0</td>
|
70
|
+
<td>34.5</td>
|
71
71
|
</tr>
|
72
72
|
|
73
73
|
<tr>
|
74
|
-
<td class="strong"><a href="#
|
75
|
-
<td class="
|
74
|
+
<td class="strong"><a href="#3c9ad93c264d75a15441d755a99e3086759fce51" class="src_link" title="lib/boardgame/piece.rb">lib/boardgame/piece.rb</a></td>
|
75
|
+
<td class="green strong">100.0 %</td>
|
76
76
|
<td>16</td>
|
77
77
|
<td>10</td>
|
78
|
-
<td>
|
79
|
-
<td>
|
80
|
-
<td>
|
78
|
+
<td>10</td>
|
79
|
+
<td>0</td>
|
80
|
+
<td>1.9</td>
|
81
81
|
</tr>
|
82
82
|
|
83
83
|
<tr>
|
84
|
-
<td class="strong"><a href="#
|
85
|
-
<td class="
|
84
|
+
<td class="strong"><a href="#b97e918bdc68bfac591fd7b458cacccbb0c9e79a" class="src_link" title="lib/boardgame/tile.rb">lib/boardgame/tile.rb</a></td>
|
85
|
+
<td class="green strong">100.0 %</td>
|
86
86
|
<td>32</td>
|
87
87
|
<td>17</td>
|
88
|
-
<td>
|
89
|
-
<td>
|
90
|
-
<td>
|
88
|
+
<td>17</td>
|
89
|
+
<td>0</td>
|
90
|
+
<td>36.6</td>
|
91
91
|
</tr>
|
92
92
|
|
93
93
|
<tr>
|
94
94
|
<td class="strong"><a href="#348e6e9cfedb8c432eab7bea21943b8305a3fc4c" class="src_link" title="test/test_map.rb">test/test_map.rb</a></td>
|
95
95
|
<td class="green strong">100.0 %</td>
|
96
|
-
<td>
|
97
|
-
<td>
|
98
|
-
<td>
|
96
|
+
<td>70</td>
|
97
|
+
<td>35</td>
|
98
|
+
<td>35</td>
|
99
99
|
<td>0</td>
|
100
|
-
<td>1.
|
100
|
+
<td>1.5</td>
|
101
101
|
</tr>
|
102
102
|
|
103
103
|
<tr>
|
104
|
-
<td class="strong"><a href="#
|
104
|
+
<td class="strong"><a href="#4e8705bea9266f2d4a5a67b5b282d9290e867580" class="src_link" title="test/test_piece.rb">test/test_piece.rb</a></td>
|
105
105
|
<td class="green strong">100.0 %</td>
|
106
|
+
<td>24</td>
|
107
|
+
<td>16</td>
|
106
108
|
<td>16</td>
|
107
|
-
<td>
|
108
|
-
<td>
|
109
|
+
<td>0</td>
|
110
|
+
<td>1.1</td>
|
111
|
+
</tr>
|
112
|
+
|
113
|
+
<tr>
|
114
|
+
<td class="strong"><a href="#685f7b949b48d9db646fecd864136d1ac8fc45a6" class="src_link" title="test/test_tile.rb">test/test_tile.rb</a></td>
|
115
|
+
<td class="green strong">100.0 %</td>
|
116
|
+
<td>57</td>
|
117
|
+
<td>39</td>
|
118
|
+
<td>39</td>
|
109
119
|
<td>0</td>
|
110
120
|
<td>1.0</td>
|
111
121
|
</tr>
|
@@ -126,13 +136,13 @@
|
|
126
136
|
|
127
137
|
<div class="source_files">
|
128
138
|
|
129
|
-
<div class="source_table" id="
|
139
|
+
<div class="source_table" id="2351f5d7398dd9789e0eceff40301f1e50e19f17">
|
130
140
|
<div class="header">
|
131
|
-
<h3>lib/
|
141
|
+
<h3>lib/boardgame.rb</h3>
|
132
142
|
<h4><span class="green">100.0 %</span> covered</h4>
|
133
143
|
<div>
|
134
|
-
<b>
|
135
|
-
<span class="green"><b>
|
144
|
+
<b>4</b> relevant lines.
|
145
|
+
<span class="green"><b>4</b> lines covered</span> and
|
136
146
|
<span class="red"><b>0</b> lines missed.</span>
|
137
147
|
</div>
|
138
148
|
</div>
|
@@ -143,33 +153,45 @@
|
|
143
153
|
<li class="covered" data-hits="1" data-linenumber="1">
|
144
154
|
<span class="hits">1</span>
|
145
155
|
|
146
|
-
<code class="ruby">
|
156
|
+
<code class="ruby">module BoardGame</code>
|
147
157
|
</li>
|
148
158
|
|
149
|
-
<li class="
|
150
|
-
<span class="hits">1</span>
|
159
|
+
<li class="never" data-hits="" data-linenumber="2">
|
151
160
|
|
152
|
-
|
161
|
+
|
162
|
+
<code class="ruby">end</code>
|
153
163
|
</li>
|
154
164
|
|
155
165
|
<li class="covered" data-hits="1" data-linenumber="3">
|
156
166
|
<span class="hits">1</span>
|
157
167
|
|
158
|
-
<code class="ruby">require_relative '
|
168
|
+
<code class="ruby">require_relative 'boardgame/piece'</code>
|
169
|
+
</li>
|
170
|
+
|
171
|
+
<li class="covered" data-hits="1" data-linenumber="4">
|
172
|
+
<span class="hits">1</span>
|
173
|
+
|
174
|
+
<code class="ruby">require_relative 'boardgame/tile'</code>
|
175
|
+
</li>
|
176
|
+
|
177
|
+
<li class="covered" data-hits="1" data-linenumber="5">
|
178
|
+
<span class="hits">1</span>
|
179
|
+
|
180
|
+
<code class="ruby">require_relative 'boardgame/map'</code>
|
159
181
|
</li>
|
160
182
|
|
161
183
|
</ol>
|
162
184
|
</pre>
|
163
185
|
</div>
|
164
186
|
|
165
|
-
<div class="source_table" id="
|
187
|
+
<div class="source_table" id="38ce2bfbbe8643bfc9fcb37ff423b1943ed882bd">
|
166
188
|
<div class="header">
|
167
|
-
<h3>lib/map.rb</h3>
|
168
|
-
<h4><span class="green">
|
189
|
+
<h3>lib/boardgame/map.rb</h3>
|
190
|
+
<h4><span class="green">100.0 %</span> covered</h4>
|
169
191
|
<div>
|
170
192
|
<b>37</b> relevant lines.
|
171
|
-
<span class="green"><b>
|
172
|
-
<span class="red"><b>
|
193
|
+
<span class="green"><b>37</b> lines covered</span> and
|
194
|
+
<span class="red"><b>0</b> lines missed.</span>
|
173
195
|
</div>
|
174
196
|
</div>
|
175
197
|
|
@@ -215,7 +237,7 @@
|
|
215
237
|
<li class="covered" data-hits="1" data-linenumber="7">
|
216
238
|
<span class="hits">1</span>
|
217
239
|
|
218
|
-
<code class="ruby">class Map</code>
|
240
|
+
<code class="ruby">class BoardGame::Map</code>
|
219
241
|
</li>
|
220
242
|
|
221
243
|
<li class="never" data-hits="" data-linenumber="8">
|
@@ -242,20 +264,20 @@
|
|
242
264
|
<code class="ruby"> def initialize(height, width)</code>
|
243
265
|
</li>
|
244
266
|
|
245
|
-
<li class="covered" data-hits="
|
246
|
-
<span class="hits">
|
267
|
+
<li class="covered" data-hits="10" data-linenumber="12">
|
268
|
+
<span class="hits">10</span>
|
247
269
|
|
248
270
|
<code class="ruby"> @height, @width = height, width</code>
|
249
271
|
</li>
|
250
272
|
|
251
|
-
<li class="covered" data-hits="
|
252
|
-
<span class="hits">
|
273
|
+
<li class="covered" data-hits="10" data-linenumber="13">
|
274
|
+
<span class="hits">10</span>
|
253
275
|
|
254
276
|
<code class="ruby"> validate_height</code>
|
255
277
|
</li>
|
256
278
|
|
257
|
-
<li class="covered" data-hits="
|
258
|
-
<span class="hits">
|
279
|
+
<li class="covered" data-hits="9" data-linenumber="14">
|
280
|
+
<span class="hits">9</span>
|
259
281
|
|
260
282
|
<code class="ruby"> initialize_map_tiles</code>
|
261
283
|
</li>
|
@@ -284,8 +306,8 @@
|
|
284
306
|
<code class="ruby"> def [](x, y)</code>
|
285
307
|
</li>
|
286
308
|
|
287
|
-
<li class="covered" data-hits="
|
288
|
-
<span class="hits">
|
309
|
+
<li class="covered" data-hits="27" data-linenumber="19">
|
310
|
+
<span class="hits">27</span>
|
289
311
|
|
290
312
|
<code class="ruby"> return @tiles[x][y] if within? x, y</code>
|
291
313
|
</li>
|
@@ -314,20 +336,20 @@
|
|
314
336
|
<code class="ruby"> def []=(x, y, tile)</code>
|
315
337
|
</li>
|
316
338
|
|
317
|
-
<li class="covered" data-hits="
|
318
|
-
<span class="hits">
|
339
|
+
<li class="covered" data-hits="145" data-linenumber="24">
|
340
|
+
<span class="hits">145</span>
|
319
341
|
|
320
342
|
<code class="ruby"> validate_coords(x, y)</code>
|
321
343
|
</li>
|
322
344
|
|
323
|
-
<li class="covered" data-hits="
|
324
|
-
<span class="hits">
|
345
|
+
<li class="covered" data-hits="143" data-linenumber="25">
|
346
|
+
<span class="hits">143</span>
|
325
347
|
|
326
|
-
<code class="ruby"> raise 'needs to be a tile' unless tile.is_a? Tile</code>
|
348
|
+
<code class="ruby"> raise 'needs to be a tile' unless tile.is_a? BoardGame::Tile</code>
|
327
349
|
</li>
|
328
350
|
|
329
|
-
<li class="covered" data-hits="
|
330
|
-
<span class="hits">
|
351
|
+
<li class="covered" data-hits="142" data-linenumber="26">
|
352
|
+
<span class="hits">142</span>
|
331
353
|
|
332
354
|
<code class="ruby"> @tiles[x][y] = tile.move_to(x, y, self)</code>
|
333
355
|
</li>
|
@@ -356,8 +378,8 @@
|
|
356
378
|
<code class="ruby"> def within?(x, y)</code>
|
357
379
|
</li>
|
358
380
|
|
359
|
-
<li class="covered" data-hits="
|
360
|
-
<span class="hits">
|
381
|
+
<li class="covered" data-hits="321" data-linenumber="31">
|
382
|
+
<span class="hits">321</span>
|
361
383
|
|
362
384
|
<code class="ruby"> (x >= 0) && (x < height) && (y >= 0) && (y < height)</code>
|
363
385
|
</li>
|
@@ -458,34 +480,34 @@
|
|
458
480
|
<code class="ruby"> def initialize_map_tiles</code>
|
459
481
|
</li>
|
460
482
|
|
461
|
-
<li class="covered" data-hits="
|
462
|
-
<span class="hits">
|
483
|
+
<li class="covered" data-hits="9" data-linenumber="48">
|
484
|
+
<span class="hits">9</span>
|
463
485
|
|
464
486
|
<code class="ruby"> @tiles = {}</code>
|
465
487
|
</li>
|
466
488
|
|
467
|
-
<li class="covered" data-hits="
|
468
|
-
<span class="hits">
|
489
|
+
<li class="covered" data-hits="9" data-linenumber="49">
|
490
|
+
<span class="hits">9</span>
|
469
491
|
|
470
492
|
<code class="ruby"> 0.upto(max_x) do |wd|</code>
|
471
493
|
</li>
|
472
494
|
|
473
|
-
<li class="covered" data-hits="
|
474
|
-
<span class="hits">
|
495
|
+
<li class="covered" data-hits="34" data-linenumber="50">
|
496
|
+
<span class="hits">34</span>
|
475
497
|
|
476
498
|
<code class="ruby"> @tiles[wd] = {}</code>
|
477
499
|
</li>
|
478
500
|
|
479
|
-
<li class="covered" data-hits="
|
480
|
-
<span class="hits">
|
501
|
+
<li class="covered" data-hits="34" data-linenumber="51">
|
502
|
+
<span class="hits">34</span>
|
481
503
|
|
482
504
|
<code class="ruby"> 0.upto(max_y) do |ht|</code>
|
483
505
|
</li>
|
484
506
|
|
485
|
-
<li class="covered" data-hits="
|
486
|
-
<span class="hits">
|
507
|
+
<li class="covered" data-hits="138" data-linenumber="52">
|
508
|
+
<span class="hits">138</span>
|
487
509
|
|
488
|
-
<code class="ruby"> self[wd, ht] = Tile.new({})</code>
|
510
|
+
<code class="ruby"> self[wd, ht] = BoardGame::Tile.new({})</code>
|
489
511
|
</li>
|
490
512
|
|
491
513
|
<li class="never" data-hits="" data-linenumber="53">
|
@@ -518,8 +540,8 @@
|
|
518
540
|
<code class="ruby"> def max_x</code>
|
519
541
|
</li>
|
520
542
|
|
521
|
-
<li class="covered" data-hits="
|
522
|
-
<span class="hits">
|
543
|
+
<li class="covered" data-hits="13" data-linenumber="58">
|
544
|
+
<span class="hits">13</span>
|
523
545
|
|
524
546
|
<code class="ruby"> width - 1</code>
|
525
547
|
</li>
|
@@ -542,8 +564,8 @@
|
|
542
564
|
<code class="ruby"> def max_y</code>
|
543
565
|
</li>
|
544
566
|
|
545
|
-
<li class="covered" data-hits="
|
546
|
-
<span class="hits">
|
567
|
+
<li class="covered" data-hits="35" data-linenumber="62">
|
568
|
+
<span class="hits">35</span>
|
547
569
|
|
548
570
|
<code class="ruby"> height - 1</code>
|
549
571
|
</li>
|
@@ -566,8 +588,8 @@
|
|
566
588
|
<code class="ruby"> def validate_coords(x, y)</code>
|
567
589
|
</li>
|
568
590
|
|
569
|
-
<li class="covered" data-hits="
|
570
|
-
<span class="hits">
|
591
|
+
<li class="covered" data-hits="145" data-linenumber="66">
|
592
|
+
<span class="hits">145</span>
|
571
593
|
|
572
594
|
<code class="ruby"> raise "Coords out of range for #{height}x#{width} map." unless within? x, y</code>
|
573
595
|
</li>
|
@@ -590,14 +612,14 @@
|
|
590
612
|
<code class="ruby"> def validate_height</code>
|
591
613
|
</li>
|
592
614
|
|
593
|
-
<li class="covered" data-hits="
|
594
|
-
<span class="hits">
|
615
|
+
<li class="covered" data-hits="10" data-linenumber="70">
|
616
|
+
<span class="hits">10</span>
|
595
617
|
|
596
618
|
<code class="ruby"> unless height.is_a?(Fixnum) && width.is_a?(Fixnum)</code>
|
597
619
|
</li>
|
598
620
|
|
599
|
-
<li class="
|
600
|
-
|
621
|
+
<li class="covered" data-hits="1" data-linenumber="71">
|
622
|
+
<span class="hits">1</span>
|
601
623
|
|
602
624
|
<code class="ruby"> raise 'Expected height and width to be Fixnums'</code>
|
603
625
|
</li>
|
@@ -624,14 +646,14 @@
|
|
624
646
|
</pre>
|
625
647
|
</div>
|
626
648
|
|
627
|
-
<div class="source_table" id="
|
649
|
+
<div class="source_table" id="3c9ad93c264d75a15441d755a99e3086759fce51">
|
628
650
|
<div class="header">
|
629
|
-
<h3>lib/piece.rb</h3>
|
630
|
-
<h4><span class="
|
651
|
+
<h3>lib/boardgame/piece.rb</h3>
|
652
|
+
<h4><span class="green">100.0 %</span> covered</h4>
|
631
653
|
<div>
|
632
654
|
<b>10</b> relevant lines.
|
633
|
-
<span class="green"><b>
|
634
|
-
<span class="red"><b>
|
655
|
+
<span class="green"><b>10</b> lines covered</span> and
|
656
|
+
<span class="red"><b>0</b> lines missed.</span>
|
635
657
|
</div>
|
636
658
|
</div>
|
637
659
|
|
@@ -647,7 +669,7 @@
|
|
647
669
|
<li class="covered" data-hits="1" data-linenumber="2">
|
648
670
|
<span class="hits">1</span>
|
649
671
|
|
650
|
-
<code class="ruby">class Piece</code>
|
672
|
+
<code class="ruby">class BoardGame::Piece</code>
|
651
673
|
</li>
|
652
674
|
|
653
675
|
<li class="covered" data-hits="1" data-linenumber="3">
|
@@ -668,32 +690,32 @@
|
|
668
690
|
<code class="ruby"> def move_to(new_tile)</code>
|
669
691
|
</li>
|
670
692
|
|
671
|
-
<li class="
|
693
|
+
<li class="covered" data-hits="3" data-linenumber="6">
|
694
|
+
<span class="hits">3</span>
|
672
695
|
|
673
|
-
|
674
|
-
<code class="ruby"> raise 'that isnt a tile' unless new_tile.is_a? Tile</code>
|
696
|
+
<code class="ruby"> raise 'that isnt a tile' unless new_tile.is_a? BoardGame::Tile</code>
|
675
697
|
</li>
|
676
698
|
|
677
|
-
<li class="
|
678
|
-
|
699
|
+
<li class="covered" data-hits="2" data-linenumber="7">
|
700
|
+
<span class="hits">2</span>
|
679
701
|
|
680
702
|
<code class="ruby"> @tile.remove self if @tile</code>
|
681
703
|
</li>
|
682
704
|
|
683
|
-
<li class="
|
684
|
-
|
705
|
+
<li class="covered" data-hits="2" data-linenumber="8">
|
706
|
+
<span class="hits">2</span>
|
685
707
|
|
686
708
|
<code class="ruby"> @tile = new_tile</code>
|
687
709
|
</li>
|
688
710
|
|
689
|
-
<li class="
|
690
|
-
|
711
|
+
<li class="covered" data-hits="2" data-linenumber="9">
|
712
|
+
<span class="hits">2</span>
|
691
713
|
|
692
714
|
<code class="ruby"> @tile << self</code>
|
693
715
|
</li>
|
694
716
|
|
695
|
-
<li class="
|
696
|
-
|
717
|
+
<li class="covered" data-hits="2" data-linenumber="10">
|
718
|
+
<span class="hits">2</span>
|
697
719
|
|
698
720
|
<code class="ruby"> self</code>
|
699
721
|
</li>
|
@@ -716,8 +738,8 @@
|
|
716
738
|
<code class="ruby"> def inspect</code>
|
717
739
|
</li>
|
718
740
|
|
719
|
-
<li class="covered" data-hits="
|
720
|
-
<span class="hits">
|
741
|
+
<li class="covered" data-hits="4" data-linenumber="14">
|
742
|
+
<span class="hits">4</span>
|
721
743
|
|
722
744
|
<code class="ruby"> "+"</code>
|
723
745
|
</li>
|
@@ -738,14 +760,14 @@
|
|
738
760
|
</pre>
|
739
761
|
</div>
|
740
762
|
|
741
|
-
<div class="source_table" id="
|
763
|
+
<div class="source_table" id="b97e918bdc68bfac591fd7b458cacccbb0c9e79a">
|
742
764
|
<div class="header">
|
743
|
-
<h3>lib/tile.rb</h3>
|
744
|
-
<h4><span class="
|
765
|
+
<h3>lib/boardgame/tile.rb</h3>
|
766
|
+
<h4><span class="green">100.0 %</span> covered</h4>
|
745
767
|
<div>
|
746
768
|
<b>17</b> relevant lines.
|
747
|
-
<span class="green"><b>
|
748
|
-
<span class="red"><b>
|
769
|
+
<span class="green"><b>17</b> lines covered</span> and
|
770
|
+
<span class="red"><b>0</b> lines missed.</span>
|
749
771
|
</div>
|
750
772
|
</div>
|
751
773
|
|
@@ -761,7 +783,7 @@
|
|
761
783
|
<li class="covered" data-hits="1" data-linenumber="2">
|
762
784
|
<span class="hits">1</span>
|
763
785
|
|
764
|
-
<code class="ruby">class Tile</code>
|
786
|
+
<code class="ruby">class BoardGame::Tile</code>
|
765
787
|
</li>
|
766
788
|
|
767
789
|
<li class="never" data-hits="" data-linenumber="3">
|
@@ -788,8 +810,8 @@
|
|
788
810
|
<code class="ruby"> def initialize(x: nil , y: nil, map: nil, content: [])</code>
|
789
811
|
</li>
|
790
812
|
|
791
|
-
<li class="covered" data-hits="
|
792
|
-
<span class="hits">
|
813
|
+
<li class="covered" data-hits="148" data-linenumber="7">
|
814
|
+
<span class="hits">148</span>
|
793
815
|
|
794
816
|
<code class="ruby"> @content, @x, @y, @map = content, x, y, map</code>
|
795
817
|
</li>
|
@@ -812,14 +834,14 @@
|
|
812
834
|
<code class="ruby"> def move_to(x, y, map = @map)</code>
|
813
835
|
</li>
|
814
836
|
|
815
|
-
<li class="covered" data-hits="
|
816
|
-
<span class="hits">
|
837
|
+
<li class="covered" data-hits="144" data-linenumber="11">
|
838
|
+
<span class="hits">144</span>
|
817
839
|
|
818
840
|
<code class="ruby"> if map.within? x, y</code>
|
819
841
|
</li>
|
820
842
|
|
821
|
-
<li class="covered" data-hits="
|
822
|
-
<span class="hits">
|
843
|
+
<li class="covered" data-hits="143" data-linenumber="12">
|
844
|
+
<span class="hits">143</span>
|
823
845
|
|
824
846
|
<code class="ruby"> @x, @y, @map = x, y, map</code>
|
825
847
|
</li>
|
@@ -830,8 +852,8 @@
|
|
830
852
|
<code class="ruby"> else</code>
|
831
853
|
</li>
|
832
854
|
|
833
|
-
<li class="
|
834
|
-
|
855
|
+
<li class="covered" data-hits="1" data-linenumber="14">
|
856
|
+
<span class="hits">1</span>
|
835
857
|
|
836
858
|
<code class="ruby"> raise 'invalid move'</code>
|
837
859
|
</li>
|
@@ -842,8 +864,8 @@
|
|
842
864
|
<code class="ruby"> end</code>
|
843
865
|
</li>
|
844
866
|
|
845
|
-
<li class="covered" data-hits="
|
846
|
-
<span class="hits">
|
867
|
+
<li class="covered" data-hits="143" data-linenumber="16">
|
868
|
+
<span class="hits">143</span>
|
847
869
|
|
848
870
|
<code class="ruby"> self</code>
|
849
871
|
</li>
|
@@ -866,8 +888,8 @@
|
|
866
888
|
<code class="ruby"> def inspect</code>
|
867
889
|
</li>
|
868
890
|
|
869
|
-
<li class="covered" data-hits="
|
870
|
-
<span class="hits">
|
891
|
+
<li class="covered" data-hits="18" data-linenumber="20">
|
892
|
+
<span class="hits">18</span>
|
871
893
|
|
872
894
|
<code class="ruby"> content.empty? ? "□" : content.last.inspect</code>
|
873
895
|
</li>
|
@@ -890,14 +912,14 @@
|
|
890
912
|
<code class="ruby"> def <<(piece)</code>
|
891
913
|
</li>
|
892
914
|
|
893
|
-
<li class="covered" data-hits="
|
894
|
-
<span class="hits">
|
915
|
+
<li class="covered" data-hits="7" data-linenumber="24">
|
916
|
+
<span class="hits">7</span>
|
895
917
|
|
896
918
|
<code class="ruby"> piece.tile = self</code>
|
897
919
|
</li>
|
898
920
|
|
899
|
-
<li class="covered" data-hits="
|
900
|
-
<span class="hits">
|
921
|
+
<li class="covered" data-hits="7" data-linenumber="25">
|
922
|
+
<span class="hits">7</span>
|
901
923
|
|
902
924
|
<code class="ruby"> @content << piece</code>
|
903
925
|
</li>
|
@@ -920,14 +942,14 @@
|
|
920
942
|
<code class="ruby"> def remove(piece)</code>
|
921
943
|
</li>
|
922
944
|
|
923
|
-
<li class="
|
924
|
-
|
945
|
+
<li class="covered" data-hits="2" data-linenumber="29">
|
946
|
+
<span class="hits">2</span>
|
925
947
|
|
926
948
|
<code class="ruby"> piece.tile = nil</code>
|
927
949
|
</li>
|
928
950
|
|
929
|
-
<li class="
|
930
|
-
|
951
|
+
<li class="covered" data-hits="2" data-linenumber="30">
|
952
|
+
<span class="hits">2</span>
|
931
953
|
|
932
954
|
<code class="ruby"> @content.delete piece</code>
|
933
955
|
</li>
|
@@ -953,8 +975,8 @@
|
|
953
975
|
<h3>test/test_map.rb</h3>
|
954
976
|
<h4><span class="green">100.0 %</span> covered</h4>
|
955
977
|
<div>
|
956
|
-
<b>
|
957
|
-
<span class="green"><b>
|
978
|
+
<b>35</b> relevant lines.
|
979
|
+
<span class="green"><b>35</b> lines covered</span> and
|
958
980
|
<span class="red"><b>0</b> lines missed.</span>
|
959
981
|
</div>
|
960
982
|
</div>
|
@@ -965,7 +987,7 @@
|
|
965
987
|
<li class="covered" data-hits="1" data-linenumber="1">
|
966
988
|
<span class="hits">1</span>
|
967
989
|
|
968
|
-
<code class="ruby">
|
990
|
+
<code class="ruby">require_relative "test_helper"</code>
|
969
991
|
</li>
|
970
992
|
|
971
993
|
<li class="never" data-hits="" data-linenumber="2">
|
@@ -995,7 +1017,7 @@
|
|
995
1017
|
<li class="covered" data-hits="20" data-linenumber="6">
|
996
1018
|
<span class="hits">20</span>
|
997
1019
|
|
998
|
-
<code class="ruby"> @map ||= Map.new(4, 4)</code>
|
1020
|
+
<code class="ruby"> @map ||= BoardGame::Map.new(4, 4)</code>
|
999
1021
|
</li>
|
1000
1022
|
|
1001
1023
|
<li class="never" data-hits="" data-linenumber="7">
|
@@ -1127,13 +1149,13 @@
|
|
1127
1149
|
<li class="covered" data-hits="1" data-linenumber="28">
|
1128
1150
|
<span class="hits">1</span>
|
1129
1151
|
|
1130
|
-
<code class="ruby"> map[1, 2] = Tile.new()</code>
|
1152
|
+
<code class="ruby"> map[1, 2] = BoardGame::Tile.new()</code>
|
1131
1153
|
</li>
|
1132
1154
|
|
1133
1155
|
<li class="covered" data-hits="1" data-linenumber="29">
|
1134
1156
|
<span class="hits">1</span>
|
1135
1157
|
|
1136
|
-
<code class="ruby"> assert map[1,2].is_a?(Tile),</code>
|
1158
|
+
<code class="ruby"> assert map[1,2].is_a?(BoardGame::Tile),</code>
|
1137
1159
|
</li>
|
1138
1160
|
|
1139
1161
|
<li class="never" data-hits="" data-linenumber="30">
|
@@ -1169,7 +1191,7 @@
|
|
1169
1191
|
<li class="covered" data-hits="1" data-linenumber="35">
|
1170
1192
|
<span class="hits">1</span>
|
1171
1193
|
|
1172
|
-
<code class="ruby"> map[11, 4] = Tile.new</code>
|
1194
|
+
<code class="ruby"> map[11, 4] = BoardGame::Tile.new</code>
|
1173
1195
|
</li>
|
1174
1196
|
|
1175
1197
|
<li class="never" data-hits="" data-linenumber="36">
|
@@ -1187,7 +1209,7 @@
|
|
1187
1209
|
<li class="covered" data-hits="1" data-linenumber="38">
|
1188
1210
|
<span class="hits">1</span>
|
1189
1211
|
|
1190
|
-
<code class="ruby"> map[4, 11] = Tile.new</code>
|
1212
|
+
<code class="ruby"> map[4, 11] = BoardGame::Tile.new</code>
|
1191
1213
|
</li>
|
1192
1214
|
|
1193
1215
|
<li class="never" data-hits="" data-linenumber="39">
|
@@ -1217,7 +1239,7 @@
|
|
1217
1239
|
<li class="covered" data-hits="1" data-linenumber="43">
|
1218
1240
|
<span class="hits">1</span>
|
1219
1241
|
|
1220
|
-
<code class="ruby"> assert map[0, 1].is_a?(Tile),</code>
|
1242
|
+
<code class="ruby"> assert map[0, 1].is_a?(BoardGame::Tile),</code>
|
1221
1243
|
</li>
|
1222
1244
|
|
1223
1245
|
<li class="never" data-hits="" data-linenumber="44">
|
@@ -1229,13 +1251,13 @@
|
|
1229
1251
|
<li class="covered" data-hits="1" data-linenumber="45">
|
1230
1252
|
<span class="hits">1</span>
|
1231
1253
|
|
1232
|
-
<code class="ruby"> map[1, 2] = Tile.new</code>
|
1254
|
+
<code class="ruby"> map[1, 2] = BoardGame::Tile.new</code>
|
1233
1255
|
</li>
|
1234
1256
|
|
1235
1257
|
<li class="covered" data-hits="1" data-linenumber="46">
|
1236
1258
|
<span class="hits">1</span>
|
1237
1259
|
|
1238
|
-
<code class="ruby"> assert map[1,2].is_a?(Tile),</code>
|
1260
|
+
<code class="ruby"> assert map[1,2].is_a?(BoardGame::Tile),</code>
|
1239
1261
|
</li>
|
1240
1262
|
|
1241
1263
|
<li class="never" data-hits="" data-linenumber="47">
|
@@ -1277,19 +1299,19 @@
|
|
1277
1299
|
<li class="covered" data-hits="1" data-linenumber="53">
|
1278
1300
|
<span class="hits">1</span>
|
1279
1301
|
|
1280
|
-
<code class="ruby"> map[0, 0] = Tile.new</code>
|
1302
|
+
<code class="ruby"> map[0, 0] = BoardGame::Tile.new</code>
|
1281
1303
|
</li>
|
1282
1304
|
|
1283
1305
|
<li class="covered" data-hits="1" data-linenumber="54">
|
1284
1306
|
<span class="hits">1</span>
|
1285
1307
|
|
1286
|
-
<code class="ruby"> map[3, 3] = Tile.new</code>
|
1308
|
+
<code class="ruby"> map[3, 3] = BoardGame::Tile.new</code>
|
1287
1309
|
</li>
|
1288
1310
|
|
1289
1311
|
<li class="covered" data-hits="1" data-linenumber="55">
|
1290
1312
|
<span class="hits">1</span>
|
1291
1313
|
|
1292
|
-
<code class="ruby"> map[2, 1]
|
1314
|
+
<code class="ruby"> map[2, 1] << BoardGame::Piece.new</code>
|
1293
1315
|
</li>
|
1294
1316
|
|
1295
1317
|
<li class="covered" data-hits="1" data-linenumber="56">
|
@@ -1343,6 +1365,204 @@
|
|
1343
1365
|
<li class="never" data-hits="" data-linenumber="64">
|
1344
1366
|
|
1345
1367
|
|
1368
|
+
<code class="ruby"></code>
|
1369
|
+
</li>
|
1370
|
+
|
1371
|
+
<li class="covered" data-hits="1" data-linenumber="65">
|
1372
|
+
<span class="hits">1</span>
|
1373
|
+
|
1374
|
+
<code class="ruby"> def test_validate_height</code>
|
1375
|
+
</li>
|
1376
|
+
|
1377
|
+
<li class="covered" data-hits="1" data-linenumber="66">
|
1378
|
+
<span class="hits">1</span>
|
1379
|
+
|
1380
|
+
<code class="ruby"> assert_raises RuntimeError do</code>
|
1381
|
+
</li>
|
1382
|
+
|
1383
|
+
<li class="covered" data-hits="1" data-linenumber="67">
|
1384
|
+
<span class="hits">1</span>
|
1385
|
+
|
1386
|
+
<code class="ruby"> BoardGame::Map.new "1", 1</code>
|
1387
|
+
</li>
|
1388
|
+
|
1389
|
+
<li class="never" data-hits="" data-linenumber="68">
|
1390
|
+
|
1391
|
+
|
1392
|
+
<code class="ruby"> end </code>
|
1393
|
+
</li>
|
1394
|
+
|
1395
|
+
<li class="never" data-hits="" data-linenumber="69">
|
1396
|
+
|
1397
|
+
|
1398
|
+
<code class="ruby"> end</code>
|
1399
|
+
</li>
|
1400
|
+
|
1401
|
+
<li class="never" data-hits="" data-linenumber="70">
|
1402
|
+
|
1403
|
+
|
1404
|
+
<code class="ruby">end</code>
|
1405
|
+
</li>
|
1406
|
+
|
1407
|
+
</ol>
|
1408
|
+
</pre>
|
1409
|
+
</div>
|
1410
|
+
|
1411
|
+
<div class="source_table" id="4e8705bea9266f2d4a5a67b5b282d9290e867580">
|
1412
|
+
<div class="header">
|
1413
|
+
<h3>test/test_piece.rb</h3>
|
1414
|
+
<h4><span class="green">100.0 %</span> covered</h4>
|
1415
|
+
<div>
|
1416
|
+
<b>16</b> relevant lines.
|
1417
|
+
<span class="green"><b>16</b> lines covered</span> and
|
1418
|
+
<span class="red"><b>0</b> lines missed.</span>
|
1419
|
+
</div>
|
1420
|
+
</div>
|
1421
|
+
|
1422
|
+
<pre>
|
1423
|
+
<ol>
|
1424
|
+
|
1425
|
+
<li class="covered" data-hits="1" data-linenumber="1">
|
1426
|
+
<span class="hits">1</span>
|
1427
|
+
|
1428
|
+
<code class="ruby">require_relative "test_helper"</code>
|
1429
|
+
</li>
|
1430
|
+
|
1431
|
+
<li class="never" data-hits="" data-linenumber="2">
|
1432
|
+
|
1433
|
+
|
1434
|
+
<code class="ruby"></code>
|
1435
|
+
</li>
|
1436
|
+
|
1437
|
+
<li class="covered" data-hits="1" data-linenumber="3">
|
1438
|
+
<span class="hits">1</span>
|
1439
|
+
|
1440
|
+
<code class="ruby">class TestPiece < Minitest::Test</code>
|
1441
|
+
</li>
|
1442
|
+
|
1443
|
+
<li class="covered" data-hits="1" data-linenumber="4">
|
1444
|
+
<span class="hits">1</span>
|
1445
|
+
|
1446
|
+
<code class="ruby"> def setup</code>
|
1447
|
+
</li>
|
1448
|
+
|
1449
|
+
<li class="covered" data-hits="2" data-linenumber="5">
|
1450
|
+
<span class="hits">2</span>
|
1451
|
+
|
1452
|
+
<code class="ruby"> @map = BoardGame::Map.new(5, 5)</code>
|
1453
|
+
</li>
|
1454
|
+
|
1455
|
+
<li class="covered" data-hits="2" data-linenumber="6">
|
1456
|
+
<span class="hits">2</span>
|
1457
|
+
|
1458
|
+
<code class="ruby"> @piece = BoardGame::Piece.new</code>
|
1459
|
+
</li>
|
1460
|
+
|
1461
|
+
<li class="never" data-hits="" data-linenumber="7">
|
1462
|
+
|
1463
|
+
|
1464
|
+
<code class="ruby"> end</code>
|
1465
|
+
</li>
|
1466
|
+
|
1467
|
+
<li class="never" data-hits="" data-linenumber="8">
|
1468
|
+
|
1469
|
+
|
1470
|
+
<code class="ruby"></code>
|
1471
|
+
</li>
|
1472
|
+
|
1473
|
+
<li class="covered" data-hits="1" data-linenumber="9">
|
1474
|
+
<span class="hits">1</span>
|
1475
|
+
|
1476
|
+
<code class="ruby"> def test_inspect</code>
|
1477
|
+
</li>
|
1478
|
+
|
1479
|
+
<li class="covered" data-hits="1" data-linenumber="10">
|
1480
|
+
<span class="hits">1</span>
|
1481
|
+
|
1482
|
+
<code class="ruby"> assert @piece.inspect == "+"</code>
|
1483
|
+
</li>
|
1484
|
+
|
1485
|
+
<li class="never" data-hits="" data-linenumber="11">
|
1486
|
+
|
1487
|
+
|
1488
|
+
<code class="ruby"> end</code>
|
1489
|
+
</li>
|
1490
|
+
|
1491
|
+
<li class="never" data-hits="" data-linenumber="12">
|
1492
|
+
|
1493
|
+
|
1494
|
+
<code class="ruby"></code>
|
1495
|
+
</li>
|
1496
|
+
|
1497
|
+
<li class="covered" data-hits="1" data-linenumber="13">
|
1498
|
+
<span class="hits">1</span>
|
1499
|
+
|
1500
|
+
<code class="ruby"> def test_move_to</code>
|
1501
|
+
</li>
|
1502
|
+
|
1503
|
+
<li class="covered" data-hits="1" data-linenumber="14">
|
1504
|
+
<span class="hits">1</span>
|
1505
|
+
|
1506
|
+
<code class="ruby"> assert_raises RuntimeError do</code>
|
1507
|
+
</li>
|
1508
|
+
|
1509
|
+
<li class="covered" data-hits="1" data-linenumber="15">
|
1510
|
+
<span class="hits">1</span>
|
1511
|
+
|
1512
|
+
<code class="ruby"> @piece.move_to [2, 2]</code>
|
1513
|
+
</li>
|
1514
|
+
|
1515
|
+
<li class="never" data-hits="" data-linenumber="16">
|
1516
|
+
|
1517
|
+
|
1518
|
+
<code class="ruby"> end</code>
|
1519
|
+
</li>
|
1520
|
+
|
1521
|
+
<li class="covered" data-hits="1" data-linenumber="17">
|
1522
|
+
<span class="hits">1</span>
|
1523
|
+
|
1524
|
+
<code class="ruby"> result = @piece.move_to @map[2,2]</code>
|
1525
|
+
</li>
|
1526
|
+
|
1527
|
+
<li class="covered" data-hits="1" data-linenumber="18">
|
1528
|
+
<span class="hits">1</span>
|
1529
|
+
|
1530
|
+
<code class="ruby"> assert @piece.tile == @map[2, 2]</code>
|
1531
|
+
</li>
|
1532
|
+
|
1533
|
+
<li class="covered" data-hits="1" data-linenumber="19">
|
1534
|
+
<span class="hits">1</span>
|
1535
|
+
|
1536
|
+
<code class="ruby"> assert @map[2,2].content.first == @piece</code>
|
1537
|
+
</li>
|
1538
|
+
|
1539
|
+
<li class="covered" data-hits="1" data-linenumber="20">
|
1540
|
+
<span class="hits">1</span>
|
1541
|
+
|
1542
|
+
<code class="ruby"> assert result == @piece</code>
|
1543
|
+
</li>
|
1544
|
+
|
1545
|
+
<li class="covered" data-hits="1" data-linenumber="21">
|
1546
|
+
<span class="hits">1</span>
|
1547
|
+
|
1548
|
+
<code class="ruby"> @piece.move_to @map[2,2]</code>
|
1549
|
+
</li>
|
1550
|
+
|
1551
|
+
<li class="covered" data-hits="1" data-linenumber="22">
|
1552
|
+
<span class="hits">1</span>
|
1553
|
+
|
1554
|
+
<code class="ruby"> assert @piece.tile == @map[2,2]</code>
|
1555
|
+
</li>
|
1556
|
+
|
1557
|
+
<li class="never" data-hits="" data-linenumber="23">
|
1558
|
+
|
1559
|
+
|
1560
|
+
<code class="ruby"> end</code>
|
1561
|
+
</li>
|
1562
|
+
|
1563
|
+
<li class="never" data-hits="" data-linenumber="24">
|
1564
|
+
|
1565
|
+
|
1346
1566
|
<code class="ruby">end</code>
|
1347
1567
|
</li>
|
1348
1568
|
|
@@ -1355,8 +1575,8 @@
|
|
1355
1575
|
<h3>test/test_tile.rb</h3>
|
1356
1576
|
<h4><span class="green">100.0 %</span> covered</h4>
|
1357
1577
|
<div>
|
1358
|
-
<b>
|
1359
|
-
<span class="green"><b>
|
1578
|
+
<b>39</b> relevant lines.
|
1579
|
+
<span class="green"><b>39</b> lines covered</span> and
|
1360
1580
|
<span class="red"><b>0</b> lines missed.</span>
|
1361
1581
|
</div>
|
1362
1582
|
</div>
|
@@ -1367,7 +1587,7 @@
|
|
1367
1587
|
<li class="covered" data-hits="1" data-linenumber="1">
|
1368
1588
|
<span class="hits">1</span>
|
1369
1589
|
|
1370
|
-
<code class="ruby">
|
1590
|
+
<code class="ruby">require_relative "test_helper"</code>
|
1371
1591
|
</li>
|
1372
1592
|
|
1373
1593
|
<li class="never" data-hits="" data-linenumber="2">
|
@@ -1391,7 +1611,7 @@
|
|
1391
1611
|
<li class="covered" data-hits="1" data-linenumber="5">
|
1392
1612
|
<span class="hits">1</span>
|
1393
1613
|
|
1394
|
-
<code class="ruby"> assert Tile.new.is_a?(Tile),</code>
|
1614
|
+
<code class="ruby"> assert BoardGame::Tile.new.is_a?(BoardGame::Tile),</code>
|
1395
1615
|
</li>
|
1396
1616
|
|
1397
1617
|
<li class="never" data-hits="" data-linenumber="6">
|
@@ -1421,13 +1641,13 @@
|
|
1421
1641
|
<li class="covered" data-hits="1" data-linenumber="10">
|
1422
1642
|
<span class="hits">1</span>
|
1423
1643
|
|
1424
|
-
<code class="ruby"> tile = Tile.new</code>
|
1644
|
+
<code class="ruby"> tile = BoardGame::Tile.new</code>
|
1425
1645
|
</li>
|
1426
1646
|
|
1427
1647
|
<li class="covered" data-hits="1" data-linenumber="11">
|
1428
1648
|
<span class="hits">1</span>
|
1429
1649
|
|
1430
|
-
<code class="ruby"> piece = Piece.new</code>
|
1650
|
+
<code class="ruby"> piece = BoardGame::Piece.new</code>
|
1431
1651
|
</li>
|
1432
1652
|
|
1433
1653
|
<li class="covered" data-hits="1" data-linenumber="12">
|
@@ -1457,6 +1677,252 @@
|
|
1457
1677
|
<li class="never" data-hits="" data-linenumber="16">
|
1458
1678
|
|
1459
1679
|
|
1680
|
+
<code class="ruby"></code>
|
1681
|
+
</li>
|
1682
|
+
|
1683
|
+
<li class="covered" data-hits="1" data-linenumber="17">
|
1684
|
+
<span class="hits">1</span>
|
1685
|
+
|
1686
|
+
<code class="ruby"> def test_removal</code>
|
1687
|
+
</li>
|
1688
|
+
|
1689
|
+
<li class="covered" data-hits="1" data-linenumber="18">
|
1690
|
+
<span class="hits">1</span>
|
1691
|
+
|
1692
|
+
<code class="ruby"> tile = BoardGame::Tile.new</code>
|
1693
|
+
</li>
|
1694
|
+
|
1695
|
+
<li class="covered" data-hits="1" data-linenumber="19">
|
1696
|
+
<span class="hits">1</span>
|
1697
|
+
|
1698
|
+
<code class="ruby"> piece = BoardGame::Piece.new</code>
|
1699
|
+
</li>
|
1700
|
+
|
1701
|
+
<li class="covered" data-hits="1" data-linenumber="20">
|
1702
|
+
<span class="hits">1</span>
|
1703
|
+
|
1704
|
+
<code class="ruby"> tile << piece</code>
|
1705
|
+
</li>
|
1706
|
+
|
1707
|
+
<li class="covered" data-hits="1" data-linenumber="21">
|
1708
|
+
<span class="hits">1</span>
|
1709
|
+
|
1710
|
+
<code class="ruby"> assert tile.content.first == piece,</code>
|
1711
|
+
</li>
|
1712
|
+
|
1713
|
+
<li class="never" data-hits="" data-linenumber="22">
|
1714
|
+
|
1715
|
+
|
1716
|
+
<code class="ruby"> "Did not put piece on tile."</code>
|
1717
|
+
</li>
|
1718
|
+
|
1719
|
+
<li class="covered" data-hits="1" data-linenumber="23">
|
1720
|
+
<span class="hits">1</span>
|
1721
|
+
|
1722
|
+
<code class="ruby"> tile.remove(piece)</code>
|
1723
|
+
</li>
|
1724
|
+
|
1725
|
+
<li class="covered" data-hits="1" data-linenumber="24">
|
1726
|
+
<span class="hits">1</span>
|
1727
|
+
|
1728
|
+
<code class="ruby"> assert tile.content.length == 0,</code>
|
1729
|
+
</li>
|
1730
|
+
|
1731
|
+
<li class="never" data-hits="" data-linenumber="25">
|
1732
|
+
|
1733
|
+
|
1734
|
+
<code class="ruby"> "Unable to remove pieces from tiles."</code>
|
1735
|
+
</li>
|
1736
|
+
|
1737
|
+
<li class="never" data-hits="" data-linenumber="26">
|
1738
|
+
|
1739
|
+
|
1740
|
+
<code class="ruby"> end</code>
|
1741
|
+
</li>
|
1742
|
+
|
1743
|
+
<li class="never" data-hits="" data-linenumber="27">
|
1744
|
+
|
1745
|
+
|
1746
|
+
<code class="ruby"></code>
|
1747
|
+
</li>
|
1748
|
+
|
1749
|
+
<li class="covered" data-hits="1" data-linenumber="28">
|
1750
|
+
<span class="hits">1</span>
|
1751
|
+
|
1752
|
+
<code class="ruby"> def test_inspect</code>
|
1753
|
+
</li>
|
1754
|
+
|
1755
|
+
<li class="covered" data-hits="1" data-linenumber="29">
|
1756
|
+
<span class="hits">1</span>
|
1757
|
+
|
1758
|
+
<code class="ruby"> tile = BoardGame::Tile.new</code>
|
1759
|
+
</li>
|
1760
|
+
|
1761
|
+
<li class="covered" data-hits="1" data-linenumber="30">
|
1762
|
+
<span class="hits">1</span>
|
1763
|
+
|
1764
|
+
<code class="ruby"> assert tile.inspect == "□",</code>
|
1765
|
+
</li>
|
1766
|
+
|
1767
|
+
<li class="never" data-hits="" data-linenumber="31">
|
1768
|
+
|
1769
|
+
|
1770
|
+
<code class="ruby"> "Expected empty tile to show □"</code>
|
1771
|
+
</li>
|
1772
|
+
|
1773
|
+
<li class="covered" data-hits="1" data-linenumber="32">
|
1774
|
+
<span class="hits">1</span>
|
1775
|
+
|
1776
|
+
<code class="ruby"> piece = BoardGame::Piece.new</code>
|
1777
|
+
</li>
|
1778
|
+
|
1779
|
+
<li class="covered" data-hits="1" data-linenumber="33">
|
1780
|
+
<span class="hits">1</span>
|
1781
|
+
|
1782
|
+
<code class="ruby"> tile << piece</code>
|
1783
|
+
</li>
|
1784
|
+
|
1785
|
+
<li class="covered" data-hits="1" data-linenumber="34">
|
1786
|
+
<span class="hits">1</span>
|
1787
|
+
|
1788
|
+
<code class="ruby"> assert tile.inspect == piece.inspect,</code>
|
1789
|
+
</li>
|
1790
|
+
|
1791
|
+
<li class="never" data-hits="" data-linenumber="35">
|
1792
|
+
|
1793
|
+
|
1794
|
+
<code class="ruby"> "Expected occupied tiles to show top piece when inspected."</code>
|
1795
|
+
</li>
|
1796
|
+
|
1797
|
+
<li class="never" data-hits="" data-linenumber="36">
|
1798
|
+
|
1799
|
+
|
1800
|
+
<code class="ruby"> end</code>
|
1801
|
+
</li>
|
1802
|
+
|
1803
|
+
<li class="never" data-hits="" data-linenumber="37">
|
1804
|
+
|
1805
|
+
|
1806
|
+
<code class="ruby"></code>
|
1807
|
+
</li>
|
1808
|
+
|
1809
|
+
<li class="covered" data-hits="1" data-linenumber="38">
|
1810
|
+
<span class="hits">1</span>
|
1811
|
+
|
1812
|
+
<code class="ruby"> def test_move_to</code>
|
1813
|
+
</li>
|
1814
|
+
|
1815
|
+
<li class="covered" data-hits="1" data-linenumber="39">
|
1816
|
+
<span class="hits">1</span>
|
1817
|
+
|
1818
|
+
<code class="ruby"> map = BoardGame::Map.new(2, 2)</code>
|
1819
|
+
</li>
|
1820
|
+
|
1821
|
+
<li class="covered" data-hits="1" data-linenumber="40">
|
1822
|
+
<span class="hits">1</span>
|
1823
|
+
|
1824
|
+
<code class="ruby"> tile = map[0, 0]</code>
|
1825
|
+
</li>
|
1826
|
+
|
1827
|
+
<li class="covered" data-hits="1" data-linenumber="41">
|
1828
|
+
<span class="hits">1</span>
|
1829
|
+
|
1830
|
+
<code class="ruby"> piece = BoardGame::Piece.new</code>
|
1831
|
+
</li>
|
1832
|
+
|
1833
|
+
<li class="covered" data-hits="1" data-linenumber="42">
|
1834
|
+
<span class="hits">1</span>
|
1835
|
+
|
1836
|
+
<code class="ruby"> tile << piece</code>
|
1837
|
+
</li>
|
1838
|
+
|
1839
|
+
<li class="covered" data-hits="1" data-linenumber="43">
|
1840
|
+
<span class="hits">1</span>
|
1841
|
+
|
1842
|
+
<code class="ruby"> assert piece.tile == tile</code>
|
1843
|
+
</li>
|
1844
|
+
|
1845
|
+
<li class="covered" data-hits="1" data-linenumber="44">
|
1846
|
+
<span class="hits">1</span>
|
1847
|
+
|
1848
|
+
<code class="ruby"> assert tile.x == 0</code>
|
1849
|
+
</li>
|
1850
|
+
|
1851
|
+
<li class="covered" data-hits="1" data-linenumber="45">
|
1852
|
+
<span class="hits">1</span>
|
1853
|
+
|
1854
|
+
<code class="ruby"> assert tile.y == 0</code>
|
1855
|
+
</li>
|
1856
|
+
|
1857
|
+
<li class="covered" data-hits="1" data-linenumber="46">
|
1858
|
+
<span class="hits">1</span>
|
1859
|
+
|
1860
|
+
<code class="ruby"> assert tile.map == map</code>
|
1861
|
+
</li>
|
1862
|
+
|
1863
|
+
<li class="covered" data-hits="1" data-linenumber="47">
|
1864
|
+
<span class="hits">1</span>
|
1865
|
+
|
1866
|
+
<code class="ruby"> new_map = BoardGame::Map.new(2, 2)</code>
|
1867
|
+
</li>
|
1868
|
+
|
1869
|
+
<li class="covered" data-hits="1" data-linenumber="48">
|
1870
|
+
<span class="hits">1</span>
|
1871
|
+
|
1872
|
+
<code class="ruby"> tile.move_to(1, 1, new_map)</code>
|
1873
|
+
</li>
|
1874
|
+
|
1875
|
+
<li class="covered" data-hits="1" data-linenumber="49">
|
1876
|
+
<span class="hits">1</span>
|
1877
|
+
|
1878
|
+
<code class="ruby"> assert piece.tile == tile</code>
|
1879
|
+
</li>
|
1880
|
+
|
1881
|
+
<li class="covered" data-hits="1" data-linenumber="50">
|
1882
|
+
<span class="hits">1</span>
|
1883
|
+
|
1884
|
+
<code class="ruby"> assert tile.x == 1</code>
|
1885
|
+
</li>
|
1886
|
+
|
1887
|
+
<li class="covered" data-hits="1" data-linenumber="51">
|
1888
|
+
<span class="hits">1</span>
|
1889
|
+
|
1890
|
+
<code class="ruby"> assert tile.y == 1</code>
|
1891
|
+
</li>
|
1892
|
+
|
1893
|
+
<li class="covered" data-hits="1" data-linenumber="52">
|
1894
|
+
<span class="hits">1</span>
|
1895
|
+
|
1896
|
+
<code class="ruby"> assert tile.map == new_map</code>
|
1897
|
+
</li>
|
1898
|
+
|
1899
|
+
<li class="covered" data-hits="1" data-linenumber="53">
|
1900
|
+
<span class="hits">1</span>
|
1901
|
+
|
1902
|
+
<code class="ruby"> assert_raises RuntimeError do</code>
|
1903
|
+
</li>
|
1904
|
+
|
1905
|
+
<li class="covered" data-hits="1" data-linenumber="54">
|
1906
|
+
<span class="hits">1</span>
|
1907
|
+
|
1908
|
+
<code class="ruby"> tile.move_to(2, 2)</code>
|
1909
|
+
</li>
|
1910
|
+
|
1911
|
+
<li class="never" data-hits="" data-linenumber="55">
|
1912
|
+
|
1913
|
+
|
1914
|
+
<code class="ruby"> end </code>
|
1915
|
+
</li>
|
1916
|
+
|
1917
|
+
<li class="never" data-hits="" data-linenumber="56">
|
1918
|
+
|
1919
|
+
|
1920
|
+
<code class="ruby"> end</code>
|
1921
|
+
</li>
|
1922
|
+
|
1923
|
+
<li class="never" data-hits="" data-linenumber="57">
|
1924
|
+
|
1925
|
+
|
1460
1926
|
<code class="ruby">end</code>
|
1461
1927
|
</li>
|
1462
1928
|
|