Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

テストケース追加

  • Loading branch information...
commit 17da8f524fd67dea17bdbe9381297e0018c744a7 1 parent c99bbb4
eiji.ienaga authored May 04, 2012

Showing 1 changed file with 24 additions and 0 deletions. Show diff stats Hide diff stats

  1. 24  test/lifegame_spec.js
24  test/lifegame_spec.js
@@ -20,6 +20,18 @@ var surviveSpaceB = function() {
20 20
                     [0, 0, 0]]);
21 21
 };
22 22
 
  23
+var underpopulatedSpace = function() {
  24
+  return new Space([[0, 0, 0],
  25
+                    [0, 1, 1],
  26
+                    [0, 0, 0]]);
  27
+};
  28
+
  29
+var upperpopulatedSpace = function() {
  30
+  return new Space([[1, 1, 1],
  31
+                    [1, 1, 0],
  32
+                    [0, 0, 0]]);
  33
+};
  34
+
23 35
 var   ALIVE = 1
24 36
     , DEAD = 0;
25 37
 
@@ -38,6 +50,18 @@ suite('Life Game', function() {
38 50
     });
39 51
   });
40 52
 
  53
+  suite('過疎について:生きているセルに隣接する生きたセルが1つ以下ならば', function() {
  54
+    test('過疎により死滅すること', function() {
  55
+      expect(underpopulatedSpace().nextTime().cells[1][1]).to.equal(DEAD);
  56
+    });
  57
+  });
  58
+
  59
+  suite('過密について:生きているセルに隣接する生きたセルが4つ以上ならば', function() {
  60
+    test('過密により死滅すること', function() {
  61
+      expect(upperpopulatedSpace().nextTime().cells[1][1]).to.equal(DEAD);
  62
+    });
  63
+  });
  64
+
41 65
 });
42 66
 
43 67
 

0 notes on commit 17da8f5

Please sign in to comment.
Something went wrong with that request. Please try again.