|
@ -21,7 +21,21 @@ void test_moving_right(void){ |
|
|
result = memcmp(&snake, &expected, sizeof(Snake)) == 0; |
|
|
result = memcmp(&snake, &expected, sizeof(Snake)) == 0; |
|
|
|
|
|
|
|
|
/* assert */ |
|
|
/* assert */ |
|
|
TEST_ASSERT_TRUE(result);//head collides with body |
|
|
|
|
|
|
|
|
TEST_ASSERT_TRUE(result); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
void test_moving_down(void){ |
|
|
|
|
|
/* arrange */ |
|
|
|
|
|
bool result; |
|
|
|
|
|
Snake snake = {16, 3, {8 + 16 * 6, 7 + 16 * 6, 6 + 16 * 6}}; |
|
|
|
|
|
Snake expected = {16, 3, {8 + 16 * 7, 8 + 16 * 6, 7 + 16 * 6}}; |
|
|
|
|
|
|
|
|
|
|
|
/* act */ |
|
|
|
|
|
move_snake(&snake); |
|
|
|
|
|
result = memcmp(&snake, &expected, sizeof(Snake)) == 0; |
|
|
|
|
|
|
|
|
|
|
|
/* assert */ |
|
|
|
|
|
TEST_ASSERT_TRUE(result); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
#endif // TEST |
|
|
#endif // TEST |