36 #include <boost/shared_ptr.hpp> 37 #include <boost/concept_check.hpp> 41 #define GTSAM_PRINT(x)((x).print(#x)) 46 template <
typename T>
struct traits;
74 inline void print(
float v,
const std::string& s =
"") {
75 printf(
"%s%f\n",s.c_str(),v);
77 inline void print(
double v,
const std::string& s =
"") {
78 printf(
"%s%lf\n",s.c_str(),v);
83 inline bool equal(
const T& obj1,
const T& obj2,
double tol) {
89 inline bool equal(
const T& obj1,
const T& obj2) {
97 bool assert_equal(
const V& expected,
const V& actual,
double tol = 1e-9) {
100 printf(
"Not equal:\n");
110 struct equals :
public std::binary_function<const V&, const V&, bool> {
112 equals(
double tol = 1e-9) : tol_(tol) {}
113 bool operator()(
const V& expected,
const V& actual) {
122 struct equals_star :
public std::binary_function<const boost::shared_ptr<V>&, const boost::shared_ptr<V>&, bool> {
125 bool operator()(
const boost::shared_ptr<V>& expected,
const boost::shared_ptr<V>& actual) {
126 if (!actual && !expected)
return true;
137 b = t->equals(*s,tol);
155 static void Print(
const T& m,
const std::string& str =
"") {
158 static bool Equals(
const T& m1,
const T& m2,
double tol = 1e-8) {
159 return m1.equals(m2, tol);
174 #define GTSAM_CONCEPT_TESTABLE_INST(T) template class gtsam::IsTestable<T>; 175 #define GTSAM_CONCEPT_TESTABLE_TYPE(T) typedef gtsam::IsTestable<T> _gtsam_Testable_##T; void print(const Matrix &A, const string &s, ostream &stream)
print without optional string, must specify cout yourself
Definition: Matrix.cpp:141
bool assert_equal(const Matrix &expected, const Matrix &actual, double tol)
equals with an tolerance, prints out message if unequal
Definition: Matrix.cpp:42
Template to create a binary predicate.
Definition: Testable.h:110
A helper that implements the traits interface for GTSAM types.
Definition: Testable.h:150
Requirements on type to pass it to Testable template below.
Definition: Testable.h:133
A manifold defines a space in which there is a notion of a linear tangent space that can be centered ...
Definition: concepts.h:30
Definition: Testable.h:57
Binary predicate on shared pointers.
Definition: Testable.h:122
Global functions in a separate testing namespace.
Definition: chartTesting.h:28
bool equal(const T &obj1, const T &obj2, double tol)
Call equal on the object.
Definition: Testable.h:83