8#ifndef TWOBLUECUBES_CATCH_APPROX_HPP_INCLUDED
9#define TWOBLUECUBES_CATCH_APPROX_HPP_INCLUDED
20 bool equalityComparisonImpl(
double other)
const;
23 void setMargin(
double margin);
26 void setEpsilon(
double epsilon);
35 template <typename T, typename = typename std::enable_if<std::is_constructible<double, T>::value>::type>
38 approx.m_epsilon = m_epsilon;
39 approx.m_margin = m_margin;
40 approx.m_scale = m_scale;
44 template <typename T, typename = typename std::enable_if<std::is_constructible<double, T>::value>::type>
49 template <typename T, typename = typename std::enable_if<std::is_constructible<double, T>::value>::type>
51 auto lhs_v =
static_cast<double>(lhs);
52 return rhs.equalityComparisonImpl(lhs_v);
55 template <typename T, typename = typename std::enable_if<std::is_constructible<double, T>::value>::type>
60 template <typename T, typename = typename std::enable_if<std::is_constructible<double, T>::value>::type>
65 template <typename T, typename = typename std::enable_if<std::is_constructible<double, T>::value>::type>
70 template <typename T, typename = typename std::enable_if<std::is_constructible<double, T>::value>::type>
72 return static_cast<double>(lhs) < rhs.m_value || lhs == rhs;
75 template <typename T, typename = typename std::enable_if<std::is_constructible<double, T>::value>::type>
77 return lhs.m_value <
static_cast<double>(rhs) || lhs == rhs;
80 template <typename T, typename = typename std::enable_if<std::is_constructible<double, T>::value>::type>
82 return static_cast<double>(lhs) > rhs.m_value || lhs == rhs;
85 template <typename T, typename = typename std::enable_if<std::is_constructible<double, T>::value>::type>
87 return lhs.m_value >
static_cast<double>(rhs) || lhs == rhs;
90 template <typename T, typename = typename std::enable_if<std::is_constructible<double, T>::value>::type>
92 double epsilonAsDouble =
static_cast<double>(newEpsilon);
93 setEpsilon(epsilonAsDouble);
97 template <typename T, typename = typename std::enable_if<std::is_constructible<double, T>::value>::type>
99 double marginAsDouble =
static_cast<double>(newMargin);
100 setMargin(marginAsDouble);
104 template <typename T, typename = typename std::enable_if<std::is_constructible<double, T>::value>::type>
106 m_scale =
static_cast<double>(newScale);
121 Detail::Approx
operator "" _a(
long double val);
122 Detail::Approx
operator "" _a(
unsigned long long val);
126struct StringMaker<
Catch::Detail::Approx> {
friend bool operator<=(T const &lhs, Approx const &rhs)
Approx & epsilon(T const &newEpsilon)
friend bool operator!=(T const &lhs, Approx const &rhs)
Approx & margin(T const &newMargin)
Approx & scale(T const &newScale)
std::string toString() const
friend bool operator==(const T &lhs, Approx const &rhs)
Approx operator()(T const &value)
friend bool operator>=(T const &lhs, Approx const &rhs)
Vector::ApproxMatcher< T > Approx(std::vector< T > const &comparator)
#define T(meth, val, expected)
static std::enable_if<::Catch::Detail::IsStreamInsertable< Fake >::value, std::string >::type convert(const Fake &value)