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

Asserts that a string-like value does not fully match a regular expression.

The regex check is a full-value match. A value can still contain the pattern as a substring and pass this assertion when the complete value does not match.

#include <regex>
#include <kaycxx/test.hpp>
using namespace kaycxx::test;
int main() {
assert_not_match("user-x", "user-[0-9]+");
auto numeric_id = std::regex{"[0-9]+"};
assert_not_match("id-42", numeric_id);
}
Unit test framework functions and types.
Definition test.hpp:15
Includes the complete public test API.

Null C string pointers do not match and therefore pass assert_not_match.