xtd - Reference Guide  0.1.1
Modern c++17/20 framework to create console, GUI and unit test applications on Windows, macOS, Linux, iOS and android.
Static Public Member Functions | List of all members
xtd::tunit::collection_assert Class Referencefinal

#include <collection_assert.h>

Definition

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

Namespace
xtd::tunit
Library
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 |---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)
static void is_false(bool condition)
Asserts that ta condition is false.
Definition: assert.h:884
static void is_true(bool condition)
Asserts that ta condition is true.
Definition: assert.h:2489
static void does_not_throw(const std::function< void()> &statement)
Asserts that the staement does not throw an exception.
Definition: assert.h:709
The tunit namespace contains a unit test library.
Definition: abort_error.h:11

Inherits xtd::tunit::base_assert.

Static Public Member Functions

template<typename expected_t , typename collection_t >
static void all_items_are_instances_of (const collection_t &collection)
 Asserts that all collection items are of the type supplied or a derived type. More...
 
template<typename expected_t , typename collection_t >
static void all_items_are_instances_of (const collection_t &collection, const std::string &message)
 Asserts that all collection items are of the type supplied or a derived type. More...
 
template<typename expected_t , typename collection_t >
static void all_items_are_instances_of (const collection_t &collection, const std::string &message, const xtd::diagnostics::stack_frame &stack_frame)
 Asserts that all collection items are of the type supplied or a derived type. More...
 
template<typename expected_t , typename collection_t >
static void all_items_are_instances_of (const collection_t &collection, const xtd::diagnostics::stack_frame &stack_frame)
 Asserts that all collection items are of the type supplied or a derived type. More...
 
template<typename collection_t >
static void all_items_are_not_null (const collection_t &collection)
 Asserts that all collection items are not null. More...
 
template<typename collection_t >
static void all_items_are_not_null (const collection_t &collection, const std::string &message)
 Asserts that all collection items are not null. More...
 
template<typename collection_t >
static void all_items_are_not_null (const collection_t &collection, const std::string &message, const xtd::diagnostics::stack_frame &stack_frame)
 Asserts that all collection items are not null. More...
 
template<typename collection_t >
static void all_items_are_not_null (const collection_t &collection, const xtd::diagnostics::stack_frame &stack_frame)
 Asserts that all collection items are not null. More...
 
template<typename collection_t >
static void all_items_are_unique (const collection_t &collection)
 Asserts that all collection items are unique. More...
 
template<typename collection_t >
static void all_items_are_unique (const collection_t &collection, const std::string &message)
 Asserts that all collection items are unique. More...
 
template<typename collection_t >
static void all_items_are_unique (const collection_t &collection, const std::string &message, const xtd::diagnostics::stack_frame &stack_frame)
 Asserts that all collection items are unique. More...
 
template<typename collection_t >
static void all_items_are_unique (const collection_t &collection, const xtd::diagnostics::stack_frame &stack_frame)
 Asserts that all collection items are unique. More...
 
template<typename expected_t , typename actual_t >
static void are_equal (const expected_t &expected, const actual_t &actual)
 Asserts that all collection items are equal. More...
 
template<typename expected_t , typename actual_t >
static void are_equal (const expected_t &expected, const actual_t &actual, const std::string &message)
 Asserts that all collection items are equal. More...
 
template<typename expected_t , typename actual_t >
static void are_equal (const expected_t &expected, const actual_t &actual, const std::string &message, const xtd::diagnostics::stack_frame &stack_frame)
 Asserts that all collection items are equal. More...
 
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 all collection items are equal. More...
 
template<typename expected_t , typename actual_t >
static void are_equivalent (const expected_t &expected, const actual_t &actual)
 Asserts that all collection items are equivalent. More...
 
template<typename expected_t , typename actual_t >
static void are_equivalent (const expected_t &expected, const actual_t &actual, const std::string &message)
 Asserts that all collection items are equivalent. More...
 
template<typename expected_t , typename actual_t >
static void are_equivalent (const expected_t &expected, const actual_t &actual, const std::string &message, const xtd::diagnostics::stack_frame &stack_frame)
 Asserts that all collection items are equivalent. More...
 
