From 21aa67b165fdfecf37c41057e8da268425fd4d94 Mon Sep 17 00:00:00 2001 From: Hofmann Jonas Date: Tue, 9 Dec 2025 18:04:58 +0100 Subject: [PATCH] removed no longer needed comments --- bintree.c | 31 ++----------------------------- bintreeTests.c | 22 +--------------------- runbintreeTests.exe | Bin 102047 -> 102047 bytes 3 files changed, 3 insertions(+), 50 deletions(-) diff --git a/bintree.c b/bintree.c index 3ecf028..0f2f187 100644 --- a/bintree.c +++ b/bintree.c @@ -52,7 +52,6 @@ TreeNode *addToTreeRec(TreeNode *currentNode, TreeNode *newNode, CompareFctType { if ((currentNode == NULL)) { - // printf("Node == NULL\n"); if ((isDuplicate == NULL) || root) { return newNode; @@ -64,17 +63,14 @@ TreeNode *addToTreeRec(TreeNode *currentNode, TreeNode *newNode, CompareFctType } else if ((compareFct(currentNode->data, newNode->data) < 0)) { - // printf("<0\n"); currentNode->left = addToTreeRec(currentNode->left, newNode, compareFct, isDuplicate, 0); } else if ((compareFct(currentNode->data, newNode->data) > 0)) { - // printf(">0\n"); currentNode->right = addToTreeRec(currentNode->right, newNode, compareFct, isDuplicate, 0); } else if ((compareFct(currentNode->data, newNode->data) == 0)) { - // printf("==0\n"); if (isDuplicate == NULL) { currentNode->left = addToTreeRec(currentNode->left, newNode, compareFct, isDuplicate, 0); @@ -113,45 +109,22 @@ void clearTreeRec(TreeNode *currentNode) if (currentNode != NULL) { clearTree(currentNode->left); - clearTree(currentNode->right); - clearNode(currentNode); - /* - printf("1\n"); - free(¤tNode->data); - currentNode->data = NULL; - printf("2\n"); - // free(currentNode); - // currentNode = NULL; - printf("3\n"); - // */ } } void clearNode(TreeNode *node) { - // printf("in clearNode\n"); - // printf("node-> data = %u\n", node->data); - // printf("node-> data = %u\n", _ADDRESSOF(node->data)); - // printf("data = %p\n", node->data); free(node->data); node->data = NULL; - // printf("data = %p\n", node->data); - // printf("node-> data = %u\n", &node->data); - // printf("data freed \n"); + node->left = NULL; node->right = NULL; - // printf("left & right = Null\n"); - // printf("node = %p\n", node); - // printf("node = %u\n", _ADDRESSOF(node)); + free(node); - // printf("node = %d\n", node); node = NULL; - // printf("node = %p\n", node); - // printf("node = %u\n", &node); - // printf("freed node\n"); } diff --git a/bintreeTests.c b/bintreeTests.c index a451d99..eddc237 100644 --- a/bintreeTests.c +++ b/bintreeTests.c @@ -11,6 +11,7 @@ void setUp(void) { // Falls notwendig, kann hier Vorbereitungsarbeit gemacht werden } + void tearDown(void) { // Hier kann Bereinigungsarbeit nach jedem Test durchgeführt werden } @@ -92,7 +93,6 @@ void test_nextTreeDataReturnsNextDataCorrectly(void) } - // test if clear Tree frees all node.name and node memory AND sets them to zero // aditionally tests if the memoryspaces have been cleared void test_clearTreeworksLikeExpected(void) @@ -114,7 +114,6 @@ void test_clearTreeworksLikeExpected(void) testRoot = addToTree(testRoot, &score5, sizeof(int), compareIntEntries, NULL); testRoot = addToTree(testRoot, &score6, sizeof(int), compareIntEntries, NULL); testRoot = addToTree(testRoot, &score7, sizeof(int), compareIntEntries, NULL); - // printf("Tree Filled\n"); // Save all Adresses TreeNode *node1 = testRoot; @@ -124,37 +123,18 @@ void test_clearTreeworksLikeExpected(void) TreeNode *node5 = testRoot->right; TreeNode *node6 = testRoot->right->left; TreeNode *node7 = testRoot->right->right; - - // printf("Adresses Saved\n"); clearTree(testRoot); - // printf("Tree Cleared\n"); // Check if everything has been set to NULL TEST_ASSERT_NULL(node1->data); - //TEST_ASSERT_NULL(testRoot); - TEST_ASSERT_NULL(node1->data); - // TEST_ASSERT_NULL(node1); - TEST_ASSERT_NULL(node2->data); - // TEST_ASSERT_NULL(node2); - TEST_ASSERT_NULL(node3->data); - // TEST_ASSERT_NULL(node3); - TEST_ASSERT_NULL(node4->data); - // TEST_ASSERT_NULL(node4); - TEST_ASSERT_NULL(node5->data); - // TEST_ASSERT_NULL(node5); - TEST_ASSERT_NULL(node6->data); - // TEST_ASSERT_NULL(node6); - TEST_ASSERT_NULL(node7->data); - // TEST_ASSERT_NULL(node7); - // */ } diff --git a/runbintreeTests.exe b/runbintreeTests.exe index 800c7aca39394144e586b7e98a8f1c6b1ce05e85..13bdb19ef48a964f30b062634ed040939d694a97 100644 GIT binary patch delta 827 zcmbu--)mA~7zgn8dGkkOPSZRKQRbHYw06--V{7JqxN^-(NkT%H+72{YI`qieYDsO? z3Zk7ouJr>M(OnSClo*X&1YLH~MHeoDi0%emME^kVUf=$LZl3e~Jj&rc-*c8ry5*8? zevUr6s6ISL_ekZh-bUy|v!NZj&~I=;Hx3()fDcucPhy#6KmIhhpa=C$9_U41lMDJV z$#Op~u^hlPmIv@R%coE>df+q;86z-+C1V$au*Py2-KO0Tshl%uYaqhwMz z%zcbZ2?x17^h+u(7o4f_x(@M0=q%w I?Z&U_U+Fo{jQ{`u delta 827 zcmbu--%C?r7zgn8dE1Y~xwW4p8%|w6S6yUnWonyk#?+OQ7AzRJEe|BwCfgaMr6U3< z3GDbd3PL1`ep}jh5lKQ&H{nGWUCbyVx)ZvH{()ZKz5NBp)HV*Iko-;qEnV-|# zx=#J4m8p~T+tkt*Z!H`~qi!FxqEF|9HXP9Hhjvt0?!YCMkK#|A3w)@p^MD^a>Rix? zNtTb{ZI%PL%yJNav)qMNy$6nCuf898a87>&da=TCAG!_A5GkE7m?=zR(&&U6c$LkY zc#q9#e8=Vt{$R6+U~;~1cl#`=bNjfz&CXvV1RlZJ8b|Fv1pW;-@^i(KD z^-Rx%qSVUtTqr^vObbF`>SC&YAsC`=#+O1tQj3eJMtnO{OkFZmPnh5*Y$2n