@@ -25,37 +25,37 @@ template<typename DerivedA>
2525struct IsCloseMatcher : Catch::Matchers::MatcherGenericBase
2626{
2727 IsCloseMatcher (
28- const Eigen::Ref< const DerivedA> a,
28+ const DerivedA& a,
2929 const typename DerivedA::RealScalar rtol =
3030 Eigen::NumTraits<typename DerivedA::RealScalar>::dummy_precision(),
3131 const typename DerivedA::RealScalar atol =
3232 Eigen::NumTraits<typename DerivedA::RealScalar>::epsilon())
33- : a (a)
34- , rtol (rtol)
35- , atol (atol)
33+ : _a (a)
34+ , _rtol (rtol)
35+ , _atol (atol)
3636 {
3737 }
3838
3939 template <typename DerivedB>
40- bool match (const Eigen::DenseBase< DerivedB> & b) const
40+ bool match (const DerivedB& b) const
4141 {
42- return ((a .derived () - b.derived ()).array ().abs () <=
43- (atol + rtol * b.derived ().array ().abs ()))
42+ return ((_a .derived () - b.derived ()).array ().abs () <=
43+ (_atol + _rtol * b.derived ().array ().abs ()))
4444 .all ();
4545 }
4646
4747 std::string describe () const override
4848 {
4949 std::stringstream ss;
50- ss << " Is close to: " << Catch::StringMaker<DerivedA>::convert (a )
51- << " \n rtol = " << rtol << " , atol = " << atol ;
50+ ss << " Is close to: " << Catch::StringMaker<DerivedA>::convert (_a )
51+ << " \n rtol = " << _rtol << " , atol = " << _atol ;
5252 return ss.str ();
5353 }
5454
5555 private:
56- const Eigen::Ref< const DerivedA> a ;
57- const typename DerivedA::RealScalar rtol ;
58- const typename DerivedA::RealScalar atol ;
56+ const DerivedA _a ;
57+ const typename DerivedA::RealScalar _rtol ;
58+ const typename DerivedA::RealScalar _atol ;
5959};
6060
6161template <typename T>
@@ -76,7 +76,8 @@ TEST_CASE("getH gives the cross product matrix")
7676 vec v{ 0.3 , 0.2 , 0.1 };
7777 // getH() should create a matrix that replicates the behavior of the cross
7878 // product such that getH(v) * a == -v.cross(a)
79- REQUIRE_THAT (getH (v) * testVec, IsClose (v.cross (-testVec)));
79+ vec ref = v.cross (-testVec);
80+ REQUIRE_THAT (getH (v) * testVec, IsClose (ref));
8081}
8182
8283TEST_CASE (" translateMass linear acceleration" )
0 commit comments