template<typename expected_t , typename actual_t >
static void are_equivalent (const expected_t &expected, const actual_t &actual, const xtd::diagnostics::stack_frame &stack_frame)
 Asserts that all collection items are equivalent. More...
 
template<typename expected_t , typename actual_t >
static void are_not_equal (const expected_t &expected, const actual_t &actual)
 Asserts that all collection items are not equal. More...
 
template<typename expected_t , typename actual_t >
static void are_not_equal (const expected_t &expected, const actual_t &actual, const std::string &message)
 Asserts that all collection items are not equal. More...
 
template<typename expected_t , typename actual_t >
static void are_not_equal (const expected_t &expected, const actual_t &actual, const std::string &message, const xtd::diagnostics::stack_frame &stack_frame)
 Asserts that all collection items are not equal. More...
 
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 all collection items are not equal. More...
 
template<typename expected_t , typename actual_t >
static void are_not_equivalent (const expected_t &expected, const actual_t &actual)
 Asserts that all collection items are not equivalent. More...
 
template<typename expected_t , typename actual_t >
static void are_not_equivalent (const expected_t &expected, const actual_t &actual, const std::string &message)
 Asserts that all collection items are not equivalent. More...
 
template<typename expected_t , typename actual_t >
static void are_not_equivalent (const expected_t &expected, const actual_t &actual, const std::string &message, const xtd::diagnostics::stack_frame &stack_frame)
 Asserts that all collection items are not equivalent. More...
 
template<typename expected_t , typename actual_t >
static void are_not_equivalent (const expected_t &expected, const actual_t &actual, const xtd::diagnostics::stack_frame &stack_frame)
 Asserts that all collection items are not equivalent. More...
 
template<typename expected_t , typename actual_t >
static void contains (const expected_t &expected, const actual_t &actual)
 Asserts that collection contains all items. More...
 
template<typename expected_t , typename actual_t >
static void contains (const expected_t &expected, const actual_t &actual, const std::string &message)
 Asserts that collection contains all items. More...
 
template<typename expected_t , typename actual_t >
static void contains (const expected_t &expected, const actual_t &actual, const std::string &message, const xtd::diagnostics::stack_frame &stack_frame)
 Asserts that collection contains all items. More...
 
template<typename expected_t , typename actual_t >
static void contains (const expected_t &expected, const actual_t &actual, const xtd::diagnostics::stack_frame &stack_frame)
 Asserts that collection contains all items. More...
 
template<typename expected_t , typename actual_t >
static void does_not_contain (const expected_t &expected, const actual_t &actual)
 Asserts that collection contains all items. More...
 
template<typename expected_t , typename actual_t >
static void does_not_contain (const expected_t &expected, const actual_t &actual, const std::string &message)
 Asserts that collection contains all items. More...
 
template<typename expected_t , typename actual_t >
static void does_not_contain (const expected_t &expected, const actual_t &actual, const std::string &message, const xtd::diagnostics::stack_frame &stack_frame)
 Asserts that collection contains all items. More...
 
template<typename expected_t , typename actual_t >
static void does_not_contain (const expected_t &expected, const actual_t &actual, const xtd::diagnostics::stack_frame &stack_frame)
 Asserts that collection contains all items. More...
 
template<typename value_t >
static void is_empty (const value_t &value)
 Asserts that collection contains an item. More...
 
template<typename value_t >
static void is_empty (const value_t &value, const std::string &message)
 Asserts that collection contains an item. More...
 
template<typename value_t >
static void is_empty (const value_t &value, const std::string &message, const xtd::diagnostics::stack_frame &stack_frame)
 Asserts that collection contains an item. More...
 
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. More...
 
template<typename value_t >
static void is_not_empty (const value_t &value)
 Asserts that collection does not contain any item. More...
 
template<typename value_t >
static void is_not_empty (const value_t &value, const std::string &message)
 Asserts that collection or traits does not contain any item. More...
 
template<typename value_t >
static void is_not_empty (const value_t &value, const std::string &message, const xtd::diagnostics::stack_frame &stack_frame)
 Asserts that collection or traits does not contain any item. More...
 
