Compare commits
11 Commits
main
...
Simons-Eig
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
d352e260d6 | ||
|
|
df2d64c137 | ||
|
|
ad88cbbba6 | ||
|
|
30ef5e53f5 | ||
|
|
9026fa88ec | ||
| 90bf5a0067 | |||
|
|
10a40bce76 | ||
| f350608626 | |||
| 96f7b5379c | |||
| 04eed79178 | |||
|
|
5b47609325 |
6
.gitignore
vendored
Normal file
6
.gitignore
vendored
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
Start_Windows/main.o
|
||||||
|
Start_Windows/graphicalGame.o
|
||||||
|
Start_Windows/wordsalad_myversion.exe
|
||||||
|
Start_Windows/game.o
|
||||||
|
Start_Windows/input.o
|
||||||
|
Start_Windows/wordsalad.exe
|
||||||
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,18 +6,153 @@
|
|||||||
#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 */
|
||||||
|
|
||||||
// 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)
|
||||||
{
|
{
|
||||||
|
// set seed
|
||||||
|
// showWordSalad(salad, 20);
|
||||||
|
|
||||||
|
for (int i = 0; i < MAX_SEARCH_FIELD_LEN; i++)
|
||||||
|
{
|
||||||
|
for (int j = 0; j < MAX_SEARCH_FIELD_LEN; j++)
|
||||||
|
{
|
||||||
|
salad[i][j] = '\0';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// showWordSalad(salad, 20);
|
||||||
|
srand(time(NULL));
|
||||||
|
|
||||||
|
int wordsPlaced = 0;
|
||||||
|
|
||||||
|
// loop through all words
|
||||||
|
for (int n = 0; n < wordCount; n++)
|
||||||
|
{
|
||||||
|
int checkSquare, retries = 0;
|
||||||
|
int wordLength = strlen(words[n]);
|
||||||
|
|
||||||
|
if(wordLength > searchFieldLen) {
|
||||||
|
printf("Fehler");
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
// get random coordinates
|
||||||
|
int rndX = rand() % (searchFieldLen - wordLength + 1);
|
||||||
|
int rndY = rand() % (searchFieldLen - wordLength + 1);
|
||||||
|
|
||||||
|
if (rand() % 2)
|
||||||
|
{
|
||||||
|
// checks if word fits into gamefield
|
||||||
|
while (checkSquare != wordLength && retries < 10)
|
||||||
|
{
|
||||||
|
checkSquare = 0;
|
||||||
|
// checks if squares to paste into is already taken
|
||||||
|
for (int x = rndX; x < (rndX + wordLength); x++)
|
||||||
|
{
|
||||||
|
if (salad[rndY][x] == '\0')
|
||||||
|
checkSquare++;
|
||||||
|
}
|
||||||
|
|
||||||
|
// new coords when doesnt fit
|
||||||
|
if (checkSquare != wordLength)
|
||||||
|
{
|
||||||
|
rndX = rand() % (searchFieldLen - wordLength + 1);
|
||||||
|
rndY = rand() % (searchFieldLen - wordLength + 1);
|
||||||
|
|
||||||
|
retries++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (retries >= 10)
|
||||||
|
{
|
||||||
|
printf("Word %d couldn't be placed", n);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
// pastes word into the line
|
||||||
|
if (checkSquare == wordLength)
|
||||||
|
{
|
||||||
|
for (int x = 0; x < wordLength; x++)
|
||||||
|
{
|
||||||
|
salad[rndY][rndX + x] = words[n][x];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
wordsPlaced++;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
|
||||||
|
// checks if word fits into gamefield
|
||||||
|
while (checkSquare != wordLength && retries < 10)
|
||||||
|
{
|
||||||
|
checkSquare = 0;
|
||||||
|
// checks if squares to paste into is already taken
|
||||||
|
for (int y = rndY; y < (rndY + wordLength); y++)
|
||||||
|
{
|
||||||
|
if (salad[y][rndX] == '\0')
|
||||||
|
checkSquare++;
|
||||||
|
}
|
||||||
|
|
||||||
|
// new coords when doesnt fit
|
||||||
|
if (checkSquare != wordLength)
|
||||||
|
{
|
||||||
|
rndX = rand() % (searchFieldLen - wordLength + 1);
|
||||||
|
rndY = rand() % (searchFieldLen - wordLength + 1);
|
||||||
|
|
||||||
|
retries++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (retries >= 10)
|
||||||
|
{
|
||||||
|
printf("Word %d couldn't be placed", n);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
// pastes word into the line
|
||||||
|
if (checkSquare == wordLength)
|
||||||
|
{
|
||||||
|
for (int y = 0; y < wordLength; y++)
|
||||||
|
{
|
||||||
|
salad[y + rndY][rndX] = words[n][y];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
wordsPlaced++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// fill voids
|
||||||
|
for (int x = 0; x < searchFieldLen; x++)
|
||||||
|
{
|
||||||
|
for (int y = 0; y < searchFieldLen; y++)
|
||||||
|
{
|
||||||
|
if (salad[y][x] == '\0')
|
||||||
|
{
|
||||||
|
// random number from 65 (A) to 90 (Z) with ASCII
|
||||||
|
salad[y][x] = rand() % (25 + 1) + 65;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return wordsPlaced;
|
||||||
}
|
}
|
||||||
|
|
||||||
// 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)
|
||||||
{
|
{
|
||||||
|
int i, j = 0;
|
||||||
|
for (i = 0; i < searchFieldLen; i++)
|
||||||
|
{
|
||||||
|
for (j = 0; j < searchFieldLen - 1; j++)
|
||||||
|
{
|
||||||
|
printf(" %c,", salad[i][j]);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
printf(" %c\n", salad[i][searchFieldLen]);
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -8,5 +8,38 @@
|
|||||||
// 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)
|
||||||
{
|
{
|
||||||
|
char puffer[MAX_LINE_LEN];
|
||||||
|
char *teiler = " ,;.\n";
|
||||||
|
char *token;
|
||||||
|
|
||||||
|
if (file == NULL)
|
||||||
|
{
|
||||||
|
printf("\nNot able to open file.\n");
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
int n = 0;
|
||||||
|
|
||||||
|
while (fgets(puffer, MAX_LINE_LEN, file) != NULL)
|
||||||
|
{
|
||||||
|
token = strtok(puffer, teiler);
|
||||||
|
|
||||||
|
while (token != NULL)
|
||||||
|
{
|
||||||
|
strncpy(words[n], token, MAX_WORD_LEN);
|
||||||
|
|
||||||
|
char *s = words[n];
|
||||||
|
while (*s)
|
||||||
|
{
|
||||||
|
*s = toupper((unsigned char)*s);
|
||||||
|
s++;
|
||||||
|
}
|
||||||
|
|
||||||
|
// printf("Einzelwort: %s\n", words[n]);
|
||||||
|
|
||||||
|
token = strtok(NULL, teiler);
|
||||||
|
n++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return n;
|
||||||
}
|
}
|
||||||
@ -40,6 +40,15 @@ int main(int argc, char *argv[])
|
|||||||
// Check if all words were successfully placed
|
// Check if all words were successfully placed
|
||||||
// Start the game if successful
|
// Start the game if successful
|
||||||
// error message if some words couldn't be placed
|
// error message if some words couldn't be placed
|
||||||
|
if(placedWords == wordCount)
|
||||||
|
{
|
||||||
|
printf("All words placed successfully (%u / %u).\n", placedWords, wordCount);
|
||||||
|
startGame(wordSalad, SALAD_SIZE, words, wordCount, 800);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
printf("Could only place %u of %u words.\n", placedWords, wordCount);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|||||||
@ -1,17 +1,25 @@
|
|||||||
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
|
||||||
|
|
||||||
|
# --------------------------
|
||||||
|
# eigenes Spiel bauen
|
||||||
|
# --------------------------
|
||||||
|
wordsalad_myversion: main.o graphicalGame.o $(BINARIES)/libwordsalad.a $(BINARIES)/libraylib.a
|
||||||
|
$(CC) -o wordsalad_myversion main.o graphicalGame.o $(BINARIES)/libwordsalad.a $(BINARIES)/libraylib.a $(LDFLAGS)
|
||||||
|
|
||||||
|
|
||||||
# --------------------------
|
# --------------------------
|
||||||
# initiales Spiel bauen
|
# initiales Spiel bauen
|
||||||
# --------------------------
|
# --------------------------
|
||||||
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)
|
||||||
|
|
||||||
|
|
||||||
# --------------------------
|
# --------------------------
|
||||||
# Normales Spiel bauen
|
# Normales Spiel bauen
|
||||||
# --------------------------
|
# --------------------------
|
||||||
@ -19,7 +27,7 @@ all: main.o input.o game.o graphicalGame.o $(BINARIES)/libraylib.a
|
|||||||
$(CC) $(CFLAGS) -o wordsalad main.o input.o game.o graphicalGame.o $(BINARIES)/libraylib.a $(LDFLAGS)
|
$(CC) $(CFLAGS) -o wordsalad main.o input.o game.o graphicalGame.o $(BINARIES)/libraylib.a $(LDFLAGS)
|
||||||
|
|
||||||
main.o: main.c
|
main.o: main.c
|
||||||
$(CC) -c $(CFLAGS) main.c
|
$(CC) -I$(raylib_folder) -c $(CFLAGS) main.c
|
||||||
|
|
||||||
input.o: input.c
|
input.o: input.c
|
||||||
$(CC) -c $(CFLAGS) input.c
|
$(CC) -c $(CFLAGS) input.c
|
||||||
@ -28,7 +36,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
|
||||||
@ -43,3 +51,9 @@ test: input.o game.o unit_tests.c
|
|||||||
# --------------------------
|
# --------------------------
|
||||||
clean:
|
clean:
|
||||||
del /f *.o *.exe
|
del /f *.o *.exe
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#[befehlname]: [dependency] -wenn in dependency eine änderung dann erstell neu
|
||||||
|
# gcc [code] - "-o [name]" Outputdatei Namen angeben "-c [name].c" kompiliere das programm "[name].a [name].o" benutze diese um das programm zu bauen
|
||||||
@ -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