X-Git-Url: http://git.draconx.ca/gitweb/rrace.git/blobdiff_plain/43a709ff25b9973a83327a06a6ecc94b09e7787b..1b1de4a466963fbfebf76e3920bf0cb573102cff:/tests/game.at?ds=sidebyside
diff --git a/tests/game.at b/tests/game.at
index bfd9819..7084f6f 100644
--- a/tests/game.at
+++ b/tests/game.at
@@ -1,4 +1,4 @@
-# Copyright © 2022 Nick Bowler
+# Copyright © 2022-2024 Nick Bowler
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -13,6 +13,42 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see .
+AT_SETUP([board bitmap functions])
+
+AT_CHECK([boardbit], [0],
+[[left(0) left(1) left(2) left(3) left(4)
+ @.... @@... @@@.. @@@@. @@@@@
+ @.... @@... @@@.. @@@@. @@@@@
+ @.... @@... @@@.. @@@@. @@@@@
+ @.... @@... @@@.. @@@@. @@@@@
+ @.... @@... @@@.. @@@@. @@@@@
+
+right(0) right(1) right(2) right(3) right(4)
+ @@@@@ .@@@@ ..@@@ ...@@ ....@
+ @@@@@ .@@@@ ..@@@ ...@@ ....@
+ @@@@@ .@@@@ ..@@@ ...@@ ....@
+ @@@@@ .@@@@ ..@@@ ...@@ ....@
+ @@@@@ .@@@@ ..@@@ ...@@ ....@
+
+above(0) above(1) above(2) above(3) above(4)
+ @@@@@ @@@@@ @@@@@ @@@@@ @@@@@
+ ..... @@@@@ @@@@@ @@@@@ @@@@@
+ ..... ..... @@@@@ @@@@@ @@@@@
+ ..... ..... ..... @@@@@ @@@@@
+ ..... ..... ..... ..... @@@@@
+
+below(0) below(1) below(2) below(3) below(4)
+ @@@@@ ..... ..... ..... .....
+ @@@@@ @@@@@ ..... ..... .....
+ @@@@@ @@@@@ @@@@@ ..... .....
+ @@@@@ @@@@@ @@@@@ @@@@@ .....
+ @@@@@ @@@@@ @@@@@ @@@@@ @@@@@
+]])
+
+AT_CLEANUP
+
+TEST_TAP_SIMPLE([board_rect], [boardrect], [], [board])
+
AT_SETUP([game_do_move zigzag])
AT_CHECK([boardmove m4_do(
@@ -556,10 +592,66 @@ AT_CHECK([boardmove m4_do(
AT_CLEANUP
-AT_SETUP([xoshiro256** sanity])
+TEST_TAP_SIMPLE([xoshiro256** sanity], [rng-test])
+
+AT_SETUP([game_check_goal])
+
+AT_DATA([boards.dat],
+[[0 0 0 0 0 0
+1f8c63f 1f8c63f 1f8c63f 0000 0000 0000
+1f8c63f 1f8c63f 1f8c63f ffff 0000 0000
+1f8c63f 1f8c63f 1f8c63f 0000 ffff 0000
+1f8c63f 1f8c63f 1f8c63f 0000 0000 ffff
+00739c0 1f8c63f 1f8c63f ffff 0000 0000
+1f8c63f 00739c0 1f8c63f 0000 ffff 0000
+1f8c63f 1f8c63f 00739c0 0000 0000 ffff
+0000000 0000000 0000000 0001 0020 0400
+]])
+
+AT_DATA([expout],
+[[00000
+00000
+739c0
+739c0
+739c0
+00000
+00000
+00000
+10840
+]])
+
+AT_CHECK([checkgoal result.dat && cat result.dat], [0], [expout])
-AT_CHECK([rng-test >out
-grep -v '^ok' out], [0], [1..200
+AT_CLEANUP
+
+AT_SETUP([game_overlay_goal])
+
+AT_DATA([boards.dat], [dnl
+0 0 0 0 0 0
+0 0 0 -1 0 0
+0 0 0 0 -1 0
+0 0 0 0 0 -1
+1ffffff 1ffffff 1ffffff 0 0 0
+])
+
+AT_DATA([expout], [dnl
+0000000 0000000 0000000
+00739c0 0000000 0000000
+0000000 00739c0 0000000
+0000000 0000000 00739c0
+1f8c63f 1f8c63f 1f8c63f
])
+AT_CHECK([overlaygoal result.dat && cat result.dat],
+ [0], [expout])
+
+AT_CLEANUP
+
+# Basic check that we get different initial games if we run the program
+# multiple times in sequence.
+AT_SETUP([game_reset initial seed])
+
+AT_CHECK([initboard >a && initboard >b && initboard >c])
+AT_CHECK([diff a b || diff b c || diff a c || exit 42], [42], [ignore-nolog])
+
AT_CLEANUP