From d3ffeb8eff30c640ed3ccdc7a8f0c7e450d28581 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Th=C3=A9ophyl=20Hoguet?= Date: Mon, 7 Mar 2022 00:11:31 +0100 Subject: [PATCH] tests game solve --- game_examples.c | 15 ++++++++++++++- game_examples.h | 1 + game_test.c | 12 ++++++++++-- 3 files changed, 25 insertions(+), 3 deletions(-) diff --git a/game_examples.c b/game_examples.c index f658c97..3c3dc2c 100644 --- a/game_examples.c +++ b/game_examples.c @@ -234,4 +234,17 @@ char other_str[] = { 'b', 'b', '4', 'b', '2', 'b', 'b', '\n', // ...\n '0', 'b', 'b', 'b', 'w', 'b', '-', '\n' // ...\n }; -/* ************************************************************************** */ \ No newline at end of file +/* ************************************************************************** */ + +square ext_hard_10x10[] = { + S_BLANK, S_BLANK, S_BLANK, S_BLACK2, S_BLANK, S_BLANK, S_BLANK, S_BLACK0, S_BLANK, S_BLANK, /* row 0 */ + S_BLANK, S_BLACK0, S_BLANK, S_BLANK, S_BLACKU, S_BLANK, S_BLANK, S_BLACK2, S_BLACKU, S_BLANK, /* row 1 */ + S_BLACKU, S_BLACK0, S_BLANK, S_BLACK1, S_BLANK, S_BLANK, S_BLANK, S_BLANK, S_BLANK, S_BLANK, /* row 2 */ + S_BLANK, S_BLANK, S_BLANK, S_BLANK, S_BLANK, S_BLANK, S_BLANK, S_BLACKU, S_BLANK, S_BLACKU, /* row 4 */ + S_BLANK, S_BLANK, S_BLANK, S_BLANK, S_BLANK, S_BLANK, S_BLANK, S_BLANK, S_BLACK3, S_BLANK, /* row 5 */ + S_BLANK, S_BLACK2, S_BLANK, S_BLANK, S_BLANK, S_BLANK, S_BLANK, S_BLANK, S_BLANK, S_BLANK, /* row 6 */ + S_BLACKU, S_BLANK, S_BLACK2, S_BLANK, S_BLANK, S_BLANK, S_BLANK, S_BLANK, S_BLANK, S_BLANK, /* row 7 */ + S_BLANK, S_BLANK, S_BLANK, S_BLANK, S_BLANK, S_BLANK, S_BLACK0, S_BLANK, S_BLACKU, S_BLACKU, /* row 8 */ + S_BLANK, S_BLACKU, S_BLACKU, S_BLANK, S_BLANK, S_BLACK2, S_BLANK, S_BLANK, S_BLACK1, S_BLANK, /* row 9 */ + S_BLANK, S_BLANK, S_BLACK0, S_BLANK, S_BLANK, S_BLANK, S_BLACKU, S_BLANK, S_BLANK, S_BLANK /* row 10 */ +}; \ No newline at end of file diff --git a/game_examples.h b/game_examples.h index 52d792c..7e3334e 100644 --- a/game_examples.h +++ b/game_examples.h @@ -35,5 +35,6 @@ extern square sol_2x2w_squares[]; extern char default_str[]; extern char ext_5x3w_str[]; extern char other_str[]; +extern square ext_hard_10x10[]; #endif // __GAME_EXAMPLES_H__ diff --git a/game_test.c b/game_test.c index 9f81b62..384b8be 100644 --- a/game_test.c +++ b/game_test.c @@ -1184,9 +1184,17 @@ bool test_game_solve(bool whoami, char** name) { return false; } game gDef = game_default(); - game gDefSol = game_default_solution(); assert(game_solve(gDef)); - assert(game_equal(gDef, gDefSol)); + assert(game_is_over(gDef)); + game_delete(gDef); + game g5x3w = game_new_ext(5, 3, ext_5x3w_squares, true); + assert(game_solve(g5x3w)); + assert(game_is_over(g5x3w)); + game_delete(g5x3w); + game g10x10 = game_new_ext(10, 10, ext_hard_10x10, false); + assert(game_solve(g10x10)); + assert(game_is_over(g10x10)); + game_delete(g10x10); return true; }