xtd 0.2.0
Loading...
Searching...
No Matches
xtd::tunit::base_assert Class Reference
Inheritance diagram for xtd::tunit::base_assert:
xtd::static_object xtd::tunit::assert xtd::tunit::assume xtd::tunit::collection_assert xtd::tunit::collection_assume xtd::tunit::collection_valid xtd::tunit::directory_assert xtd::tunit::directory_assume xtd::tunit::directory_valid xtd::tunit::file_assert xtd::tunit::file_assume xtd::tunit::file_valid xtd::tunit::string_assert xtd::tunit::string_assume xtd::tunit::string_valid xtd::tunit::valid

Definition

The base class for assert.

Namespace
xtd::tunit
Library
xtd.tunit
Examples
math_assert.cpp, math_assume.cpp, and math_valid.cpp.

Public Static Methods

static void abort ()
 Abort current test. This is used by the other assert functions.
 
static void abort (const xtd::diagnostics::stack_frame &stack_frame)
 Abort current test. This is used by the other assert functions.
 
static void abort (const xtd::ustring &message)
 Abort current test. This is used by the other assert functions.
 
static void abort (const xtd::ustring &message, const xtd::diagnostics::stack_frame &stack_frame)
 Abort current test. This is used by the other assert functions.
 
static void fail ()
 Throws an xtd::tunit::assert_error exception. This is used by the other assert functions.
 
static void fail (const xtd::diagnostics::stack_frame &stack_frame)
 Throws an xtd::tunit::assert_error exception. This is used by the other assert functions.
 
static void fail (const xtd::ustring &message)
 Throws an xtd::tunit::assert_error exception. This is used by the other assert functions.
 
static void fail (const xtd::ustring &message, const xtd::diagnostics::stack_frame &stack_frame)
 Throws an xtd::tunit::assert_error exception. This is used by the other assert functions.
 
static void ignore ()
 Ignore current test. This is used by the other assert functions.
 
static void ignore (const xtd::diagnostics::stack_frame &stack_frame)
 Ignore current test. This is used by the other assert functions.
 
static void ignore (const xtd::ustring &message)
 Ignore current test. This is used by the other assert functions.
 
static void ignore (const xtd::ustring &message, const xtd::diagnostics::stack_frame &stack_frame)
 Ignore current test. This is used by the other assert functions.
 
static void succeed ()
 Generates a success with a generic message. This is used by the other assert functions.
 
static void succeed (const xtd::diagnostics::stack_frame &stack_frame)
 Generates a success with a generic message. This is used by the other assert functions.
 
static void succeed (const xtd::ustring &message)
 Generates a success with a generic message. This is used by the other assert functions.
 
static void succeed (const xtd::ustring &message, const xtd::diagnostics::stack_frame &stack_frame)
 Generates a success with a generic message. This is used by the other assert functions.
 

Protected Methods

static void error ()
 Throws an xtd::tunit::assert_error exception. This is used by the other assert functions.
 
static void error (const xtd::ustring &message)
 Throws an xtd::tunit::assert_error exception. This is used by the other assert functions.
 
static void error (const xtd::ustring &actual, const xtd::ustring &expected, const xtd::ustring &message, const xtd::diagnostics::stack_frame &stack_frame)
 Throws an xtd::tunit::assert_error exception. This is used by the other assert functions.
 
static void fail (const xtd::ustring &actual, const xtd::ustring &expected, const xtd::ustring &message, const xtd::diagnostics::stack_frame &stack_frame)
 Throws an xtd::tunit::assert_error exception. This is used by the other assert functions.
 
template<typename value_t >
static xtd::ustring to_string (const value_t &value)
 Convert specified value to xtd::ustring.
 
template<typename value_t >
static xtd::ustring to_string (const value_t *value)
 Convert specified value to xtd::ustring.
 
template<typename collection_t >
static xtd::ustring join_items (const collection_t &collection)
 Join specified collection into xtd::ustring.
 
static xtd::ustring join_items (const xtd::ustring &str)
 Join specified string into xtd::ustring.
 

