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::string_assume Class Referencefinal

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

#include <string_assume.h>

Inheritance diagram for xtd::tunit::string_assume:
xtd::tunit::base_assert

Static Public Member Functions

static void are_equal_ignoring_case (const std::string &expected, const std::string &actual)
 Valids that two type are equal ignoring case. More...
 
static void are_equal_ignoring_case (const std::string &expected, const std::string &actual, const xtd::tunit::line_info &line_info)
 Valids that two type are equal ignoring case. More...
 
static void are_equal_ignoring_case (const std::string &expected, const std::string &actual, const std::string &message)
 Valids that two type are equal ignoring case. More...
 
static void are_equal_ignoring_case (const std::string &expected, const std::string &actual, const std::string &message, const xtd::tunit::line_info &line_info)
 Valids that two type are equal ignoring case. More...
 
static void are_equal_ignoring_case (const std::u16string &expected, const std::u16string &actual)
 Valids that two type are equal ignoring case. More...
 
static void are_equal_ignoring_case (const std::u16string &expected, const std::u16string &actual, const xtd::tunit::line_info &line_info)
 Valids that two type are equal ignoring case. More...
 
static void are_equal_ignoring_case (const std::u16string &expected, const std::u16string &actual, const std::string &message)
 Valids that two type are equal ignoring case. More...
 
static void are_equal_ignoring_case (const std::u16string &expected, const std::u16string &actual, const std::string &message, const xtd::tunit::line_info &line_info)
 Valids that two type are equal ignoring case. More...
 
static void are_equal_ignoring_case (const std::u32string &expected, const std::u32string &actual)
 Valids that two type are equal ignoring case. More...
 
static void are_equal_ignoring_case (const std::u32string &expected, const std::u32string &actual, const xtd::tunit::line_info &line_info)
 Valids that two type are equal. More...
 
static void are_equal_ignoring_case (const std::u32string &expected, const std::u32string &actual, const std::string &message)
 Valids that two type are equal ignoring case. More...
 
static void are_equal_ignoring_case (const std::u32string &expected, const std::u32string &actual, const std::string &message, const xtd::tunit::line_info &line_info)
 Valids that two type are equal. More...
 
static void are_equal_ignoring_case (const std::wstring &expected, const std::wstring &actual)
 Valids that two type are equal ignoring case. More...
 
static void are_equal_ignoring_case (const std::wstring &expected, const std::wstring &actual, const xtd::tunit::line_info &line_info)
 Valids that two type are equal ignoring case. More...
 
static void are_equal_ignoring_case (const std::wstring &expected, const std::wstring &actual, const std::string &message)
 Valids that two type are equal ignoring case. More...
 
static void are_equal_ignoring_case (const std::wstring &expected, const std::wstring &actual, const std::string &message, const xtd::tunit::line_info &line_info)
 Valids that two type are equal ignoring case. More...
 
static void are_not_equal_ignoring_case (const std::string &expected, const std::string &actual)
 Valids that two type are not equal ignoring case. More...
 
static void are_not_equal_ignoring_case (const std::string &expected, const std::string &actual, const xtd::tunit::line_info &line_info)
 Valids that two type are not equal ignoring case. More...
 
static void are_not_equal_ignoring_case (const std::string &expected, const std::string &actual, const std::string &message)
 Valids that two type are not equal ignoring case. More...
 
static void are_not_equal_ignoring_case (const std::string &expected, const std::string &actual, const std::string &message, const xtd::tunit::line_info &line_info)
 Valids that two type are not equal ignoring case. More...
 
static void are_not_equal_ignoring_case (const std::u16string &expected, const std::u16string &actual)
 Valids that two type are not equal ignoring case. More...
 
static void are_not_equal_ignoring_case (const std::u16string &expected, const std::u16string &actual, const xtd::tunit::line_info &line_info)
 Valids that two type are not equal ignoring case. More...
 
static void are_not_equal_ignoring_case (const std::u16string &expected, const std::u16string &actual, const std::string &message)
 Valids that two type are not equal ignoring case. More...
 
static void are_not_equal_ignoring_case (const std::u16string &expected, const std::u16string &actual, const std::string &message, const xtd::tunit::line_info &line_info)
 Valids that two type are not equal ignoring case. More...
 
static void are_not_equal_ignoring_case (const std::u32string &expected, const std::u32string &actual)
 Valids that two type are not equal ignoring case. More...
 
static void are_not_equal_ignoring_case (const std::u32string &expected, const std::u32string &actual, const xtd::tunit::line_info &line_info)
 Valids that two type are not equal ignoring case. More...
 
static void are_not_equal_ignoring_case (const std::u32string &expected, const std::u32string &actual, const std::string &message)
 Valids that two type are not equal ignoring case. More...
 
static void are_not_equal_ignoring_case (const std::u32string &expected, const std::u32string &actual, const std::string &message, const xtd::tunit::line_info &line_info)
 Valids that two type are not equal ignoring case. More...
 
static void are_not_equal_ignoring_case (const std::wstring &expected, const std::wstring &actual)
 Valids that two type are not equal ignoring case. More...
 
static void are_not_equal_ignoring_case (const std::wstring &expected, const std::wstring &actual, const xtd::tunit::line_info &line_info)
 Valids that two type are not equal ignoring case. More...
 
static void are_not_equal_ignoring_case (const std::wstring &expected, const std::wstring &actual, const std::string &message)
 Valids that two type are not equal ignoring case. More...
 
static void are_not_equal_ignoring_case (const std::wstring &expected, const std::wstring &actual, const std::string &message, const xtd::tunit::line_info &line_info)
 Valids that two type are not equal ignoring case. More...
 
static void contains (const std::string &item, const std::string &string)
 Valids that string contains an item. More...
 
static void contains (const std::string &item, const std::string &string, const xtd::tunit::line_info &line_info)
 Valids that string contains an item. More...
 
static void contains (const std::string &item, const std::string &string, const std::string &message)
 Valids that string contains an item. More...
 
static void contains (const std::string &item, const std::string &string, const std::string &message, const xtd::tunit::line_info &line_info)
 Valids that string contains an item. More...
 
static void contains (const std::u16string &item, const std::u16string &string)
 Valids that string contains an item. More...
 
static void contains (const std::u16string &item, const std::u16string &string, const xtd::tunit::line_info &line_info)
 Valids that string contains an item. More...
 
static void contains (const std::u16string &item, const std::u16string &string, const std::string &message)
 Valids that string contains an item. More...
 
static void contains (const std::u16string &item, const std::u16string &string, const std::string &message, const xtd::tunit::line_info &line_info)
 Valids that string contains an item. More...
 
static void contains (const std::u32string &item, const std::u32string &string)
 Valids that string contains an item. More...
 
static void contains (const std::u32string &item, const std::u32string &string, const xtd::tunit::line_info &line_info)
 Valids that string contains an item. More...
 
static void contains (const std::u32string &item, const std::u32string &string, const std::string &message)
 Valids that string contains an item. More...
 
static void contains (const std::u32string &item, const std::u32string &string, const std::string &message, const xtd::tunit::line_info &line_info)
 Valids that string contains an item. More...
 
static void contains (const std::wstring &item, const std::wstring &string)
 Valids that string contains an item. More...
 
static void contains (const std::wstring &item, const std::wstring &string, const xtd::tunit::line_info &line_info)
 Valids that string contains an item. More...
 
static void contains (const std::wstring &item, const std::wstring &string, const std::string &message)
 Valids that string contains an item. More...
 
static void contains (const std::wstring &item, const std::wstring &string, const std::string &message, const xtd::tunit::line_info &line_info)
 Valids that string contains an item. More...
 
static void does_not_contain (const std::string &item, const std::string &string)
 Valids that string contains an item. More...
 
static void does_not_contain (const std::string &item, const std::string &string, const xtd::tunit::line_info &line_info)
 Valids that string contains an item. More...
 
static void does_not_contain (const std::string &item, const std::string &string, const std::string &message)
 Valids that string contains an item. More...
 
static void does_not_contain (const std::string &item, const std::string &string, const std::string &message, const xtd::tunit::line_info &line_info)
 Valids that string contains an item. More...
 
static void does_not_contain (const std::u16string &item, const std::u16string &string)
 Valids that string contains an item. More...
 
static void does_not_contain (const std::u16string &item, const std::u16string &string, const xtd::tunit::line_info &line_info)
 Valids that string contains an item. More...
 
static void does_not_contain (const std::u16string &item, const std::u16string &string, const std::string &message)
 Valids that string contains an item. More...
 
static void does_not_contain (const std::u16string &item, const std::u16string &string, const std::string &message, const xtd::tunit::line_info &line_info)
 Valids that string contains an item. More...
 
static void does_not_contain (const std::u32string &item, const std::u32string &string)
 Valids that string contains an item. More...
 
static void does_not_contain (const std::u32string &item, const std::u32string &string, const xtd::tunit::line_info &line_info)
 Valids that string contains an item. More...
 
static void does_not_contain (const std::u32string &item, const std::u32string &string, const std::string &message)
 Valids that string contains an item. More...
 
static void does_not_contain (const std::u32string &item, const std::u32string &string, const std::string &message, const xtd::tunit::line_info &line_info)
 Valids that string contains an item. More...
 
static void does_not_contain (const std::wstring &item, const std::wstring &string)
 Valids that string contains an item. More...
 
static void does_not_contain (const std::wstring &item, const std::wstring &string, const xtd::tunit::line_info &line_info)
 Valids that string contains an item. More...
 
static void does_not_contain (const std::wstring &item, const std::wstring &string, const std::string &message)
 Valids that string contains an item. More...
 
static void does_not_contain (const std::wstring &item, const std::wstring &string, const std::string &message, const xtd::tunit::line_info &line_info)
 Valids that string contains an item. More...
 
static void does_not_end_with (const std::string &item, const std::string &string)
 Valids that string does not end witdh item. More...
 
static void does_not_end_with (const std::string &item, const std::string &string, const xtd::tunit::line_info &line_info)
 Valids that string starts with item. More...
 
static void does_not_end_with (const std::string &item, const std::string &string, const std::string &message)
 Valids that string starts with item. More...
 
static void does_not_end_with (const std::string &item, const std::string &string, const std::string &message, const xtd::tunit::line_info &line_info)
 Valids that string starts with item. More...
 
static void does_not_end_with (const std::u16string &item, const std::u16string &string)
 Valids that string starts with item. More...
 
static void does_not_end_with (const std::u16string &item, const std::u16string &string, const xtd::tunit::line_info &line_info)
 Valids that srinbg start with item. More...
 
static void does_not_end_with (const std::u16string &item, const std::u16string &string, const std::string &message)
 Valids that string does not end witdh item. More...
 
static void does_not_end_with (const std::u16string &item, const std::u16string &string, const std::string &message, const xtd::tunit::line_info &line_info)
 Valids that string does not end witdh item. More...
 
static void does_not_end_with (const std::u32string &item, const std::u32string &string)
 Valids that string does not end witdh item. More...
 
static void does_not_end_with (const std::u32string &item, const std::u32string &string, const xtd::tunit::line_info &line_info)
 Valids that string does not end witdh item. More...
 
static void does_not_end_with (const std::u32string &item, const std::u32string &string, const std::string &message)
 Valids that string does not end witdh item. More...
 
static void does_not_end_with (const std::u32string &item, const std::u32string &string, const std::string &message, const xtd::tunit::line_info &line_info)
 Valids that string does not end witdh item. More...
 
static void does_not_end_with (const std::wstring &item, const std::wstring &string)
 Valids that string does not end witdh item. More...
 
static void does_not_end_with (const std::wstring &item, const std::wstring &string, const xtd::tunit::line_info &line_info)
 Valids that string does not end witdh item. More...
 
static void does_not_end_with (const std::wstring &item, const std::wstring &string, const std::string &message)
 Valids that string does not end witdh item. More...
 
static void does_not_end_with (const std::wstring &item, const std::wstring &string, const std::string &message, const xtd::tunit::line_info &line_info)
 Valids that string does not end witdh item. More...
 
static void does_not_match (const std::string &regex_pattern, const std::string &actual)
 Valids that does not match regex patern. More...
 
static void does_not_match (const std::string &regex_pattern, const std::string &actual, const xtd::tunit::line_info &line_info)
 Valids that does not match regex patern. More...
 
static void does_not_match (const std::string &regex_pattern, const std::string &actual, const std::string &message)
 Valids that does not match regex patern. More...
 
static void does_not_match (const std::string &regex_pattern, const std::string &actual, const std::string &message, const xtd::tunit::line_info &line_info)
 Valids that does not match regex patern. More...
 
static void does_not_match (const std::wstring &regex_pattern, const std::wstring &actual)
 Valids that does not match regex patern. /. More...
 
static void does_not_match (const std::wstring &regex_pattern, const std::wstring &actual, const xtd::tunit::line_info &line_info)
 Valids that does not match regex patern. More...
 
static void does_not_match (const std::wstring &regex_pattern, const std::wstring &actual, const std::string &message)
 Valids that does not match regex patern. More...
 
