test main

This commit is contained in:
Alexei Keller 2025-11-06 16:32:17 +01:00
parent 6adbaf539e
commit 51b54badda
5 changed files with 15 additions and 6 deletions

View File

@ -1,7 +1,9 @@
/**/
#include "game.h"
#include <time.h>
#include <stdlib.h>
#include <string.h>
#include <ctype.h>
#define MAX_RAND_TRIES_PER_WORD 10
@ -12,6 +14,7 @@
* restliche Felder mit zufälligen Buchstaben füllen */
// Creates the word salad by placing words randomly and filling empty spaces
/*
int createWordSalad(char salad[MAX_SEARCH_FIELD_LEN][MAX_SEARCH_FIELD_LEN], unsigned int searchFieldLen, const char words[][MAX_WORD_LEN], unsigned int wordCount)
{
srand(time(NULL));
@ -128,4 +131,4 @@ void showWordSalad(const char salad[MAX_SEARCH_FIELD_LEN][MAX_SEARCH_FIELD_LEN],
}
printf("\n");
}
}
} *\

Binary file not shown.

View File

@ -1,3 +1,4 @@
/*
#include "input.h"
#include <string.h>
#include <ctype.h>
@ -16,17 +17,22 @@ int readWords(FILE *file, char words[][MAX_WORD_LEN], unsigned int maxWordCount)
while(fgets(puffer, MAX_LINE_LEN-1, file) != NULL && counter < maxWordCount)
{
char *word_parts = strtok(puffer, ",;\n\t/. "); //Wörter aufteilen
printf("...");
while(word_parts != NULL && counter < maxWordCount)
{
printf("!!!!");
for(i = 0; i < MAX_WORD_LEN -1 && word_parts[i] != '\0'; i++)
{
words[counter][i] = toupper(word_parts[i]); //Großbuchstaben erzeugen
printf("????");
words[counter][i] = toupper(word_parts[i]); //Großbuchstaben erzeugen
}
words[counter][i] = '\0'; //Stringdefinition vervollständigen
counter++; // Wort eingelesen, Wortzähler erhöhen
word_parts = strtok(NULL, ",;\n\t/. "); //NULL für Zeiger angeben
}
counter++; // Wort eingelesen, Wortzähler erhöhen
word_parts = strtok(NULL, ",;\n\t/. "); //NULL für Zeiger angeben
}
return counter;
}

View File

@ -33,7 +33,7 @@ graphicalGame.o: graphicalGame.c
# --------------------------
# Unit Tests
# --------------------------
TEST_BIN = runTests
TEST_BIN = runTests2
test: input.o game.o unit_tests.c
$(CC) $(CFLAGS) -I$(unityfolder) -o $(TEST_BIN) input.o game.o unit_tests.c $(BINARIES)/libunity.a

BIN
Start_Windows/runTests2.exe Normal file

Binary file not shown.