xtd 0.2.0
Loading...
Searching...
No Matches
xtd::tunit::assert Class Referencefinal
Inheritance diagram for xtd::tunit::assert:
xtd::tunit::base_assert xtd::static_object

Definition

The assert class contains a collection of static methods that implement the most common assertions used in xtd::tUnit.

Namespace
xtd::tunit
Library
xtd.tunit
Remarks
Assertions are central to unit testing in any of the xUnit frameworks, and xtd.tunit is no exception. xtd.tunit provides a rich set of assertions as static methods of the Assert class.
If an assertion fails, the method call does not return and an error is reported. If a test contains multiple assertions, any that follow the one that failed will not be executed. For this reason, it's usually best to try for one assertion per test.
Each method may be called without a message, with a simple text message or with a message and arguments. In the last case the message is formatted using the provided text and arguments.
Examples
This example show how to used some methods :
#include <xtd/xtd.tunit>
#include <stdexcept>
using namespace xtd::tunit;
namespace unit_tests {
// The class test must be declared with test_class_ helper.
class test_class_(test) {
void test_method_(test_case1) {
assert::is_true(true);
}
void test_method_(test_case2) {
assert::is_false(true);
}
void test_method_(test_case3) {
assert::does_not_throw([] {throw std::range_error("error");});
}
};
}
auto main()->int {
return console_unit_test().run();
}
// This code can produce the following output:
//
// Start 3 tests from 1 test case
// Run tests:
// SUCCEED test.test_case1 (0 ms total)
// FAILED test.test_case2 (0 ms total)
// Expected: false
// But was: true
// Stack Trace: in |---OMITTED---|/assert.cpp:14
// FAILED test.test_case3 (0 ms total)
// Expected: No Exception to be thrown
// But was: <std::range_error>
// Stack Trace: in |---OMITTED---|/assert.cpp:18
//
// Test results:
// SUCCEED 1 test.
// FAILED 2 tests.
// End 3 tests from 1 test case ran. (0 ms total)
The console_unit_test class is console unit test interface.
Definition console_unit_test.h:23
int32 run()
Runs all tests in this unit_test object and prints the result.
#define test_method_(method_name)
Add test method to class test.
Definition test_method_attribute.h:89
The tunit namespace contains a unit test library.
Definition abort_error.h:10

Public Static Methods

template<typename expected_t , typename actual_t >
static void are_equal (const expected_t &expected, const actual_t &actual)
 Asserts that two type are equal.
 
template<typename expected_t , typename actual_t >
static void are_equal (const expected_t &expected, const actual_t &actual, const xtd::diagnostics::stack_frame &stack_frame)
 Asserts that two type are equal.
 
template<typename expected_t , typename actual_t >
static void are_equal (const expected_t &expected, const actual_t &actual, const xtd::ustring &message)
 Asserts that two type are equal.
 
template<typename expected_t , typename actual_t >
static void are_equal (const expected_t &expected, const actual_t &actual, const xtd::ustring &message, const xtd::diagnostics::stack_frame &stack_frame)
 Asserts that two type are equal.
 
static void are_equal (float expected, float actual, float tolerance)
 Asserts that two type are equal.
 
static void are_equal (float expected, float actual, float tolerance, const xtd::diagnostics::stack_frame &stack_frame)
 Asserts that two type are equal.
 
static void are_equal (float expected, float &actual, float tolerance, const xtd::ustring &message)
 Asserts that two type are equal.
 
static void are_equal (float expected, float actual, float tolerance, const xtd::ustring &message, const xtd::diagnostics::stack_frame &stack_frame)
 Asserts that two type are equal.
 
static void are_equal (double expected, double actual, double tolerance)
 Asserts that two type are equal.
 
static void are_equal (double expected, double actual, double tolerance, const xtd::diagnostics::stack_frame &stack_frame)
 Asserts that two type are equal.
 
static void are_equal (double expected, double actual, double tolerance, const xtd::ustring &message)
 Asserts that two type are equal.
 
static void are_equal (double expected, double actual, double tolerance, const xtd::ustring &message, const xtd::diagnostics::stack_frame &stack_frame)
 Asserts that two type are equal.
 
static void are_equal (long double expected, long double actual, long double tolerance)
 Asserts that two type are equal.
 
static void are_equal (long double expected, long double actual, long double tolerance, const xtd::diagnostics::stack_frame &stack_frame)
 Asserts that two type are equal.
 
static void are_equal (long double expected, long double actual, long double tolerance, const xtd::ustring &message)
 Asserts that two type are equal.
 
static void are_equal (long double expected, long double actual, long double tolerance, const xtd::ustring &message, const xtd::diagnostics::stack_frame &stack_frame)
 Asserts that two type are equal.
 
template<typename expected_t , typename actual_t >
static void are_not_equal (const expected_t &expected, const actual_t &actual)
 Asserts that two type are not equal.
 
template<typename expected_t , typename actual_t >
static void are_not_equal (const expected_t &expected, const actual_t &actual, const xtd::diagnostics::stack_frame &stack_frame)
 Asserts that two type are not equal.
 
template<typename expected_t , typename actual_t >
static void are_not_equal (const expected_t &expected, const actual_t &actual, const xtd::ustring &message)
 Asserts that two type are not equal.
 
template<typename expected_t , typename actual_t >
static void are_not_equal (const expected_t &expected, const actual_t &actual, const xtd::ustring &message, const xtd::diagnostics::stack_frame &stack_frame)
 Asserts that two type are not equal.
 
template<typename expected_t , typename actual_t >
static void are_not_same (const expected_t &expected, const actual_t &actual)
 Asserts that two objects do refer to differents objects.
 
template<typename expected_t , typename actual_t >
static void are_not_same (const expected_t &expected, const actual_t &actual, const xtd::diagnostics::stack_frame &stack_frame)
 Asserts that two objects do refer to differents objects.
 
template<typename expected_t , typename actual_t >
static void are_not_same (const expected_t &expected, const actual_t &actual, const xtd::ustring &message)
 Asserts that two objects do refer to differents objects.
 
template<typename expected_t , typename actual_t >
static void are_not_same (const expected_t &expected, const actual_t &actual, const xtd::ustring &message, const xtd::diagnostics::stack_frame &stack_frame)
 Asserts that two objects do refer to differents objects.
 
template<typename expected_t , typename actual_t >
static void are_same (const expected_t &expected, const actual_t &actual)
 Asserts that two objects do refer to differents objects.
 
template<typename expected_t , typename actual_t >
static void are_same (const expected_t &expected, const actual_t &actual, const xtd::diagnostics::stack_frame &stack_frame)
 Asserts that two objects do refer to differents objects.
 
template<typename expected_t , typename actual_t >
static void are_same (const expected_t &expected, const actual_t &actual, const xtd::ustring &message)
 Asserts that two objects do refer to differents objects.
 
template<typename expected_t , typename actual_t >
static void are_same (const expected_t &expected, const actual_t &actual, const xtd::ustring &message, const xtd::diagnostics::stack_frame &stack_frame)
 Asserts that two objects do refer to differents objects.
 
template<typename item_t , typename collection_t >
static void contains (const item_t &item, const collection_t &collection)
 Asserts that collection contains an item.
 
template<typename item_t , typename collection_t >
static void contains (const item_t &item, const collection_t &collection, const xtd::diagnostics::stack_frame &stack_frame)
 Asserts that collection contains an item.
 
template<typename item_t , typename collection_t >
static void contains (const item_t &item, const collection_t &collection, const xtd::ustring &message)
 Asserts that collection contains an item.
 
template<typename item_t , typename collection_t >
static void contains (const item_t &item, const collection_t &collection, const xtd::ustring &message, const xtd::diagnostics::stack_frame &stack_frame)
 Asserts that collection contains an item.
 
static void does_not_throw (const std::function< void()> &statement)
 Asserts that the staement does not throw an exception.
 
static void does_not_throw (const std::function< void()> &statement, const xtd::diagnostics::stack_frame &stack_frame)
 Asserts that the staement does not throw an exception.
 
static void does_not_throw (const std::function< void()> &statement, const xtd::ustring &message)
 Asserts that the staement does not throw an exception.
 
static void does_not_throw (const std::function< void()> &statement, const xtd::ustring &message, const xtd::diagnostics::stack_frame &stack_frame)
 Asserts that the staement does not throw an exception.
 
template<typename value_t >
static void is_empty (const value_t &value)
 Asserts that collection contains an item.
 
template<typename value_t >
static void is_empty (const value_t &value, const xtd::diagnostics::stack_frame &stack_frame)
 Asserts that collection contains an item.
 
template<typename value_t >
static void is_empty (const value_t &value, const xtd::ustring &message)
 Asserts that collection contains an item.
 
template<typename value_t >
static void is_empty (const value_t &value, const xtd::ustring &message, const xtd::diagnostics::stack_frame &stack_frame)
 Asserts that collection contains an item.
 
static void is_false (bool condition)
 Asserts that ta condition is false.
 
static void is_false (bool condition, const xtd::diagnostics::stack_frame &stack_frame)
 Asserts that a condition is false.
 
static void is_false (bool condition, const xtd::ustring &message)
 Asserts that a condition is false.
 
static void is_false (bool condition, const xtd::ustring &message, const xtd::diagnostics::stack_frame &stack_frame)
 Asserts that a condition is false.
 
template<typename value1_t , typename value2_t >
static void is_greater (const value1_t &val1, const value2_t &val2)
 Asserts that the first value is greater than the second value.
 
template<typename value1_t , typename value2_t >
static void is_greater (const value1_t &val1, const value2_t &val2, const xtd::diagnostics::stack_frame &stack_frame)
 Asserts that the first value is greater than the second value.
 
template<typename value1_t , typename value2_t >
static void is_greater (const value1_t &val1, const value2_t &val2, const xtd::ustring &message)
 Asserts that the first value is greater than the second value.
 
template<typename value1_t , typename value2_t >
static void is_greater (const value1_t &val1, const value2_t &val2, const xtd::ustring &message, const xtd::diagnostics::stack_frame &stack_frame)
 Asserts that the first value is greater than the second value.
 
template<typename value1_t , typename value2_t >
static void is_greater_or_equal (const value1_t &val1, const value2_t &val2)
 Asserts that the first value is greater than or equal to the second value.
 
template<typename value1_t , typename value2_t >
static void is_greater_or_equal (const value1_t &val1, const value2_t &val2, const xtd::diagnostics::stack_frame &stack_frame)
 Asserts that the first value is greater than or equal to the second value.
 
template<typename value1_t , typename value2_t >
static void is_greater_or_equal (const value1_t &val1, const value2_t &val2, const xtd::ustring &message)
 Asserts that the first value is greater than or equal to the second value.
 
template<typename value1_t , typename value2_t >
static void is_greater_or_equal (const value1_t &val1, const value2_t &val2, const xtd::ustring &message, const xtd::diagnostics::stack_frame &stack_frame)
 Asserts that the first value is greater than or equal to the second value.
 
template<typename type_t , typename value_t >
static void is_instance_of (const value_t &value)
 Asserts that an object is of the type supplied or a derived type.
 
template<typename type_t , typename value_t >
static void is_instance_of (const value_t &value, const xtd::diagnostics::stack_frame &stack_frame)
 Asserts that an object is of the type supplied or a derived type.
 
template<typename type_t , typename value_t >
static void is_instance_of (const value_t &value, const xtd::ustring &message)
 Asserts that an object is of the type supplied or a derived type.
 
template<typename type_t , typename value_t >
static void is_instance_of (const value_t &value, const xtd::ustring &message, const xtd::diagnostics::stack_frame &stack_frame)
 Asserts that an object is of the type supplied or a derived type.
 
template<typename value1_t , typename value2_t >
static void is_less (const value1_t &val1, const value2_t &val2)
 Asserts that the first value is is_less than the second value.
 
template<typename value1_t , typename value2_t >
static void is_less (const value1_t &val1, const value2_t &val2, const xtd::diagnostics::stack_frame &stack_frame)
 Asserts that the first value is is_less than the second value.
 
template<typename value1_t , typename value2_t >
static void is_less (const value1_t &val1, const value2_t &val2, const xtd::ustring &message)
 Asserts that the first value is is_less than the second value.
 
template<typename value1_t , typename value2_t >
static void is_less (const value1_t &val1, const value2_t &val2, const xtd::ustring &message, const xtd::diagnostics::stack_frame &stack_frame)
 Asserts that the first value is is_less than the second value.
 
template<typename value1_t , typename value2_t >
static void is_less_or_equal (const value1_t &val1, const value2_t &val2)
 Asserts that the first value is is_less than or equal to the second value.
 
template<typename value1_t , typename value2_t >
static void is_less_or_equal (const value1_t &val1, const value2_t &val2, const xtd::diagnostics::stack_frame &stack_frame)
 Asserts that the first value is is_less than or equal to the second value.
 
template<typename value1_t , typename value2_t >
static void is_less_or_equal (const value1_t &val1, const value2_t &val2, const xtd::ustring &message)
 Asserts that the first value is is_less than or equal to the second value.
 
template<typename value1_t , typename value2_t >
static void is_less_or_equal (const value1_t &val1, const value2_t &val2, const xtd::ustring &message, const xtd::diagnostics::stack_frame &stack_frame)
 Asserts that the first value is is_less than or equal to the second value.
 
static void is_NaN (double value)
 that a value is NaN.
 
static void is_NaN (double value, const xtd::diagnostics::stack_frame &stack_frame)
 that a value is NaN.
 
static void is_NaN (double value, const xtd::ustring &message)
 Asserts that a value is NaN.
 
static void is_NaN (double value, const xtd::ustring &message, const xtd::diagnostics::stack_frame &stack_frame)
 Asserts that a value is NaN.
 
static void is_NaN (long double value)
 that a value is NaN.
 
static void is_NaN (long double value, const xtd::diagnostics::stack_frame &stack_frame)
 that a value is NaN.
 
static void is_NaN (long double value, const xtd::ustring &message)
 Asserts that a value is NaN.
 
static void is_NaN (long double value, const xtd::ustring &message, const xtd::diagnostics::stack_frame &stack_frame)
 Asserts that a value is NaN.
 
static void is_NaN (float value)
 that a value is NaN.
 
static void is_NaN (float value, const xtd::diagnostics::stack_frame &stack_frame)
 that a value is NaN.
 
static void is_NaN (float value, const xtd::ustring &message)
 Asserts that a value is NaN.
 
static void is_NaN (float value, const xtd::ustring &message, const xtd::diagnostics::stack_frame &stack_frame)
 Asserts that a value is NaN.
 
template<typename value_t >
static void is_negative (const value_t &value)
 Asserts that ta condition is negative.
 
template<typename value_t >
static void is_negative (const value_t &value, const xtd::diagnostics::stack_frame &stack_frame)
 Asserts that ta condition is negative.
 
template<typename value_t >
static void is_negative (const value_t &value, const xtd::ustring &message)
 Asserts that ta condition is negative.
 
template<typename value_t >
static void is_negative (const value_t &value, const xtd::ustring &message, const xtd::diagnostics::stack_frame &stack_frame)
 Asserts that ta condition is negative.
 
template<typename value_t >
static void is_not_empty (const value_t &value)
 Asserts that collection oes not contain any item.
 
template<typename value_t >
static void is_not_empty (const value_t &value, const xtd::diagnostics::stack_frame &stack_frame)
 Asserts that collection does not contain any item.
 
template<typename value_t >
static void is_not_empty (const value_t &value, const xtd::ustring &message)
 Asserts that collection does not contain any item.
 
template<typename value_t >
static void is_not_empty (const value_t &value, const xtd::ustring &message, const xtd::diagnostics::stack_frame &stack_frame)
 Asserts that collection does not contain any item.
 
template<typename type_t , typename value_t >
static void is_not_instance_of (const value_t &value)
 Asserts that an object is not of the type supplied or a derived type.
 
template<typename type_t , typename value_t >
static void is_not_instance_of (const value_t &value, const xtd::diagnostics::stack_frame &stack_frame)
 Asserts that an object is not of the type supplied or a derived type.
 
template<typename type_t , typename value_t >
static void is_not_instance_of (const value_t &value, const xtd::ustring &message)
 Asserts that an object is not of the type supplied or a derived type.
 
template<typename type_t , typename value_t >
static void is_not_instance_of (const value_t &value, const xtd::ustring &message, const xtd::diagnostics::stack_frame &stack_frame)
 Asserts that an object is not of the type supplied or a derived type.
 
template<typename pointer_t >
static void is_not_null (const pointer_t *pointer)
 Asserts that the pointer is not null.
 
template<typename pointer_t >
static void is_not_null (const pointer_t *pointer, const xtd::diagnostics::stack_frame &stack_frame)
 Asserts that the pointer is not null.
 
template<typename pointer_t >
static void is_not_null (const pointer_t *pointer, const xtd::ustring &message)
 Asserts that the pointer is not null.
 
template<typename pointer_t >
static void is_not_null (const pointer_t *pointer, const xtd::ustring &message, const xtd::diagnostics::stack_frame &stack_frame)
 Asserts that the pointer is not null.
 
template<typename optional_t >
static void is_not_null (const std::optional< optional_t > &opt)
 Asserts that the optional is not std::nullopt.
 
template<typename optional_t >
static void is_not_null (const std::optional< optional_t > &opt, const xtd::diagnostics::stack_frame &stack_frame)
 Asserts that the optional is not std::nullopt.
 
template<typename optional_t >
static void is_not_null (const std::optional< optional_t > &opt, const xtd::ustring &message)
 Asserts that the optional is not std::nullopt.
 
template<typename optional_t >
static void is_not_null (const std::optional< optional_t > &opt, const xtd::ustring &message, const xtd::diagnostics::stack_frame &stack_frame)
 Asserts that the optional is not std::nullopt.
 
template<typename pointer_t >
static void is_not_null (const std::unique_ptr< pointer_t > &pointer)
 Asserts that the pointer is not null.
 
template<typename pointer_t >
static void is_not_null (const std::unique_ptr< pointer_t > &pointer, const xtd::diagnostics::stack_frame &stack_frame)
 Asserts that the pointer is not null.
 
template<typename pointer_t >
static void is_not_null (const std::unique_ptr< pointer_t > &pointer, const xtd::ustring &message)
 Asserts that the pointer is not null.
 
template<typename pointer_t >
static void is_not_null (const std::unique_ptr< pointer_t > &pointer, const xtd::ustring &message, const xtd::diagnostics::stack_frame &stack_frame)
 Asserts that the pointer is not null.
 
template<typename pointer_t >
static void is_not_null (const std::shared_ptr< pointer_t > &pointer)
 Asserts that the pointer is not null.
 
template<typename pointer_t >
static void is_not_null (const std::shared_ptr< pointer_t > &pointer, const xtd::diagnostics::stack_frame &stack_frame)
 Asserts that the pointer is not null.
 
template<typename pointer_t >
static void is_not_null (const std::shared_ptr< pointer_t > &pointer, const xtd::ustring &message)
 Asserts that the pointer is not null.
 
template<typename pointer_t >
static void is_not_null (const std::shared_ptr< pointer_t > &pointer, const xtd::ustring &message, const xtd::diagnostics::stack_frame &stack_frame)
 Asserts that the pointer is not null.
 
template<typename pointer_t >
static void is_not_null (const std::weak_ptr< pointer_t > &pointer)
 Asserts that the pointer is not null.
 
template<typename pointer_t >
static void is_not_null (const std::weak_ptr< pointer_t > &pointer, const xtd::diagnostics::stack_frame &stack_frame)
 Asserts that the pointer is not null.
 
template<typename pointer_t >
static void is_not_null (const std::weak_ptr< pointer_t > &pointer, const xtd::ustring &message)
 Asserts that the pointer is not null.
 
template<typename pointer_t >
static void is_not_null (const std::weak_ptr< pointer_t > &pointer, const xtd::ustring &message, const xtd::diagnostics::stack_frame &stack_frame)
 Asserts that the pointer is not null.
 
static void is_not_null (std::nullptr_t pointer)
 Asserts that the pointer is not null.
 
static void is_not_null (std::nullptr_t pointer, const xtd::diagnostics::stack_frame &stack_frame)
 Asserts that the pointer is not null.
 
static void is_not_null (std::nullptr_t pointer, const xtd::ustring &message)
 Asserts that the pointer is not null.
 
static void is_not_null (std::nullptr_t pointer, const xtd::ustring &message, const xtd::diagnostics::stack_frame &stack_frame)
 Asserts that the pointer is not null.
 
template<typename value_t >
static void is_not_zero (const value_t &value)
 Asserts that ta condition is not zero.
 
template<typename value_t >
static void is_not_zero (const value_t &value, const xtd::diagnostics::stack_frame &stack_frame)
 Asserts that ta condition is not zero.
 
template<typename value_t >
static void is_not_zero (const value_t &value, const xtd::ustring &message)
 Asserts that ta condition is not zero.
 
template<typename value_t >
static void is_not_zero (const value_t &value, const xtd::ustring &message, const xtd::diagnostics::stack_frame &stack_frame)
 Asserts that ta condition is not zero.
 
template<typename pointer_t >
static void is_null (const pointer_t *pointer)
 Asserts that the pointer is null.
 
template<typename pointer_t >
static void is_null (const pointer_t *pointer, const xtd::diagnostics::stack_frame &stack_frame)
 Asserts that the pointer is null.
 
template<typename pointer_t >
static void is_null (const pointer_t *pointer, const xtd::ustring &message)
 Asserts that the pointer is null.
 
template<typename pointer_t >
static void is_null (const pointer_t *pointer, const xtd::ustring &message, const xtd::diagnostics::stack_frame &stack_frame)
 Asserts that the pointer is null.
 
template<typename optional_t >
static void is_null (const std::optional< optional_t > &opt)
 Asserts that the optional is std::nullopt.
 
template<typename optional_t >
static void is_null (const std::optional< optional_t > &opt, const xtd::diagnostics::stack_frame &stack_frame)
 Asserts that the optional is std::nullopt.
 
template<typename optional_t >
static void is_null (const std::optional< optional_t > &opt, const xtd::ustring &message)
 Asserts that the optional is std::nullopt.
 
template<typename optional_t >
static void is_null (const std::optional< optional_t > &opt, const xtd::ustring &message, const xtd::diagnostics::stack_frame &stack_frame)
 Asserts that the optional is std::nullopt.
 
template<typename pointer_t >
static void is_null (const std::unique_ptr< pointer_t > &pointer)
 Asserts that the pointer is null.
 
template<typename pointer_t >
static void is_null (const std::unique_ptr< pointer_t > &pointer, const xtd::diagnostics::stack_frame &stack_frame)
 Asserts that the pointer is null.
 
template<typename pointer_t >
static void is_null (const std::unique_ptr< pointer_t > &pointer, const xtd::ustring &message)
 Asserts that the pointer is null.
 
template<typename pointer_t >
static void is_null (const std::unique_ptr< pointer_t > &pointer, const xtd::ustring &message, const xtd::diagnostics::stack_frame &stack_frame)
 Asserts that the pointer is null.
 
template<typename pointer_t >
static void is_null (const std::shared_ptr< pointer_t > &pointer)
 Asserts that the pointer is null.
 
template<typename pointer_t >
static void is_null (const std::shared_ptr< pointer_t > &pointer, const xtd::diagnostics::stack_frame &stack_frame)
 Asserts that the pointer is null.
 
template<typename pointer_t >
static void is_null (const std::shared_ptr< pointer_t > &pointer, const xtd::ustring &message)
 Asserts that the pointer is null.
 
template<typename pointer_t >
static void is_null (const std::shared_ptr< pointer_t > &pointer, const xtd::ustring &message, const xtd::diagnostics::stack_frame &stack_frame)
 Asserts that the pointer is null.
 
template<typename pointer_t >
static void is_null (const std::weak_ptr< pointer_t > &pointer)
 Asserts that the pointer is null.
 
template<typename pointer_t >
static void is_null (const std::weak_ptr< pointer_t > &pointer, const xtd::diagnostics::stack_frame &stack_frame)
 Asserts that the pointer is null.
 
template<typename pointer_t >
static void is_null (const std::weak_ptr< pointer_t > &pointer, const xtd::ustring &message)
 Asserts that the pointer is null.
 
template<typename pointer_t >
static void is_null (const std::weak_ptr< pointer_t > &pointer, const xtd::ustring &message, const xtd::diagnostics::stack_frame &stack_frame)
 Asserts that the pointer is null.
 
static void is_null (std::nullptr_t pointer)
 Asserts that the pointer is null.
 
static void is_null (std::nullptr_t pointer, const xtd::diagnostics::stack_frame &stack_frame)
 Asserts that the pointer is null.
 
static void is_null (std::nullptr_t pointer, const xtd::ustring &message)
 Asserts that the pointer is null.
 
static void is_null (std::nullptr_t pointer, const xtd::ustring &message, const xtd::diagnostics::stack_frame &stack_frame)
 Asserts that the pointer is null.
 
template<typename value_t >
static void is_positive (const value_t &value)
 Asserts that ta condition is positive.
 
template<typename value_t >
static void is_positive (const value_t &value, const xtd::diagnostics::stack_frame &stack_frame)
 Asserts that ta condition is positive.
 
template<typename value_t >
static void is_positive (const value_t &value, const xtd::ustring &message)
 Asserts that ta condition is positive.
 
template<typename value_t >
static void is_positive (const value_t &value, const xtd::ustring &message, const xtd::diagnostics::stack_frame &stack_frame)
 Asserts that ta condition is positive.
 
static void is_true (bool condition)
 Asserts that ta condition is true.
 
static void is_true (bool condition, const xtd::diagnostics::stack_frame &stack_frame)
 Asserts that a condition is true.
 
static void is_true (bool condition, const xtd::ustring &message)
 Asserts that a condition is true.
 
static void is_true (bool condition, const xtd::ustring &message, const xtd::diagnostics::stack_frame &stack_frame)
 Asserts that a condition is true.
 
template<typename value_t >
static void is_zero (const value_t &value)
 Asserts that ta condition is zero.
 
template<typename value_t >
static void is_zero (const value_t &value, const xtd::diagnostics::stack_frame &stack_frame)
 Asserts that ta condition is zero.
 
template<typename value_t >
static void is_zero (const value_t &value, const xtd::ustring &message)
 Asserts that ta condition is zero.
 
template<typename value_t >
static void is_zero (const value_t &value, const xtd::ustring &message, const xtd::diagnostics::stack_frame &stack_frame)
 Asserts that ta condition is zero.
 
template<typename exception_t >
static void throws (const std::function< void()> &statement)
 Asserts that the statement throws a particular exception when called.
 
template<typename exception_t >
static void throws (const std::function< void()> &statement, const xtd::diagnostics::stack_frame &stack_frame)
 Asserts that the statement throws a particular exception when called.
 
template<typename exception_t >
static void throws (const std::function< void()> &statement, const xtd::ustring &message)
 Asserts that the statement throws a particular exception when called.
 
template<typename exception_t >
static void throws (const std::function< void()> &statement, const xtd::ustring &message, const xtd::diagnostics::stack_frame &stack_frame)
 Asserts that the statement throws a particular exception when called.
 
static void throws_any (const std::function< void()> &statement)
 Asserts that the staement does not throw an exception.
 
static void throws_any (const std::function< void()> &statement, const xtd::diagnostics::stack_frame &stack_frame)
 Asserts that the staement does not throw an exception.
 
static void throws_any (const std::function< void()> &statement, const xtd::ustring &message)
 Asserts that the staement does not throw an exception.
 
static void throws_any (const std::function< void()> &statement, const xtd::ustring &message, const xtd::diagnostics::stack_frame &stack_frame)
 Asserts that the staement does not throw an exception.
 

Additional Inherited Members

- Static Public Member Functions inherited from xtd::tunit::base_assert
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.
 
- Static Protected Member Functions inherited from xtd::tunit::base_assert
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

◆ are_equal() [1/16]

template<typename expected_t , typename actual_t >
static void xtd::tunit::assert::are_equal ( const expected_t &  expected,
const actual_t &  actual 
)
inlinestatic

Asserts that two type are equal.

Parameters
expectedthe expected value.
actualthe actual value.
Exceptions
xtd::tunit::assert_errorIf bad assertion.
Examples
xtd::tunit::assert::are_equal(24, int(24)); // test ok.
xtd::tunit::assert::are_equal(23, int(24)); // test throws an assert_error exception.
static void are_equal(const expected_t &expected, const actual_t &actual)
Asserts that two type are equal.
Definition assert.h:49

◆ are_equal() [2/16]

template<typename expected_t , typename actual_t >
static void xtd::tunit::assert::are_equal ( const expected_t &  expected,
const actual_t &  actual,
const xtd::diagnostics::stack_frame stack_frame 
)
inlinestatic

Asserts that two type are equal.

Parameters
expectedthe expected value.
actualthe actual value.
stack_frameContains information about current file and current line.
Exceptions
xtd::tunit::assert_errorIf bad assertion.
Examples
xtd::tunit::assert::are_equal(24, int(24), csf_); // test ok.
xtd::tunit::assert::are_equal(23, int(24), csf_); // test throws an assert_error exception.
#define csf_
Provides information about the current stack frame.
Definition current_stack_frame.h:30

◆ are_equal() [3/16]

template<typename expected_t , typename actual_t >
static void xtd::tunit::assert::are_equal ( const expected_t &  expected,
const actual_t &  actual,
const xtd::ustring message 
)
inlinestatic

Asserts that two type are equal.

Parameters
expectedthe expected value.
actualthe actual value.
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::are_equal(24, int(24), "User message..."); // test ok.
xtd::tunit::assert::are_equal(23, int(24), "User message..."); // test throws an assert_error exception.

◆ are_equal() [4/16]

template<typename expected_t , typename actual_t >
static void xtd::tunit::assert::are_equal ( const expected_t &  expected,
const actual_t &  actual,
const xtd::ustring message,
const xtd::diagnostics::stack_frame stack_frame 
)
inlinestatic

Asserts that two type are equal.

Parameters
expectedthe expected value.
actualthe actual value.
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::are_equal(24, int(24), "User message...", csf_); // test ok.
xtd::tunit::assert::are_equal(23, int(24), "User message...", csf_); // test throws an assert_error exception.

◆ are_equal() [5/16]

static void xtd::tunit::assert::are_equal ( double  expected,
double  actual,
double  tolerance 
)
static

Asserts that two type are equal.

Parameters
expectedthe expected value.
actualthe actual value.
toleranceIndicates a tolerance within which they will be considered as equal.
Exceptions
xtd::tunit::assert_errorIf bad assertion.
Examples
double d = 0.00007999999999;
xtd::tunit::assert::are_equal_(0.00008, d, 0.0000000000001); // test ok.
xtd::tunit::assert::are_equal_(0.00008, d, 0.00000000000001); // test throws an assert_error exception.
@ d
The D key.

◆ are_equal() [6/16]

static void xtd::tunit::assert::are_equal ( double  expected,
double  actual,
double  tolerance,
const xtd::diagnostics::stack_frame stack_frame 
)
static

Asserts that two type are equal.

Parameters
expectedthe expected value.
actualthe actual value.
toleranceIndicates a tolerance within which they will be considered as equal.
stack_frameContains information about current file and current line.
Exceptions
xtd::tunit::assert_errorIf bad assertion.
Examples
double d = 0.00007999999999;
xtd::tunit::assert::are_equal_(0.00008, d, 0.0000000000001, csf_); // test ok.
xtd::tunit::assert::are_equal_(0.00008, d, 0.00000000000001, csf_); // test throws an assert_error exception.

◆ are_equal() [7/16]

static void xtd::tunit::assert::are_equal ( double  expected,
double  actual,
double  tolerance,
const xtd::ustring message 
)
static

Asserts that two type are equal.

Parameters
expectedthe expected value.
actualthe actual value.
toleranceIndicates a tolerance within which they will be considered as equal.
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
double d = 0.00007999999999;
xtd::tunit::assert::are_equal_(0.00008, d, 0.0000000000001, "User message..."); // test ok.
xtd::tunit::assert::are_equal_(0.00008, d, 0.00000000000001, "User message..."); // test throws an assert_error exception.

◆ are_equal() [8/16]

static void xtd::tunit::assert::are_equal ( double  expected,
double  actual,
double  tolerance,
const xtd::ustring message,
const xtd::diagnostics::stack_frame stack_frame 
)
static

Asserts that two type are equal.

Parameters
expectedthe expected value.
actualthe actual value.
toleranceIndicates a tolerance within which they will be considered as equal.
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
double d = 0.00007999999999;
xtd::tunit::assert::are_equal_(0.00008, d, 0.0000000000001, "User message...", csf_); // test ok.
xtd::tunit::assert::are_equal_(0.00008, d, 0.00000000000001, "User message...", csf_); // test throws an assert_error exception.

◆ are_equal() [9/16]

static void xtd::tunit::assert::are_equal ( float  expected,
float &  actual,
float  tolerance,
const xtd::ustring message 
)
static

Asserts that two type are equal.

Parameters
expectedthe expected value.
actualthe actual value.
toleranceIndicates a tolerance within which they will be considered as equal.
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
float f = 0.00007999999999f;
xtd::tunit::assert::are_equal_(0.00008f, f, 0.0000000000001f, "User message..."); // test ok.
xtd::tunit::assert::are_equal_(0.00008f, f, 0.00000000000001f, "User message..."); // test throws an assert_error exception.
@ f
The F key.

◆ are_equal() [10/16]

static void xtd::tunit::assert::are_equal ( float  expected,
float  actual,
float  tolerance 
)
static

Asserts that two type are equal.

Parameters
expectedthe expected value.
actualthe actual value.
toleranceIndicates a tolerance within which they will be considered as equal.
Exceptions
xtd::tunit::assert_errorIf bad assertion.
Examples
float f = 0.00007999999999f;
xtd::tunit::assert::are_equal_(0.00008f, f, 0.0000000000001f); // test ok.
xtd::tunit::assert::are_equal_(0.00008f, f, 0.00000000000001f); // test throws an assert_error exception.

◆ are_equal() [11/16]

static void xtd::tunit::assert::are_equal ( float  expected,
float  actual,
float  tolerance,
const xtd::diagnostics::stack_frame stack_frame 
)
static

Asserts that two type are equal.

Parameters
expectedthe expected value.
actualthe actual value.
toleranceIndicates a tolerance within which they will be considered as equal.
stack_frameContains information about current file and current line.
Exceptions
xtd::tunit::assert_errorIf bad assertion.
Examples
float f = 0.00007999999999f;
xtd::tunit::assert::are_equal_(0.00008f, f, 0.0000000000001f, csf_); // test ok.
xtd::tunit::assert::are_equal_(0.00008f, f, 0.00000000000001f, csf_); // test throws an assert_error exception.

◆ are_equal() [12/16]

static void xtd::tunit::assert::are_equal ( float  expected,
float  actual,
float  tolerance,
const xtd::ustring message,
const xtd::diagnostics::stack_frame stack_frame 
)
static

Asserts that two type are equal.

Parameters
expectedthe expected value.
actualthe actual value.
toleranceIndicates a tolerance within which they will be considered as equal.
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
float f = 0.00007999999999f;
xtd::tunit::assert::are_equal_(0.00008f, f, 0.0000000000001f, "User message...", csf_); // test ok.
xtd::tunit::assert::are_equal_(0.00008f, f, 0.00000000000001f, "User message...", csf_); // test throws an assert_error exception.

◆ are_equal() [13/16]

static void xtd::tunit::assert::are_equal ( long double  expected,
long double  actual,
long double  tolerance 
)
static

Asserts that two type are equal.

Parameters
expectedthe expected value.
actualthe actual value.
toleranceIndicates a tolerance within which they will be considered as equal.
Exceptions
xtd::tunit::assert_errorIf bad assertion.
Examples
long double ld = 0.00007999999999;
xtd::tunit::assert::are_equal_(0.00008l, ld, 0.0000000000001l); // test ok.
xtd::tunit::assert::are_equal_(0.00008l, ld, 0.00000000000001l); // test throws an assert_error exception.

◆ are_equal() [14/16]

static void xtd::tunit::assert::are_equal ( long double  expected,
long double  actual,
long double  tolerance,
const xtd::diagnostics::stack_frame stack_frame 
)
static

Asserts that two type are equal.

Parameters
expectedthe expected value.
actualthe actual value.
toleranceIndicates a tolerance within which they will be considered as equal.
stack_frameContains information about current file and current line.
Exceptions
xtd::tunit::assert_errorIf bad assertion.
Examples
long double ld = 0.00007999999999;
xtd::tunit::assert::are_equal_(0.00008l, ld, 0.0000000000001l, csf_); // test ok.
xtd::tunit::assert::are_equal_(0.00008l, ld, 0.00000000000001l, csf_); // test throws an assert_error exception.

◆ are_equal() [15/16]

static void xtd::tunit::assert::are_equal ( long double  expected,
long double  actual,
long double  tolerance,
const xtd::ustring message 
)
static

Asserts that two type are equal.

Parameters
expectedthe expected value.
actualthe actual value.
toleranceIndicates a tolerance within which they will be considered as equal.
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
long double ld = 0.00007999999999;
xtd::tunit::assert::are_equal_(0.00008l, ld, 0.0000000000001l, "User message..."); // test ok.
xtd::tunit::assert::are_equal_(0.00008l, ld, 0.00000000000001l, "User message..."); // test throws an assert_error exception.

◆ are_equal() [16/16]

static void xtd::tunit::assert::are_equal ( long double  expected,
long double  actual,
long double  tolerance,
const xtd::ustring message,
const xtd::diagnostics::stack_frame stack_frame 
)
static

Asserts that two type are equal.

Parameters
expectedthe expected value.
actualthe actual value.
toleranceIndicates a tolerance within which they will be considered as equal.
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
long double ld = 0.00007999999999;
xtd::tunit::assert::are_equal_(0.00008l, ld, 0.0000000000001l, "User message...", csf_); // test ok.
xtd::tunit::assert::are_equal_(0.00008l, ld, 0.00000000000001l, "User message...", csf_); // test throws an assert_error exception.

◆ are_not_equal() [1/4]

template<typename expected_t , typename actual_t >
static void xtd::tunit::assert::are_not_equal ( const expected_t &  expected,
const actual_t &  actual 
)
inlinestatic

Asserts that two type are not equal.

Parameters
expectedthe expected value.
actualthe actual value.
Exceptions
xtd::tunit::assert_errorIf bad assertion.
Examples
xtd::tunit::assert::are_not_equal(23, int(24)); // test ok.
xtd::tunit::assert::are_not_equal(24, int(24)); // test throws an assert_error exception.
static void are_not_equal(const expected_t &expected, const actual_t &actual)
Asserts that two type are not equal.
Definition assert.h:273

◆ are_not_equal() [2/4]

template<typename expected_t , typename actual_t >
static void xtd::tunit::assert::are_not_equal ( const expected_t &  expected,
const actual_t &  actual,
const xtd::diagnostics::stack_frame stack_frame 
)
inlinestatic

Asserts that two type are not equal.

Parameters
expectedthe expected value.
actualthe actual value.
stack_frameContains information about current file and current line.
Exceptions
xtd::tunit::assert_errorIf bad assertion.
Examples
xtd::tunit::assert::are_not_equal(23, int(24), csf_); // test ok.
xtd::tunit::assert::are_not_equal(24, int(24), csf_); // test throws an assert_error exception.

◆ are_not_equal() [3/4]

template<typename expected_t , typename actual_t >
static void xtd::tunit::assert::are_not_equal ( const expected_t &  expected,
const actual_t &  actual,
const xtd::ustring message 
)
inlinestatic

Asserts that two type are not equal.

Parameters
expectedthe expected value.
actualthe actual value.
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::are_not_equal(23, int(24), "User message..."); // test ok.
xtd::tunit::assert::are_not_equal(24, int(24), "User message..."); // test throws an assert_error exception.

◆ are_not_equal() [4/4]

template<typename expected_t , typename actual_t >
static void xtd::tunit::assert::are_not_equal ( const expected_t &  expected,
const actual_t &  actual,
const xtd::ustring message,
const xtd::diagnostics::stack_frame stack_frame 
)
inlinestatic

Asserts that two type are not equal.

Parameters
expectedthe expected value.
actualthe actual value.
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::are_not_equal(23, int(24), "User message...", csf_); // test ok.
xtd::tunit::assert::are_not_equal(24, int(24), "User message...", csf_); // test throws an assert_error exception.

◆ are_not_same() [1/4]

template<typename expected_t , typename actual_t >
static void xtd::tunit::assert::are_not_same ( const expected_t &  expected,
const actual_t &  actual 
)
inlinestatic

Asserts that two objects do refer to differents objects.

Parameters
expectedthe expected value.
actualthe actual value.
Exceptions
xtd::tunit::assert_errorIf bad assertion.
Examples
int a = 24;
int& b = a;
int c= 24;
xtd::tunit::assert::are_not_same(b, a); // test throws an assert_error exception.
static void are_not_same(const expected_t &expected, const actual_t &actual)
Asserts that two objects do refer to differents objects.
Definition assert.h:340
@ a
The A key.
@ c
The C key.
@ b
The B key.

◆ are_not_same() [2/4]

template<typename expected_t , typename actual_t >
static void xtd::tunit::assert::are_not_same ( const expected_t &  expected,
const actual_t &  actual,
const xtd::diagnostics::stack_frame stack_frame 
)
inlinestatic

Asserts that two objects do refer to differents objects.

Parameters
expectedthe expected value.
actualthe actual value.
stack_frameContains information about current file and current line.
Exceptions
xtd::tunit::assert_errorIf bad assertion.
Examples
int a = 24;
int& b = a;
int c= 24;
xtd::tunit::assert::are_not_same(b, a, stack_frame); // test throws an assert_error exception.

◆ are_not_same() [3/4]

template<typename expected_t , typename actual_t >
static void xtd::tunit::assert::are_not_same ( const expected_t &  expected,
const actual_t &  actual,
const xtd::ustring message 
)
inlinestatic

Asserts that two objects do refer to differents objects.

Parameters
expectedthe expected value.
actualthe actual value.
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
int a = 24;
int& b = a;
int c= 24;
xtd::tunit::assert::are_not_same(c, a, "User message..."); // test ok.
xtd::tunit::assert::are_not_same(b, a, "User message..."); // test throws an assert_error exception.

◆ are_not_same() [4/4]

template<typename expected_t , typename actual_t >
static void xtd::tunit::assert::are_not_same ( const expected_t &  expected,
const actual_t &  actual,
const xtd::ustring message,
const xtd::diagnostics::stack_frame stack_frame 
)
inlinestatic

Asserts that two objects do refer to differents objects.

Parameters
expectedthe expected value.
actualthe actual value.
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
int a = 24;
int& b = a;
int c= 24;
xtd::tunit::assert::are_not_same(c, a, "User message...", csf_); // test ok.
xtd::tunit::assert::are_not_same(b, a, "User message...", stack_frame); // test throws an assert_error exception.

◆ are_same() [1/4]

template<typename expected_t , typename actual_t >
static void xtd::tunit::assert::are_same ( const expected_t &  expected,
const actual_t &  actual 
)
inlinestatic

Asserts that two objects do refer to differents objects.

Parameters
expectedthe expected value.
actualthe actual value.
Exceptions
xtd::tunit::assert_errorIf bad assertion.
Examples
int a = 24;
int& b = a;
int c= 24;
xtd::tunit::assert::are_same(c, a); // test throws an assert_error exception.
static void are_same(const expected_t &expected, const actual_t &actual)
Asserts that two objects do refer to differents objects.
Definition assert.h:406

◆ are_same() [2/4]

template<typename expected_t , typename actual_t >
static void xtd::tunit::assert::are_same ( const expected_t &  expected,
const actual_t &  actual,
const xtd::diagnostics::stack_frame stack_frame 
)
inlinestatic

Asserts that two objects do refer to differents objects.

Parameters
expectedthe expected value.
actualthe actual value.
stack_frameContains information about current file and current line.
Exceptions
xtd::tunit::assert_errorIf bad assertion.
Examples
int a = 24;
int& b = a;
int c= 24;
xtd::tunit::assert::are_same(c, a, csf_); // test throws an assert_error exception.

◆ are_same() [3/4]

template<typename expected_t , typename actual_t >
static void xtd::tunit::assert::are_same ( const expected_t &  expected,
const actual_t &  actual,
const xtd::ustring message 
)
inlinestatic

Asserts that two objects do refer to differents objects.

Parameters
expectedthe expected value.
actualthe actual value.
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
int a = 24;
int& b = a;
int c= 24;
xtd::tunit::assert::are_same(b, a, "User message..."); // test ok.
xtd::tunit::assert::are_same(c, a, "User message..."); // test throws an assert_error exception.

◆ are_same() [4/4]

template<typename expected_t , typename actual_t >
static void xtd::tunit::assert::are_same ( const expected_t &  expected,
const actual_t &  actual,
const xtd::ustring message,
const xtd::diagnostics::stack_frame stack_frame 
)
inlinestatic

Asserts that two objects do refer to differents objects.

