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.
- checksums.yaml +4 -4
- data/README.md +523 -521
- data/VERSION.semver +1 -1
- data/lib/sashite/ggn.rb +3 -2
- data/lib/sashite/ggn/ability.rb +11 -19
- data/lib/sashite/ggn/actor.rb +5 -13
- data/lib/sashite/ggn/ally.rb +6 -14
- data/lib/sashite/ggn/area.rb +6 -14
- data/lib/sashite/ggn/attacked.rb +6 -14
- data/lib/sashite/ggn/boolean.rb +6 -14
- data/lib/sashite/ggn/digit.rb +6 -14
- data/lib/sashite/ggn/digit_excluding_zero.rb +6 -14
- data/lib/sashite/ggn/direction.rb +6 -14
- data/lib/sashite/ggn/gameplay.rb +8 -28
- data/lib/sashite/ggn/gameplay_into_base64.rb +7 -14
- data/lib/sashite/ggn/integer.rb +6 -14
- data/lib/sashite/ggn/last_moved_actor.rb +6 -14
- data/lib/sashite/ggn/maximum_magnitude.rb +6 -14
- data/lib/sashite/ggn/name.rb +6 -14
- data/lib/sashite/ggn/negative_integer.rb +6 -14
- data/lib/sashite/ggn/null.rb +7 -9
- data/lib/sashite/ggn/object.rb +11 -19
- data/lib/sashite/ggn/occupied.rb +12 -20
- data/lib/sashite/ggn/pattern.rb +7 -16
- data/lib/sashite/ggn/previous_moves_counter.rb +6 -14
- data/lib/sashite/ggn/promotable_into_actors.rb +8 -17
- data/lib/sashite/ggn/required.rb +6 -14
- data/lib/sashite/ggn/self.rb +7 -9
- data/lib/sashite/ggn/square.rb +11 -19
- data/lib/sashite/ggn/state.rb +9 -17
- data/lib/sashite/ggn/subject.rb +11 -19
- data/lib/sashite/ggn/unsigned_integer.rb +6 -14
- data/lib/sashite/ggn/unsigned_integer_excluding_zero.rb +5 -13
- data/lib/sashite/ggn/verb.rb +15 -24
- data/lib/sashite/ggn/zero.rb +7 -9
- data/sashite-ggn.gemspec +2 -4
- data/test/test_ggn.rb +501 -495
- data/test/test_ggn_ability.rb +10 -10
- data/test/test_ggn_actor.rb +516 -536
- data/test/test_ggn_ally.rb +13 -29
- data/test/test_ggn_area.rb +9 -67
- data/test/test_ggn_attacked.rb +13 -29
- data/test/test_ggn_boolean.rb +10 -26
- data/test/test_ggn_digit.rb +10 -10
- data/test/test_ggn_digit_excluding_zero.rb +10 -11
- data/test/test_ggn_direction.rb +10 -10
- data/test/test_ggn_gameplay.rb +22 -38
- data/test/test_ggn_gameplay_into_base64.rb +511 -501
- data/test/test_ggn_integer.rb +19 -21
- data/test/test_ggn_last_moved_actor.rb +13 -29
- data/test/test_ggn_maximum_magnitude.rb +18 -16
- data/test/test_ggn_name.rb +9 -39
- data/test/test_ggn_negative_integer.rb +10 -10
- data/test/test_ggn_null.rb +10 -10
- data/test/test_ggn_object.rb +22 -24
- data/test/test_ggn_occupied.rb +40 -64
- data/test/test_ggn_pattern.rb +12 -10
- data/test/test_ggn_previous_moves_counter.rb +18 -20
- data/test/test_ggn_promotable_into_actors.rb +529 -549
- data/test/test_ggn_required.rb +10 -26
- data/test/test_ggn_self.rb +10 -10
- data/test/test_ggn_square.rb +14 -16
- data/test/test_ggn_state.rb +15 -19
- data/test/test_ggn_subject.rb +17 -19
- data/test/test_ggn_unsigned_integer.rb +30 -12
- data/test/test_ggn_unsigned_integer_excluding_zero.rb +14 -10
- data/test/test_ggn_verb.rb +16 -15
- data/test/test_ggn_zero.rb +10 -10
- metadata +4 -18
data/test/test_ggn_required.rb
CHANGED
@@ -1,37 +1,21 @@
|
|
1
1
|
require_relative '_test_helper'
|
2
2
|
|
3
3
|
describe Sashite::GGN::Required do
|
4
|
-
|
5
|
-
describe 'false' do
|
6
|
-
before do
|
7
|
-
@required = Sashite::GGN::Required.new('f')
|
8
|
-
end
|
9
|
-
|
10
|
-
it 'returns the GGN as a JSON' do
|
11
|
-
@required.as_json.must_equal false
|
12
|
-
end
|
4
|
+
subject { Sashite::GGN::Required }
|
13
5
|
|
14
|
-
|
15
|
-
|
16
|
-
|
6
|
+
describe '.load' do
|
7
|
+
before do
|
8
|
+
@ggn_obj = 't'
|
17
9
|
end
|
18
10
|
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
end
|
23
|
-
|
24
|
-
it 'returns the GGN as a JSON' do
|
25
|
-
@required.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
|
-
|
29
|
-
|
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::Required.new('foobar') }.must_raise ArgumentError
|
36
|
-
end
|
37
21
|
end
|
data/test/test_ggn_self.rb
CHANGED
@@ -1,21 +1,21 @@
|
|
1
1
|
require_relative '_test_helper'
|
2
2
|
|
3
3
|
describe Sashite::GGN::Self do
|
4
|
-
|
4
|
+
subject { Sashite::GGN::Self }
|
5
|
+
|
6
|
+
describe '.load' do
|
5
7
|
before do
|
6
|
-
@
|
8
|
+
@ggn_obj = 'self'
|
7
9
|
end
|
8
10
|
|
9
|
-
it '
|
10
|
-
@
|
11
|
+
it 'loads a document from the current io stream' do
|
12
|
+
subject.load(@ggn_obj).must_equal :self
|
11
13
|
end
|
12
14
|
|
13
|
-
|
14
|
-
|
15
|
+
describe 'errors' do
|
16
|
+
it 'raises without self' do
|
17
|
+
-> { subject.load '42' }.must_raise ArgumentError
|
18
|
+
end
|
15
19
|
end
|
16
20
|
end
|
17
|
-
|
18
|
-
it 'is false' do
|
19
|
-
Sashite::GGN::Self.valid?('foobar').must_equal false
|
20
|
-
end
|
21
21
|
end
|
data/test/test_ggn_square.rb
CHANGED
@@ -1,27 +1,25 @@
|
|
1
1
|
require_relative '_test_helper'
|
2
2
|
|
3
3
|
describe Sashite::GGN::Square do
|
4
|
-
|
4
|
+
subject { Sashite::GGN::Square }
|
5
|
+
|
6
|
+
describe '.load' do
|
5
7
|
before do
|
6
|
-
@
|
8
|
+
@ggn_obj = '_@an_enemy_actor+all'
|
7
9
|
end
|
8
10
|
|
9
|
-
it '
|
10
|
-
@
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
}.hash
|
16
|
-
)
|
11
|
+
it 'loads a document from the current io stream' do
|
12
|
+
subject.load(@ggn_obj).hash.must_equal({
|
13
|
+
:"...attacked?" => nil,
|
14
|
+
:"...occupied!" => :an_enemy_actor,
|
15
|
+
:"area" => :all
|
16
|
+
}.hash)
|
17
17
|
end
|
18
18
|
|
19
|
-
|
20
|
-
|
19
|
+
describe 'errors' do
|
20
|
+
it 'raises witout a square' do
|
21
|
+
-> { subject.load 'foobar' }.must_raise ArgumentError
|
22
|
+
end
|
21
23
|
end
|
22
24
|
end
|
23
|
-
|
24
|
-
it 'raises an error' do
|
25
|
-
-> { Sashite::GGN::Square.new('foo') }.must_raise ArgumentError
|
26
|
-
end
|
27
25
|
end
|
data/test/test_ggn_state.rb
CHANGED
@@ -1,28 +1,24 @@
|
|
1
1
|
require_relative '_test_helper'
|
2
2
|
|
3
3
|
describe Sashite::GGN::State do
|
4
|
-
|
5
|
-
describe 'a state' do
|
6
|
-
before do
|
7
|
-
@state = Sashite::GGN::State.new('t&_')
|
8
|
-
end
|
4
|
+
subject { Sashite::GGN::State }
|
9
5
|
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
:"...previous_moves_counter" => nil
|
15
|
-
}.hash
|
16
|
-
)
|
17
|
-
end
|
6
|
+
describe '.load' do
|
7
|
+
before do
|
8
|
+
@ggn_obj = 't&_'
|
9
|
+
end
|
18
10
|
|
19
|
-
|
20
|
-
|
21
|
-
|
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)
|
22
16
|
end
|
23
|
-
end
|
24
17
|
|
25
|
-
|
26
|
-
|
18
|
+
describe 'errors' do
|
19
|
+
it 'raises without a state' do
|
20
|
+
-> { subject.load 'foobar' }.must_raise ArgumentError
|
21
|
+
end
|
22
|
+
end
|
27
23
|
end
|
28
24
|
end
|
data/test/test_ggn_subject.rb
CHANGED
@@ -1,30 +1,28 @@
|
|
1
1
|
require_relative '_test_helper'
|
2
2
|
|
3
3
|
describe Sashite::GGN::Subject do
|
4
|
-
|
4
|
+
subject { Sashite::GGN::Subject }
|
5
|
+
|
6
|
+
describe '.load' do
|
5
7
|
before do
|
6
|
-
@
|
8
|
+
@ggn_obj = 't<self>_&_'
|
7
9
|
end
|
8
10
|
|
9
|
-
it '
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
:"
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
}.hash
|
19
|
-
)
|
11
|
+
it 'loads a document from the current io stream' do
|
12
|
+
subject.load(@ggn_obj).hash.must_equal({
|
13
|
+
:"...ally?" => true,
|
14
|
+
:"actor" => :self,
|
15
|
+
:"state" => {
|
16
|
+
:"...last_moved_actor?" => nil,
|
17
|
+
:"...previous_moves_counter" => nil
|
18
|
+
}
|
19
|
+
}.hash)
|
20
20
|
end
|
21
21
|
|
22
|
-
|
23
|
-
|
22
|
+
describe 'errors' do
|
23
|
+
it 'raises without a subject' do
|
24
|
+
-> { subject.load 'foobar' }.must_raise ArgumentError
|
25
|
+
end
|
24
26
|
end
|
25
27
|
end
|
26
|
-
|
27
|
-
it 'raises an error' do
|
28
|
-
-> { Sashite::GGN::Subject.new('?<self>_&_') }.must_raise ArgumentError
|
29
|
-
end
|
30
28
|
end
|
@@ -1,21 +1,39 @@
|
|
1
1
|
require_relative '_test_helper'
|
2
2
|
|
3
3
|
describe Sashite::GGN::UnsignedInteger do
|
4
|
-
|
5
|
-
before do
|
6
|
-
@unsigned_integer = Sashite::GGN::UnsignedInteger.new('0')
|
7
|
-
end
|
4
|
+
subject { Sashite::GGN::UnsignedInteger }
|
8
5
|
|
9
|
-
|
10
|
-
|
11
|
-
|
6
|
+
describe '.load' do
|
7
|
+
describe 'a zero' do
|
8
|
+
before do
|
9
|
+
@ggn_obj = '0'
|
10
|
+
end
|
12
11
|
|
13
|
-
|
14
|
-
|
12
|
+
it 'loads a document from the current io stream' do
|
13
|
+
subject.load(@ggn_obj).must_equal 0
|
14
|
+
end
|
15
|
+
|
16
|
+
describe 'errors' do
|
17
|
+
it 'raises with a double zero' do
|
18
|
+
-> { subject.load '00' }.must_raise ArgumentError
|
19
|
+
end
|
20
|
+
end
|
15
21
|
end
|
16
|
-
end
|
17
22
|
|
18
|
-
|
19
|
-
|
23
|
+
describe 'an unsigned integer excluding zero' 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 a negative integer' do
|
34
|
+
-> { subject.load '-4' }.must_raise ArgumentError
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
20
38
|
end
|
21
39
|
end
|
@@ -1,21 +1,25 @@
|
|
1
1
|
require_relative '_test_helper'
|
2
2
|
|
3
3
|
describe Sashite::GGN::UnsignedIntegerExcludingZero do
|
4
|
-
|
4
|
+
subject { Sashite::GGN::UnsignedIntegerExcludingZero }
|
5
|
+
|
6
|
+
describe '.load' do
|
5
7
|
before do
|
6
|
-
@
|
8
|
+
@ggn_obj = '42'
|
7
9
|
end
|
8
10
|
|
9
|
-
it '
|
10
|
-
@
|
11
|
+
it 'loads a document from the current io stream' do
|
12
|
+
subject.load(@ggn_obj).must_equal 42
|
11
13
|
end
|
12
14
|
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
15
|
+
describe 'errors' do
|
16
|
+
it 'raises with a negative integer' do
|
17
|
+
-> { subject.load '-42' }.must_raise ArgumentError
|
18
|
+
end
|
17
19
|
|
18
|
-
|
19
|
-
|
20
|
+
it 'raises with a zero' do
|
21
|
+
-> { subject.load '0' }.must_raise ArgumentError
|
22
|
+
end
|
23
|
+
end
|
20
24
|
end
|
21
25
|
end
|
data/test/test_ggn_verb.rb
CHANGED
@@ -1,26 +1,27 @@
|
|
1
1
|
require_relative '_test_helper'
|
2
2
|
|
3
3
|
describe Sashite::GGN::Verb do
|
4
|
-
|
4
|
+
subject { Sashite::GGN::Verb }
|
5
|
+
|
6
|
+
describe '.load' do
|
5
7
|
before do
|
6
|
-
@
|
8
|
+
@ggn_obj = 'shift[4,2]42/t'
|
7
9
|
end
|
8
10
|
|
9
|
-
it '
|
10
|
-
@
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
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)
|
16
19
|
end
|
17
20
|
|
18
|
-
|
19
|
-
|
21
|
+
describe 'errors' do
|
22
|
+
it 'raises without a verb structure' do
|
23
|
+
-> { subject.load 'foobar' }.must_raise ArgumentError
|
24
|
+
end
|
20
25
|
end
|
21
26
|
end
|
22
|
-
|
23
|
-
it 'raises an error' do
|
24
|
-
-> { Sashite::GGN::Verb.new('shift[4,2]0/t') }.must_raise ArgumentError
|
25
|
-
end
|
26
27
|
end
|
data/test/test_ggn_zero.rb
CHANGED
@@ -1,21 +1,21 @@
|
|
1
1
|
require_relative '_test_helper'
|
2
2
|
|
3
3
|
describe Sashite::GGN::Zero do
|
4
|
-
|
4
|
+
subject { Sashite::GGN::Zero }
|
5
|
+
|
6
|
+
describe '.load' do
|
5
7
|
before do
|
6
|
-
@
|
8
|
+
@ggn_obj = '0'
|
7
9
|
end
|
8
10
|
|
9
|
-
it '
|
10
|
-
@
|
11
|
+
it 'loads a document from the current io stream' do
|
12
|
+
subject.load(@ggn_obj).must_equal 0
|
11
13
|
end
|
12
14
|
|
13
|
-
|
14
|
-
|
15
|
+
describe 'errors' do
|
16
|
+
it 'raises without zero' do
|
17
|
+
-> { subject.load '4' }.must_raise ArgumentError
|
18
|
+
end
|
15
19
|
end
|
16
20
|
end
|
17
|
-
|
18
|
-
it 'is false' do
|
19
|
-
Sashite::GGN::Zero.valid?('foobar').must_equal false
|
20
|
-
end
|
21
21
|
end
|
metadata
CHANGED
@@ -1,29 +1,15 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sashite-ggn
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0
|
4
|
+
version: 0.1.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-
|
11
|
+
date: 2014-06-10 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
|
-
- !ruby/object:Gem::Dependency
|
14
|
-
name: sashite-cgh
|
15
|
-
requirement: !ruby/object:Gem::Requirement
|
16
|
-
requirements:
|
17
|
-
- - "~>"
|
18
|
-
- !ruby/object:Gem::Version
|
19
|
-
version: 0.0.1
|
20
|
-
type: :runtime
|
21
|
-
prerelease: false
|
22
|
-
version_requirements: !ruby/object:Gem::Requirement
|
23
|
-
requirements:
|
24
|
-
- - "~>"
|
25
|
-
- !ruby/object:Gem::Version
|
26
|
-
version: 0.0.1
|
27
13
|
- !ruby/object:Gem::Dependency
|
28
14
|
name: bundler
|
29
15
|
requirement: !ruby/object:Gem::Requirement
|
@@ -66,7 +52,7 @@ dependencies:
|
|
66
52
|
- - "~>"
|
67
53
|
- !ruby/object:Gem::Version
|
68
54
|
version: '10'
|
69
|
-
description: Ruby
|
55
|
+
description: A Ruby interface for data serialization in GGN format.
|
70
56
|
email:
|
71
57
|
- contact@cyril.io
|
72
58
|
executables: []
|
@@ -171,7 +157,7 @@ rubyforge_project:
|
|
171
157
|
rubygems_version: 2.2.2
|
172
158
|
signing_key:
|
173
159
|
specification_version: 4
|
174
|
-
summary:
|
160
|
+
summary: General Gameplay Notation.
|
175
161
|
test_files:
|
176
162
|
- test/_test_helper.rb
|
177
163
|
- test/test_ggn.rb
|