xtd - Reference Guide  0.1.0
Modern c++17 framework to create console, gui and unit test applications on Windows, macOS and Linux.
xtd::tunit::valid Class Referencefinal

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

#include <valid.h>

Inheritance diagram for xtd::tunit::valid:
xtd::tunit::base_assert

Static Public Member Functions

template<typename TExpected , typename TActual >
static void are_equal (const TExpected &expected, const TActual &actual)
 Valids that two type are equal. More...
 
template<typename TExpected , typename TActual >
static void are_equal (const TExpected &expected, const TActual &actual, const xtd::tunit::line_info &line_info)
 Valids that two type are equal. More...
 
template<typename TExpected , typename TActual >
static void are_equal (const TExpected &expected, const TActual &actual, const std::string &message)
 Valids that two type are equal. More...
 
template<typename TExpected , typename TActual >
static void are_equal (const TExpected &expected, const TActual &actual, const std::string &message, const xtd::tunit::line_info &line_info)
 Valids that two type are equal. More...
 
static void are_equal (float expected, float actual, float tolerance)
 Valids that two type are equal. More...
 
static void are_equal (float expected, float actual, float tolerance, const xtd::tunit::line_info &line_info)
 Valids that two type are equal. More...
 
static void are_equal (float expected, float &actual, float tolerance, const std::string &message)
 Valids that two type are equal. More...
 
static void are_equal (float expected, float actual, float tolerance, const std::string &message, const xtd::tunit::line_info &line_info)
 Valids that two type are equal. More...
 
static void are_equal (double expected, double actual, double tolerance)
 Valids that two type are equal. More...
 
static void are_equal (double expected, double actual, double tolerance, const xtd::tunit::line_info &line_info)
 Valids that two type are equal. More...
 
static void are_equal (double expected, double actual, double tolerance, const std::string &message)
 Valids that two type are equal. More...
 
static void are_equal (double expected, double actual, double tolerance, const std::string &message, const xtd::tunit::line_info &line_info)
 Valids that two type are equal. More...
 
static void are_equal (long double expected, long double actual, long double tolerance)
 Valids that two type are equal. More...
 
static void are_equal (long double expected, long double actual, long double tolerance, const xtd::tunit::line_info &line_info)
 Valids that two type are equal. More...
 
static void are_equal (long double expected, long double actual, long double tolerance, const std::string &message)
 Valids that two type are equal. More...
 
static void are_equal (long double expected, long double actual, long double tolerance, const std::string &message, const xtd::tunit::line_info &line_info)
 Valids that two type are equal. More...
 
template<typename TExpected , typename TActual >
static void are_not_equal (const TExpected &expected, const TActual &actual)
 Valids that two type are not equal. More...
 
template<typename TExpected , typename TActual >
static void are_not_equal (const TExpected &expected, const TActual &actual, const xtd::tunit::line_info &line_info)
 Valids that two type are not equal. More...
 
template<typename TExpected , typename TActual >
static void are_not_equal (const TExpected &expected, const TActual &actual, const std::string &message)
 Valids that two type are not equal. More...
 
template<typename TExpected , typename TActual >
static void are_not_equal (const TExpected &expected, const TActual &actual, const std::string &message, const xtd::tunit::line_info &line_info)
 Valids that two type are not equal. More...
 
template<typename TExpected , typename TActual >
static void are_not_same (const TExpected &expected, const TActual &actual)
 Valids that two objects do refer to differents objects. More...
 
template<typename TExpected , typename TActual >
static void are_not_same (const TExpected &expected, const TActual &actual, const xtd::tunit::line_info &line_info)
 Valids that two objects do refer to differents objects. More...
 
template<typename TExpected , typename TActual >
static void are_not_same (const TExpected &expected, const TActual &actual, const std::string &message)
 Valids that two objects do refer to differents objects. More...
 
template<typename TExpected , typename TActual >
static void are_not_same (const TExpected &expected, const TActual &actual, const std::string &message, const xtd::tunit::line_info &line_info)
 Valids that two objects do refer to differents objects. More...
 
template<typename TExpected , typename TActual >
static void are_same (const TExpected &expected, const TActual &actual)
 Valids that two objects do refer to differents objects. More...
 
template<typename TExpected , typename TActual >
static void are_same (const TExpected &expected, const TActual &actual, const xtd::tunit::line_info &line_info)
 Valids that two objects do refer to differents objects. More...
 
template<typename TExpected , typename TActual >
static void are_same (const TExpected &expected, const TActual &actual, const std::string &message)
 Valids that two objects do refer to differents objects. More...
 
template<typename TExpected , typename TActual >
static void are_same (const TExpected &expected, const TActual &actual, const std::string &message, const xtd::tunit::line_info &line_info)
 Valids that two objects do refer to differents objects. More...
 
template<typename TItem , typename TCollection >
static void contains (const TItem &item, const TCollection &collection)
 Valids that collection contains an item. More...
 
template<typename TItem , typename TCollection >
static void contains (const TItem &item, const TCollection &collection, const xtd::tunit::line_info &line_info)
 Valids that collection contains an item. More...
 
template<typename TItem , typename TCollection >
static void contains (const TItem &item, const TCollection &collection, const std::string &message)
 Valids that collection contains an item. More...
 
template<typename TItem , typename TCollection >
static void contains (const TItem &item, const TCollection &collection, const std::string &message, const xtd::tunit::line_info &line_info)
 Valids that collection contains an item. More...
 
static void does_not_throw (const std::function< void()> &statement)
 Valids that the staement does not throw an exception. More...
 
static void does_not_throw (const std::function< void()> &statement, const xtd::tunit::line_info &line_info)
 Valids that the staement does not throw an exception. More...
 
static void does_not_throw (const std::function< void()> &statement, const std::string &message)
 Valids that the staement does not throw an exception. More...
 
static void does_not_throw (const std::function< void()> &statement, const std::string &message, const xtd::tunit::line_info &line_info)
 Valids that the staement does not throw an exception. More...
 
template<typename TValue >
static void is_empty (const TValue &value)
 Valids that collection contains an item. More...
 
template<typename TValue >
static void is_empty (const TValue &value, const xtd::tunit::line_info &line_info)
 Valids that collection contains an item. More...
 
template<typename TValue >
static void is_empty (const TValue &value, const std::string &message)
 Valids that collection contains an item. More...
 
template<typename TValue >
static void is_empty (const TValue &value, const std::string &message, const xtd::tunit::line_info &line_info)
 Valids that collection contains an item. More...
 
template<typename TValue1 , typename TValue2 >
static void is_greater_or_equal (const TValue1 &val1, const TValue2 &val2)
 Valids that the first value is greater than or equal to the second value. More...
 
template<typename TValue1 , typename TValue2 >
static void is_greater_or_equal (const TValue1 &val1, const TValue2 &val2, const xtd::tunit::line_info &line_info)
 Valids that the first value is greater than or equal to the second value. More...
 
template<typename TValue1 , typename TValue2 >
static void is_greater_or_equal (const TValue1 &val1, const TValue2 &val2, const std::string &message)
 Valids that the first value is greater than or equal to the second value. More...
 
template<typename TValue1 , typename TValue2 >
static void is_greater_or_equal (const TValue1 &val1, const TValue2 &val2, const std::string &message, const xtd::tunit::line_info &line_info)
 Valids that the first value is greater than or equal to the second value. More...
 
template<typename Type , typename TValue >
static void is_instance_of (const TValue &value)
 Valids that an object is of the type supplied or a derived type. More...
 
template<typename Type , typename TValue >
static void is_instance_of (const TValue &value, const xtd::tunit::line_info &line_info)
 Valids that an object is of the type supplied or a derived type. More...
 
template<typename Type , typename TValue >
static void is_instance_of (const TValue &value, const std::string &message)
 Valids that an object is of the type supplied or a derived type. More...
 
template<typename Type , typename TValue >
static void is_instance_of (const TValue &value, const std::string &message, const xtd::tunit::line_info &line_info)
 Valids that an object is of the type supplied or a derived type. More...
 
template<typename TValue1 , typename TValue2 >
static void is_less (const TValue1 &val1, const TValue2 &val2)
 Valids that the first value is is_less than the second value. More...
 
template<typename TValue1 , typename TValue2 >
static void is_less (const TValue1 &val1, const TValue2 &val2, const xtd::tunit::line_info &line_info)
 Valids that the first value is is_less than the second value. More...
 
template<typename TValue1 , typename TValue2 >
static void is_less (const TValue1 &val1, const TValue2 &val2, const std::string &message)
 Valids that the first value is is_less than the second value. More...
 
template<typename TValue1 , typename TValue2 >
static void is_less (const TValue1 &val1, const TValue2 &val2, const std::string &message, const xtd::tunit::line_info &line_info)
 Valids that the first value is is_less than the second value. More...
 
template<typename TValue1 , typename TValue2 >
static void is_less_or_equal (const TValue1 &val1, const TValue2 &val2)
 Valids that the first value is is_less than or equal to the second value. More...
 
template<typename TValue1 , typename TValue2 >
static void is_less_or_equal (const TValue1 &val1, const TValue2 &val2, const xtd::tunit::line_info &line_info)
 Valids that the first value is is_less than or equal to the second value. More...
 
template<typename TValue1 , typename TValue2 >
static void is_less_or_equal (const TValue1 &val1, const TValue2 &val2, const std::string &message)
 Valids that the first value is is_less than or equal to the second value. More...
 
template<typename TValue1 , typename TValue2 >
static void is_less_or_equal (const TValue1 &val1, const TValue2 &val2, const std::string &message, const xtd::tunit::line_info &line_info)
 Valids that the first value is is_less than or equal to the second value. More...
 
static void is_NaN (double value)
 that a value is NaN. More...
 
static void is_NaN (double value, const xtd::tunit::line_info &line_info)
 that a value is NaN. More...
 
static void is_NaN (double value, const std::string &message)
 Valids that a value is NaN. More...
 
static void is_NaN (double value, const std::string &message, const xtd::tunit::line_info &line_info)
 Valids that a value is NaN. More...
 
static void is_NaN (long double value)
 that a value is NaN. More...
 
static void is_NaN (long double value, const xtd::tunit::line_info &line_info)
 that a value is NaN. More...
 
static void is_NaN (long double value, const std::string &message)
 Valids that a value is NaN. More...
 
static void is_NaN (long double value, const std::string &message, const xtd::tunit::line_info &line_info)
 Valids that a value is NaN. More...
 
static void is_NaN (float value)
 that a value is NaN. More...
 
static void is_NaN (float value, const xtd::tunit::line_info &line_info)
 that a value is NaN. More...
 
static void is_NaN (float value, const std::string &message)
 Valids that a value is NaN. More...
 
static void is_NaN (float value, const std::string &message, const xtd::tunit::line_info &line_info)
 Valids that a value is NaN. More...
 
template<typename TValue >
static void is_negative (const TValue &value)
 Valids that ta condition is negative. More...
 
template<typename TValue >
static void is_negative (const TValue &value, const xtd::tunit::line_info &line_info)
 Valids that ta condition is negative. More...
 
template<typename TValue >
static void is_negative (const TValue &value, const std::string &message)
 Valids that ta condition is negative. More...
 
template<typename TValue >
static void is_negative (const TValue &value, const std::string &message, const xtd::tunit::line_info &line_info)
 Valids that ta condition is negative. More...
 
template<typename TValue >
static void is_not_empty (const TValue &value)
 Valids that collection oes not contain any item. More...
 
template<typename TValue >
static void is_not_empty (const TValue &value, const xtd::tunit::line_info &line_info)
 Valids that collection does not contain any item. More...
 
template<typename TValue >
static void is_not_empty (const TValue &value, const std::string &message)
 Valids that collection does not contain any item. More...
 
template<typename TValue >
static void is_not_empty (const TValue &value, const std::string &message, const xtd::tunit::line_info &line_info)
 Valids that collection does not contain any item. More...
 
template<typename Type , typename TValue >
static void is_not_instance_of (const TValue &value)
 Valids that an object is not of the type supplied or a derived type. More...
 
template<typename Type , typename TValue >
static void is_not_instance_of (const TValue &value, const xtd::tunit::line_info &line_info)
 Valids that an object is not of the type supplied or a derived type. More...
 
