Browse Source

test 4

remotes/origin/Lucas
Lucas Heil 11 months ago
parent
commit
319f79a4f3
  1. 27
      src/test/c/test_sudoku.c

27
src/test/c/test_sudoku.c

@ -64,6 +64,33 @@ void test_initializeGrid() {
}
//3
void test_create_playing_field_level_medium_two() {
int Sudoku_grid[SIZE_OF_GAMEBORD_AXIS_X][SIZE_OF_GAMEBORD_AXIS_Y];
selected_difficulty = 2;
selected_level = 2;
int expected_grid[SIZE_OF_GAMEBORD_AXIS_X][SIZE_OF_GAMEBORD_AXIS_Y] = {{7, 0, 2, 0, 0, 0, 9, 5, 0},
{0, 0, 0, 7, 5, 0, 2, 0, 6},
{0, 0, 5, 0, 2, 8, 7, 0, 3},
{5, 1, 8, 0, 3, 0, 6, 0, 0},
{0, 0, 6, 1, 0, 0, 0, 3, 0},
{0, 0, 0, 0, 6, 2, 0, 8, 1},
{0, 9, 0, 2, 0, 4, 0, 0, 5},
{0, 0, 0, 0, 9, 0, 0, 0, 4},
{0, 5, 1, 0, 0, 0, 0, 9, 2}};
create_playing_field(Sudoku_grid, selected_difficulty, selected_level);
// 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 create_playing_field() executed.\n\n");
}

Loading…
Cancel
Save