mirror of
https://github.com/status-im/nim-stew.git
synced 2025-02-15 13:37:18 +00:00
fix 1.0 test compat
This commit is contained in:
parent
cf4df3dc50
commit
e9d75c05f6
@ -173,7 +173,6 @@ func readVarint*[Stream](input: var Stream,
|
|||||||
|
|
||||||
func appendVarintImpl[Stream](s: var Stream, x: SomeUnsignedInt) {.inline.} =
|
func appendVarintImpl[Stream](s: var Stream, x: SomeUnsignedInt) {.inline.} =
|
||||||
mixin append
|
mixin append
|
||||||
type UInt = type(x)
|
|
||||||
|
|
||||||
if x <= 0x7F:
|
if x <= 0x7F:
|
||||||
s.append byte(x and 0xFF)
|
s.append byte(x and 0xFF)
|
||||||
|
@ -49,7 +49,10 @@ suite "varints":
|
|||||||
|
|
||||||
test "[ProtoBuf] random values":
|
test "[ProtoBuf] random values":
|
||||||
for i in 0..10000:
|
for i in 0..10000:
|
||||||
let val = rand(0'u64 .. 0xFFFF_FFFF_FFFF_FFFE'u64)
|
# TODO nim 1.0 random casts limits to int, so anything bigger will crash
|
||||||
roundtipTest val
|
# * sigh *
|
||||||
|
let
|
||||||
|
v1 = rand(0'u64 .. cast[uint64](int.high))
|
||||||
|
roundtipTest v1
|
||||||
|
|
||||||
# TODO Migrate the rest of the LibP2P test cases
|
# TODO Migrate the rest of the LibP2P test cases
|
||||||
|
Loading…
x
Reference in New Issue
Block a user