X-Git-Url: http://git.ozlabs.org/?p=ccan;a=blobdiff_plain;f=ccan%2Ftdb2%2Ftest%2Frun-enlarge_hash.c;fp=ccan%2Ftdb2%2Ftest%2Frun-enlarge_hash.c;h=10ded59b205f0fdc2678799cb4dda250da454b6e;hp=0000000000000000000000000000000000000000;hb=25ed8785693e98492c0c516a8845866ec784f2b9;hpb=dbf1ac48c3a1f5147dfcd457a7847a03de26a6c7 diff --git a/ccan/tdb2/test/run-enlarge_hash.c b/ccan/tdb2/test/run-enlarge_hash.c new file mode 100644 index 00000000..10ded59b --- /dev/null +++ b/ccan/tdb2/test/run-enlarge_hash.c @@ -0,0 +1,30 @@ +#include +#include +#include +#include +#include +#include +#include "logging.h" + +int main(int argc, char *argv[]) +{ + unsigned int i; + struct tdb_context *tdb; + int flags[] = { TDB_INTERNAL, TDB_DEFAULT, + TDB_INTERNAL|TDB_CONVERT, TDB_CONVERT }; + + plan_tests(sizeof(flags) / sizeof(flags[0]) * 2 + 1); + for (i = 0; i < sizeof(flags) / sizeof(flags[0]); i++) { + tdb = tdb_open("/tmp/run-new_database.tdb", flags[i], + O_RDWR|O_CREAT|O_TRUNC, 0600, NULL); + tdb->log = tap_log_fn; + ok1(tdb); + if (tdb) { + enlarge_hash(tdb); + ok1(tdb_check(tdb, NULL, NULL) == 0); + tdb_close(tdb); + } + } + ok1(tap_log_messages == 0); + return exit_status(); +}