diff options
author | Miran <narimiran@disroot.org> | 2020-09-04 09:23:27 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-09-04 09:23:27 +0200 |
commit | 4fb17bc03be3046d8ff619a74eec7cb7ce02b4d2 (patch) | |
tree | 64e1452f63bb3b4c986842b398cafe877a6ebfc6 /tests | |
parent | 48f29972210612b41cb6d98122672b1713edc907 (diff) | |
download | Nim-4fb17bc03be3046d8ff619a74eec7cb7ce02b4d2.tar.gz |
fix #15257, `toHex` couldn't handle large uint64 (#15261) [backport:1.2]
Diffstat (limited to 'tests')
-rw-r--r-- | tests/stdlib/tstrutil.nim | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/tests/stdlib/tstrutil.nim b/tests/stdlib/tstrutil.nim index 5702b7341..ef5b041be 100644 --- a/tests/stdlib/tstrutil.nim +++ b/tests/stdlib/tstrutil.nim @@ -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: |