From 92c0ab2c28223bc13c4e168ed577a2ee97dc4871 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Enrico=20Schr=C3=B6der?= Date: Thu, 16 Oct 2025 13:48:45 +0200 Subject: [PATCH 1/5] macOS lib Ordner umbenannt (x86_64) --- Start_Mac/{macos-x64 => macos-x86_64}/libraylib.a | Bin Start_Mac/{macos-x64 => macos-x86_64}/libunity.a | Bin .../{macos-x64 => macos-x86_64}/libwordsalad.a | Bin .../libwordsalad_complete.a | Bin 4 files changed, 0 insertions(+), 0 deletions(-) rename Start_Mac/{macos-x64 => macos-x86_64}/libraylib.a (100%) rename Start_Mac/{macos-x64 => macos-x86_64}/libunity.a (100%) rename Start_Mac/{macos-x64 => macos-x86_64}/libwordsalad.a (100%) rename Start_Mac/{macos-x64 => macos-x86_64}/libwordsalad_complete.a (100%) diff --git a/Start_Mac/macos-x64/libraylib.a b/Start_Mac/macos-x86_64/libraylib.a similarity index 100% rename from Start_Mac/macos-x64/libraylib.a rename to Start_Mac/macos-x86_64/libraylib.a diff --git a/Start_Mac/macos-x64/libunity.a b/Start_Mac/macos-x86_64/libunity.a similarity index 100% rename from Start_Mac/macos-x64/libunity.a rename to Start_Mac/macos-x86_64/libunity.a diff --git a/Start_Mac/macos-x64/libwordsalad.a b/Start_Mac/macos-x86_64/libwordsalad.a similarity index 100% rename from Start_Mac/macos-x64/libwordsalad.a rename to Start_Mac/macos-x86_64/libwordsalad.a diff --git a/Start_Mac/macos-x64/libwordsalad_complete.a b/Start_Mac/macos-x86_64/libwordsalad_complete.a similarity index 100% rename from Start_Mac/macos-x64/libwordsalad_complete.a rename to Start_Mac/macos-x86_64/libwordsalad_complete.a From 6b435cf82d7136acebda4ca7b5921fda4b5b4c60 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Enrico=20Schr=C3=B6der?= Date: Mon, 20 Oct 2025 14:39:05 +0200 Subject: [PATCH 2/5] Fix makefiles. --- Start_Linux/makefile | 6 +++--- Start_Mac/makefile | 2 +- Start_Windows/makefile | 7 +++---- 3 files changed, 7 insertions(+), 8 deletions(-) diff --git a/Start_Linux/makefile b/Start_Linux/makefile index 096695a..a8d8f59 100644 --- a/Start_Linux/makefile +++ b/Start_Linux/makefile @@ -1,9 +1,9 @@ CC = gcc -CFLAGS = -g -Wall -I$(raylibfolder) +CFLAGS = -g -Wall LDFLAGS = -lGL -lX11 -lm BINARIES = ./linux -raylib_folder = ./raylib +raylibfolder = ./raylib unityfolder = ./unity # -------------------------- @@ -28,7 +28,7 @@ game.o: game.c $(CC) $(CFLAGS) -c game.c graphicalGame.o: graphicalGame.c - $(CC) $(CFLAGS) -c graphicalGame.c + $(CC) $(CFLAGS) -I$(raylibfolder) -c graphicalGame.c # -------------------------- # Unit Tests diff --git a/Start_Mac/makefile b/Start_Mac/makefile index 49654ae..5e659e4 100644 --- a/Start_Mac/makefile +++ b/Start_Mac/makefile @@ -4,7 +4,7 @@ LDFLAGS = -framework OpenGL -framework CoreFoundation -framework CoreGraphics -f ARCH := $(shell uname -m) BINARIES = ./macos-$(ARCH) -raylib_folder = ./raylib +raylibfolder = ./raylib unityfolder = ./unity # -------------------------- diff --git a/Start_Windows/makefile b/Start_Windows/makefile index 146a8c6..2529cce 100644 --- a/Start_Windows/makefile +++ b/Start_Windows/makefile @@ -1,9 +1,9 @@ CC = gcc -CFLAGS = -g -Wall -I$(raylibfolder) +CFLAGS = -g -Wall LDFLAGS = -lopengl32 -lgdi32 -lwinmm BINARIES = ./windows -raylib_folder = ./raylib +raylibfolder = ./raylib unityfolder = ./unity # -------------------------- @@ -12,7 +12,6 @@ unityfolder = ./unity wordsalad_initial: $(CC) -o wordsalad_initial $(BINARIES)/libwordsalad_complete.a $(BINARIES)/libraylib.a $(LDFLAGS) - # -------------------------- # Normales Spiel bauen # -------------------------- @@ -29,7 +28,7 @@ game.o: game.c $(CC) -c $(CFLAGS) game.c graphicalGame.o: graphicalGame.c - $(CC) -I$(raylib_folder) -c $(CFLAGS) graphicalGame.c + $(CC) -I$(raylibfolder) -c $(CFLAGS) graphicalGame.c # -------------------------- # Unit Tests From 1ed03a34448689735b942fc0bd589fbbad417e14 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Enrico=20Schr=C3=B6der?= Date: Tue, 21 Oct 2025 11:24:14 +0200 Subject: [PATCH 3/5] Windows Makefile korrigiert --- Start_Windows/makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Start_Windows/makefile b/Start_Windows/makefile index 2529cce..72cccb7 100644 --- a/Start_Windows/makefile +++ b/Start_Windows/makefile @@ -22,7 +22,7 @@ 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 From e20bf82c19448aefe0a1efaf1d884876b0f794ef Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Enrico=20Schr=C3=B6der?= Date: Tue, 21 Oct 2025 11:45:37 +0200 Subject: [PATCH 4/5] Makefile angepasst --- Start_Mac/makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Start_Mac/makefile b/Start_Mac/makefile index 5e659e4..1d3b4a6 100644 --- a/Start_Mac/makefile +++ b/Start_Mac/makefile @@ -43,4 +43,4 @@ test: input.o game.o unit_tests.c $(BINARIES)/libunity.a # Clean # -------------------------- clean: - rm -f *.o wordsalad + rm -f *.o wordsalad $(TEST_BIN) From ffaed665b9bb52231b6e3e49f01285f38e7ff1b8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Enrico=20Schr=C3=B6der?= Date: Tue, 21 Oct 2025 15:24:07 +0200 Subject: [PATCH 5/5] =?UTF-8?q?Unittest=20f=C3=BCr=20das=20Platzieren=20al?= =?UTF-8?q?ler=20W=C3=B6rter=20hinzugef=C3=BCgt.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Start_Linux/unit_tests.c | 33 ++++++++++++++++++++++++++++++++- Start_Mac/unit_tests.c | 30 ++++++++++++++++++++++++++++++ Start_Windows/unit_tests.c | 30 ++++++++++++++++++++++++++++++ 3 files changed, 92 insertions(+), 1 deletion(-) diff --git a/Start_Linux/unit_tests.c b/Start_Linux/unit_tests.c index d1a15f5..34b07ed 100644 --- a/Start_Linux/unit_tests.c +++ b/Start_Linux/unit_tests.c @@ -101,7 +101,37 @@ 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. @@ -134,9 +164,10 @@ 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); return result; -} \ No newline at end of file +} diff --git a/Start_Mac/unit_tests.c b/Start_Mac/unit_tests.c index 50a62cf..34b07ed 100644 --- a/Start_Mac/unit_tests.c +++ b/Start_Mac/unit_tests.c @@ -101,6 +101,35 @@ 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, @@ -135,6 +164,7 @@ 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); diff --git a/Start_Windows/unit_tests.c b/Start_Windows/unit_tests.c index 50a62cf..34b07ed 100644 --- a/Start_Windows/unit_tests.c +++ b/Start_Windows/unit_tests.c @@ -101,6 +101,35 @@ 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, @@ -135,6 +164,7 @@ 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);