From a1d79fd563975ab71a83436bdc924b22db9ebc69 Mon Sep 17 00:00:00 2001 From: Luis Hahn Date: Mon, 5 Feb 2024 13:35:12 +0100 Subject: [PATCH] =?UTF-8?q?Hinzuf=C3=BCgen=20der=20Verbindung=20zwischen?= =?UTF-8?q?=20Turm=20und=20Moving,=20Luis=20Hahn?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/Moving.c | 2 ++ test/test_Moving.c | 26 ++++++++++++++++++++++++++ 2 files changed, 28 insertions(+) diff --git a/src/Moving.c b/src/Moving.c index 848f037..d39fbe5 100644 --- a/src/Moving.c +++ b/src/Moving.c @@ -3,6 +3,7 @@ #include #include "spieler.h" #include "Bauer.h" +#include "Turm.h" bool istzugerlaubt(char** Brett, int startX, int startY, int endX, int endY, Player player) { @@ -25,6 +26,7 @@ bool istzugerlaubt(char** Brett, int startX, int startY, int endX, int endY, Pla switch (Brett[startY][startX]) { case 'R': //Datei von Turm aufrufen + return (istzugerlaubt_Turm(Brett, startX,startY,endX,endY,player)); break; case 'N': //Datei von Springer aufrufen diff --git a/test/test_Moving.c b/test/test_Moving.c index fdf9a48..c0153a9 100644 --- a/test/test_Moving.c +++ b/test/test_Moving.c @@ -3,6 +3,7 @@ #include "Schachbrett.h" #include "Moving.h" #include "Spieler.h" +#include "Turm.h" #include void setUp(void) { @@ -56,4 +57,29 @@ void test_istzugerlaubt(void){ } +void test_istzugerlaubt_Turm(void){ + + char** brett = Schachbrett_erstellen(); + int startX = 0; + int startY = 4; + int endX = 0; + int endY = 2; + Player player = PLAYER_WHITE; + + + TEST_ASSERT_NOT_NULL(brett); + + brett[4][0] = 'r'; + print_Schachfeld(brett); + + + TEST_ASSERT_TRUE(istzugerlaubt(brett, startX, startY, endX, endY, player)); + + + for (int i = 0; i < 8; i++) { + free(brett[i]); + } + free(brett); +} + #endif // TEST