36 #include <boost/shared_ptr.hpp>
40 #define GTSAM_PRINT(x)((x).print(#x))
54 static bool checkTestableConcept(
const T& d) {
56 d.print(std::string());
61 bool r1 = d.equals(d, tol);
62 bool r2 = d.equals(d);
69 inline void print(
const T&
object,
const std::string& s =
"") {
75 inline bool equal(
const T& obj1,
const T& obj2,
double tol) {
76 return obj1.equals(obj2, tol);
81 inline bool equal(
const T& obj1,
const T& obj2) {
82 return obj1.equals(obj2);
89 bool assert_equal(
const V& expected,
const V& actual,
double tol = 1e-9) {
90 if (actual.equals(expected, tol))
92 printf(
"Not equal:\n");
93 expected.print(
"expected:\n");
94 actual.print(
"actual:\n");
102 struct equals :
public std::binary_function<const V&, const V&, bool> {
104 equals(
double tol = 1e-9) : tol_(tol) {}
105 bool operator()(
const V& expected,
const V& actual) {
106 return (actual.equals(expected, tol_));
114 struct equals_star :
public std::binary_function<const boost::shared_ptr<V>&, const boost::shared_ptr<V>&, bool> {
117 bool operator()(
const boost::shared_ptr<V>& expected,
const boost::shared_ptr<V>& actual) {
118 if (!actual || !expected)
return false;
119 return (actual->equals(*expected, tol_));
133 #define GTSAM_CONCEPT_TESTABLE_INST(T) template class gtsam::TestableConcept<T>;
134 #define GTSAM_CONCEPT_TESTABLE_TYPE(T) typedef gtsam::TestableConcept<T> _gtsam_TestableConcept_##T;
Binary predicate on shared pointers.
Definition: Testable.h:114
void print(const Matrix &A, const string &s, ostream &stream)
print a matrix
Definition: Matrix.cpp:183
Template to create a binary predicate.
Definition: Testable.h:102
bool assert_equal(const Matrix &expected, const Matrix &actual, double tol)
equals with an tolerance, prints out message if unequal
Definition: Matrix.cpp:60
Definition: Testable.h:53
bool equal(const T &obj1, const T &obj2, double tol)
Call equal on the object.
Definition: Testable.h:75