From 43cd7406949edc5081215fd68894dc5426596690 Mon Sep 17 00:00:00 2001 From: Ronja Awe Date: Mon, 23 Jan 2023 13:15:13 +0100 Subject: [PATCH] =?UTF-8?q?Test=20hinzugef=C3=BCgt,=20Funktion=20reagiert?= =?UTF-8?q?=20auf=20userinput?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/c/raetselronja.c | 13 +++++++------ test/c/test_raetselronja.c | 20 +++++++++++++++++++- 2 files changed, 26 insertions(+), 7 deletions(-) diff --git a/src/c/raetselronja.c b/src/c/raetselronja.c index fb8665f..d17dda1 100644 --- a/src/c/raetselronja.c +++ b/src/c/raetselronja.c @@ -33,13 +33,13 @@ int zahlenraetsel(int input[], int loesung, int n) { } -int raetselaufruf(){ +int raetselaufruf() { int loesung = 0; int n = 0; - int auswahl = 1; + //int auswahl = 1; - // int auswahl = userInput(); + int auswahl = userInput(); switch (auswahl) { case 1: @@ -60,12 +60,13 @@ int raetselaufruf(){ loesung = 400; zahlenraetsel(input3, loesung, n); break; - default: return -1; + //default: return -1; } return auswahl; } -//Zahlenrätsel : 25,50,54,49,98,102,97,194 -//256,289,324,361, \ No newline at end of file + + + diff --git a/test/c/test_raetselronja.c b/test/c/test_raetselronja.c index 5f950f1..663b8e8 100644 --- a/test/c/test_raetselronja.c +++ b/test/c/test_raetselronja.c @@ -49,11 +49,29 @@ TEST_ASSERT_EQUAL_INT(0, result); void test_runRaetselTestrichtig(void){ +int input[] = {1,2}; +int loesung = 198; +int n = 2; + userInput_ExpectAndReturn(198); -int result = raetselaufruf(1); +int result = zahlenraetsel(input, loesung, n); TEST_ASSERT_EQUAL_INT(1, result); } + +void test_runRaetselTestAufruf(void){ + + userInput_ExpectAndReturn(1); + userInput_ExpectAndReturn(1); + int result = raetselaufruf(); + +TEST_ASSERT_EQUAL_INT(1, result); + +} + + + + #endif // TEST \ No newline at end of file