X-Git-Url: http://mj.ucw.cz/gitweb/?a=blobdiff_plain;ds=sidebyside;f=lib%2Fredblack-test.c;h=575d645f13ce7a14469c1ce338d15b92d114dc37;hb=80ca78f1c50aeaaa1483719127a6b31b39c11510;hp=ede1a71e8baede52f7663130d7a36c0c8b901a16;hpb=b3524e137a080e8a37687347e1898cc1f0a91379;p=libucw.git diff --git a/lib/redblack-test.c b/lib/redblack-test.c index ede1a71e..575d645f 100644 --- a/lib/redblack-test.c +++ b/lib/redblack-test.c @@ -4,7 +4,6 @@ * (c) 2002, Robert Spalek */ -#define DEBUG #include "lib/lib.h" #include "lib/conf.h" #include "lib/fastbuf.h" @@ -39,7 +38,6 @@ static void my_dump_data(struct fastbuf *fb, struct my1_node *n) #define TREE_WANT_DELETE #define TREE_WANT_ITERATOR #define TREE_WANT_DUMP -#define TREE_STATIC #define TREE_CONSERVE_SPACE #include "redblack.h" @@ -123,7 +121,7 @@ usage(void) int main(int argc, char **argv) { - uns verbose = 0, number = 1000, asserts = 0; + int verbose = 0, number = 1000, asserts = 0; int opt; struct fastbuf *fb, *dump_fb; struct my_tree t; @@ -177,7 +175,8 @@ main(int argc, char **argv) } for (i=0; i<100; i++) { - int res UNUSED = my_delete(&t, i); + int a = i/10, b = i%10, j = a*10 + (b + a) % 10; + int res UNUSED = my_delete(&t, j); ASSERT(res); my_dump(dump_fb, &t); } @@ -192,13 +191,6 @@ main(int argc, char **argv) my_dump(NULL, &t); } my_dump(dump_fb, &t); - for (i=0; i<997; i++) - { - int res UNUSED = my_delete(&t, i*111 % 997); - ASSERT(res); - my_dump(NULL, &t); - } - my_dump(dump_fb, &t); i = 0; TREE_FOR_ALL(my, &t, n) { @@ -206,6 +198,14 @@ main(int argc, char **argv) i++; } TREE_END_FOR; + ASSERT(i == 997); + for (i=0; i<997; i++) + { + int res UNUSED = my_delete(&t, i*111 % 997); + ASSERT(res); + my_dump(NULL, &t); + } + my_dump(dump_fb, &t); my_cleanup(&t); if (verbose > 0) bputs(fb, "Complete tree passed\n");