sashite-ggn 0.1.0 → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (69) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +8 -528
  3. data/VERSION.semver +1 -1
  4. data/lib/sashite/ggn.rb +2 -2
  5. data/lib/sashite/ggn/ability.rb +2 -20
  6. data/lib/sashite/ggn/gameplay.rb +2 -13
  7. data/lib/sashite/ggn/object.rb +2 -21
  8. data/lib/sashite/ggn/pattern.rb +2 -13
  9. data/lib/sashite/ggn/square.rb +2 -24
  10. data/lib/sashite/ggn/state.rb +2 -21
  11. data/lib/sashite/ggn/subject.rb +2 -22
  12. data/lib/sashite/ggn/verb.rb +2 -28
  13. data/sashite-ggn.gemspec +2 -2
  14. data/test/test_ggn.rb +6 -543
  15. data/test/test_ggn_ability.rb +28 -38
  16. data/test/test_ggn_gameplay.rb +8 -548
  17. data/test/test_ggn_object.rb +30 -22
  18. data/test/test_ggn_pattern.rb +8 -75
  19. data/test/test_ggn_square.rb +30 -14
  20. data/test/test_ggn_state.rb +18 -13
  21. data/test/test_ggn_subject.rb +30 -17
  22. data/test/test_ggn_verb.rb +18 -16
  23. metadata +4 -73
  24. data/lib/sashite/ggn/actor.rb +0 -20
  25. data/lib/sashite/ggn/ally.rb +0 -20
  26. data/lib/sashite/ggn/area.rb +0 -17
  27. data/lib/sashite/ggn/attacked.rb +0 -20
  28. data/lib/sashite/ggn/boolean.rb +0 -17
  29. data/lib/sashite/ggn/digit.rb +0 -20
  30. data/lib/sashite/ggn/digit_excluding_zero.rb +0 -17
  31. data/lib/sashite/ggn/direction.rb +0 -19
  32. data/lib/sashite/ggn/gameplay_into_base64.rb +0 -21
  33. data/lib/sashite/ggn/integer.rb +0 -20
  34. data/lib/sashite/ggn/last_moved_actor.rb +0 -20
  35. data/lib/sashite/ggn/maximum_magnitude.rb +0 -20
  36. data/lib/sashite/ggn/name.rb +0 -17
  37. data/lib/sashite/ggn/negative_integer.rb +0 -19
  38. data/lib/sashite/ggn/null.rb +0 -21
  39. data/lib/sashite/ggn/occupied.rb +0 -29
  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/unsigned_integer.rb +0 -20
  45. data/lib/sashite/ggn/unsigned_integer_excluding_zero.rb +0 -20
  46. data/lib/sashite/ggn/zero.rb +0 -21
  47. data/test/test_ggn_actor.rb +0 -571
  48. data/test/test_ggn_ally.rb +0 -35
  49. data/test/test_ggn_area.rb +0 -21
  50. data/test/test_ggn_attacked.rb +0 -35
  51. data/test/test_ggn_boolean.rb +0 -21
  52. data/test/test_ggn_digit.rb +0 -21
  53. data/test/test_ggn_digit_excluding_zero.rb +0 -21
  54. data/test/test_ggn_direction.rb +0 -21
  55. data/test/test_ggn_gameplay_into_base64.rb +0 -555
  56. data/test/test_ggn_integer.rb +0 -39
  57. data/test/test_ggn_last_moved_actor.rb +0 -35
  58. data/test/test_ggn_maximum_magnitude.rb +0 -39
  59. data/test/test_ggn_name.rb +0 -21
  60. data/test/test_ggn_negative_integer.rb +0 -21
  61. data/test/test_ggn_null.rb +0 -21
  62. data/test/test_ggn_occupied.rb +0 -78
  63. data/test/test_ggn_previous_moves_counter.rb +0 -39
  64. data/test/test_ggn_promotable_into_actors.rb +0 -578
  65. data/test/test_ggn_required.rb +0 -21
  66. data/test/test_ggn_self.rb +0 -21
  67. data/test/test_ggn_unsigned_integer.rb +0 -39
  68. data/test/test_ggn_unsigned_integer_excluding_zero.rb +0 -25
  69. data/test/test_ggn_zero.rb +0 -21
