36#include <boost/concept_check.hpp>
42#define GTSAM_PRINT(x)((x).print(#x))
47 template <
typename T>
struct traits;
75 inline void print(
float v,
const std::string& s =
"") {
76 std::cout << (s.empty() ? s : s +
" ") << v << std::endl;
78 inline void print(
double v,
const std::string& s =
"") {
79 std::cout << (s.empty() ? s : s +
" ") << v << std::endl;
84 inline bool equal(
const T& obj1,
const T& obj2,
double tol) {
90 inline bool equal(
const T& obj1,
const T& obj2) {
98 bool assert_equal(
const V& expected,
const V& actual,
double tol = 1e-9) {
101 printf(
"Not equal:\n");
111 struct equals :
public std::function<bool(const V&, const V&)> {
113 equals(
double tol = 1e-9) : tol_(tol) {}
114 bool operator()(
const V& expected,
const V& actual) {
123 struct equals_star :
public std::function<bool(const std::shared_ptr<V>&, const std::shared_ptr<V>&)> {
126 bool operator()(
const std::shared_ptr<V>& expected,
const std::shared_ptr<V>& actual) {
127 if (!actual && !expected)
return true;
138 b = t->equals(*s,tol);
156 static void Print(
const T& m,
const std::string& str =
"") {
159 static bool Equals(
const T& m1,
const T& m2,
double tol = 1e-8) {
160 return m1.equals(m2, tol);
175#define GTSAM_CONCEPT_TESTABLE_INST(T) template class gtsam::IsTestable<T>;
176#define GTSAM_CONCEPT_TESTABLE_TYPE(T) using _gtsam_Testable_##T = gtsam::IsTestable<T>;
Global functions in a separate testing namespace.
Definition: chartTesting.h:28
bool assert_equal(const Matrix &expected, const Matrix &actual, double tol)
equals with an tolerance, prints out message if unequal
Definition: Matrix.cpp:42
void print(const Matrix &A, const string &s, ostream &stream)
print without optional string, must specify cout yourself
Definition: Matrix.cpp:155
bool equal(const T &obj1, const T &obj2, double tol)
Call equal on the object.
Definition: Testable.h:84
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:58
Template to create a binary predicate.
Definition: Testable.h:111
Binary predicate on shared pointers.
Definition: Testable.h:123
Requirements on type to pass it to Testable template below.
Definition: Testable.h:134
A helper that implements the traits interface for GTSAM types.
Definition: Testable.h:151