diff --git a/src/main/c/Minesweeper/minesweeper_start.h b/src/main/c/Minesweeper/minesweeper_start.h index bf0f21a..a73d944 100644 --- a/src/main/c/Minesweeper/minesweeper_start.h +++ b/src/main/c/Minesweeper/minesweeper_start.h @@ -11,6 +11,7 @@ typedef struct Minesweeper_Board{ void minesweeper_start(); +bool bomb_in_array(int array[], int bomb, int length); #endif // MINESWEEPER_START_H \ No newline at end of file diff --git a/test/Minesweeper/test_bomb_in_array.c b/test/Minesweeper/test_bomb_in_array.c new file mode 100644 index 0000000..710791b --- /dev/null +++ b/test/Minesweeper/test_bomb_in_array.c @@ -0,0 +1,25 @@ +#ifdef TEST +#include "unity.h" +#include +#include "../../src/main/c/Minesweeper/minesweeper_start.h" + + +void setUp(void){} +void tearDown(void){} + + +void test_bomb_in_array(void){ + /* arrange */ + bool result; + int array[] = {5, 9, 42, 6, 87, 95, 202, 13, 45 ,78}; + int bomb = 42; + int length = 10; + + /* act */ + result = bomb_in_array(array, bomb, length); + + /* assert */ + TEST_ASSERT_TRUE(result);//head collides with body +} + +#endif // TEST \ No newline at end of file