mimic++ v4
Loading...
Searching...
No Matches
Matcher.hpp File Reference
#include "mimic++/Fwd.hpp"
#include "mimic++/Printer.hpp"
#include "mimic++/String.hpp"
#include "mimic++/TypeTraits.hpp"
#include "mimic++/Utility.hpp"
#include <algorithm>
#include <concepts>
#include <functional>
#include <optional>
#include <ranges>
#include <tuple>
#include <type_traits>
Include dependency graph for Matcher.hpp:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

class  mimicpp::PredicateMatcher< Predicate, AdditionalArgs >
 Generic matcher and the basic building block of most of the built-in matchers. More...
 
class  mimicpp::WildcardMatcher
 Matcher, which never fails. More...
 
struct  mimicpp::case_insensitive_t
 Tag type, used in string matchers. More...
 

Namespaces

namespace  mimicpp
 
namespace  mimicpp::custom
 
namespace  mimicpp::matches
 
namespace  mimicpp::matches::str
 
namespace  mimicpp::matches::range
 

Concepts

concept  mimicpp::matcher_for
 

Functions

template<typename T >
constexpr auto mimicpp::matches::eq (T &&value)
 Tests, whether the target compares equal to the expected value.
 
template<typename T >
constexpr auto mimicpp::matches::ne (T &&value)
 Tests, whether the target compares not equal to the expected value.
 
template<typename T >
constexpr auto mimicpp::matches::lt (T &&value)
 Tests, whether the target is less than the expected value.
 
template<typename T >
constexpr auto mimicpp::matches::le (T &&value)
 Tests, whether the target is less than or equal to the expected value.
 
template<typename T >
constexpr auto mimicpp::matches::gt (T &&value)
 Tests, whether the target is greater than the expected value.
 
template<typename T >
constexpr auto mimicpp::matches::ge (T &&value)
 Tests, whether the target is greater than or equal to the expected value.
 
template<typename UnaryPredicate >
constexpr auto mimicpp::matches::predicate (UnaryPredicate &&predicate, StringT description="passes predicate", StringT invertedDescription="fails predicate")
 Tests, whether the target fulfills the given predicate.
 
template<satisfies< std::is_lvalue_reference > T>
constexpr auto mimicpp::matches::instance (T &&instance)
 Tests, whether the target is the expected instance.
 
template<string Pattern>
constexpr auto mimicpp::matches::str::eq (Pattern &&pattern)
 Tests, whether the target string compares equal to the expected string.
 
template<case_foldable_string Pattern>
constexpr auto mimicpp::matches::str::eq (Pattern &&pattern, const case_insensitive_t)
 Tests, whether the target string compares case-insensitively equal to the expected string.
 
template<string Pattern>
constexpr auto mimicpp::matches::str::starts_with (Pattern &&pattern)
 Tests, whether the target string starts with the pattern string.
 
template<string Pattern>
constexpr auto mimicpp::matches::str::starts_with (Pattern &&pattern, const case_insensitive_t)
 Tests, whether the target string starts case-insensitively with the pattern string.
 
template<string Pattern>
constexpr auto mimicpp::matches::str::ends_with (Pattern &&pattern)
 Tests, whether the target string ends with the pattern string.
 
template<string Pattern>
constexpr auto mimicpp::matches::str::ends_with (Pattern &&pattern, const case_insensitive_t)
 Tests, whether the target string ends case-insensitively with the pattern string.
 
template<string Pattern>
constexpr auto mimicpp::matches::str::contains (Pattern &&pattern)
 Tests, whether the pattern string is part of the target string.
 
template<string Pattern>
constexpr auto mimicpp::matches::str::contains (Pattern &&pattern, const case_insensitive_t)
 Tests, whether the pattern string is case-insensitively part of the target string.
 
template<std::ranges::forward_range Range, typename Comparator = std::equal_to<>>
constexpr auto mimicpp::matches::range::eq (Range &&expected, Comparator comparator=Comparator{})
 Tests, whether the target range compares equal to the expected range, by comparing them element-wise.
 
template<std::ranges::forward_range Range, typename Comparator = std::equal_to<>>
constexpr auto mimicpp::matches::range::unordered_eq (Range &&expected, Comparator comparator=Comparator{})
 Tests, whether the target range is a permutation of the expected range, by comparing them element-wise.
 
template<typename Relation = std::ranges::less>
constexpr auto mimicpp::matches::range::is_sorted (Relation relation=Relation{})
 Tests, whether the target range is sorted, by applying the relation on each adjacent elements.
 
constexpr auto mimicpp::matches::range::is_empty ()
 Tests, whether the target range is empty.
 
constexpr auto mimicpp::matches::range::has_size (const std::integral auto expected)
 Tests, whether the target range has the expected size.
 
template<typename Matcher >
constexpr auto mimicpp::matches::range::each_element (Matcher &&matcher)
 Tests, whether each element of the target range matches the specified matcher.
 
template<typename Matcher >
constexpr auto mimicpp::matches::range::any_element (Matcher &&matcher)
 Tests, whether any element of the target range matches the specified matcher.
 

Variables

constexpr WildcardMatcher mimicpp::matches::_ {}
 The wildcard matcher, always matching.
 
struct mimicpp::case_insensitive_t mimicpp::case_insensitive