template<typename value_t >
static void is_not_empty (const value_t &value, const xtd::diagnostics::stack_frame &stack_frame)
 Asserts that collection or traits does not contain any item. More...
 
template<typename value_t >
static void is_ordered (const value_t &value)
 Asserts that collection is ordered. More...
 
template<typename value_t >
static void is_ordered (const value_t &value, const std::string &message)
 Asserts that collection is ordered. More...
 
template<typename value_t >
static void is_ordered (const value_t &value, const std::string &message, const xtd::diagnostics::stack_frame &stack_frame)
 Asserts that collection is ordered. More...
 
template<typename value_t >
static void is_ordered (const value_t &value, const xtd::diagnostics::stack_frame &stack_frame)
 Asserts that collection is ordered. More...
 

Member Function Documentation

◆ all_items_are_instances_of() [1/4]

template<typename expected_t , typename collection_t >
static void xtd::tunit::collection_assert::all_items_are_instances_of ( const collection_t &  collection)
inlinestatic

Asserts that all collection items are 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::assertion_errorIf bad assertion.
Examples
std::vector<std::ios_base*> a = {&std::cout, &std::cerr, &std::cin};
xtd::tunit::collection_assert::all_items_are_instances_of<std::ios_base*>(a); // test ok.
xtd::tunit::collection_assert::all_items_are_instances_of<std::basic_ostream<char>*>(a); // test throws an assertion_error exception.
@ a
The A key.

◆ all_items_are_instances_of() [2/4]

template<typename expected_t , typename collection_t >
static void xtd::tunit::collection_assert::all_items_are_instances_of ( const collection_t &  collection,
const std::string &  message 
)
inlinestatic

Asserts that all collection items are 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::assertion_errorIf bad assertion.
Examples
std::vector<std::ios_base*> a = {&std::cout, &std::cerr, &std::cin};
xtd::tunit::collection_assert::all_items_are_instances_of<std::ios_base*>(a, "User message..."); // test ok.
xtd::tunit::collection_assert::all_items_are_instances_of<std::basic_ostream<char>*>(a, "User message..."); // test throws an assertion_error exception.

◆ all_items_are_instances_of() [3/4]

template<typename expected_t , typename collection_t >
static void xtd::tunit::collection_assert::all_items_are_instances_of ( const collection_t &  collection,
const std::string &  message,
const xtd::diagnostics::stack_frame stack_frame 
)
inlinestatic

Asserts that all collection items are 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::assertion_errorIf bad assertion.
Examples
std::vector<std::ios_base*> a = {&std::cout, &std::cerr, &std::cin};
xtd::tunit::collection_assert::all_items_are_instances_of<std::ios_base*>(a, "User message...", csf_); // test ok.
xtd::tunit::collection_assert::all_items_are_instances_of<std::basic_ostream<char>*>(a, "User message...", csf_); // test throws an assertion_error exception.
#define csf_
Provides information about the current stack frame.
Definition: stack_frame.h:213

◆ all_items_are_instances_of() [4/4]

template<typename expected_t , typename collection_t >
static void xtd::tunit::collection_assert::all_items_are_instances_of ( const collection_t &  collection,
const xtd::diagnostics::stack_frame stack_frame 
)
inlinestatic

Asserts that all collection items are 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::assertion_errorIf bad assertion.
Examples
std::vector<std::ios_base*> a = {&std::cout, &std::cerr, &std::cin};
xtd::tunit::collection_assert::all_items_are_instances_of<std::ios_base*>(a, csf_); // test ok.
xtd::tunit::collection_assert::all_items_are_instances_of<std::basic_ostream<char>*>(a, csf_); // test throws an assertion_error exception.

◆ all_items_are_not_null() [1/4]

template<typename collection_t >
static void xtd::tunit::collection_assert::all_items_are_not_null ( const collection_t &  collection)
inlinestatic

Asserts that all collection items are not null.

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::assertion_errorIf bad assertion.
Examples
int i1 = 0, i2 = 3;
std::vector<int*> a1 = {&i1, &i2};
std::vector<int*> a2 = {&i1, &i2, nullptr};
xtd::tunit::collection_assert::all_items_are_not_null(a2); // test throws an assertion_error exception.
static void all_items_are_not_null(const collection_t &collection)
Asserts that all collection items are not null.
Definition: collection_assert.h:121
@ a2
The a2 segment.
@ a1
The a1 segment.

◆ all_items_are_not_null() [2/4]

template<typename collection_t >
static void xtd::tunit::collection_assert::all_items_are_not_null ( const collection_t &  collection,
const std::string &  message 
)
inlinestatic

Asserts that all collection items are not null.

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::assertion_errorIf bad assertion.
Examples
int i1 = 0, i2 = 3;
std::vector<int*> a1 = {&i1, &i2};
xtd::tunit::collection_assert::all_items_are_not_null(a1, "User message..."); // test ok.
std::vector<int*> a2 = {&i1, &i2, nullptr};
xtd::tunit::collection_assert::all_items_are_not_null(a2, "User message..."); // test throws an assertion_error exception.

◆ all_items_are_not_null() [3/4]

template<typename collection_t >
static void xtd::tunit::collection_assert::all_items_are_not_null ( const collection_t &  collection,
const std::string &  message,
const xtd::diagnostics::stack_frame stack_frame 
)
inlinestatic

Asserts that all collection items are not null.

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::assertion_errorIf bad assertion.
Examples
int i1 = 0, i2 = 3;
std::vector<int*> a1 = {&i1, &i2};
xtd::tunit::collection_assert::all_items_are_not_null(a1, "User message...", csf_); // test ok.
std::vector<int*> a2 = {&i1, &i2, nullptr};
xtd::tunit::collection_assert::all_items_are_not_null(a2, "User message...", csf_); // test throws an assertion_error exception.

◆ all_items_are_not_null() [4/4]

template<typename collection_t >
static void xtd::tunit::collection_assert::all_items_are_not_null ( const collection_t &  collection,
const xtd::diagnostics::stack_frame stack_frame 
)
inlinestatic

Asserts that all collection items are not null.

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::assertion_errorIf bad assertion.
Examples
int i1 = 0, i2 = 3;
std::vector<int*> a1 = {&i1, &i2};
std::vector<int*> a2 = {&i1, &i2, nullptr};
xtd::tunit::collection_assert::all_items_are_not_null(a2, csf_); // test throws an assertion_error exception.

◆ all_items_are_unique() [1/4]

template<typename collection_t >
static void xtd::tunit::collection_assert::all_items_are_unique ( const collection_t &  collection)
inlinestatic

Asserts that all collection items are unique.

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::assertion_errorIf bad assertion.
Examples
std::vector<int> a1 = {1, 2, 3, 4};
std::vector<int> a2 = {1, 2, 3, 4, 1};
xtd::tunit::collection_assert::all_items_are_unique(a2); // test throws an assertion_error exception.
static void all_items_are_unique(const collection_t &collection)
Asserts that all collection items are unique.
Definition: collection_assert.h:209

◆ all_items_are_unique() [2/4]

template<typename collection_t >
static void xtd::tunit::collection_assert::all_items_are_unique ( const collection_t &  collection,
const std::string &  message 
)
inlinestatic

Asserts that all collection items are unique.

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::assertion_errorIf bad assertion.
Examples
std::vector<int> a1 = {1, 2, 3, 4};
xtd::tunit::collection_assert::all_items_are_unique(a1, "User message..."); // test ok.
std::vector<int> a2 = {1, 2, 3, 4, 1};
xtd::tunit::collection_assert::all_items_are_unique(a2, "User message..."); // test throws an assertion_error exception.

◆ all_items_are_unique() [3/4]

template<typename collection_t >
static void xtd::tunit::collection_assert::all_items_are_unique ( const collection_t &  collection,
const std::string &  message,
const xtd::diagnostics::stack_frame stack_frame 
)
inlinestatic

