diff --git a/makefile b/makefile index 1f15f75..b94e026 100644 --- a/makefile +++ b/makefile @@ -35,7 +35,9 @@ $(program_obj_filesobj_files): %.o: %.c # -------------------------- # Unit Tests # -------------------------- -unitTests: +stackTests: stack.o test_stack.c $(unityfolder)/unity.c + $(CC) $(CFLAGS) -I$(unityfolder) -o runStackTests test_stack.c stack.o $(unityfolder)/unity.c + echo "needs to be implemented" # -------------------------- diff --git a/test_stack.c b/test_stack.c new file mode 100644 index 0000000..c4fe248 --- /dev/null +++ b/test_stack.c @@ -0,0 +1,27 @@ +#include "stack.h" +#include "unity.h" + + +void test_firstNodeAddedCorrectly(void) { + StackNode* modelStack; + int modelData = 5; + modelStack->below = NULL; + modelStack->data = &modelData; + + StackNode* testStack = NULL; + int testData = 5; + testStack = push(testStack, &testData); + TEST_ASSERT_EQUAL_INT(*(modelStack->data), *(testStack->data)); + TEST_ASSERT_NULL(testStack->below); +} + + +int main(void) { + + UNITY_BEGIN(); + + printf("\n----------------------------Stack-Tests----------------------------\n"); + RUN_TEST(test_firstNodeAddedCorrectly); + + return UNITY_END(); +} \ No newline at end of file