unittests from makefile is done

This commit is contained in:
regis37 2025-12-02 02:12:30 +01:00
parent ba032b7ef3
commit 601b011152
7 changed files with 17 additions and 2 deletions

BIN
doble.exe

Binary file not shown.

View File

@ -3,6 +3,7 @@ Regis;18924
player_name;9929
Kamto;7946
player_name;5987
player_1;4989
Warren;4986
player_name;4983
player1;3999

View File

@ -35,8 +35,20 @@ $(program_obj_filesobj_files): %.o: %.c
# --------------------------
# Unit Tests
# --------------------------
unitTests:
echo "needs to be implemented"
unitTests: test_numbers test_stack
test_numbers: test_numbers.o stack.o bintree.o numbers.o
$(CC) $(FLAGS) $^ -o test_numbers
test_numbers.o: test_numbers.c
$(CC) -c $(FLAGS) $< -o $@
test_stack: test_stack.o stack.o
$(CC) $(FLAGS) $^ -o test_stack
test_stack.o: test_stack.c
$(CC) -c $(FLAGS) $< -o $@
# --------------------------
# Clean

View File

@ -15,6 +15,7 @@
// Returns NULL on errors. Use your implementation of the binary search tree to check for possible duplicates while
// creating random numbers.
unsigned int *createNumbers(unsigned int len) {
if (len < 2)
return NULL;
@ -52,6 +53,7 @@ unsigned int *createNumbers(unsigned int len) {
// Returns only the only number in numbers which is present twice. Returns zero on errors.
unsigned int getDuplicate(const unsigned int numbers[], unsigned int len) {
if (!numbers || len < 2) return 0;
// Kopie erstellen, damit Original nicht verändert wird

Binary file not shown.

BIN
test_stack.exe Normal file

Binary file not shown.