From 890f363d88434969743bc3dc5c6d3f1e7bd848c4 Mon Sep 17 00:00:00 2001 From: David Moeller Date: Thu, 25 Jan 2024 10:48:18 +0100 Subject: [PATCH] Test moving left --- 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 6c400b8..3bd9b6a 100644 --- a/test/Snake/test_moving_snake.c +++ b/test/Snake/test_moving_snake.c @@ -38,4 +38,18 @@ void test_moving_down(void){ TEST_ASSERT_TRUE(result); } +void test_moving_left(void){ + /* arrange */ + bool result; + Snake snake = {-1, 3, {8 + 16 * 6, 7 + 16 * 6, 6 + 16 * 6}}; + Snake expected = {-1, 3, {7 + 16 * 6, 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