17#include <catch2/matchers/catch_matchers_floating_point.hpp>
19namespace lagrange::testing {
21template <
typename DerivedA,
typename DerivedB>
23 const Eigen::MatrixBase<DerivedA>& A,
24 const Eigen::MatrixBase<DerivedB>& B,
25 typename DerivedA::Scalar eps_rel,
26 typename DerivedA::Scalar eps_abs)
28 REQUIRE(A.rows() == B.rows());
29 REQUIRE(A.cols() == B.cols());
30 for (Eigen::Index i = 0; i < A.size(); ++i) {
32 A.derived().data()[i],
33 Catch::Matchers::WithinRel(B.derived().data()[i], eps_rel) ||
34 (Catch::Matchers::WithinAbs(0, eps_abs) &&
35 Catch::Matchers::WithinAbs(B.derived().data()[i], eps_abs)));