Wire Sysio Wire Sysion 1.0.0
Loading...
Searching...
No Matches
Catch::Detail::Approx Class Reference

#include <catch_approx.h>

Public Member Functions

 Approx (double value)
 
Approx operator- () const
 
template<typename T , typename = typename std::enable_if<std::is_constructible<double, T>::value>::type>
Approx operator() (T const &value)
 
template<typename T , typename = typename std::enable_if<std::is_constructible<double, T>::value>::type>
 Approx (T const &value)
 
template<typename T , typename = typename std::enable_if<std::is_constructible<double, T>::value>::type>
Approxepsilon (T const &newEpsilon)
 
template<typename T , typename = typename std::enable_if<std::is_constructible<double, T>::value>::type>
Approxmargin (T const &newMargin)
 
template<typename T , typename = typename std::enable_if<std::is_constructible<double, T>::value>::type>
Approxscale (T const &newScale)
 
std::string toString () const
 
 Approx (double value)
 
Approx operator- () const
 
template<typename T , typename = typename std::enable_if<std::is_constructible<double, T>::value>::type>
Approx operator() (T const &value)
 
template<typename T , typename = typename std::enable_if<std::is_constructible<double, T>::value>::type>
 Approx (T const &value)
 
template<typename T , typename = typename std::enable_if<std::is_constructible<double, T>::value>::type>
Approxepsilon (T const &newEpsilon)
 
template<typename T , typename = typename std::enable_if<std::is_constructible<double, T>::value>::type>
Approxmargin (T const &newMargin)
 
template<typename T , typename = typename std::enable_if<std::is_constructible<double, T>::value>::type>
Approxscale (T const &newScale)
 
std::string toString () const
 

Static Public Member Functions

static Approx custom ()
 
static Approx custom ()
 

Friends

template<typename T , typename = typename std::enable_if<std::is_constructible<double, T>::value>::type>
bool operator== (const T &lhs, Approx const &rhs)
 
template<typename T , typename = typename std::enable_if<std::is_constructible<double, T>::value>::type>
bool operator== (Approx const &lhs, const T &rhs)
 
template<typename T , typename = typename std::enable_if<std::is_constructible<double, T>::value>::type>
bool operator!= (T const &lhs, Approx const &rhs)
 
template<typename T , typename = typename std::enable_if<std::is_constructible<double, T>::value>::type>
bool operator!= (Approx const &lhs, T const &rhs)
 
template<typename T , typename = typename std::enable_if<std::is_constructible<double, T>::value>::type>
bool operator<= (T const &lhs, Approx const &rhs)
 
template<typename T , typename = typename std::enable_if<std::is_constructible<double, T>::value>::type>
bool operator<= (Approx const &lhs, T const &rhs)
 
template<typename T , typename = typename std::enable_if<std::is_constructible<double, T>::value>::type>
bool operator>= (T const &lhs, Approx const &rhs)
 
template<typename T , typename = typename std::enable_if<std::is_constructible<double, T>::value>::type>
bool operator>= (Approx const &lhs, T const &rhs)
 
template<typename T , typename = typename std::enable_if<std::is_constructible<double, T>::value>::type>
bool operator== (const T &lhs, Approx const &rhs)
 
template<typename T , typename = typename std::enable_if<std::is_constructible<double, T>::value>::type>
bool operator== (Approx const &lhs, const T &rhs)
 
template<typename T , typename = typename std::enable_if<std::is_constructible<double, T>::value>::type>
bool operator!= (T const &lhs, Approx const &rhs)
 
template<typename T , typename = typename std::enable_if<std::is_constructible<double, T>::value>::type>
bool operator!= (Approx const &lhs, T const &rhs)
 
template<typename T , typename = typename std::enable_if<std::is_constructible<double, T>::value>::type>
bool operator<= (T const &lhs, Approx const &rhs)
 
template<typename T , typename = typename std::enable_if<std::is_constructible<double, T>::value>::type>
bool operator<= (Approx const &lhs, T const &rhs)
 
