Browse Source

test displayRules

remotes/origin/Saba
Saba Fazlali 11 months ago
parent
commit
6d89e784ae
  1. BIN
      cmake-build-debug/.ninja_deps
  2. 2
      cmake-build-debug/.ninja_log
  3. 4
      cmake-build-debug/Testing/Temporary/LastTest.log
  4. 31
      test/Hangman/test_playHangman.c

BIN
cmake-build-debug/.ninja_deps

2
cmake-build-debug/.ninja_log

@ -20,3 +20,5 @@
41 68 1707259974621052571 pmuw_projekt_notebinder a5668107eb06d295 41 68 1707259974621052571 pmuw_projekt_notebinder a5668107eb06d295
0 41 1707260143202490285 CMakeFiles/pmuw_projekt_notebinder.dir/src/main/c/Hangman/playHangman.c.o f2e2af7048638ee6 0 41 1707260143202490285 CMakeFiles/pmuw_projekt_notebinder.dir/src/main/c/Hangman/playHangman.c.o f2e2af7048638ee6
41 66 1707260143227530868 pmuw_projekt_notebinder a5668107eb06d295 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

4
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

31
test/Hangman/test_playHangman.c

@ -1,18 +1,21 @@
#include "playHangman.c"
#include <string.h>
#include <stdio.h> #include <stdio.h>
#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
} }
Loading…
Cancel
Save