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/tdb2/transaction.c>
8 #include <ccan/tap/tap.h>
10 int main(int argc, char *argv[])
12 struct tdb_context *tdb;
14 plan_tests(1 + TDB_ERR_NESTING + 2);
15 tdb = tdb_open("run-tdb_errorstr.tdb", TDB_DEFAULT,
16 O_RDWR|O_CREAT|O_TRUNC, 0600, NULL);
20 for (err = TDB_SUCCESS; err <= TDB_ERR_NESTING; err++) {
24 ok1(!strcmp(tdb_errorstr(tdb),
28 ok1(!strcmp(tdb_errorstr(tdb),
29 "Transaction already started"));
32 ok1(!strcmp(tdb_errorstr(tdb),
36 ok1(!strcmp(tdb_errorstr(tdb),
40 ok1(!strcmp(tdb_errorstr(tdb),
44 ok1(!strcmp(tdb_errorstr(tdb),
48 ok1(!strcmp(tdb_errorstr(tdb),
49 "Invalid parameter"));
52 ok1(!strcmp(tdb_errorstr(tdb),
53 "Record does not exist"));
56 ok1(!strcmp(tdb_errorstr(tdb),
57 "write not permitted"));
60 ok1(!strcmp(tdb_errorstr(tdb),
65 ok1(!strcmp(tdb_errorstr(tdb), "Invalid error code"));