This commit is contained in:
Kristin 2025-12-05 10:20:17 +01:00
parent 17f4155891
commit 90612e4d04
5 changed files with 60 additions and 0 deletions

1
.gitignore vendored Normal file
View File

@ -0,0 +1 @@
doble_initial.exe

BIN
runTests.exe Normal file

Binary file not shown.

BIN
stack.o Normal file

Binary file not shown.

59
test_stack.c Normal file
View File

@ -0,0 +1,59 @@
#include "unity.h"
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "stack.h"
void test_createNode(void) {
int testInt = 26;
StackNode *testNode = createNode(&testInt);
TEST_ASSERT_NOT_NULL(testNode);
TEST_ASSERT_EQUAL_PTR(&testInt, testNode->data);
TEST_ASSERT_NULL(testNode->next);
free(testNode);
}
void test_pushDataToStack(void) {}
void test_deleteTopElement(void) {}
void test_returnData(void) {}
void test_clearStack(void) {
int testInts[] = {1, 2, 3, 4, 5};
StackNode *testStack = NULL;
for (int i = 0; i < 5; i++) {
testStack = push(testStack, &testInts[i]);
}
testStack = clearStack(testStack);
TEST_ASSERT_NULL(testStack);
}
void setUp(void) {}
void tearDown(void) {}
int main(void) {
UNITY_BEGIN();
printf("------------------------stack test------------------------\n");
RUN_TEST(test_createNode);
RUN_TEST(test_pushDataToStack);
RUN_TEST(test_deleteTopElement);
RUN_TEST(test_returnData);
RUN_TEST(test_clearStack);
RUN_TEST(test_clearStack);
return UNITY_END();
}

BIN
test_stack.o Normal file

Binary file not shown.