1 #include "private.h" // struct ntdb_context
3 #include "tap-interface.h"
7 int main(int argc
, char *argv
[])
10 struct ntdb_context
*ntdb
;
11 int flags
[] = { NTDB_DEFAULT
, NTDB_NOMMAP
,
12 NTDB_CONVERT
, NTDB_NOMMAP
|NTDB_CONVERT
};
13 NTDB_DATA key
= ntdb_mkdata("key", 3);
14 NTDB_DATA data
= ntdb_mkdata("data", 4), d
;
16 plan_tests(sizeof(flags
) / sizeof(flags
[0]) * 12 + 1);
18 for (i
= 0; i
< sizeof(flags
) / sizeof(flags
[0]); i
++) {
19 ntdb
= ntdb_open("api-60-transaction.ntdb",
20 flags
[i
]|MAYBE_NOSYNC
,
21 O_RDWR
|O_CREAT
|O_TRUNC
, 0600, &tap_log_attr
);
26 ok1(ntdb_store(ntdb
, key
, data
, NTDB_INSERT
) == 0);
28 ok1(ntdb_transaction_start(ntdb
) == 0);
29 /* Do an identical replace. */
30 ok1(ntdb_store(ntdb
, key
, data
, NTDB_REPLACE
) == 0);
31 ok1(ntdb_transaction_commit(ntdb
) == 0);
33 ok1(ntdb_check(ntdb
, NULL
, NULL
) == 0);
34 ok1(ntdb_fetch(ntdb
, key
, &d
) == NTDB_SUCCESS
);
35 ok1(ntdb_deq(data
, d
));
40 ntdb
= ntdb_open("api-60-transaction.ntdb",
41 flags
[i
]|MAYBE_NOSYNC
,
42 O_RDWR
, 0600, &tap_log_attr
);
46 ok1(ntdb_check(ntdb
, NULL
, NULL
) == 0);
47 ok1(ntdb_fetch(ntdb
, key
, &d
) == NTDB_SUCCESS
);
48 ok1(ntdb_deq(data
, d
));
53 ok1(tap_log_messages
== 0);