summaryrefslogtreecommitdiff
path: root/tests.c
diff options
context:
space:
mode:
Diffstat (limited to 'tests.c')
-rw-r--r--tests.c16
1 files 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);
}
generated by cgit on debian on lair
contact matthew@masot.net with questions or feedback