aboutsummaryrefslogtreecommitdiff
path: root/ttt/test
diff options
context:
space:
mode:
authorTrygve Laugstøl <trygvis@inamo.no>2024-03-03 19:25:41 +0100
committerTrygve Laugstøl <trygvis@inamo.no>2024-03-03 19:25:41 +0100
commit0be77ac09408c13cc12b5953b9ac7459b549c202 (patch)
tree40176fc9983aa8b524af336284a354f559b63568 /ttt/test
parenta4c300e687600ae9c9559175362c7de6956a23e6 (diff)
downloaderlang-workshop-0be77ac09408c13cc12b5953b9ac7459b549c202.tar.gz
erlang-workshop-0be77ac09408c13cc12b5953b9ac7459b549c202.tar.bz2
erlang-workshop-0be77ac09408c13cc12b5953b9ac7459b549c202.tar.xz
erlang-workshop-0be77ac09408c13cc12b5953b9ac7459b549c202.zip
wip
Diffstat (limited to 'ttt/test')
-rw-r--r--ttt/test/ttt_test.erl18
1 files changed, 18 insertions, 0 deletions
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).