From 0be77ac09408c13cc12b5953b9ac7459b549c202 Mon Sep 17 00:00:00 2001 From: Trygve Laugstøl Date: Sun, 3 Mar 2024 19:25:41 +0100 Subject: wip --- ttt/test/ttt_test.erl | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 ttt/test/ttt_test.erl (limited to 'ttt/test') diff --git a/ttt/test/ttt_test.erl b/ttt/test/ttt_test.erl new file mode 100644 index 0000000..95b6bf7 --- /dev/null +++ b/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