From 0a40d39849709aad2c3089c0d218a1cd67bf0079 Mon Sep 17 00:00:00 2001 From: David Moeller Date: Thu, 25 Jan 2024 10:49:00 +0100 Subject: [PATCH] Test moving up --- test/Snake/test_moving_snake.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/test/Snake/test_moving_snake.c b/test/Snake/test_moving_snake.c index 3bd9b6a..115d55f 100644 --- a/test/Snake/test_moving_snake.c +++ b/test/Snake/test_moving_snake.c @@ -52,4 +52,18 @@ void test_moving_left(void){ TEST_ASSERT_TRUE(result); } +void test_moving_up(void){ + /* arrange */ + bool result; + Snake snake = {-16, 3, {8 + 16 * 6, 7 + 16 * 6, 6 + 16 * 6}}; + Snake expected = {-16, 3, {8 + 16 * 5, 8 + 16 * 6, 7 + 16 * 6}}; + + /* act */ + move_snake(&snake); + result = memcmp(&snake, &expected, sizeof(Snake)) == 0; + + /* assert */ + TEST_ASSERT_TRUE(result); +} + #endif // TEST \ No newline at end of file