diff --git a/include/eigen-checks/glog.h b/include/eigen-checks/glog.h new file mode 100644 index 0000000..74d0fe4 --- /dev/null +++ b/include/eigen-checks/glog.h @@ -0,0 +1,35 @@ +#ifndef EIGEN_CHECKS_GLOG_H_ +#define EIGEN_CHECKS_GLOG_H_ +#include +#include +#include +#include + +#define CHECK_EIGEN_MATRIX_EQUAL(MatrixA, MatrixB) \ + do { \ + ::testing::AssertionResult result = eigen_checks::internal::MatricesNear(\ + MatrixA, #MatrixA, MatrixB, #MatrixB, \ + static_cast::type::Scalar>(0.0), "0.0"); \ + CHECK(static_cast(result)) << result.message; \ + } while(0); + +#define CHECK_EIGEN_MATRIX_EQUAL_DOUBLE(MatrixA, MatrixB) \ + do { \ + ::testing::AssertionResult result = eigen_checks::internal::MatricesNear(\ + MatrixA, #MatrixA, MatrixB, #MatrixB, \ + static_cast::type::Scalar>( \ + eigen_checks::internal::kDefaultPrecision), \ + "Floating point precision"); \ + CHECK(static_cast(result)) << result.message; \ + } while(0); + +#define CHECK_EIGEN_MATRIX_NEAR(MatrixA, MatrixB, Precision) \ + do { \ + ::testing::AssertionResult result = eigen_checks::internal::MatricesNear(\ + MatrixA, #MatrixA, MatrixB, #MatrixB, Precision, #Precision); \ + CHECK(static_cast(result)) << result.message; \ + } while(0); + +#endif // EIGEN_CHECKS_GLOG_H_