Asserts that all collection items are unique.

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::assertion_errorIf bad assertion.
Examples
std::vector<int> a1 = {1, 2, 3, 4};
xtd::tunit::collection_assert::all_items_are_unique(a1, "User message...", csf_); // test ok.
std::vector<int> a2 = {1, 2, 3, 4, 1};
xtd::tunit::collection_assert::all_items_are_unique(a2, "User message...", csf_); // test throws an assertion_error exception.

◆ all_items_are_unique() [4/4]

template<typename collection_t >
static void xtd::tunit::collection_assert::all_items_are_unique ( const collection_t &  collection,
const xtd::diagnostics::stack_frame stack_frame 
)
inlinestatic

Asserts that all collection items are unique.

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::assertion_errorIf bad assertion.
Examples
std::vector<int> a1 = {1, 2, 3, 4};
std::vector<int> a2 = {1, 2, 3, 4, 1};
xtd::tunit::collection_assert::all_items_are_unique(a2, csf_); // test throws an assertion_error exception.

◆ are_equal() [1/4]

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

Asserts that all collection items are equal.

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::assertion_errorIf bad assertion.
Examples
std::vector<int> a = {1, 2, 3, 4};
xtd::tunit::collection_assert::are_equal({1, 2, 3, 4}, a); // test ok.
xtd::tunit::collection_assert::are_equal({4, 3, 2, 1}, a); // test throws an assertion_error exception.
static void are_equal(const expected_t &expected, const actual_t &actual)
Asserts that all collection items are equal.
Definition: collection_assert.h:296

◆ are_equal() [2/4]

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

Asserts that all collection items are equal.

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::assertion_errorIf bad assertion.
Examples
std::vector<int> a = {1, 2, 3, 4};
xtd::tunit::collection_assert::are_equal({1, 2, 3, 4}, a, "User message..."); // test ok.
xtd::tunit::collection_assert::are_equal({4, 3, 2, 1}, a, "User message..."); // test throws an assertion_error exception.

◆ are_equal() [3/4]

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

Asserts that all collection items are equal.

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::assertion_errorIf bad assertion.
Examples
std::vector<int> a = {1, 2, 3, 4};
xtd::tunit::collection_assert::are_equal({1, 2, 3, 4}, a, "User message...", csf_); // test ok.
xtd::tunit::collection_assert::are_equal({4, 3, 2, 1}, a, "User message...", csf_); // test throws an assertion_error exception.

◆ are_equal() [4/4]

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

Asserts that all collection items are equal.

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::assertion_errorIf bad assertion.
Examples
std::vector<int> a = {1, 2, 3, 4};
xtd::tunit::collection_assert::are_equal({1, 2, 3, 4}, a, csf_); // test ok.
xtd::tunit::collection_assert::are_equal({4, 3, 2, 1}, a, csf_); // test throws an assertion_error exception.

◆ are_equivalent() [1/4]

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

Asserts that all collection items are equivalent.

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::assertion_errorIf bad assertion.
Examples
std::vector<int> a = {1, 2, 3, 4};
xtd::tunit::collection_assert::are_equivalent({1, 2, 3, 5}, a); // test throws an assertion_error exception.
static void are_equivalent(const expected_t &expected, const actual_t &actual)
Asserts that all collection items are equivalent.
Definition: collection_assert.h:403

◆ are_equivalent() [2/4]

template<typename expected_t , typename actual_t >
static void xtd::tunit::collection_assert::are_equivalent ( const expected_t &  expected,
const actual_t &  actual,
const std::string &  message 
)
inlinestatic

Asserts that all collection items are equivalent.

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::assertion_errorIf bad assertion.
Examples
std::vector<int> a = {1, 2, 3, 4};
xtd::tunit::collection_assert::are_equivalent({4, 3, 2, 1}, a, "User message..."); // test ok.
xtd::tunit::collection_assert::are_equivalent({1, 2, 3, 5}, a, "User message..."); // test throws an assertion_error exception.

◆ are_equivalent() [3/4]

template<typename expected_t , typename actual_t >
static void xtd::tunit::collection_assert::are_equivalent ( const expected_t &  expected,
const actual_t &  actual,
const std::string &  message,
const xtd::diagnostics::stack_frame stack_frame 
)
inlinestatic

Asserts that all collection items are equivalent.

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::assertion_errorIf bad assertion.
Examples
std::vector<int> a = {1, 2, 3, 4};
xtd::tunit::collection_assert::are_equivalent({4, 3, 2, 1}, a, "User message...", csf_); // test ok.
xtd::tunit::collection_assert::are_equivalent({1, 2, 3, 5}, a, "User message...", csf_); // test throws an assertion_error exception.

◆ are_equivalent() [4/4]

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

Asserts that all collection items are equivalent.

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::assertion_errorIf bad assertion.
Examples
std::vector<int> a = {1, 2, 3, 4};
xtd::tunit::collection_assert::are_equivalent({1, 2, 3, 5}, a, csf_); // test throws an assertion_error exception.

◆ are_not_equal() [1/4]

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

Asserts that all collection items are not equal.

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::assertion_errorIf bad assertion.
Examples
std::vector<int> a = {1, 2, 3, 4};
xtd::tunit::collection_assert::are_not_equal({1, 2, 3, 4}, a); // test throws an assertion_error exception.
static void are_not_equal(const expected_t &expected, const actual_t &actual)
Asserts that all collection items are not equal.
Definition: collection_assert.h:526

◆ are_not_equal() [2/4]

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

Asserts that all collection items are not equal.

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::assertion_errorIf bad assertion.
Examples
std::vector<int> a = {1, 2, 3, 4};
xtd::tunit::collection_assert::are_not_equal({4, 3, 2, 1}, a, "User message..."); // test ok.
xtd::tunit::collection_assert::are_not_equal({1, 2, 3, 4}, a, "User message..."); // test throws an assertion_error exception.

◆ are_not_equal() [3/4]

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

Asserts that all collection items are not equal.

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::assertion_errorIf bad assertion.
Examples
std::vector<int> a = {1, 2, 3, 4};
xtd::tunit::collection_assert::are_not_equal({4, 3, 2, 1}, a, "User message...", csf_); // test ok.
xtd::tunit::collection_assert::are_not_equal({1, 2, 3, 4}, a, "User message...", csf_); // test throws an assertion_error exception.

◆ are_not_equal() [4/4]

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

Asserts that all collection items are not equal.

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::assertion_errorIf bad assertion.
Examples
std::vector<int> a = {1, 2, 3, 4};
xtd::tunit::collection_assert::are_not_equal({1, 2, 3, 4}, a, csf_); // test throws an assertion_error exception.

◆ are_not_equivalent() [1/4]

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

Asserts that all collection items are not equivalent.

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::assertion_errorIf bad assertion.
Examples
std::vector<int> a = {1, 2, 3, 4};
xtd::tunit::collection_assert::are_not_equivalent({4, 3, 2, 1}, a); // test throws an assertion_error exception.
static void are_not_equivalent(const expected_t &expected, const actual_t &actual)
Asserts that all collection items are not equivalent.
Definition: collection_assert.h:633

◆ are_not_equivalent() [2/4]

template<typename expected_t , typename actual_t >
static void xtd::tunit::collection_assert::are_not_equivalent ( const expected_t &  expected,
const actual_t &  actual,
const std::string &  message 
)
inlinestatic

Asserts that all collection items are not equivalent.

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::assertion_errorIf bad assertion.
Examples
std::vector<int> a = {1, 2, 3, 4};
xtd::tunit::collection_assert::are_not_equivalent({1, 2, 3, 5}, a, "User message..."); // test ok.
xtd::tunit::collection_assert::are_not_equivalent({4, 3, 2, 1}, a, "User message..."); // test throws an assertion_error exception.

◆ are_not_equivalent() [3/4]

template<typename expected_t , typename actual_t >
static void xtd::tunit::collection_assert::are_not_equivalent ( const expected_t &  expected,
const actual_t &  actual,
const std::string &  message,
const xtd::diagnostics::stack_frame stack_frame 
)
inlinestatic

