Browse Source

test 10

main^2
Lucas Heil 11 months ago
committed by Peter Wiebe
parent
commit
309885c4bc
  1. 43
      src/test/c/test_sudoku.c

43
src/test/c/test_sudoku.c

@ -218,5 +218,48 @@ void test_Player_actions_for_playing_print_and_solve(){
//9
void test_giving_hints_to_player(){
test_help = true;
int selected_difficulty = 1;
int selected_level = 1;
int Sudoku_grid[SIZE_OF_GAMEBORD_AXIS_X][SIZE_OF_GAMEBORD_AXIS_Y] =
{
{5, 3, 0, 0, 7, 0, 0, 0, 0},
{6, 0, 0, 1, 9, 5, 0, 0, 0},
{0, 9, 8, 0, 0, 0, 0, 6, 0},
{8, 0, 0, 0, 6, 0, 0, 0, 3},
{4, 0, 0, 8, 0, 3, 0, 0, 1},
{7, 0, 0, 0, 2, 0, 0, 0, 6},
{0, 6, 0, 0, 0, 0, 2, 8, 0},
{0, 0, 0, 4, 1, 9, 0, 0, 5},
{0, 0, 0, 0, 8, 0, 0, 7, 9}
};
int expected_grid[SIZE_OF_GAMEBORD_AXIS_X][SIZE_OF_GAMEBORD_AXIS_Y] =
{{4, 7, 3, 6, 2, 1, 8, 5, 9},
{6, 8, 5, 9, 7, 4, 1, 3, 2},
{9, 2, 1, 5, 3, 8, 7, 6, 4},
{7, 6, 9, 3, 5, 2, 4, 8, 1},
{8, 5, 4, 1, 9, 7, 6, 2, 3},
{1, 3, 2, 4, 8, 6, 9, 7, 5},
{2, 9, 7, 8, 1, 5, 3, 4, 6},
{3, 4, 8, 2, 6, 9, 5, 1, 7},
{5, 1, 6, 7, 4, 3, 2, 9, 8}};
giving_hints_to_player(Sudoku_grid);
// Check if the generated Sudoku grid is valid
for (int i = 0; i < SIZE_OF_GAMEBORD_AXIS_X; ++i) {
for (int j = 0; j < SIZE_OF_GAMEBORD_AXIS_Y; ++j) {
TEST_ASSERT_EQUAL_INT_MESSAGE(expected_grid[i][j], Sudoku_grid[i][j], "Checking if every space is correct");
}}
printf("Unit test for giving_hints_to_player() executed.\n\n");
}
#endif // TEST #endif // TEST
Loading…
Cancel
Save