@@ -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
@@ -1,21 +0,0 @@
1
- require_relative '_test_helper'
2
-
3
- describe Sashite::GGN::NegativeInteger do
4
- subject { Sashite::GGN::NegativeInteger }
5
-
6
- describe '.load' do
7
- before do
8
- @ggn_obj = '-42'
9
- end
10
-
11
- it 'loads a document from the current io stream' do
12
- subject.load(@ggn_obj).must_equal -42
13
- end
14
-
15
- describe 'errors' do
16
- it 'raises with an unsigned integer' do
17
- -> { subject.load '4' }.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::Null do
4
- subject { Sashite::GGN::Null }
5
-
6
- describe '.load' do
7
- before do
8
- @ggn_obj = '_'
9
- end
10
-
11
- it 'loads a document from the current io stream' do
12
- subject.load(@ggn_obj).must_equal nil
13
- end
14
-
15
- describe 'errors' do
16
- it 'raises without null' do
17
- -> { subject.load '4' }.must_raise ArgumentError
18
- end
19
- end
20
- end
21
- end
@@ -1,78 +0,0 @@
1
- require_relative '_test_helper'
2
-
3
- describe Sashite::GGN::Occupied do
4
- subject { Sashite::GGN::Occupied }
5
-
6
- describe '.load' do
7
- describe 'a relationship' do
8
- before do
9
- @ggn_obj = 'an_ally_actor'
10
- end
11
-
12
- it 'loads a document from the current io stream' do
13
- subject.load(@ggn_obj).must_equal :an_ally_actor
14
- end
15
-
16
- describe 'errors' do
17
- it 'raises without a relationship' do
18
- -> { subject.load 'foobar' }.must_raise ArgumentError
19
- end
20
- end
21
- end
22
-
23
- describe 'a boolean' do
24
- before do
25
- @ggn_obj = 'f'
26
- end
27
-
28
- it 'loads a document from the current io stream' do
29
- subject.load(@ggn_obj).must_equal false
30
- end
31
-
32
- describe 'errors' do
33
- it 'raises without a boolean' do
34
- -> { subject.load 'foobar' }.must_raise ArgumentError
35
- end
36
- end
37
- end
38
-
39
- describe 'null' do
40
- before do
41
- @ggn_obj = '_'
42
- end
43
-
44
- it 'loads a document from the current io stream' do
45
- subject.load(@ggn_obj).must_equal nil
46
- end
47
-
48
- describe 'errors' do
49
- it 'raises without null' do
50
- -> { subject.load '' }.must_raise ArgumentError
51
- end
52
- end
53
- end
54
-
55
- describe 'a subject' do
56
- before do
57
- @ggn_obj = 'f<self>_&_'
58
- end
59
-
60
- it 'loads a document from the current io stream' do
61
- subject.load(@ggn_obj).hash.must_equal({
62
- :"...ally?" => false,
63
- actor: :self,
64
- state: {
65
- :"...last_moved_actor?" => nil,
66
- :"...previous_moves_counter" => nil
67
- }
68
- }.hash)
69
- end
70
-
71
- describe 'errors' do
72
- it 'raises without a well-formed subject' do
73
- -> { subject.load 'f<foo>_&_' }.must_raise ArgumentError
74
- end
75
- end
76
- end
77
- end
78
- end
@@ -1,39 +0,0 @@
1
- require_relative '_test_helper'
2
-
3
- describe Sashite::GGN::PreviousMovesCounter do
4
- subject { Sashite::GGN::PreviousMovesCounter }
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 without null' do
18
- -> { subject.load '' }.must_raise ArgumentError
19
- end
20
- end
21
- end
22
-
23
- describe 'an unsigned integer' do
24
- before do
25
- @ggn_obj = '0'
26
- end
27
-
28
- it 'loads a document from the current io stream' do
29
- subject.load(@ggn_obj).must_equal 0
30
- end
31
-
32
- describe 'errors' do
33
- it 'raises with a negative integer' do
34
- -> { subject.load '-4' }.must_raise ArgumentError
35
- end
36
- end
37
- end
38
- end
39
- end
@@ -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