From 25e6cc69a0f25d3ccba43ff25079ea30eefa7a4f Mon Sep 17 00:00:00 2001 From: Luis Hahn Date: Mon, 5 Feb 2024 13:22:31 +0100 Subject: [PATCH] Turm else eingebaut, Luis Hahn --- src/Turm.c | 2 ++ test/test_Turm.c | 27 +++++++++++++++++++++++++++ 2 files changed, 29 insertions(+) diff --git a/src/Turm.c b/src/Turm.c index 04991cd..c12a07c 100644 --- a/src/Turm.c +++ b/src/Turm.c @@ -48,6 +48,8 @@ int counter = 0; return true; } + }else{ + return false; } diff --git a/test/test_Turm.c b/test/test_Turm.c index be5226b..a28de2a 100644 --- a/test/test_Turm.c +++ b/test/test_Turm.c @@ -38,6 +38,8 @@ void test_Turm_Y_Bewegung(void) { free(brett); } + + void test_Turm_X_Bewegung(void) { char** brett = Schachbrett_erstellen(); @@ -88,6 +90,31 @@ void test_Turm_negative_Y_Bewegung(void) { free(brett); } +void test_Turm_Falsche_Bewegung(void) { + + char** brett = Schachbrett_erstellen(); + int startX = 0; + int startY = 0; + int endX = 1; + int endY = 3; + Player player = PLAYER_WHITE; + + + TEST_ASSERT_NOT_NULL(brett); + + + print_Schachfeld(brett); + + + TEST_ASSERT_FALSE(istzugerlaubt_Turm( brett, startX, startY, endX, endY, player)); + + + for (int i = 0; i < 8; i++) { + free(brett[i]); + } + free(brett); +} + #endif // TEST