mirror of
git://git.tartarus.org/simon/puzzles.git
synced 2025-04-20 23:51:29 -07:00
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.
This commit is contained in:
@ -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;
|
||||
|
Reference in New Issue
Block a user