3 #include "tap-interface.h"
9 int main(int argc
, char *argv
[])
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
);
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);
38 ok1(tap_log_messages
== 0);