Struct googletest::matchers::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 for NearMatcher<T>
impl<T: Debug + Float> Matcher 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) -> Description
fn describe(&self, matcher_result: MatcherResult) -> Description
Returns a description of
self
or a negative description if
matcher_result
is DoesNotMatch
. Read moresource§fn explain_match(&self, actual: &Self::ActualT) -> Description
fn explain_match(&self, actual: &Self::ActualT) -> Description
Auto Trait Implementations§
impl<T> RefUnwindSafe for NearMatcher<T>where
T: RefUnwindSafe,
impl<T> Send for NearMatcher<T>where
T: Send,
impl<T> Sync for NearMatcher<T>where
T: Sync,
impl<T> Unpin for NearMatcher<T>where
T: Unpin,
impl<T> UnwindSafe for NearMatcher<T>where
T: UnwindSafe,
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more