rename io tests ti io bigints
This commit is contained in:
parent
23ecb9a221
commit
5620bbfaee
|
@ -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"
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue