Browse Source

Test test if tile has a bomb

remotes/origin/David
David Moeller 11 months ago
parent
commit
063eb9ebe0
  1. 1
      src/main/c/Minesweeper/minesweeper_start.h
  2. 25
      test/Minesweeper/test_bomb_in_array.c

1
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

25
test/Minesweeper/test_bomb_in_array.c

@ -0,0 +1,25 @@
#ifdef TEST
#include "unity.h"
#include <stdbool.h>
#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
Loading…
Cancel
Save