1 # Copyright © 2022-2024 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 TEST_TAP_SIMPLE([xoshiro256** sanity], [rng-test])
597 AT_SETUP([game_check_goal])
599 AT_DATA([boards.dat],
601 1f8c63f 1f8c63f 1f8c63f 0000 0000 0000
602 1f8c63f 1f8c63f 1f8c63f ffff 0000 0000
603 1f8c63f 1f8c63f 1f8c63f 0000 ffff 0000
604 1f8c63f 1f8c63f 1f8c63f 0000 0000 ffff
605 00739c0 1f8c63f 1f8c63f ffff 0000 0000
606 1f8c63f 00739c0 1f8c63f 0000 ffff 0000
607 1f8c63f 1f8c63f 00739c0 0000 0000 ffff
608 0000000 0000000 0000000 0001 0020 0400
623 AT_CHECK([checkgoal <boards.dat >result.dat && cat result.dat], [0], [expout])
627 AT_SETUP([game_overlay_goal])
629 AT_DATA([boards.dat], [dnl
634 1ffffff 1ffffff 1ffffff 0 0 0
637 AT_DATA([expout], [dnl
638 0000000 0000000 0000000
639 00739c0 0000000 0000000
640 0000000 00739c0 0000000
641 0000000 0000000 00739c0
642 1f8c63f 1f8c63f 1f8c63f
645 AT_CHECK([overlaygoal <boards.dat >result.dat && cat result.dat],
650 # Basic check that we get different initial games if we run the program
651 # multiple times in sequence.
652 AT_SETUP([game_reset initial seed])
654 AT_CHECK([initboard >a && initboard >b && initboard >c])
655 AT_CHECK([diff a b || diff b c || diff a c || exit 42], [42], [ignore-nolog])