From 5620bbfaee4be55896647d28e8014f41d4666d40 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mamy=20Andr=C3=A9-Ratsimbazafy?= Date: Sun, 16 Feb 2020 11:29:27 +0100 Subject: [PATCH] rename io tests ti io bigints --- constantine.nimble | 2 +- constantine/io/io_bigints.nim | 3 ++- tests/{test_io.nim => test_io_bigints.nim} | 0 3 files changed, 3 insertions(+), 2 deletions(-) rename tests/{test_io.nim => test_io_bigints.nim} (100%) diff --git a/constantine.nimble b/constantine.nimble index 84b5964..06bb98b 100644 --- a/constantine.nimble +++ b/constantine.nimble @@ -17,7 +17,7 @@ proc test(fakeCurves: string, path: string, lang = "c") = ### tasks task test, "Run all tests": test "", "tests/test_primitives.nim" - test "", "tests/test_io.nim" + test "", "tests/test_io_bigints.nim" test "", "tests/test_bigints.nim" test "", "tests/test_bigints_multimod.nim" test "", "tests/test_bigints_vs_gmp.nim" diff --git a/constantine/io/io_bigints.nim b/constantine/io/io_bigints.nim index bf0be99..a1f48d5 100644 --- a/constantine/io/io_bigints.nim +++ b/constantine/io/io_bigints.nim @@ -273,7 +273,7 @@ func hexToPaddedByteArray(hexStr: string, output: var openArray[byte], order: st let maxStrSize = output.len * 2 let size = hexStr.len - skip - nonBlanksCount - doAssert size <= maxStrSize + doAssert size <= maxStrSize, "size: " & $size & " (without blanks or prefix), maxSize: " & $maxStrSize if size < maxStrSize: # include extra byte if odd length @@ -330,6 +330,7 @@ func fromHex*(T: type BigInt, s: string): T = # 1. Convert to canonical uint const canonLen = (T.bits + 8 - 1) div 8 var bytes: array[canonLen, byte] + debugEcho "canonLen: ", canonLen hexToPaddedByteArray(s, bytes, littleEndian) # 2. Convert canonical uint to Big Int diff --git a/tests/test_io.nim b/tests/test_io_bigints.nim similarity index 100% rename from tests/test_io.nim rename to tests/test_io_bigints.nim