template<typename Type , typename TValue >
static void is_not_instance_of (const TValue &value, const std::string &message)
 Valids that an object is not of the type supplied or a derived type. More...
 
template<typename Type , typename TValue >
static void is_not_instance_of (const TValue &value, const std::string &message, const xtd::tunit::line_info &line_info)
 Valids that an object is not of the type supplied or a derived type. More...
 
template<typename TPointer >
static void is_not_null (const TPointer *pointer)
 Valids that the pointer is not null. More...
 
template<typename TPointer >
static void is_not_null (const TPointer *pointer, const xtd::tunit::line_info &line_info)
 Valids that the pointer is not null. More...
 
template<typename TPointer >
static void is_not_null (const TPointer *pointer, const std::string &message)
 Valids that the pointer is not null. More...
 
template<typename TPointer >
static void is_not_null (const TPointer *pointer, const std::string &message, const xtd::tunit::line_info &line_info)
 Valids that the pointer is not null. More...
 
template<typename TPointer >
static void is_not_null (const std::unique_ptr< TPointer > &pointer)
 Valids that the pointer is not null. More...
 
template<typename TPointer >
static void is_not_null (const std::unique_ptr< TPointer > &pointer, const xtd::tunit::line_info &line_info)
 Valids that the pointer is not null. More...
 
template<typename TPointer >
static void is_not_null (const std::unique_ptr< TPointer > &pointer, const std::string &message)
 Valids that the pointer is not null. More...
 
template<typename TPointer >
static void is_not_null (const std::unique_ptr< TPointer > &pointer, const std::string &message, const xtd::tunit::line_info &line_info)
 Valids that the pointer is not null. More...
 
template<typename TPointer >
static void is_not_null (const std::shared_ptr< TPointer > &pointer)
 Valids that the pointer is not null. More...
 
template<typename TPointer >
static void is_not_null (const std::shared_ptr< TPointer > &pointer, const xtd::tunit::line_info &line_info)
 Valids that the pointer is not null. More...
 
template<typename TPointer >
static void is_not_null (const std::shared_ptr< TPointer > &pointer, const std::string &message)
 Valids that the pointer is not null. More...
 
template<typename TPointer >
static void is_not_null (const std::shared_ptr< TPointer > &pointer, const std::string &message, const xtd::tunit::line_info &line_info)
 Valids that the pointer is not null. More...
 
template<typename TPointer >
static void is_not_null (const std::weak_ptr< TPointer > &pointer)
 Valids that the pointer is not null. More...
 
template<typename TPointer >
static void is_not_null (const std::weak_ptr< TPointer > &pointer, const xtd::tunit::line_info &line_info)
 Valids that the pointer is not null. More...
 
template<typename TPointer >
static void is_not_null (const std::weak_ptr< TPointer > &pointer, const std::string &message)
 Valids that the pointer is not null. More...
 
template<typename TPointer >
static void is_not_null (const std::weak_ptr< TPointer > &pointer, const std::string &message, const xtd::tunit::line_info &line_info)
 Valids that the pointer is not null. More...
 
static void is_not_null (std::nullptr_t pointer)
 Valids that the pointer is not null. More...
 
static void is_not_null (std::nullptr_t pointer, const xtd::tunit::line_info &line_info)
 Valids that the pointer is not null. More...
 
static void is_not_null (std::nullptr_t pointer, const std::string &message)
 Valids that the pointer is not null. More...
 
static void is_not_null (std::nullptr_t pointer, const std::string &message, const xtd::tunit::line_info &line_info)
 Valids that the pointer is not null. More...
 
template<typename TValue >
static void is_not_zero (const TValue &value)
 Valids that ta condition is not zero. More...
 
template<typename TValue >
static void is_not_zero (const TValue &value, const xtd::tunit::line_info &line_info)
 Valids that ta condition is not zero. More...
 
template<typename TValue >
static void is_not_zero (const TValue &value, const std::string &message)
 Valids that ta condition is not zero. More...
 
template<typename TValue >
static void is_not_zero (const TValue &value, const std::string &message, const xtd::tunit::line_info &line_info)
 Valids that ta condition is not zero. More...
 
