]> git.ozlabs.org Git - ccan/blobdiff - ccan/tdb2/test/run-encode.c
tdb2: document problems with moving or enlarging hash table.
[ccan] / ccan / tdb2 / test / run-encode.c
index a6253fe4e736c3ef5a7285c8043edcfbea588d6a..b8c24366b7d63b9a491c28cc587775c22f9cece1 100644 (file)
@@ -3,14 +3,15 @@
 #include <ccan/tdb2/lock.c>
 #include <ccan/tdb2/io.c>
 #include <ccan/tap/tap.h>
+#include "logging.h"
 
 int main(int argc, char *argv[])
 {
        unsigned int i;
        struct tdb_used_record rec;
-       struct tdb_context tdb = { .log = null_log_fn, .log_priv = NULL };
+       struct tdb_context tdb = { .log = tap_log_fn, .log_priv = NULL };
 
-       plan_tests(64 + 32 + 48*6);
+       plan_tests(64 + 32 + 48*6 + 1);
 
        /* We should be able to encode any data value. */
        for (i = 0; i < 64; i++)
@@ -33,8 +34,9 @@ int main(int argc, char *argv[])
                ok1(rec_key_length(&rec) == klen);
                ok1(rec_data_length(&rec) == dlen);
                ok1(rec_extra_padding(&rec) == xlen);
-               ok1(rec_hash(&rec) == h);
+               ok1(rec_hash(&rec) << (64 - 11) == h);
                ok1(rec_magic(&rec) == TDB_MAGIC);
        }
+       ok1(tap_log_messages == 0);
        return exit_status();
 }