39 template <
typename ScalarType>
51 template <
typename FadType1,
typename FadType2>
54 if (
a.size() != b.size())
return false;
55 if (
a.hasFastAccess() != b.hasFastAccess())
return false;
56 if (!
cmp(
a.val(), b.val()))
return false;
57 for (
int i=0;
i<
a.size(); ++
i) {
58 if (!
cmp(
a.dx(
i), b.dx(
i)))
return false;
59 if (!
cmp(
a.fastAccessDx(
i), b.fastAccessDx(
i)))
return false;
64 template <
typename FadType1,
typename FadType2>
65 ::testing::AssertionResult
operator() (
const char* a_expr,
const char* b_expr,
66 const FadType1&
a,
const FadType2& b)
68 bool success = (*this)(
a,b);
69 if (success) return ::testing::AssertionSuccess();
70 return ::testing::AssertionFailure()
71 <<
"Fad's do not match!" << std::endl
72 << a_expr <<
" = " <<
a << std::endl
73 << b_expr <<
" = " << b << std::endl;
83 template <
typename FadType1,
typename FadType2>
86 if (
a.size() != b.size())
return false;
87 if (
a.hasFastAccess() != b.hasFastAccess())
return false;
88 if (!
cmp(
a.val(), b.val()))
return false;
89 for (
int i=0;
i<
a.size(); ++
i) {
90 if (!
cmp(
a.dx(
i), b.dx(
i)))
return false;
91 if (!
cmp(
a.fastAccessDx(
i), b.fastAccessDx(
i)))
return false;
96 template <
typename FadType1,
typename FadType2>
97 ::testing::AssertionResult
operator() (
const char* a_expr,
const char* b_expr,
98 const FadType1&
a,
const FadType2& b)
100 bool success = (*this)(
a,b);
101 if (success) return ::testing::AssertionSuccess();
102 return ::testing::AssertionFailure()
103 <<
"Fad's do not match!" << std::endl
104 << a_expr <<
" = " <<
a << std::endl
105 << b_expr <<
" = " << b << std::endl;
109#define COMPARE_VALUES(a, b) \
110 ASSERT_PRED2(CompareFloats(this->tol_a, this->tol_r), a, b);
112#define COMPARE_FADS(a, b) \
113 ASSERT_PRED_FORMAT2(CompareFads(this->tol_a, this->tol_r), a, b);
115#define COMPARE_NESTED_FADS(a, b) \
116 ASSERT_PRED_FORMAT2(CompareNestedFads(this->tol_a, this->tol_r), a, b);
bool operator()(const FadType1 &a, const FadType2 &b)
CompareFads(double tol_a, double tol_r)
bool operator()(const ScalarType &a, const ScalarType &b)
CompareFloats(double tol_a_, double tol_r_)
CompareNestedFads(double tol_a, double tol_r)
bool operator()(const FadType1 &a, const FadType2 &b)