From bf4c41b8977840ed269e02d1f73c72032a4e2079 Mon Sep 17 00:00:00 2001 From: Lukas Weber Date: Wed, 3 Dec 2025 13:30:29 +0100 Subject: [PATCH] Test 2 working now, only one test missing --- test_stack.c | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/test_stack.c b/test_stack.c index e352d68..3b4fc48 100644 --- a/test_stack.c +++ b/test_stack.c @@ -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); }