treedump.c (909B)
1 #include "../lash_tree.h" 2 #include "../lash_tree_dump.h" 3 #include <stdlib.h> 4 #include <stdio.h> 5 6 int main(int argc, char **argv) { 7 8 lash_tree_t *tree1; 9 lash_tree_t *tree2; 10 lash_tree_t *tree3; 11 12 tree1 = lash_treeInit(tree1, 10); 13 if (tree1 == NULL) 14 return 1; 15 16 tree2 = lash_treeInit(tree2, 13); 17 if (tree2 == NULL) 18 return 1; 19 20 tree3 = lash_treeInit(tree3, 12); 21 if (tree3 == NULL) 22 return 1; 23 24 printf("Tree 1 has cap %d\n", tree1->capacity); 25 printf("Tree 2 has cap %d\n", tree2->capacity); 26 printf("Tree 3 has cap %d\n", tree3->capacity); 27 lash_treeDumpInit(2); 28 lash_treeDumpAdd(tree1, "test1"); 29 lash_treeDumpAdd(tree3, "test3"); 30 lash_treePush(tree1, 10, 0); 31 lash_treePush(tree1, 15, 0); 32 lash_treePush(tree1, 20, 0); 33 lash_treePush(tree3, 30, 0); 34 lash_treePush(tree3, 40, 2); 35 lash_treeDump(NULL, NULL); 36 lash_treeDump(tree1, NULL); 37 lash_treeDump(tree3, "test of comment"); 38 return 0; 39 }