Classes | Namespaces | Macros | Typedefs | Enumerations | Variables
test.hpp File Reference
#include <exception>
#include <vector>
#include <cstring>
#include <cstdio>
#include <sstream>
#include <string>
Include dependency graph for test.hpp:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  test::AssertFailedError
 
struct  test::TestBase
 

Namespaces

 test
 

Macros

#define _ASSERT_BINOP(a, b, cmp)
 
#define _TEST_STATUS(name, status)
 
#define ASSERT(expr)
 
#define ASSERT_ANY_THROW(expr)
 
#define ASSERT_EQ(a, b)   _ASSERT_BINOP(a, b, !=)
 
#define ASSERT_GE(a, b)   _ASSERT_BINOP(a, b, <)
 
#define ASSERT_GT(a, b)   _ASSERT_BINOP(a, b, <=)
 
#define ASSERT_LE(a, b)   _ASSERT_BINOP(a, b, >)
 
#define ASSERT_LT(a, b)   _ASSERT_BINOP(a, b, >=)
 
#define ASSERT_NE(a, b)   _ASSERT_BINOP(a, b, ==)
 
#define ASSERT_NO_THROW(expr)
 
#define ASSERT_THROW(expr, e_type)
 
#define H_54E531F7_9154_454B_BEB9_257408429470
 
#define TEST(name)   _TEST_STATUS(name, ::test::SUCCESS)
 
#define TEST_ABORT(name)   _TEST_STATUS(name, ::test::SIGNAL_ABORT)
 
#define TEST_DIVZERO(name)   _TEST_STATUS(name, ::test::SIGNAL_DIVZERO)
 
#define TEST_FAIL(name)   _TEST_STATUS(name, ::test::FAILED)
 
#define TEST_FAIL_ASSERT(name)   _TEST_STATUS(name, ::test::ASSERT_FAIL)
 
#define TEST_SEGFAULT(name)   _TEST_STATUS(name, ::test::SIGNAL_SEGFAULT)
 
#define TEST_UNCAUGHT_EXCEPTION(name)   _TEST_STATUS(name, ::test::EXCEPTION_UNCAUGHT)
 
#define TEST_UNCAUGHT_SIGNAL(name)   _TEST_STATUS(name, ::test::SIGNAL_UNCAUGHT)
 

Typedefs

typedef std::vector< TestBase * > test::test_registry_t
 

Enumerations

enum  test::TestStatus {
  test::SUCCESS = 0<<0, test::FAILED = 1<<0, test::ASSERT_FAIL = FAILED | 1<<1, test::EXCEPTION_UNCAUGHT = FAILED | 2<<1,
  test::SIGNAL_UNCAUGHT = FAILED | 3<<1, test::SIGNAL_SEGFAULT = SIGNAL_UNCAUGHT | 1<<3, test::SIGNAL_ABORT = SIGNAL_UNCAUGHT | 2<<3, test::SIGNAL_DIVZERO = SIGNAL_UNCAUGHT | 2<<3,
  test::STATUS_MASK = 0x1F
}
 

Variables

test_registry_t test::test_registry
 

Macro Definition Documentation

◆ _ASSERT_BINOP

#define _ASSERT_BINOP (   a,
  b,
  cmp 
)
Value:
(not (a cmp b)) ? static_cast<void>(0) \
: throw ::test::AssertFailedError( \
__FILE__, __LINE__, "because " #a " " #cmp " " #b)

Definition at line 137 of file test.hpp.

◆ _TEST_STATUS

#define _TEST_STATUS (   name,
  status 
)
Value:
struct TEST_##name: ::test::TestBase { \
TEST_##name(): TestBase(#name, status) {} \
void do_test(); \
} TEST_##name; \
void TEST_##name::do_test()

Definition at line 116 of file test.hpp.

◆ ASSERT

