我遇到了失败的测试,在我所有的理解中应该通过。我在这里遗漏了一些明显的东西吗?
import org.scalatest._
class xxxTests extends FlatSpec with ShouldMatchers {
import math.{Pi => PI}
"" should "(this should pass)" in {
assert( 0.0 === 0.0 ) // ok
(1e-100) should equal ((0.0) plusOrMinus 1e-5) // FAILS!!! "1.0E-100 did not equal DoubleTolerance(0.0,1.0E-5)"
(1e-3) should not equal ((0.0) plusOrMinus 1e-5) // ok
(0.0) should equal ((0.0) plusOrMinus 1e-5) // FAILS!!! "0.0 did not equal DoubleTolerance(0.0,1.0E-5)"
}
}
我在 Scalatest 1.8 和 2.0M4 都经历过这种情况。