further debugging
This commit is contained in:
parent
f7549910eb
commit
7c3df62d86
14
bintree.c
14
bintree.c
@ -113,6 +113,15 @@ void clearTreeRec(TreeNode *currentNode)
|
|||||||
clearTree(currentNode->right);
|
clearTree(currentNode->right);
|
||||||
|
|
||||||
clearNode(currentNode);
|
clearNode(currentNode);
|
||||||
|
/*
|
||||||
|
printf("1\n");
|
||||||
|
free(¤tNode->data);
|
||||||
|
currentNode->data = NULL;
|
||||||
|
printf("2\n");
|
||||||
|
// free(currentNode);
|
||||||
|
// currentNode = NULL;
|
||||||
|
printf("3\n");
|
||||||
|
// */
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -120,11 +129,11 @@ void clearTreeRec(TreeNode *currentNode)
|
|||||||
void clearNode(TreeNode *node)
|
void clearNode(TreeNode *node)
|
||||||
{
|
{
|
||||||
// printf("in clearNode\n");
|
// printf("in clearNode\n");
|
||||||
printf("node-> data = %u\n", &node->data);
|
// printf("node-> data = %u\n", node->data);
|
||||||
// printf("node-> data = %u\n", _ADDRESSOF(node->data));
|
// printf("node-> data = %u\n", _ADDRESSOF(node->data));
|
||||||
free(&node->data);
|
free(&node->data);
|
||||||
node->data = NULL;
|
node->data = NULL;
|
||||||
printf("node-> data = %u\n", &node->data);
|
// printf("node-> data = %u\n", &node->data);
|
||||||
// printf("data freed \n");
|
// printf("data freed \n");
|
||||||
node->left = NULL;
|
node->left = NULL;
|
||||||
node->right = NULL;
|
node->right = NULL;
|
||||||
@ -134,6 +143,7 @@ void clearNode(TreeNode *node)
|
|||||||
// free(node);
|
// free(node);
|
||||||
// printf("node = %d\n", node);
|
// printf("node = %d\n", node);
|
||||||
node = NULL;
|
node = NULL;
|
||||||
|
printf("node = %u\n", &node);
|
||||||
printf("freed node\n");
|
printf("freed node\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -131,7 +131,7 @@ void test_clearTreeworksLikeExpected(void)
|
|||||||
|
|
||||||
// Check if everything has been set to NULL
|
// Check if everything has been set to NULL
|
||||||
TEST_ASSERT_NULL(testRoot->data);
|
TEST_ASSERT_NULL(testRoot->data);
|
||||||
// TEST_ASSERT_NULL(testRoot);
|
TEST_ASSERT_NULL(testRoot);
|
||||||
|
|
||||||
TEST_ASSERT_NULL(node1->data);
|
TEST_ASSERT_NULL(node1->data);
|
||||||
// TEST_ASSERT_NULL(node1);
|
// TEST_ASSERT_NULL(node1);
|
||||||
|
|||||||
Binary file not shown.
Loading…
x
Reference in New Issue
Block a user