From 6d89e784aea3192bae6ffa2d9dc09bf2712ea287 Mon Sep 17 00:00:00 2001 From: Saba Fazlali Date: Wed, 7 Feb 2024 01:39:44 +0100 Subject: [PATCH] test displayRules --- cmake-build-debug/.ninja_deps | Bin 38316 -> 38716 bytes cmake-build-debug/.ninja_log | 2 ++ .../Testing/Temporary/LastTest.log | 4 +-- test/Hangman/test_playHangman.c | 31 ++++++++++-------- 4 files changed, 21 insertions(+), 16 deletions(-) diff --git a/cmake-build-debug/.ninja_deps b/cmake-build-debug/.ninja_deps index c82727a0759cbdc3efa6fedcc3899dbce9cb51d4..ad32c4ec4524529a6b8eeae7125ce3d329ed0701 100644 GIT binary patch delta 25 hcmZ3pnrY8ErVVSRPQFvZ!6qV~aqUXZ<~Y|TMgW^*3o-xz delta 9 Rcmdn9j%m$mrVVSR0st3>1h)VH diff --git a/cmake-build-debug/.ninja_log b/cmake-build-debug/.ninja_log index e2bb7e3..1ced4ca 100644 --- a/cmake-build-debug/.ninja_log +++ b/cmake-build-debug/.ninja_log @@ -20,3 +20,5 @@ 41 68 1707259974621052571 pmuw_projekt_notebinder a5668107eb06d295 0 41 1707260143202490285 CMakeFiles/pmuw_projekt_notebinder.dir/src/main/c/Hangman/playHangman.c.o f2e2af7048638ee6 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 diff --git a/cmake-build-debug/Testing/Temporary/LastTest.log b/cmake-build-debug/Testing/Temporary/LastTest.log index 47dd361..e5ab0e9 100644 --- a/cmake-build-debug/Testing/Temporary/LastTest.log +++ b/cmake-build-debug/Testing/Temporary/LastTest.log @@ -1,3 +1,3 @@ -Start testing: Feb 06 23:55 CET +Start testing: Feb 07 01:39 CET ---------------------------------------------------------- -End testing: Feb 06 23:55 CET +End testing: Feb 07 01:39 CET diff --git a/test/Hangman/test_playHangman.c b/test/Hangman/test_playHangman.c index 2b4c51b..7e01f23 100644 --- a/test/Hangman/test_playHangman.c +++ b/test/Hangman/test_playHangman.c @@ -1,18 +1,21 @@ -#include "playHangman.c" -#include #include +#include "playHangman.h" -// Custom assert function to compare expected and actual values -void assert_equal(const char *test_name, const char *expected, const char *actual) { - if (strcmp(expected, actual) == 0) { - printf("[PASS] %s\n", test_name); - } else { - printf("[FAIL] %s - Expected: \"%s\", Actual: \"%s\"\n", test_name, expected, actual); - } -} -// Test function for playHangman() -void test_playHangman() { - char wordToGuess[] = "test"; - //playHangman(wordToGuess); +void test_displayRules() { + // Simulate user input: 1, 2, and an invalid input + printf("Test Case 1: User enters '1' (YES)\n"); + printf("Expected Output: \"Let's get started!\"\n"); + printf("Actual Output: "); + displayRules(); // Call displayRules() with input 1 + + printf("\nTest Case 2: User enters '2' (NO)\n"); + printf("Expected Output: Output of printRules()\n"); + printf("Actual Output: "); + displayRules(); // Call displayRules() with input 2 + + printf("\nTest Case 3: User enters an invalid input\n"); + printf("Expected Output: \"Please enter either 1 or 2 to continue:\"\n"); + printf("Actual Output: "); + displayRules(); // Call displayRules() with invalid input } \ No newline at end of file