]> git.ozlabs.org Git - ccan/blobdiff - ccan/tdb2/test/run-tdb1.c
tdb2: unify tdb1_store into tdb_store
[ccan] / ccan / tdb2 / test / run-tdb1.c
index 2d551dc53828151e757760696ecca106d94cdcaa..584d7d6504f45cbba413f0e894e8c2fa53a5cbd5 100644 (file)
@@ -14,7 +14,7 @@ int main(int argc, char *argv[])
        hsize.base.next = &tap_log_attr;
        hsize.tdb1_hashsize.hsize = 1024;
 
-       plan_tests(10);
+       plan_tests(8);
        tdb = tdb_open("run.tdb1", TDB_VERSION1,
                       O_CREAT|O_TRUNC|O_RDWR, 0600, &hsize);
 
@@ -24,12 +24,10 @@ int main(int argc, char *argv[])
        data.dsize = strlen("world");
        data.dptr = (void *)"world";
 
-       ok1(tdb1_store(tdb, key, data, TDB_MODIFY) < 0);
-       ok1(tdb_error(tdb) == TDB_ERR_NOEXIST);
-       ok1(tdb1_store(tdb, key, data, TDB_INSERT) == 0);
-       ok1(tdb1_store(tdb, key, data, TDB_INSERT) < 0);
-       ok1(tdb_error(tdb) == TDB_ERR_EXISTS);
-       ok1(tdb1_store(tdb, key, data, TDB_MODIFY) == 0);
+       ok1(tdb_store(tdb, key, data, TDB_MODIFY) == TDB_ERR_NOEXIST);
+       ok1(tdb_store(tdb, key, data, TDB_INSERT) == TDB_SUCCESS);
+       ok1(tdb_store(tdb, key, data, TDB_INSERT) == TDB_ERR_EXISTS);
+       ok1(tdb_store(tdb, key, data, TDB_MODIFY) == TDB_SUCCESS);
 
        data = tdb1_fetch(tdb, key);
        ok1(data.dsize == strlen("world"));