diff --git a/tests/test_io.nim b/tests/test_io.nim index 612d090..687f035 100644 --- a/tests/test_io.nim +++ b/tests/test_io.nim @@ -121,7 +121,7 @@ template chkDumpHexStint(chk: untyped, BE, LE: string, bits: int) = chk dumpHex(x, bigEndian) == data chk dumpHex(x, littleEndian) == LE -template testIO(chk, tst, handleErr: untyped) = +template testIO1(chk, tst, handleErr: untyped) = tst "[stuint] Creation from native ints": nativeStuint(chk, 0, 64) nativeStuint(chk, 0'u8, 64) @@ -452,6 +452,7 @@ template testIO(chk, tst, handleErr: untyped) = handleErr OverflowDefect: chkTruncateStint(chk, low(int64), uint64, "0x8000000000000000", 128) +template testIO2(chk, tst, handleErr: untyped) = tst "[stuint] parse - toString roundtrip": chkRoundTripBin(chk, chkRoundTripStuint, 64, 1) chkRoundTripBin(chk, chkRoundTripStuint, 64, 2) @@ -725,13 +726,24 @@ template testIO(chk, tst, handleErr: untyped) = chkDumpHexStint(chk, "abcdef0012345678abcdef1122334455", "5544332211efcdab7856341200efcdab", 128) static: - testIO(ctCheck, ctTest, ctExpect) + testIO1(ctCheck, ctTest, ctExpect) + testIO2(ctCheck, ctTest, ctExpect) +const + # TODO: This condition causing crash + crash_condition = NimMajor >= 2 and + not defined(release) and + defined(cpp) and + defined(nimRawSetJmp) + proc main() = # Nim GC protests we are using too much global variables # so put it in a proc suite "Testing input and output procedures": - testIO(check, test, expect) + testIO1(check, test, expect) + + when not crash_condition: + testIO2(check, test, expect) test "toByteArrayBE CT vs RT": chkCTvsRT(check, 0xab'u64, 64)