From ecb3df3e5d879217ac8c9954d26cd57cf19e7ec0 Mon Sep 17 00:00:00 2001 From: Ronja Awe Date: Mon, 30 Jan 2023 14:50:55 +0100 Subject: [PATCH] =?UTF-8?q?If=20f=C3=BCr=20noch=20nicht=20am=20Ziel=20erst?= =?UTF-8?q?ellt?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/c/labyrinth.c | 9 +++++++-- test/c/test_labyrinth.c | 18 ++++++++++++++++++ 2 files changed, 25 insertions(+), 2 deletions(-) diff --git a/src/c/labyrinth.c b/src/c/labyrinth.c index b1b98e2..e177437 100644 --- a/src/c/labyrinth.c +++ b/src/c/labyrinth.c @@ -21,6 +21,11 @@ return 0; int wegsuchen(lab laby, int startx, int starty, int zielx, int ziely){ - - return 0; + if(startx == zielx && starty == ziely){ + return 0; + } + else{ + return -1; + } + } \ No newline at end of file diff --git a/test/c/test_labyrinth.c b/test/c/test_labyrinth.c index fb7f7ea..0f05551 100644 --- a/test/c/test_labyrinth.c +++ b/test/c/test_labyrinth.c @@ -50,6 +50,24 @@ void test_LabyrinthAmZiel(void){ TEST_ASSERT_EQUAL_INT(0, result); +} + +void test_LabyrinthAmZiel2(void){ + + int result; + int input = 1; + int hoehe = 3; + int breite = 3; + lab laby = { + {'1', '2', '3'}, + {'4', '5', '6'}, + {'7', '8', '9'}, + }; + + result = wegsuchen(laby, 1, 1, 0, 0); + TEST_ASSERT_EQUAL_INT(-1, result); + + } #endif // TEST \ No newline at end of file