sashite-ggn 0.1.0 → 0.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (84) hide show
  1. checksums.yaml +5 -5
  2. data/LICENSE.md +17 -18
  3. data/README.md +356 -506
  4. data/lib/sashite/ggn/piece/source/destination/engine/transition.rb +90 -0
  5. data/lib/sashite/ggn/piece/source/destination/engine.rb +407 -0
  6. data/lib/sashite/ggn/piece/source/destination.rb +65 -0
  7. data/lib/sashite/ggn/piece/source.rb +71 -0
  8. data/lib/sashite/ggn/piece.rb +77 -0
  9. data/lib/sashite/ggn/schema.rb +152 -0
  10. data/lib/sashite/ggn/validation_error.rb +31 -0
  11. data/lib/sashite/ggn.rb +317 -5
  12. data/lib/sashite-ggn.rb +112 -1
  13. metadata +31 -151
  14. data/.gitignore +0 -22
  15. data/.ruby-version +0 -1
  16. data/.travis.yml +0 -3
  17. data/Gemfile +0 -2
  18. data/Rakefile +0 -7
  19. data/VERSION.semver +0 -1
  20. data/lib/sashite/ggn/ability.rb +0 -29
  21. data/lib/sashite/ggn/actor.rb +0 -20
  22. data/lib/sashite/ggn/ally.rb +0 -20
  23. data/lib/sashite/ggn/area.rb +0 -17
  24. data/lib/sashite/ggn/attacked.rb +0 -20
  25. data/lib/sashite/ggn/boolean.rb +0 -17
  26. data/lib/sashite/ggn/digit.rb +0 -20
  27. data/lib/sashite/ggn/digit_excluding_zero.rb +0 -17
  28. data/lib/sashite/ggn/direction.rb +0 -19
  29. data/lib/sashite/ggn/gameplay.rb +0 -20
  30. data/lib/sashite/ggn/gameplay_into_base64.rb +0 -21
  31. data/lib/sashite/ggn/integer.rb +0 -20
  32. data/lib/sashite/ggn/last_moved_actor.rb +0 -20
  33. data/lib/sashite/ggn/maximum_magnitude.rb +0 -20
  34. data/lib/sashite/ggn/name.rb +0 -17
  35. data/lib/sashite/ggn/negative_integer.rb +0 -19
  36. data/lib/sashite/ggn/null.rb +0 -21
  37. data/lib/sashite/ggn/object.rb +0 -28
  38. data/lib/sashite/ggn/occupied.rb +0 -29
  39. data/lib/sashite/ggn/pattern.rb +0 -20
  40. data/lib/sashite/ggn/previous_moves_counter.rb +0 -20
  41. data/lib/sashite/ggn/promotable_into_actors.rb +0 -23
  42. data/lib/sashite/ggn/required.rb +0 -19
  43. data/lib/sashite/ggn/self.rb +0 -21
  44. data/lib/sashite/ggn/square.rb +0 -29
  45. data/lib/sashite/ggn/state.rb +0 -26
  46. data/lib/sashite/ggn/subject.rb +0 -29
  47. data/lib/sashite/ggn/unsigned_integer.rb +0 -20
  48. data/lib/sashite/ggn/unsigned_integer_excluding_zero.rb +0 -20
  49. data/lib/sashite/ggn/verb.rb +0 -33
  50. data/lib/sashite/ggn/zero.rb +0 -21
  51. data/sashite-ggn.gemspec +0 -19
  52. data/test/_test_helper.rb +0 -2
  53. data/test/test_ggn.rb +0 -552
  54. data/test/test_ggn_ability.rb +0 -51
  55. data/test/test_ggn_actor.rb +0 -571
  56. data/test/test_ggn_ally.rb +0 -35
  57. data/test/test_ggn_area.rb +0 -21
  58. data/test/test_ggn_attacked.rb +0 -35
  59. data/test/test_ggn_boolean.rb +0 -21
  60. data/test/test_ggn_digit.rb +0 -21
  61. data/test/test_ggn_digit_excluding_zero.rb +0 -21
  62. data/test/test_ggn_direction.rb +0 -21
  63. data/test/test_ggn_gameplay.rb +0 -557
  64. data/test/test_ggn_gameplay_into_base64.rb +0 -555
  65. data/test/test_ggn_integer.rb +0 -39
  66. data/test/test_ggn_last_moved_actor.rb +0 -35
  67. data/test/test_ggn_maximum_magnitude.rb +0 -39
  68. data/test/test_ggn_name.rb +0 -21
  69. data/test/test_ggn_negative_integer.rb +0 -21
  70. data/test/test_ggn_null.rb +0 -21
  71. data/test/test_ggn_object.rb +0 -33
  72. data/test/test_ggn_occupied.rb +0 -78
  73. data/test/test_ggn_pattern.rb +0 -84
  74. data/test/test_ggn_previous_moves_counter.rb +0 -39
  75. data/test/test_ggn_promotable_into_actors.rb +0 -578
  76. data/test/test_ggn_required.rb +0 -21
  77. data/test/test_ggn_self.rb +0 -21
  78. data/test/test_ggn_square.rb +0 -25
  79. data/test/test_ggn_state.rb +0 -24
  80. data/test/test_ggn_subject.rb +0 -28
  81. data/test/test_ggn_unsigned_integer.rb +0 -39
  82. data/test/test_ggn_unsigned_integer_excluding_zero.rb +0 -25
  83. data/test/test_ggn_verb.rb +0 -27
  84. data/test/test_ggn_zero.rb +0 -21
