|
|
@ -0,0 +1,269 @@ |
|
|
|
#include "build/temp/../../src/main/c/Minesweeper/minesweeper_start.h" |
|
|
|
#include "/var/lib/gems/2.7.0/gems/ceedling-0.31.1/vendor/unity/src/unity.h" |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void setUp(void){} |
|
|
|
|
|
|
|
void tearDown(void){} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void test_detect_not_valid_tile_left(void){ |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Minesweeper_Board board = initialize_minesweeper(); |
|
|
|
|
|
|
|
int tile = 0; |
|
|
|
|
|
|
|
int direction = 2; |
|
|
|
|
|
|
|
int result; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
result = is_Valid_tile(&board, tile, direction); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
UnityAssertEqualNumber((UNITY_INT)((-1)), (UNITY_INT)((result)), ( |
|
|
|
|
|
|
|
((void *)0) |
|
|
|
|
|
|
|
), (UNITY_UINT)(21), UNITY_DISPLAY_STYLE_INT); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void test_detect_not_valid_tile_up(void){ |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Minesweeper_Board board = initialize_minesweeper(); |
|
|
|
|
|
|
|
int tile = 0; |
|
|
|
|
|
|
|
int direction = 3; |
|
|
|
|
|
|
|
int result; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
result = is_Valid_tile(&board, tile, direction); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
UnityAssertEqualNumber((UNITY_INT)((-1)), (UNITY_INT)((result)), ( |
|
|
|
|
|
|
|
((void *)0) |
|
|
|
|
|
|
|
), (UNITY_UINT)(35), UNITY_DISPLAY_STYLE_INT); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void test_detect_not_valid_tile_right(void){ |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Minesweeper_Board board = initialize_minesweeper(); |
|
|
|
|
|
|
|
int tile = board.width * board.height - 1; |
|
|
|
|
|
|
|
int direction = 5; |
|
|
|
|
|
|
|
int result; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
result = is_Valid_tile(&board, tile, direction); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
UnityAssertEqualNumber((UNITY_INT)((-1)), (UNITY_INT)((result)), ( |
|
|
|
|
|
|
|
((void *)0) |
|
|
|
|
|
|
|
), (UNITY_UINT)(49), UNITY_DISPLAY_STYLE_INT); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void test_detect_not_valid_tile_down(void){ |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Minesweeper_Board board = initialize_minesweeper(); |
|
|
|
|
|
|
|
int tile = board.width * board.height - 1; |
|
|
|
|
|
|
|
int direction = 4; |
|
|
|
|
|
|
|
int result; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
result = is_Valid_tile(&board, tile, direction); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
UnityAssertEqualNumber((UNITY_INT)((-1)), (UNITY_INT)((result)), ( |
|
|
|
|
|
|
|
((void *)0) |
|
|
|
|
|
|
|
), (UNITY_UINT)(63), UNITY_DISPLAY_STYLE_INT); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void test_detect_valid_tile_left(void){ |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Minesweeper_Board board = initialize_minesweeper(); |
|
|
|
|
|
|
|
int tile = board.width * board.height - 1; |
|
|
|
|
|
|
|
int direction = 2; |
|
|
|
|
|
|
|
int result; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
result = is_Valid_tile(&board, tile, direction); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
UnityAssertEqualNumber((UNITY_INT)((board.width * board.height - 2)), (UNITY_INT)((result)), ( |
|
|
|
|
|
|
|
((void *)0) |
|
|
|
|
|
|
|
), (UNITY_UINT)(77), UNITY_DISPLAY_STYLE_INT); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void test_detect_valid_tile_up(void){ |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Minesweeper_Board board = initialize_minesweeper(); |
|
|
|
|
|
|
|
int tile = board.width * board.height - 1; |
|
|
|
|
|
|
|
int direction = 3; |
|
|
|
|
|
|
|
int result; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
result = is_Valid_tile(&board, tile, direction); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
UnityAssertEqualNumber((UNITY_INT)((board.width * (board.height - 1) - 1)), (UNITY_INT)((result)), ( |
|
|
|
|
|
|
|
((void *)0) |
|
|
|
|
|
|
|
), (UNITY_UINT)(91), UNITY_DISPLAY_STYLE_INT); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void test_detect_valid_tile_right(void){ |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Minesweeper_Board board = initialize_minesweeper(); |
|
|
|
|
|
|
|
int tile = 0; |
|
|
|
|
|
|
|
int direction = 5; |
|
|
|
|
|
|
|
int result; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
result = is_Valid_tile(&board, tile, direction); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
UnityAssertEqualNumber((UNITY_INT)((1)), (UNITY_INT)((result)), ( |
|
|
|
|
|
|
|
((void *)0) |
|
|
|
|
|
|
|
), (UNITY_UINT)(105), UNITY_DISPLAY_STYLE_INT); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void test_detect_valid_tile_down(void){ |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Minesweeper_Board board = initialize_minesweeper(); |
|
|
|
|
|
|
|
int tile = 0; |
|
|
|
|
|
|
|
int direction = 4; |
|
|
|
|
|
|
|
int result; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
result = is_Valid_tile(&board, tile, direction); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
UnityAssertEqualNumber((UNITY_INT)((0 + board.width)), (UNITY_INT)((result)), ( |
|
|
|
|
|
|
|
((void *)0) |
|
|
|
|
|
|
|
), (UNITY_UINT)(119), UNITY_DISPLAY_STYLE_INT); |
|
|
|
|
|
|
|
} |