forked from freudenreichan/info2Praktikum-DobleSpiel
Push unittest teilweise implementiert
This commit is contained in:
parent
8fdfe6b2f4
commit
8fb9559ca3
42
stackTests.c
Normal file
42
stackTests.c
Normal file
@ -0,0 +1,42 @@
|
|||||||
|
#include <stdio.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
#include "stack.h"
|
||||||
|
#include "unity.h"
|
||||||
|
|
||||||
|
//Initialisierung
|
||||||
|
void setUp(void){}
|
||||||
|
void tearDown(void){}
|
||||||
|
|
||||||
|
void test_push_created_new_stacknode(void)
|
||||||
|
{
|
||||||
|
StackNode test = {111,NULL};
|
||||||
|
int testdata = 222;
|
||||||
|
void *data =&testdata;
|
||||||
|
|
||||||
|
StackNode test1 = push(&test,data);
|
||||||
|
unsigned int n = 50;
|
||||||
|
unsigned int* arr = createNumbers(n);
|
||||||
|
|
||||||
|
TEST_ASSERT_NOT_NULL(arr);
|
||||||
|
|
||||||
|
// Ein paar Werte prüfen (dürfen alles sein, nur kein Segfault)
|
||||||
|
for (unsigned int i = 0; i < n; i++)
|
||||||
|
TEST_ASSERT_TRUE(arr[i] >= 0);
|
||||||
|
|
||||||
|
free(arr);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
int main(void)
|
||||||
|
{
|
||||||
|
UNITY_BEGIN();
|
||||||
|
|
||||||
|
RUN_TEST(test_createNumbers_returns_valid_array);
|
||||||
|
RUN_TEST(test_createNumbers_contains_exactly_one_duplicate);
|
||||||
|
RUN_TEST(test_getDuplicated_finds_correct_duplicate);
|
||||||
|
|
||||||
|
return UNITY_END();
|
||||||
|
}
|
||||||
Loading…
x
Reference in New Issue
Block a user