Test 2 working now, only one test missing

This commit is contained in:
Lukas Weber 2025-12-03 13:30:29 +01:00
parent c663833b6e
commit bf4c41b897

View File

@ -23,13 +23,22 @@ void test_topReturnsCorrectValues(void) {
StackNode* testStack = NULL;
int data1 = 1;
testStack = push(testStack, &data1);
int* returnData1 = (int*) top(testStack);
int data2 = 0;
testStack = push(testStack, &data2);
int* returnData2 = (int*) top(testStack);
int data3 = 3;
testStack = push(testStack, &data3);
TEST_ASSERT_EQUAL_INT(1, *(int*)testStack->stackData);
TEST_ASSERT_EQUAL_INT(0, *(int*)testStack->stackData);
TEST_ASSERT_EQUAL_INT(3, *(int*)testStack->stackData);
int* returnData3 = (int*) top(testStack);
size_t counter = 0;
if(*returnData1 == 1)
counter++;
if(*returnData2 == 0)
counter++;
if(*returnData3 == 3)
counter++;
TEST_ASSERT_EQUAL_INT(3, counter);
clearStack(testStack);
}