Container Constraints
The following constraints can be applied to containers in the standard template library:
Contains Constraint
Used to verify that a container contains an expected value.
Composite syntax: Assert::That(container, Contains(12));
Fluent syntax: Assert::That(container, Is().Containing(12));
HasLength Constraint
Used to verify that a container has the expected length.
Composite syntax: Assert::That(container, HasLength(3));
Fluent syntax: Assert::That(container, Is().OfLength(3));
All
Used to verify that all elements of a STL sequence container matches an expectation.
Assert::That(container, Has().All().LessThan(5).Or().EqualTo(66));
AtLeast
Used to verify that at least a specified amount of elements in a STL sequence container matches an expectation.
Assert::That(container, Has().AtLeast(3).StartingWith("foo"));
AtMost
Used to verify that at most a specified amount of elements in a STL sequence container matches an expectation.
Assert:That(container, Has().AtMost(2).Not().Containing("failed"));
Exactly
Used to verify that a STL sequence container has exactly a specified amount of elements that matches an expectation.
Assert::That(container, Has().Exactly(3).GreaterThan(10).And().LessThan(20));