aboutsummaryrefslogtreecommitdiff
path: root/fuzzpuzz.c
diff options
context:
space:
mode:
authorBen Harris <bjh21@bjh21.me.uk>2023-02-12 22:57:51 +0000
committerBen Harris <bjh21@bjh21.me.uk>2023-02-13 21:23:58 +0000
commitffe2fa169f9fdc411d00e1c75cf3cdc5f3099727 (patch)
tree5b305c88b5df19ee02c884f0247714aab6d7aefc /fuzzpuzz.c
parenta2bf0508c7256a62d973446fce841504580e2591 (diff)
downloadpuzzles-ffe2fa169f9fdc411d00e1c75cf3cdc5f3099727.zip
puzzles-ffe2fa169f9fdc411d00e1c75cf3cdc5f3099727.tar.gz
puzzles-ffe2fa169f9fdc411d00e1c75cf3cdc5f3099727.tar.bz2
puzzles-ffe2fa169f9fdc411d00e1c75cf3cdc5f3099727.tar.xz
Extend fuzzpuzz to test more code
Now if the input save file loads correctly, fuzzpuzz asks the back-end to draw the puzzle. All the drawing operations are no-ops, but this tests the drawing code in the back-end.
Diffstat (limited to 'fuzzpuzz.c')
-rw-r--r--fuzzpuzz.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/fuzzpuzz.c b/fuzzpuzz.c
index 0d6cc7a..978c90e 100644
--- a/fuzzpuzz.c
+++ b/fuzzpuzz.c
@@ -39,6 +39,8 @@ static void savefile_write(void *wctx, const void *buf, int len)
fwrite(buf, 1, len, fp);
}
+static drawing_api drapi = { NULL };
+
int main(int argc, char **argv)
{
const char *err;
@@ -47,6 +49,7 @@ int main(int argc, char **argv)
const game *ourgame = NULL;
midend *me;
FILE *in = NULL;
+ int w, h;
if (argc != 1) {
fprintf(stderr, "usage: %s\n", argv[0]);
@@ -93,7 +96,7 @@ int main(int argc, char **argv)
continue;
}
- me = midend_new(NULL, ourgame, NULL, NULL);
+ me = midend_new(NULL, ourgame, &drapi, NULL);
rewind(in);
err = midend_deserialise(me, savefile_read, in);
@@ -103,6 +106,9 @@ int main(int argc, char **argv)
midend_free(me);
continue;
}
+ w = h = INT_MAX;
+ midend_size(me, &w, &h, false, 1);
+ midend_redraw(me);
midend_serialise(me, savefile_write, stdout);
midend_free(me);
ret = 0;