diff options
author | Keith Bostic <keith@wiredtiger.com> | 2015-03-03 20:53:44 -0500 |
---|---|---|
committer | Keith Bostic <keith@wiredtiger.com> | 2015-03-03 20:53:44 -0500 |
commit | 62bed5afec9a6b075c7963928fe5c77994ae759b (patch) | |
tree | d4cd82159805bc2fbdbef1a72cd0f31e31c28fc4 /test/packing | |
parent | a59f2a5c8344702e42ed3c35e59faa1e5e5bf0a1 (diff) | |
download | mongo-62bed5afec9a6b075c7963928fe5c77994ae759b.tar.gz |
Make the packing tests compile again, add them to the list of test
programs we always compile.
Diffstat (limited to 'test/packing')
-rw-r--r-- | test/packing/intpack-test.c | 22 | ||||
-rw-r--r-- | test/packing/intpack-test2.c | 17 | ||||
-rw-r--r-- | test/packing/packing-test.c | 18 |
3 files changed, 28 insertions, 29 deletions
diff --git a/test/packing/intpack-test.c b/test/packing/intpack-test.c index 109f37e229a..1a16b33a615 100644 --- a/test/packing/intpack-test.c +++ b/test/packing/intpack-test.c @@ -27,13 +27,13 @@ */ #include <assert.h> -#include <stdlib.h> -#include <time.h> -#include <wt_internal.h> -#include "intpack.i" +#include "wt_internal.h" -int main() { +int +main() +{ + const uint8_t *cp; uint8_t buf[10], *p; uint64_t r, r2, ncalls; int i, s; @@ -47,9 +47,9 @@ int main() { #if 1 p = buf; - __wt_vpack_uint(NULL, &p, sizeof buf, r); - p = buf; - __wt_vunpack_uint(NULL, &p, sizeof buf, &r2); + assert(__wt_vpack_uint(&p, sizeof(buf), r) == 0); + cp = buf; + assert(__wt_vunpack_uint(&cp, sizeof(buf), &r2) == 0); #else /* * Note: use memmove for comparison because GCC does @@ -57,9 +57,9 @@ int main() { * to measure anything. */ p = buf; - memmove(p, &r, sizeof r); - p = buf; - memmove(&r2, p, sizeof r2); + memmove(p, &r, sizeof(r)); + cp = buf; + memmove(&r2, cp, sizeof(r2)); #endif if (r != r2) { fprintf(stderr, "mismatch!\n"); diff --git a/test/packing/intpack-test2.c b/test/packing/intpack-test2.c index 6b54504f367..6f409a6434c 100644 --- a/test/packing/intpack-test2.c +++ b/test/packing/intpack-test2.c @@ -27,27 +27,26 @@ */ #include <assert.h> -#include <stdlib.h> -#include <time.h> -#include <wt_internal.h> -#include "intpack.i" +#include "wt_internal.h" -int main() { +int +main() +{ uint8_t buf[10], *p, *end; int64_t i; for (i = 1; i < 1LL << 60; i <<= 1) { end = buf; - __wt_vpack_uint(NULL, &end, sizeof buf, i); - printf("%lld ", i); + assert(__wt_vpack_uint(&end, sizeof(buf), i) == 0); + printf("%" PRId64 " ", i); for (p = buf; p < end; p++) printf("%02x", *p); printf("\n"); end = buf; - __wt_vpack_int(NULL, &end, sizeof buf, -i); - printf("%lld ", -i); + assert(__wt_vpack_int(&end, sizeof(buf), -i) == 0); + printf("%" PRId64 " ", -i); for (p = buf; p < end; p++) printf("%02x", *p); printf("\n"); diff --git a/test/packing/packing-test.c b/test/packing/packing-test.c index 2696e8a008d..803e1fb2b37 100644 --- a/test/packing/packing-test.c +++ b/test/packing/packing-test.c @@ -27,26 +27,24 @@ */ #include <assert.h> -#include <stdlib.h> -#include <time.h> -#include <wiredtiger.h> -#include <stdarg.h> +#include "wt_internal.h" -void check(const char *fmt, ...) +static void +check(const char *fmt, ...) { char buf[200], *end, *p; va_list ap; size_t len; va_start(ap, fmt); - len = wiredtiger_struct_sizev(fmt, ap); + assert(__wt_struct_sizev(NULL, &len, fmt, ap) == 0); va_end(ap); - assert(len < sizeof buf); + assert(len < sizeof(buf)); va_start(ap, fmt); - assert(wiredtiger_struct_packv(buf, sizeof buf, fmt, ap) == 0); + assert(__wt_struct_packv(NULL, buf, sizeof(buf), fmt, ap) == 0); va_end(ap); printf("%s ", fmt); @@ -55,7 +53,9 @@ void check(const char *fmt, ...) printf("\n"); } -int main() { +int +main() +{ check("iii", 0, 101, -99); check("3i", 0, 101, -99); check("iS", 42, "forty two"); |