Struct googletest::matchers::near_matcher::NearMatcher
source · pub struct NearMatcher<T: Debug> { /* private fields */ }Expand description
A matcher which matches floating-point numbers approximately equal to its expected value.
Implementations§
source§impl<T: Debug> NearMatcher<T>
impl<T: Debug> NearMatcher<T>
sourcepub fn nans_are_equal(self) -> Self
pub fn nans_are_equal(self) -> Self
Configures this instance to treat two NaNs as equal.
This behaviour differs from the IEEE standad for floating point which treats two NaNs as infinitely far apart.
sourcepub fn nans_are_not_equal(self) -> Self
pub fn nans_are_not_equal(self) -> Self
Configures this instance to treat two NaNs as not equal.
This behaviour complies with the IEEE standad for floating point. It is the default behaviour for this matcher, so invoking this method is usually redunant.
Trait Implementations§
source§impl<T: Debug + Float> Matcher<T> for NearMatcher<T>
impl<T: Debug + Float> Matcher<T> for NearMatcher<T>
source§fn matches(&self, actual: &T) -> MatcherResult
fn matches(&self, actual: &T) -> MatcherResult
Returns whether the condition matches the datum
actual. Read moresource§fn describe(&self, matcher_result: MatcherResult) -> String
fn describe(&self, matcher_result: MatcherResult) -> String
Returns a description of
self or a negative description if
matcher_result is DoesNotMatch. Read moresource§fn explain_match(&self, actual: &T) -> MatchExplanation
fn explain_match(&self, actual: &T) -> MatchExplanation
Prepares a
MatchExplanation describing how the expected value
encoded in this instance matches or does not match the given value
actual. Read more