Increases the maximum arity of AllOf() and AnyOf() to 10, by Marcus Börger.
This commit is contained in:
@@ -2889,82 +2889,6 @@ inline internal::NotMatcher<InnerMatcher> Not(InnerMatcher m) {
|
||||
return internal::NotMatcher<InnerMatcher>(m);
|
||||
}
|
||||
|
||||
// Creates a matcher that matches any value that matches all of the
|
||||
// given matchers.
|
||||
//
|
||||
// For now we only support up to 5 matchers. Support for more
|
||||
// matchers can be added as needed, or the user can use nested
|
||||
// AllOf()s.
|
||||
template <typename Matcher1, typename Matcher2>
|
||||
inline internal::BothOfMatcher<Matcher1, Matcher2>
|
||||
AllOf(Matcher1 m1, Matcher2 m2) {
|
||||
return internal::BothOfMatcher<Matcher1, Matcher2>(m1, m2);
|
||||
}
|
||||
|
||||
template <typename Matcher1, typename Matcher2, typename Matcher3>
|
||||
inline internal::BothOfMatcher<Matcher1,
|
||||
internal::BothOfMatcher<Matcher2, Matcher3> >
|
||||
AllOf(Matcher1 m1, Matcher2 m2, Matcher3 m3) {
|
||||
return AllOf(m1, AllOf(m2, m3));
|
||||
}
|
||||
|
||||
template <typename Matcher1, typename Matcher2, typename Matcher3,
|
||||
typename Matcher4>
|
||||
inline internal::BothOfMatcher<Matcher1,
|
||||
internal::BothOfMatcher<Matcher2,
|
||||
internal::BothOfMatcher<Matcher3, Matcher4> > >
|
||||
AllOf(Matcher1 m1, Matcher2 m2, Matcher3 m3, Matcher4 m4) {
|
||||
return AllOf(m1, AllOf(m2, m3, m4));
|
||||
}
|
||||
|
||||
template <typename Matcher1, typename Matcher2, typename Matcher3,
|
||||
typename Matcher4, typename Matcher5>
|
||||
inline internal::BothOfMatcher<Matcher1,
|
||||
internal::BothOfMatcher<Matcher2,
|
||||
internal::BothOfMatcher<Matcher3,
|
||||
internal::BothOfMatcher<Matcher4, Matcher5> > > >
|
||||
AllOf(Matcher1 m1, Matcher2 m2, Matcher3 m3, Matcher4 m4, Matcher5 m5) {
|
||||
return AllOf(m1, AllOf(m2, m3, m4, m5));
|
||||
}
|
||||
|
||||
// Creates a matcher that matches any value that matches at least one
|
||||
// of the given matchers.
|
||||
//
|
||||
// For now we only support up to 5 matchers. Support for more
|
||||
// matchers can be added as needed, or the user can use nested
|
||||
// AnyOf()s.
|
||||
template <typename Matcher1, typename Matcher2>
|
||||
inline internal::EitherOfMatcher<Matcher1, Matcher2>
|
||||
AnyOf(Matcher1 m1, Matcher2 m2) {
|
||||
return internal::EitherOfMatcher<Matcher1, Matcher2>(m1, m2);
|
||||
}
|
||||
|
||||
template <typename Matcher1, typename Matcher2, typename Matcher3>
|
||||
inline internal::EitherOfMatcher<Matcher1,
|
||||
internal::EitherOfMatcher<Matcher2, Matcher3> >
|
||||
AnyOf(Matcher1 m1, Matcher2 m2, Matcher3 m3) {
|
||||
return AnyOf(m1, AnyOf(m2, m3));
|
||||
}
|
||||
|
||||
template <typename Matcher1, typename Matcher2, typename Matcher3,
|
||||
typename Matcher4>
|
||||
inline internal::EitherOfMatcher<Matcher1,
|
||||
internal::EitherOfMatcher<Matcher2,
|
||||
internal::EitherOfMatcher<Matcher3, Matcher4> > >
|
||||
AnyOf(Matcher1 m1, Matcher2 m2, Matcher3 m3, Matcher4 m4) {
|
||||
return AnyOf(m1, AnyOf(m2, m3, m4));
|
||||
}
|
||||
|
||||
template <typename Matcher1, typename Matcher2, typename Matcher3,
|
||||
typename Matcher4, typename Matcher5>
|
||||
inline internal::EitherOfMatcher<Matcher1,
|
||||
internal::EitherOfMatcher<Matcher2,
|
||||
internal::EitherOfMatcher<Matcher3,
|
||||
internal::EitherOfMatcher<Matcher4, Matcher5> > > >
|
||||
AnyOf(Matcher1 m1, Matcher2 m2, Matcher3 m3, Matcher4 m4, Matcher5 m5) {
|
||||
return AnyOf(m1, AnyOf(m2, m3, m4, m5));
|
||||
}
|
||||
|
||||
// Returns a matcher that matches anything that satisfies the given
|
||||
// predicate. The predicate can be any unary function or functor
|
||||
// whose return type can be implicitly converted to bool.
|
||||
|
||||
Reference in New Issue
Block a user