Browse Source

test toLower

remotes/origin/Saba
Saba Fazlali 11 months ago
parent
commit
0ba06ef885
  1. 4
      cmake-build-debug/Testing/Temporary/LastTest.log
  2. 24
      test/Hangman/test_playHangman.c

4
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

24
test/Hangman/test_playHangman.c

@ -1,5 +1,7 @@
#include <stdio.h> #include <stdio.h>
#include "playHangman.h"
#include "playHangman.c"
#include <assert.h>
void test_displayRules() { void test_displayRules() {
@ -18,4 +20,24 @@ void test_displayRules() {
printf("Expected Output: \"Please enter either 1 or 2 to continue:\"\n"); printf("Expected Output: \"Please enter either 1 or 2 to continue:\"\n");
printf("Actual Output: "); printf("Actual Output: ");
displayRules(); // Call displayRules() with invalid input 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 == '?');
} }
Loading…
Cancel
Save