zc_utils.py: restore 2^64 - 1 test vector.

Signed-off-by: Daira Hopwood <daira@jacaranda.org>
This commit is contained in:
Daira Hopwood 2021-09-15 17:45:10 +01:00
parent cbaca139a7
commit f15c51c680
1 changed files with 2 additions and 0 deletions

2
zc_utils.py Normal file → Executable file
View File

@ -1,3 +1,4 @@
#!/usr/bin/env python3
import struct
def write_compact_size(n):
@ -60,6 +61,7 @@ test_round_trip(0x010001, b'\xFE\x01\x00\x01\x00')
test_round_trip(0xFFFFFFFE, b'\xFE\xFE\xFF\xFF\xFF')
test_round_trip(0xFFFFFFFF, b'\xFE\xFF\xFF\xFF\xFF')
test_round_trip(0x0100000000, b'\xFF\x00\x00\x00\x00\x01\x00\x00\x00')
test_round_trip(0xFFFFFFFFFFFFFFFF, b'\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF')
assert_parse_fails(b'\xFD\xFC\x00')
assert_parse_fails(b'\xFE\xFF\xFF\x00\x00')