static void does_not_match (const std::wstring &regex_pattern, const std::wstring &actual, const std::string &message, const xtd::tunit::line_info &line_info)
 Valids that does not match regex patern. More...
 
static void does_not_start_with (const std::string &item, const std::string &string)
 Valids that string does noy start witdh item. More...
 
static void does_not_start_with (const std::string &item, const std::string &string, const xtd::tunit::line_info &line_info)
 Valids that string starts with item. More...
 
static void does_not_start_with (const std::string &item, const std::string &string, const std::string &message)
 Valids that string starts with item. More...
 
static void does_not_start_with (const std::string &item, const std::string &string, const std::string &message, const xtd::tunit::line_info &line_info)
 Valids that string starts with item. More...
 
static void does_not_start_with (const std::u16string &item, const std::u16string &string)
 Valids that string starts with item. More...
 
static void does_not_start_with (const std::u16string &item, const std::u16string &string, const xtd::tunit::line_info &line_info)
 Valids that srinbg start with item. More...
 
static void does_not_start_with (const std::u16string &item, const std::u16string &string, const std::string &message)
 Valids that string does noy start witdh item. More...
 
static void does_not_start_with (const std::u16string &item, const std::u16string &string, const std::string &message, const xtd::tunit::line_info &line_info)
 Valids that string does noy start witdh item. More...
 
static void does_not_start_with (const std::u32string &item, const std::u32string &string)
 Valids that string does noy start witdh item. More...
 
static void does_not_start_with (const std::u32string &item, const std::u32string &string, const xtd::tunit::line_info &line_info)
 Valids that string does noy start witdh item. More...
 
static void does_not_start_with (const std::u32string &item, const std::u32string &string, const std::string &message)
 Valids that string does noy start witdh item. More...
 
static void does_not_start_with (const std::u32string &item, const std::u32string &string, const std::string &message, const xtd::tunit::line_info &line_info)
 Valids that string does noy start witdh item. More...
 
static void does_not_start_with (const std::wstring &item, const std::wstring &string)
 Valids that string does noy start witdh item. More...
 
static void does_not_start_with (const std::wstring &item, const std::wstring &string, const xtd::tunit::line_info &line_info)
 Valids that string does noy start witdh item. More...
 
static void does_not_start_with (const std::wstring &item, const std::wstring &string, const std::string &message)
 Valids that string does noy start witdh item. More...
 
static void does_not_start_with (const std::wstring &item, const std::wstring &string, const std::string &message, const xtd::tunit::line_info &line_info)
 Valids that string does noy start witdh item. More...
 
static void ends_with (const std::string &item, const std::string &string)
 Valids that string ends witdh item. More...
 
static void ends_with (const std::string &item, const std::string &string, const xtd::tunit::line_info &line_info)
 Valids that string starts with item. More...
 
static void ends_with (const std::string &item, const std::string &string, const std::string &message)
 Valids that string starts with item. More...
 
static void ends_with (const std::string &item, const std::string &string, const std::string &message, const xtd::tunit::line_info &line_info)
 Valids that string starts with item. More...
 
static void ends_with (const std::u16string &item, const std::u16string &string)
 Valids that string starts with item. More...
 
static void ends_with (const std::u16string &item, const std::u16string &string, const xtd::tunit::line_info &line_info)
 Valids that srinbg start with item. More...
 
static void ends_with (const std::u16string &item, const std::u16string &string, const std::string &message)
 Valids that string ends witdh item. More...
 
static void ends_with (const std::u16string &item, const std::u16string &string, const std::string &message, const xtd::tunit::line_info &line_info)
 Valids that string ends witdh item. More...
 
static void ends_with (const std::u32string &item, const std::u32string &string)
 Valids that string ends witdh item. More...
 
static void ends_with (const std::u32string &item, const std::u32string &string, const xtd::tunit::line_info &line_info)
 Valids that string ends witdh item. More...
 
static void ends_with (const std::u32string &item, const std::u32string &string, const std::string &message)
 Valids that string ends witdh item. More...
 
static void ends_with (const std::u32string &item, const std::u32string &string, const std::string &message, const xtd::tunit::line_info &line_info)
 Valids that string ends witdh item. More...
 
static void ends_with (const std::wstring &item, const std::wstring &string)
 Valids that string ends witdh item. More...
 
static void ends_with (const std::wstring &item, const std::wstring &string, const xtd::tunit::line_info &line_info)
 Valids that string ends witdh item. More...
 
