From c34d7363b61a9e00c986b79793bf7cdc03e9ea99 Mon Sep 17 00:00:00 2001 From: Trygve Laugstøl Date: Mon, 4 Mar 2024 09:15:01 +0100 Subject: wip --- tictactoe/ttt/test/ttt_test.erl | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 tictactoe/ttt/test/ttt_test.erl (limited to 'tictactoe/ttt/test') diff --git a/tictactoe/ttt/test/ttt_test.erl b/tictactoe/ttt/test/ttt_test.erl new file mode 100644 index 0000000..95b6bf7 --- /dev/null +++ b/tictactoe/ttt/test/ttt_test.erl @@ -0,0 +1,18 @@ +-module(ttt_test). + +-include_lib("eunit/include/eunit.hrl"). + +empty_board_test() -> + E = ttt:empty_board(), + ?assertEqual(E, ttt:empty_board()). + +moves_board_test() -> + B0 = ttt:empty_board(), + {ok, B1} = ttt:move(B0, 'X', 0, 0), + {ok, B2} = ttt:move(B1, 'X', 0, 1), + {ok, B3} = ttt:move(B2, 'X', 0, 2), + ?assertEqual(['X', 'X', 'X', 'E', 'E', 'E', 'E', 'E', 'E'], B3). + +simple_test() -> + R = ttt:who_wins(['X', 'X', 'X', 'E', 'E', 'E', 'E', 'E', 'E']), + ?assertEqual('X', R). -- cgit v1.2.3