diff --git a/gtsam/base/TestableAssertions.h b/gtsam/base/TestableAssertions.h index 46f738f7d..bf96c5d48 100644 --- a/gtsam/base/TestableAssertions.h +++ b/gtsam/base/TestableAssertions.h @@ -70,6 +70,14 @@ bool assert_equal(const V& expected, const boost::optional& actual, double to return assert_equal(expected, *actual, tol); } +template +bool assert_equal(const V& expected, const boost::optional& actual, double tol = 1e-9) { + if (!actual) { + std::cout << "actual is boost::none" << std::endl; + return false; + } + return assert_equal(expected, *actual, tol); +} /** * Version of assert_equals to work with vectors