Improve the VFS Makefile so that it is easier for use out of tree but still works...
[Samba/gebeck_regimport.git] / lib / tdb / test / run-zero-append.c
blob0ef30737ba6caa0e0c7776316193d78fe63de5dd
1 #include "../common/tdb_private.h"
2 #include "../common/io.c"
3 #include "../common/tdb.c"
4 #include "../common/lock.c"
5 #include "../common/freelist.c"
6 #include "../common/traverse.c"
7 #include "../common/transaction.c"
8 #include "../common/error.c"
9 #include "../common/open.c"
10 #include "../common/check.c"
11 #include "../common/hash.c"
12 #include "tap-interface.h"
13 #include <stdlib.h>
14 #include <err.h>
15 #include "logging.h"
17 int main(int argc, char *argv[])
19 struct tdb_context *tdb;
20 TDB_DATA key, data;
22 plan_tests(4);
23 tdb = tdb_open_ex(NULL, 1024, TDB_INTERNAL, O_CREAT|O_TRUNC|O_RDWR,
24 0600, &taplogctx, NULL);
25 ok1(tdb);
27 /* Tickle bug on appending zero length buffer to zero length buffer. */
28 key.dsize = strlen("hi");
29 key.dptr = (void *)"hi";
30 data.dptr = (void *)"world";
31 data.dsize = 0;
33 ok1(tdb_append(tdb, key, data) == 0);
34 ok1(tdb_append(tdb, key, data) == 0);
35 data = tdb_fetch(tdb, key);
36 ok1(data.dsize == 0);
37 tdb_close(tdb);
38 free(data.dptr);
40 return exit_status();