From 0ba06ef885ada58077bd8e22a9b36676252d09e0 Mon Sep 17 00:00:00 2001 From: Saba Fazlali Date: Wed, 7 Feb 2024 01:43:57 +0100 Subject: [PATCH] test toLower --- .../Testing/Temporary/LastTest.log | 4 ++-- test/Hangman/test_playHangman.c | 24 ++++++++++++++++++- 2 files changed, 25 insertions(+), 3 deletions(-) diff --git a/cmake-build-debug/Testing/Temporary/LastTest.log b/cmake-build-debug/Testing/Temporary/LastTest.log index e5ab0e9..d4630a9 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:39 CET +Start testing: Feb 07 01:43 CET ---------------------------------------------------------- -End testing: Feb 07 01:39 CET +End testing: Feb 07 01:43 CET diff --git a/test/Hangman/test_playHangman.c b/test/Hangman/test_playHangman.c index 7e01f23..cfc47b0 100644 --- a/test/Hangman/test_playHangman.c +++ b/test/Hangman/test_playHangman.c @@ -1,5 +1,7 @@ #include -#include "playHangman.h" +#include "playHangman.c" +#include + void test_displayRules() { @@ -18,4 +20,24 @@ void test_displayRules() { printf("Expected Output: \"Please enter either 1 or 2 to continue:\"\n"); printf("Actual Output: "); displayRules(); // Call displayRules() with invalid input +} + +void test_toLower() { + printf("Test Case 1: Lowercase letter 'a'\n"); + printf("Expected Output: 'a'\n"); + char result = toLower('a'); + printf("Actual Output: '%c'\n", result); + assert(result == 'a'); + + printf("\nTest Case 2: Uppercase letter 'B'\n"); + printf("Expected Output: 'b'\n"); + result = toLower('B'); + printf("Actual Output: '%c'\n", result); + assert(result == 'b'); + + printf("\nTest Case 3: Non-alphabetic character '#'\n"); + printf("Expected Output: '#'\n"); + result = toLower('?'); + printf("Actual Output: '%c'\n", result); + assert(result == '?'); } \ No newline at end of file