From 26229fcc6c432818e91ae0f74e010f1d1bd636ec Mon Sep 17 00:00:00 2001 From: Ronja Awe Date: Mon, 30 Jan 2023 14:32:28 +0100 Subject: [PATCH] funktion printlabyrinth erstellt --- src/c/labyrinth.c | 20 ++++++++++++++++++++ src/c/labyrinth.h | 10 ++++++++++ test/c/test_labyrinth.c | 36 ++++++++++++++++++++++++++++++++++++ 3 files changed, 66 insertions(+) create mode 100644 src/c/labyrinth.c create mode 100644 src/c/labyrinth.h create mode 100644 test/c/test_labyrinth.c diff --git a/src/c/labyrinth.c b/src/c/labyrinth.c new file mode 100644 index 0000000..dc8b99c --- /dev/null +++ b/src/c/labyrinth.c @@ -0,0 +1,20 @@ +#include +#include +#include +#include +#include +#include "labyrinth.h" + + + +int printlabyrinth(lab laby, int hoehe, int breite){ + + for(int i = 0; i < hoehe; i++){ + for(int j = 0; j < breite; j++){ + printf("%c ", laby[i][j]); + } + printf("\n"); + } + +return 0; +} \ No newline at end of file diff --git a/src/c/labyrinth.h b/src/c/labyrinth.h new file mode 100644 index 0000000..bda98ae --- /dev/null +++ b/src/c/labyrinth.h @@ -0,0 +1,10 @@ +#ifndef LABYRINTH_H +#define LABYRINTH_H + +#define MAXZEILEN 5 +#define MAXSPALTEN 5 + +typedef char lab[MAXZEILEN][MAXSPALTEN]; +int printlabyrinth(lab laby, int hoehe, int breite); + +#endif \ No newline at end of file diff --git a/test/c/test_labyrinth.c b/test/c/test_labyrinth.c new file mode 100644 index 0000000..5f3aa56 --- /dev/null +++ b/test/c/test_labyrinth.c @@ -0,0 +1,36 @@ +#ifdef TEST +#include "unity.h" +//in example.h wird die Funktion deklariert +#include "labyrinth.h" + +//Vor- bzw. Nachbereitung +void setUp(void) +{ +} + +void tearDown(void) +{ +} + + +void test_runExampleTest(void) +{ + + int result; + int input = 1; + int hoehe = 3; + int breite = 3; + lab laby = { + {'1', '2', '3'}, + {'4', '5', '6'}, + {'7', '8', '9'}, + }; + + + result = printlabyrinth(laby, hoehe, breite); + + + TEST_ASSERT_EQUAL_INT(0, result); +} + +#endif // TEST \ No newline at end of file