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,555 +0,0 @@
1
- require_relative '_test_helper'
2
-
3
- describe Sashite::GGN::GameplayIntoBase64 do
4
- subject { Sashite::GGN::GameplayIntoBase64 }
5
-
6
- describe '.load' do
7
- before do
8
- @ggn_obj = 'dDxzZWxmPl8mX15yZW1vdmVbLTEsMF0xL3Q9X0BmK2FsbH5fQGFuX2VuZW15X2FjdG9yK2FsbCVzZWxm' +
9
- 'LiB0PHNlbGY+XyZfXnJlbW92ZVswLC0xXTEvdD1fQGYrYWxsfl9AYW5fZW5lbXlfYWN0b3IrYWxsJXNl' +
10
- 'bGYuIHQ8c2VsZj5fJl9ecmVtb3ZlWzAsMV0xL3Q9X0BmK2FsbH5fQGFuX2VuZW15X2FjdG9yK2FsbCVz' +
11
- 'ZWxmLiB0PHNlbGY+XyZfXnJlbW92ZVsxLDBdMS90PV9AZithbGx+X0Bhbl9lbmVteV9hY3RvcithbGwl' +
12
- 'c2VsZi4gdDxzZWxmPl8mX15zaGlmdFstMSwwXV8vdD1fQGYrYWxsfl9AZithbGwlc2VsZi4gdDxzZWxm' +
13
- 'Pl8mX15zaGlmdFstMSwwXV8vdD1fQGYrYWxsfl9AZithbGwlc2VsZjsgdDxzZWxmPl8mX15yZW1vdmVb' +
14
- 'LTEsMF0xL3Q9X0BmK2FsbH5fQGFuX2VuZW15X2FjdG9yK2FsbCVzZWxmLiB0PHNlbGY+XyZfXnNoaWZ0' +
15
- 'WzAsLTFdXy90PV9AZithbGx+X0BmK2FsbCVzZWxmLiB0PHNlbGY+XyZfXnNoaWZ0WzAsLTFdXy90PV9A' +
16
- 'ZithbGx+X0BmK2FsbCVzZWxmOyB0PHNlbGY+XyZfXnJlbW92ZVswLC0xXTEvdD1fQGYrYWxsfl9AYW5f' +
17
- 'ZW5lbXlfYWN0b3IrYWxsJXNlbGYuIHQ8c2VsZj5fJl9ec2hpZnRbMCwxXV8vdD1fQGYrYWxsfl9AZith' +
18
- 'bGwlc2VsZi4gdDxzZWxmPl8mX15zaGlmdFswLDFdXy90PV9AZithbGx+X0BmK2FsbCVzZWxmOyB0PHNl' +
19
- 'bGY+XyZfXnJlbW92ZVswLDFdMS90PV9AZithbGx+X0Bhbl9lbmVteV9hY3RvcithbGwlc2VsZi4gdDxz' +
20
- 'ZWxmPl8mX15zaGlmdFsxLDBdXy90PV9AZithbGx+X0BmK2FsbCVzZWxmLiB0PHNlbGY+XyZfXnNoaWZ0' +
21
- 'WzEsMF1fL3Q9X0BmK2FsbH5fQGYrYWxsJXNlbGY7IHQ8c2VsZj5fJl9ecmVtb3ZlWzEsMF0xL3Q9X0Bm' +
22
- 'K2FsbH5fQGFuX2VuZW15X2FjdG9yK2FsbCVzZWxmLg=='
23
- end
24
-
25
- it 'loads a document from the current io stream' do
26
- subject.load(@ggn_obj).hash.must_equal [
27
- [
28
- {
29
- :"subject" => {
30
- :"...ally?" => true,
31
- :"actor" => :self,
32
- :"state" => {
33
- :"...last_moved_actor?" => nil,
34
- :"...previous_moves_counter" => nil
35
- }
36
- },
37
-
38
- :"verb" => {
39
- :"name" => :remove,
40
- :"vector" => {:"...maximum_magnitude" => 1, direction: [-1,0]}
41
- },
42
-
43
- :"object" => {
44
- :"src_square" => {
45
- :"...attacked?" => nil,
46
- :"...occupied!" => false,
47
- :"area" => :all
48
- },
49
- :"dst_square" => {
50
- :"...attacked?" => nil,
51
- :"...occupied!" => :an_enemy_actor,
52
- :"area" => :all
53
- },
54
- :"promotable_into_actors" => [:self]
55
- }
56
- }
57
- ],
58
-
59
-
60
-
61
- [
62
- {
63
- :"subject" => {
64
- :"...ally?" => true,
65
- :"actor" => :self,
66
- :"state" => {
67
- :"...last_moved_actor?" => nil,
68
- :"...previous_moves_counter" => nil
69
- }
70
- },
71
-
72
- :"verb" => {
73
- :"name" => :remove,
74
- :"vector" => {:"...maximum_magnitude" => 1, direction: [0,-1]}
75
- },
76
-
77
- :"object" => {
78
- :"src_square" => {
79
- :"...attacked?" => nil,
80
- :"...occupied!" => false,
81
- :"area" => :all
82
- },
83
- :"dst_square" => {
84
- :"...attacked?" => nil,
85
- :"...occupied!" => :an_enemy_actor,
86
- :"area" => :all
87
- },
88
- :"promotable_into_actors" => [:self]
89
- }
90
- }
91
- ],
92
-
93
-
94
-
95
- [
96
- {
97
- :"subject" => {
98
- :"...ally?" => true,
99
- :"actor" => :self,
100
- :"state" => {
101
- :"...last_moved_actor?" => nil,
102
- :"...previous_moves_counter" => nil
103
- }
104
- },
105
-
106
- :"verb" => {
107
- :"name" => :remove,
108
- :"vector" => {:"...maximum_magnitude" => 1, direction: [0,1]}
109
- },
110
-
111
- :"object" => {
112
- :"src_square" => {
113
- :"...attacked?" => nil,
114
- :"...occupied!" => false,
115
- :"area" => :all
116
- },
117
- :"dst_square" => {
118
- :"...attacked?" => nil,
119
- :"...occupied!" => :an_enemy_actor,
120
- :"area" => :all
121
- },
122
- :"promotable_into_actors" => [:self]
123
- }
124
- }
125
- ],
126
-
127
-
128
-
129
- [
130
- {
131
- :"subject" => {
132
- :"...ally?" => true,
133
- :"actor" => :self,
134
- :"state" => {
135
- :"...last_moved_actor?" => nil,
136
- :"...previous_moves_counter" => nil
137
- }
138
- },
139
-
140
- :"verb" => {
141
- :"name" => :remove,
142
- :"vector" => {:"...maximum_magnitude" => 1, direction: [1,0]}
143
- },
144
-
145
- :"object" => {
146
- :"src_square" => {
147
- :"...attacked?" => nil,
148
- :"...occupied!" => false,
149
- :"area" => :all
150
- },
151
- :"dst_square" => {
152
- :"...attacked?" => nil,
153
- :"...occupied!" => :an_enemy_actor,
154
- :"area" => :all
155
- },
156
- :"promotable_into_actors" => [:self]
157
- }
158
- }
159
- ],
160
-
161
-
162
-
163
- [
164
- {
165
- :"subject" => {
166
- :"...ally?" => true,
167
- :"actor" => :self,
168
- :"state" => {
169
- :"...last_moved_actor?" => nil,
170
- :"...previous_moves_counter" => nil
171
- }
172
- },
173
-
174
- :"verb" => {
175
- :"name" => :shift,
176
- :"vector" => {:"...maximum_magnitude" => nil, direction: [-1,0]}
177
- },
178
-
179
- :"object" => {
180
- :"src_square" => {
181
- :"...attacked?" => nil,
182
- :"...occupied!" => false,
183
- :"area" => :all
184
- },
185
- :"dst_square" => {
186
- :"...attacked?" => nil,
187
- :"...occupied!" => false,
188
- :"area" => :all
189
- },
190
- :"promotable_into_actors" => [:self]
191
- }
192
- }
193
- ],
194
-
195
-
196
-
197
- [
198
- {
199
- :"subject" => {
200
- :"...ally?" => true,
201
- :"actor" => :self,
202
- :"state" => {
203
- :"...last_moved_actor?" => nil,
204
- :"...previous_moves_counter" => nil
205
- }
206
- },
207
-
208
- :"verb" => {
209
- :"name" => :shift,
210
- :"vector" => {:"...maximum_magnitude" => nil, direction: [-1,0]}
211
- },
212
-
213
- :"object" => {
214
- :"src_square" => {
215
- :"...attacked?" => nil,
216
- :"...occupied!" => false,
217
- :"area" => :all
218
- },
219
- :"dst_square" => {
220
- :"...attacked?" => nil,
221
- :"...occupied!" => false,
222
- :"area" => :all
223
- },
224
- :"promotable_into_actors" => [:self]
225
- }
226
- },
227
- {
228
- :"subject" => {
229
- :"...ally?" => true,
230
- :"actor" => :self,
231
- :"state" => {
232
- :"...last_moved_actor?" => nil,
233
- :"...previous_moves_counter" => nil
234
- }
235
- },
236
-
237
- :"verb" => {
238
- :"name" => :remove,
239
- :"vector" => {:"...maximum_magnitude" => 1, direction: [-1,0]}
240
- },
241
-
242
- :"object" => {
243
- :"src_square" => {
244
- :"...attacked?" => nil,
245
- :"...occupied!" => false,
246
- :"area" => :all
247
- },
248
- :"dst_square" => {
249
- :"...attacked?" => nil,
250
- :"...occupied!" => :an_enemy_actor,
251
- :"area" => :all
252
- },
253
- :"promotable_into_actors" => [:self]
254
- }
255
- }
256
- ],
257
-
258
-
259
-
260
- [
261
- {
262
- :"subject" => {
263
- :"...ally?" => true,
264
- :"actor" => :self,
265
- :"state" => {
266
- :"...last_moved_actor?" => nil,
267
- :"...previous_moves_counter" => nil
268
- }
269
- },
270
-
271
- :"verb" => {
272
- :"name" => :shift,
273
- :"vector" => {:"...maximum_magnitude" => nil, direction: [0,-1]}
274
- },
275
-
276
- :"object" => {
277
- :"src_square" => {
278
- :"...attacked?" => nil,
279
- :"...occupied!" => false,
280
- :"area" => :all
281
- },
282
- :"dst_square" => {
283
- :"...attacked?" => nil,
284
- :"...occupied!" => false,
285
- :"area" => :all
286
- },
287
- :"promotable_into_actors" => [:self]
288
- }
289
- }
290
- ],
291
-
292
-
293
-
294
- [
295
- {
296
- :"subject" => {
297
- :"...ally?" => true,
298
- :"actor" => :self,
299
- :"state" => {
300
- :"...last_moved_actor?" => nil,
301
- :"...previous_moves_counter" => nil
302
- }
303
- },
304
-
305
- :"verb" => {
306
- :"name" => :shift,
307
- :"vector" => {:"...maximum_magnitude" => nil, direction: [0,-1]}
308
- },
309
-
310
- :"object" => {
311
- :"src_square" => {
312
- :"...attacked?" => nil,
313
- :"...occupied!" => false,
314
- :"area" => :all
315
- },
316
- :"dst_square" => {
317
- :"...attacked?" => nil,
318
- :"...occupied!" => false,
319
- :"area" => :all
320
- },
321
- :"promotable_into_actors" => [:self]
322
- }
323
- },
324
- {
325
- :"subject" => {
326
- :"...ally?" => true,
327
- :"actor" => :self,
328
- :"state" => {
329
- :"...last_moved_actor?" => nil,
330
- :"...previous_moves_counter" => nil
331
- }
332
- },
333
-
334
- :"verb" => {
335
- :"name" => :remove,
336
- :"vector" => {:"...maximum_magnitude" => 1, direction: [0,-1]}
337
- },
338
-
339
- :"object" => {
340
- :"src_square" => {
341
- :"...attacked?" => nil,
342
- :"...occupied!" => false,
343
- :"area" => :all
344
- },
345
- :"dst_square" => {
346
- :"...attacked?" => nil,
347
- :"...occupied!" => :an_enemy_actor,
348
- :"area" => :all
349
- },
350
- :"promotable_into_actors" => [:self]
351
- }
352
- }
353
- ],
354
-
355
-
356
-
357
- [
358
- {
359
- :"subject" => {
360
- :"...ally?" => true,
361
- :"actor" => :self,
362
- :"state" => {
363
- :"...last_moved_actor?" => nil,
364
- :"...previous_moves_counter" => nil
365
- }
366
- },
367
-
368
- :"verb" => {
369
- :"name" => :shift,
370
- :"vector" => {:"...maximum_magnitude" => nil, direction: [0,1]}
371
- },
372
-
373
- :"object" => {
374
- :"src_square" => {
375
- :"...attacked?" => nil,
376
- :"...occupied!" => false,
377
- :"area" => :all
378
- },
379
- :"dst_square" => {
380
- :"...attacked?" => nil,
381
- :"...occupied!" => false,
382
- :"area" => :all
383
- },
384
- :"promotable_into_actors" => [:self]
385
- }
386
- }
387
- ],
388
-
389
-
390
-
391
- [
392
- {
393
- :"subject" => {
394
- :"...ally?" => true,
395
- :"actor" => :self,
396
- :"state" => {
397
- :"...last_moved_actor?" => nil,
398
- :"...previous_moves_counter" => nil
399
- }
400
- },
401
-
402
- :"verb" => {
403
- :"name" => :shift,
404
- :"vector" => {:"...maximum_magnitude" => nil, direction: [0,1]}
405
- },
406
-
407
- :"object" => {
408
- :"src_square" => {
409
- :"...attacked?" => nil,
410
- :"...occupied!" => false,
411
- :"area" => :all
412
- },
413
- :"dst_square" => {
414
- :"...attacked?" => nil,
415
- :"...occupied!" => false,
416
- :"area" => :all
417
- },
418
- :"promotable_into_actors" => [:self]
419
- }
420
- },
421
- {
422
- :"subject" => {
423
- :"...ally?" => true,
424
- :"actor" => :self,
425
- :"state" => {
426
- :"...last_moved_actor?" => nil,
427
- :"...previous_moves_counter" => nil
428
- }
429
- },
430
-
431
- :"verb" => {
432
- :"name" => :remove,
433
- :"vector" => {:"...maximum_magnitude" => 1, direction: [0,1]}
434
- },
435
-
436
- :"object" => {
437
- :"src_square" => {
438
- :"...attacked?" => nil,
439
- :"...occupied!" => false,
440
- :"area" => :all
441
- },
442
- :"dst_square" => {
443
- :"...attacked?" => nil,
444
- :"...occupied!" => :an_enemy_actor,
445
- :"area" => :all
446
- },
447
- :"promotable_into_actors" => [:self]
448
- }
449
- }
450
- ],
451
-
452
-
453
-
454
- [
455
- {
456
- :"subject" => {
457
- :"...ally?" => true,
458
- :"actor" => :self,
459
- :"state" => {
460
- :"...last_moved_actor?" => nil,
461
- :"...previous_moves_counter" => nil
462
- }
463
- },
464
-
465
- :"verb" => {
466
- :"name" => :shift,
467
- :"vector" => {:"...maximum_magnitude" => nil, direction: [1,0]}
468
- },
469
-
470
- :"object" => {
471
- :"src_square" => {
472
- :"...attacked?" => nil,
473
- :"...occupied!" => false,
474
- :"area" => :all
475
- },
476
- :"dst_square" => {
477
- :"...attacked?" => nil,
478
- :"...occupied!" => false,
479
- :"area" => :all
480
- },
481
- :"promotable_into_actors" => [:self]
482
- }
483
- }
484
- ],
485
-
486
-
487
-
488
- [
489
- {
490
- :"subject" => {
491
- :"...ally?" => true,
492
- :"actor" => :self,
493
- :"state" => {
494
- :"...last_moved_actor?" => nil,
495
- :"...previous_moves_counter" => nil
496
- }
497
- },
498
-
499
- :"verb" => {
500
- :"name" => :shift,
501
- :"vector" => {:"...maximum_magnitude" => nil, direction: [1,0]}
502
- },
503
-
504
- :"object" => {
505
- :"src_square" => {
506
- :"...attacked?" => nil,
507
- :"...occupied!" => false,
508
- :"area" => :all
509
- },
510
- :"dst_square" => {
511
- :"...attacked?" => nil,
512
- :"...occupied!" => false,
513
- :"area" => :all
514
- },
515
- :"promotable_into_actors" => [:self]
516
- }
517
- },
518
- {
519
- :"subject" => {
520
- :"...ally?" => true,
521
- :"actor" => :self,
522
- :"state" => {
523
- :"...last_moved_actor?" => nil,
524
- :"...previous_moves_counter" => nil
525
- }
526
- },
527
-
528
- :"verb" => {
529
- :"name" => :remove,
530
- :"vector" => {:"...maximum_magnitude" => 1, direction: [1,0]}
531
- },
532
-
533
- :"object" => {
534
- :"src_square" => {
535
- :"...attacked?" => nil,
536
- :"...occupied!" => false,
537
- :"area" => :all
538
- },
539
- :"dst_square" => {
540
- :"...attacked?" => nil,
541
- :"...occupied!" => :an_enemy_actor,
542
- :"area" => :all
543
- },
544
- :"promotable_into_actors" => [:self]
545
- }
546
- }
547
- ]
548
- ].hash
549
- end
550
-
551
- it 'raises an error' do
552
- -> { subject.load 'Zm9vYmFy' }.must_raise ArgumentError
553
- end
554
- end
555
- end
@@ -1,39 +0,0 @@
1
- require_relative '_test_helper'
2
-
3
- describe Sashite::GGN::Integer do
4
- subject { Sashite::GGN::Integer }
5
-
6
- describe '.load' do
7
- describe 'negative integer' do
8
- before do
9
- @ggn_obj = '-42'
10
- end
11
-
12
- it 'loads a document from the current io stream' do
13
- subject.load(@ggn_obj).must_equal -42
14
- end
15
-
16
- describe 'errors' do
17
- it 'raises with the opposite of zero' do
18
- -> { subject.load '-0' }.must_raise ArgumentError
19
- end
20
- end
21
- end
22
-
23
- describe 'unsigned integer' do
24
- before do
25
- @ggn_obj = '42'
26
- end
27
-
28
- it 'loads a document from the current io stream' do
29
- subject.load(@ggn_obj).must_equal 42
30
- end
31
-
32
- describe 'errors' do
33
- it 'raises with an integer beginning by zero' do
34
- -> { subject.load '04' }.must_raise ArgumentError
35
- end
36
- end
37
- end
38
- end
39
- end
@@ -1,35 +0,0 @@
1
- require_relative '_test_helper'
2
-
3
- describe Sashite::GGN::LastMovedActor do
4
- subject { Sashite::GGN::LastMovedActor }
5
-
6
- describe '.load' do
7
- describe 'boolean' do
8
- before do
9
- @ggn_obj = 't'
10
- end
11
-
12
- it 'loads a document from the current io stream' do
13
- subject.load(@ggn_obj).must_equal true
14
- end
15
-
16
- it 'raises an error' do
17
- -> { subject.load 'true' }.must_raise ArgumentError
18
- end
19
- end
20
-
21
- describe 'null' do
22
- before do
23
- @ggn_obj = '_'
24
- end
25
-
26
- it 'loads a document from the current io stream' do
27
- subject.load(@ggn_obj).must_equal nil
28
- end
29
-
30
- it 'raises an error' do
31
- -> { subject.load '' }.must_raise ArgumentError
32
- end
33
- end
34
- end
35
- end
@@ -1,39 +0,0 @@
1
- require_relative '_test_helper'
2
-
3
- describe Sashite::GGN::MaximumMagnitude do
4
- subject { Sashite::GGN::MaximumMagnitude }
5
-
6
- describe '.load' do
7
- describe 'null' do
8
- before do
9
- @ggn_obj = '_'
10
- end
11
-
12
- it 'loads a document from the current io stream' do
13
- subject.load(@ggn_obj).must_equal nil
14
- end
15
-
16
- describe 'errors' do
17
- it 'raises an error' do
18
- -> { subject.load 'foobar' }.must_raise ArgumentError
19
- end
20
- end
21
- end
22
-
23
- describe 'an unsigned integer' do
24
- before do
25
- @ggn_obj = '42'
26
- end
27
-
28
- it 'loads a document from the current io stream' do
29
- subject.load(@ggn_obj).must_equal 42
30
- end
31
-
32
- describe 'errors' do
33
- it 'raises an error' do
34
- -> { subject.load '-4' }.must_raise ArgumentError
35
- end
36
- end
37
- end
38
- end
39
- end
@@ -1,21 +0,0 @@
1
- require_relative '_test_helper'
2
-
3
- describe Sashite::GGN::Name do
4
- subject { Sashite::GGN::Name }
5
-
6
- describe '.load' do
7
- before do
8
- @ggn_obj = 'capture'
9
- end
10
-
11
- it 'loads a document from the current io stream' do
12
- subject.load(@ggn_obj).must_equal :capture
13
- end
14
-
15
- describe 'errors' do
16
- it 'raises an error' do
17
- -> { subject.load 'foobar' }.must_raise ArgumentError
18
- end
19
- end
20
- end
21
- end