From 00144ee4e9857ad578597bed3f51176f252d6b13 Mon Sep 17 00:00:00 2001 From: Timothee Cour Date: Mon, 4 Jan 2021 10:45:46 -0800 Subject: fix #16576: honor matrix in testament by making such tests non joinable (#16577) * refs #16576: honor matrix in testament by making such tests non joinable * add tests + misc fixes * fix test for i386 with -d:danger --- tests/stdlib/tmath.nim | 10 ++++++---- tests/testament/t16576.nim | 7 +++++++ tests/testament/tjoinable.nim | 8 ++++++++ 3 files changed, 21 insertions(+), 4 deletions(-) create mode 100644 tests/testament/t16576.nim create mode 100644 tests/testament/tjoinable.nim (limited to 'tests') diff --git a/tests/stdlib/tmath.nim b/tests/stdlib/tmath.nim index 4176f70e8..16c274032 100644 --- a/tests/stdlib/tmath.nim +++ b/tests/stdlib/tmath.nim @@ -1,8 +1,10 @@ discard """ targets: "c cpp js" + matrix:"; -d:danger" """ -## xxx enable matrix:"; -d:nimTmathCase2 -d:danger --passc:-ffast-math" +# xxx: there should be a test with `-d:nimTmathCase2 -d:danger --passc:-ffast-math`, +# but it requires disabling certain lines with `when not defined(nimTmathCase2)` import std/[math, random, os] import std/[unittest] @@ -156,13 +158,13 @@ block: doAssert(erf(6.0) > erf(5.0)) doAssert(erfc(6.0) < erfc(5.0)) - - # Function for approximate comparison of floats proc `==~`(x, y: float): bool = (abs(x-y) < 1e-9) + # Function for approximate comparison of floats + # xxx use `almostEqual` block: # prod doAssert prod([1, 2, 3, 4]) == 24 - doAssert prod([1.5, 3.4]) == 5.1 + doAssert prod([1.5, 3.4]).almostEqual 5.1 let x: seq[float] = @[] doAssert prod(x) == 1.0 diff --git a/tests/testament/t16576.nim b/tests/testament/t16576.nim new file mode 100644 index 000000000..8d0dd57e3 --- /dev/null +++ b/tests/testament/t16576.nim @@ -0,0 +1,7 @@ +discard """ + matrix:"-d:nimTest_t16576" +""" + +# bug #16576 +doAssert defined(nimTest_t16576) +doAssert not defined(nimMegatest) diff --git a/tests/testament/tjoinable.nim b/tests/testament/tjoinable.nim new file mode 100644 index 000000000..7a0ad7985 --- /dev/null +++ b/tests/testament/tjoinable.nim @@ -0,0 +1,8 @@ +discard """ + output: "ok" +""" + +# checks that this is joinable +doAssert defined(testing) +doAssert defined(nimMegatest) +echo "ok" # intentional to make sure this doesn't prevent `isJoinableSpec` -- cgit 1.4.1-2-gfad0