1 #include "private.h" // struct ntdb_context
3 #include "tap-interface.h"
10 int main(int argc
, char *argv
[])
13 struct ntdb_context
*ntdb
;
14 int flags
[] = { NTDB_DEFAULT
, NTDB_NOMMAP
,
15 NTDB_CONVERT
, NTDB_NOMMAP
|NTDB_CONVERT
};
16 NTDB_DATA key
= ntdb_mkdata("key", 3);
17 NTDB_DATA data
= ntdb_mkdata("data", 4), d
;
19 plan_tests(sizeof(flags
) / sizeof(flags
[0]) * 12 + 1);
21 for (i
= 0; i
< sizeof(flags
) / sizeof(flags
[0]); i
++) {
22 ntdb
= ntdb_open("api-60-transaction.ntdb",
23 flags
[i
]|MAYBE_NOSYNC
,
24 O_RDWR
|O_CREAT
|O_TRUNC
, 0600, &tap_log_attr
);
29 ok1(ntdb_store(ntdb
, key
, data
, NTDB_INSERT
) == 0);
31 ok1(ntdb_transaction_start(ntdb
) == 0);
32 /* Do an identical replace. */
33 ok1(ntdb_store(ntdb
, key
, data
, NTDB_REPLACE
) == 0);
34 ok1(ntdb_transaction_commit(ntdb
) == 0);
36 ok1(ntdb_check(ntdb
, NULL
, NULL
) == 0);
37 ok1(ntdb_fetch(ntdb
, key
, &d
) == NTDB_SUCCESS
);
38 ok1(ntdb_deq(data
, d
));
43 ntdb
= ntdb_open("api-60-transaction.ntdb",
44 flags
[i
]|MAYBE_NOSYNC
,
45 O_RDWR
, 0600, &tap_log_attr
);
49 ok1(ntdb_check(ntdb
, NULL
, NULL
) == 0);
50 ok1(ntdb_fetch(ntdb
, key
, &d
) == NTDB_SUCCESS
);
51 ok1(ntdb_deq(data
, d
));
56 ok1(tap_log_messages
== 0);