tunit - Reference Guide  1.0.0
Modern c++17 unit testing framework on Windows, macOS, Linux, iOS and android.
tunit::base_assert Class Reference
Inheritance diagram for tunit::base_assert:

Static Public Member Functions

static void abort ()
 Abort current test. More...
 
static void abort (const tunit::line_info &line_info)
 Abort current test. More...
 
static void abort (const std::string &message)
 Abort current test. More...
 
static void abort (const std::string &message, const tunit::line_info &line_info)
 Abort current test. More...
 
static void fail ()
 Throws an tunit::assertion_error exception. More...
 
static void fail (const tunit::line_info &line_info)
 Throws an tunit::assertion_error exception. More...
 
static void fail (const std::string &message)
 Throws an tunit::assertion_error exception. More...
 
static void fail (const std::string &message, const tunit::line_info &line_info)
 Throws an tunit::assertion_error exception. More...
 
static void ignore ()
 Ignore current test. More...
 
static void ignore (const tunit::line_info &line_info)
 Ignore current test. More...
 
static void ignore (const std::string &message)
 Ignore current test. More...
 
static void ignore (const std::string &message, const tunit::line_info &line_info)
 Ignore current test. More...
 
static void succeed ()
 Generates a success with a generic message. More...
 
static void succeed (const tunit::line_info &line_info)
 Generates a success with a generic message. More...
 
static void succeed (const std::string &message)
 Generates a success with a generic message. More...
 
static void succeed (const std::string &message, const tunit::line_info &line_info)
 Generates a success with a generic message. More...
 

Static Protected Member Functions

static void error ()
 
static void error (const std::string &actual, const std::string &expected, const std::string &message, const tunit::line_info &line_info)
 
static void fail (const std::string &actual, const std::string &expected, const std::string &message, const tunit::line_info &line_info)
 
template<typename TCollection >
static std::string join_items (const TCollection &collection)
 
static std::string join_items (const std::string &str)
 
template<typename TValue >
static std::string to_string (const TValue &value)
 
template<typename TValue >
static std::string to_string (const TValue *value)
 

Member Function Documentation

◆ abort() [1/4]

static void tunit::base_assert::abort ( )
inlinestatic

Abort current test.

This is used by the other Assert functions.

Examples
tunit::assert::abort("User message...", line_info_); // test throws an abort_error exception.

◆ abort() [2/4]

static void tunit::base_assert::abort ( const tunit::line_info line_info)
inlinestatic

Abort current test.

This is used by the other Assert functions.

Parameters
line_infoContains information about current file and current line.
Exceptions
tunit::assertion_errorIf bad assertion.
Examples
tunit::assert::abort("User message...", line_info_); // test throws an abort_error exception.

◆ abort() [3/4]

static void tunit::base_assert::abort ( const std::string &  message)
inlinestatic

Abort current test.

This is used by the other Assert functions.

Parameters
messageA user message to display if the assertion fails. This message can be seen in the unit test results.
Examples
tunit::assert::abort("User message...", line_info_); // test throws an abort_error exception.

◆ abort() [4/4]

static void tunit::base_assert::abort ( const std::string &  message,
const tunit::line_info line_info 
)
static

Abort current test.

This is used by the other Assert functions.

Parameters
messageA user message to display if the assertion fails. This message can be seen in the unit test results.
line_infoContains information about current file and current line.
Examples
tunit::assert::abort("User message...", line_info_); // test throws an abort_error exception.

◆ fail() [1/4]

static void tunit::base_assert::fail ( )
inlinestatic

Throws an tunit::assertion_error exception.

This is used by the other Assert functions.

Exceptions
tunit::assertion_errorIf bad assertion.
Examples
tunit::assert::fail("User message...", line_info_); // test throws an assertion_error exception.

◆ fail() [2/4]

static void tunit::base_assert::fail ( const tunit::line_info line_info)
inlinestatic

