3 #include "../private.h"
4 #include "tap-interface.h"
6 #include "helpapi-external-agent.h"
8 int main(int argc, char *argv[])
11 struct ntdb_context *ntdb;
12 int flags[] = { NTDB_INTERNAL, NTDB_DEFAULT, NTDB_NOMMAP,
13 NTDB_INTERNAL|NTDB_CONVERT, NTDB_CONVERT,
14 NTDB_NOMMAP|NTDB_CONVERT };
15 NTDB_DATA key = ntdb_mkdata("key", 3);
16 NTDB_DATA data = ntdb_mkdata("data", 4);
18 plan_tests(sizeof(flags) / sizeof(flags[0]) * 7 + 1);
19 for (i = 0; i < sizeof(flags) / sizeof(flags[0]); i++) {
20 ntdb = ntdb_open("run-simple-delete.ntdb",
21 flags[i]|MAYBE_NOSYNC,
22 O_RDWR|O_CREAT|O_TRUNC, 0600, &tap_log_attr);
25 /* Delete should fail. */
26 ok1(ntdb_delete(ntdb, key) == NTDB_ERR_NOEXIST);
27 ok1(ntdb_check(ntdb, NULL, NULL) == 0);
28 /* Insert should succeed. */
29 ok1(ntdb_store(ntdb, key, data, NTDB_INSERT) == 0);
30 ok1(ntdb_check(ntdb, NULL, NULL) == 0);
31 /* Delete should now work. */
32 ok1(ntdb_delete(ntdb, key) == 0);
33 ok1(ntdb_check(ntdb, NULL, NULL) == 0);
37 ok1(tap_log_messages == 0);