1 #include "tdb2-source.h"
2 #include <ccan/tap/tap.h>
5 static bool add_records(struct tdb_context *tdb)
8 struct tdb_data key = { (unsigned char *)&i, sizeof(i) };
9 struct tdb_data data = { (unsigned char *)&i, sizeof(i) };
11 for (i = 0; i < 1000; i++) {
12 if (tdb_store(tdb, key, data, TDB_REPLACE) != 0)
19 int main(int argc, char *argv[])
22 struct tdb_context *tdb;
23 int flags[] = { TDB_INTERNAL, TDB_DEFAULT, TDB_NOMMAP,
24 TDB_INTERNAL|TDB_CONVERT, TDB_CONVERT,
25 TDB_NOMMAP|TDB_CONVERT };
27 plan_tests(sizeof(flags) / sizeof(flags[0]) * 4 + 1);
28 for (i = 0; i < sizeof(flags) / sizeof(flags[0]); i++) {
29 tdb = tdb_open("run-16-wipe_all.tdb", flags[i],
30 O_RDWR|O_CREAT|O_TRUNC, 0600, &tap_log_attr);
33 ok1(add_records(tdb));
34 ok1(tdb_wipe_all(tdb) == TDB_SUCCESS);
35 ok1(tdb_firstkey(tdb, &key) == TDB_ERR_NOEXIST);
40 ok1(tap_log_messages == 0);