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,33 +1,41 @@
1
1
  require_relative '_test_helper'
2
2
 
3
3
  describe Sashite::GGN::Object do
4
- subject { Sashite::GGN::Object }
4
+ subject { Sashite::GGN::Object.new }
5
5
 
6
- describe '.load' do
7
- before do
8
- @ggn_obj = '_@f+all~_@f+all%self'
6
+ describe '#src_square' do
7
+ it 'responds to src_square' do
8
+ subject.must_respond_to :src_square
9
9
  end
10
+ end
11
+
12
+ describe '#src_square=' do
13
+ it 'responds to src_square=' do
14
+ subject.must_respond_to :src_square=
15
+ end
16
+ end
10
17
 
11
- it 'loads a document from the current io stream' do
12
- subject.load(@ggn_obj).hash.must_equal({
13
- src_square: {
14
- :"...attacked?" => nil,
15
- :"...occupied!" => false,
16
- area: :all
17
- },
18
- dst_square: {
19
- :"...attacked?" => nil,
20
- :"...occupied!" => false,
21
- area: :all
22
- },
23
- promotable_into_actors: [:self]
24
- }.hash)
18
+ describe '#dst_square' do
19
+ it 'responds to dst_square' do
20
+ subject.must_respond_to :dst_square
25
21
  end
22
+ end
23
+
24
+ describe '#dst_square=' do
25
+ it 'responds to dst_square=' do
26
+ subject.must_respond_to :dst_square=
27
+ end
28
+ end
29
+
30
+ describe '#promotable_into_actors' do
31
+ it 'responds to promotable_into_actors' do
32
+ subject.must_respond_to :promotable_into_actors
33
+ end
34
+ end
26
35
 
27
- describe 'errors' do
28
- it 'raises without an object' do
29
- -> { subject.load 'foo' }.must_raise ArgumentError
30
- end
36
+ describe '#promotable_into_actors=' do
37
+ it 'responds to promotable_into_actors=' do
38
+ subject.must_respond_to :promotable_into_actors=
31
39
  end
32
40
  end
33
41
  end
@@ -1,84 +1,17 @@
1
1
  require_relative '_test_helper'
2
2
 
3
3
  describe Sashite::GGN::Pattern do
4
- subject { Sashite::GGN::Pattern }
4
+ subject { Sashite::GGN::Pattern.new }
5
5
 
6
- describe '.load' do
7
- before do
8
- @ggn_obj = 't<self>_&_^shift[-1,0]_/t=_@f+all~_@f+all%self; ' +
9
- 't<self>_&_^remove[-1,0]1/t=_@f+all~_@an_enemy_actor+all%self'
10
- end
11
-
12
- it 'loads a document from the current io stream' do
13
- subject.load(@ggn_obj).hash.must_equal(
14
- [
15
- {
16
- :"subject" => {
17
- :"...ally?" => true,
18
- :"actor" => :self,
19
- :"state" => {
20
- :"...last_moved_actor?" => nil,
21
- :"...previous_moves_counter" => nil
22
- }
23
- },
24
-
25
- :"verb" => {
26
- :"name" => :shift,
27
- :"vector" => {:"...maximum_magnitude" => nil, :direction => [-1,0]}
28
- },
29
-
30
- :"object" => {
31
- :"src_square" => {
32
- :"...attacked?" => nil,
33
- :"...occupied!" => false,
34
- :"area" => :all
35
- },
36
- :"dst_square" => {
37
- :"...attacked?" => nil,
38
- :"...occupied!" => false,
39
- :"area" => :all
40
- },
41
- :"promotable_into_actors" => [:self]
42
- }
43
- },
44
- {
45
- :"subject" => {
46
- :"...ally?" => true,
47
- :"actor" => :self,
48
- :"state" => {
49
- :"...last_moved_actor?" => nil,
50
- :"...previous_moves_counter" => nil
51
- }
52
- },
53
-
54
- :"verb" => {
55
- :"name" => :remove,
56
- :"vector" => {:"...maximum_magnitude" => 1, :direction => [-1,0]}
57
- },
58
-
59
- :"object" => {
60
- :"src_square" => {
61
- :"...attacked?" => nil,
62
- :"...occupied!" => false,
63
- :"area" => :all
64
- },
65
- :"dst_square" => {
66
- :"...attacked?" => nil,
67
- :"...occupied!" => :an_enemy_actor,
68
- :"area" => :all
69
- },
70
- :"promotable_into_actors" => [:self]
71
- }
72
- }
73
- ].hash
74
- )
6
+ describe '#abilities' do
7
+ it 'responds to abilities' do
8
+ subject.must_respond_to :abilities
75
9
  end
