on JVM targets (but also in general) why do assert...
# test
e
on JVM targets (but also in general) why do assertEquals with NaN arguments pass? I'd expect
Copy code
kotlin.test.assertEquals(Double.NaN, Double.NaN, 1e-6)
to fail because
Double.NaN != Double.NaN
e
boxed, they're equal (
Map<Double, *>
would have issues otherwise) unboxed, they're unequal (as per IEEE 754)
ah you're already using the primitive overload with the tolerance value. well it seems that kotlin.test special-cases that behavior https://github.com/JetBrains/kotlin/blob/d520c37454e46f56e0af3013ae1da906bee40c6a/[…]braries/kotlin.test/common/src/main/kotlin/kotlin/test/Utils.kt
e
I'd argue that when using the tolerance values it should fail on NaNs since the tolerance only makes sense in numerical/computational contexts
The thing I got bitten by was when (arguably not so handy in hindsight) testing identities. Something along the lines of
assertEquals(a.distanceTo(c), b.distanceTo(c), 1e-6)