diff options
Diffstat (limited to 'tictactoe-2/apps/ttt/test')
-rw-r--r-- | tictactoe-2/apps/ttt/test/ttt_test.erl | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/tictactoe-2/apps/ttt/test/ttt_test.erl b/tictactoe-2/apps/ttt/test/ttt_test.erl new file mode 100644 index 0000000..95b6bf7 --- /dev/null +++ b/tictactoe-2/apps/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). |