Browse Source

test 6

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

46
src/test/c/test_sudoku.c

@ -114,6 +114,52 @@ void test_printGrid() {
} }
//5
// Unit test for check_if_Sudoku_solved() function
void test_check_if_Sudoku_solved_everything_correct() {
selected_difficulty = 1;
selected_level = 1;
int Sudoku_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}};
check_if_Sudoku_solved(Sudoku_grid);
TEST_ASSERT_TRUE(check_solved);
printf("Unit test for check_if_Sudoku_solved() executed.\n");
}
void test_check_if_Sudoku_solved_mistake_on_purpose() {
selected_difficulty = 1;
selected_level = 1;
int Sudoku_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, 3}};
check_if_Sudoku_solved(Sudoku_grid);
TEST_ASSERT_FALSE(check_solved);
printf("Unit test for check_if_Sudoku_solved() executed.\n\n");
}

Loading…
Cancel
Save