diff options
| author | Ben Harris <bjh21@bjh21.me.uk> | 2023-02-12 16:25:48 +0000 |
|---|---|---|
| committer | Ben Harris <bjh21@bjh21.me.uk> | 2023-02-13 21:19:07 +0000 |
| commit | a2bf0508c7256a62d973446fce841504580e2591 (patch) | |
| tree | a7ab52af22f6332f8e02d7752e9d34268cb80bfb | |
| parent | df783b93e3271264a8d54f90876f41a80ef2247d (diff) | |
| download | puzzles-a2bf0508c7256a62d973446fce841504580e2591.zip puzzles-a2bf0508c7256a62d973446fce841504580e2591.tar.gz puzzles-a2bf0508c7256a62d973446fce841504580e2591.tar.bz2 puzzles-a2bf0508c7256a62d973446fce841504580e2591.tar.xz | |
Reserialise the game in fuzzpuzz
This means that the serialising code gets tested, and also provides a
convenient way to canonicalise a (valid) save file.
| -rw-r--r-- | fuzzpuzz.c | 8 |
1 files changed, 8 insertions, 0 deletions
@@ -32,6 +32,13 @@ static bool savefile_read(void *wctx, void *buf, int len) return (ret == len); } +static void savefile_write(void *wctx, const void *buf, int len) +{ + FILE *fp = (FILE *)wctx; + + fwrite(buf, 1, len, fp); +} + int main(int argc, char **argv) { const char *err; @@ -96,6 +103,7 @@ int main(int argc, char **argv) midend_free(me); continue; } + midend_serialise(me, savefile_write, stdout); midend_free(me); ret = 0; } |