Asserts that all collection items are not equivalent.

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::assertion_errorIf bad assertion.
Examples
std::vector<int> a = {1, 2, 3, 4};
xtd::tunit::collection_assert::are_not_equivalent({1, 2, 3, 5}, a, "User message...", csf_); // test ok.
xtd::tunit::collection_assert::are_not_equivalent({4, 3, 2, 1}, a, "User message...", csf_); // test throws an assertion_error exception.

◆ are_not_equivalent() [4/4]

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

Asserts that all collection items are not equivalent.

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::assertion_errorIf bad assertion.
Examples
std::vector<int> a = {1, 2, 3, 4};
xtd::tunit::collection_assert::are_not_equivalent({4, 3, 2, 1}, a, csf_); // test throws an assertion_error exception.

◆ contains() [1/4]

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

Asserts that collection contains all items.

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::assertion_errorIf bad assertion.
Examples
std::vector<int> a = {1, 2, 3, 4};
xtd::tunit::collection_assert::contains({1, 2, 6}, a); // test throws an assertion_error exception.
static void contains(const expected_t &expected, const actual_t &actual)
Asserts that collection contains all items.
Definition: collection_assert.h:756

◆ contains() [2/4]

template<typename expected_t , typename actual_t >
static void xtd::tunit::collection_assert::contains ( const expected_t &  expected,
const actual_t &  actual,
const std::string &  message 
)
inlinestatic

Asserts that collection contains all items.

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::assertion_errorIf bad assertion.
Examples
std::vector<int> a = {1, 2, 3, 4};
xtd::tunit::collection_assert::contains({1, 2}, a, "User message..."); // test ok.
xtd::tunit::collection_assert::contains({1, 2, 6}, a, "User message..."); // test throws an assertion_error exception.

◆ contains() [3/4]

template<typename expected_t , typename actual_t >
static void xtd::tunit::collection_assert::contains ( const expected_t &  expected,
const actual_t &  actual,
const std::string &  message,
const xtd::diagnostics::stack_frame stack_frame 
)
inlinestatic

Asserts that collection contains all items.

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::assertion_errorIf bad assertion.
Examples
std::vector<int> a = {1, 2, 3, 4};
xtd::tunit::collection_assert::contains({1, 2}, a, "User message...", csf_); // test ok.
xtd::tunit::collection_assert::contains({1, 2, 6}, a, "User message...", csf_); // test throws an assertion_error exception.

◆ contains() [4/4]

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

Asserts that collection contains all items.

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::assertion_errorIf bad assertion.
Examples
std::vector<int> a = {1, 2, 3, 4};
xtd::tunit::collection_assert::contains({1, 2, 6}, a, csf_); // test throws an assertion_error exception.

◆ does_not_contain() [1/4]

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

Asserts that collection contains all items.

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::assertion_errorIf bad assertion.
Examples
std::vector<int> a = {1, 2, 3, 4};
xtd::tunit::collection_assert::does_not_contain({1, 2, 6}, a); // test throws an assertion_error exception.
static void does_not_contain(const expected_t &expected, const actual_t &actual)
Asserts that collection contains all items.
Definition: collection_assert.h:875

◆ does_not_contain() [2/4]

template<typename expected_t , typename actual_t >
static void xtd::tunit::collection_assert::does_not_contain ( const expected_t &  expected,
const actual_t &  actual,
const std::string &  message 
)
inlinestatic

Asserts that collection contains all items.

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::assertion_errorIf bad assertion.
Examples
std::vector<int> a = {1, 2, 3, 4};
xtd::tunit::collection_assert::does_not_contain({1, 2}, a, "User message..."); // test ok.
xtd::tunit::collection_assert::does_not_contain({1, 2, 6}, a, "User message..."); // test throws an assertion_error exception.

◆ does_not_contain() [3/4]

template<typename expected_t , typename actual_t >
static void xtd::tunit::collection_assert::does_not_contain ( const expected_t &  expected,
const actual_t &  actual,
const std::string &  message,
const xtd::diagnostics::stack_frame stack_frame 
)
inlinestatic

