From 00ae16c7776e7624486a95227b638ea6b0aa2b03 Mon Sep 17 00:00:00 2001 From: wjf-hs Date: Mon, 24 Jun 2024 17:25:59 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B5=8B=E8=AF=95=E7=A4=BA=E4=BE=8B=E7=9A=84?= =?UTF-8?q?=E6=98=BE=E7=A4=BA=E6=96=B9=E5=BC=8F=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- test/test_tree.c | 29 +++++++++++++---------------- 1 file changed, 13 insertions(+), 16 deletions(-) diff --git a/test/test_tree.c b/test/test_tree.c index 953a875..090723c 100644 --- a/test/test_tree.c +++ b/test/test_tree.c @@ -296,11 +296,14 @@ void test_tree_num(void) printf("----- insert -----\n"); for (i = 0; i < len; i++) { - tree->insert(tree, &data[i]); + temp = data[i]; + tree->insert(tree, &temp); - // printf("----- preorder -----\n"); - // tree->preorder(tree, tree->_root); - // printf("\n"); + printf("insert = "); + tree->print_obj(&temp); + printf("size = %2d : ", tree->size(tree)); + tree->preorder(tree, tree->_root); + printf("\n"); } printf("----- preorder -----\n"); tree->preorder(tree, tree->_root); @@ -321,19 +324,19 @@ void test_tree_num(void) printf("----- right priority -----\n"); tree->order(tree, true); - printf("----- preorder -----\n"); + printf("----- preorder(right) -----\n"); tree->preorder(tree, tree->_root); printf("\n"); - printf("----- inorder -----\n"); + printf("----- inorder(right) -----\n"); tree->inorder(tree, tree->_root); printf("\n"); - printf("----- postorder -----\n"); + printf("----- postorder(right) -----\n"); tree->postorder(tree, tree->_root); printf("\n"); - printf("----- breadth -----\n"); + printf("----- breadth(right) -----\n"); tree->breadth(tree, tree->_root); printf("\n"); @@ -347,18 +350,12 @@ void test_tree_num(void) for (i = 0; i < len; i++) { temp = data[i]; - - printf("delete = "); - tree->print_obj(&temp); // delete tree->delete(tree, &temp); + printf("delete = "); + tree->print_obj(&temp); printf("size = %2d : ", tree->size(tree)); - - - // printf("----- breadth -----\n"); - // tree->breadth(tree, tree->_root); - // printf("----- preorder -----\n"); tree->preorder(tree, tree->_root); printf("\n"); }