From 2d9e5ac8d73ad951c5e20c67f830f3cd65b620f1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Th=C3=A9ophyl=20Hoguet?= Date: Fri, 11 Feb 2022 17:55:24 +0100 Subject: [PATCH] patched update_flags close #8 --- game_test_thoguet.c | 77 ++++++++++++++++++++++++--------------------- 1 file changed, 41 insertions(+), 36 deletions(-) diff --git a/game_test_thoguet.c b/game_test_thoguet.c index ea0fde4..07ddd95 100644 --- a/game_test_thoguet.c +++ b/game_test_thoguet.c @@ -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; }