patched update_flags close #8

This commit is contained in:
Théophyl Hoguet committed 2022-02-11 17:57:57 +01:00
1 parent 194cb59438
commit 2d9e5ac8d7
1 file changed
+41 -36
+41 -36
View File
@@ -408,42 +408,47 @@ bool test_game_update_flags(bool whoami, char** name) {
assert(counterF_ERROR(g5x3w) == 5);
game_delete(g5x3w);
// without wrapping
game g2x2 = game_new_ext(2, 2, ext_2x2w_squares, false);
game_play_move(g2x2, 0, 1, S_LIGHTBULB);
game_play_move(g2x2, 1, 0, S_LIGHTBULB);
assert(game_is_over(g2x2));
game g3x3 = game_new_ext(3, 3, ext_3x3w_squares, false);
game_play_move(g3x3, 1, 0, S_LIGHTBULB);
game_play_move(g3x3, 2, 2, S_LIGHTBULB);
assert(game_is_over(g3x3));
game_delete(g3x3);
game g5x3 = game_new_ext(5, 3, ext_5x3w_squares, false);
game_play_move(g5x3, 0, 0, S_LIGHTBULB);
game_play_move(g5x3, 1, 1, S_LIGHTBULB);
game_play_move(g5x3, 2, 0, S_LIGHTBULB);
game_play_move(g5x3, 3, 2, S_LIGHTBULB);
game_play_move(g5x3, 4, 1, S_LIGHTBULB);
assert(game_is_over(g5x3));
game_restart(g2x2);
game_restart(g5x3);
game_play_move(g2x2, 1, 0, S_MARK);
assert(!game_is_over(g2x2));
assert(game_has_error(g2x2, 0, 0));
assert(counterF_ERROR(g2x2) == 1);
game_delete(g2x2);
game_play_move(g5x3, 0, 2, S_LIGHTBULB);
game_play_move(g5x3, 1, 1, S_LIGHTBULB);
game_play_move(g5x3, 2, 0, S_LIGHTBULB);
game_play_move(g5x3, 2, 2, S_LIGHTBULB);
game_play_move(g5x3, 3, 2, S_LIGHTBULB);
game_play_move(g5x3, 4, 1, S_LIGHTBULB);
assert(!game_is_over(g5x3));
assert(game_has_error(g5x3, 1, 2));
assert(game_has_error(g5x3, 2, 1));
assert(game_has_error(g5x3, 2, 2));
assert(game_has_error(g5x3, 3, 2));
assert(counterF_ERROR(g5x3) == 4);
game_delete(g5x3);
game g4x4 = game_new_ext(4, 4, ext_4x4_squares, false);
game_play_move(g4x4, 0, 0, S_LIGHTBULB);
game_play_move(g4x4, 1, 3, S_LIGHTBULB);
game_play_move(g4x4, 2, 1, S_LIGHTBULB);
game_play_move(g4x4, 3, 2, S_LIGHTBULB);
assert(game_is_over(g4x4));
game g3x10 = game_new_ext(3, 10, ext_3x10_squares, false);
game_play_move(g3x10, 0, 0, S_LIGHTBULB);
game_play_move(g3x10, 1, 3, S_LIGHTBULB);
game_play_move(g3x10, 2, 4, S_LIGHTBULB);
game_play_move(g3x10, 0, 8, S_LIGHTBULB);
game_play_move(g3x10, 2, 9, S_LIGHTBULB);
assert(game_is_over(g3x10));
game_delete(g3x10);
game g5x1 = game_new_ext(5, 1, ext_5x1_squares, false);
game_play_move(g5x1, 0, 0, S_LIGHTBULB);
game_play_move(g5x1, 4, 0, S_LIGHTBULB);
assert(game_is_over(g5x1));
game_restart(g4x4);
game_restart(g5x1);
game_play_move(g4x4, 2, 1, S_MARK);
game_play_move(g4x4, 3, 2, S_MARK);
game_play_move(g4x4, 2, 3, S_MARK);
assert(!game_is_over(g4x4));
assert(game_has_error(g4x4, 2, 2));
assert(counterF_ERROR(g4x4) == 1);
game_play_move(g4x4, 0, 1, S_LIGHTBULB);
assert(!game_is_over(g4x4));
assert(game_has_error(g4x4, 2, 2));
assert(game_has_error(g4x4, 0, 2));
assert(counterF_ERROR(g4x4) == 2);
game_delete(g4x4);
game_play_move(g5x1, 0, 0, S_LIGHTBULB);
game_play_move(g5x1, 1, 0, S_LIGHTBULB);
game_play_move(g5x1, 4, 0, S_LIGHTBULB);
assert(!game_is_over(g5x1));
assert(game_has_error(g5x1, 0, 0));
assert(game_has_error(g5x1, 1, 0));
assert(game_has_error(g5x1, 2, 0));
assert(counterF_ERROR(g5x1) == 3);
game_delete(g5x1);
return EXIT_SUCCESS;
}