]> git.cworth.org Git - empires-server/blobdiff - test
test: Add simple testing for tictactoe as well
[empires-server] / test
diff --git a/test b/test
index 30dbe7f2781cd292de35b2b4112862f11af992c3..b5be7d8fa20e27142a8acbdb719e950a22b7acf5 100755 (executable)
--- a/test
+++ b/test
@@ -268,5 +268,26 @@ players=$(empires_players_string)
 test "$players" = ""
 TEST_END
 
+TEST_SECTION "Tic Tac Toe game"
+
+tictactoe_game_path=tictactoe/$tictactoe_game_id
+
+tictactoe_move()
+{
+    curl_post $tictactoe_game_path/move "{\"square\": $1}"
+}
+
+TEST_SUBSECTION "Tic Tac Toe /move"
+
+TEST "Move to the center square"
+result=$(tictactoe_move 4)
+test "$result" = "true"
+TEST_END
+
+TEST "Move to center square again is now illegal"
+result=$(tictactoe_move 4)
+test "$result" = "false"
+TEST_END
+
 TEST_REPORT