Commit e9f1c4a

mo khan <mo@mokhan.ca>
2014-12-30 14:40:52
add test target.
1 parent 4186a22
Changed files (2)
src/world.c
@@ -3,9 +3,7 @@
 #include <string.h>
 #include "world.h"
 
-int world_number_of_cells(World *world) {
-  return world->width * world->height;
-}
+int world_number_of_cells(World *world);
 
 int west_of(World *world, int index) {
   return (index % world->width == 0) ? index + (world->width-1) : index - 1;
@@ -39,6 +37,10 @@ int south_east_of(World *world, int index) {
   return east_of(world, south_of(world, index));
 }
 
+int world_number_of_cells(World *world) {
+  return world->width * world->height;
+}
+
 Cell* world_cell_at(World *world, int index) {
   return &world->cells[sizeof(Cell) * index];
 }
Makefile
@@ -3,3 +3,9 @@ default: src/*.c src/*.h
 	mkdir -p bin
 	gcc -std=c99 -Wall -o bin/test_game_of_life src/world_test.c src/world.c src/cell.c src/print.c
 	./bin/test_game_of_life
+
+test: src/*.c src/*.h
+	rm -fr bin
+	mkdir -p bin
+	gcc -std=c99 -Wall -o bin/test_game_of_life src/world_test.c src/world.c src/cell.c src/print.c
+	./bin/test_game_of_life