Scalactic User Guide Custom equality Default equality Constrained equality Tolerance Normalization The Explicitly DSL Or and Every Requirements Snapshots TimesOnInt |
Default equality
Scalactic defines a default Here are some examples showing the special treatment of arrays: scala> import org.scalactic._ import org.scalactic._ scala> import TripleEquals._ import TripleEquals._ scala> Array(1, 2, 3) == Array(1, 2, 3) res0: Boolean = false scala> Array(1, 2, 3) === Array(1, 2, 3) res1: Boolean = true scala> Array(1, 2, 3) == List(1, 2, 3) <console>:14: warning: comparing values of types Array[Int] and List[Int] using `==' will always yield false Array(1, 2, 3) == List(1, 2, 3) ^ res2: Boolean = false scala> Array(1, 2, 3) === List(1, 2, 3) res3: Boolean = true scala> List(1, 2, 3) == Array(1, 2, 3) res4: Boolean = false scala> List(1, 2, 3) === Array(1, 2, 3) res5: Boolean = true
You can obtain a default equality via the Next, learn about Constrained equality. |
Scalactic is brought to you by Bill Venners, with
contributions from several other folks. It is sponsored by
Artima, Inc.
ScalaTest is free, open-source software
released under the Apache
2.0 license.
Copyright © 2009-2024 Artima, Inc. All Rights Reserved.