diff --git a/src/main/c/Tim/hangman.c b/src/main/c/Tim/hangman.c index 974f5b6..33293be 100644 --- a/src/main/c/Tim/hangman.c +++ b/src/main/c/Tim/hangman.c @@ -6,8 +6,7 @@ #define LISTSIZE 10 #define MAX_WORD_LENGTH 30 -char* getWordFromList(int); -int getParameters(int, char*); + char wordlist[LISTSIZE][MAX_WORD_LENGTH] = { "Kartoffel", "Zigarette", "Haus", "Fenster", "Kartenleseettiketiergeraet", diff --git a/src/main/c/Tim/hangman.h b/src/main/c/Tim/hangman.h index cd17d02..0995129 100644 --- a/src/main/c/Tim/hangman.h +++ b/src/main/c/Tim/hangman.h @@ -2,5 +2,6 @@ #define HANGMAN_H void hangman(); +char* getWordFromList(int); #endif diff --git a/src/test/c/Tim/test_hangman.c b/src/test/c/Tim/test_hangman.c index 2afdf17..6ae6216 100644 --- a/src/test/c/Tim/test_hangman.c +++ b/src/test/c/Tim/test_hangman.c @@ -1,5 +1,6 @@ #include "hangman.h" #include "unity.h" +#include @@ -13,12 +14,26 @@ void tearDown(void) } -void test_ceedling_functionality() +void test_getWordFromList_Kartoffel_0() { //arrange - int expectedResult = 0; + int pos = 0; + char expectedResult[] = "Kartoffel"; //act - int actualResult = 0; + char actualResult[30]; + strcpy(actualResult,getWordFromList(pos)); //assert - TEST_ASSERT_EQUAL_INT(expectedResult, actualResult); + TEST_ASSERT_EQUAL_STRING(expectedResult, actualResult); +} + +void test_getWordFromList_Kleiderschrank_5() +{ + //arrange + int pos = 5; + char expectedResult[] = "Kleiderschrank"; + //act + char actualResult[30]; + strcpy(actualResult,getWordFromList(pos)); + //assert + TEST_ASSERT_EQUAL_STRING(expectedResult, actualResult); } \ No newline at end of file