X-Git-Url: http://git.ozlabs.org/?p=ccan;a=blobdiff_plain;f=ccan%2Ftdb2%2Ftest%2Frun-traverse.c;h=02335d6a82332f8085e387d4de506ee74539d84c;hp=51d84a0a7afaa6a2554069e379e658995d53a77e;hb=c56e2b1b5e51b094d53f4012e226b352a91618f6;hpb=04d31dd269ab901ac3de7a1290ed6a87bdea206a diff --git a/ccan/tdb2/test/run-traverse.c b/ccan/tdb2/test/run-traverse.c index 51d84a0a..02335d6a 100644 --- a/ccan/tdb2/test/run-traverse.c +++ b/ccan/tdb2/test/run-traverse.c @@ -2,8 +2,10 @@ #include #include #include +#include #include #include +#include #include #include "logging.h" @@ -117,7 +119,7 @@ int main(int argc, char *argv[]) hattr.base.next = &tap_log_attr; - plan_tests(sizeof(flags) / sizeof(flags[0]) * 50 + 1); + plan_tests(sizeof(flags) / sizeof(flags[0]) * 53 + 1); for (i = 0; i < sizeof(flags) / sizeof(flags[0]); i++) { tdb = tdb_open("run-traverse.tdb", flags[i], O_RDWR|O_CREAT|O_TRUNC, 0600, &hattr); @@ -179,6 +181,7 @@ int main(int argc, char *argv[]) ok1(td.low <= NUM_RECORDS / 2); ok1(td.high > NUM_RECORDS / 2); ok1(tdb_check(tdb, NULL, NULL) == 0); + ok1(tap_log_messages == 0); /* Growing traverse. Expect failure on r/o traverse. */ tgd.calls = 0; @@ -190,6 +193,8 @@ int main(int argc, char *argv[]) ok1(tgd.error == TDB_ERR_RDONLY); ok1(tgd.calls == 1); ok1(!tgd.mismatch); + ok1(tap_log_messages == 1); + tap_log_messages = 0; ok1(tdb_check(tdb, NULL, NULL) == 0); /* Deleting traverse. Expect failure on r/o traverse. */ @@ -206,9 +211,11 @@ int main(int argc, char *argv[]) ok1(!td.mismatch); ok1(td.calls == 1); ok1(td.low == td.high); + ok1(tap_log_messages == 1); + tap_log_messages = 0; ok1(tdb_check(tdb, NULL, NULL) == 0); - /* Deleting traverse. */ + /* Deleting traverse (delete everything). */ td.calls = 0; td.call_limit = UINT_MAX; td.low = INT_MAX; @@ -222,7 +229,7 @@ int main(int argc, char *argv[]) ok1(!td.mismatch); ok1(td.calls == NUM_RECORDS); ok1(td.low == 0); - ok1(td.high == NUM_RECORDS-1); + ok1(td.high == NUM_RECORDS - 1); ok1(tdb_check(tdb, NULL, NULL) == 0); /* Now it's empty! */