Indicates whether the objects passed as a
and b
are equal.
Indicates whether the objects passed as a
and b
are equal.
a left-hand-side object being compared with another (right-hand-side one) for equality (e.g., a == b
)
a right-hand-side object being compared with another (left-hand-side one) for equality (e.g., a == b
)
true if the passed objects are "equal," as defined by this Equality
instance
Defines a custom way to determine equality for a type.
For example, here's how you could define equality between
Double
s such that a tolerance of ± 0.01 is allowed:If an implicit instance of
TolerantDoubleEquality
is in scope, it will be used by ScalaTest's===
operators and itsshould equal
andshould ===
matcher syntax. Here's an example:Note: The
Equality
type class was inspired in part by theEqual
type class of thescalaz
project.the type whose equality is being customized