generated from freudenreichan/info2Praktikum-DobleSpiel
Test 2 working now, only one test missing
This commit is contained in:
parent
c663833b6e
commit
bf4c41b897
15
test_stack.c
15
test_stack.c
@ -23,13 +23,22 @@ void test_topReturnsCorrectValues(void) {
|
|||||||
StackNode* testStack = NULL;
|
StackNode* testStack = NULL;
|
||||||
int data1 = 1;
|
int data1 = 1;
|
||||||
testStack = push(testStack, &data1);
|
testStack = push(testStack, &data1);
|
||||||
|
int* returnData1 = (int*) top(testStack);
|
||||||
int data2 = 0;
|
int data2 = 0;
|
||||||
testStack = push(testStack, &data2);
|
testStack = push(testStack, &data2);
|
||||||
|
int* returnData2 = (int*) top(testStack);
|
||||||
int data3 = 3;
|
int data3 = 3;
|
||||||
testStack = push(testStack, &data3);
|
testStack = push(testStack, &data3);
|
||||||
TEST_ASSERT_EQUAL_INT(1, *(int*)testStack->stackData);
|
int* returnData3 = (int*) top(testStack);
|
||||||
TEST_ASSERT_EQUAL_INT(0, *(int*)testStack->stackData);
|
|
||||||
TEST_ASSERT_EQUAL_INT(3, *(int*)testStack->stackData);
|
size_t counter = 0;
|
||||||
|
if(*returnData1 == 1)
|
||||||
|
counter++;
|
||||||
|
if(*returnData2 == 0)
|
||||||
|
counter++;
|
||||||
|
if(*returnData3 == 3)
|
||||||
|
counter++;
|
||||||
|
TEST_ASSERT_EQUAL_INT(3, counter);
|
||||||
clearStack(testStack);
|
clearStack(testStack);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user