Asserts that collection contains all items.

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::assertion_errorIf bad assertion.
Examples
std::vector<int> a = {1, 2, 3, 4};
xtd::tunit::collection_assert::does_not_contain({1, 2}, a, "User message...", csf_); // test ok.
xtd::tunit::collection_assert::does_not_contain({1, 2, 6}, a, "User message...", csf_); // test throws an assertion_error exception.

◆ does_not_contain() [4/4]

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

Asserts that collection contains all items.

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::assertion_errorIf bad assertion.
Examples
std::vector<int> a = {1, 2, 3, 4};
xtd::tunit::collection_assert::does_not_contain({1, 2, 6}, a, csf_); // test throws an assertion_error exception.

◆ is_empty() [1/4]

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

Asserts that collection contains an item.

Parameters
valueThe value to check is empty.
Exceptions
xtd::tunit::assertion_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 assertion_error exception.
static void is_empty(const value_t &value)
Asserts that collection contains an item.
Definition: assert.h:768

◆ is_empty() [2/4]

template<typename value_t >
static void xtd::tunit::collection_assert::is_empty ( const value_t &  value,
const std::string &  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::assertion_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 assertion_error exception.

◆ is_empty() [3/4]

template<typename value_t >
static void xtd::tunit::collection_assert::is_empty ( const value_t &  value,
const std::string &  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::assertion_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 assertion_error exception.

◆ is_empty() [4/4]

template<typename value_t >
static void xtd::tunit::collection_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::assertion_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 assertion_error exception.

◆ is_not_empty() [1/4]

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

Asserts that collection does not contain any item.

Parameters
valueThe value to check is empty.
Exceptions
xtd::tunit::assertion_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 assertion_error exception.
static void is_not_empty(const value_t &value)
Asserts that collection oes not contain any item.
Definition: assert.h:1617

◆ is_not_empty() [2/4]

template<typename value_t >
static void xtd::tunit::collection_assert::is_not_empty ( const value_t &  value,
const std::string &  message 
)
inlinestatic

Asserts that collection or traits 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::assertion_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 assertion_error exception.

◆ is_not_empty() [3/4]

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

Asserts that collection or traits 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::assertion_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 assertion_error exception.

◆ is_not_empty() [4/4]

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

Asserts that collection or traits does not contain any item.

Parameters
valueThe value to check is empty.
stack_frameContains information about current file and current line.
Exceptions
xtd::tunit::assertion_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 assertion_error exception.

◆ is_ordered() [1/4]

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

Asserts that collection is ordered.

Parameters
valueThe value to check is empty.
Exceptions
xtd::tunit::assertion_errorIf bad assertion.
Examples
std::vector<int> v1 = {1, 2, 3, 4};
std::vector<int> v2 = {1, 2, 4, 3};
xtd::tunit::assert::is_ordered(v1); // test ok.
xtd::tunit::assert::is_ordered(v2); // test throws an assertion_error exception.

◆ is_ordered() [2/4]

template<typename value_t >
static void xtd::tunit::collection_assert::is_ordered ( const value_t &  value,
const std::string &  message 
)
inlinestatic

Asserts that collection is ordered.

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::assertion_errorIf bad assertion.
Examples
std::vector<int> v1 = {1, 2, 3, 4};
std::vector<int> v2 = {1, 2, 4, 3};
xtd::tunit::assert::is_ordered(v1, "User message..."); // test ok.
xtd::tunit::assert::is_ordered(v2, "User message..."); // test throws an assertion_error exception.

◆ is_ordered() [3/4]

template<typename value_t >
static void xtd::tunit::collection_assert::is_ordered ( const value_t &  value,
const std::string &  message,
const xtd::diagnostics::stack_frame stack_frame 
)
inlinestatic

Asserts that collection is ordered.

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::assertion_errorIf bad assertion.
Examples
std::vector<int> v1 = {1, 2, 3, 4};
std::vector<int> v2 = {1, 2, 4, 3};
xtd::tunit::assert::is_ordered(v1, "User message...", csf_); // test ok.
xtd::tunit::assert::is_ordered(v2, "User message...", csf_); // test throws an assertion_error exception.

◆ is_ordered() [4/4]

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

Asserts that collection is ordered.

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

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