]> git.ozlabs.org Git - ccan/blob - ccan/tdb2/test/run-01-new_database.c
6b82d57657beb3b05f6bc880b4de6d6142d7af0a
[ccan] / ccan / tdb2 / test / run-01-new_database.c
1 #include <ccan/tdb2/tdb.c>
2 #include <ccan/tdb2/free.c>
3 #include <ccan/tdb2/lock.c>
4 #include <ccan/tdb2/io.c>
5 #include <ccan/tdb2/hash.c>
6 #include <ccan/tdb2/check.c>
7 #include <ccan/tap/tap.h>
8 #include "logging.h"
9
10 int main(int argc, char *argv[])
11 {
12         unsigned int i;
13         struct tdb_context *tdb;
14         int flags[] = { TDB_INTERNAL, TDB_DEFAULT, TDB_NOMMAP,
15                         TDB_INTERNAL|TDB_CONVERT, TDB_CONVERT, 
16                         TDB_NOMMAP|TDB_CONVERT };
17
18         plan_tests(sizeof(flags) / sizeof(flags[0]) * 2 + 1);
19         for (i = 0; i < sizeof(flags) / sizeof(flags[0]); i++) {
20                 tdb = tdb_open("run-new_database.tdb", flags[i],
21                                O_RDWR|O_CREAT|O_TRUNC, 0600, &tap_log_attr);
22                 ok1(tdb);
23                 if (tdb) {
24                         ok1(tdb_check(tdb, NULL, NULL) == 0);
25                         tdb_close(tdb);
26                 }
27         }
28         ok1(tap_log_messages == 0);
29         return exit_status();
30 }