Member Function Documentation

◆ abort() [1/4]

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

Abort current test. This is used by the other assert functions.

Examples
xtd::tunit::assert::abort(); // test throws an abort_error exception.
static void abort()
Abort current test. This is used by the other assert functions.
Examples
math_assume.cpp.

◆ abort() [2/4]

static void xtd::tunit::base_assert::abort ( const xtd::diagnostics::stack_frame stack_frame)
static

Abort current test. This is used by the other assert functions.

Parameters
stack_frameContains information about current file and current line.
Exceptions
xtd::tunit::assert_errorIf bad assertion.
Examples
xtd::tunit::assert::abort(csf_); // test throws an abort_error exception.
#define csf_
Provides information about the current stack frame.
Definition current_stack_frame.h:30

◆ abort() [3/4]

static void xtd::tunit::base_assert::abort ( const xtd::ustring message)
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.
Examples
xtd::tunit::assert::abort("User message..."); // test throws an abort_error exception.

◆ abort() [4/4]

static void xtd::tunit::base_assert::abort ( const xtd::ustring message,
const xtd::diagnostics::stack_frame stack_frame 
)
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.
stack_frameContains information about current file and current line.
Examples
xtd::tunit::assert::abort("User message...", csf_); // test throws an abort_error exception.

◆ error() [1/3]

static void xtd::tunit::base_assert::error ( )
staticprotected

Throws an xtd::tunit::assert_error exception. This is used by the other assert functions.

Exceptions
xtd::tunit::assert_errorIf bad assertion.
Examples
xtd::tunit::assert::error(); // test throws an assert_error exception.
static void error()
Throws an xtd::tunit::assert_error exception. This is used by the other assert functions.
Examples
math_valid.cpp.

◆ error() [2/3]

static void xtd::tunit::base_assert::error ( const xtd::ustring actual,
const xtd::ustring expected,
const xtd::ustring message,
const xtd::diagnostics::stack_frame stack_frame 
)
staticprotected

Throws an xtd::tunit::assert_error exception. This is used by the other assert functions.

Exceptions
xtd::tunit::assert_errorIf bad assertion.
Examples
xtd::tunit::assert::error(actual_str, expected_str, "User message...", csf_); // test throws an assert_error exception.

◆ error() [3/3]

static void xtd::tunit::base_assert::error ( const xtd::ustring message)
staticprotected

Throws an xtd::tunit::assert_error exception. This is used by the other assert functions.

Exceptions
xtd::tunit::assert_errorIf bad assertion.
Examples
xtd::tunit::assert::error("User message..."); // test throws an assert_error exception.

◆ fail() [1/5]

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

Throws an xtd::tunit::assert_error exception. This is used by the other assert functions.

Exceptions
xtd::tunit::assert_errorIf bad assertion.
Examples
xtd::tunit::assert::fail(); // test throws an assert_error exception.
static void fail()
Throws an xtd::tunit::assert_error exception. This is used by the other assert functions.
Examples
math_assert.cpp, math_assume.cpp, and math_valid.cpp.

◆ fail() [2/5]

static void xtd::tunit::base_assert::fail ( const xtd::diagnostics::stack_frame stack_frame)
static

Throws an xtd::tunit::assert_error exception. This is used by the other assert functions.

Parameters
stack_frameContains information about current file and current line.
Exceptions
xtd::tunit::assert_errorIf bad assertion.
Examples
xtd::tunit::assert::fail(csf_); // test throws an assert_error exception.

◆ fail() [3/5]

static void xtd::tunit::base_assert::fail ( const xtd::ustring actual,
const xtd::ustring expected,
const xtd::ustring message,
const xtd::diagnostics::stack_frame stack_frame 
)
staticprotected

Throws an xtd::tunit::assert_error exception. This is used by the other assert functions.

Exceptions
xtd::tunit::assert_errorIf bad assertion.
Examples
xtd::tunit::assert::fail(actual_str, expected_str, "User message...", csf_); // test throws an assert_error exception.

◆ fail() [4/5]

