tests game solve
This commit is contained in:
1 parent
72eec47152
commit
d3ffeb8eff
3 files changed
+25
-3
No files matched your search
+14
-1
@@ -234,4 +234,17 @@ char other_str[] = {
|
|||||||
'b', 'b', '4', 'b', '2', 'b', 'b', '\n', // <squares[5][0]><squares[5][1]>...<squares[5][nb_cols-1]>\n
|
'b', 'b', '4', 'b', '2', 'b', 'b', '\n', // <squares[5][0]><squares[5][1]>...<squares[5][nb_cols-1]>\n
|
||||||
'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 */
|
||||||
|
};
|
||||||
@@ -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
@@ -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;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user