fix 1.0 test compat

This commit is contained in:
Jacek Sieka 2019-12-10 15:50:02 +01:00
parent cf4df3dc50
commit e9d75c05f6
No known key found for this signature in database
GPG Key ID: A1B09461ABB656B8
2 changed files with 5 additions and 3 deletions

View File

@ -173,7 +173,6 @@ func readVarint*[Stream](input: var Stream,
func appendVarintImpl[Stream](s: var Stream, x: SomeUnsignedInt) {.inline.} =
mixin append
type UInt = type(x)
if x <= 0x7F:
s.append byte(x and 0xFF)

View File

@ -49,7 +49,10 @@ suite "varints":
test "[ProtoBuf] random values":
for i in 0..10000:
let val = rand(0'u64 .. 0xFFFF_FFFF_FFFF_FFFE'u64)
roundtipTest val
# TODO nim 1.0 random casts limits to int, so anything bigger will crash
# * sigh *
let
v1 = rand(0'u64 .. cast[uint64](int.high))
roundtipTest v1
# TODO Migrate the rest of the LibP2P test cases