2025-11-24 16:05:31 +01:00

51 lines
867 B
C

#include <stdio.h>
#include <stdlib.h>
#include "stack.h"
#include "unity.h"
void test_push(void)
{
int value = 3;
TEST_ASSERT_NOT_NULL(push(NULL, &value));
TEST_ASSERT_EQUAL_INT(value, (intptr_t) push(NULL, &value)->value);
}
void test_pop(void)
{
TEST_ASSERT_NULL(pop(NULL));
}
void test_top(void)
{
TEST_ASSERT_NULL(top(NULL));
}
void test_clear(void)
{
// TEST_ASSERT_NULL(clearStack(NULL));
}
void setUp(void) {
// Falls notwendig, kann hier Vorbereitungsarbeit gemacht werden
}
void tearDown(void) {
// Hier kann Bereinigungsarbeit nach jedem Test durchgeführt werden
}
int main()
{
UNITY_BEGIN();
printf("============================\nStack tests\n============================\n");
RUN_TEST(test_push);
RUN_TEST(test_pop);
RUN_TEST(test_top);
RUN_TEST(test_clear);
return UNITY_END();
}