From 4a00a81935017e4d341d21d11bb02eff74e71b52 Mon Sep 17 00:00:00 2001 From: Joe Lukas Kalb Date: Tue, 6 Feb 2024 18:18:08 +0100 Subject: [PATCH] turn_direction_right W --> N --- src/main/c/labyrinth.c | 3 +++ src/test/c/test_labyrinth.c | 13 +++++++++++++ 2 files changed, 16 insertions(+) diff --git a/src/main/c/labyrinth.c b/src/main/c/labyrinth.c index d53c95b..a76a53b 100644 --- a/src/main/c/labyrinth.c +++ b/src/main/c/labyrinth.c @@ -16,5 +16,8 @@ void turn_direction_right(Direction *direction){ case S: *direction = W; break; + case W: + *direction = N; + break; } } diff --git a/src/test/c/test_labyrinth.c b/src/test/c/test_labyrinth.c index 555736d..e257b07 100644 --- a/src/test/c/test_labyrinth.c +++ b/src/test/c/test_labyrinth.c @@ -51,3 +51,16 @@ void test_turn_direction_right_from_S_expected_W(void) TEST_ASSERT_TRUE(expected == actual); } +void test_turn_direction_right_from_W_expected_N(void) +{ + /* arrange */ + Direction actual = W; + Direction expected = N; + + /* act */ + turn_direction_right(&actual); + + /* assert */ + TEST_ASSERT_TRUE(expected == actual); +} +