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