unittests from makefile is done
This commit is contained in:
parent
ba032b7ef3
commit
601b011152
@ -3,6 +3,7 @@ Regis;18924
|
|||||||
player_name;9929
|
player_name;9929
|
||||||
Kamto;7946
|
Kamto;7946
|
||||||
player_name;5987
|
player_name;5987
|
||||||
|
player_1;4989
|
||||||
Warren;4986
|
Warren;4986
|
||||||
player_name;4983
|
player_name;4983
|
||||||
player1;3999
|
player1;3999
|
||||||
|
|||||||
16
makefile
16
makefile
@ -35,8 +35,20 @@ $(program_obj_filesobj_files): %.o: %.c
|
|||||||
# --------------------------
|
# --------------------------
|
||||||
# Unit Tests
|
# 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
|
# Clean
|
||||||
|
|||||||
@ -15,6 +15,7 @@
|
|||||||
// Returns NULL on errors. Use your implementation of the binary search tree to check for possible duplicates while
|
// Returns NULL on errors. Use your implementation of the binary search tree to check for possible duplicates while
|
||||||
// creating random numbers.
|
// creating random numbers.
|
||||||
unsigned int *createNumbers(unsigned int len) {
|
unsigned int *createNumbers(unsigned int len) {
|
||||||
|
|
||||||
if (len < 2)
|
if (len < 2)
|
||||||
return NULL;
|
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.
|
// 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) {
|
unsigned int getDuplicate(const unsigned int numbers[], unsigned int len) {
|
||||||
|
|
||||||
if (!numbers || len < 2) return 0;
|
if (!numbers || len < 2) return 0;
|
||||||
|
|
||||||
// Kopie erstellen, damit Original nicht verändert wird
|
// Kopie erstellen, damit Original nicht verändert wird
|
||||||
|
|||||||
BIN
test_numbers.exe
BIN
test_numbers.exe
Binary file not shown.
BIN
test_stack.exe
Normal file
BIN
test_stack.exe
Normal file
Binary file not shown.
Loading…
x
Reference in New Issue
Block a user