@@ -1,578 +0,0 @@
1
- require_relative '_test_helper'
2
-
3
- describe Sashite::GGN::PromotableIntoActors do
4
- subject { Sashite::GGN::PromotableIntoActors }
5
-
6
- describe '.load' do
7
- describe 'gameplay into base64 and self' do
8
- before do
9
- @ggn_obj = 'dDxzZWxmPl8mX15yZW1vdmVbLTEsMF0xL3Q9X0BmK2FsbH5fQGFuX2VuZW15X2FjdG9yK2FsbCVzZWxm' +
10
- 'LiB0PHNlbGY+XyZfXnJlbW92ZVswLC0xXTEvdD1fQGYrYWxsfl9AYW5fZW5lbXlfYWN0b3IrYWxsJXNl' +
11
- 'bGYuIHQ8c2VsZj5fJl9ecmVtb3ZlWzAsMV0xL3Q9X0BmK2FsbH5fQGFuX2VuZW15X2FjdG9yK2FsbCVz' +
12
- 'ZWxmLiB0PHNlbGY+XyZfXnJlbW92ZVsxLDBdMS90PV9AZithbGx+X0Bhbl9lbmVteV9hY3RvcithbGwl' +
13
- 'c2VsZi4gdDxzZWxmPl8mX15zaGlmdFstMSwwXV8vdD1fQGYrYWxsfl9AZithbGwlc2VsZi4gdDxzZWxm' +
14
- 'Pl8mX15zaGlmdFstMSwwXV8vdD1fQGYrYWxsfl9AZithbGwlc2VsZjsgdDxzZWxmPl8mX15yZW1vdmVb' +
15
- 'LTEsMF0xL3Q9X0BmK2FsbH5fQGFuX2VuZW15X2FjdG9yK2FsbCVzZWxmLiB0PHNlbGY+XyZfXnNoaWZ0' +
16
- 'WzAsLTFdXy90PV9AZithbGx+X0BmK2FsbCVzZWxmLiB0PHNlbGY+XyZfXnNoaWZ0WzAsLTFdXy90PV9A' +
17
- 'ZithbGx+X0BmK2FsbCVzZWxmOyB0PHNlbGY+XyZfXnJlbW92ZVswLC0xXTEvdD1fQGYrYWxsfl9AYW5f' +
18
- 'ZW5lbXlfYWN0b3IrYWxsJXNlbGYuIHQ8c2VsZj5fJl9ec2hpZnRbMCwxXV8vdD1fQGYrYWxsfl9AZith' +
19
- 'bGwlc2VsZi4gdDxzZWxmPl8mX15zaGlmdFswLDFdXy90PV9AZithbGx+X0BmK2FsbCVzZWxmOyB0PHNl' +
20
- 'bGY+XyZfXnJlbW92ZVswLDFdMS90PV9AZithbGx+X0Bhbl9lbmVteV9hY3RvcithbGwlc2VsZi4gdDxz' +
21
- 'ZWxmPl8mX15zaGlmdFsxLDBdXy90PV9AZithbGx+X0BmK2FsbCVzZWxmLiB0PHNlbGY+XyZfXnNoaWZ0' +
22
- 'WzEsMF1fL3Q9X0BmK2FsbH5fQGYrYWxsJXNlbGY7IHQ8c2VsZj5fJl9ecmVtb3ZlWzEsMF0xL3Q9X0Bm' +
23
- 'K2FsbH5fQGFuX2VuZW15X2FjdG9yK2FsbCVzZWxmLg==,self'
24
- end
25
-
26
- it 'loads a document from the current io stream' do
27
- subject.load(@ggn_obj).hash.must_equal [
28
- [
29
- [
30
- {
31
- :"subject" => {
32
- :"...ally?" => true,
33
- :"actor" => :self,
34
- :"state" => {
35
- :"...last_moved_actor?" => nil,
36
- :"...previous_moves_counter" => nil
37
- }
38
- },
39
-
40
- :"verb" => {
41
- :"name" => :remove,
42
- :"vector" => {:"...maximum_magnitude" => 1, direction: [-1,0]}
43
- },
44
-
45
- :"object" => {
46
- :"src_square" => {
47
- :"...attacked?" => nil,
48
- :"...occupied!" => false,
49
- :"area" => :all
50
- },
51
- :"dst_square" => {
52
- :"...attacked?" => nil,
53
- :"...occupied!" => :an_enemy_actor,
54
- :"area" => :all
55
- },
56
- :"promotable_into_actors" => [:self]
57
- }
58
- }
59
- ],
60
-
61
-
62
-
63
- [
64
- {
65
- :"subject" => {
66
- :"...ally?" => true,
67
- :"actor" => :self,
68
- :"state" => {
69
- :"...last_moved_actor?" => nil,
70
- :"...previous_moves_counter" => nil
71
- }
72
- },
73
-
74
- :"verb" => {
75
- :"name" => :remove,
76
- :"vector" => {:"...maximum_magnitude" => 1, direction: [0,-1]}
77
- },
78
-
79
- :"object" => {
80
- :"src_square" => {
81
- :"...attacked?" => nil,
82
- :"...occupied!" => false,
83
- :"area" => :all
84
- },
85
- :"dst_square" => {
86
- :"...attacked?" => nil,
87
- :"...occupied!" => :an_enemy_actor,
88
- :"area" => :all
89
- },
90
- :"promotable_into_actors" => [:self]
91
- }
92
- }
93
- ],
94
-
95
-
96
-
97
- [
98
- {
99
- :"subject" => {
100
- :"...ally?" => true,
101
- :"actor" => :self,
102
- :"state" => {
103
- :"...last_moved_actor?" => nil,
104
- :"...previous_moves_counter" => nil
105
- }
106
- },
107
-
108
- :"verb" => {
109
- :"name" => :remove,
110
- :"vector" => {:"...maximum_magnitude" => 1, direction: [0,1]}
111
- },
112
-
113
- :"object" => {
114
- :"src_square" => {
115
- :"...attacked?" => nil,
116
- :"...occupied!" => false,
117
- :"area" => :all
118
- },
119
- :"dst_square" => {
120
- :"...attacked?" => nil,
121
- :"...occupied!" => :an_enemy_actor,
122
- :"area" => :all
123
- },
124
- :"promotable_into_actors" => [:self]
125
- }
126
- }
127
- ],
128
-
129
-
130
-
131
- [
132
- {
133
- :"subject" => {
134
- :"...ally?" => true,
135
- :"actor" => :self,
136
- :"state" => {
137
- :"...last_moved_actor?" => nil,
138
- :"...previous_moves_counter" => nil
139
- }
140
- },
141
-
142
- :"verb" => {
143
- :"name" => :remove,
144
- :"vector" => {:"...maximum_magnitude" => 1, direction: [1,0]}
145
- },
146
-
147
- :"object" => {
148
- :"src_square" => {
149
- :"...attacked?" => nil,
150
- :"...occupied!" => false,
151
- :"area" => :all
152
- },
153
- :"dst_square" => {
154
- :"...attacked?" => nil,
155
- :"...occupied!" => :an_enemy_actor,
156
- :"area" => :all
157
- },
158
- :"promotable_into_actors" => [:self]
159
- }
160
- }
161
- ],
162
-
163
-
164
-
165
- [
166
- {
167
- :"subject" => {
168
- :"...ally?" => true,
169
- :"actor" => :self,
170
- :"state" => {
171
- :"...last_moved_actor?" => nil,
172
- :"...previous_moves_counter" => nil
173
- }
174
- },
175
-
176
- :"verb" => {
177
- :"name" => :shift,
178
- :"vector" => {:"...maximum_magnitude" => nil, direction: [-1,0]}
179
- },
180
-
181
- :"object" => {
182
- :"src_square" => {
183
- :"...attacked?" => nil,
184
- :"...occupied!" => false,
185
- :"area" => :all
186
- },
187
- :"dst_square" => {
188
- :"...attacked?" => nil,
189
- :"...occupied!" => false,
190
- :"area" => :all
191
- },
192
- :"promotable_into_actors" => [:self]
193
- }
194
- }
195
- ],
196
-
197
-
198
-
199
- [
200
- {
201
- :"subject" => {
202
- :"...ally?" => true,
203
- :"actor" => :self,
204
- :"state" => {
205
- :"...last_moved_actor?" => nil,
206
- :"...previous_moves_counter" => nil
207
- }
208
- },
209
-
210
- :"verb" => {
211
- :"name" => :shift,
212
- :"vector" => {:"...maximum_magnitude" => nil, direction: [-1,0]}
213
- },
214
-
215
- :"object" => {
216
- :"src_square" => {
217
- :"...attacked?" => nil,
218
- :"...occupied!" => false,
219
- :"area" => :all
220
- },
221
- :"dst_square" => {
222
- :"...attacked?" => nil,
223
- :"...occupied!" => false,
224
- :"area" => :all
225
- },
226
- :"promotable_into_actors" => [:self]
227
- }
228
- },
229
- {
230
- :"subject" => {
231
- :"...ally?" => true,
232
- :"actor" => :self,
233
- :"state" => {
234
- :"...last_moved_actor?" => nil,
235
- :"...previous_moves_counter" => nil
236
- }
237
- },
238
-
239
- :"verb" => {
240
- :"name" => :remove,
241
- :"vector" => {:"...maximum_magnitude" => 1, direction: [-1,0]}
242
- },
243
-
244
- :"object" => {
245
- :"src_square" => {
246
- :"...attacked?" => nil,
247
- :"...occupied!" => false,
248
- :"area" => :all
249
- },
250
- :"dst_square" => {
251
- :"...attacked?" => nil,
252
- :"...occupied!" => :an_enemy_actor,
253
- :"area" => :all
254
- },
255
- :"promotable_into_actors" => [:self]
256
- }
257
- }
258
- ],
259
-
260
-
261
-
262
- [
263
- {
264
- :"subject" => {
265
- :"...ally?" => true,
266
- :"actor" => :self,
267
- :"state" => {
268
- :"...last_moved_actor?" => nil,
269
- :"...previous_moves_counter" => nil
270
- }
271
- },
272
-
273
- :"verb" => {
274
- :"name" => :shift,
275
- :"vector" => {:"...maximum_magnitude" => nil, direction: [0,-1]}
276
- },
277
-
278
- :"object" => {
279
- :"src_square" => {
280
- :"...attacked?" => nil,
281
- :"...occupied!" => false,
282
- :"area" => :all
283
- },
284
- :"dst_square" => {
285
- :"...attacked?" => nil,
286
- :"...occupied!" => false,
287
- :"area" => :all
288
- },
289
- :"promotable_into_actors" => [:self]
290
- }
291
- }
292
- ],
293
-
294
-
295
-
296
- [
297
- {
298
- :"subject" => {
299
- :"...ally?" => true,
300
- :"actor" => :self,
301
- :"state" => {
302
- :"...last_moved_actor?" => nil,
303
- :"...previous_moves_counter" => nil
304
- }
305
- },
306
-
307
- :"verb" => {
308
- :"name" => :shift,
309
- :"vector" => {:"...maximum_magnitude" => nil, direction: [0,-1]}
310
- },
311
-
312
- :"object" => {
313
- :"src_square" => {
314
- :"...attacked?" => nil,
315
- :"...occupied!" => false,
316
- :"area" => :all
317
- },
318
- :"dst_square" => {
319
- :"...attacked?" => nil,
320
- :"...occupied!" => false,
321
- :"area" => :all
322
- },
323
- :"promotable_into_actors" => [:self]
324
- }
325
- },
326
- {
327
- :"subject" => {
328
- :"...ally?" => true,
329
- :"actor" => :self,
330
- :"state" => {
331
- :"...last_moved_actor?" => nil,
332
- :"...previous_moves_counter" => nil
333
- }
334
- },
335
-
336
- :"verb" => {
337
- :"name" => :remove,
338
- :"vector" => {:"...maximum_magnitude" => 1, direction: [0,-1]}
339
- },
340
-
341
- :"object" => {
342
- :"src_square" => {
343
- :"...attacked?" => nil,
344
- :"...occupied!" => false,
345
- :"area" => :all
346
- },
347
- :"dst_square" => {
348
- :"...attacked?" => nil,
349
- :"...occupied!" => :an_enemy_actor,
350
- :"area" => :all
351
- },
352
- :"promotable_into_actors" => [:self]
353
- }
354
- }
355
- ],
356
-
357
-
358
-
359
- [
360
- {
361
- :"subject" => {
362
- :"...ally?" => true,
363
- :"actor" => :self,
364
- :"state" => {
365
- :"...last_moved_actor?" => nil,
366
- :"...previous_moves_counter" => nil
367
- }
368
- },
369
-
370
- :"verb" => {
371
- :"name" => :shift,
372
- :"vector" => {:"...maximum_magnitude" => nil, direction: [0,1]}
373
- },
374
-
375
- :"object" => {
376
- :"src_square" => {
377
- :"...attacked?" => nil,
378
- :"...occupied!" => false,
379
- :"area" => :all
380
- },
381
- :"dst_square" => {
382
- :"...attacked?" => nil,
383
- :"...occupied!" => false,
384
- :"area" => :all
385
- },
386
- :"promotable_into_actors" => [:self]
387
- }
388
- }
389
- ],
390
-
391
-
392
-
393
- [
394
- {
395
- :"subject" => {
396
- :"...ally?" => true,
397
- :"actor" => :self,
398
- :"state" => {
399
- :"...last_moved_actor?" => nil,
400
- :"...previous_moves_counter" => nil
401
- }
402
- },
403
-
404
- :"verb" => {
405
- :"name" => :shift,
406
- :"vector" => {:"...maximum_magnitude" => nil, direction: [0,1]}
407
- },
408
-
409
- :"object" => {
410
- :"src_square" => {
411
- :"...attacked?" => nil,
412
- :"...occupied!" => false,
413
- :"area" => :all
414
- },
415
- :"dst_square" => {
416
- :"...attacked?" => nil,
417
- :"...occupied!" => false,
418
- :"area" => :all
419
- },
420
- :"promotable_into_actors" => [:self]
421
- }
422
- },
423
- {
424
- :"subject" => {
425
- :"...ally?" => true,
426
- :"actor" => :self,
427
- :"state" => {
428
- :"...last_moved_actor?" => nil,
429
- :"...previous_moves_counter" => nil
430
- }
431
- },
432
-
433
- :"verb" => {
434
- :"name" => :remove,
435
- :"vector" => {:"...maximum_magnitude" => 1, direction: [0,1]}
436
- },
437
-
438
- :"object" => {
439
- :"src_square" => {
440
- :"...attacked?" => nil,
441
- :"...occupied!" => false,
442
- :"area" => :all
443
- },
444
- :"dst_square" => {
445
- :"...attacked?" => nil,
446
- :"...occupied!" => :an_enemy_actor,
447
- :"area" => :all
448
- },
449
- :"promotable_into_actors" => [:self]
450
- }
451
- }
452
- ],
453
-
454
-
455
-
456
- [
457
- {
458
- :"subject" => {
459
- :"...ally?" => true,
460
- :"actor" => :self,
461
- :"state" => {
462
- :"...last_moved_actor?" => nil,
463
- :"...previous_moves_counter" => nil
464
- }
465
- },
466
-
467
- :"verb" => {
468
- :"name" => :shift,
469
- :"vector" => {:"...maximum_magnitude" => nil, direction: [1,0]}
470
- },
471
-
472
- :"object" => {
473
- :"src_square" => {
474
- :"...attacked?" => nil,
475
- :"...occupied!" => false,
476
- :"area" => :all
477
- },
478
- :"dst_square" => {
479
- :"...attacked?" => nil,
480
- :"...occupied!" => false,
481
- :"area" => :all
482
- },
483
- :"promotable_into_actors" => [:self]
484
- }
485
- }
486
- ],
487
-
488
-
489
-
490
- [
491
- {
492
- :"subject" => {
493
- :"...ally?" => true,
494
- :"actor" => :self,
495
- :"state" => {
496
- :"...last_moved_actor?" => nil,
497
- :"...previous_moves_counter" => nil
498
- }
499
- },
500
-
501
- :"verb" => {
502
- :"name" => :shift,
503
- :"vector" => {:"...maximum_magnitude" => nil, direction: [1,0]}
504
- },
505
-
506
- :"object" => {
507
- :"src_square" => {
508
- :"...attacked?" => nil,
509
- :"...occupied!" => false,
510
- :"area" => :all
511
- },
512
- :"dst_square" => {
513
- :"...attacked?" => nil,
514
- :"...occupied!" => false,
515
- :"area" => :all
516
- },
517
- :"promotable_into_actors" => [:self]
518
- }
519
- },
520
- {
521
- :"subject" => {
522
- :"...ally?" => true,
523
- :"actor" => :self,
524
- :"state" => {
525
- :"...last_moved_actor?" => nil,
526
- :"...previous_moves_counter" => nil
527
- }
528
- },
529
-
530
- :"verb" => {
531
- :"name" => :remove,
532
- :"vector" => {:"...maximum_magnitude" => 1, direction: [1,0]}
533
- },
534
-
535
- :"object" => {
536
- :"src_square" => {
537
- :"...attacked?" => nil,
538
- :"...occupied!" => false,
539
- :"area" => :all
540
- },
541
- :"dst_square" => {
542
- :"...attacked?" => nil,
543
- :"...occupied!" => :an_enemy_actor,
544
- :"area" => :all
545
- },
546
- :"promotable_into_actors" => [:self]
547
- }
548
- }
549
- ]
550
- ],
551
- :self
552
- ].hash
553
- end
554
-
555
- describe 'errors' do
556
- it 'raises without a collection of actors' do
557
- -> { subject.load 'foobar' }.must_raise ArgumentError
558
- end
559
- end
560
- end
561
-
562
- describe 'self' do
563
- before do
564
- @ggn_obj = 'self'
565
- end
566
-
567
- it 'loads a document from the current io stream' do
568
- subject.load(@ggn_obj).must_equal [ :self ]
569
- end
570
-
571
- describe 'errors' do
572
- it 'raises with more than one self' do
573
- -> { subject.load 'self,self' }.must_raise ArgumentError
574
- end
575
- end
576
- end
577
- end
578
- end
@@ -1,21 +0,0 @@
1
- require_relative '_test_helper'
2
-
3
- describe Sashite::GGN::Required do
4
- subject { Sashite::GGN::Required }
5
-
6
- describe '.load' do
7
- before do
8
- @ggn_obj = 't'
9
- end
10
-
11
- it 'loads a document from the current io stream' do
12
- subject.load(@ggn_obj).must_equal true
13
- end
14
-
15
- describe 'errors' do
16
- it 'raises without a boolean' do
17
- -> { subject.load 'foobar' }.must_raise ArgumentError
18
- end
19
- end
20
- end
21
- end
@@ -1,21 +0,0 @@
1
- require_relative '_test_helper'
2
-
3
- describe Sashite::GGN::Self do
4
- subject { Sashite::GGN::Self }
5
-
6
- describe '.load' do
7
- before do
8
- @ggn_obj = 'self'
9
- end
10
-
11
- it 'loads a document from the current io stream' do
12
- subject.load(@ggn_obj).must_equal :self
13
- end
14
-
15
- describe 'errors' do
16
- it 'raises without self' do
17
- -> { subject.load '42' }.must_raise ArgumentError
18
- end
19
- end
20
- end
21
- end
@@ -1,25 +0,0 @@
1
- require_relative '_test_helper'
2
-
3
- describe Sashite::GGN::Square do
4
- subject { Sashite::GGN::Square }
5
-
6
- describe '.load' do
7
- before do
8
- @ggn_obj = '_@an_enemy_actor+all'
9
- end
10
-
11
- it 'loads a document from the current io stream' do
12
- subject.load(@ggn_obj).hash.must_equal({
13
- :"...attacked?" => nil,
14
- :"...occupied!" => :an_enemy_actor,
15
- :"area" => :all
16
- }.hash)
17
- end
18
-
19
- describe 'errors' do
20
- it 'raises witout a square' do
21
- -> { subject.load 'foobar' }.must_raise ArgumentError
22
- end
23
- end
24
- end
25
- end
@@ -1,24 +0,0 @@
1
- require_relative '_test_helper'
2
-
3
- describe Sashite::GGN::State do
4
- subject { Sashite::GGN::State }
5
-
6
- describe '.load' do
7
- before do
8
- @ggn_obj = 't&_'
9
- end
10
-
11
- it 'loads a document from the current io stream' do
12
- subject.load(@ggn_obj).hash.must_equal({
13
- :"...last_moved_actor?" => true,
14
- :"...previous_moves_counter" => nil
15
- }.hash)
16
- end
17
-
18
- describe 'errors' do
19
- it 'raises without a state' do
20
- -> { subject.load 'foobar' }.must_raise ArgumentError
21
- end
22
- end
23
- end
24
- end
@@ -1,28 +0,0 @@
1
- require_relative '_test_helper'
2
-
3
- describe Sashite::GGN::Subject do
4
- subject { Sashite::GGN::Subject }
5
-
6
- describe '.load' do
7
- before do
8
- @ggn_obj = 't<self>_&_'
9
- end
10
-
11
- it 'loads a document from the current io stream' do
12
- subject.load(@ggn_obj).hash.must_equal({
13
- :"...ally?" => true,
14
- :"actor" => :self,
15
- :"state" => {
16
- :"...last_moved_actor?" => nil,
17
- :"...previous_moves_counter" => nil
18
- }
19
- }.hash)
20
- end
21
-
22
- describe 'errors' do
23
- it 'raises without a subject' do
24
- -> { subject.load 'foobar' }.must_raise ArgumentError
25
- end
26
- end
27
- end
28
- end