Parameters
expectedthe expected value.
actualthe actual value.
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
int a = 24;
int& b = a;
int c= 24;
xtd::tunit::assert::are_same(b, a, "User message...", csf_); // test ok.
xtd::tunit::assert::are_same(c, a, "User message...", csf_); // test throws an assert_error exception.

◆ contains() [1/4]

template<typename item_t , typename collection_t >
static void xtd::tunit::assert::contains ( const item_t &  item,
const collection_t &  collection 
)
inlinestatic

Asserts that collection contains an item.

Parameters
itemobject to verify.
collectionthat contains object.
Exceptions
xtd::tunit::assert_errorIf bad assertion.
Examples
std::vector<int> v1 = {0, 1, 2, 3};
xtd::tunit::assert::contains(2, v1); // test ok.
xtd::tunit::assert::contains(4, v1); // test throws an assert_error exception.
static void contains(const item_t &item, const collection_t &collection)
Asserts that collection contains an item.
Definition assert.h:470

◆ contains() [2/4]

template<typename item_t , typename collection_t >
static void xtd::tunit::assert::contains ( const item_t &  item,
const collection_t &  collection,
const xtd::diagnostics::stack_frame stack_frame 
)
inlinestatic

Asserts that collection contains an item.

Parameters
itemobject to verify.
collectionthat contains object.
stack_frameContains information about current file and current line.
Exceptions
xtd::tunit::assert_errorIf bad assertion.
Examples
std::vector<int> v1 = {0, 1, 2, 3};
xtd::tunit::assert::contains(2, v1, csf_); // test ok.
xtd::tunit::assert::contains(4, v1, csf_); // test throws an assert_error exception.

◆ contains() [3/4]

template<typename item_t , typename collection_t >
static void xtd::tunit::assert::contains ( const item_t &  item,
const collection_t &  collection,
const xtd::ustring message 
)
inlinestatic

Asserts that collection contains an item.

Parameters
itemobject to verify.
collectionthat contains object.
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
std::vector<int> v1 = {0, 1, 2, 3};
xtd::tunit::assert::contains(2, v1, "User message..."); // test ok.
xtd::tunit::assert::contains(4, v1, "User message..."); // test throws an assert_error exception.

◆ contains() [4/4]

template<typename item_t , typename collection_t >
static void xtd::tunit::assert::contains ( const item_t &  item,
const collection_t &  collection,
const xtd::ustring message,
const xtd::diagnostics::stack_frame stack_frame 
)
inlinestatic

Asserts that collection contains an item.

Parameters
itemobject to verify.
collectionthat contains object.
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
std::vector<int> v1 = {0, 1, 2, 3};
xtd::tunit::assert::contains(2, v1, "User message...", csf_); // test ok.
xtd::tunit::assert::contains(4, v1, "User message...", csf_); // test throws an assert_error exception.

◆ does_not_throw() [1/4]

static void xtd::tunit::assert::does_not_throw ( const std::function< void()> &  statement)
static

Asserts that the staement does not throw an exception.

Parameters
statementThe statement that verify.
Exceptions
xtd::tunit::assert_errorIf bad assertion.
Examples
std::vector<int> v1 = {1, 2, 3, 4};
xtd::tunit::assert::does_not_throw([&] {v1.at(2);}); // test ok.
xtd::tunit::assert::does_not_throw([&] {v1.at(5);}); // test throws an assert_error exception.
static void does_not_throw(const std::function< void()> &statement)
Asserts that the staement does not throw an exception.

◆ does_not_throw() [2/4]

static void xtd::tunit::assert::does_not_throw ( const std::function< void()> &  statement,
const xtd::diagnostics::stack_frame stack_frame 
)
static

Asserts that the staement does not throw an exception.

Parameters
statementThe statement that verify.
stack_frameContains information about current file and current line.
Exceptions
xtd::tunit::assert_errorIf bad assertion.
Examples
std::vector<int> v1 = {1, 2, 3, 4};
xtd::tunit::assert::does_not_throw([&] {v1.at(2);}, csf_); // test ok.
xtd::tunit::assert::does_not_throw([&] {v1.at(5);}, csf_); // test throws an assert_error exception.

◆ does_not_throw() [3/4]

static void xtd::tunit::assert::does_not_throw ( const std::function< void()> &  statement,
const xtd::ustring message 
)
static

Asserts that the staement does not throw an exception.

Parameters
statementThe statement that verify.
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
std::vector<int> v1 = {1, 2, 3, 4};
xtd::tunit::assert::does_not_throw([&] {v1.at(2);}, "User message..."); // test ok.
xtd::tunit::assert::does_not_throw([&] {v1.at(5);}, "User message..."); // test throws an assert_error exception.

◆ does_not_throw() [4/4]

static void xtd::tunit::assert::does_not_throw ( const std::function< void()> &  statement,
const xtd::ustring message,
const xtd::diagnostics::stack_frame stack_frame 
)
static

Asserts that the staement does not throw an exception.

Parameters
statementThe statement that verify.
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
std::vector<int> v1 = {1, 2, 3, 4};
xtd::tunit::assert::does_not_throw([&] {v1.at(2);}, "User message...", csf_); // test ok.
xtd::tunit::assert::does_not_throw([&] {v1.at(5);}, "User message...", csf_); // test throws an assert_error exception.

◆ is_empty() [1/4]

template<typename value_t >
static void xtd::tunit::assert::is_empty ( const value_t &  value)
inlinestatic

Asserts that collection contains an item.

Parameters
valueThe value to check is empty.
Exceptions
xtd::tunit::assert_errorIf bad assertion.
Examples
std::vector<int> v1;
std::vector<int> v2 = {0, 1, 2, 3};
xtd::tunit::assert::is_empty(v2); // test throws an assert_error exception.
static void is_empty(const value_t &value)
Asserts that collection contains an item.
Definition assert.h:598

◆ is_empty() [2/4]

template<typename value_t >
static void xtd::tunit::assert::is_empty ( const value_t &  value,
const xtd::diagnostics::stack_frame stack_frame 
)
inlinestatic

Asserts that collection contains an item.

Parameters
valueThe value to check is empty.
stack_frameContains information about current file and current line.
Exceptions
xtd::tunit::assert_errorIf bad assertion.
Examples
std::vector<int> v1;
std::vector<int> v2 = {0, 1, 2, 3};
xtd::tunit::assert::is_empty(v2, csf_); // test throws an assert_error exception.

◆ is_empty() [3/4]

template<typename value_t >
static void xtd::tunit::assert::is_empty ( const value_t &  value,
const xtd::ustring message 
)
inlinestatic

Asserts that collection contains an item.

Parameters
valueThe value to check is empty.
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
std::vector<int> v1;
std::vector<int> v2 = {0, 1, 2, 3};
xtd::tunit::assert::is_empty(v1, "User message..."); // test ok.
xtd::tunit::assert::is_empty(v2, "User message..."); // test throws an assert_error exception.

◆ is_empty() [4/4]

template<typename value_t >
static void xtd::tunit::assert::is_empty ( const value_t &  value,
const xtd::ustring message,
const xtd::diagnostics::stack_frame stack_frame 
)
inlinestatic

Asserts that collection contains an item.

Parameters
valueThe value to check is empty.
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
std::vector<int> v1;
std::vector<int> v2 = {0, 1, 2, 3};
xtd::tunit::assert::is_empty(v1, "User message...", csf_); // test ok.
xtd::tunit::assert::is_empty(v2, "User message...", csf_); // test throws an assert_error exception.

◆ is_false() [1/4]

static void xtd::tunit::assert::is_false ( bool  condition)
static

Asserts that ta condition is false.

Parameters
conditionThe condition to check is false.
Exceptions
xtd::tunit::assert_errorIf bad assertion.
Examples
std::string s1 = "Anything";
std::string s2;
xtd::tunit::assert::is_false(std::empty(s1)); // test ok.
xtd::tunit::assert::is_false(std::empty(s2)); // test throws an assert_error exception.
static void is_false(bool condition)
Asserts that ta condition is false.

◆ is_false() [2/4]

static void xtd::tunit::assert::is_false ( bool  condition,
const xtd::diagnostics::stack_frame stack_frame 
)
static

Asserts that a condition is false.

Parameters
conditionThe condition to check is false.
stack_frameContains information about current file and current line.
Exceptions
xtd::tunit::assert_errorIf bad assertion.
Examples
std::string s1 = "Anything";
std::string s2;
xtd::tunit::assert::is_false(std::empty(s1), csf_); // test ok.
xtd::tunit::assert::is_false(std::empty(s2), csf_); // test throws an assert_error exception.

◆ is_false() [3/4]

static void xtd::tunit::assert::is_false ( bool  condition,
const xtd::ustring message 
)
static

Asserts that a condition is false.

Parameters
conditionThe condition to check is false.
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
std::string s1 = "Anything";
std::string s2;
xtd::tunit::assert::is_false(std::empty(s1), "User message..."); // test ok.
xtd::tunit::assert::is_false(std::empty(s2), "User message..."); // test throws an assert_error exception.

◆ is_false() [4/4]

static void xtd::tunit::assert::is_false ( bool  condition,
const xtd::ustring message,
const xtd::diagnostics::stack_frame stack_frame 
)
static

Asserts that a condition is false.

Parameters
conditionThe condition to check is false.
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
std::string s1 = "Anything";
std::string s2;
xtd::tunit::assert::is_false(std::empty(s1), "User message...", csf_); // test ok.
xtd::tunit::assert::is_false(std::empty(s2), "User message...", csf_); // test throws an assert_error exception.

◆ is_greater() [1/4]

template<typename value1_t , typename value2_t >
static void xtd::tunit::assert::is_greater ( const value1_t &  val1,
const value2_t &  val2 
)
inlinestatic

Asserts that the first value is greater than the second value.

Parameters
val1the first value.
val2the second value.
Exceptions
xtd::tunit::assert_errorIf bad assertion.
Examples
xtd::tunit::assert::is_greater(24, 12); // test ok.
xtd::tunit::assert::is_greater(24, 48); // test throws an assert_error exception.
static void is_greater(const value1_t &val1, const value2_t &val2)
Asserts that the first value is greater than the second value.
Definition assert.h:727

◆ is_greater() [2/4]

template<typename value1_t , typename value2_t >
static void xtd::tunit::assert::is_greater ( const value1_t &  val1,
const value2_t &  val2,
const xtd::diagnostics::stack_frame stack_frame 
)
inlinestatic

Asserts that the first value is greater than the second value.

Parameters
val1the first value.
val2the second value.
stack_frameContains information about current file and current line.
Exceptions
xtd::tunit::assert_errorIf bad assertion.
Examples
xtd::tunit::assert::is_greater(24, 12, csf_); // test ok.
xtd::tunit::assert::is_greater(24, 48, csf_); // test throws an assert_error exception.

◆ is_greater() [3/4]

template<typename value1_t , typename value2_t >
static void xtd::tunit::assert::is_greater ( const value1_t &  val1,
const value2_t &  val2,
const xtd::ustring message 
)
inlinestatic

Asserts that the first value is greater than the second value.

Parameters
val1the first value.
val2the second value.
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::is_greater(24, 12, "User message..."); // test ok.
xtd::tunit::assert::is_greater(24, 48, "User message..."); // test throws an assert_error exception.

◆ is_greater() [4/4]

template<typename value1_t , typename value2_t >
static void xtd::tunit::assert::is_greater ( const value1_t &  val1,
const value2_t &  val2,
const xtd::ustring message,
const xtd::diagnostics::stack_frame stack_frame 
)
inlinestatic

Asserts that the first value is greater than the second value.

Parameters
val1the first value.
val2the second value.
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::is_greater(24, 12, "User message...", csf_); // test ok.
xtd::tunit::assert::is_greater(24, 48, "User message...", csf_); // test throws an assert_error exception.

◆ is_greater_or_equal() [1/4]

template<typename value1_t , typename value2_t >
static void xtd::tunit::assert::is_greater_or_equal ( const value1_t &  val1,
const value2_t &  val2 
)
inlinestatic

Asserts that the first value is greater than or equal to the second value.

Parameters
val1the first value.
val2the second value.
Exceptions
xtd::tunit::assert_errorIf bad assertion.
Examples
xtd::tunit::assert::is_greater_or_equal(24, 48); // test throws an assert_error exception.
static void is_greater_or_equal(const value1_t &val1, const value2_t &val2)
Asserts that the first value is greater than or equal to the second value.
Definition assert.h:792

◆ is_greater_or_equal() [2/4]

template<typename value1_t , typename value2_t >
static void xtd::tunit::assert::is_greater_or_equal ( const value1_t &  val1,
const value2_t &  val2,
const xtd::diagnostics::stack_frame stack_frame 
)
inlinestatic

Asserts that the first value is greater than or equal to the second value.

Parameters
val1the first value.
val2the second value.
stack_frameContains information about current file and current line.
Exceptions
xtd::tunit::assert_errorIf bad assertion.
Examples
xtd::tunit::assert::is_greater_or_equal(24, 48, csf_); // test throws an assert_error exception.

◆ is_greater_or_equal() [3/4]

template<typename value1_t , typename value2_t >
static void xtd::tunit::assert::is_greater_or_equal ( const value1_t &  val1,
const value2_t &  val2,
const xtd::ustring message 
)
inlinestatic

Asserts that the first value is greater than or equal to the second value.

Parameters
val1the first value.
val2the second value.
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::is_greater_or_equal(24, 12, "User message..."); // test ok.
xtd::tunit::assert::is_greater_or_equal(24, 24, "User message..."); // test ok.
xtd::tunit::assert::is_greater_or_equal(24, 48, "User message..."); // test throws an assert_error exception.

◆ is_greater_or_equal() [4/4]

template<typename value1_t , typename value2_t >
static void xtd::tunit::assert::is_greater_or_equal ( const value1_t &  val1,
const value2_t &  val2,
const xtd::ustring message,
const xtd::diagnostics::stack_frame stack_frame 
)
inlinestatic

Asserts that the first value is greater than or equal to the second value.

Parameters
val1the first value.
val2the second value.
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::is_greater_or_equal(24, 12, "User message...", csf_); // test ok.
xtd::tunit::assert::is_greater_or_equal(24, 24, "User message...", csf_); // test ok.
xtd::tunit::assert::is_greater_or_equal(24, 48, "User message...", csf_); // test throws an assert_error exception.

◆ is_instance_of() [1/4]

template<typename type_t , typename value_t >
static void xtd::tunit::assert::is_instance_of ( const value_t &  value)
inlinestatic

Asserts that an object is of the type supplied or a derived type.

Parameters
valueThe object to verify
Exceptions
xtd::tunit::assert_errorIf bad assertion.
Examples
std::invalid_argument except("invalid argument");
xtd::tunit::assert::is_instance_of<std::logic_error>(except); // test ok.
xtd::tunit::assert::is_instance_of<std::bad_cast>(except); // test throws an assert_error exception.

◆ is_instance_of() [2/4]

template<typename type_t , typename value_t >
static void xtd::tunit::assert::is_instance_of ( const value_t &  value,
const xtd::diagnostics::stack_frame stack_frame 
)
inlinestatic

Asserts that an object is of the type supplied or a derived type.

