From: Carl Worth Date: Mon, 6 Jul 2020 05:35:59 +0000 (-0700) Subject: test: Add testing for a move that sends you to a full mini-grid X-Git-Url: https://git.cworth.org/git?p=empires-server;a=commitdiff_plain;h=83b82c646adf5bd2c9e96caf8f4f99dc0eb7f19e test: Add testing for a move that sends you to a full mini-grid In this case, it's legal to move anywhere, (the normal constraint of having to move to a matching mini-square is waived since it's impossible by definition). --- diff --git a/test b/test index 8659c64..bcf3e3f 100755 --- a/test +++ b/test @@ -577,6 +577,45 @@ result=$(scribe_move '[0,8]') test "$result" = '{"legal":true}' TEST_END +TEST "Several moves to fill up the mini-grid 0" +scribe_set_player_team o +scribe_move '[3,0]' >/dev/null +scribe_set_player_team + +scribe_move '[8,0]' >/dev/null +scribe_set_player_team o +scribe_move '[0,0]' >/dev/null +scribe_set_player_team + +scribe_move '[0,1]' >/dev/null +scribe_set_player_team o +scribe_move '[0,2]' >/dev/null +scribe_set_player_team + +scribe_move '[1,0]' >/dev/null +scribe_set_player_team o +scribe_move '[2,0]' >/dev/null +scribe_set_player_team + +scribe_move '[0,5]' >/dev/null +scribe_set_player_team o +scribe_move '[0,6]' >/dev/null +scribe_set_player_team + +scribe_move '[5,0]' >/dev/null +scribe_set_player_team o +scribe_move '[6,0]' >/dev/null +scribe_set_player_team + +scribe_move '[0,7]' >/dev/null +scribe_set_player_team o +scribe_move '[0,4]' >/dev/null +scribe_set_player_team + +result=$(scribe_move '[7,0]') +test "$result" = '{"legal":true}' +TEST_END + +TEST "Full mini grid allows a free move" +scribe_set_player_team o +scribe_move '[4,1]' >/dev/null +scribe_set_player_team + +result=$(scribe_move '[1,1]') +test "$result" = '{"legal":true}' +TEST_END TEST_SECTION "Empathy game"