40 std::string_view pattern,
41 std::string_view reason = {},
42 std::optional<std::source_location> location = KAYCXX_ASSERT_DEFAULT_SOURCE
44 auto regex = std::regex(std::string(pattern));
45 if (detail::regex_matches(actual, regex)) {
46 auto actual_string = detail::to_string(actual);
47 auto expected_string = std::format(
"/{}/", pattern);
48 auto message = std::format(
"Expected <{}> not to match <{}>", actual_string, expected_string);
49 throw assertion_error(message, reason, std::move(actual_string), std::move(expected_string), location);
68 std::regex
const& regex,
69 std::string_view reason = {},
70 std::optional<std::source_location> location = KAYCXX_ASSERT_DEFAULT_SOURCE
72 if (detail::regex_matches(actual, regex)) {
73 auto actual_string = detail::to_string(actual);
74 auto message = std::format(
"Expected <{}> not to match regex", actual_string);
76 throw assertion_error(message, reason, std::move(actual_string),
"regex", location);
void assert_not_match(T const &actual, std::string_view pattern, std::string_view reason={}, std::optional< std::source_location > location=KAYCXX_ASSERT_DEFAULT_SOURCE)
Asserts that the argument does not match the given pattern.
Definition assert_not_match.hpp:38