From: Carl Worth Date: Sun, 31 May 2020 23:12:10 +0000 (-0700) Subject: test: Add simple testing for tictactoe as well X-Git-Url: https://git.cworth.org/git?p=lmno-server;a=commitdiff_plain;h=32420152e7e4805104d5118fabc5ada0e668e5ae 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. --- 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