#define ASSERT (   expr)
Value:
(expr) ? static_cast<void>(0) \
: throw ::test::AssertFailedError( \
__FILE__, __LINE__, #expr)

Definition at line 132 of file test.hpp.

◆ ASSERT_ANY_THROW

#define ASSERT_ANY_THROW (   expr)
Value:
do { try { expr } \
catch (...) { break; } \
throw ::test::AssertFailedError( \
__FILE__, __LINE__, "expected any exception"); \
} while(0)

Definition at line 156 of file test.hpp.

◆ ASSERT_EQ

#define ASSERT_EQ (   a,
  b 
)    _ASSERT_BINOP(a, b, !=)

Definition at line 142 of file test.hpp.

◆ ASSERT_GE

#define ASSERT_GE (   a,
  b 
)    _ASSERT_BINOP(a, b, <)

Definition at line 147 of file test.hpp.

◆ ASSERT_GT

#define ASSERT_GT (   a,
  b 
)    _ASSERT_BINOP(a, b, <=)

Definition at line 146 of file test.hpp.

◆ ASSERT_LE

#define ASSERT_LE (   a,
  b 
)    _ASSERT_BINOP(a, b, >)

Definition at line 145 of file test.hpp.

◆ ASSERT_LT

#define ASSERT_LT (   a,
  b 
)    _ASSERT_BINOP(a, b, >=)

Definition at line 144 of file test.hpp.

◆ ASSERT_NE

#define ASSERT_NE (   a,
  b 
)    _ASSERT_BINOP(a, b, ==)

Definition at line 143 of file test.hpp.

◆ ASSERT_NO_THROW

#define ASSERT_NO_THROW (   expr)
Value:
try { expr } \
catch (...) { \
throw ::test::AssertFailedError( \
__FILE__, __LINE__, "no exception expected"); \
}

Definition at line 163 of file test.hpp.

◆ ASSERT_THROW

#define ASSERT_THROW (   expr,
  e_type 
)
Value:
do { try { expr } \
catch (const e_type&) { break; } \
throw ::test::AssertFailedError( \
__FILE__, __LINE__, "expected exception " #e_type); \
} while(0)

Definition at line 149 of file test.hpp.

◆ H_54E531F7_9154_454B_BEB9_257408429470

#define H_54E531F7_9154_454B_BEB9_257408429470

Definition at line 26 of file test.hpp.

◆ TEST

#define TEST (   name)    _TEST_STATUS(name, ::test::SUCCESS)

Definition at line 123 of file test.hpp.

◆ TEST_ABORT

#define TEST_ABORT (   name)    _TEST_STATUS(name, ::test::SIGNAL_ABORT)

Definition at line 129 of file test.hpp.

◆ TEST_DIVZERO

#define TEST_DIVZERO (   name)    _TEST_STATUS(name, ::test::SIGNAL_DIVZERO)

Definition at line 130 of file test.hpp.

◆ TEST_FAIL

#define TEST_FAIL (   name)    _TEST_STATUS(name, ::test::FAILED)

Definition at line 124 of file test.hpp.

◆ TEST_FAIL_ASSERT

#define TEST_FAIL_ASSERT (   name)    _TEST_STATUS(name, ::test::ASSERT_FAIL)

Definition at line 125 of file test.hpp.

◆ TEST_SEGFAULT

#define TEST_SEGFAULT (   name)    _TEST_STATUS(name, ::test::SIGNAL_SEGFAULT)

Definition at line 128 of file test.hpp.

◆ TEST_UNCAUGHT_EXCEPTION

#define TEST_UNCAUGHT_EXCEPTION (   name)    _TEST_STATUS(name, ::test::EXCEPTION_UNCAUGHT)

Definition at line 126 of file test.hpp.

◆ TEST_UNCAUGHT_SIGNAL

#define TEST_UNCAUGHT_SIGNAL (   name)    _TEST_STATUS(name, ::test::SIGNAL_UNCAUGHT)

Definition at line 127 of file test.hpp.

test::TestBase::name
const char * name
Definition: test.hpp:83
test::TestBase::do_test
virtual void do_test()=0
b
void b(StackTrace &st)
Definition: stacktrace.cpp:50
test::TestBase
Definition: test.hpp:82


backward_ros
Author(s):
autogenerated on Tue Mar 1 2022 23:50:49