Throws an tunit::assertion_error exception.

This is used by the other Assert functions.

Parameters
line_infoContains information about current file and current line.
Exceptions
tunit::assertion_errorIf bad assertion.
Examples
tunit::assert::fail("User message...", line_info_); // test throws an assertion_error exception.

◆ fail() [3/4]

static void tunit::base_assert::fail ( const std::string &  message)
inlinestatic

Throws an tunit::assertion_error exception.

This is used by the other Assert functions.

Parameters
messageA user message to display if the assertion fails. This message can be seen in the unit test results.
Exceptions
tunit::assertion_errorIf bad assertion.
Examples
tunit::assert::fail("User message...", line_info_); // test throws an assertion_error exception.

◆ fail() [4/4]

static void tunit::base_assert::fail ( const std::string &  message,
const tunit::line_info line_info 
)
inlinestatic

Throws an tunit::assertion_error exception.

This is used by the other Assert functions.

Parameters
messageA user message to display if the assertion fails. This message can be seen in the unit test results.
line_infoContains information about current file and current line.
Exceptions
tunit::assertion_errorIf bad assertion.
Examples
tunit::assert::fail("User message...", line_info_); // test throws an assertion_error exception.

◆ ignore() [1/4]

static void tunit::base_assert::ignore ( )
inlinestatic

Ignore current test.

This is used by the other Assert functions.

Examples
tunit::assert::ignore("User message...", line_info_); // test throws an ignore_error exception.

◆ ignore() [2/4]

static void tunit::base_assert::ignore ( const tunit::line_info line_info)
inlinestatic

Ignore current test.

This is used by the other Assert functions.

Parameters
line_infoContains information about current file and current line.
Exceptions
tunit::assertion_errorIf bad assertion.
Examples
tunit::assert::ignore("User message...", line_info_); // test throws an ignore_error exception.

◆ ignore() [3/4]

static void tunit::base_assert::ignore ( const std::string &  message)
inlinestatic

Ignore current test.

This is used by the other Assert functions.

Parameters
messageA user message to display if the assertion fails. This message can be seen in the unit test results.
Examples
tunit::assert::ignore("User message...", line_info_); // test throws an ignore_error exception.

◆ ignore() [4/4]

static void tunit::base_assert::ignore ( const std::string &  message,
const tunit::line_info line_info 
)
static

Ignore current test.

This is used by the other Assert functions.

Parameters
messageA user message to display if the assertion fails. This message can be seen in the unit test results.
line_infoContains information about current file and current line.
Examples
tunit::assert::ignore("User message...", line_info_); // test throws an ignore_error exception.

◆ succeed() [1/4]

static void tunit::base_assert::succeed ( )
inlinestatic

Generates a success with a generic message.

This is used by the other Assert functions.

Examples
tunit::assert::succeed(); // test ok.

◆ succeed() [2/4]

static void tunit::base_assert::succeed ( const tunit::line_info line_info)
inlinestatic

Generates a success with a generic message.

This is used by the other Assert functions.

Parameters
messageA user message to display if the assertion fails. This message can be seen in the unit test results.
Examples

◆ succeed() [3/4]

static void tunit::base_assert::succeed ( const std::string &  message)
inlinestatic

Generates a success with a generic message.

This is used by the other Assert functions.

Parameters
messageA user message to display if the assertion fails. This message can be seen in the unit test results.
Examples
tunit::assert::succeed("User message..."); // test ok.

◆ succeed() [4/4]

static void tunit::base_assert::succeed ( const std::string &  message,
const tunit::line_info line_info 
)
static

Generates a success with a generic message.

This is used by the other Assert functions.

Parameters
messageA user message to display if the assertion fails. This message can be seen in the unit test results.
line_infoContains information about current file and current line.
Examples
tunit::assert::succeed("User message...", line_info_); // test ok.

The documentation for this class was generated from the following file: