makfile tests hinzugefügt bintreeTests erstellt

This commit is contained in:
Ben Skuppin 2025-12-10 23:35:40 +01:00
parent 33b370f0d2
commit 8c95340c77
2 changed files with 31 additions and 6 deletions

View File

@ -5,8 +5,23 @@
void setUp(void){}
void tearDown(void){}
void TEST_BINTREE{
void TEST_BINTREE(){
int input[8]={1,2,3,4,5,6,7,8};
int output[8];
int len = 8;
TreeNode* root = NULL;
int* isDuplicate;
for (int i = 0; i<len; i++) {
root = addToTree(root, &input[i], sizeof(int), compareFct, isDuplicate);
}
for (int i = 0; i<len; i++) {
output[i] = *(int*)nextTreeData(root);
}
TEST_ASSERT_INT_ARRAY_WITHIN(0, input, output, 8);
}
@ -17,9 +32,11 @@ int main(){
printf("\n============================\nbintree tests\n============================\n");
//RUN_TEST();
RUN_TEST(TEST_BINTREE);
//RUN_TEST();
//RUN_TEST();
return UNITY_END();
}
//Befehl zum Kompilieren: gcc bintreeTests.c bintree.h bintree.c unity/unity.c stack.c stack.h

View File

@ -1,5 +1,6 @@
CC = gcc
FLAGS = -g -Wall -lm
NAMES = doble bintreeTests stackTests numbersTests
ifeq ($(OS),Windows_NT)
include makefile_windows.variables
@ -36,14 +37,21 @@ $(program_obj_filesobj_files): %.o: %.c
# Unit Tests
# --------------------------
unitTests:
echo "needs to be implemented"
bintreeTests: stack.o bintree.o bintreeTests.c $(unityfolder)/unity.c
$(CC) $(CFLAGS) -I$(unityfolder) -o bintreeTests bintreeTests.c bintree.o stack.o $(unityfolder)/unity.c
stackTests: stack.o stackTests.c $(unityfolder)/unity.c
$(CC) $(CFLAGS) -I$(unityfolder) -o stackTests stackTests.c stack.o $(unityfolder)/unity.c
numbersTests: numbers.o numbersTests.c bintree.o stack.o $(unityfolder)/unity.c
$(CC) $(CFLAGS) -I$(unityfolder) -o numbersTests numbersTests.c numbers.o bintree.o stack.o $(unityfolder)/unity.c
# --------------------------
# Clean
# --------------------------
clean:
ifeq ($(OS),Windows_NT)
del /f *.o doble
del /f *.o $(NAMES)
else
rm -f *.o doble
rm -f *.o $(NAMES)
endif