|
|
@ -1,5 +1,7 @@ |
|
|
|
#include <stdio.h> |
|
|
|
#include "playHangman.h" |
|
|
|
#include "playHangman.c" |
|
|
|
#include <assert.h> |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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 == '?'); |
|
|
|
} |