From 91ab5e2a3e0d339d6cb67c8deae4b67b4280a79b Mon Sep 17 00:00:00 2001 From: Paul Furgale Date: Thu, 8 Jan 2015 13:26:06 +0100 Subject: [PATCH] Print matrices when checks fail --- include/eigen-checks/internal/gtest-equal.h | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/include/eigen-checks/internal/gtest-equal.h b/include/eigen-checks/internal/gtest-equal.h index b044ad9..8f486f1 100644 --- a/include/eigen-checks/internal/gtest-equal.h +++ b/include/eigen-checks/internal/gtest-equal.h @@ -29,6 +29,8 @@ ::testing::AssertionResult MatricesNear( failure_reason << "The matrices have a different number of cols: " << name_lhs << " has " << lhs.cols() << " cols while " << name_rhs << " cols " << rhs.cols() << " cols." << std::endl; + failure_reason << name_lhs << ":\n" << lhs << std::endl; + failure_reason << name_rhs << ":\n" << rhs << std::endl; return failure_reason; } @@ -69,6 +71,9 @@ ::testing::AssertionResult MatricesNear( } } } + failure_reason << name_lhs << ":\n" << lhs << std::endl; + failure_reason << name_rhs << ":\n" << rhs << std::endl; + failure_reason << "Difference:\n" << (lhs - rhs) << std::endl; return failure_reason; } }