generated from freudenreichan/info2Praktikum-DobleSpiel
43 lines
877 B
C
43 lines
877 B
C
#include <stdio.h>
|
|
#include "unity/unity.h"
|
|
#include "bintree.h"
|
|
|
|
void setUp(void){}
|
|
void tearDown(void){}
|
|
|
|
void TEST_BINTREE(){
|
|
int input[8]={7,3,2,4,8,6,1,5};
|
|
int expected[8]={1,2,3,4,5,6,7,8};
|
|
int output[8];
|
|
int len = 8;
|
|
TreeNode* root = NULL;
|
|
int* isDuplicate;
|
|
|
|
for (int i = 0; i<len; i++) {
|
|
root = addToTree(root, &input[i], sizeof(int), compareFct, isDuplicate);
|
|
}
|
|
|
|
for (int i = 0; i<len; i++) {
|
|
output[i] = *(int*)nextTreeData(root);
|
|
|
|
}
|
|
|
|
TEST_ASSERT_INT_ARRAY_WITHIN(0, expected, output, 8);
|
|
|
|
}
|
|
|
|
|
|
|
|
int main(){
|
|
UNITY_BEGIN();
|
|
|
|
printf("\n============================\nbintree tests\n============================\n");
|
|
|
|
RUN_TEST(TEST_BINTREE);
|
|
//RUN_TEST();
|
|
//RUN_TEST();
|
|
|
|
return UNITY_END();
|
|
}
|
|
|
|
//Befehl zum Kompilieren: gcc bintreeTests.c bintree.h bintree.c unity/unity.c stack.c stack.h
|