]> git.cworth.org Git - lmno-server/commitdiff
test: Add testing for a move that sends you to a full mini-grid
authorCarl Worth <cworth@cworth.org>
Mon, 6 Jul 2020 05:35:59 +0000 (22:35 -0700)
committerCarl Worth <cworth@cworth.org>
Mon, 6 Jul 2020 05:36:59 +0000 (22:36 -0700)
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).

test

diff --git a/test b/test
index 8659c64b7d63207eef9defb6d2f19d957237194b..bcf3e3f86a0c526e022368adc54a9e81e98ababb 100755 (executable)
--- 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"