diff --git a/--library=m.exe b/--library=m.exe new file mode 100644 index 0000000..cb0a69c Binary files /dev/null and b/--library=m.exe differ diff --git a/bintree.o b/bintree.o index 535fb57..f2b4f4c 100644 Binary files a/bintree.o and b/bintree.o differ diff --git a/highscore.o b/highscore.o deleted file mode 100644 index 027832c..0000000 Binary files a/highscore.o and /dev/null differ diff --git a/main.o b/main.o deleted file mode 100644 index fe49827..0000000 Binary files a/main.o and /dev/null differ diff --git a/makefile b/makefile index baefbfb..c48a758 100644 --- a/makefile +++ b/makefile @@ -1,8 +1,11 @@ CC = gcc -FLAGS = -g -Wall -lm +CFLAGS = -g -Wall +LIBS = -lm ifeq ($(OS),Windows_NT) include makefile_windows.variables + RM_CMD = del /f + EXT = .exe else UNAME = $(shell uname) ifeq ($(UNAME),Linux) @@ -10,56 +13,67 @@ else else include makefile_mac.variables endif + RM_CMD = rm -f + EXT = endif raylibfolder = ./raylib unityfolder = ./unity # -------------------------- -# Initiales Programm bauen (zum ausprobieren) -# -------------------------- -doble_initial: - $(CC) -o doble_initial $(BINARIES)/libdoble_complete.a - -# -------------------------- -# Selbst implementiertes Programm bauen +# Objekt-Dateien Definition # -------------------------- program_obj_files = stack.o bintree.o numbers.o timer.o highscore.o +# main.o separat oder hier hinzufügen +OBJ = main.o $(program_obj_files) -doble : main.o $(program_obj_files) - $(CC) $(FLAGS) $^ -o doble +# -------------------------- +# Initiales Programm +# -------------------------- +doble_initial: + # Hinweis: $(BINARIES) muss in den include-Dateien definiert sein! + $(CC) -o doble_initial$(EXT) $(BINARIES)/libdoble_complete.a $(LIBS) -# HINWEIS: Hier war ein Tippfehler im Original (obj_filesobj_files), ich habe ihn korrigiert: -$(program_obj_files): %.o: %.c - $(CC) -c $(FLAGS) $^ -o $@ +# -------------------------- +# Hauptprogramm (doble) +# -------------------------- +doble: $(OBJ) + # WICHTIG: $(LIBS) ganz am Ende! + $(CC) $(CFLAGS) $^ -o doble$(EXT) $(LIBS) + +%.o: %.c + $(CC) -c $(CFLAGS) $< -o $@ # -------------------------- # Unit Tests # -------------------------- -# Name des Test-Programms -TEST_BIN = test_runner +TEST_BIN = test_runner$(EXT) -# Das Target 'unitTests' baut das Test-Programm und führt es aus -unitTests: unittest.o unittestTree.o stack.o numbers.o - @echo "--- Erstelle Test-Executable ---" - $(CC) $(FLAGS) unittest.o unittestTree.o stack.o numbers.o -o $(TEST_BIN) - @echo "--- Starte Tests ---" - ./$(TEST_BIN) +TEST_STACK_BIN = test_stack$(EXT) +TEST_NUMBERS_BIN = test_numbers$(EXT) + +testStack: unittest.o stack.o unity/unity.o + @echo "--- Baue und starte Stack Tests ---" + $(CC) $(CFLAGS) unittest.o stack.o unity/unity.o -o $(TEST_STACK_BIN) $(LIBS) + ./$(TEST_STACK_BIN) + +testNumbers: unittestTree.o numbers.o bintree.o stack.o unity/unity.o + @echo "--- Baue und starte Numbers Tests ---" + $(CC) $(CFLAGS) unittestTree.o numbers.o bintree.o stack.o unity/unity.o -o $(TEST_NUMBERS_BIN) $(LIBS) + ./$(TEST_NUMBERS_BIN) -# Regel, um unittest.c zu kompilieren unittest.o: test_stack.c - $(CC) -c $(FLAGS) test_stack.c -o unittest.o + $(CC) -c $(CFLAGS) test_stack.c -o unittest.o unittestTree.o: test_numbers.c - $(CC) -c $(FLAGS) test_numbers.c -o unittestTree.o + $(CC) -c $(CFLAGS) test_numbers.c -o unittestTree.o +unity/unity.o: unity/unity.c + $(CC) -c $(CFLAGS) unity/unity.c -o unity/unity.o + # -------------------------- # Clean # -------------------------- clean: - ifeq ($(OS),Windows_NT) - del /f *.o doble $(TEST_BIN) - else - rm -f *.o doble $(TEST_BIN) - endif \ No newline at end of file + $(RM_CMD) *.o doble$(EXT) doble_initial$(EXT) $(TEST_BIN) \ No newline at end of file diff --git a/numbers.o b/numbers.o index 8754b9d..fcbba11 100644 Binary files a/numbers.o and b/numbers.o differ diff --git a/stack.o b/stack.o index 35edb9f..4ad91d0 100644 Binary files a/stack.o and b/stack.o differ diff --git a/test_numbers.c b/test_numbers.c index 92b2d76..8d42284 100644 --- a/test_numbers.c +++ b/test_numbers.c @@ -3,7 +3,7 @@ #include #include "numbers.h" #include "bintree.h" -#include "unity.h" +#include "unity/unity.h" void test_getDuplicateLogic() diff --git a/test_numbers.exe b/test_numbers.exe new file mode 100644 index 0000000..9c0b258 Binary files /dev/null and b/test_numbers.exe differ diff --git a/test_stack.c b/test_stack.c index f0f8790..a5bc658 100644 --- a/test_stack.c +++ b/test_stack.c @@ -2,6 +2,7 @@ #include #include #include "stack.h" +#include "unity/unity.h" void test_pushFailsOnNullPointer(StackNode *stack, void *data) { @@ -44,6 +45,13 @@ void test_topFailsOnNullPointer() { return; } + +void setUp(void) { +} + +void tearDown(void) { +} + int main() { diff --git a/test_stack.exe b/test_stack.exe new file mode 100644 index 0000000..1655893 Binary files /dev/null and b/test_stack.exe differ diff --git a/timer.o b/timer.o deleted file mode 100644 index 92bfb6b..0000000 Binary files a/timer.o and /dev/null differ diff --git a/unittest.o b/unittest.o index ccf5708..ea5c948 100644 Binary files a/unittest.o and b/unittest.o differ diff --git a/unittestTree.o b/unittestTree.o new file mode 100644 index 0000000..5cd3647 Binary files /dev/null and b/unittestTree.o differ diff --git a/unity/unity.o b/unity/unity.o new file mode 100644 index 0000000..c4ca3ac Binary files /dev/null and b/unity/unity.o differ