Wire Sysio Wire Sysion 1.0.0
Loading...
Searching...
No Matches
Catch::Matchers::Floating::WithinAbsMatcher Struct Reference

#include <catch_matchers_floating.h>

Inheritance diagram for Catch::Matchers::Floating::WithinAbsMatcher:
Collaboration diagram for Catch::Matchers::Floating::WithinAbsMatcher:

Public Member Functions

 WithinAbsMatcher (double target, double margin)
 
bool match (double const &matchee) const override
 
std::string describe () const override
 
 WithinAbsMatcher (double target, double margin)
 
bool match (double const &matchee) const override
 
std::string describe () const override
 
- Public Member Functions inherited from Catch::Matchers::Impl::MatcherBase< T >
MatchAllOf< Toperator&& (MatcherBase const &other) const
 
MatchAnyOf< Toperator|| (MatcherBase const &other) const
 
MatchNotOf< Toperator! () const
 
MatchAllOf< Toperator&& (MatcherBase const &other) const
 
MatchAnyOf< Toperator|| (MatcherBase const &other) const
 
MatchNotOf< Toperator! () const
 
- Public Member Functions inherited from Catch::Matchers::Impl::MatcherUntypedBase
 MatcherUntypedBase ()=default
 
 MatcherUntypedBase (MatcherUntypedBase const &)=default
 
MatcherUntypedBaseoperator= (MatcherUntypedBase const &)=delete
 
std::string toString () const
 
 MatcherUntypedBase ()=default
 
 MatcherUntypedBase (MatcherUntypedBase const &)=default
 
MatcherUntypedBaseoperator= (MatcherUntypedBase const &)=delete
 
std::string toString () const
 
- Public Member Functions inherited from Catch::Matchers::Impl::MatcherMethod< T >
virtual bool match (T const &arg) const=0
 
virtual bool match (T const &arg) const=0
 

Additional Inherited Members

- Protected Member Functions inherited from Catch::Matchers::Impl::MatcherUntypedBase
virtual ~MatcherUntypedBase ()
 
virtual ~MatcherUntypedBase ()
 
- Protected Attributes inherited from Catch::Matchers::Impl::MatcherUntypedBase
std::string m_cachedToString
 

Detailed Description

Definition at line 3048 of file catch.hpp.

Constructor & Destructor Documentation

◆ WithinAbsMatcher() [1/2]

Catch::Matchers::Floating::WithinAbsMatcher::WithinAbsMatcher ( double target,
double margin )

Definition at line 83 of file catch_matchers_floating.cpp.

84 :m_target{ target }, m_margin{ margin } {
85 CATCH_ENFORCE(margin >= 0, "Invalid margin: " << margin << '.'
86 << " Margin has to be non-negative.");
87 }
#define CATCH_ENFORCE(condition, msg)

◆ WithinAbsMatcher() [2/2]

Catch::Matchers::Floating::WithinAbsMatcher::WithinAbsMatcher ( double target,
double margin )

Member Function Documentation

◆ describe() [1/2]

std::string Catch::Matchers::Floating::WithinAbsMatcher::describe ( ) const
overridevirtual

Implements Catch::Matchers::Impl::MatcherUntypedBase.

Definition at line 95 of file catch_matchers_floating.cpp.

95 {
96 return "is within " + ::Catch::Detail::stringify(m_margin) + " of " + ::Catch::Detail::stringify(m_target);
97 }
std::string stringify(const T &e)
Here is the call graph for this function:

◆ describe() [2/2]

std::string Catch::Matchers::Floating::WithinAbsMatcher::describe ( ) const
overridevirtual

◆ match() [1/2]

bool Catch::Matchers::Floating::WithinAbsMatcher::match ( double const & matchee) const
override

Definition at line 91 of file catch_matchers_floating.cpp.

91 {
92 return (matchee + m_margin >= m_target) && (m_target + m_margin >= matchee);
93 }

◆ match() [2/2]

bool Catch::Matchers::Floating::WithinAbsMatcher::match ( double const & matchee) const
override

The documentation for this struct was generated from the following files: