fix #15257, toHex couldn't handle large uint64 (#15261) [backport:1.2]

This commit is contained in:
Miran
2020-09-04 09:23:27 +02:00
committed by GitHub
parent 48f2997221
commit 4fb17bc03b
2 changed files with 35 additions and 14 deletions

View File

@@ -3,8 +3,6 @@
import
strutils
import macros
template rejectParse(e) =
try:
discard e
@@ -296,6 +294,10 @@ assert "/1/2/3".rfind('0') == -1
assert(toHex(100i16, 32) == "00000000000000000000000000000064")
assert(toHex(-100i16, 32) == "FFFFFFFFFFFFFFFFFFFFFFFFFFFFFF9C")
assert(toHex(high(uint64)) == "FFFFFFFFFFFFFFFF")
assert(toHex(high(uint64), 16) == "FFFFFFFFFFFFFFFF")
assert(toHex(high(uint64), 32) == "0000000000000000FFFFFFFFFFFFFFFF")
assert "".parseHexStr == ""
assert "00Ff80".parseHexStr == "\0\xFF\x80"
try: