|
|
@ -11,7 +11,7 @@ void test_detect_not_valid_tile_left(void){ |
|
|
|
/* arrange */ |
|
|
|
Minesweeper_Board board = initialize_minesweeper(); |
|
|
|
int tile = 0; |
|
|
|
int direction = 1; |
|
|
|
int direction = 2; |
|
|
|
int result; |
|
|
|
|
|
|
|
/* act */ |
|
|
@ -35,10 +35,10 @@ void test_detect_not_valid_tile_up(void){ |
|
|
|
TEST_ASSERT_EQUAL_INT(-1, result);//not valid tile |
|
|
|
} |
|
|
|
|
|
|
|
void test_detect_valid_tile_right(void){ |
|
|
|
void test_detect_not_valid_tile_right(void){ |
|
|
|
/* arrange */ |
|
|
|
Minesweeper_Board board = initialize_minesweeper(); |
|
|
|
int tile = 0; |
|
|
|
int tile = board.width * board.height - 1; |
|
|
|
int direction = 5; |
|
|
|
int result; |
|
|
|
|
|
|
@ -46,13 +46,13 @@ void test_detect_valid_tile_right(void){ |
|
|
|
result = is_Valid_tile(&board, tile, direction); |
|
|
|
|
|
|
|
/* assert */ |
|
|
|
TEST_ASSERT_EQUAL_INT(1, result);//not valid tile |
|
|
|
TEST_ASSERT_EQUAL_INT(-1, result);//not valid tile |
|
|
|
} |
|
|
|
|
|
|
|
void test_detect_valid_tile_down(void){ |
|
|
|
void test_detect_not_valid_tile_down(void){ |
|
|
|
/* arrange */ |
|
|
|
Minesweeper_Board board = initialize_minesweeper(); |
|
|
|
int tile = 0; |
|
|
|
int tile = board.width * board.height - 1; |
|
|
|
int direction = 4; |
|
|
|
int result; |
|
|
|
|
|
|
@ -60,27 +60,55 @@ void test_detect_valid_tile_down(void){ |
|
|
|
result = is_Valid_tile(&board, tile, direction); |
|
|
|
|
|
|
|
/* assert */ |
|
|
|
TEST_ASSERT_EQUAL_INT(0 + board.width, result);//not valid tile |
|
|
|
TEST_ASSERT_EQUAL_INT(-1, result);//not valid tile |
|
|
|
} |
|
|
|
|
|
|
|
void test_detect_not_valid_tile_right(void){ |
|
|
|
void test_detect_valid_tile_left(void){ |
|
|
|
/* arrange */ |
|
|
|
Minesweeper_Board board = initialize_minesweeper(); |
|
|
|
int tile = board.width * board.height - 1; |
|
|
|
int direction = 5; |
|
|
|
int direction = 2; |
|
|
|
int result; |
|
|
|
|
|
|
|
/* act */ |
|
|
|
result = is_Valid_tile(&board, tile, direction); |
|
|
|
|
|
|
|
/* assert */ |
|
|
|
TEST_ASSERT_EQUAL_INT(-1, result);//not valid tile |
|
|
|
TEST_ASSERT_EQUAL_INT(board.width * board.height - 2, result);//not valid tile |
|
|
|
} |
|
|
|
|
|
|
|
void test_detect_not_valid_tile_down(void){ |
|
|
|
void test_detect_valid_tile_up(void){ |
|
|
|
/* arrange */ |
|
|
|
Minesweeper_Board board = initialize_minesweeper(); |
|
|
|
int tile = board.width * board.height - 1; |
|
|
|
int direction = 3; |
|
|
|
int result; |
|
|
|
|
|
|
|
/* act */ |
|
|
|
result = is_Valid_tile(&board, tile, direction); |
|
|
|
|
|
|
|
/* assert */ |
|
|
|
TEST_ASSERT_EQUAL_INT(board.width * (board.height - 1) - 1, result);//not valid tile |
|
|
|
} |
|
|
|
|
|
|
|
void test_detect_valid_tile_right(void){ |
|
|
|
/* arrange */ |
|
|
|
Minesweeper_Board board = initialize_minesweeper(); |
|
|
|
int tile = 0; |
|
|
|
int direction = 5; |
|
|
|
int result; |
|
|
|
|
|
|
|
/* act */ |
|
|
|
result = is_Valid_tile(&board, tile, direction); |
|
|
|
|
|
|
|
/* assert */ |
|
|
|
TEST_ASSERT_EQUAL_INT(1, result);//not valid tile |
|
|
|
} |
|
|
|
|
|
|
|
void test_detect_valid_tile_down(void){ |
|
|
|
/* arrange */ |
|
|
|
Minesweeper_Board board = initialize_minesweeper(); |
|
|
|
int tile = 0; |
|
|
|
int direction = 4; |
|
|
|
int result; |
|
|
|
|
|
|
@ -88,7 +116,7 @@ void test_detect_not_valid_tile_down(void){ |
|
|
|
result = is_Valid_tile(&board, tile, direction); |
|
|
|
|
|
|
|
/* assert */ |
|
|
|
TEST_ASSERT_EQUAL_INT(-1, result);//not valid tile |
|
|
|
TEST_ASSERT_EQUAL_INT(0 + board.width, result);//not valid tile |
|
|
|
} |
|
|
|
|
|
|
|
#endif // TEST |