template<typename TPointer >
static void is_null (const TPointer *pointer)
 Valids that the pointer is null. More...
 
template<typename TPointer >
static void is_null (const TPointer *pointer, const xtd::tunit::line_info &line_info)
 Valids that the pointer is null. More...
 
template<typename TPointer >
static void is_null (const TPointer *pointer, const std::string &message)
 Valids that the pointer is null. More...
 
template<typename TPointer >
static void is_null (const TPointer *pointer, const std::string &message, const xtd::tunit::line_info &line_info)
 Valids that the pointer is null. More...
 
template<typename TPointer >
static void is_null (const std::unique_ptr< TPointer > &pointer)
 Valids that the pointer is null. More...
 
template<typename TPointer >
static void is_null (const std::unique_ptr< TPointer > &pointer, const xtd::tunit::line_info &line_info)
 Valids that the pointer is null. More...
 
template<typename TPointer >
static void is_null (const std::unique_ptr< TPointer > &pointer, const std::string &message)
 Valids that the pointer is null. More...
 
template<typename TPointer >
static void is_null (const std::unique_ptr< TPointer > &pointer, const std::string &message, const xtd::tunit::line_info &line_info)
 Valids that the pointer is null. More...
 
template<typename TPointer >
static void is_null (const std::shared_ptr< TPointer > &pointer)
 Valids that the pointer is null. More...
 
template<typename TPointer >
static void is_null (const std::shared_ptr< TPointer > &pointer, const xtd::tunit::line_info &line_info)
 Valids that the pointer is null. More...
 
template<typename TPointer >
static void is_null (const std::shared_ptr< TPointer > &pointer, const std::string &message)
 Valids that the pointer is null. More...
 
template<typename TPointer >
static void is_null (const std::shared_ptr< TPointer > &pointer, const std::string &message, const xtd::tunit::line_info &line_info)
 Valids that the pointer is null. More...
 
template<typename TPointer >
static void is_null (const std::weak_ptr< TPointer > &pointer)
 Valids that the pointer is null. More...
 
template<typename TPointer >
static void is_null (const std::weak_ptr< TPointer > &pointer, const xtd::tunit::line_info &line_info)
 Valids that the pointer is null. More...
 
template<typename TPointer >
static void is_null (const std::weak_ptr< TPointer > &pointer, const std::string &message)
 Valids that the pointer is null. More...
 
template<typename TPointer >
static void is_null (const std::weak_ptr< TPointer > &pointer, const std::string &message, const xtd::tunit::line_info &line_info)
 Valids that the pointer is null. More...
 
static void is_null (std::nullptr_t pointer)
 Valids that the pointer is null. More...
 
static void is_null (std::nullptr_t pointer, const xtd::tunit::line_info &line_info)
 Valids that the pointer is null. More...
 
static void is_null (std::nullptr_t pointer, const std::string &message)
 Valids that the pointer is null. More...
 
static void is_null (std::nullptr_t pointer, const std::string &message, const xtd::tunit::line_info &line_info)
 Valids that the pointer is null. More...
 
template<typename TValue >
static void is_positive (const TValue &value)
 Valids that ta condition is positive. More...
 
template<typename TValue >
static void is_positive (const TValue &value, const xtd::tunit::line_info &line_info)
 Valids that ta condition is positive. More...
 
template<typename TValue >
static void is_positive (const TValue &value, const std::string &message)
 Valids that ta condition is positive. More...
 
template<typename TValue >
static void is_positive (const TValue &value, const std::string &message, const xtd::tunit::line_info &line_info)
 Valids that ta condition is positive. More...
 
static void is_true (bool condition)
 Valids that ta condition is true. More...
 
static void is_true (bool condition, const xtd::tunit::line_info &line_info)
 Valids that a condition is true. More...
 
static void is_true (bool condition, const std::string &message)
 Valids that a condition is true. More...
 
static void is_true (bool condition, const std::string &message, const xtd::tunit::line_info &line_info)
 Valids that a condition is true. More...
 
template<typename TValue >
static void is_zero (const TValue &value)
 Valids that ta condition is zero. More...
 
