IN101 project on Conway's Game of Life
|
Test executable source code for a naive implementation of Conway's game of life universe simulator. More...
#include <stdio.h>
#include <stdlib.h>
#include <assert.h>
#include <string.h>
#include "naive_universe.h"
#include "naive_loader.h"
#include "naive_conway.h"
Functions | |
void | test_count_neighbors () |
Test of the naive_count_neighbors function. More... | |
void | test_naive_step () |
Test of the naive_step function. More... | |
void | test_naive_simulation () |
Test of the naive_simulation function. More... | |
int | main (void) |
Variables | |
universe | u |
char * | GLIDER_10STEPS = "................................................................o.................o.o..................oo..........................................................................................................................................................................................................................................................................................................................." |
Test executable source code for a naive implementation of Conway's game of life universe simulator.
Contains the following tests:
naive_count_neighbors
function, using data/glider.txt
naive_step
function, using source files from the data/archive-test
directorynaive_simulation
function, using data/glider.txt
and checking a 10 step simulation void test_count_neighbors | ( | ) |
Test of the naive_count_neighbors
function.
This tests uses the data/glider.txt
source file and checks 4 neighbors counts, including two with edge positions.
void test_naive_simulation | ( | ) |
Test of the naive_simulation
function.
This test uses the data/glider.txt
source files, launches a 10 step simulation and compares the result with the exact solution given by the GLIDER_10STEPS
constant.
void test_naive_step | ( | ) |
Test of the naive_step
function.
This test uses the data/archive-test
directory that contains 512 source files and their next step solution.
It will load each universe from each file, use the naive_step
function and compare the return's cell table with the given exact solution.