Browse Source

Test self_collision

remotes/origin/David
David Moeller 11 months ago
parent
commit
ce57e7533c
  1. 1
      src/main/c/Snake/get_character.c
  2. 24
      test/Snake/test_collision.c
  3. 7
      test/Snake/test_part_of_snake.c

1
src/main/c/Snake/get_character.c

@ -3,7 +3,6 @@
#include <unistd.h>
#include <sys/select.h>
#include <termios.h>
#include <stdio.h>
#include <time.h>
struct termios orig_termios;

24
test/Snake/test_collision.c

@ -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

7
test/Snake/test_part_of_snake.c

@ -4,11 +4,8 @@
#include "../../src/main/c/Snake/get_character.h"
void setUp(void){
//Wenn Funktion Vorraussetzungen braucht
}
void tearDown(void){
}
void setUp(void){}
void tearDown(void){}
void test_find_head(void){

Loading…
Cancel
Save