Build a lot of conditioned-out test and helper programs.

Most of these aren't especially useful, but if we're going to have
them in the code base at all, we should at least ensure they compile:
bit-rotted conditioned-out code is of no value.

One of the new programs is 'galaxieseditor', which borrows most of the
Galaxies code but changes the UI so that you can create and remove
_dots_ instead of edges, and then run the solver to see whether it can
solve the puzzle you've designed. Unlike the rest, this is a GUI
helper tool, using the 'guiprogram' cmake function introduced in the
previous commit.

The programs are:
 - 'combi', a test program for the utility module that generates all
   combinations of n things
 - 'divvy', a test program for the module that divides a rectangle at
   random into equally-sized polyominoes
 - 'penrose-test', a test program for the Penrose-tiling generator
   used in Loopy, which outputs an SVG of a piece of tiling
 - 'penrose-vector', a much smaller test program for the vector
   arithmetic subroutines in that code
 - 'sort-test', a test of this code base's local array sorting routine
 - 'tree234-test', the exhaustive test code that's been in tree234.c
   all along.

Not all of them compiled first time. Most of the fixes were the usual
kind of thing: fixing compiler warnings by removing unused
variables/functions, bringing uses of internal APIs up to date. A
notable one was that galaxieseditor's interpret_move() modified the
input game state, which was an error all along and is now detected by
me having made it a const pointer; I had to replace that with an extra
wrinkle in the move-string format, so that now execute_move() makes
the modification.

The one I'm _least_ proud of is squelching a huge number of
format-string warnings in tree234-test by interposing a variadic
function without __attribute__((printf)).
This commit is contained in:
Simon Tatham
2021-05-23 10:04:47 +01:00
parent d5b53853aa
commit 12b64a1db1
7 changed files with 96 additions and 31 deletions

View File

@ -65,6 +65,8 @@ centred on a dot.")
solver(galaxies)
cliprogram(galaxiespicture galaxies.c
COMPILE_DEFINITIONS STANDALONE_PICTURE_GENERATOR)
guiprogram(galaxieseditor galaxies.c
COMPILE_DEFINITIONS EDITOR)
puzzle(guess
DISPLAYNAME "Guess"
@ -266,5 +268,11 @@ add_subdirectory(unfinished)
cliprogram(obfusc obfusc.c)
cliprogram(latincheck latin.c COMPILE_DEFINITIONS STANDALONE_LATIN_TEST)
cliprogram(matching matching.c COMPILE_DEFINITIONS STANDALONE_MATCHING_TEST)
cliprogram(combi combi.c COMPILE_DEFINITIONS STANDALONE_COMBI_TEST)
cliprogram(divvy divvy.c COMPILE_DEFINITIONS TESTMODE)
cliprogram(penrose-test penrose.c COMPILE_DEFINITIONS TEST_PENROSE)
cliprogram(penrose-vector-test penrose.c COMPILE_DEFINITIONS TEST_VECTORS)
cliprogram(sort-test sort.c COMPILE_DEFINITIONS SORT_TEST)
cliprogram(tree234-test tree234.c COMPILE_DEFINITIONS TEST)
build_platform_extras()