1 # Copyright © 2022-2023 Nick Bowler
3 # This program is free software: you can redistribute it and/or modify
4 # it under the terms of the GNU General Public License as published by
5 # the Free Software Foundation, either version 3 of the License, or
6 # (at your option) any later version.
8 # This program is distributed in the hope that it will be useful,
9 # but WITHOUT ANY WARRANTY; without even the implied warranty of
10 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 # GNU General Public License for more details.
13 # You should have received a copy of the GNU General Public License
14 # along with this program. If not, see <https://www.gnu.org/licenses/>.
16 AT_SETUP([board bitmap functions])
18 AT_CHECK([boardbit], [0],
19 [[left(0) left(1) left(2) left(3) left(4)
20 @.... @@... @@@.. @@@@. @@@@@
21 @.... @@... @@@.. @@@@. @@@@@
22 @.... @@... @@@.. @@@@. @@@@@
23 @.... @@... @@@.. @@@@. @@@@@
24 @.... @@... @@@.. @@@@. @@@@@
26 right(0) right(1) right(2) right(3) right(4)
27 @@@@@ .@@@@ ..@@@ ...@@ ....@
28 @@@@@ .@@@@ ..@@@ ...@@ ....@
29 @@@@@ .@@@@ ..@@@ ...@@ ....@
30 @@@@@ .@@@@ ..@@@ ...@@ ....@
31 @@@@@ .@@@@ ..@@@ ...@@ ....@
33 above(0) above(1) above(2) above(3) above(4)
34 @@@@@ @@@@@ @@@@@ @@@@@ @@@@@
35 ..... @@@@@ @@@@@ @@@@@ @@@@@
36 ..... ..... @@@@@ @@@@@ @@@@@
37 ..... ..... ..... @@@@@ @@@@@
38 ..... ..... ..... ..... @@@@@
40 below(0) below(1) below(2) below(3) below(4)
41 @@@@@ ..... ..... ..... .....
42 @@@@@ @@@@@ ..... ..... .....
43 @@@@@ @@@@@ @@@@@ ..... .....
44 @@@@@ @@@@@ @@@@@ @@@@@ .....
45 @@@@@ @@@@@ @@@@@ @@@@@ @@@@@
50 TEST_TAP_SIMPLE([board_rect], [boardrect], [], [board])
52 AT_SETUP([game_do_move zigzag])
54 AT_CHECK([boardmove m4_do(
213 AT_SETUP([game_do_move vertical])
215 AT_CHECK([boardmove m4_do(
220 [424143404442])], [0],
404 AT_SETUP([game_do_move horizontal])
406 AT_CHECK([boardmove m4_do(
411 [243414440424])], [0],
595 AT_SETUP([xoshiro256** sanity])
597 AT_CHECK([rng-test >out
598 grep -v '^ok' out], [0], [1..200
603 AT_SETUP([game_check_goal])
605 AT_DATA([boards.dat],
607 1f8c63f 1f8c63f 1f8c63f 0000 0000 0000
608 1f8c63f 1f8c63f 1f8c63f ffff 0000 0000
609 1f8c63f 1f8c63f 1f8c63f 0000 ffff 0000
610 1f8c63f 1f8c63f 1f8c63f 0000 0000 ffff
611 00739c0 1f8c63f 1f8c63f ffff 0000 0000
612 1f8c63f 00739c0 1f8c63f 0000 ffff 0000
613 1f8c63f 1f8c63f 00739c0 0000 0000 ffff
614 0000000 0000000 0000000 0001 0020 0400
629 AT_CHECK([checkgoal <boards.dat >result.dat && cat result.dat], [0], [expout])
633 AT_SETUP([game_overlay_goal])
635 AT_DATA([boards.dat], [dnl
640 1ffffff 1ffffff 1ffffff 0 0 0
643 AT_DATA([expout], [dnl
644 0000000 0000000 0000000
645 00739c0 0000000 0000000
646 0000000 00739c0 0000000
647 0000000 0000000 00739c0
648 1f8c63f 1f8c63f 1f8c63f
651 AT_CHECK([overlaygoal <boards.dat >result.dat && cat result.dat],
656 # Basic check that we get different initial games if we run the program
657 # multiple times in sequence.
658 AT_SETUP([game_reset initial seed])
660 AT_CHECK([initboard >a && initboard >b && initboard >c])
661 AT_CHECK([diff a b || diff b c || diff a c || exit 42], [42], [ignore-nolog])