Skip to content
Snippets Groups Projects
Commit 30c976d6 authored by sabriansam96's avatar sabriansam96
Browse files

Fixed Test Functions

parent 28573bc8
No related branches found
No related tags found
No related merge requests found
......@@ -21,21 +21,26 @@ def oscillators():
def test_gol_still_lifes():
gol = GameOfLife()
for l in still_lifes():
if np.any(l != gol.next(l)):
gol = GameOfLife(l)
gol.update()
if not np.all(l == gol.board()):
assert False,"Still life was not still."
def test_gol_oscillators():
gol=GameOfLife()
for l_i,l_o in oscillators():
if np.any(l_o != gol.next(l_i)):
gol=GameOfLife(l_i)
gol.update()
if not np.all(l_o == gol.board()):
assert False,"Oscillators did not work."
def test_gol_benchmark(benchmark):
gol=GameOfLife()
board = np.ones((50,50))
benchmark(gol.next,board)
def gol_next(board):
gol=GameOfLife(board)
gol.update()
return gol.board()
benchmark(gol_next, board)
if __name__ == "__main__":
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment