From 6ce31b79c61b0eec2320011b4a1a8d6730cc1ae8 Mon Sep 17 00:00:00 2001 From: David Moeller Date: Wed, 7 Feb 2024 08:31:29 +0100 Subject: [PATCH] Test detect valid tile --- test/Minesweeper/test_is_Valid_tile.c | 28 +++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/test/Minesweeper/test_is_Valid_tile.c b/test/Minesweeper/test_is_Valid_tile.c index 65082e2..503146d 100644 --- a/test/Minesweeper/test_is_Valid_tile.c +++ b/test/Minesweeper/test_is_Valid_tile.c @@ -21,4 +21,32 @@ void test_detect_not_valid_tile(void){ TEST_ASSERT_EQUAL_INT(-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; + + /* act */ + result = is_Valid_tile(&board, tile, direction); + + /* assert */ + TEST_ASSERT_EQUAL_INT(0 + board.width, result);//not valid tile +} + #endif // TEST \ No newline at end of file