template<typename T , typename = typename std::enable_if<std::is_constructible<double, T>::value>::type>
bool operator>= (T const &lhs, Approx const &rhs)
 
template<typename T , typename = typename std::enable_if<std::is_constructible<double, T>::value>::type>
bool operator>= (Approx const &lhs, T const &rhs)
 

Detailed Description

Definition at line 2739 of file catch.hpp.

Constructor & Destructor Documentation

◆ Approx() [1/4]

Catch::Detail::Approx::Approx ( double value)
explicit

Definition at line 28 of file catch_approx.cpp.

29 : m_epsilon( std::numeric_limits<float>::epsilon()*100 ),
30 m_margin( 0.0 ),
31 m_scale( 0.0 ),
32 m_value( value )
33 {}
#define value
Definition pkcs11.h:157
Here is the caller graph for this function:

◆ Approx() [2/4]

template<typename T , typename = typename std::enable_if<std::is_constructible<double, T>::value>::type>
Catch::Detail::Approx::Approx ( T const & value)
inlineexplicit

Definition at line 45 of file catch_approx.h.

45 : Approx(static_cast<double>(value))
46 {}

◆ Approx() [3/4]

Catch::Detail::Approx::Approx ( double value)
explicit

◆ Approx() [4/4]

template<typename T , typename = typename std::enable_if<std::is_constructible<double, T>::value>::type>
Catch::Detail::Approx::Approx ( T const & value)
inlineexplicit

Definition at line 2766 of file catch.hpp.

2766 : Approx(static_cast<double>(value))
2767 {}

Member Function Documentation

◆ custom() [1/2]

Approx Catch::Detail::Approx::custom ( )
static

Definition at line 35 of file catch_approx.cpp.

35 {
36 return Approx( 0 );
37 }
Here is the call graph for this function:

◆ custom() [2/2]

static Approx Catch::Detail::Approx::custom ( )
static

◆ epsilon() [1/2]

template<typename T , typename = typename std::enable_if<std::is_constructible<double, T>::value>::type>
Approx & Catch::Detail::Approx::epsilon ( T const & newEpsilon)
inline

Definition at line 91 of file catch_approx.h.

91 {
92 double epsilonAsDouble = static_cast<double>(newEpsilon);
93 setEpsilon(epsilonAsDouble);
94 return *this;
95 }
Here is the caller graph for this function:

◆ epsilon() [2/2]

template<typename T , typename = typename std::enable_if<std::is_constructible<double, T>::value>::type>
Approx & Catch::Detail::Approx::epsilon ( T const & newEpsilon)
inline

Definition at line 2811 of file catch.hpp.

2811 {
2812 double epsilonAsDouble = static_cast<double>(newEpsilon);
2813 setEpsilon(epsilonAsDouble);
2814 return *this;
2815 }

◆ margin() [1/2]

template<typename T , typename = typename std::enable_if<std::is_constructible<double, T>::value>::type>
Approx & Catch::Detail::Approx::margin ( T const & newMargin)
inline

Definition at line 98 of file catch_approx.h.

98 {
99 double marginAsDouble = static_cast<double>(newMargin);
100 setMargin(marginAsDouble);
101 return *this;
102 }
Here is the caller graph for this function:

◆ margin() [2/2]

template<typename T , typename = typename std::enable_if<std::is_constructible<double, T>::value>::type>
Approx & Catch::Detail::Approx::margin ( T const & newMargin)
inline

Definition at line 2818 of file catch.hpp.

2818 {
2819 double marginAsDouble = static_cast<double>(newMargin);
2820 setMargin(marginAsDouble);
2821 return *this;
2822 }

◆ operator()() [1/2]

template<typename T , typename = typename std::enable_if<std::is_constructible<double, T>::value>::type>
Approx Catch::Detail::Approx::operator() ( T const & value)
inline

