diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..24165e4 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +doble_initial.exe diff --git a/runTests.exe b/runTests.exe new file mode 100644 index 0000000..beaffd6 Binary files /dev/null and b/runTests.exe differ diff --git a/stack.o b/stack.o new file mode 100644 index 0000000..0a42f45 Binary files /dev/null and b/stack.o differ diff --git a/test_stack.c b/test_stack.c new file mode 100644 index 0000000..52ff263 --- /dev/null +++ b/test_stack.c @@ -0,0 +1,59 @@ +#include "unity.h" +#include +#include +#include + +#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(); +} diff --git a/test_stack.o b/test_stack.o new file mode 100644 index 0000000..c90be42 Binary files /dev/null and b/test_stack.o differ