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_io.nim"
|
||||||
test "", "tests/test_bigints.nim"
|
test "", "tests/test_bigints.nim"
|
||||||
test "", "tests/test_bigints_multimod.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/config/common,
|
||||||
../constantine/primitives/constant_time
|
../constantine/primitives/constant_time
|
||||||
|
|
||||||
|
proc main() =
|
||||||
suite "isZero":
|
suite "isZero":
|
||||||
test "isZero for zero":
|
test "isZero for zero":
|
||||||
var x: BigInt[128]
|
var x: BigInt[128]
|
||||||
|
@ -203,3 +204,5 @@ suite "Modular operations - small modulus - Stint specific failures highlighted
|
||||||
|
|
||||||
check:
|
check:
|
||||||
bool(r == BigInt[40].fromUint(u mod v))
|
bool(r == BigInt[40].fromUint(u mod v))
|
||||||
|
|
||||||
|
main()
|
||||||
|
|
|
@ -14,6 +14,7 @@ import
|
||||||
../constantine/math/[bigints_raw, bigints_checked],
|
../constantine/math/[bigints_raw, bigints_checked],
|
||||||
../constantine/primitives/constant_time
|
../constantine/primitives/constant_time
|
||||||
|
|
||||||
|
proc main() =
|
||||||
suite "Bigints - Multiprecision modulo":
|
suite "Bigints - Multiprecision modulo":
|
||||||
test "bitsize 237 mod bitsize 192":
|
test "bitsize 237 mod bitsize 192":
|
||||||
let a = BigInt[237].fromHex("0x123456789012345678901234567890123456789012345678901234567890")
|
let a = BigInt[237].fromHex("0x123456789012345678901234567890123456789012345678901234567890")
|
||||||
|
@ -87,3 +88,5 @@ suite "Bigints - Multiprecision modulo":
|
||||||
|
|
||||||
check:
|
check:
|
||||||
bool(r == expected)
|
bool(r == expected)
|
||||||
|
|
||||||
|
main()
|
||||||
|
|
|
@ -14,6 +14,7 @@ import unittest, random,
|
||||||
randomize(0xDEADBEEF) # Random seed for reproducibility
|
randomize(0xDEADBEEF) # Random seed for reproducibility
|
||||||
type T = BaseType
|
type T = BaseType
|
||||||
|
|
||||||
|
proc main() =
|
||||||
suite "IO":
|
suite "IO":
|
||||||
test "Parsing raw integers":
|
test "Parsing raw integers":
|
||||||
block: # Sanity check
|
block: # Sanity check
|
||||||
|
@ -76,3 +77,5 @@ suite "IO":
|
||||||
let hex = x.dumpHex(bigEndian)
|
let hex = x.dumpHex(bigEndian)
|
||||||
|
|
||||||
check: p == hex
|
check: p == hex
|
||||||
|
|
||||||
|
main()
|
||||||
|
|
|
@ -15,6 +15,7 @@ randomize(0xDEADBEEF)
|
||||||
template undistinct[T](x: Ct[T]): T =
|
template undistinct[T](x: Ct[T]): T =
|
||||||
T(x)
|
T(x)
|
||||||
|
|
||||||
|
proc main() =
|
||||||
suite "Constant-time unsigned integers":
|
suite "Constant-time unsigned integers":
|
||||||
test "High - getting the biggest representable number":
|
test "High - getting the biggest representable number":
|
||||||
check:
|
check:
|
||||||
|
@ -185,3 +186,5 @@ suite "Constant-time booleans":
|
||||||
|
|
||||||
bool(mux(y, v, w) == v)
|
bool(mux(y, v, w) == v)
|
||||||
bool(mux(n, v, w) == w)
|
bool(mux(n, v, w) == w)
|
||||||
|
|
||||||
|
main()
|
||||||
|
|
Loading…
Reference in New Issue