kaycxx-test
C++ unit test framework
Loading...
Searching...
No Matches
assert_contain

Asserts that a string contains text or that a range contains an element.

String-like values use substring semantics. Other ranges use element lookup through std::ranges::find, so an element must compare equal to the expected value.

#include <vector>
#include <kaycxx/test.hpp>
using namespace kaycxx::test;
int main() {
assert_contain("hello world", "world");
assert_contain("abc", 'b');
auto values = std::vector{1, 2, 3};
assert_contain(values, 2);
}
Unit test framework functions and types.
Definition test.hpp:15
Includes the complete public test API.

Null C string pointers never contain anything.