Commit 1f4e69b

mo khan <mo@mokhan.ca>
2014-10-27 03:07:59
add test for 3 living neighbors.
1 parent b1176a9
Changed files (1)
gol_test.c
@@ -36,6 +36,18 @@ static char* any_live_cell_with_two_live_neighbours_lives_on_to_the_next_generat
   return 0;
 }
 
+static char* any_live_cell_with_three_live_neighbours_lives_on_to_the_next_generation() {
+  printf("TEST: %s\n", __func__);
+  char world[3][3] = {
+    { 'x', ' ', 'x' },
+    { ' ', 'x', ' ' },
+    { ' ', ' ', ' ' },
+  };
+  char* new_world = evolve(*world);
+  assert_equal(new_world[1] == 'x', "lives because has 3 live neighbors");
+  return 0;
+}
+
 static char* it_returns_the_correct_number_of_living_neighbors() {
   printf("TEST: %s\n", __func__);
   char world[3][3] = {
@@ -55,10 +67,6 @@ static char* it_returns_the_correct_number_of_living_neighbors() {
   return 0;
 }
 
-static char* any_live_cell_with_three_live_neighbours_lives_on_to_the_next_generation() {
-  return 0;
-}
-
 static char* all_tests() {
   run_test(test_foo);
   run_test(it_returns_the_correct_number_of_living_neighbors);