39 #include <gtest/gtest.h>
41 #include <Eigen/Geometry>
44 template <
typename _Scalar,
int _Dim,
int _Mode,
int _Options>
45 std::ostream&
operator<<(std::ostream& s,
const Eigen::Transform<_Scalar, _Dim, _Mode, _Options>& t)
47 return s <<
"p=[" << t.translation().transpose() <<
"] q=[" << Eigen::Quaterniond(t.linear()).coeffs().transpose()
52 template <
typename T1,
typename T2>
60 ::testing::AssertionResult
operator()(
const char* expr1,
const char* expr2, T1 val1, T2 val2)
62 if (val1.isApprox(val2,
prec_))
63 return ::testing::AssertionSuccess();
65 std::stringstream msg;
66 msg <<
"Expected equality of these values (up to precision " <<
prec_ <<
"):" << std::fixed
67 << std::setprecision(1 - std::log10(
prec_))
68 <<
"\n " << expr1 <<
"\n Which is: " << val1
69 <<
"\n " << expr2 <<
"\n Which is: " << val2;
70 return ::testing::AssertionFailure() << msg.str();
74 #define EXPECT_EIGEN_EQ(val1, val2) \
75 EXPECT_PRED_FORMAT2((IsApprox<decltype(val1), decltype(val2)>( \
76 Eigen::NumTraits<typename std::decay<decltype(val1)>::type::Scalar>::dummy_precision())), \
78 #define EXPECT_EIGEN_NEAR(val1, val2, prec_) \
79 EXPECT_PRED_FORMAT2((IsApprox<decltype(val1), decltype(val2)>(prec_)), val1, val2)
std::ostream & operator<<(std::ostream &s, const Eigen::Transform< _Scalar, _Dim, _Mode, _Options > &t)
::testing::AssertionResult operator()(const char *expr1, const char *expr2, T1 val1, T2 val2)