Endlich fertig
This commit is contained in:
@@ -29,14 +29,38 @@ program_obj_files = stack.o bintree.o numbers.o timer.o highscore.o
|
||||
doble : main.o $(program_obj_files)
|
||||
$(CC) $(FLAGS) $^ -o doble
|
||||
|
||||
$(program_obj_filesobj_files): %.o: %.c
|
||||
$(CC) -c $(FLAGS) $^ -o $@
|
||||
# pattern rule to build .o from .c
|
||||
%.o: %.c
|
||||
$(CC) -c $(FLAGS) $< -o $@
|
||||
|
||||
# --------------------------
|
||||
# Unit Tests
|
||||
# --------------------------
|
||||
unitTests:
|
||||
echo "needs to be implemented"
|
||||
unitTests: test_stack test_numbers test_bintree
|
||||
@total=0; passed=0; failed=0; \
|
||||
for t in test_stack test_numbers test_bintree; do \
|
||||
total=$$((total+1)); \
|
||||
printf "Running %s...\n" "$$t"; \
|
||||
./$$t; rc=$$?; \
|
||||
if [ $$rc -eq 0 ]; then \
|
||||
printf "%s: PASS\n\n" "$$t"; \
|
||||
passed=$$((passed+1)); \
|
||||
else \
|
||||
printf "%s: FAIL (exit %d)\n\n" "$$t" $$rc; \
|
||||
failed=$$((failed+1)); \
|
||||
fi; \
|
||||
done; \
|
||||
printf "Summary: %d tests run, %d passed, %d failed\n" $$total $$passed $$failed; \
|
||||
exit $$failed
|
||||
|
||||
test_stack: test_stack.c stack.c
|
||||
$(CC) $(FLAGS) test_stack.c stack.c -o test_stack
|
||||
|
||||
test_numbers: test_numbers.c numbers.c bintree.c stack.c
|
||||
$(CC) $(FLAGS) test_numbers.c numbers.c bintree.c stack.c -o test_numbers
|
||||
|
||||
test_bintree: test_bintree.c bintree.c stack.c
|
||||
$(CC) $(FLAGS) test_bintree.c bintree.c stack.c -o test_bintree
|
||||
|
||||
# --------------------------
|
||||
# Clean
|
||||
|
||||
Reference in New Issue
Block a user