Definition at line 36 of file catch_approx.h.

36 {
37 Approx approx( static_cast<double>(value) );
38 approx.m_epsilon = m_epsilon;
39 approx.m_margin = m_margin;
40 approx.m_scale = m_scale;
41 return approx;
42 }

◆ operator()() [2/2]

template<typename T , typename = typename std::enable_if<std::is_constructible<double, T>::value>::type>
Approx Catch::Detail::Approx::operator() ( T const & value)
inline

Definition at line 2757 of file catch.hpp.

2757 {
2758 Approx approx( static_cast<double>(value) );
2759 approx.m_epsilon = m_epsilon;
2760 approx.m_margin = m_margin;
2761 approx.m_scale = m_scale;
2762 return approx;
2763 }

◆ operator-() [1/2]

Approx Catch::Detail::Approx::operator- ( ) const

Definition at line 39 of file catch_approx.cpp.

39 {
40 auto temp(*this);
41 temp.m_value = -temp.m_value;
42 return temp;
43 }

◆ operator-() [2/2]

Approx Catch::Detail::Approx::operator- ( ) const

◆ scale() [1/2]

template<typename T , typename = typename std::enable_if<std::is_constructible<double, T>::value>::type>
Approx & Catch::Detail::Approx::scale ( T const & newScale)
inline

Definition at line 105 of file catch_approx.h.

105 {
106 m_scale = static_cast<double>(newScale);
107 return *this;
108 }
Here is the caller graph for this function:

◆ scale() [2/2]

template<typename T , typename = typename std::enable_if<std::is_constructible<double, T>::value>::type>
Approx & Catch::Detail::Approx::scale ( T const & newScale)
inline

Definition at line 2825 of file catch.hpp.

2825 {
2826 m_scale = static_cast<double>(newScale);
2827 return *this;
2828 }

◆ toString() [1/2]

std::string Catch::Detail::Approx::toString ( ) const

Definition at line 46 of file catch_approx.cpp.

46 {
47 ReusableStringStream rss;
48 rss << "Approx( " << ::Catch::Detail::stringify( m_value ) << " )";
49 return rss.str();
50 }
std::string stringify(const T &e)
Here is the call graph for this function:

◆ toString() [2/2]

std::string Catch::Detail::Approx::toString ( ) const

Friends And Related Symbol Documentation

◆ operator!= [1/4]

template<typename T , typename = typename std::enable_if<std::is_constructible<double, T>::value>::type>
bool operator!= ( Approx const & lhs,
T const & rhs )
friend

Definition at line 66 of file catch_approx.h.

66 {
67 return !operator==( rhs, lhs );
68 }
friend bool operator==(const T &lhs, Approx const &rhs)

◆ operator!= [2/4]

template<typename T , typename = typename std::enable_if<std::is_constructible<double, T>::value>::type>
bool operator!= ( Approx const & lhs,
T const & rhs )
friend

Definition at line 2786 of file catch.hpp.

2786 {
2787 return !operator==( rhs, lhs );
2788 }

◆ operator!= [3/4]

template<typename T , typename = typename std::enable_if<std::is_constructible<double, T>::value>::type>
bool operator!= ( T const & lhs,
Approx const & rhs )
friend

Definition at line 61 of file catch_approx.h.

61 {
62 return !operator==( lhs, rhs );
63 }

◆ operator!= [4/4]

template<typename T , typename = typename std::enable_if<std::is_constructible<double, T>::value>::type>
bool operator!= ( T const & lhs,
Approx const & rhs )
friend

Definition at line 2781 of file catch.hpp.

2781 {
2782 return !operator==( lhs, rhs );
2783 }

◆ operator<= [1/4]

template<typename T , typename = typename std::enable_if<std::is_constructible<double, T>::value>::type>
bool operator<= ( Approx const & lhs,
T const & rhs )
friend

Definition at line 76 of file catch_approx.h.

76 {
77 return lhs.m_value < static_cast<double>(rhs) || lhs == rhs;
78 }

