Determine whether a numeric object is outside the passed Spread
, returning an Option[String]
.
Determine whether a numeric object is outside the passed Spread
, returning an Option[String]
.
the Spread
against which to compare the value passed to the constructor as left
true if the value passed to the constructor as left
is not within the Spread
passed to this method.
else returns an error message string wrapped in a Some
.
Compare two objects for inequality, returning an Option[String]
, using the Equality
type class passed as equality
.
Compare two objects for inequality, returning an Option[String]
, using the Equality
type class passed as equality
.
the object to compare for inequality with left
, passed to the constructor
an implicit Equality
type class that defines a way of calculating equality for objects of type L
None if the left
and right
objects are not equal according to the passed Equality
type class.
else returns an error message string wrapped in a Some
.
Determine whether a numeric object is within the passed Spread
, returning an Option[String]
.
Determine whether a numeric object is within the passed Spread
, returning an Option[String]
.
the Spread
against which to compare the value passed to the constructor as left
None if the value passed to the constructor as left
is not within the Spread
passed to this method,
else returns an error message string wrapped in a Some
.
Compare two objects for equality, returning an Option[String]
, using the Equality
type class passed as equality
.
Compare two objects for equality, returning an Option[String]
, using the Equality
type class passed as equality
.
the object to compare for equality with left
, passed to the constructor
an implicit Equality
type class that defines a way of calculating equality for objects of type L
None if the left
and right
objects are equal according to the passed Equality
type class.
else returns an error message string wrapped in a Some
.
Class used via an implicit conversion to enable any two objects to be compared with
===
and!==
with anOption[String]
result and no enforced type constraint between two object types. For example:You can also check numeric values against another with a tolerance. Here are some examples:
The benefit of using
assert(a === b)
rather thanassert(a == b)
in ScalaTest code is that aTestFailedException
produced by the former will include the values ofa
andb
in its detail message.Note: This class has "Legacy" in its name because its approach to error messages will eventually be replaced by macros. Once ScalaTest no longer supports Scala 2.9, this class will be deprecated in favor of class
Equalizer
. Instead of obtaining nice error messages via theOption[String]
returned by the methods of this class, the error messages will be obtained by a macro. The "legacy" approach to good error messages will continue to be used, however, until ScalaTest no longer supports Scala 2.9, since macros were introduced to Scala (in experimental form) in 2.10.The primary constructor takes one object,
left
, whose type is being converted toEqualizer
. Theleft
value may be anull
reference, because this is allowed by Scala's==
operator.