diff --git a/cmake-build-debug/.ninja_deps b/cmake-build-debug/.ninja_deps index ad32c4e..9978f2d 100644 Binary files a/cmake-build-debug/.ninja_deps and b/cmake-build-debug/.ninja_deps differ diff --git a/cmake-build-debug/.ninja_log b/cmake-build-debug/.ninja_log index 1ced4ca..5e1153a 100644 --- a/cmake-build-debug/.ninja_log +++ b/cmake-build-debug/.ninja_log @@ -22,3 +22,5 @@ 41 66 1707260143227530868 pmuw_projekt_notebinder a5668107eb06d295 2 209 1707265395136143124 CMakeFiles/pmuw_projekt_notebinder.dir/src/main/c/Hangman/playHangman.c.o f2e2af7048638ee6 209 296 1707265395223868349 pmuw_projekt_notebinder a5668107eb06d295 +0 192 1707267006006028181 CMakeFiles/pmuw_projekt_notebinder.dir/src/main/c/Hangman/word_selector.c.o fab41de4b8cc0421 +192 278 1707267006091837249 pmuw_projekt_notebinder a5668107eb06d295 diff --git a/cmake-build-debug/Testing/Temporary/LastTest.log b/cmake-build-debug/Testing/Temporary/LastTest.log index d4630a9..cf33378 100644 --- a/cmake-build-debug/Testing/Temporary/LastTest.log +++ b/cmake-build-debug/Testing/Temporary/LastTest.log @@ -1,3 +1,3 @@ -Start testing: Feb 07 01:43 CET +Start testing: Feb 07 01:50 CET ---------------------------------------------------------- -End testing: Feb 07 01:43 CET +End testing: Feb 07 01:50 CET diff --git a/src/main/c/Hangman/word_selector.c b/src/main/c/Hangman/word_selector.c index 157fb93..5b2b914 100644 --- a/src/main/c/Hangman/word_selector.c +++ b/src/main/c/Hangman/word_selector.c @@ -14,7 +14,7 @@ const char wordsList[NUM_WORDS][MAX_WORD_LENGTH + 1] = { "year", "dealer", "patience", - "initiative", + "table tennis", "pollution", "awareness", "problem", diff --git a/test/Hangman/test_playHangman.c b/test/Hangman/test_playHangman.c index 3f7ba5a..94e9743 100644 --- a/test/Hangman/test_playHangman.c +++ b/test/Hangman/test_playHangman.c @@ -2,8 +2,6 @@ #include "playHangman.c" #include - - void test_displayRules() { // Simulate user input: 1, 2, and an invalid input printf("Test Case 1: User enters '1' (YES)\n"); @@ -43,9 +41,16 @@ void test_toLower() { } void test_initializeHangman() { - char wordToGuess[] = "hangman"; - char currentGuess[8]; - initializeHangman(wordToGuess, currentGuess); - assert(strcmp(currentGuess, "_______") == 0); + // Test case 1: Word with alphabets only + char wordToGuess1[] = "hangman"; + char currentGuess1[8]; // Make sure this size is enough to accommodate the wordToGuess and the null terminator + initializeHangman(wordToGuess1, currentGuess1); + assert(strcmp(currentGuess1, "_______") == 0); + + // Test case 2: Word with spaces (e.g: table tennis) + char wordToGuess2[] = "hello world"; + char currentGuess2[12]; // Make sure this size is enough to accommodate the wordToGuess and the null terminator + initializeHangman(wordToGuess2, currentGuess2); + assert(strcmp(currentGuess2, "_____ _____") == 0); printf("initializeHangman test passed!\n"); } \ No newline at end of file