Browse Source

test drawHangman

remotes/origin/Saba
Saba Fazlali 11 months ago
parent
commit
08bf6e1b5c
  1. 21
      src/main/c/Hangman/Test/test_drawHangman.c
  2. 12
      test/Hangman/test_drawHangman.c
  3. 0
      test/Hangman/test_drawHangman.h
  4. 1
      test/Hangman/test_playHangman.c

21
src/main/c/Hangman/Test/test_drawHangman.c

@ -1,21 +0,0 @@
#include "test_drawHangman.h"
void test_drawHangman(int mistakes){
switch (mistakes) {
case 0:
drawHangman(0);
case 1:
drawHangman(1);
case 2:
drawHangman(2);
case 3:
drawHangman(3);
case 4:
drawHangman(4);
case 5:
drawHangman(5);
case 6:
drawHangman(6);
case 10: // More than 6 mistakes
drawHangman(10);
}
}

12
test/Hangman/test_drawHangman.c

@ -0,0 +1,12 @@
#include <stdio.h>
#include <assert.h>
#include "drawHangman.h"
#include "playHangman.h"
void test_drawHangman() {
// Test each case of incorrectGuesses
printf("Testing drawHangman(0):\n");
drawHangman(0);
printf("\n");
}

0
src/main/c/Hangman/Test/test_drawHangman.h → test/Hangman/test_drawHangman.h

1
src/main/c/Hangman/Test/test_playHangman.c → test/Hangman/test_playHangman.c

@ -2,7 +2,6 @@
#include <string.h>
#include <stdio.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) {
Loading…
Cancel
Save