From 32420152e7e4805104d5118fabc5ada0e668e5ae Mon Sep 17 00:00:00 2001 From: Carl Worth Date: Sun, 31 May 2020 16:12:10 -0700 Subject: [PATCH] test: Add simple testing for tictactoe as well This just verifies we can move to a square, (and can't then move to the same square again). To do something more interesting here, I'll have to think about how to test with multiple clients connecting to the same game and how to verify the results of the streaming from the /events API. --- test | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/test b/test index 30dbe7f..b5be7d8 100755 --- 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 -- 2.43.0