mirror of
https://github.com/nim-lang/Nim.git
synced 2026-05-02 03:54:44 +00:00
* refs #16576: honor matrix in testament by making such tests non joinable * add tests + misc fixes * fix test for i386 with -d:danger
This commit is contained in:
@@ -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
|
||||
|
||||
|
||||
Reference in New Issue
Block a user