From 30c976d661f31ac63f0847daf0f59ad979632d6a Mon Sep 17 00:00:00 2001 From: sabriansam96 <sabriansam96@mi.fu-berlin.de> Date: Mon, 15 Nov 2021 18:44:06 +0100 Subject: [PATCH] Fixed Test Functions --- test_gol.py | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/test_gol.py b/test_gol.py index 3f1a24c..bad4330 100644 --- a/test_gol.py +++ b/test_gol.py @@ -21,23 +21,28 @@ 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__": test_gol_still_lifes() - test_gol_oscillators() \ No newline at end of file + test_gol_oscillators() -- GitLab