build: Remove unused build_idl.sh
[Samba.git] / lib / tdb / test / run-zero-append.c
blob36bf6990f53eb32ac3bd0a478e0c971f9a0704a0
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 "logging.h"
16 int main(int argc, char *argv[])
18 struct tdb_context *tdb;
19 TDB_DATA key, data;
21 plan_tests(4);
22 tdb = tdb_open_ex(NULL, 1024, TDB_INTERNAL, O_CREAT|O_TRUNC|O_RDWR,
23 0600, &taplogctx, NULL);
24 ok1(tdb);
26 /* Tickle bug on appending zero length buffer to zero length buffer. */
27 key.dsize = strlen("hi");
28 key.dptr = (void *)"hi";
29 data.dptr = (void *)"world";
30 data.dsize = 0;
32 ok1(tdb_append(tdb, key, data) == 0);
33 ok1(tdb_append(tdb, key, data) == 0);
34 data = tdb_fetch(tdb, key);
35 ok1(data.dsize == 0);
36 tdb_close(tdb);
37 free(data.dptr);
39 return exit_status();