diff options
author | Joshua Haberman <joshua@reverberate.org> | 2009-06-16 22:45:07 -0700 |
---|---|---|
committer | Joshua Haberman <joshua@reverberate.org> | 2009-06-16 22:45:07 -0700 |
commit | 24c14a3ad0cc658d94e255fcdac2628fe1be5d05 (patch) | |
tree | 8b0e66fda4a1dd744092f80cb008a5f2a08dcf7e | |
parent | c41973146221b67c85bd5294aee99a47e4d76415 (diff) |
Increased robustness of 64-bit varint test.
-rw-r--r-- | tests.c | 16 |
1 files changed, 8 insertions, 8 deletions
@@ -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); } |