static void xtd::tunit::base_assert::fail ( const xtd::ustring message)
static

Throws an xtd::tunit::assert_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
xtd::tunit::assert_errorIf bad assertion.
Examples
xtd::tunit::assert::fail("User message..."); // test throws an assert_error exception.

◆ fail() [5/5]

static void xtd::tunit::base_assert::fail ( const xtd::ustring message,
const xtd::diagnostics::stack_frame stack_frame 
)
static

Throws an xtd::tunit::assert_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.
stack_frameContains information about current file and current line.
Exceptions
xtd::tunit::assert_errorIf bad assertion.
Examples
xtd::tunit::assert::fail("User message...", csf_); // test throws an assert_error exception.

◆ ignore() [1/4]

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

Ignore current test. This is used by the other assert functions.

Examples
xtd::tunit::assert::ignore(); // test throws an ignore_error exception.
static void ignore()
Ignore current test. This is used by the other assert functions.

◆ ignore() [2/4]

static void xtd::tunit::base_assert::ignore ( const xtd::diagnostics::stack_frame stack_frame)
static

Ignore current test. This is used by the other assert functions.

Parameters
stack_frameContains information about current file and current line.
Exceptions
xtd::tunit::assert_errorIf bad assertion.
Examples
xtd::tunit::assert::ignore(csf_); // test throws an ignore_error exception.

◆ ignore() [3/4]

static void xtd::tunit::base_assert::ignore ( const xtd::ustring message)
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.
Examples
xtd::tunit::assert::ignore("User message..."); // test throws an ignore_error exception.

◆ ignore() [4/4]

static void xtd::tunit::base_assert::ignore ( const xtd::ustring message,
const xtd::diagnostics::stack_frame stack_frame 
)
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.
stack_frameContains information about current file and current line.
Examples
xtd::tunit::assert::ignore("User message...", csf_); // test throws an ignore_error exception.

◆ join_items() [1/2]

template<typename collection_t >
static xtd::ustring xtd::tunit::base_assert::join_items ( const collection_t &  collection)
inlinestaticprotected

Join specified collection into xtd::ustring.

Parameters
collectionThe collection to join into xtd::ustring.
Returns
The xtd::ustring that contains the joined collection.

◆ join_items() [2/2]

static xtd::ustring xtd::tunit::base_assert::join_items ( const xtd::ustring str)
staticprotected

Join specified string into xtd::ustring.

Parameters
strThe joined to join into xtd::ustring.
Returns
The xtd::ustring that contains the joined string.

◆ succeed() [1/4]

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

Generates a success with a generic message. This is used by the other assert functions.

Examples
static void succeed()
Generates a success with a generic message. This is used by the other assert functions.
Examples
math_assert.cpp, math_assume.cpp, and math_valid.cpp.

◆ succeed() [2/4]

static void xtd::tunit::base_assert::succeed ( const xtd::diagnostics::stack_frame stack_frame)
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.
Examples

◆ succeed() [3/4]

static void xtd::tunit::base_assert::succeed ( const xtd::ustring message)
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.
Examples
xtd::tunit::assert::succeed("User message..."); // test ok.

◆ succeed() [4/4]

static void xtd::tunit::base_assert::succeed ( const xtd::ustring message,
const xtd::diagnostics::stack_frame stack_frame 
)
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.
stack_frameContains information about current file and current line.
Examples
xtd::tunit::assert::succeed("User message...", csf_); // test ok.

◆ to_string() [1/2]

template<typename value_t >
static xtd::ustring xtd::tunit::base_assert::to_string ( const value_t &  value)
inlinestaticprotected

Convert specified value to xtd::ustring.

Parameters
valueThe value to convert to xtd::ustring.
Returns
The xtd::ustring that contains the value.

◆ to_string() [2/2]

template<typename value_t >
static xtd::ustring xtd::tunit::base_assert::to_string ( const value_t *  value)
inlinestaticprotected

Convert specified value to xtd::ustring.

Parameters
valueThe value to convert to xtd::ustring.
Returns
The xtd::ustring that contains the value.

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