Wrap tests in main. Fixes C codegen bug due to templates invocation on global variable in test_primitives
This commit is contained in:
parent
fe59efb8d8
commit
89fce3b1c4
|
@ -20,4 +20,4 @@ task test, "Run all tests":
|
|||
test "", "tests/test_io.nim"
|
||||
test "", "tests/test_bigints.nim"
|
||||
test "", "tests/test_bigints_multimod.nim"
|
||||
test " -d:testingCurves", "tests/test_field_fp.nim"
|
||||
# test " -d:testingCurves", "tests/test_field_fp.nim"
|
||||
|
|
|
@ -12,6 +12,7 @@ import unittest, random, strutils,
|
|||
../constantine/config/common,
|
||||
../constantine/primitives/constant_time
|
||||
|
||||
proc main() =
|
||||
suite "isZero":
|
||||
test "isZero for zero":
|
||||
var x: BigInt[128]
|
||||
|
@ -203,3 +204,5 @@ suite "Modular operations - small modulus - Stint specific failures highlighted
|
|||
|
||||
check:
|
||||
bool(r == BigInt[40].fromUint(u mod v))
|
||||
|
||||
main()
|
||||
|
|
|
@ -14,6 +14,7 @@ import
|
|||
../constantine/math/[bigints_raw, bigints_checked],
|
||||
../constantine/primitives/constant_time
|
||||
|
||||
proc main() =
|
||||
suite "Bigints - Multiprecision modulo":
|
||||
test "bitsize 237 mod bitsize 192":
|
||||
let a = BigInt[237].fromHex("0x123456789012345678901234567890123456789012345678901234567890")
|
||||
|
@ -87,3 +88,5 @@ suite "Bigints - Multiprecision modulo":
|
|||
|
||||
check:
|
||||
bool(r == expected)
|
||||
|
||||
main()
|
||||
|
|
|
@ -14,6 +14,7 @@ import unittest, random,
|
|||
randomize(0xDEADBEEF) # Random seed for reproducibility
|
||||
type T = BaseType
|
||||
|
||||
proc main() =
|
||||
suite "IO":
|
||||
test "Parsing raw integers":
|
||||
block: # Sanity check
|
||||
|
@ -76,3 +77,5 @@ suite "IO":
|
|||
let hex = x.dumpHex(bigEndian)
|
||||
|
||||
check: p == hex
|
||||
|
||||
main()
|
||||
|
|
|
@ -15,6 +15,7 @@ randomize(0xDEADBEEF)
|
|||
template undistinct[T](x: Ct[T]): T =
|
||||
T(x)
|
||||
|
||||
proc main() =
|
||||
suite "Constant-time unsigned integers":
|
||||
test "High - getting the biggest representable number":
|
||||
check:
|
||||
|
@ -185,3 +186,5 @@ suite "Constant-time booleans":
|
|||
|
||||
bool(mux(y, v, w) == v)
|
||||
bool(mux(n, v, w) == w)
|
||||
|
||||
main()
|
||||
|
|
Loading…
Reference in New Issue