10
+ end
76
11
 
77
- describe 'errors' do
78
- it 'raises with several identical patterns' do
79
- -> { subject.load 't<self>_&_^shift[-1,0]_/t=_@f+all~_@f+all%self; ' +
80
- 't<self>_&_^shift[-1,0]_/t=_@f+all~_@f+all%self' }.must_raise ArgumentError
81
- end
12
+ describe '#abilities=' do
13
+ it 'responds to abilities=' do
14
+ subject.must_respond_to :abilities=
82
15
  end
83
16
  end
84
17
  end
@@ -1,25 +1,41 @@
1
1
  require_relative '_test_helper'
2
2
 
3
3
  describe Sashite::GGN::Square do
4
- subject { Sashite::GGN::Square }
4
+ subject { Sashite::GGN::Square.new }
5
5
 
6
- describe '.load' do
7
- before do
8
- @ggn_obj = '_@an_enemy_actor+all'
6
+ describe '#attacked' do
7
+ it 'responds to attacked' do
8
+ subject.must_respond_to :attacked
9
9
  end
10
+ end
11
+
12
+ describe '#attacked=' do
13
+ it 'responds to attacked=' do
14
+ subject.must_respond_to :attacked=
15
+ end
16
+ end
10
17
 
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)
18
+ describe '#occupied' do
19
+ it 'responds to occupied' do
20
+ subject.must_respond_to :occupied
17
21
  end
22
+ end
23
+
24
+ describe '#occupied=' do
25
+ it 'responds to occupied=' do
26
+ subject.must_respond_to :occupied=
27
+ end
28
+ end
29
+
30
+ describe '#area' do
31
+ it 'responds to area' do
32
+ subject.must_respond_to :area
33
+ end
34
+ end
18
35
 
19
- describe 'errors' do
20
- it 'raises witout a square' do
21
- -> { subject.load 'foobar' }.must_raise ArgumentError
22
- end
36
+ describe '#area=' do
37
+ it 'responds to area=' do
38
+ subject.must_respond_to :area=
23
39
  end
24
40
  end
25
41
  end
@@ -1,24 +1,29 @@
1
1
  require_relative '_test_helper'
2
2
 
3
3
  describe Sashite::GGN::State do
4
- subject { Sashite::GGN::State }
4
+ subject { Sashite::GGN::State.new }
5
5
 
6
- describe '.load' do
7
- before do
8
- @ggn_obj = 't&_'
6
+ describe '#last_moved_actor' do
7
+ it 'responds to last_moved_actor' do
8
+ subject.must_respond_to :last_moved_actor
9
9
  end
10
+ end
10
11
 
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)
12
+ describe '#last_moved_actor=' do
13
+ it 'responds to last_moved_actor=' do
14
+ subject.must_respond_to :last_moved_actor=
16
15
  end
16
+ end
17
+
18
+ describe '#previous_moves_counter' do
19
+ it 'responds to previous_moves_counter' do
20
+ subject.must_respond_to :previous_moves_counter
21
+ end
22
+ end
17
23
 
18
- describe 'errors' do
19
- it 'raises without a state' do
20
- -> { subject.load 'foobar' }.must_raise ArgumentError
21
- end
24
+ describe '#previous_moves_counter=' do
25
+ it 'responds to previous_moves_counter=' do
26
+ subject.must_respond_to :previous_moves_counter=
22
27
  end
23
28
  end
24
29
  end
@@ -1,28 +1,41 @@
1
1
  require_relative '_test_helper'
2
2
 
3
3
  describe Sashite::GGN::Subject do
4
- subject { Sashite::GGN::Subject }
4
+ subject { Sashite::GGN::Subject.new }
5
5
 
6
- describe '.load' do
7
- before do
8
- @ggn_obj = 't<self>_&_'
6
+ describe '#ally' do
7
+ it 'responds to ally' do
8
+ subject.must_respond_to :ally
9
9
  end
