Compare commits
8 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| f637b84844 | |||
|
|
ad5a4de563 | ||
|
|
5e77016df3 | ||
| 1f3236c18b | |||
| 0feb82646e | |||
|
|
cb9246caa5 | ||
| 5a730de455 | |||
| 0b01ae2039 |
Binary file not shown.
@ -1,9 +1,9 @@
|
|||||||
CC = gcc
|
CC = gcc
|
||||||
CFLAGS = -g -Wall
|
CFLAGS = -g -Wall -I$(raylibfolder)
|
||||||
LDFLAGS = -lGL -lX11 -lm
|
LDFLAGS = -lGL -lX11 -lm
|
||||||
BINARIES = ./linux
|
BINARIES = ./linux
|
||||||
|
|
||||||
raylibfolder = ./raylib
|
raylib_folder = ./raylib
|
||||||
unityfolder = ./unity
|
unityfolder = ./unity
|
||||||
|
|
||||||
# --------------------------
|
# --------------------------
|
||||||
@ -28,7 +28,7 @@ game.o: game.c
|
|||||||
$(CC) $(CFLAGS) -c game.c
|
$(CC) $(CFLAGS) -c game.c
|
||||||
|
|
||||||
graphicalGame.o: graphicalGame.c
|
graphicalGame.o: graphicalGame.c
|
||||||
$(CC) $(CFLAGS) -I$(raylibfolder) -c graphicalGame.c
|
$(CC) $(CFLAGS) -c graphicalGame.c
|
||||||
|
|
||||||
# --------------------------
|
# --------------------------
|
||||||
# Unit Tests
|
# Unit Tests
|
||||||
|
|||||||
@ -101,37 +101,7 @@ void test_createWordSalad_too_small(void) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void test_createWordSalad_allWordsPlaced() {
|
|
||||||
char words[3][MAX_WORD_LEN] = {"CAT", "DOG", "MOUSE"};
|
|
||||||
char saladHoriz[MAX_SEARCH_FIELD_LEN][MAX_SEARCH_FIELD_LEN];
|
|
||||||
char saladVert[MAX_SEARCH_FIELD_LEN][MAX_SEARCH_FIELD_LEN];
|
|
||||||
|
|
||||||
int placed = createWordSalad(saladHoriz, 20, words, 3);
|
|
||||||
for(int i = 0; i < MAX_SEARCH_FIELD_LEN; i++)
|
|
||||||
{
|
|
||||||
for(int j = 0; j < MAX_SEARCH_FIELD_LEN; j++)
|
|
||||||
{
|
|
||||||
saladVert[j][i] = saladHoriz[i][j];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
for(int i = 0; i < 3; i++) {
|
|
||||||
const char* word = words[i];
|
|
||||||
int wordFound = 0;
|
|
||||||
for(int j = 0; j < MAX_SEARCH_FIELD_LEN; j++)
|
|
||||||
{
|
|
||||||
const char* row = saladHoriz[j];
|
|
||||||
const char* col = saladVert[j];
|
|
||||||
wordFound |= strstr(row, word) || strstr(col, word);
|
|
||||||
}
|
|
||||||
TEST_ASSERT_TRUE_MESSAGE(wordFound, "Not all words were placed.");
|
|
||||||
}
|
|
||||||
|
|
||||||
TEST_ASSERT_EQUAL_INT(3, placed);
|
|
||||||
}
|
|
||||||
|
|
||||||
// ---------- Test Setup und TearDown Funktionen ----------
|
// ---------- Test Setup und TearDown Funktionen ----------
|
||||||
|
|
||||||
// Hier Setup- und TearDown-Funktionen definieren,
|
// Hier Setup- und TearDown-Funktionen definieren,
|
||||||
// falls Vor- und Nachbereitungen für die Tests benötigt.
|
// falls Vor- und Nachbereitungen für die Tests benötigt.
|
||||||
|
|
||||||
@ -164,10 +134,9 @@ int main(void) {
|
|||||||
RUN_TEST(test_readWords_empty_file);
|
RUN_TEST(test_readWords_empty_file);
|
||||||
RUN_TEST(test_createWordSalad_all_fit);
|
RUN_TEST(test_createWordSalad_all_fit);
|
||||||
RUN_TEST(test_createWordSalad_too_small);
|
RUN_TEST(test_createWordSalad_too_small);
|
||||||
RUN_TEST(test_createWordSalad_allWordsPlaced);
|
|
||||||
|
|
||||||
int result = UNITY_END(); // Test-Ergebnisse
|
int result = UNITY_END(); // Test-Ergebnisse
|
||||||
print_test_result(result);
|
print_test_result(result);
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
@ -4,7 +4,7 @@ LDFLAGS = -framework OpenGL -framework CoreFoundation -framework CoreGraphics -f
|
|||||||
ARCH := $(shell uname -m)
|
ARCH := $(shell uname -m)
|
||||||
BINARIES = ./macos-$(ARCH)
|
BINARIES = ./macos-$(ARCH)
|
||||||
|
|
||||||
raylibfolder = ./raylib
|
raylib_folder = ./raylib
|
||||||
unityfolder = ./unity
|
unityfolder = ./unity
|
||||||
|
|
||||||
# --------------------------
|
# --------------------------
|
||||||
@ -43,4 +43,4 @@ test: input.o game.o unit_tests.c $(BINARIES)/libunity.a
|
|||||||
# Clean
|
# Clean
|
||||||
# --------------------------
|
# --------------------------
|
||||||
clean:
|
clean:
|
||||||
rm -f *.o wordsalad $(TEST_BIN)
|
rm -f *.o wordsalad
|
||||||
|
|||||||
@ -101,35 +101,6 @@ void test_createWordSalad_too_small(void) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void test_createWordSalad_allWordsPlaced() {
|
|
||||||
char words[3][MAX_WORD_LEN] = {"CAT", "DOG", "MOUSE"};
|
|
||||||
char saladHoriz[MAX_SEARCH_FIELD_LEN][MAX_SEARCH_FIELD_LEN];
|
|
||||||
char saladVert[MAX_SEARCH_FIELD_LEN][MAX_SEARCH_FIELD_LEN];
|
|
||||||
|
|
||||||
int placed = createWordSalad(saladHoriz, 20, words, 3);
|
|
||||||
for(int i = 0; i < MAX_SEARCH_FIELD_LEN; i++)
|
|
||||||
{
|
|
||||||
for(int j = 0; j < MAX_SEARCH_FIELD_LEN; j++)
|
|
||||||
{
|
|
||||||
saladVert[j][i] = saladHoriz[i][j];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
for(int i = 0; i < 3; i++) {
|
|
||||||
const char* word = words[i];
|
|
||||||
int wordFound = 0;
|
|
||||||
for(int j = 0; j < MAX_SEARCH_FIELD_LEN; j++)
|
|
||||||
{
|
|
||||||
const char* row = saladHoriz[j];
|
|
||||||
const char* col = saladVert[j];
|
|
||||||
wordFound |= strstr(row, word) || strstr(col, word);
|
|
||||||
}
|
|
||||||
TEST_ASSERT_TRUE_MESSAGE(wordFound, "Not all words were placed.");
|
|
||||||
}
|
|
||||||
|
|
||||||
TEST_ASSERT_EQUAL_INT(3, placed);
|
|
||||||
}
|
|
||||||
|
|
||||||
// ---------- Test Setup und TearDown Funktionen ----------
|
// ---------- Test Setup und TearDown Funktionen ----------
|
||||||
|
|
||||||
// Hier Setup- und TearDown-Funktionen definieren,
|
// Hier Setup- und TearDown-Funktionen definieren,
|
||||||
@ -164,7 +135,6 @@ int main(void) {
|
|||||||
RUN_TEST(test_readWords_empty_file);
|
RUN_TEST(test_readWords_empty_file);
|
||||||
RUN_TEST(test_createWordSalad_all_fit);
|
RUN_TEST(test_createWordSalad_all_fit);
|
||||||
RUN_TEST(test_createWordSalad_too_small);
|
RUN_TEST(test_createWordSalad_too_small);
|
||||||
RUN_TEST(test_createWordSalad_allWordsPlaced);
|
|
||||||
|
|
||||||
int result = UNITY_END(); // Test-Ergebnisse
|
int result = UNITY_END(); // Test-Ergebnisse
|
||||||
print_test_result(result);
|
print_test_result(result);
|
||||||
|
|||||||
@ -6,6 +6,7 @@
|
|||||||
#define MAX_RAND_TRIES_PER_WORD 10
|
#define MAX_RAND_TRIES_PER_WORD 10
|
||||||
#define EMPTY_CHAR 0
|
#define EMPTY_CHAR 0
|
||||||
|
|
||||||
|
|
||||||
//TODO: Spiellogik implementieren:
|
//TODO: Spiellogik implementieren:
|
||||||
/* * Wörter aus der Wortliste zufällig horizontal oder vertikal platzieren
|
/* * Wörter aus der Wortliste zufällig horizontal oder vertikal platzieren
|
||||||
* restliche Felder mit zufälligen Buchstaben füllen */
|
* restliche Felder mit zufälligen Buchstaben füllen */
|
||||||
@ -13,11 +14,81 @@
|
|||||||
// Creates the word salad by placing words randomly and filling empty spaces
|
// 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)
|
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((unsigned int)time(NULL));
|
||||||
|
|
||||||
|
// Spielfeld leeren
|
||||||
|
for (unsigned int i = 0; i < searchFieldLen; i++)
|
||||||
|
for (unsigned int j = 0; j < searchFieldLen; j++)
|
||||||
|
salad[i][j] = EMPTY_CHAR;
|
||||||
|
|
||||||
|
int placedCount = 0;
|
||||||
|
|
||||||
|
for (unsigned int w = 0; w < wordCount; w++) {
|
||||||
|
const char *word = words[w];
|
||||||
|
unsigned int len = strlen(word);
|
||||||
|
int placed = 0;
|
||||||
|
|
||||||
|
if (len > searchFieldLen)
|
||||||
|
continue; // Wort passt niemals ins Feld
|
||||||
|
|
||||||
|
for (int tries = 0; tries < MAX_RAND_TRIES_PER_WORD * searchFieldLen && !placed; tries++) {
|
||||||
|
int horizontal = rand() % 2;
|
||||||
|
|
||||||
|
unsigned int row = rand() % searchFieldLen;
|
||||||
|
unsigned int col = rand() % searchFieldLen;
|
||||||
|
|
||||||
|
// Stelle sicher, dass Wort im Spielfeld bleibt
|
||||||
|
if (horizontal) {
|
||||||
|
if (col + len > searchFieldLen) continue;
|
||||||
|
} else {
|
||||||
|
if (row + len > searchFieldLen) continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Prüfen, ob Platz frei ist oder gleiche Buchstaben überlappen
|
||||||
|
int fits = 1;
|
||||||
|
for (unsigned int i = 0; i < len; i++) {
|
||||||
|
char c = horizontal ? salad[row][col + i] : salad[row + i][col];
|
||||||
|
if (c != EMPTY_CHAR && c != word[i]) {
|
||||||
|
fits = 0;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!fits) continue;
|
||||||
|
|
||||||
|
// Wort einsetzen
|
||||||
|
for (unsigned int i = 0; i < len; i++) {
|
||||||
|
if (horizontal)
|
||||||
|
salad[row][col + i] = word[i];
|
||||||
|
else
|
||||||
|
salad[row + i][col] = word[i];
|
||||||
|
}
|
||||||
|
|
||||||
|
placed = 1;
|
||||||
|
placedCount++;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!placed) {
|
||||||
|
fprintf(stderr, "WARNUNG: Wort \"%s\" konnte nicht platziert werden.\n", word);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Leere Felder auffüllen
|
||||||
|
for (unsigned int i = 0; i < searchFieldLen; i++)
|
||||||
|
for (unsigned int j = 0; j < searchFieldLen; j++)
|
||||||
|
if (salad[i][j] == EMPTY_CHAR)
|
||||||
|
salad[i][j] = 'A' + (rand() % 26);
|
||||||
|
|
||||||
|
return placedCount;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Prints the word salad to console
|
// Prints the word salad to console
|
||||||
void showWordSalad(const char salad[MAX_SEARCH_FIELD_LEN][MAX_SEARCH_FIELD_LEN], unsigned int searchFieldLen)
|
void showWordSalad(const char salad[MAX_SEARCH_FIELD_LEN][MAX_SEARCH_FIELD_LEN], unsigned int searchFieldLen)
|
||||||
{
|
{
|
||||||
|
for (unsigned int i = 0; i < searchFieldLen; i++) {
|
||||||
|
for (unsigned int j = 0; j < searchFieldLen; j++) {
|
||||||
|
printf("%c ", salad[i][j]);
|
||||||
|
}
|
||||||
|
printf("\n");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -8,5 +8,32 @@
|
|||||||
// Read words from file and store in 'words' array
|
// Read words from file and store in 'words' array
|
||||||
int readWords(FILE *file, char words[][MAX_WORD_LEN], unsigned int maxWordCount)
|
int readWords(FILE *file, char words[][MAX_WORD_LEN], unsigned int maxWordCount)
|
||||||
{
|
{
|
||||||
|
if (file == NULL)
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
unsigned int count = 0;
|
||||||
|
char line[512];
|
||||||
|
|
||||||
|
// Lese Datei zeilenweise
|
||||||
|
while (fgets(line, sizeof(line), file) != NULL && count < maxWordCount)
|
||||||
|
{
|
||||||
|
// Zerlege die Zeile in Tokens (Wörter), getrennt durch gängige Delimiter
|
||||||
|
char *token = strtok(line, " ,;:.!?\"\n\r\t");
|
||||||
|
|
||||||
|
while (token != NULL && count < maxWordCount)
|
||||||
|
{
|
||||||
|
// In Großbuchstaben umwandeln
|
||||||
|
for (int i = 0; token[i]; i++)
|
||||||
|
token[i] = (char)toupper((unsigned char)token[i]);
|
||||||
|
|
||||||
|
// Wort kopieren
|
||||||
|
strncpy(words[count], token, MAX_WORD_LEN - 1);
|
||||||
|
words[count][MAX_WORD_LEN - 1] = '\0';
|
||||||
|
|
||||||
|
count++;
|
||||||
|
token = strtok(NULL, " ,;:.!?\"\n\r\t");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return count;
|
||||||
}
|
}
|
||||||
@ -6,49 +6,66 @@
|
|||||||
|
|
||||||
#define MAX_NUMBER_OF_WORDS 100
|
#define MAX_NUMBER_OF_WORDS 100
|
||||||
#define SALAD_SIZE 20
|
#define SALAD_SIZE 20
|
||||||
|
#define WINDOW_SIZE 800 // Fenstergröße für das grafische Spiel
|
||||||
|
|
||||||
int main(int argc, char *argv[])
|
int main(int argc, char *argv[])
|
||||||
{
|
{
|
||||||
int exitCode = EXIT_SUCCESS;
|
int exitCode = EXIT_SUCCESS;
|
||||||
|
|
||||||
// Check if the correct number of arguments is provided
|
// Check if the correct number of arguments is provided
|
||||||
if(argc != 2)
|
if(argc != 2)
|
||||||
|
{
|
||||||
|
fprintf(stderr, "Usage: %s <path to file with search words>\n", argv[0]);
|
||||||
|
exitCode = EXIT_FAILURE;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
char words[MAX_NUMBER_OF_WORDS][MAX_WORD_LEN]; // Array to hold the words to be used in the game
|
||||||
|
unsigned int wordCount = 0;
|
||||||
|
|
||||||
|
FILE *file = fopen(argv[1], "r");
|
||||||
|
|
||||||
|
if(file != NULL)
|
||||||
{
|
{
|
||||||
fprintf(stderr, "Usage: %s <path to file with search words>\n", argv[0]);
|
unsigned int placedWords = 0;
|
||||||
exitCode = EXIT_FAILURE;
|
char wordSalad[MAX_SEARCH_FIELD_LEN][MAX_SEARCH_FIELD_LEN]; // 2D array to store the word salad
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
char words[MAX_NUMBER_OF_WORDS][MAX_WORD_LEN]; // Array to hold the words to be used in the game
|
|
||||||
unsigned int wordCount = 0;
|
|
||||||
|
|
||||||
FILE *file = fopen(argv[1], "r");
|
// Read words from file and store in 'words' array
|
||||||
|
wordCount = readWords(file, words, MAX_NUMBER_OF_WORDS);
|
||||||
|
fclose(file);
|
||||||
|
|
||||||
if(file != NULL)
|
// Create the word salad by placing words into grid
|
||||||
|
placedWords = createWordSalad(wordSalad, SALAD_SIZE, words, wordCount);
|
||||||
|
|
||||||
|
// Check if all words were successfully placed
|
||||||
|
if (placedWords == wordCount)
|
||||||
{
|
{
|
||||||
unsigned int placedWords = 0;
|
printf("All %u words successfully placed!\n\n", placedWords);
|
||||||
char wordSalad[MAX_SEARCH_FIELD_LEN][MAX_SEARCH_FIELD_LEN]; // 2D array to store the word salad
|
|
||||||
|
|
||||||
// Read words from file and store in 'words' array
|
// Show the generated word salad on console
|
||||||
wordCount = readWords(file, words, MAX_NUMBER_OF_WORDS);
|
showWordSalad(wordSalad, SALAD_SIZE);
|
||||||
fclose(file);
|
|
||||||
|
|
||||||
// Create the word salad by placing words into grid
|
|
||||||
placedWords = createWordSalad(wordSalad, SALAD_SIZE, words, wordCount);
|
|
||||||
|
|
||||||
// TODO:
|
|
||||||
// Check if all words were successfully placed
|
|
||||||
// Start the game if successful
|
|
||||||
// error message if some words couldn't be placed
|
|
||||||
|
|
||||||
|
// Start the graphical game (raylib-basierte Version)
|
||||||
|
printf("\nStarting graphical word search game ...\n");
|
||||||
|
startGame(wordSalad, SALAD_SIZE, words, wordCount, WINDOW_SIZE);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// Print error message if file couldn't be opened
|
fprintf(stderr,
|
||||||
fprintf(stderr, "Could not open file %s for reading ...\n", argv[1]);
|
"Error: Only %u of %u words could be placed.\n"
|
||||||
|
"Please reduce the number of words or increase the grid size.\n",
|
||||||
|
placedWords, wordCount);
|
||||||
exitCode = EXIT_FAILURE;
|
exitCode = EXIT_FAILURE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// Print error message if file couldn't be opened
|
||||||
|
fprintf(stderr, "Could not open file %s for reading ...\n", argv[1]);
|
||||||
|
exitCode = EXIT_FAILURE;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return exitCode;
|
return exitCode;
|
||||||
}
|
|
||||||
|
}
|
||||||
|
|||||||
@ -1,9 +1,9 @@
|
|||||||
CC = gcc
|
CC = gcc
|
||||||
CFLAGS = -g -Wall
|
CFLAGS = -g -Wall -I$(raylib_folder)
|
||||||
LDFLAGS = -lopengl32 -lgdi32 -lwinmm
|
LDFLAGS = -lopengl32 -lgdi32 -lwinmm
|
||||||
BINARIES = ./windows
|
BINARIES = ./windows
|
||||||
|
|
||||||
raylibfolder = ./raylib
|
raylib_folder = ./raylib
|
||||||
unityfolder = ./unity
|
unityfolder = ./unity
|
||||||
|
|
||||||
# --------------------------
|
# --------------------------
|
||||||
@ -12,6 +12,15 @@ unityfolder = ./unity
|
|||||||
wordsalad_initial:
|
wordsalad_initial:
|
||||||
$(CC) -o wordsalad_initial $(BINARIES)/libwordsalad_complete.a $(BINARIES)/libraylib.a $(LDFLAGS)
|
$(CC) -o wordsalad_initial $(BINARIES)/libwordsalad_complete.a $(BINARIES)/libraylib.a $(LDFLAGS)
|
||||||
|
|
||||||
|
# ------------------------------
|
||||||
|
# Eigene Version mit libwordsalad.a
|
||||||
|
# ------------------------------
|
||||||
|
wordsalad_myversion:
|
||||||
|
$(CC) -o wordsalad_myversion main.o game.o input.o graphicalGame.o $(BINARIES)/libraylib.a $(LDFLAGS)
|
||||||
|
|
||||||
|
# .o Datein -> kompilierte .c Datein (Objektdateien)
|
||||||
|
#libraylib.a -> Graphik Bibliothek
|
||||||
|
|
||||||
# --------------------------
|
# --------------------------
|
||||||
# Normales Spiel bauen
|
# Normales Spiel bauen
|
||||||
# --------------------------
|
# --------------------------
|
||||||
@ -28,7 +37,7 @@ game.o: game.c
|
|||||||
$(CC) -c $(CFLAGS) game.c
|
$(CC) -c $(CFLAGS) game.c
|
||||||
|
|
||||||
graphicalGame.o: graphicalGame.c
|
graphicalGame.o: graphicalGame.c
|
||||||
$(CC) -I$(raylibfolder) -c $(CFLAGS) graphicalGame.c
|
$(CC) -I$(raylib_folder) -c $(CFLAGS) graphicalGame.c
|
||||||
|
|
||||||
# --------------------------
|
# --------------------------
|
||||||
# Unit Tests
|
# Unit Tests
|
||||||
|
|||||||
@ -101,35 +101,6 @@ void test_createWordSalad_too_small(void) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void test_createWordSalad_allWordsPlaced() {
|
|
||||||
char words[3][MAX_WORD_LEN] = {"CAT", "DOG", "MOUSE"};
|
|
||||||
char saladHoriz[MAX_SEARCH_FIELD_LEN][MAX_SEARCH_FIELD_LEN];
|
|
||||||
char saladVert[MAX_SEARCH_FIELD_LEN][MAX_SEARCH_FIELD_LEN];
|
|
||||||
|
|
||||||
int placed = createWordSalad(saladHoriz, 20, words, 3);
|
|
||||||
for(int i = 0; i < MAX_SEARCH_FIELD_LEN; i++)
|
|
||||||
{
|
|
||||||
for(int j = 0; j < MAX_SEARCH_FIELD_LEN; j++)
|
|
||||||
{
|
|
||||||
saladVert[j][i] = saladHoriz[i][j];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
for(int i = 0; i < 3; i++) {
|
|
||||||
const char* word = words[i];
|
|
||||||
int wordFound = 0;
|
|
||||||
for(int j = 0; j < MAX_SEARCH_FIELD_LEN; j++)
|
|
||||||
{
|
|
||||||
const char* row = saladHoriz[j];
|
|
||||||
const char* col = saladVert[j];
|
|
||||||
wordFound |= strstr(row, word) || strstr(col, word);
|
|
||||||
}
|
|
||||||
TEST_ASSERT_TRUE_MESSAGE(wordFound, "Not all words were placed.");
|
|
||||||
}
|
|
||||||
|
|
||||||
TEST_ASSERT_EQUAL_INT(3, placed);
|
|
||||||
}
|
|
||||||
|
|
||||||
// ---------- Test Setup und TearDown Funktionen ----------
|
// ---------- Test Setup und TearDown Funktionen ----------
|
||||||
|
|
||||||
// Hier Setup- und TearDown-Funktionen definieren,
|
// Hier Setup- und TearDown-Funktionen definieren,
|
||||||
@ -164,7 +135,6 @@ int main(void) {
|
|||||||
RUN_TEST(test_readWords_empty_file);
|
RUN_TEST(test_readWords_empty_file);
|
||||||
RUN_TEST(test_createWordSalad_all_fit);
|
RUN_TEST(test_createWordSalad_all_fit);
|
||||||
RUN_TEST(test_createWordSalad_too_small);
|
RUN_TEST(test_createWordSalad_too_small);
|
||||||
RUN_TEST(test_createWordSalad_allWordsPlaced);
|
|
||||||
|
|
||||||
int result = UNITY_END(); // Test-Ergebnisse
|
int result = UNITY_END(); // Test-Ergebnisse
|
||||||
print_test_result(result);
|
print_test_result(result);
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user