X-Git-Url: http://git.ozlabs.org/?a=blobdiff_plain;f=ccan%2Ftdb2%2Ftest%2Frun-simple-store.c;fp=ccan%2Ftdb2%2Ftest%2Frun-simple-store.c;h=0000000000000000000000000000000000000000;hb=6804501c350181dea8f531142b28c620b70edbd9;hp=ba6f97a334d5a0f7b3ad2300ac34b29e33979bfc;hpb=32710c917e41b6a283ab73190614623c1a8e9508;p=ccan diff --git a/ccan/tdb2/test/run-simple-store.c b/ccan/tdb2/test/run-simple-store.c deleted file mode 100644 index ba6f97a3..00000000 --- a/ccan/tdb2/test/run-simple-store.c +++ /dev/null @@ -1,41 +0,0 @@ -#include -#include -#include -#include -#include -#include -#include "logging.h" - -int main(int argc, char *argv[]) -{ - unsigned int i; - struct tdb_context *tdb; - int flags[] = { TDB_INTERNAL, TDB_DEFAULT, TDB_NOMMAP, - TDB_INTERNAL|TDB_CONVERT, TDB_CONVERT, - TDB_NOMMAP|TDB_CONVERT }; - struct tdb_data key = { (unsigned char *)"key", 3 }; - struct tdb_data data = { (unsigned char *)"data", 4 }; - - plan_tests(sizeof(flags) / sizeof(flags[0]) * 9 + 1); - for (i = 0; i < sizeof(flags) / sizeof(flags[0]); i++) { - tdb = tdb_open("run-simple-store.tdb", flags[i], - O_RDWR|O_CREAT|O_TRUNC, 0600, &tap_log_attr); - ok1(tdb); - if (tdb) { - /* Modify should fail. */ - ok1(tdb_store(tdb, key, data, TDB_MODIFY) == -1); - ok1(tdb_error(tdb) == TDB_ERR_NOEXIST); - ok1(tdb_check(tdb, NULL, NULL) == 0); - /* Insert should succeed. */ - ok1(tdb_store(tdb, key, data, TDB_INSERT) == 0); - ok1(tdb_check(tdb, NULL, NULL) == 0); - /* Second insert should fail. */ - ok1(tdb_store(tdb, key, data, TDB_INSERT) == -1); - ok1(tdb_error(tdb) == TDB_ERR_EXISTS); - ok1(tdb_check(tdb, NULL, NULL) == 0); - tdb_close(tdb); - } - } - ok1(tap_log_messages == 0); - return exit_status(); -}