gtsam 4.1.1
gtsam
Testable.h File Reference

Concept check for values that can be used in unit tests. More...

Go to the source code of this file.

Classes

class  gtsam::IsTestable< T >
 
struct  gtsam::equals< V >
 Template to create a binary predicate. More...
 
struct  gtsam::equals_star< V >
 Binary predicate on shared pointers. More...
 
struct  gtsam::HasTestablePrereqs< T >
 Requirements on type to pass it to Testable template below. More...
 
struct  gtsam::Testable< T >
 A helper that implements the traits interface for GTSAM types. More...
 

Namespaces

namespace  gtsam
 Global functions in a separate testing namespace.
 

Macros

#define GTSAM_PRINT(x)   ((x).print(#x))
 
#define GTSAM_CONCEPT_TESTABLE_INST(T)   template class gtsam::IsTestable<T>;
 Macros for using the TestableConcept. More...
 
#define GTSAM_CONCEPT_TESTABLE_TYPE(T)   using _gtsam_Testable_##T = gtsam::IsTestable<T>;
 

Functions

void gtsam::print (float v, const std::string &s="")
 
void gtsam::print (double v, const std::string &s="")
 
template<class T >
bool gtsam::equal (const T &obj1, const T &obj2, double tol)
 Call equal on the object.
 
template<class T >
bool gtsam::equal (const T &obj1, const T &obj2)
 Call equal without tolerance (use default tolerance)
 
template<class V >
bool gtsam::assert_equal (const V &expected, const V &actual, double tol=1e-9)
 This template works for any type with equals.
 

Detailed Description

Concept check for values that can be used in unit tests.

Author
Frank Dellaert

The necessary functions to implement for Testable are defined below with additional details as to the interface. The concept checking function will check whether or not the function exists in derived class and throw compile-time errors.

print with optional string naming the object void print(const std::string& name) const = 0;

equality up to tolerance tricky to implement, see NoiseModelFactor1 for an example equals is not supposed to print out anything, just return true|false bool equals(const Derived& expected, double tol) const = 0;

Macro Definition Documentation

◆ GTSAM_CONCEPT_TESTABLE_INST

#define GTSAM_CONCEPT_TESTABLE_INST (   T)    template class gtsam::IsTestable<T>;

Macros for using the TestableConcept.

  • An instantiation for use inside unit tests
  • A typedef for use inside generic algorithms

NOTE: intentionally not in the gtsam namespace to allow for classes not in the gtsam namespace to be more easily enforced as testable

Deprecated:
please use BOOST_CONCEPT_ASSERT and