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

#include <catch_matchers_floating.h>

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

Public Member Functions

 WithinUlpsMatcher (double target, int ulps, FloatingPointKind baseType)
 
bool match (double const &matchee) const override
 
std::string describe () const override
 
 WithinUlpsMatcher (double target, int ulps, FloatingPointKind baseType)
 
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 3057 of file catch.hpp.

Constructor & Destructor Documentation

◆ WithinUlpsMatcher() [1/2]

Catch::Matchers::Floating::WithinUlpsMatcher::WithinUlpsMatcher ( double target,
int ulps,
FloatingPointKind baseType )

Definition at line 100 of file catch_matchers_floating.cpp.

101 :m_target{ target }, m_ulps{ ulps }, m_type{ baseType } {
102 CATCH_ENFORCE(ulps >= 0, "Invalid ULP setting: " << ulps << '.'
103 << " ULPs have to be non-negative.");
104 }
#define CATCH_ENFORCE(condition, msg)

◆ WithinUlpsMatcher() [2/2]

Catch::Matchers::Floating::WithinUlpsMatcher::WithinUlpsMatcher ( double target,
int ulps,
FloatingPointKind baseType )

Member Function Documentation

◆ describe() [1/2]

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

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

Definition at line 127 of file catch_matchers_floating.cpp.

127 {
128 return "is within " + Catch::to_string(m_ulps) + " ULPs of " + ::Catch::Detail::stringify(m_target) + ((m_type == FloatingPointKind::Float)? "f" : "");
129 }
std::string stringify(const T &e)
std::string to_string(T const &t)
Here is the call graph for this function:

◆ describe() [2/2]

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

◆ match() [1/2]

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

Definition at line 112 of file catch_matchers_floating.cpp.

112 {
113 switch (m_type) {
115 return almostEqualUlps<float>(static_cast<float>(matchee), static_cast<float>(m_target), m_ulps);
117 return almostEqualUlps<double>(matchee, m_target, m_ulps);
118 default:
119 CATCH_INTERNAL_ERROR( "Unknown FloatingPointKind value" );
120 }
121 }
#define CATCH_INTERNAL_ERROR(msg)

◆ match() [2/2]

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

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