43 #define GTSAM_PRINT(x)((x).print(#x)) 48 template <
typename T>
struct traits;
76 inline void print(
float v,
const std::string&
s =
"") {
77 std::cout << (
s.empty() ?
s :
s +
" ") << v << std::endl;
79 inline void print(
double v,
const std::string&
s =
"") {
80 std::cout << (
s.empty() ?
s :
s +
" ") << v << std::endl;
85 inline bool equal(
const T& obj1,
const T& obj2,
double tol) {
91 inline bool equal(
const T& obj1,
const T& obj2) {
102 printf(
"Not equal:\n");
112 struct equals :
public std::function<bool(const V&, const V&)> {
124 struct equals_star :
public std::function<bool(const std::shared_ptr<V>&, const std::shared_ptr<V>&)> {
128 if (!actual && !expected)
return true;
161 return m1.equals(m2,
tol);
176 #define GTSAM_CONCEPT_TESTABLE_INST(T) template class gtsam::IsTestable<T>; 177 #define GTSAM_CONCEPT_TESTABLE_TYPE(T) using _gtsam_Testable_##T = gtsam::IsTestable<T>; void print(const Matrix &A, const string &s, ostream &stream)
#define GTSAM_CONCEPT_ASSERT(concept)
bool operator()(const std::shared_ptr< V > &expected, const std::shared_ptr< V > &actual)
bool assert_equal(const Matrix &expected, const Matrix &actual, double tol)
static bool Equals(const T &m1, const T &m2, double tol=1e-8)
Requirements on type to pass it to Testable template below.
BOOST_CONCEPT_USAGE(HasTestablePrereqs)
Array< int, Dynamic, 1 > v
BOOST_CONCEPT_USAGE(IsTestable)
Array< double, 1, 3 > e(1./3., 0.5, 2.)
equals_star(double tol=1e-9)
static void Print(const T &m, const std::string &str="")
bool equal(const T &obj1, const T &obj2, double tol)
void Print(const CONTAINER &keys, const string &s, const KeyFormatter &keyFormatter)
bool operator()(const V &expected, const V &actual)