cellular_map 0.3.0 → 0.3.1
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/cellular_map/zone.rb +1 -0
- data/test/test_map.rb +5 -0
- data/test/test_zone.rb +5 -0
- metadata +1 -1
data/lib/cellular_map/zone.rb
CHANGED
data/test/test_map.rb
CHANGED
@@ -43,6 +43,11 @@ class TestMap < Test::Unit::TestCase
|
|
43
43
|
assert_equal @map, result
|
44
44
|
}
|
45
45
|
|
46
|
+
should("return itself after iterating") {
|
47
|
+
result = @map.each {}
|
48
|
+
assert_same @map, result
|
49
|
+
}
|
50
|
+
|
46
51
|
should("collect all filled cells") {
|
47
52
|
expected = @sample.collect { |c, v| c + [v] }.sort!
|
48
53
|
inside = @map.collect { |cell| [cell.x, cell.y, cell.content] }.sort!
|
data/test/test_zone.rb
CHANGED
@@ -59,6 +59,11 @@ class TestZone < Test::Unit::TestCase
|
|
59
59
|
assert_equal @positions, inside
|
60
60
|
}
|
61
61
|
|
62
|
+
should("return itself after iterating") {
|
63
|
+
result = @zone.each {}
|
64
|
+
assert_same @zone, result
|
65
|
+
}
|
66
|
+
|
62
67
|
should("collect all its cells in a basic one-dimension array") {
|
63
68
|
inside = @zone.collect { |cell| [cell.x, cell.y, cell.content] }.sort!
|
64
69
|
outside = @positions.collect { |x, y| [x, y, @sample[[x, y]]] }.sort!
|