forked from freudenreichan/info2Praktikum-DobleSpiel
Merge remote-tracking branch 'origin/main'
This commit is contained in:
commit
b68ee9237a
3 files changed
+24
-24
No files matched your search
@@ -1,5 +1,6 @@
|
|||||||
Lukas;5999
|
Lukas;5999
|
||||||
Lukas;4999
|
Lukas;4999
|
||||||
Tobi;4999
|
Tobi;4999
|
||||||
|
Henrik;4977
|
||||||
Lukas;3999
|
Lukas;3999
|
||||||
player1;3999
|
player1;3999
|
||||||
+4
-4
@@ -35,14 +35,14 @@ $(program_obj_files): %.o: %.c
|
|||||||
# --------------------------
|
# --------------------------
|
||||||
# Unit Tests
|
# Unit Tests
|
||||||
# --------------------------
|
# --------------------------
|
||||||
unitTests: numbersTests
|
|
||||||
./numbersTests
|
|
||||||
|
|
||||||
numbersTests: numbersTests.c numbers.o bintree.o stack.o $(unityfolder)/unity.c
|
numbersTests: numbersTests.c numbers.o bintree.o stack.o $(unityfolder)/unity.c
|
||||||
$(CC) $(FLAGS) -I$(unityfolder) $^ -o numbersTests
|
$(CC) $(FLAGS) -I$(unityfolder) $^ -o numbersTests
|
||||||
|
|
||||||
|
stackTests: test_stack.c stack.o $(unityfolder)/unity.c
|
||||||
|
$(CC) $(FLAGS) -I$(unityfolder) $^ -o stackTests
|
||||||
|
|
||||||
bintreeTests: bintree.o test_bintree.c stack.o $(unityfolder)/unity.c
|
bintreeTests: bintree.o test_bintree.c stack.o $(unityfolder)/unity.c
|
||||||
$(CC) $(CFLAGS) -I$(unityfolder) -o runBintreeTests test_bintree.c bintree.o stack.o $(unityfolder)/unity.c
|
$(CC) $(CFLAGS) -I$(unityfolder) -o bintreeTests test_bintree.c bintree.o stack.o $(unityfolder)/unity.c
|
||||||
|
|
||||||
# --------------------------
|
# --------------------------
|
||||||
# compile_commands.json für clangd erzeugen (benötigt bear)
|
# compile_commands.json für clangd erzeugen (benötigt bear)
|
||||||
|
|||||||
+19
-20
@@ -33,14 +33,14 @@ static void test_addToTreeBuildsTreeInOrder(void)
|
|||||||
{
|
{
|
||||||
const TreeNode *const tree = buildTree();
|
const TreeNode *const tree = buildTree();
|
||||||
|
|
||||||
TEST_ASSERT_EQUAL(1, *(int *)tree->data);
|
TEST_ASSERT_EQUAL_INT(1, *(int *)tree->data);
|
||||||
TEST_ASSERT_EQUAL(NULL, tree->left);
|
TEST_ASSERT_NULL(tree->left);
|
||||||
TEST_ASSERT_NOT_NULL(tree->right);
|
TEST_ASSERT_NOT_NULL(tree->right);
|
||||||
TEST_ASSERT_EQUAL(3, *(int *)tree->right->data);
|
TEST_ASSERT_EQUAL_INT(3, *(int *)tree->right->data);
|
||||||
TEST_ASSERT_NOT_NULL(tree->right->right);
|
TEST_ASSERT_NOT_NULL(tree->right->right);
|
||||||
TEST_ASSERT_EQUAL(4, *(int *)tree->right->right->data);
|
TEST_ASSERT_EQUAL_INT(4, *(int *)tree->right->right->data);
|
||||||
TEST_ASSERT_NOT_NULL(tree->right->left);
|
TEST_ASSERT_NOT_NULL(tree->right->left);
|
||||||
TEST_ASSERT_EQUAL(2, *(int *)tree->right->left->data);
|
TEST_ASSERT_EQUAL_INT(2, *(int *)tree->right->left->data);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void test_addToTreeReportsNoDuplicates(void)
|
static void test_addToTreeReportsNoDuplicates(void)
|
||||||
@@ -51,7 +51,7 @@ static void test_addToTreeReportsNoDuplicates(void)
|
|||||||
const int data = -1;
|
const int data = -1;
|
||||||
tree = addToTree(tree, &data, sizeof(int), compare_ints, &duplicates);
|
tree = addToTree(tree, &data, sizeof(int), compare_ints, &duplicates);
|
||||||
|
|
||||||
TEST_ASSERT_EQUAL(0, duplicates);
|
TEST_ASSERT_EQUAL_INT(0, duplicates);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void test_addToTreeReportsDuplicates(void)
|
static void test_addToTreeReportsDuplicates(void)
|
||||||
@@ -62,7 +62,7 @@ static void test_addToTreeReportsDuplicates(void)
|
|||||||
const int data = 1;
|
const int data = 1;
|
||||||
tree = addToTree(tree, &data, sizeof(int), compare_ints, &duplicates);
|
tree = addToTree(tree, &data, sizeof(int), compare_ints, &duplicates);
|
||||||
|
|
||||||
TEST_ASSERT_EQUAL(1, duplicates);
|
TEST_ASSERT_EQUAL_INT(1, duplicates);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void test_clearTree(void)
|
static void test_clearTree(void)
|
||||||
@@ -81,16 +81,16 @@ static void test_nextTreeDataTraversesTree(void)
|
|||||||
|
|
||||||
const int *const value1 = nextTreeData(buildTree());
|
const int *const value1 = nextTreeData(buildTree());
|
||||||
TEST_ASSERT_NOT_NULL(value1);
|
TEST_ASSERT_NOT_NULL(value1);
|
||||||
TEST_ASSERT_EQUAL(1, *value1);
|
TEST_ASSERT_EQUAL_INT(1, *value1);
|
||||||
const int *const value2 = nextTreeData(NULL);
|
const int *const value2 = nextTreeData(NULL);
|
||||||
TEST_ASSERT_NOT_NULL(value2);
|
TEST_ASSERT_NOT_NULL(value2);
|
||||||
TEST_ASSERT_EQUAL(2, *value2);
|
TEST_ASSERT_EQUAL_INT(2, *value2);
|
||||||
const int *const value3 = nextTreeData(NULL);
|
const int *const value3 = nextTreeData(NULL);
|
||||||
TEST_ASSERT_NOT_NULL(value3);
|
TEST_ASSERT_NOT_NULL(value3);
|
||||||
TEST_ASSERT_EQUAL(3, *value3);
|
TEST_ASSERT_EQUAL_INT(3, *value3);
|
||||||
const int *const value4 = nextTreeData(NULL);
|
const int *const value4 = nextTreeData(NULL);
|
||||||
TEST_ASSERT_NOT_NULL(value4);
|
TEST_ASSERT_NOT_NULL(value4);
|
||||||
TEST_ASSERT_EQUAL(4, *value4);
|
TEST_ASSERT_EQUAL_INT(4, *value4);
|
||||||
TEST_ASSERT_NULL(nextTreeData(NULL));
|
TEST_ASSERT_NULL(nextTreeData(NULL));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -98,33 +98,33 @@ static void test_nextTreeDataTraversesTwoTrees(void)
|
|||||||
{
|
{
|
||||||
const int *const value1a = nextTreeData(buildTree());
|
const int *const value1a = nextTreeData(buildTree());
|
||||||
TEST_ASSERT_NOT_NULL(value1a);
|
TEST_ASSERT_NOT_NULL(value1a);
|
||||||
TEST_ASSERT_EQUAL(1, *value1a);
|
TEST_ASSERT_EQUAL_INT(1, *value1a);
|
||||||
const int *const value2a = nextTreeData(NULL);
|
const int *const value2a = nextTreeData(NULL);
|
||||||
TEST_ASSERT_NOT_NULL(value2a);
|
TEST_ASSERT_NOT_NULL(value2a);
|
||||||
TEST_ASSERT_EQUAL(2, *value2a);
|
TEST_ASSERT_EQUAL_INT(2, *value2a);
|
||||||
const int *const value1b = nextTreeData(buildTree());
|
const int *const value1b = nextTreeData(buildTree());
|
||||||
TEST_ASSERT_NOT_NULL(value1b);
|
TEST_ASSERT_NOT_NULL(value1b);
|
||||||
TEST_ASSERT_EQUAL(1, *value1b);
|
TEST_ASSERT_EQUAL_INT(1, *value1b);
|
||||||
const int *const value2b = nextTreeData(NULL);
|
const int *const value2b = nextTreeData(NULL);
|
||||||
TEST_ASSERT_NOT_NULL(value2b);
|
TEST_ASSERT_NOT_NULL(value2b);
|
||||||
TEST_ASSERT_EQUAL(2, *value2b);
|
TEST_ASSERT_EQUAL_INT(2, *value2b);
|
||||||
const int *const value3b = nextTreeData(NULL);
|
const int *const value3b = nextTreeData(NULL);
|
||||||
TEST_ASSERT_NOT_NULL(value3b);
|
TEST_ASSERT_NOT_NULL(value3b);
|
||||||
TEST_ASSERT_EQUAL(3, *value3b);
|
TEST_ASSERT_EQUAL_INT(3, *value3b);
|
||||||
const int *const value4b = nextTreeData(NULL);
|
const int *const value4b = nextTreeData(NULL);
|
||||||
TEST_ASSERT_NOT_NULL(value4b);
|
TEST_ASSERT_NOT_NULL(value4b);
|
||||||
TEST_ASSERT_EQUAL(4, *value4b);
|
TEST_ASSERT_EQUAL_INT(4, *value4b);
|
||||||
TEST_ASSERT_NULL(nextTreeData(NULL));
|
TEST_ASSERT_NULL(nextTreeData(NULL));
|
||||||
}
|
}
|
||||||
|
|
||||||
static void test_treeSizeIsZeroForNULLTree(void)
|
static void test_treeSizeIsZeroForNULLTree(void)
|
||||||
{
|
{
|
||||||
TEST_ASSERT_EQUAL(0, treeSize(NULL));
|
TEST_ASSERT_EQUAL_INT(0, treeSize(NULL));
|
||||||
}
|
}
|
||||||
|
|
||||||
static void test_treeSizeIsCorrectForTestTree(void)
|
static void test_treeSizeIsCorrectForTestTree(void)
|
||||||
{
|
{
|
||||||
TEST_ASSERT_EQUAL(4, treeSize(buildTree()));
|
TEST_ASSERT_EQUAL_INT(4, treeSize(buildTree()));
|
||||||
}
|
}
|
||||||
|
|
||||||
void setUp(void)
|
void setUp(void)
|
||||||
@@ -141,7 +141,6 @@ int main()
|
|||||||
|
|
||||||
printf("\n============================\nbinary tree tests\n============================\n");
|
printf("\n============================\nbinary tree tests\n============================\n");
|
||||||
RUN_TEST(test_addToTreeAllNullReturnsNull);
|
RUN_TEST(test_addToTreeAllNullReturnsNull);
|
||||||
RUN_TEST(test_toArrayWorks);
|
|
||||||
RUN_TEST(test_addToTreeBuildsTreeInOrder);
|
RUN_TEST(test_addToTreeBuildsTreeInOrder);
|
||||||
RUN_TEST(test_addToTreeReportsNoDuplicates);
|
RUN_TEST(test_addToTreeReportsNoDuplicates);
|
||||||
RUN_TEST(test_addToTreeReportsDuplicates);
|
RUN_TEST(test_addToTreeReportsDuplicates);
|
||||||
|
|||||||
Reference in new issue
Block a user