s3:smb2_server: add .need_tcon to smbd_smb2_dispatch_table
[Samba/gebeck_regimport.git] / lib / ntdb / test / api-simple-delete.c
blobdedc433d1fcc2a99e9ba331ed2af92369162860e
1 #include "config.h"
2 #include "ntdb.h"
3 #include "tap-interface.h"
4 #include <sys/types.h>
5 #include <sys/stat.h>
6 #include <fcntl.h>
7 #include "logging.h"
9 int main(int argc, char *argv[])
11 unsigned int i;
12 struct ntdb_context *ntdb;
13 int flags[] = { NTDB_INTERNAL, NTDB_DEFAULT, NTDB_NOMMAP,
14 NTDB_INTERNAL|NTDB_CONVERT, NTDB_CONVERT,
15 NTDB_NOMMAP|NTDB_CONVERT };
16 NTDB_DATA key = ntdb_mkdata("key", 3);
17 NTDB_DATA data = ntdb_mkdata("data", 4);
19 plan_tests(sizeof(flags) / sizeof(flags[0]) * 7 + 1);
20 for (i = 0; i < sizeof(flags) / sizeof(flags[0]); i++) {
21 ntdb = ntdb_open("run-simple-delete.ntdb",
22 flags[i]|MAYBE_NOSYNC,
23 O_RDWR|O_CREAT|O_TRUNC, 0600, &tap_log_attr);
24 ok1(ntdb);
25 if (ntdb) {
26 /* Delete should fail. */
27 ok1(ntdb_delete(ntdb, key) == NTDB_ERR_NOEXIST);
28 ok1(ntdb_check(ntdb, NULL, NULL) == 0);
29 /* Insert should succeed. */
30 ok1(ntdb_store(ntdb, key, data, NTDB_INSERT) == 0);
31 ok1(ntdb_check(ntdb, NULL, NULL) == 0);
32 /* Delete should now work. */
33 ok1(ntdb_delete(ntdb, key) == 0);
34 ok1(ntdb_check(ntdb, NULL, NULL) == 0);
35 ntdb_close(ntdb);
38 ok1(tap_log_messages == 0);
39 return exit_status();