10
+ end
11
+
12
+ describe '#ally=' do
13
+ it 'responds to ally=' do
14
+ subject.must_respond_to :ally=
15
+ end
16
+ end
10
17
 
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)
18
+ describe '#actor' do
19
+ it 'responds to actor' do
20
+ subject.must_respond_to :actor
20
21
  end
22
+ end
23
+
24
+ describe '#actor=' do
25
+ it 'responds to actor=' do
26
+ subject.must_respond_to :actor=
27
+ end
28
+ end
29
+
30
+ describe '#state' do
31
+ it 'responds to state' do
32
+ subject.must_respond_to :state
33
+ end
34
+ end
21
35
 
22
- describe 'errors' do
23
- it 'raises without a subject' do
24
- -> { subject.load 'foobar' }.must_raise ArgumentError
25
- end
36
+ describe '#state=' do
37
+ it 'responds to state=' do
38
+ subject.must_respond_to :state=
26
39
  end
27
40
  end
28
41
  end
@@ -1,27 +1,29 @@
1
1
  require_relative '_test_helper'
2
2
 
3
3
  describe Sashite::GGN::Verb do
4
- subject { Sashite::GGN::Verb }
4
+ subject { Sashite::GGN::Verb.new }
5
5
 
6
- describe '.load' do
7
- before do
8
- @ggn_obj = 'shift[4,2]42/t'
6
+ describe '#name' do
7
+ it 'responds to name' do
8
+ subject.must_respond_to :name
9
9
  end
10
+ end
10
11
 
11
- it 'loads a document from the current io stream' do
12
- subject.load(@ggn_obj).hash.must_equal({
13
- name: :shift,
14
- vector: {
15
- direction: [4,2],
16
- :"...maximum_magnitude" => 42
17
- }
18
- }.hash)
12
+ describe '#name=' do
13
+ it 'responds to name=' do
14
+ subject.must_respond_to :name=
19
15
  end
16
+ end
17
+
18
+ describe '#vector' do
19
+ it 'responds to vector' do
20
+ subject.must_respond_to :vector
21
+ end
22
+ end
20
23
 
21
- describe 'errors' do
22
- it 'raises without a verb structure' do
23
- -> { subject.load 'foobar' }.must_raise ArgumentError
24
- end
24
+ describe '#vector=' do
25
+ it 'responds to vector=' do
26
+ subject.must_respond_to :vector=
25
27
  end
26
28
  end
27
29
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sashite-ggn
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Cyril Wack
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-06-10 00:00:00.000000000 Z
11
+ date: 2014-06-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -52,7 +52,7 @@ dependencies:
52
52
  - - "~>"
53
53
  - !ruby/object:Gem::Version
54
54
  version: '10'
55
- description: A Ruby interface for data serialization in GGN format.
55
+ description: A Ruby interface for GGN (General Gameplay Notation) objects.
56
56
  email:
57
57
  - contact@cyril.io
58
58
  executables: []
@@ -70,70 +70,24 @@ files:
70
70
  - lib/sashite-ggn.rb
71
71
  - lib/sashite/ggn.rb
72
72
  - lib/sashite/ggn/ability.rb
73
- - lib/sashite/ggn/actor.rb
74
- - lib/sashite/ggn/ally.rb
75
- - lib/sashite/ggn/area.rb
76
- - lib/sashite/ggn/attacked.rb
77
- - lib/sashite/ggn/boolean.rb
78
- - lib/sashite/ggn/digit.rb
79
- - lib/sashite/ggn/digit_excluding_zero.rb
80
- - lib/sashite/ggn/direction.rb
81
73
  - lib/sashite/ggn/gameplay.rb
82
- - lib/sashite/ggn/gameplay_into_base64.rb
83
- - lib/sashite/ggn/integer.rb
84
- - lib/sashite/ggn/last_moved_actor.rb
85
- - lib/sashite/ggn/maximum_magnitude.rb
86
- - lib/sashite/ggn/name.rb
87
- - lib/sashite/ggn/negative_integer.rb
88
- - lib/sashite/ggn/null.rb
89
74
  - lib/sashite/ggn/object.rb
90
- - lib/sashite/ggn/occupied.rb
91
75
  - lib/sashite/ggn/pattern.rb
