|
|
@ -0,0 +1,24 @@ |
|
|
|
#ifdef TEST |
|
|
|
#include "unity.h" |
|
|
|
#include <stdbool.h> |
|
|
|
#include "../../src/main/c/Snake/snake_start.h" |
|
|
|
#include "../../src/main/c/Snake/get_character.h" |
|
|
|
|
|
|
|
|
|
|
|
void setUp(void){} |
|
|
|
void tearDown(void){} |
|
|
|
|
|
|
|
|
|
|
|
void test_self_collision(void){ |
|
|
|
/* arrange */ |
|
|
|
bool result; |
|
|
|
Snake snake = {{1, 0}, 5, {6 + 16 * 6, 6 + 16 * 7, 7 + 16 * 7, 7 + 16 * 6, 6 + 16 * 6}}; |
|
|
|
|
|
|
|
/* act */ |
|
|
|
result = check_if_dead(&snake); |
|
|
|
|
|
|
|
/* assert */ |
|
|
|
TEST_ASSERT_TRUE(result);//head collides with body |
|
|
|
} |
|
|
|
|
|
|
|
#endif // TEST |