Parameters
valueThe object to verify
stack_frameContains information about current file and current line.
Exceptions
xtd::tunit::assert_errorIf bad assertion.
Examples
std::invalid_argument except("invalid argument");
xtd::tunit::assert::is_instance_of<std::logic_error>(except, csf_); // test ok.
xtd::tunit::assert::is_instance_of<std::bad_cast>(except, csf_); // test throws an assert_error exception.

◆ is_instance_of() [3/4]

template<typename type_t , typename value_t >
static void xtd::tunit::assert::is_instance_of ( const value_t &  value,
const xtd::ustring message 
)
inlinestatic

Asserts that an object is of the type supplied or a derived type.

Parameters
valueThe object to verify
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
std::invalid_argument except("invalid argument");
xtd::tunit::assert::is_instance_of<std::logic_error>(except, "User message..."); // test ok.
xtd::tunit::assert::is_instance_of<std::bad_cast>(except, "User message..."); // test throws an assert_error exception.

◆ is_instance_of() [4/4]

template<typename type_t , typename value_t >
static void xtd::tunit::assert::is_instance_of ( const value_t &  value,
const xtd::ustring message,
const xtd::diagnostics::stack_frame stack_frame 
)
inlinestatic

Asserts that an object is of the type supplied or a derived type.

Parameters
valueThe object to verify
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
std::invalid_argument except("invalid argument");
xtd::tunit::assert::is_instance_of<std::logic_error>(except, "User message...", csf_); // test ok.
xtd::tunit::assert::is_instance_of<std::bad_cast>(except, "User message...", csf_); // test throws an assert_error exception.

◆ is_less() [1/4]

template<typename value1_t , typename value2_t >
static void xtd::tunit::assert::is_less ( const value1_t &  val1,
const value2_t &  val2 
)
inlinestatic

Asserts that the first value is is_less than the second value.

Parameters
val1the first value.
val2the second value.
Exceptions
xtd::tunit::assert_errorIf bad assertion.
Examples
xtd::tunit::assert::is_less(24, 48); // test ok.
xtd::tunit::assert::is_less(24, 12); // test throws an assert_error exception.
static void is_less(const value1_t &val1, const value2_t &val2)
Asserts that the first value is is_less than the second value.
Definition assert.h:914

◆ is_less() [2/4]

template<typename value1_t , typename value2_t >
static void xtd::tunit::assert::is_less ( const value1_t &  val1,
const value2_t &  val2,
const xtd::diagnostics::stack_frame stack_frame 
)
inlinestatic

Asserts that the first value is is_less than the second value.

Parameters
val1the first value.
val2the second value.
stack_frameContains information about current file and current line.
Exceptions
xtd::tunit::assert_errorIf bad assertion.
Examples
xtd::tunit::assert::is_less(24, 48, csf_); // test ok.
xtd::tunit::assert::is_less(24, 12, csf_); // test throws an assert_error exception.

◆ is_less() [3/4]

template<typename value1_t , typename value2_t >
static void xtd::tunit::assert::is_less ( const value1_t &  val1,
const value2_t &  val2,
const xtd::ustring message 
)
inlinestatic

Asserts that the first value is is_less than the second value.

Parameters
val1the first value.
val2the second value.
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::is_less(24, 48, "User message..."); // test ok.
xtd::tunit::assert::is_less(24, 12, "User message..."); // test throws an assert_error exception.

◆ is_less() [4/4]

template<typename value1_t , typename value2_t >
static void xtd::tunit::assert::is_less ( const value1_t &  val1,
const value2_t &  val2,
const xtd::ustring message,
const xtd::diagnostics::stack_frame stack_frame 
)
inlinestatic

Asserts that the first value is is_less than the second value.

Parameters
val1the first value.
val2the second value.
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::is_less(24, 48, "User message...", csf_); // test ok.
xtd::tunit::assert::is_less(24, 12, "User message...", csf_); // test throws an assert_error exception.

◆ is_less_or_equal() [1/4]

template<typename value1_t , typename value2_t >
static void xtd::tunit::assert::is_less_or_equal ( const value1_t &  val1,
const value2_t &  val2 
)
inlinestatic

Asserts that the first value is is_less than or equal to the second value.

Parameters
val1the first value.
val2the second value.
Exceptions
xtd::tunit::assert_errorIf bad assertion.
Examples
xtd::tunit::assert::is_less_or_equal(24, 12); // test throws an assert_error exception.
static void is_less_or_equal(const value1_t &val1, const value2_t &val2)
Asserts that the first value is is_less than or equal to the second value.
Definition assert.h:979

◆ is_less_or_equal() [2/4]

template<typename value1_t , typename value2_t >
static void xtd::tunit::assert::is_less_or_equal ( const value1_t &  val1,
const value2_t &  val2,
const xtd::diagnostics::stack_frame stack_frame 
)
inlinestatic

Asserts that the first value is is_less than or equal to the second value.

Parameters
val1the first value.
val2the second value.
stack_frameContains information about current file and current line.
Exceptions
xtd::tunit::assert_errorIf bad assertion.
Examples
xtd::tunit::assert::is_less_or_equal(24, 12, csf_); // test throws an assert_error exception.

◆ is_less_or_equal() [3/4]

template<typename value1_t , typename value2_t >
static void xtd::tunit::assert::is_less_or_equal ( const value1_t &  val1,
const value2_t &  val2,
const xtd::ustring message 
)
inlinestatic

Asserts that the first value is is_less than or equal to the second value.

Parameters
val1the first value.
val2the second value.
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::is_less_or_equal(24, 48, "User message..."); // test ok.
xtd::tunit::assert::is_less_or_equal(24, 24, "User message..."); // test ok.
xtd::tunit::assert::is_less_or_equal(24, 12, "User message..."); // test throws an assert_error exception.

◆ is_less_or_equal() [4/4]

template<typename value1_t , typename value2_t >
static void xtd::tunit::assert::is_less_or_equal ( const value1_t &  val1,
const value2_t &  val2,
const xtd::ustring message,
const xtd::diagnostics::stack_frame stack_frame 
)
inlinestatic

Asserts that the first value is is_less than or equal to the second value.

Parameters
val1the first value.
val2the second value.
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::is_less_or_equal(24, 48, "User message...", csf_); // test ok.
xtd::tunit::assert::is_less_or_equal(24, 24, "User message...", csf_); // test ok.
xtd::tunit::assert::is_less_or_equal(24, 12, "User message...", csf_); // test throws an assert_error exception.

◆ is_NaN() [1/12]

static void xtd::tunit::assert::is_NaN ( double  value)
static

that a value is NaN.

Parameters
valueThe value to check is NaN.
Exceptions
xtd::tunit::assert_errorIf bad assertion.
Examples
double v1 = std::numeric_limits<double>::quiet_NaN();
double v2 = 3.14159265358979323846;
xtd::tunit::assert::is_NaN(v2); // test throws an assert_error exception.
static void is_NaN(double value)
that a value is NaN.

◆ is_NaN() [2/12]

static void xtd::tunit::assert::is_NaN ( double  value,
const xtd::diagnostics::stack_frame stack_frame 
)
static

that a value is NaN.

Parameters
valueThe value to check is NaN.
stack_frameContains information about current file and current line.
Exceptions
xtd::tunit::assert_errorIf bad assertion.
Examples
double v1 = std::numeric_limits<double>::quiet_NaN();
double v2 = 3.14159265358979323846;
xtd::tunit::assert::is_NaN(v2, csf_); // test throws an assert_error exception.

◆ is_NaN() [3/12]

static void xtd::tunit::assert::is_NaN ( double  value,
const xtd::ustring message 
)
static

Asserts that a value is NaN.

Parameters
valueThe value to check is NaN.
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
double v1 = std::numeric_limits<double>::quiet_NaN();
double v2 = 3.14159265358979323846;
xtd::tunit::assert::is_NaN(v1, "User message..."); // test ok.
xtd::tunit::assert::is_NaN(v2, "User message..."); // test throws an assert_error exception.

◆ is_NaN() [4/12]

static void xtd::tunit::assert::is_NaN ( double  value,
const xtd::ustring message,
const xtd::diagnostics::stack_frame stack_frame 
)
static

Asserts that a value is NaN.

Parameters
valueThe value to check is NaN.
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
double v1 = std::numeric_limits<double>::quiet_NaN();
double v2 = 3.14159265358979323846;
xtd::tunit::assert::is_NaN(v1, "User message...", csf_); // test ok.
xtd::tunit::assert::is_NaN(v2, "User message...", csf_); // test throws an assert_error exception.

◆ is_NaN() [5/12]

static void xtd::tunit::assert::is_NaN ( float  value)
static

that a value is NaN.

Parameters
valueThe value to check is NaN.
Exceptions
xtd::tunit::assert_errorIf bad assertion.
Examples
float v1 = std::numeric_limits<float>::quiet_NaN();
float v2 = 3.14159265358979323846;
xtd::tunit::assert::is_NaN(v2); // test throws an assert_error exception.

◆ is_NaN() [6/12]

static void xtd::tunit::assert::is_NaN ( float  value,
const xtd::diagnostics::stack_frame stack_frame 
)
static

that a value is NaN.

Parameters
valueThe value to check is NaN.
stack_frameContains information about current file and current line.
Exceptions
xtd::tunit::assert_errorIf bad assertion.
Examples
float v1 = std::numeric_limits<float>::quiet_NaN();
float v2 = 3.14159265358979323846;
xtd::tunit::assert::is_NaN(v2, csf_); // test throws an assert_error exception.

◆ is_NaN() [7/12]

static void xtd::tunit::assert::is_NaN ( float  value,
const xtd::ustring message 
)
static

Asserts that a value is NaN.

Parameters
valueThe value to check is NaN.
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
float v1 = std::numeric_limits<float>::quiet_NaN();
float v2 = 3.14159265358979323846;
xtd::tunit::assert::is_NaN(v1, "User message..."); // test ok.
xtd::tunit::assert::is_NaN(v2, "User message..."); // test throws an assert_error exception.

◆ is_NaN() [8/12]

static void xtd::tunit::assert::is_NaN ( float  value,
const xtd::ustring message,
const xtd::diagnostics::stack_frame stack_frame 
)
static

Asserts that a value is NaN.

Parameters
valueThe value to check is NaN.
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
float v1 = std::numeric_limits<float>::quiet_NaN();
float v2 = 3.14159265358979323846;
xtd::tunit::assert::is_NaN(v1, "User message...", csf_); // test ok.
xtd::tunit::assert::is_NaN(v2, "User message...", csf_); // test throws an assert_error exception.

◆ is_NaN() [9/12]

static void xtd::tunit::assert::is_NaN ( long double  value)
static

that a value is NaN.

Parameters
valueThe value to check is NaN.
Exceptions
xtd::tunit::assert_errorIf bad assertion.
Examples
long double v1 = std::numeric_limits<double>::quiet_NaN();
long double v2 = 3.14159265358979323846l;
xtd::tunit::assert::is_NaN(v2); // test throws an assert_error exception.

◆ is_NaN() [10/12]

static void xtd::tunit::assert::is_NaN ( long double  value,
const xtd::diagnostics::stack_frame stack_frame 
)
static

that a value is NaN.

Parameters
valueThe value to check is NaN.
stack_frameContains information about current file and current line.
Exceptions
xtd::tunit::assert_errorIf bad assertion.
Examples
long double v1 = std::numeric_limits<long double>::quiet_NaN();
long double v2 = 3.14159265358979323846l;
xtd::tunit::assert::is_NaN(v2, csf_); // test throws an assert_error exception.

◆ is_NaN() [11/12]

static void xtd::tunit::assert::is_NaN ( long double  value,
const xtd::ustring message 
)
static

Asserts that a value is NaN.

Parameters
valueThe value to check is NaN.
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
long double v1 = std::numeric_limits<long double>::quiet_NaN();
long double v2 = 3.14159265358979323846l;
xtd::tunit::assert::is_NaN(v1, "User message..."); // test ok.
xtd::tunit::assert::is_NaN(v2, "User message..."); // test throws an assert_error exception.

◆ is_NaN() [12/12]

static void xtd::tunit::assert::is_NaN ( long double  value,
const xtd::ustring message,
const xtd::diagnostics::stack_frame stack_frame 
)
static

Asserts that a value is NaN.

Parameters
valueThe value to check is NaN.
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
long double v1 = std::numeric_limits<long double>::quiet_NaN();
long double v2 = 3.14159265358979323846l;
xtd::tunit::assert::is_NaN(v1, "User message...", csf_); // test ok.
xtd::tunit::assert::is_NaN(v2, "User message...", csf_); // test throws an assert_error exception.

◆ is_negative() [1/4]

template<typename value_t >
static void xtd::tunit::assert::is_negative ( const value_t &  value)
inlinestatic

Asserts that ta condition is negative.

Parameters
valueThe value to check is negative.
Exceptions
xtd::tunit::assert_errorIf bad assertion.
Examples
int i1 = -1;
int i2 = 1;
xtd::tunit::assert::is_negative(i2); // test throws an assert_error exception.
static void is_negative(const value_t &value)
Asserts that ta condition is negative.
Definition assert.h:1192

◆ is_negative() [2/4]

template<typename value_t >
static void xtd::tunit::assert::is_negative ( const value_t &  value,
const xtd::diagnostics::stack_frame stack_frame 
)
inlinestatic

Asserts that ta condition is negative.

Parameters
valueThe value to check is negative.
stack_frameContains information about current file and current line.
Exceptions
xtd::tunit::assert_errorIf bad assertion.
Examples
int i1 = -1;
int i2 = 1;
xtd::tunit::assert::is_negative(i2, csf_); // test throws an assert_error exception.

◆ is_negative() [3/4]

template<typename value_t >
static void xtd::tunit::assert::is_negative ( const value_t &  value,
const xtd::ustring message 
)
inlinestatic

Asserts that ta condition is negative.

Parameters
valueThe value to check is negative.
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
int i1 = -1;
int i2 = 1;
xtd::tunit::assert::is_negative(i1, "User message..."); // test ok.
xtd::tunit::assert::is_negative(i2, "User message..."); // test throws an assert_error exception.

◆ is_negative() [4/4]

template<typename value_t >
static void xtd::tunit::assert::is_negative ( const value_t &  value,
const xtd::ustring message,
const xtd::diagnostics::stack_frame stack_frame 
)
inlinestatic

Asserts that ta condition is negative.

Parameters
valueThe value to check is negative.
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
int i1 = -1;
int i2 = 1;
xtd::tunit::assert::is_negative(i1, "User message...", csf_); // test ok.
xtd::tunit::assert::is_negative(i2, "User message...", csf_); // test throws an assert_error exception.

◆ is_not_empty() [1/4]

template<typename value_t >
static void xtd::tunit::assert::is_not_empty ( const value_t &  value)
inlinestatic

Asserts that collection oes not contain any item.

Parameters
valueThe value to check is empty.
Exceptions
xtd::tunit::assert_errorIf bad assertion.
Examples
std::vector<int> v1 = {0, 1, 2, 3};
std::vector<int> v2;
xtd::tunit::assert::is_not_empty(v2); // test throws an assert_error exception.
static void is_not_empty(const value_t &value)
Asserts that collection oes not contain any item.
Definition assert.h:1250

◆ is_not_empty() [2/4]

template<typename value_t >
static void xtd::tunit::assert::is_not_empty ( const value_t &  value,
const xtd::diagnostics::stack_frame stack_frame 
)
inlinestatic

