Compare commits

..

9 Commits
main ... main

Author SHA1 Message Date
6cfaf703b9 ööö 2025-10-14 15:13:39 +02:00
de4bb4c3db Merge remote-tracking branch 'origin/main'
# Conflicts:
#	Start_Windows/main.c
2025-10-14 15:12:03 +02:00
e863676981 ööö 2025-10-14 15:09:16 +02:00
7afa756c9b Test 2025-10-14 15:08:08 +02:00
b6d34f6f6c Test 2025-10-14 15:07:08 +02:00
a67724715a Merge remote-tracking branch 'origin/main'
# Conflicts:
#	Start_Windows/main.c
2025-10-14 15:05:59 +02:00
5ea0af4074 Test 2025-10-14 15:03:13 +02:00
166ec82da6 Test 2025-10-14 15:03:04 +02:00
b267091f4b first commit 2025-10-14 15:01:09 +02:00
11 changed files with 14 additions and 102 deletions

View File

@ -1,9 +1,9 @@
CC = gcc
CFLAGS = -g -Wall
CFLAGS = -g -Wall -I$(raylibfolder)
LDFLAGS = -lGL -lX11 -lm
BINARIES = ./linux
raylibfolder = ./raylib
raylib_folder = ./raylib
unityfolder = ./unity
# --------------------------
@ -28,7 +28,7 @@ game.o: game.c
$(CC) $(CFLAGS) -c game.c
graphicalGame.o: graphicalGame.c
$(CC) $(CFLAGS) -I$(raylibfolder) -c graphicalGame.c
$(CC) $(CFLAGS) -c graphicalGame.c
# --------------------------
# Unit Tests

View File

@ -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 ----------
// Hier Setup- und TearDown-Funktionen definieren,
// falls Vor- und Nachbereitungen für die Tests benötigt.
@ -164,7 +134,6 @@ int main(void) {
RUN_TEST(test_readWords_empty_file);
RUN_TEST(test_createWordSalad_all_fit);
RUN_TEST(test_createWordSalad_too_small);
RUN_TEST(test_createWordSalad_allWordsPlaced);
int result = UNITY_END(); // Test-Ergebnisse
print_test_result(result);

View File

@ -4,7 +4,7 @@ LDFLAGS = -framework OpenGL -framework CoreFoundation -framework CoreGraphics -f
ARCH := $(shell uname -m)
BINARIES = ./macos-$(ARCH)
raylibfolder = ./raylib
raylib_folder = ./raylib
unityfolder = ./unity
# --------------------------
@ -43,4 +43,4 @@ test: input.o game.o unit_tests.c $(BINARIES)/libunity.a
# Clean
# --------------------------
clean:
rm -f *.o wordsalad $(TEST_BIN)
rm -f *.o wordsalad

View File

@ -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 ----------
// Hier Setup- und TearDown-Funktionen definieren,
@ -164,7 +135,6 @@ int main(void) {
RUN_TEST(test_readWords_empty_file);
RUN_TEST(test_createWordSalad_all_fit);
RUN_TEST(test_createWordSalad_too_small);
RUN_TEST(test_createWordSalad_allWordsPlaced);
int result = UNITY_END(); // Test-Ergebnisse
print_test_result(result);

View File

@ -40,7 +40,9 @@ int main(int argc, char *argv[])
// Check if all words were successfully placed
// Start the game if successful
// error message if some words couldn't be placed
//function llll
// ha
//function xxx
}
else
{

View File

@ -1,9 +1,9 @@
CC = gcc
CFLAGS = -g -Wall
CFLAGS = -g -Wall -I$(raylibfolder)
LDFLAGS = -lopengl32 -lgdi32 -lwinmm
BINARIES = ./windows
raylibfolder = ./raylib
raylib_folder = ./raylib
unityfolder = ./unity
# --------------------------
@ -12,6 +12,7 @@ unityfolder = ./unity
wordsalad_initial:
$(CC) -o wordsalad_initial $(BINARIES)/libwordsalad_complete.a $(BINARIES)/libraylib.a $(LDFLAGS)
# --------------------------
# Normales Spiel bauen
# --------------------------
@ -22,13 +23,13 @@ main.o: main.c
$(CC) -c $(CFLAGS) main.c
input.o: input.c
$(CC) -c $(CFLAGS) input.c
$(CC) -c $(CFLAGS)input.c
game.o: game.c
$(CC) -c $(CFLAGS) game.c
graphicalGame.o: graphicalGame.c
$(CC) -I$(raylibfolder) -c $(CFLAGS) graphicalGame.c
$(CC) -I$(raylib_folder) -c $(CFLAGS) graphicalGame.c
# --------------------------
# Unit Tests

View File

@ -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 ----------
// Hier Setup- und TearDown-Funktionen definieren,
@ -164,7 +135,6 @@ int main(void) {
RUN_TEST(test_readWords_empty_file);
RUN_TEST(test_createWordSalad_all_fit);
RUN_TEST(test_createWordSalad_too_small);
RUN_TEST(test_createWordSalad_allWordsPlaced);
int result = UNITY_END(); // Test-Ergebnisse
print_test_result(result);