template<typename TValue >
static void is_zero (const TValue &value, const xtd::tunit::line_info &line_info)
 Valids that ta condition is zero. More...
 
template<typename TValue >
static void is_zero (const TValue &value, const std::string &message)
 Valids that ta condition is zero. More...
 
template<typename TValue >
static void is_zero (const TValue &value, const std::string &message, const xtd::tunit::line_info &line_info)
 Valids that ta condition is zero. More...
 
template<typename TException >
static void throws (const std::function< void()> &statement)
 Valids that the statement throws a particular exception when called. More...
 
template<typename TException >
static void throws (const std::function< void()> &statement, const xtd::tunit::line_info &line_info)
 Valids that the statement throws a particular exception when called. More...
 
template<typename TException >
static void throws (const std::function< void()> &statement, const std::string &message)
 Valids that the statement throws a particular exception when called. More...
 
template<typename TException >
static void throws (const std::function< void()> &statement, const std::string &message, const xtd::tunit::line_info &line_info)
 Valids that the statement throws a particular exception when called. More...
 
static void throws_any (const std::function< void()> &statement)
 Valids that the staement does not throw an exception. More...
 
static void throws_any (const std::function< void()> &statement, const xtd::tunit::line_info &line_info)
 Valids that the staement does not throw an exception. More...
 
static void throws_any (const std::function< void()> &statement, const std::string &message)
 Valids that the staement does not throw an exception. More...
 
static void throws_any (const std::function< void()> &statement, const std::string &message, const xtd::tunit::line_info &line_info)
 Valids that the staement does not throw an exception. More...
 

Static Private Member Functions

static void abort ()
 Abort current test. This is used by the other Assert functions. More...
 
static void abort (const xtd::tunit::line_info &line_info)
 Abort current test. This is used by the other Assert functions. More...
 
static void abort (const std::string &message)
 Abort current test. This is used by the other Assert functions. More...
 
static void abort (const std::string &message, const xtd::tunit::line_info &line_info)
 Abort current test. This is used by the other Assert functions. More...
 
static void error ()
 
static void error (const std::string &actual, const std::string &expected, const std::string &message, const xtd::tunit::line_info &line_info)
 
static void fail ()
 Throws an xtd::tunit::assertion_error exception. This is used by the other Assert functions. More...
 
static void fail (const xtd::tunit::line_info &line_info)
 Throws an xtd::tunit::assertion_error exception. This is used by the other Assert functions. More...
 
static void fail (const std::string &message)
 Throws an xtd::tunit::assertion_error exception. This is used by the other Assert functions. More...
 
static void fail (const std::string &message, const xtd::tunit::line_info &line_info)
 Throws an xtd::tunit::assertion_error exception. This is used by the other Assert functions. More...
 
static void fail (const std::string &actual, const std::string &expected, const std::string &message, const xtd::tunit::line_info &line_info)
 
static void ignore ()
 Ignore current test. This is used by the other Assert functions. More...
 
static void ignore (const xtd::tunit::line_info &line_info)
 Ignore current test. This is used by the other Assert functions. More...
 
static void ignore (const std::string &message)
 Ignore current test. This is used by the other Assert functions. More...
 
static void ignore (const std::string &message, const xtd::tunit::line_info &line_info)
 Ignore current test. This is used by the other Assert functions. More...
 
template<typename TCollection >
static std::string join_items (const TCollection &collection)
 
static std::string join_items (const std::string &str)
 
static void succeed ()
 Generates a success with a generic message. This is used by the other Assert functions. More...
 
static void succeed (const xtd::tunit::line_info &line_info)
 Generates a success with a generic message. This is used by the other Assert functions. More...
 
static void succeed (const std::string &message)
 Generates a success with a generic message. This is used by the other Assert functions. More...
 
static void succeed (const std::string &message, const xtd::tunit::line_info &line_info)
 Generates a success with a generic message. This is used by the other Assert functions. More...
 
template<typename TValue >
static std::string to_string (const TValue &value)
 
template<typename TValue >
static std::string to_string (const TValue *value)
 

Detailed Description

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

Examples
This example show how to used some methods :

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