◆ operator<= [2/4]

template<typename T , typename = typename std::enable_if<std::is_constructible<double, T>::value>::type>
bool operator<= ( Approx const & lhs,
T const & rhs )
friend

Definition at line 2796 of file catch.hpp.

2796 {
2797 return lhs.m_value < static_cast<double>(rhs) || lhs == rhs;
2798 }

◆ operator<= [3/4]

template<typename T , typename = typename std::enable_if<std::is_constructible<double, T>::value>::type>
bool operator<= ( T const & lhs,
Approx const & rhs )
friend

Definition at line 71 of file catch_approx.h.

71 {
72 return static_cast<double>(lhs) < rhs.m_value || lhs == rhs;
73 }

◆ operator<= [4/4]

template<typename T , typename = typename std::enable_if<std::is_constructible<double, T>::value>::type>
bool operator<= ( T const & lhs,
Approx const & rhs )
friend

Definition at line 2791 of file catch.hpp.

2791 {
2792 return static_cast<double>(lhs) < rhs.m_value || lhs == rhs;
2793 }

◆ operator== [1/4]

template<typename T , typename = typename std::enable_if<std::is_constructible<double, T>::value>::type>
bool operator== ( Approx const & lhs,
const T & rhs )
friend

Definition at line 56 of file catch_approx.h.

56 {
57 return operator==( rhs, lhs );
58 }

◆ operator== [2/4]

template<typename T , typename = typename std::enable_if<std::is_constructible<double, T>::value>::type>
bool operator== ( Approx const & lhs,
const T & rhs )
friend

Definition at line 2776 of file catch.hpp.

2776 {
2777 return operator==( rhs, lhs );
2778 }

◆ operator== [3/4]

template<typename T , typename = typename std::enable_if<std::is_constructible<double, T>::value>::type>
bool operator== ( const T & lhs,
Approx const & rhs )
friend

Definition at line 50 of file catch_approx.h.

50 {
51 auto lhs_v = static_cast<double>(lhs);
52 return rhs.equalityComparisonImpl(lhs_v);
53 }

◆ operator== [4/4]

template<typename T , typename = typename std::enable_if<std::is_constructible<double, T>::value>::type>
bool operator== ( const T & lhs,
Approx const & rhs )
friend

Definition at line 2770 of file catch.hpp.

2770 {
2771 auto lhs_v = static_cast<double>(lhs);
2772 return rhs.equalityComparisonImpl(lhs_v);
2773 }

◆ operator>= [1/4]

template<typename T , typename = typename std::enable_if<std::is_constructible<double, T>::value>::type>
bool operator>= ( Approx const & lhs,
T const & rhs )
friend

Definition at line 86 of file catch_approx.h.

86 {
87 return lhs.m_value > static_cast<double>(rhs) || lhs == rhs;
88 }

◆ operator>= [2/4]

template<typename T , typename = typename std::enable_if<std::is_constructible<double, T>::value>::type>
bool operator>= ( Approx const & lhs,
T const & rhs )
friend

Definition at line 2806 of file catch.hpp.

2806 {
2807 return lhs.m_value > static_cast<double>(rhs) || lhs == rhs;
2808 }

◆ operator>= [3/4]

template<typename T , typename = typename std::enable_if<std::is_constructible<double, T>::value>::type>
bool operator>= ( T const & lhs,
Approx const & rhs )
friend

Definition at line 81 of file catch_approx.h.

81 {
82 return static_cast<double>(lhs) > rhs.m_value || lhs == rhs;
83 }

◆ operator>= [4/4]

template<typename T , typename = typename std::enable_if<std::is_constructible<double, T>::value>::type>
bool operator>= ( T const & lhs,
Approx const & rhs )
friend

Definition at line 2801 of file catch.hpp.

2801 {
2802 return static_cast<double>(lhs) > rhs.m_value || lhs == rhs;
2803 }

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