generated from freudenreichan/info2Praktikum-DobleSpiel
Started working on tests, added config to makefile
This commit is contained in:
parent
94e489cfae
commit
0bc9263b60
4
makefile
4
makefile
@ -35,7 +35,9 @@ $(program_obj_filesobj_files): %.o: %.c
|
|||||||
# --------------------------
|
# --------------------------
|
||||||
# Unit Tests
|
# 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"
|
echo "needs to be implemented"
|
||||||
|
|
||||||
# --------------------------
|
# --------------------------
|
||||||
|
|||||||
27
test_stack.c
Normal file
27
test_stack.c
Normal file
@ -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();
|
||||||
|
}
|
||||||
Loading…
x
Reference in New Issue
Block a user