From 1109d8a0cbeb84622bbaffc6a5acf420d4a5b481 Mon Sep 17 00:00:00 2001 From: Lucas Heil Date: Wed, 7 Feb 2024 17:44:54 +0100 Subject: [PATCH] test 4 --- src/test/c/test_sudoku.c | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/src/test/c/test_sudoku.c b/src/test/c/test_sudoku.c index 674cf9b..92a9053 100644 --- a/src/test/c/test_sudoku.c +++ b/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"); +} +