diff --git a/cpp/Testable.h b/cpp/Testable.h index 7a0ce98b3..d69021b92 100644 --- a/cpp/Testable.h +++ b/cpp/Testable.h @@ -8,6 +8,8 @@ #pragma once +#include + namespace gtsam { /** @@ -49,4 +51,21 @@ namespace gtsam { return false; } + /** + * Template to create a binary predicate + */ + template + bool equals(const V& expected, const V& actual, double tol = 1e-9) { + return (actual.equals(expected, tol)); + } + + /** + * Binary predicate on shared pointers + */ + template + bool equals_star(const boost::shared_ptr& expected, + const boost::shared_ptr& actual, double tol = 1e-9) { + return (actual->equals(*expected, tol)); + } + } // gtsam