92
- - lib/sashite/ggn/previous_moves_counter.rb
93
- - lib/sashite/ggn/promotable_into_actors.rb
94
- - lib/sashite/ggn/required.rb
95
- - lib/sashite/ggn/self.rb
96
76
  - lib/sashite/ggn/square.rb
97
77
  - lib/sashite/ggn/state.rb
98
78
  - lib/sashite/ggn/subject.rb
99
- - lib/sashite/ggn/unsigned_integer.rb
100
- - lib/sashite/ggn/unsigned_integer_excluding_zero.rb
101
79
  - lib/sashite/ggn/verb.rb
102
- - lib/sashite/ggn/zero.rb
103
80
  - sashite-ggn.gemspec
104
81
  - test/_test_helper.rb
105
82
  - test/test_ggn.rb
106
83
  - test/test_ggn_ability.rb
107
- - test/test_ggn_actor.rb
108
- - test/test_ggn_ally.rb
109
- - test/test_ggn_area.rb
110
- - test/test_ggn_attacked.rb
111
- - test/test_ggn_boolean.rb
112
- - test/test_ggn_digit.rb
113
- - test/test_ggn_digit_excluding_zero.rb
114
- - test/test_ggn_direction.rb
115
84
  - test/test_ggn_gameplay.rb
116
- - test/test_ggn_gameplay_into_base64.rb
117
- - test/test_ggn_integer.rb
118
- - test/test_ggn_last_moved_actor.rb
119
- - test/test_ggn_maximum_magnitude.rb
120
- - test/test_ggn_name.rb
121
- - test/test_ggn_negative_integer.rb
122
- - test/test_ggn_null.rb
123
85
  - test/test_ggn_object.rb
124
- - test/test_ggn_occupied.rb
125
86
  - test/test_ggn_pattern.rb
126
- - test/test_ggn_previous_moves_counter.rb
127
- - test/test_ggn_promotable_into_actors.rb
128
- - test/test_ggn_required.rb
129
- - test/test_ggn_self.rb
130
87
  - test/test_ggn_square.rb
131
88
  - test/test_ggn_state.rb
132
89
  - test/test_ggn_subject.rb
133
- - test/test_ggn_unsigned_integer.rb
134
- - test/test_ggn_unsigned_integer_excluding_zero.rb
135
90
  - test/test_ggn_verb.rb
136
- - test/test_ggn_zero.rb
137
91
  homepage: https://github.com/sashite/ggn.rb
138
92
  licenses:
139
93
  - MIT
@@ -157,38 +111,15 @@ rubyforge_project:
157
111
  rubygems_version: 2.2.2
158
112
  signing_key:
159
113
  specification_version: 4
160
- summary: General Gameplay Notation.
114
+ summary: Some mappers for GGN objects
161
115
  test_files:
162
116
  - test/_test_helper.rb
163
117
  - test/test_ggn.rb
164
118
  - test/test_ggn_ability.rb
165
- - test/test_ggn_actor.rb
166
- - test/test_ggn_ally.rb
167
- - test/test_ggn_area.rb
168
- - test/test_ggn_attacked.rb
169
- - test/test_ggn_boolean.rb
170
- - test/test_ggn_digit.rb
171
- - test/test_ggn_digit_excluding_zero.rb
172
- - test/test_ggn_direction.rb
173
119
  - test/test_ggn_gameplay.rb
174
- - test/test_ggn_gameplay_into_base64.rb
175
- - test/test_ggn_integer.rb
176
- - test/test_ggn_last_moved_actor.rb
177
- - test/test_ggn_maximum_magnitude.rb
178
- - test/test_ggn_name.rb
179
- - test/test_ggn_negative_integer.rb
180
- - test/test_ggn_null.rb
181
120
  - test/test_ggn_object.rb
182
- - test/test_ggn_occupied.rb
183
121
  - test/test_ggn_pattern.rb
184
- - test/test_ggn_previous_moves_counter.rb
185
- - test/test_ggn_promotable_into_actors.rb
186
- - test/test_ggn_required.rb
187
- - test/test_ggn_self.rb
188
122
  - test/test_ggn_square.rb
189
123
  - test/test_ggn_state.rb
190
124
  - test/test_ggn_subject.rb
191
- - test/test_ggn_unsigned_integer.rb
192
- - test/test_ggn_unsigned_integer_excluding_zero.rb
193
125
  - test/test_ggn_verb.rb
194
- - test/test_ggn_zero.rb