Asserts that collection does not contain any item.

Parameters
valueThe value to check is empty.
stack_frameContains information about current file and current line.
Exceptions
xtd::tunit::assert_errorIf bad assertion.
Examples
std::vector<int> v1 = {0, 1, 2, 3};
std::vector<int> v2;
xtd::tunit::assert::is_not_empty(v2, csf_); // test throws an assert_error exception.

◆ is_not_empty() [3/4]

template<typename value_t >
static void xtd::tunit::assert::is_not_empty ( const value_t &  value,
const xtd::ustring message 
)
inlinestatic

Asserts that collection does not contain any item.

Parameters
valueThe value to check is empty.
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
std::vector<int> v1 = {0, 1, 2, 3};
std::vector<int> v2;
xtd::tunit::assert::is_not_empty(v1, "User message..."); // test ok.
xtd::tunit::assert::is_not_empty(v2, "User message..."); // test throws an assert_error exception.

◆ is_not_empty() [4/4]

template<typename value_t >
static void xtd::tunit::assert::is_not_empty ( const value_t &  value,
const xtd::ustring message,
const xtd::diagnostics::stack_frame stack_frame 
)
inlinestatic

Asserts that collection does not contain any item.

Parameters
valueThe value to check is empty.
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
std::vector<int> v1 = {0, 1, 2, 3};
std::vector<int> v2;
xtd::tunit::assert::is_not_empty(v1, "User message...", csf_); // test ok.
xtd::tunit::assert::is_not_empty(v2, "User message...", csf_); // test throws an assert_error exception.

◆ is_not_instance_of() [1/4]

template<typename type_t , typename value_t >
static void xtd::tunit::assert::is_not_instance_of ( const value_t &  value)
inlinestatic

Asserts that an object is not of the type supplied or a derived type.

Parameters
valueThe object to verify
Exceptions
xtd::tunit::assert_errorIf bad assertion.
Examples
std::invalid_argument except("invalid argument");
xtd::tunit::assert::is_not_instance_of<std::bad_cast>(except); // test ok.
xtd::tunit::assert::is_not_instance_of<std::logic_error>(except); // test throws an assert_error exception.

◆ is_not_instance_of() [2/4]

template<typename type_t , typename value_t >
static void xtd::tunit::assert::is_not_instance_of ( const value_t &  value,
const xtd::diagnostics::stack_frame stack_frame 
)
inlinestatic

Asserts that an object is not of the type supplied or a derived type.

Parameters
valueThe object to verify
stack_frameContains information about current file and current line.
Exceptions
xtd::tunit::assert_errorIf bad assertion.
Examples
std::invalid_argument except("invalid argument");
xtd::tunit::assert::is_not_instance_of<std::bad_cast>(except, csf_); // test ok.
xtd::tunit::assert::is_not_instance_of<std::logic_error>(except, csf_); // test throws an assert_error exception.

◆ is_not_instance_of() [3/4]

template<typename type_t , typename value_t >
static void xtd::tunit::assert::is_not_instance_of ( const value_t &  value,
const xtd::ustring message 
)
inlinestatic

Asserts that an object is not of the type supplied or a derived type.

Parameters
valueThe object to verify
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
std::invalid_argument except("invalid argument");
xtd::tunit::assert::is_not_instance_of<std::bad_cast>(except, "User message..."); // test ok.
xtd::tunit::assert::is_not_instance_of<std::logic_error>(except, "User message..."); // test throws an assert_error exception.

◆ is_not_instance_of() [4/4]

template<typename type_t , typename value_t >
static void xtd::tunit::assert::is_not_instance_of ( const value_t &  value,
const xtd::ustring message,
const xtd::diagnostics::stack_frame stack_frame 
)
inlinestatic

Asserts that an object is not of the type supplied or a derived type.

Parameters
valueThe object to verify
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
std::invalid_argument except("invalid argument");
xtd::tunit::assert::is_not_instance_of<std::bad_cast>(except, "User message...", csf_); // test ok.
xtd::tunit::assert::is_not_instance_of<std::logic_error>(except, "User message...", csf_); // test throws an assert_error exception.

◆ is_not_null() [1/24]

template<typename pointer_t >
static void xtd::tunit::assert::is_not_null ( const pointer_t *  pointer)
inlinestatic

Asserts that the pointer is not null.

Parameters
pointerThe pointer to check is null.
Exceptions
xtd::tunit::assert_errorIf bad assertion.
Examples
std::string str = "Anything";
std::string* s1 = &str;
std::string* s2 = nullptr;
xtd::tunit::assert::is_not_null(s2); // test throws an assert_error exception.
static void is_not_null(const pointer_t *pointer)
Asserts that the pointer is not null.
Definition assert.h:1387

◆ is_not_null() [2/24]

template<typename pointer_t >
static void xtd::tunit::assert::is_not_null ( const pointer_t *  pointer,
const xtd::diagnostics::stack_frame stack_frame 
)
inlinestatic

Asserts that the pointer is not null.

Parameters
pointerThe pointer to check is null.
stack_frameContains information about current file and current line.
Exceptions
xtd::tunit::assert_errorIf bad assertion.
Examples
std::string str = "Anything";
std::string* s1 = &str;
std::string* s2 = nullptr;
xtd::tunit::assert::is_not_null(s2, csf_); // test throws an assert_error exception.

◆ is_not_null() [3/24]

template<typename pointer_t >
static void xtd::tunit::assert::is_not_null ( const pointer_t *  pointer,
const xtd::ustring message 
)
inlinestatic

Asserts that the pointer is not null.

Parameters
pointerThe pointer to check is null.
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
std::string str = "Anything";
std::string* s1 = &str;
std::string* s2 = nullptr;
xtd::tunit::assert::is_not_null(s1, "User message..."); // test ok.
xtd::tunit::assert::is_not_null(s2, "User message..."); // test throws an assert_error exception.

◆ is_not_null() [4/24]

template<typename pointer_t >
static void xtd::tunit::assert::is_not_null ( const pointer_t *  pointer,
const xtd::ustring message,
const xtd::diagnostics::stack_frame stack_frame 
)
inlinestatic

Asserts that the pointer is not null.

Parameters
pointerThe pointer to check is null.
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
std::string str = "Anything";
std::string* s1 = &str;
std::string* s2 = nullptr;
xtd::tunit::assert::is_not_null(s1, "User message...", csf_); // test ok.
xtd::tunit::assert::is_not_null(s2, "User message...", csf_); // test throws an assert_error exception.

◆ is_not_null() [5/24]

template<typename optional_t >
static void xtd::tunit::assert::is_not_null ( const std::optional< optional_t > &  opt)
inlinestatic

Asserts that the optional is not std::nullopt.

Parameters
optThe optional to check is std::nullopt.
Exceptions
xtd::tunit::assert_errorIf bad assertion.
Examples
std::optional<std::string> s1 = "Anything";
std::optional<std::string> s2;
xtd::tunit::assert::is_not_null(s2); // test throws an assert_error exception.

◆ is_not_null() [6/24]

template<typename optional_t >
static void xtd::tunit::assert::is_not_null ( const std::optional< optional_t > &  opt,
const xtd::diagnostics::stack_frame stack_frame 
)
inlinestatic

Asserts that the optional is not std::nullopt.

Parameters
optThe optional to check is std::nullopt.
stack_frameContains information about current file and current line.
Exceptions
xtd::tunit::assert_errorIf bad assertion.
Examples
std::optional<std::string> s1 = "Anything";
std::optional<std::string> s2;
xtd::tunit::assert::is_not_null(s2, csf_); // test throws an assert_error exception.

◆ is_not_null() [7/24]

template<typename optional_t >
static void xtd::tunit::assert::is_not_null ( const std::optional< optional_t > &  opt,
const xtd::ustring message 
)
inlinestatic

Asserts that the optional is not std::nullopt.

Parameters
optThe optional to check is std::nullopt.
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
std::optional<std::string> s1 = "Anything";
std::optional<std::string> s2;
xtd::tunit::assert::is_not_null(s1, "User message..."); // test ok.
xtd::tunit::assert::is_not_null(s2, "User message..."); // test throws an assert_error exception.

◆ is_not_null() [8/24]

template<typename optional_t >
static void xtd::tunit::assert::is_not_null ( const std::optional< optional_t > &  opt,
const xtd::ustring message,
const xtd::diagnostics::stack_frame stack_frame 
)
inlinestatic

Asserts that the optional is not std::nullopt.

Parameters
optThe optional to check is std::nullopt.
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
std::optional<std::string> s1 = "Anything";
std::optional<std::string> s2;
xtd::tunit::assert::is_not_null(s1, "User message...", csf_); // test ok.
xtd::tunit::assert::is_not_null(s2, "User message...", csf_); // test throws an assert_error exception.

◆ is_not_null() [9/24]

template<typename pointer_t >
static void xtd::tunit::assert::is_not_null ( const std::shared_ptr< pointer_t > &  pointer)
inlinestatic

Asserts that the pointer is not null.

Parameters
pointerThe pointer to check is null.
Exceptions
xtd::tunit::assert_errorIf bad assertion.
Examples
std::shared_ptr<std::string> s1 = std::make_shared<std::string>("Anything");
std::shared_ptr<std::string> s2;
xtd::tunit::assert::is_not_null(s2); // test throws an assert_error exception.

◆ is_not_null() [10/24]

template<typename pointer_t >
static void xtd::tunit::assert::is_not_null ( const std::shared_ptr< pointer_t > &  pointer,
const xtd::diagnostics::stack_frame stack_frame 
)
inlinestatic

Asserts that the pointer is not null.

Parameters
pointerThe pointer to check is null.
stack_frameContains information about current file and current line.
Exceptions
xtd::tunit::assert_errorIf bad assertion.
Examples
std::shared_ptr<std::string> s1 = std::make_shared<std::string>("Anything");
std::shared_ptr<std::string> s2;
xtd::tunit::assert::is_not_null(s2, csf_); // test throws an assert_error exception.

◆ is_not_null() [11/24]

template<typename pointer_t >
static void xtd::tunit::assert::is_not_null ( const std::shared_ptr< pointer_t > &  pointer,
const xtd::ustring message 
)
inlinestatic

Asserts that the pointer is not null.

Parameters
pointerThe pointer to check is null.
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
std::shared_ptr<std::string> s1 = std::make_shared<std::string>("Anything");
std::shared_ptr<std::string> s2;
xtd::tunit::assert::is_not_null(s1, "User message..."); // test ok.
xtd::tunit::assert::is_not_null(s2, "User message..."); // test throws an assert_error exception.

◆ is_not_null() [12/24]

template<typename pointer_t >
static void xtd::tunit::assert::is_not_null ( const std::shared_ptr< pointer_t > &  pointer,
const xtd::ustring message,
const xtd::diagnostics::stack_frame stack_frame 
)
inlinestatic

Asserts that the pointer is not null.

Parameters
pointerThe pointer to check is null.
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
std::shared_ptr<std::string> s1 = std::make_shared<std::string>("Anything");
std::shared_ptr<std::string> s2;
xtd::tunit::assert::is_not_null(s1, "User message...", csf_); // test ok.
xtd::tunit::assert::is_not_null(s2, "User message...", csf_); // test throws an assert_error exception.

◆ is_not_null() [13/24]

template<typename pointer_t >
static void xtd::tunit::assert::is_not_null ( const std::unique_ptr< pointer_t > &  pointer)
inlinestatic

Asserts that the pointer is not null.

Parameters
pointerThe pointer to check is null.
Exceptions
xtd::tunit::assert_errorIf bad assertion.
Examples
std::unique_ptr<std::string> s1 = std::make_unique<std::string>("Anything");
std::unique_ptr<std::string> s2;
xtd::tunit::assert::is_not_null(s2); // test throws an assert_error exception.

◆ is_not_null() [14/24]

template<typename pointer_t >
static void xtd::tunit::assert::is_not_null ( const std::unique_ptr< pointer_t > &  pointer,
const xtd::diagnostics::stack_frame stack_frame 
)
inlinestatic

Asserts that the pointer is not null.

Parameters
pointerThe pointer to check is null.
stack_frameContains information about current file and current line.
Exceptions
xtd::tunit::assert_errorIf bad assertion.
Examples
std::unique_ptr<std::string> s1 = std::make_unique<std::string>("Anything");
std::unique_ptr<std::string> s2;
xtd::tunit::assert::is_not_null(s2, csf_); // test throws an assert_error exception.

◆ is_not_null() [15/24]

template<typename pointer_t >
static void xtd::tunit::assert::is_not_null ( const std::unique_ptr< pointer_t > &  pointer,
const xtd::ustring message 
)
inlinestatic

Asserts that the pointer is not null.

Parameters
pointerThe pointer to check is null.
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
std::unique_ptr<std::string> s1 = std::make_unique<std::string>("Anything");
std::unique_ptr<std::string> s2;
xtd::tunit::assert::is_not_null(s1, "User message..."); // test ok.
xtd::tunit::assert::is_not_null(s2, "User message..."); // test throws an assert_error exception.

◆ is_not_null() [16/24]

template<typename pointer_t >
static void xtd::tunit::assert::is_not_null ( const std::unique_ptr< pointer_t > &  pointer,
const xtd::ustring message,
const xtd::diagnostics::stack_frame stack_frame 
)
inlinestatic

Asserts that the pointer is not null.

Parameters
pointerThe pointer to check is null.
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
std::unique_ptr<std::string> s1 = std::make_unique<std::string>("Anything");
std::unique_ptr<std::string> s2;
xtd::tunit::assert::is_not_null(s1, "User message...", csf_); // test ok.
xtd::tunit::assert::is_not_null(s2, "User message...", csf_); // test throws an assert_error exception.

◆ is_not_null() [17/24]

template<typename pointer_t >
static void xtd::tunit::assert::is_not_null ( const std::weak_ptr< pointer_t > &  pointer)
inlinestatic

Asserts that the pointer is not null.

Parameters
pointerThe pointer to check is null.
Examples
std::shared_ptr<std::string> s = std::make_shared<std::string>("Anything");
std::weak_ptr<std::string> s1 = s;
std::weak_ptr<std::string> s2;
@ s
The S key.

◆ is_not_null() [18/24]

template<typename pointer_t >
static void xtd::tunit::assert::is_not_null ( const std::weak_ptr< pointer_t > &  pointer,
const xtd::diagnostics::stack_frame stack_frame 
)
inlinestatic

Asserts that the pointer is not null.

Parameters
pointerThe pointer to check is null.
stack_frameContains information about current file and current line.
Examples
std::shared_ptr<std::string> s = std::make_shared<std::string>("Anything");
std::weak_ptr<std::string> s1 = s;
std::weak_ptr<std::string> s2;

◆ is_not_null() [19/24]

template<typename pointer_t >
static void xtd::tunit::assert::is_not_null ( const std::weak_ptr< pointer_t > &  pointer,
const xtd::ustring message 
)
inlinestatic

Asserts that the pointer is not null.

