Classes | Namespaces | Macros | Functions
test_macros.hpp File Reference
#include <sophus/types.hpp>
Include dependency graph for test_macros.hpp:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

class  Sophus::details::Pretty< Scalar >
 
class  Sophus::details::Pretty< Eigen::Matrix< Scalar, M, N > >
 

Namespaces

 Sophus
 
 Sophus::details
 

Macros

#define SOPHUS_STRINGIFY(x)   #x
 
#define SOPHUS_TEST(passed, condition, ...)
 
#define SOPHUS_TEST_APPROX(passed, left, right, thr, ...)
 
#define SOPHUS_TEST_EQUAL(passed, left, right, ...)
 
#define SOPHUS_TEST_NEQ(passed, left, right, ...)
 
#define SOPHUS_TEST_NOT_APPROX(passed, left, right, thr, ...)
 

Functions

template<class T >
std::string Sophus::details::pretty (T const &v)
 
void Sophus::processTestResult (bool passed)
 
template<class... Args>
void Sophus::details::testFailed (bool &passed, char const *func, char const *file, int line, std::string const &msg)
 

Macro Definition Documentation

◆ SOPHUS_STRINGIFY

#define SOPHUS_STRINGIFY (   x)    #x

Definition at line 49 of file test_macros.hpp.

◆ SOPHUS_TEST

#define SOPHUS_TEST (   passed,
  condition,
  ... 
)
Value:
do { \
if (!(condition)) { \
std::string msg = Sophus::details::FormatString( \
"condition ``%`` is false\n", SOPHUS_STRINGIFY(condition)); \
msg += Sophus::details::FormatString(__VA_ARGS__); \
Sophus::details::testFailed(passed, SOPHUS_FUNCTION, __FILE__, __LINE__, \
msg); \
} \
} while (false)

GenericTests whether condition is true. The in-out parameter passed will be set to false if test fails.

Definition at line 53 of file test_macros.hpp.

◆ SOPHUS_TEST_APPROX

#define SOPHUS_TEST_APPROX (   passed,
  left,
  right,
  thr,
  ... 
)
Value:
do { \
auto nrm = Sophus::maxMetric((left), (right)); \
if (!(nrm < (thr))) { \
std::string msg = Sophus::details::FormatString( \
"% (=%) is not approx % (=%); % is %; nrm is %\n", \
msg += Sophus::details::FormatString(__VA_ARGS__); \
Sophus::details::testFailed(passed, SOPHUS_FUNCTION, __FILE__, __LINE__, \
msg); \
} \
} while (false)

GenericTests whether left is approximatly equal to right given a threshold. The in-out parameter passed will be set to false if test fails.

Definition at line 96 of file test_macros.hpp.

◆ SOPHUS_TEST_EQUAL

#define SOPHUS_TEST_EQUAL (   passed,
  left,
  right,
  ... 
)
Value:
do { \
if (left != right) { \
std::string msg = Sophus::details::FormatString( \
"% (=%) is not equal to % (=%)\n", SOPHUS_STRINGIFY(left), \
msg += Sophus::details::FormatString(__VA_ARGS__); \
Sophus::details::testFailed(passed, SOPHUS_FUNCTION, __FILE__, __LINE__, \
msg); \
} \
} while (false)

GenericTests whether left is equal to right given a threshold. The in-out parameter passed will be set to false if test fails.

Definition at line 66 of file test_macros.hpp.

◆ SOPHUS_TEST_NEQ

#define SOPHUS_TEST_NEQ (   passed,
  left,
  right,
  ... 
)
Value:
do { \
if (left == right) { \
std::string msg = Sophus::details::FormatString( \
"% (=%) shoudl not be equal to % (=%)\n", SOPHUS_STRINGIFY(left), \
msg += Sophus::details::FormatString(__VA_ARGS__); \
Sophus::details::testFailed(passed, SOPHUS_FUNCTION, __FILE__, __LINE__, \
msg); \
} \
} while (false)

GenericTests whether left is equal to right given a threshold. The in-out parameter passed will be set to false if test fails.

Definition at line 81 of file test_macros.hpp.

◆ SOPHUS_TEST_NOT_APPROX

#define SOPHUS_TEST_NOT_APPROX (   passed,
  left,
  right,
  thr,
  ... 
)
Value:
do { \
auto nrm = Sophus::maxMetric((left), (right)); \
if (nrm < (thr)) { \
std::string msg = Sophus::details::FormatString( \
"% (=%) is approx % (=%), but it should not!\n % is %; nrm is %\n", \
msg += Sophus::details::FormatString(__VA_ARGS__); \
Sophus::details::testFailed(passed, SOPHUS_FUNCTION, __FILE__, __LINE__, \
msg); \
} \
} while (false)

GenericTests whether left is NOT approximatly equal to right given a threshold. The in-out parameter passed will be set to false if test fails.

Definition at line 113 of file test_macros.hpp.

SOPHUS_FUNCTION
#define SOPHUS_FUNCTION
Definition: common.hpp:28
SOPHUS_STRINGIFY
#define SOPHUS_STRINGIFY(x)
Definition: test_macros.hpp:49
Sophus::details::testFailed
void testFailed(bool &passed, char const *func, char const *file, int line, std::string const &msg)
Definition: test_macros.hpp:29
Sophus::maxMetric
auto maxMetric(T const &p0, T const &p1) -> decltype(details::MaxMetric< T >::impl(p0, p1))
Definition: types.hpp:164
Sophus::details::pretty
std::string pretty(T const &v)
Definition: test_macros.hpp:24
Sophus::details::FormatString
std::string FormatString(char const *text, Args &&... args)
Definition: common.hpp:91


sophus
Author(s): Hauke Strasdat
autogenerated on Wed Mar 2 2022 01:01:48