tests game solve

This commit is contained in:
Théophyl Hoguet committed 2022-03-07 00:11:31 +01:00
1 parent 72eec47152
commit d3ffeb8eff
3 files changed
+24 -2

No files matched your search

+13
View File
@@ -235,3 +235,16 @@ char other_str[] = {
'0', 'b', 'b', 'b', 'w', 'b', '-', '\n' // <squares[6][0]><squares[6][1]>...<squares[6][nb_cols-1]>\n '0', 'b', 'b', 'b', 'w', 'b', '-', '\n' // <squares[6][0]><squares[6][1]>...<squares[6][nb_cols-1]>\n
}; };
/* ************************************************************************** */ /* ************************************************************************** */
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 */
};
+1
View File
@@ -35,5 +35,6 @@ extern square sol_2x2w_squares[];
extern char default_str[]; extern char default_str[];
extern char ext_5x3w_str[]; extern char ext_5x3w_str[];
extern char other_str[]; extern char other_str[];
extern square ext_hard_10x10[];
#endif // __GAME_EXAMPLES_H__ #endif // __GAME_EXAMPLES_H__
+10 -2
View File
@@ -1184,9 +1184,17 @@ bool test_game_solve(bool whoami, char** name) {
return false; return false;
} }
game gDef = game_default(); game gDef = game_default();
game gDefSol = game_default_solution();
assert(game_solve(gDef)); 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; return true;
} }