Parameters
pointerThe pointer to check is null.
messageA user message to display if the assertion fails. This message can be seen in the unit test results.
Examples
std::shared_ptr<std::string> s = std::make_shared<std::string>("Anything");
std::weak_ptr<std::string> s1 = s;
std::weak_ptr<std::string> s2;
xtd::tunit::assert::is_not_null(s1, "User message..."); // test ok.
xtd::tunit::assert::is_not_null(s2, "User message..."); // test ok.

◆ is_not_null() [20/24]

template<typename pointer_t >
static void xtd::tunit::assert::is_not_null ( const std::weak_ptr< pointer_t > &  pointer,
const xtd::ustring message,
const xtd::diagnostics::stack_frame stack_frame 
)
inlinestatic

Asserts that the pointer is not null.

Parameters
pointerThe pointer to check is null.
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
std::shared_ptr<std::string> s = std::make_shared<std::string>("Anything");
std::weak_ptr<std::string> s1 = s;
std::weak_ptr<std::string> s2;
xtd::tunit::assert::is_not_null(s1, "User message...", csf_); // test ok.
xtd::tunit::assert::is_not_null(s2, "User message...", csf_); // test ok.

◆ is_not_null() [21/24]

static void xtd::tunit::assert::is_not_null ( std::nullptr_t  pointer)
static

Asserts that the pointer is not null.

Parameters
pointerThe pointer to check is null.
Exceptions
xtd::tunit::assert_errorIf bad assertion.
Remarks
Always false, a nullptr_t is always equal to nullptr.
Examples
xtd::tunit::assert::is_not_null(nullptr); // test throws an assert_error exception.

◆ is_not_null() [22/24]

static void xtd::tunit::assert::is_not_null ( std::nullptr_t  pointer,
const xtd::diagnostics::stack_frame stack_frame 
)
static

Asserts that the pointer is not null.

Parameters
pointerThe pointer to check is null.
stack_frameContains information about current file and current line.
Exceptions
xtd::tunit::assert_errorIf bad assertion.
Remarks
Always false, a nullptr_t is always equal to nullptr.
Examples
xtd::tunit::assert::is_not_null(nullptr, csf_); // test throws an assert_error exception.

◆ is_not_null() [23/24]

static void xtd::tunit::assert::is_not_null ( std::nullptr_t  pointer,
const xtd::ustring message 
)
static

Asserts that the pointer is not null.

Parameters
pointerThe pointer to check is null.
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.
Remarks
Always false, a nullptr_t is always equal to nullptr.
Examples
xtd::tunit::assert::is_not_null(nullptr, "User message..."); // test throws an assert_error exception.

◆ is_not_null() [24/24]

static void xtd::tunit::assert::is_not_null ( std::nullptr_t  pointer,
const xtd::ustring message,
const xtd::diagnostics::stack_frame stack_frame 
)
static

Asserts that the pointer is not null.

Parameters
pointerThe pointer to check is null.
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.
Remarks
Always false, a nullptr_t is always equal to nullptr.
Examples
xtd::tunit::assert::is_not_null(nullptr, "User message...", csf_); // test throws an assert_error exception.

◆ is_not_zero() [1/4]

template<typename value_t >
static void xtd::tunit::assert::is_not_zero ( const value_t &  value)
inlinestatic

Asserts that ta condition is not zero.

Parameters
valueThe value to check is not zero.
Exceptions
xtd::tunit::assert_errorIf bad assertion.
Examples
int i1 = 42;
int i2 = 0;
xtd::tunit::assert::is_not_zero(i2); // test throws an assert_error exception.
static void is_not_zero(const value_t &value)
Asserts that ta condition is not zero.
Definition assert.h:1716

◆ is_not_zero() [2/4]

template<typename value_t >
static void xtd::tunit::assert::is_not_zero ( const value_t &  value,
const xtd::diagnostics::stack_frame stack_frame 
)
inlinestatic

Asserts that ta condition is not zero.

Parameters
valueThe value to check is not zero.
stack_frameContains information about current file and current line.
Exceptions
xtd::tunit::assert_errorIf bad assertion.
Examples
int i1 = 42;
int i2 = 0;
xtd::tunit::assert::is_not_zero(i2, csf_); // test throws an assert_error exception.

◆ is_not_zero() [3/4]

template<typename value_t >
static void xtd::tunit::assert::is_not_zero ( const value_t &  value,
const xtd::ustring message 
)
inlinestatic

Asserts that ta condition is not zero.

Parameters
valueThe value to check is not zero.
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
int i1 = 42;
int i2 = 0;
xtd::tunit::assert::is_not_zero(i1, "User message..."); // test ok.
xtd::tunit::assert::is_not_zero(i2, "User message..."); // test throws an assert_error exception.

◆ is_not_zero() [4/4]

template<typename value_t >
static void xtd::tunit::assert::is_not_zero ( const value_t &  value,
const xtd::ustring message,
const xtd::diagnostics::stack_frame stack_frame 
)
inlinestatic

Asserts that ta condition is not zero.

Parameters
valueThe value to check is not zero.
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
int i1 = 42;
int i2 = 0;
xtd::tunit::assert::is_not_zero(i1, "User message...", csf_); // test ok.
xtd::tunit::assert::is_not_zero(i2, "User message...", csf_); // test throws an assert_error exception.

◆ is_null() [1/24]

template<typename pointer_t >
static void xtd::tunit::assert::is_null ( const pointer_t *  pointer)
inlinestatic

Asserts that the pointer is null.

Parameters
pointerThe pointer to check is null.
Exceptions
xtd::tunit::assert_errorIf bad assertion.
Examples
std::string str = "Anything";
std::string* s1 = nullptr;
std::string* s2 = &str;
xtd::tunit::assert::is_null(s2); // test throws an assert_error exception.
static void is_null(const pointer_t *pointer)
Asserts that the pointer is null.
Definition assert.h:1775

◆ is_null() [2/24]

template<typename pointer_t >
static void xtd::tunit::assert::is_null ( const pointer_t *  pointer,
const xtd::diagnostics::stack_frame stack_frame 
)
inlinestatic

Asserts that the pointer is null.

Parameters
pointerThe pointer to check is null.
stack_frameContains information about current file and current line.
Exceptions
xtd::tunit::assert_errorIf bad assertion.
Examples
std::string str = "Anything";
std::string* s1 = nullptr;
std::string* s2 = &str;
xtd::tunit::assert::is_null(s2, csf_); // test throws an assert_error exception.

◆ is_null() [3/24]

template<typename pointer_t >
static void xtd::tunit::assert::is_null ( const pointer_t *  pointer,
const xtd::ustring message 
)
inlinestatic

Asserts that the pointer is null.

Parameters
pointerThe pointer to check is null.
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
std::string str = "Anything";
std::string* s1 = nullptr;
std::string* s2 = &str;
xtd::tunit::assert::is_null(s1, "User message..."); // test ok.
xtd::tunit::assert::is_null(s2, "User message..."); // test throws an assert_error exception.

◆ is_null() [4/24]

template<typename pointer_t >
static void xtd::tunit::assert::is_null ( const pointer_t *  pointer,
const xtd::ustring message,
const xtd::diagnostics::stack_frame stack_frame 
)
inlinestatic

Asserts that the pointer is null.

Parameters
pointerThe pointer to check is null.
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
std::string str = "Anything";
std::string* s1 = nullptr;
std::string* s2 = &str;
xtd::tunit::assert::is_null(s1, "User message...", csf_); // test ok.
xtd::tunit::assert::is_null(s2, "User message...", csf_); // test throws an assert_error exception.

◆ is_null() [5/24]

template<typename optional_t >
static void xtd::tunit::assert::is_null ( const std::optional< optional_t > &  opt)
inlinestatic

Asserts that the optional is std::nullopt.

Parameters
optThe optional to check is std::nullopt.
Exceptions
xtd::tunit::assert_errorIf bad assertion.
Examples
std::optional<std::string> s1;
std::optional<std::string> s2 = "Anything";
xtd::tunit::assert::is_null(s2); // test throws an assert_error exception.

◆ is_null() [6/24]

template<typename optional_t >
static void xtd::tunit::assert::is_null ( const std::optional< optional_t > &  opt,
const xtd::diagnostics::stack_frame stack_frame 
)
inlinestatic

Asserts that the optional is std::nullopt.

Parameters
optThe optional to check is std::nullopt.
stack_frameContains information about current file and current line.
Exceptions
xtd::tunit::assert_errorIf bad assertion.
Examples
std::optional<std::string> s1;
std::optional<std::string> s2 = "Anything";
xtd::tunit::assert::is_null(s2, csf_); // test throws an assert_error exception.

◆ is_null() [7/24]

template<typename optional_t >
static void xtd::tunit::assert::is_null ( const std::optional< optional_t > &  opt,
const xtd::ustring message 
)
inlinestatic

Asserts that the optional is std::nullopt.

Parameters
optThe optional to check is std::nullopt.
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
std::optional<std::string> s1;
std::optional<std::string> s2 = std::make_shared<std::string>("Anything");
xtd::tunit::assert::is_null(s1, "User message..."); // test ok.
xtd::tunit::assert::is_null(s2, "User message..."); // test throws an assert_error exception.

◆ is_null() [8/24]

template<typename optional_t >
static void xtd::tunit::assert::is_null ( const std::optional< optional_t > &  opt,
const xtd::ustring message,
const xtd::diagnostics::stack_frame stack_frame 
)
inlinestatic

Asserts that the optional is std::nullopt.

Parameters
optThe optional to check is std::nullopt.
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
std::optional<std::string> s1;
std::optional<std::string> s2 = "Anything";
xtd::tunit::assert::is_null(s1, "User message...", csf_); // test ok.
xtd::tunit::assert::is_null(s2, "User message...", csf_); // test throws an assert_error exception.

◆ is_null() [9/24]

template<typename pointer_t >
static void xtd::tunit::assert::is_null ( const std::shared_ptr< pointer_t > &  pointer)
inlinestatic

Asserts that the pointer is null.

Parameters
pointerThe pointer to check is null.
Exceptions
xtd::tunit::assert_errorIf bad assertion.
Examples
std::shared_ptr<std::string> s1;
std::shared_ptr<std::string> s2 = std::make_shared<std::string>("Anything");
xtd::tunit::assert::is_null(s2); // test throws an assert_error exception.

◆ is_null() [10/24]

template<typename pointer_t >
static void xtd::tunit::assert::is_null ( const std::shared_ptr< pointer_t > &  pointer,
const xtd::diagnostics::stack_frame stack_frame 
)
inlinestatic

Asserts that the pointer is null.

Parameters
pointerThe pointer to check is null.
stack_frameContains information about current file and current line.
Exceptions
xtd::tunit::assert_errorIf bad assertion.
Examples
std::shared_ptr<std::string> s1;
std::shared_ptr<std::string> s2 = std::make_shared<std::string>("Anything");
xtd::tunit::assert::is_null(s2, csf_); // test throws an assert_error exception.

◆ is_null() [11/24]

template<typename pointer_t >
static void xtd::tunit::assert::is_null ( const std::shared_ptr< pointer_t > &  pointer,
const xtd::ustring message 
)
inlinestatic

Asserts that the pointer is null.

Parameters
pointerThe pointer to check is null.
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
std::shared_ptr<std::string> s1;
std::shared_ptr<std::string> s2 = std::make_shared<std::string>("Anything");
xtd::tunit::assert::is_null(s1, "User message..."); // test ok.
xtd::tunit::assert::is_null(s2, "User message..."); // test throws an assert_error exception.

◆ is_null() [12/24]

template<typename pointer_t >
static void xtd::tunit::assert::is_null ( const std::shared_ptr< pointer_t > &  pointer,
const xtd::ustring message,
const xtd::diagnostics::stack_frame stack_frame 
)
inlinestatic

Asserts that the pointer is null.

Parameters
pointerThe pointer to check is null.
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
std::shared_ptr<std::string> s1;
std::shared_ptr<std::string> s2 = std::make_shared<std::string>("Anything");
xtd::tunit::assert::is_null(s1, "User message...", csf_); // test ok.
xtd::tunit::assert::is_null(s2, "User message...", csf_); // test throws an assert_error exception.

◆ is_null() [13/24]

template<typename pointer_t >
static void xtd::tunit::assert::is_null ( const std::unique_ptr< pointer_t > &  pointer)
inlinestatic

Asserts that the pointer is null.

Parameters
pointerThe pointer to check is null.
Exceptions
xtd::tunit::assert_errorIf bad assertion.
Examples
std::unique_ptr<std::string> s1;
std::unique_ptr<std::string> s2 = std::make_unique<std::string>("Anything");
xtd::tunit::assert::is_null(s2); // test throws an assert_error exception.

◆ is_null() [14/24]

template<typename pointer_t >
static void xtd::tunit::assert::is_null ( const std::unique_ptr< pointer_t > &  pointer,
const xtd::diagnostics::stack_frame stack_frame 
)
inlinestatic

Asserts that the pointer is null.

Parameters
pointerThe pointer to check is null.
stack_frameContains information about current file and current line.
Exceptions
xtd::tunit::assert_errorIf bad assertion.
Examples
std::unique_ptr<std::string> s1;
std::unique_ptr<std::string> s2 = std::make_unique<std::string>("Anything");
xtd::tunit::assert::is_null(s2, csf_); // test throws an assert_error exception.

◆ is_null() [15/24]

template<typename pointer_t >
static void xtd::tunit::assert::is_null ( const std::unique_ptr< pointer_t > &  pointer,
const xtd::ustring message 
)
inlinestatic

Asserts that the pointer is null.

Parameters
pointerThe pointer to check is null.
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
std::unique_ptr<std::string> s1;
std::unique_ptr<std::string> s2 = std::make_unique<std::string>("Anything");
xtd::tunit::assert::is_null(s1, "User message..."); // test ok.
xtd::tunit::assert::is_null(s2, "User message..."); // test throws an assert_error exception.

◆ is_null() [16/24]

template<typename pointer_t >
static void xtd::tunit::assert::is_null ( const std::unique_ptr< pointer_t > &  pointer,
const xtd::ustring message,
const xtd::diagnostics::stack_frame stack_frame 
)
inlinestatic

Asserts that the pointer is null.

Parameters
pointerThe pointer to check is null.
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
std::unique_ptr<std::string> s1;
std::unique_ptr<std::string> s2 = std::make_unique<std::string>("Anything");
xtd::tunit::assert::is_null(s1, "User message...", csf_); // test ok.
xtd::tunit::assert::is_null(s2, "User message...", csf_); // test throws an assert_error exception.

◆ is_null() [17/24]

template<typename pointer_t >
static void xtd::tunit::assert::is_null ( const std::weak_ptr< pointer_t > &  pointer)
inlinestatic

Asserts that the pointer is null.

Parameters
pointerThe pointer to check is null.
Remarks
Always false, a weaptr can't be equal to nullptr by contruction or assignation.
Examples
std::shared_ptr<std::string> s = std::make_shared<std::string>("Anything");
std::weak_ptr<std::string> s1;
std::weak_ptr<std::string> s2 = s;
xtd::tunit::assert::is_null(s1); // test throws an assert_error exception.
xtd::tunit::assert::is_null(s2); // test throws an assert_error exception.

◆ is_null() [18/24]

template<typename pointer_t >
static void xtd::tunit::assert::is_null ( const std::weak_ptr< pointer_t > &  pointer,
const xtd::diagnostics::stack_frame stack_frame 
)
inlinestatic

