|
|
@ -12,7 +12,7 @@ void test_no_bombs_placed_around_tile(void){ |
|
|
|
/* arrange */ |
|
|
|
int result; |
|
|
|
Minesweeper_Board board = initialize_minesweeper(); |
|
|
|
int tile = 1 + board.width * 1; |
|
|
|
int tile = 0 + board.width * 1; |
|
|
|
|
|
|
|
/* act */ |
|
|
|
result = number_of_bombs(&board, tile); |
|
|
@ -26,10 +26,10 @@ void test_searching_for_bombs_on_correct_tiles(void){ |
|
|
|
int result; |
|
|
|
Minesweeper_Board board = initialize_minesweeper(); |
|
|
|
int tile = 0 + board.width * 1; |
|
|
|
board.bombs[0] = 0 + board.width * 2; |
|
|
|
board.bombs[0] = 2 + board.width * 1; |
|
|
|
board.bombs[0] = board.width - 1 + board.width * 1; |
|
|
|
board.bombs[0] = 0 + board.width * (board.height - 1); |
|
|
|
board.bombs[0] = 0 + board.width * 3; |
|
|
|
board.bombs[1] = 2 + board.width * 1; |
|
|
|
board.bombs[2] = board.width - 1 + board.width * 1; |
|
|
|
board.bombs[3] = 0 + board.width * (board.height - 1); |
|
|
|
|
|
|
|
/* act */ |
|
|
|
result = number_of_bombs(&board, tile); |
|
|
@ -38,4 +38,21 @@ void test_searching_for_bombs_on_correct_tiles(void){ |
|
|
|
TEST_ASSERT_EQUAL_INT(0, result);//no bombs placed around tile |
|
|
|
} |
|
|
|
|
|
|
|
void test_2_bombs_around_tile(void){ |
|
|
|
/* arrange */ |
|
|
|
int result; |
|
|
|
Minesweeper_Board board = initialize_minesweeper(); |
|
|
|
int tile = 0 + board.width * 1; |
|
|
|
board.bombs[0] = 0 + board.width * 2; |
|
|
|
board.bombs[1] = 1 + board.width * 1; |
|
|
|
board.bombs[2] = board.width - 1 + board.width * 1; |
|
|
|
board.bombs[3] = 0 + board.width * (board.height - 1); |
|
|
|
|
|
|
|
/* act */ |
|
|
|
result = number_of_bombs(&board, tile); |
|
|
|
|
|
|
|
/* assert */ |
|
|
|
TEST_ASSERT_EQUAL_INT(2, result);//2 bombs placed around tile |
|
|
|
} |
|
|
|
|
|
|
|
#endif // TEST |