|
@ -55,4 +55,43 @@ void test_2_bombs_around_tile(void){ |
|
|
TEST_ASSERT_EQUAL_INT(2, result);//2 bombs placed around tile |
|
|
TEST_ASSERT_EQUAL_INT(2, result);//2 bombs placed around tile |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
void test_5_bombs_around_tile(void){ |
|
|
|
|
|
/* arrange */ |
|
|
|
|
|
int result; |
|
|
|
|
|
Minesweeper_Board board = initialize_minesweeper(); |
|
|
|
|
|
int tile = 1 + board.width * 0; |
|
|
|
|
|
board.bombs[0] = 0 + board.width * 0; |
|
|
|
|
|
board.bombs[1] = 2 + board.width * 0; |
|
|
|
|
|
board.bombs[2] = 0 + board.width * 1; |
|
|
|
|
|
board.bombs[3] = 1 + board.width * 1; |
|
|
|
|
|
board.bombs[4] = 2 + board.width * 1; |
|
|
|
|
|
|
|
|
|
|
|
/* act */ |
|
|
|
|
|
result = number_of_bombs(&board, tile); |
|
|
|
|
|
|
|
|
|
|
|
/* assert */ |
|
|
|
|
|
TEST_ASSERT_EQUAL_INT(5, result);//5 bombs placed around tile |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
void test_8_bombs_around_tile(void){ |
|
|
|
|
|
/* arrange */ |
|
|
|
|
|
int result; |
|
|
|
|
|
Minesweeper_Board board = initialize_minesweeper(); |
|
|
|
|
|
int tile = 7 + board.width * 7; |
|
|
|
|
|
board.bombs[0] = 6 + board.width * 6; |
|
|
|
|
|
board.bombs[1] = 7 + board.width * 6; |
|
|
|
|
|
board.bombs[2] = 8 + board.width * 6; |
|
|
|
|
|
board.bombs[3] = 6 + board.width * 7; |
|
|
|
|
|
board.bombs[4] = 8 + board.width * 7; |
|
|
|
|
|
board.bombs[5] = 6 + board.width * 8; |
|
|
|
|
|
board.bombs[6] = 7 + board.width * 8; |
|
|
|
|
|
board.bombs[7] = 8 + board.width * 8; |
|
|
|
|
|
|
|
|
|
|
|
/* act */ |
|
|
|
|
|
result = number_of_bombs(&board, tile); |
|
|
|
|
|
|
|
|
|
|
|
/* assert */ |
|
|
|
|
|
TEST_ASSERT_EQUAL_INT(8, result);//2 bombs placed around tile |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
#endif // TEST |
|
|
#endif // TEST |