static void ends_with (const std::wstring &item, const std::wstring &string, const std::string &message)
 Valids that string ends witdh item. More...
 
static void ends_with (const std::wstring &item, const std::wstring &string, const std::string &message, const xtd::tunit::line_info &line_info)
 Valids that string ends witdh item. More...
 
static void matches (const std::string &regex_pattern, const std::string &actual)
 Valids that matches regex patern. More...
 
static void matches (const std::string &regex_pattern, const std::string &actual, const xtd::tunit::line_info &line_info)
 Valids that matches regex patern. More...
 
static void matches (const std::string &regex_pattern, const std::string &actual, const std::string &message)
 Valids that matches regex patern. More...
 
static void matches (const std::string &regex_pattern, const std::string &actual, const std::string &message, const xtd::tunit::line_info &line_info)
 Valids that matches regex patern. More...
 
static void matches (const std::wstring &regex_pattern, const std::wstring &actual)
 Valids that matches regex patern. /. More...
 
static void matches (const std::wstring &regex_pattern, const std::wstring &actual, const xtd::tunit::line_info &line_info)
 Valids that matches regex patern. More...
 
static void matches (const std::wstring &regex_pattern, const std::wstring &actual, const std::string &message)
 Valids that matches regex patern. More...
 
static void matches (const std::wstring &regex_pattern, const std::wstring &actual, const std::string &message, const xtd::tunit::line_info &line_info)
 Valids that matches regex patern. More...
 
static void starts_with (const std::string &item, const std::string &string)
 Valids that string starts witdh item. More...
 
static void starts_with (const std::string &item, const std::string &string, const xtd::tunit::line_info &line_info)
 Valids that string starts with item. More...
 
static void starts_with (const std::string &item, const std::string &string, const std::string &message)
 Valids that string starts with item. More...
 
static void starts_with (const std::string &item, const std::string &string, const std::string &message, const xtd::tunit::line_info &line_info)
 Valids that string starts with item. More...
 
static void starts_with (const std::u16string &item, const std::u16string &string)
 Valids that string starts with item. More...
 
static void starts_with (const std::u16string &item, const std::u16string &string, const xtd::tunit::line_info &line_info)
 Valids that srinbg start with item. More...
 
static void starts_with (const std::u16string &item, const std::u16string &string, const std::string &message)
 Valids that string starts witdh item. More...
 
static void starts_with (const std::u16string &item, const std::u16string &string, const std::string &message, const xtd::tunit::line_info &line_info)
 Valids that string starts witdh item. More...
 
static void starts_with (const std::u32string &item, const std::u32string &string)
 Valids that string starts witdh item. More...
 
static void starts_with (const std::u32string &item, const std::u32string &string, const xtd::tunit::line_info &line_info)
 Valids that string starts witdh item. More...
 
static void starts_with (const std::u32string &item, const std::u32string &string, const std::string &message)
 Valids that string starts witdh item. More...
 
static void starts_with (const std::u32string &item, const std::u32string &string, const std::string &message, const xtd::tunit::line_info &line_info)
 Valids that string starts witdh item. More...
 
static void starts_with (const std::wstring &item, const std::wstring &string)
 Valids that string starts witdh item. More...
 
static void starts_with (const std::wstring &item, const std::wstring &string, const xtd::tunit::line_info &line_info)
 Valids that string starts witdh item. More...
 
static void starts_with (const std::wstring &item, const std::wstring &string, const std::string &message)
 Valids that string starts witdh item. More...
 
static void starts_with (const std::wstring &item, const std::wstring &string, const std::string &message, const xtd::tunit::line_info &line_info)
 Valids that string starts witdh item. 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 string_assume class contains a collection of static methods that implement the most string assertions used in xtd::tUnit.

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) {
public:
void test_method_(test_case1) {
}
void test_method_(test_case2) {
}
void test_method_(test_case3) {
assert::does_not_throw([] {throw std::range_error("error");});
}
};
}
int main() {
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 /Users/yves/Projects/xtd/examples/xtd.tunit.examples/assert/src/assert.cpp:14
// FAILED test.test_case3 (0 ms total)
// Expected: No Exception to be thrown
// But was: <std::range_error>
// Stack Trace: in /Users/yves/Projects/xtd/examples/xtd.tunit.examples/assert/src/assert.cpp:18
//
// Test results:
// SUCCEED 1 test.
// FAILED 2 tests.
// End 3 tests from 1 test case ran. (0 ms total)

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