36 #include <boost/concept_check.hpp> 37 #include <boost/shared_ptr.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 std::cout << (
s.empty() ?
s :
s +
" ") << v << std::endl;
77 inline void print(
double v,
const std::string&
s =
"") {
78 std::cout << (
s.empty() ?
s :
s +
" ") << v << std::endl;
83 inline bool equal(
const T& obj1,
const T& obj2,
double tol) {
89 inline bool equal(
const T& obj1,
const T& obj2) {
100 printf(
"Not equal:\n");
110 struct equals :
public std::function<bool(const V&, const V&)> {
122 struct equals_star :
public std::function<bool(const boost::shared_ptr<V>&, const boost::shared_ptr<V>&)> {
126 if (!actual && !expected)
return true;
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)
BOOST_CONCEPT_ASSERT((boost::RandomAccessRangeConcept< ListOfOneContainer< int > >))
bool operator()(const boost::shared_ptr< V > &expected, const boost::shared_ptr< V > &actual)
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)
BOOST_CONCEPT_USAGE(IsTestable)
Array< double, 1, 3 > e(1./3., 0.5, 2.)
equals_star(double tol=1e-9)
bool assert_equal(const Matrix &expected, const Matrix &actual, double tol)
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)