From 24c14a3ad0cc658d94e255fcdac2628fe1be5d05 Mon Sep 17 00:00:00 2001 From: Joshua Haberman Date: Tue, 16 Jun 2009 22:45:07 -0700 Subject: Increased robustness of 64-bit varint test. --- tests.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/tests.c b/tests.c index a62ad0d..c29c9a0 100644 --- a/tests.c +++ b/tests.c @@ -29,17 +29,17 @@ void test_get_v_uint64_t() assert(status == UPB_STATUS_OK); assert(twobyte_val == 300); - uint8_t ninebyte[] = {0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x7F}; - uint8_t *ninebyte_buf = ninebyte; - uint64_t ninebyte_val = 0; - status = get_v_uint64_t(&ninebyte_buf, &ninebyte_val); - assert(status == UPB_STATUS_OK); - assert(ninebyte_val == (1ULL<<63)); - - uint8_t tenbyte[] = {0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x01}; + uint8_t tenbyte[] = {0x81, 0x82, 0x83, 0x84, 0x85, 0x86, 0x87, 0x88, 0x89, 0x7F}; uint8_t *tenbyte_buf = tenbyte; uint64_t tenbyte_val = 0; status = get_v_uint64_t(&tenbyte_buf, &tenbyte_val); + assert(status == UPB_STATUS_OK); + assert(tenbyte_val == 0x89101c305080c101); + + uint8_t elevenbyte[] = {0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x01}; + uint8_t *elevenbyte_buf = elevenbyte; + uint64_t elevenbyte_val = 0; + status = get_v_uint64_t(&elevenbyte_buf, &elevenbyte_val); assert(status == UPB_ERROR_UNTERMINATED_VARINT); } -- cgit v1.2.3