X-Git-Url: http://mj.ucw.cz/gitweb/?a=blobdiff_plain;ds=sidebyside;f=lib%2Fredblack-test.c;h=80a7a000ce8711603b11fce25877ca03fb46b4bb;hb=239f3fb07d3b69db82ddb097f16c495c6a289349;hp=cb722f33254bf80fb79462b9fb282ca7bf39d468;hpb=18a4ad653c68dcb7dbcdeaefacbba6ca8a5e52c1;p=libucw.git diff --git a/lib/redblack-test.c b/lib/redblack-test.c index cb722f33..80a7a000 100644 --- a/lib/redblack-test.c +++ b/lib/redblack-test.c @@ -5,7 +5,7 @@ */ #include "lib/lib.h" -#include "lib/conf.h" +#include "lib/getopt.h" #include "lib/fastbuf.h" #include #include @@ -127,7 +127,7 @@ main(int argc, char **argv) struct my_tree t; struct my2_tree t2; int i; - cfdeffile = NULL; + cf_def_file = NULL; log_init(argv[0]); while ((opt = cf_getopt(argc, argv, options, CF_NO_LONG_OPTS, NULL)) >= 0) switch (opt) @@ -175,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); } @@ -190,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) { @@ -204,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");