Asserts that the pointer is null.

Parameters
pointerThe pointer to check is null.
stack_frameContains information about current file and current line.
Remarks
Always false, a weaptr can't be equal to nullptr by contruction or assignation.
Examples
std::shared_ptr<std::string> s = std::make_shared<std::string>("Anything");
std::weak_ptr<std::string> s1;
std::weak_ptr<std::string> s2 = s;
xtd::tunit::assert::is_null(s1, csf_); // test throws an assert_error exception.
xtd::tunit::assert::is_null(s2, csf_); // test throws an assert_error exception.

◆ is_null() [19/24]

template<typename pointer_t >
static void xtd::tunit::assert::is_null ( const std::weak_ptr< pointer_t > &  pointer,
const xtd::ustring message 
)
inlinestatic

Asserts that the pointer is null.

Parameters
pointerThe pointer to check is null.
messageA user message to display if the assertion fails. This message can be seen in the unit test results.
Remarks
Always false, a weaptr can't be equal to nullptr by contruction or assignation.
Examples
std::shared_ptr<std::string> s = std::make_shared<std::string>("Anything");
std::weak_ptr<std::string> s1;
std::weak_ptr<std::string> s2 = s;
xtd::tunit::assert::is_null(s1, "User message..."); // test throws an assert_error exception.
xtd::tunit::assert::is_null(s2, "User message..."); // test throws an assert_error exception.

◆ is_null() [20/24]

template<typename pointer_t >
static void xtd::tunit::assert::is_null ( const std::weak_ptr< pointer_t > &  pointer,
const xtd::ustring message,
const xtd::diagnostics::stack_frame stack_frame 
)
inlinestatic

Asserts that the pointer is null.

Parameters
pointerThe pointer to check is null.
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.
Remarks
Always false, a weaptr can't be equal to nullptr by contruction or assignation.
Examples
std::shared_ptr<std::string> s = std::make_shared<std::string>("Anything");
std::weak_ptr<std::string> s1;
std::weak_ptr<std::string> s2 = s;
xtd::tunit::assert::is_null(s1, "User message...", csf_); // test throws an assert_error exception.
xtd::tunit::assert::is_null(s2, "User message...", csf_); // test throws an assert_error exception.

◆ is_null() [21/24]

static void xtd::tunit::assert::is_null ( std::nullptr_t  pointer)
static

Asserts that the pointer is null.

Parameters
pointerThe pointer to check is null.
Exceptions
xtd::tunit::assert_errorIf bad assertion.
Remarks
Always false, a nullptr_t is always equal to nullptr.
Examples
xtd::tunit::assert::is_null(nullptr); // test ok.

◆ is_null() [22/24]

static void xtd::tunit::assert::is_null ( std::nullptr_t  pointer,
const xtd::diagnostics::stack_frame stack_frame 
)
static

Asserts that the pointer is null.

Parameters
pointerThe pointer to check is null.
stack_frameContains information about current file and current line.
Exceptions
xtd::tunit::assert_errorIf bad assertion.
Remarks
Always false, a nullptr_t is always equal to nullptr.
Examples
xtd::tunit::assert::is_null(nullptr, csf_); // test ok.

◆ is_null() [23/24]

static void xtd::tunit::assert::is_null ( std::nullptr_t  pointer,
const xtd::ustring message 
)
static

Asserts that the pointer is null.

Parameters
pointerThe pointer to check is null.
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.
Remarks
Always false, a nullptr_t is always equal to nullptr.
Examples
xtd::tunit::assert::is_null(nullptr, "User message..."); // test ok.

◆ is_null() [24/24]

static void xtd::tunit::assert::is_null ( std::nullptr_t  pointer,
const xtd::ustring message,
const xtd::diagnostics::stack_frame stack_frame 
)
static

Asserts that the pointer is null.

Parameters
pointerThe pointer to check is null.
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.
Remarks
Always false, a nullptr_t is always equal to nullptr.
Examples
xtd::tunit::assert::is_null(nullptr, "User message...", csf_); // test ok.

◆ is_positive() [1/4]

template<typename value_t >
static void xtd::tunit::assert::is_positive ( const value_t &  value)
inlinestatic

Asserts that ta condition is positive.

Parameters
valueThe value to check is positive.
Exceptions
xtd::tunit::assert_errorIf bad assertion.
Examples
int i1 = 1;
int i2 = -1;
xtd::tunit::assert::is_positive(i2); // test throws an assert_error exception.
static void is_positive(const value_t &value)
Asserts that ta condition is positive.
Definition assert.h:2108

◆ is_positive() [2/4]

template<typename value_t >
static void xtd::tunit::assert::is_positive ( const value_t &  value,
const xtd::diagnostics::stack_frame stack_frame 
)
inlinestatic

Asserts that ta condition is positive.

Parameters
valueThe value to check is positive.
stack_frameContains information about current file and current line.
Exceptions
xtd::tunit::assert_errorIf bad assertion.
Examples
int i1 = 1;
int i2 = -1;
xtd::tunit::assert::is_positive(i2, csf_); // test throws an assert_error exception.

◆ is_positive() [3/4]

template<typename value_t >
static void xtd::tunit::assert::is_positive ( const value_t &  value,
const xtd::ustring message 
)
inlinestatic

Asserts that ta condition is positive.

Parameters
valueThe value to check is positive.
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
int i1 = 1;
int i2 = -1;
xtd::tunit::assert::is_positive(i1, "User message..."); // test ok.
xtd::tunit::assert::is_positive(i2, "User message..."); // test throws an assert_error exception.

◆ is_positive() [4/4]

template<typename value_t >
static void xtd::tunit::assert::is_positive ( const value_t &  value,
const xtd::ustring message,
const xtd::diagnostics::stack_frame stack_frame 
)
inlinestatic

Asserts that ta condition is positive.

Parameters
valueThe value to check is positive.
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
int i1 = 1;
int i2 = -1;
xtd::tunit::assert::is_positive(i1, "User message...", csf_); // test ok.
xtd::tunit::assert::is_positive(i2, "User message...", csf_); // test throws an assert_error exception.

◆ is_true() [1/4]

static void xtd::tunit::assert::is_true ( bool  condition)
static

Asserts that ta condition is true.

Parameters
conditionThe condition to check is true.
Exceptions
xtd::tunit::assert_errorIf bad assertion.
Examples
std::string s1;
std::string s2 = "Anything";
xtd::tunit::assert::is_false(std::empty(s1)); // test ok.
xtd::tunit::assert::is_false(std::empty(s2)); // test throws an assert_error exception.

◆ is_true() [2/4]

static void xtd::tunit::assert::is_true ( bool  condition,
const xtd::diagnostics::stack_frame stack_frame 
)
static

Asserts that a condition is true.

Parameters
conditionThe condition to check is true.
stack_frameContains information about current file and current line.
Exceptions
xtd::tunit::assert_errorIf bad assertion.
Examples
std::string s1;
std::string s2 = "Anything";
xtd::tunit::assert::is_false(std::empty(s1), csf_); // test ok.
xtd::tunit::assert::is_false(std::empty(s2), csf_); // test throws an assert_error exception.

◆ is_true() [3/4]

static void xtd::tunit::assert::is_true ( bool  condition,
const xtd::ustring message 
)
static

Asserts that a condition is true.

Parameters
conditionThe condition to check is true.
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
std::string s1;
std::string s2 = "Anything";
xtd::tunit::assert::is_false(std::empty(s1), "User message..."); // test ok.
xtd::tunit::assert::is_false(std::empty(s2), "User message..."); // test throws an assert_error exception.

◆ is_true() [4/4]

static void xtd::tunit::assert::is_true ( bool  condition,
const xtd::ustring message,
const xtd::diagnostics::stack_frame stack_frame 
)
static

Asserts that a condition is true.

Parameters
conditionThe condition to check is true.
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
std::string s1;
std::string s2 = "Anything";
xtd::tunit::assert::is_false(std::empty(s1), "User message...", csf_); // test ok.
xtd::tunit::assert::is_false(std::empty(s2), "User message...", csf_); // test throws an assert_error exception.

◆ is_zero() [1/4]

template<typename value_t >
static void xtd::tunit::assert::is_zero ( const value_t &  value)
inlinestatic

Asserts that ta condition is zero.

Parameters
valueThe value to check is zero.
Exceptions
xtd::tunit::assert_errorIf bad assertion.
Examples
int i1 = 0;
int i2 = 42;
xtd::tunit::assert::is_zero(i2); // test throws an assert_error exception.
static void is_zero(const value_t &value)
Asserts that ta condition is zero.
Definition assert.h:2215

◆ is_zero() [2/4]

template<typename value_t >
static void xtd::tunit::assert::is_zero ( const value_t &  value,
const xtd::diagnostics::stack_frame stack_frame 
)
inlinestatic

Asserts that ta condition is zero.

Parameters
valueThe value to check is zero.
stack_frameContains information about current file and current line.
Exceptions
xtd::tunit::assert_errorIf bad assertion.
Examples
int i1 = 0;
int i2 = 42;
xtd::tunit::assert::is_zero(i2, csf_); // test throws an assert_error exception.

◆ is_zero() [3/4]

template<typename value_t >
static void xtd::tunit::assert::is_zero ( const value_t &  value,
const xtd::ustring message 
)
inlinestatic

Asserts that ta condition is zero.

Parameters
valueThe value to check is zero.
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
int i1 = 0;
int i2 = 42;
xtd::tunit::assert::is_zero(i1, "User message..."); // test ok.
xtd::tunit::assert::is_zero(i2, "User message..."); // test throws an assert_error exception.

◆ is_zero() [4/4]

template<typename value_t >
static void xtd::tunit::assert::is_zero ( const value_t &  value,
const xtd::ustring message,
const xtd::diagnostics::stack_frame stack_frame 
)
inlinestatic

Asserts that ta condition is zero.

Parameters
valueThe value to check is zero.
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
int i1 = 0;
int i2 = 42;
xtd::tunit::assert::is_zero(i1, "User message...", csf_); // test ok.
xtd::tunit::assert::is_zero(i2, "User message...", csf_); // test throws an assert_error exception.

◆ throws() [1/4]

template<typename exception_t >
static void xtd::tunit::assert::throws ( const std::function< void()> &  statement)
inlinestatic

Asserts that the statement throws a particular exception when called.

Template Parameters
exception_tThe exception type that must be throw.
Parameters
statementThe statement that verify.
Exceptions
xtd::tunit::assert_errorIf bad assertion.
Examples
std::vector<int> v1 = {1, 2, 3, 4};
xtd::tunit::assert::throws<std::out_of_range>([&] {v1.at(5);}); // test ok.
xtd::tunit::assert::throws<std::out_of_range>([&] {v1.at(2);}); // test throws an assert_error exception.

◆ throws() [2/4]

template<typename exception_t >
static void xtd::tunit::assert::throws ( const std::function< void()> &  statement,
const xtd::diagnostics::stack_frame stack_frame 
)
inlinestatic

Asserts that the statement throws a particular exception when called.

Template Parameters
exception_tThe exception type that must be throw.
Parameters
statementThe statement that verify.
stack_frameContains information about current file and current line.
Exceptions
xtd::tunit::assert_errorIf bad assertion.
Examples
std::vector<int> v1 = {1, 2, 3, 4};
xtd::tunit::assert::throws<std::out_of_range>([&] {v1.at(5);}, csf_); // test ok.
xtd::tunit::assert::throws<std::out_of_range>([&] {v1.at(2);}, csf_); // test throws an assert_error exception.

◆ throws() [3/4]

template<typename exception_t >
static void xtd::tunit::assert::throws ( const std::function< void()> &  statement,
const xtd::ustring message 
)
inlinestatic

Asserts that the statement throws a particular exception when called.

Template Parameters
exception_tThe exception type that must be throw.
Parameters
statementThe statement that verify.
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
std::vector<int> v1 = {1, 2, 3, 4};
xtd::tunit::assert::throws<std::out_of_range>([&] {v1.at(5);}, "User message..."); // test ok.
xtd::tunit::assert::throws<std::out_of_range>([&] {v1.at(2);}, "User message..."); // test throws an assert_error exception.

◆ throws() [4/4]

template<typename exception_t >
static void xtd::tunit::assert::throws ( const std::function< void()> &  statement,
const xtd::ustring message,
const xtd::diagnostics::stack_frame stack_frame 
)
inlinestatic

Asserts that the statement throws a particular exception when called.

Template Parameters
exception_tThe exception type that must be throw.
Parameters
statementThe statement that verify.
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
std::vector<int> v1 = {1, 2, 3, 4};
xtd::tunit::assert::throws<std::out_of_range>([&] {v1.at(5);}, "User message...", csf_); // test ok.
xtd::tunit::assert::throws<std::out_of_range>([&] {v1.at(2);}, "User message...", csf_); // test throws an assert_error exception.

◆ throws_any() [1/4]

static void xtd::tunit::assert::throws_any ( const std::function< void()> &  statement)
static

Asserts that the staement does not throw an exception.

Parameters
statementThe statement that verify.
Exceptions
xtd::tunit::assert_errorIf bad assertion.
Examples
std::vector<int> v1 = {1, 2, 3, 4};
xtd::tunit::assert::throws_any([&] {v1.at(5);}); // test ok.
xtd::tunit::assert::throws_any([&] {v1.at(2);}); // test throws an assert_error exception.
static void throws_any(const std::function< void()> &statement)
Asserts that the staement does not throw an exception.

◆ throws_any() [2/4]

static void xtd::tunit::assert::throws_any ( const std::function< void()> &  statement,
const xtd::diagnostics::stack_frame stack_frame 
)
static

Asserts that the staement does not throw an exception.

Parameters
statementThe statement that verify.
stack_frameContains information about current file and current line.
Exceptions
xtd::tunit::assert_errorIf bad assertion.
Examples
std::vector<int> v1 = {1, 2, 3, 4};
xtd::tunit::assert::throws_any([&] {v1.at(5);}, csf_); // test ok.
xtd::tunit::assert::throws_any([&] {v1.at(2);}, csf_); // test throws an assert_error exception.

◆ throws_any() [3/4]

static void xtd::tunit::assert::throws_any ( const std::function< void()> &  statement,
const xtd::ustring message 
)
static

Asserts that the staement does not throw an exception.

Parameters
statementThe statement that verify.
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
std::vector<int> v1 = {1, 2, 3, 4};
xtd::tunit::assert::throws_any([&] {v1.at(5);}, "User message..."); // test ok.
xtd::tunit::assert::throws_any([&] {v1.at(2);}, "User message..."); // test throws an assert_error exception.

◆ throws_any() [4/4]

static void xtd::tunit::assert::throws_any ( const std::function< void()> &  statement,
const xtd::ustring message,
const xtd::diagnostics::stack_frame stack_frame 
)
static

Asserts that the staement does not throw an exception.

Parameters
statementThe statement that verify.
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
std::vector<int> v1 = {1, 2, 3, 4};
xtd::tunit::assert::throws_any([&] {v1.at(5);}, "User message...", csf_); // test ok.
xtd::tunit::assert::throws_any([&] {v1.at(2);}, "User message...", csf_); // test throws an assert_error exception.

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