restore mistakenly removed iffs in their explicit form
Due to confusion arisen from "iff" standing for "if and only if", this commit uses the latter.
This commit is contained in:
@@ -361,8 +361,8 @@ template <size_t N>
|
||||
class TuplePrefix {
|
||||
public:
|
||||
// TuplePrefix<N>::Matches(matcher_tuple, value_tuple) returns true
|
||||
// if the first N fields of matcher_tuple matches the first N
|
||||
// fields of value_tuple, respectively.
|
||||
// if and only if the first N fields of matcher_tuple matches
|
||||
// the first N fields of value_tuple, respectively.
|
||||
template <typename MatcherTuple, typename ValueTuple>
|
||||
static bool Matches(const MatcherTuple& matcher_tuple,
|
||||
const ValueTuple& value_tuple) {
|
||||
@@ -420,8 +420,8 @@ class TuplePrefix<0> {
|
||||
::std::ostream* /* os */) {}
|
||||
};
|
||||
|
||||
// TupleMatches(matcher_tuple, value_tuple) returns true if all
|
||||
// matchers in matcher_tuple match the corresponding fields in
|
||||
// TupleMatches(matcher_tuple, value_tuple) returns true if and only if
|
||||
// all matchers in matcher_tuple match the corresponding fields in
|
||||
// value_tuple. It is a compiler error if matcher_tuple and
|
||||
// value_tuple have different number of fields or incompatible field
|
||||
// types.
|
||||
@@ -2534,7 +2534,8 @@ class KeyMatcherImpl : public MatcherInterface<PairType> {
|
||||
testing::SafeMatcherCast<const KeyType&>(inner_matcher)) {
|
||||
}
|
||||
|
||||
// Returns true if 'key_value.first' (the key) matches the inner matcher.
|
||||
// Returns true if and only if 'key_value.first' (the key) matches the inner
|
||||
// matcher.
|
||||
bool MatchAndExplain(PairType key_value,
|
||||
MatchResultListener* listener) const override {
|
||||
StringMatchResultListener inner_listener;
|
||||
@@ -2616,8 +2617,8 @@ class PairMatcherImpl : public MatcherInterface<PairType> {
|
||||
second_matcher_.DescribeNegationTo(os);
|
||||
}
|
||||
|
||||
// Returns true if 'a_pair.first' matches first_matcher and 'a_pair.second'
|
||||
// matches second_matcher.
|
||||
// Returns true if and only if 'a_pair.first' matches first_matcher and
|
||||
// 'a_pair.second' matches second_matcher.
|
||||
bool MatchAndExplain(PairType a_pair,
|
||||
MatchResultListener* listener) const override {
|
||||
if (!listener->IsInterested()) {
|
||||
@@ -3152,8 +3153,8 @@ class ElementsAreArrayMatcher {
|
||||
|
||||
// Given a 2-tuple matcher tm of type Tuple2Matcher and a value second
|
||||
// of type Second, BoundSecondMatcher<Tuple2Matcher, Second>(tm,
|
||||
// second) is a polymorphic matcher that matches a value x if tm
|
||||
// matches tuple (x, second). Useful for implementing
|
||||
// second) is a polymorphic matcher that matches a value x if and only if
|
||||
// tm matches tuple (x, second). Useful for implementing
|
||||
// UnorderedPointwise() in terms of UnorderedElementsAreArray().
|
||||
//
|
||||
// BoundSecondMatcher is copyable and assignable, as we need to put
|
||||
@@ -3217,8 +3218,8 @@ class BoundSecondMatcher {
|
||||
|
||||
// Given a 2-tuple matcher tm and a value second,
|
||||
// MatcherBindSecond(tm, second) returns a matcher that matches a
|
||||
// value x if tm matches tuple (x, second). Useful for implementing
|
||||
// UnorderedPointwise() in terms of UnorderedElementsAreArray().
|
||||
// value x if and only if tm matches tuple (x, second). Useful for
|
||||
// implementing UnorderedPointwise() in terms of UnorderedElementsAreArray().
|
||||
template <typename Tuple2Matcher, typename Second>
|
||||
BoundSecondMatcher<Tuple2Matcher, Second> MatcherBindSecond(
|
||||
const Tuple2Matcher& tm, const Second& second) {
|
||||
@@ -3710,7 +3711,7 @@ WhenDynamicCastTo(const Matcher<To>& inner_matcher) {
|
||||
// Creates a matcher that matches an object whose given field matches
|
||||
// 'matcher'. For example,
|
||||
// Field(&Foo::number, Ge(5))
|
||||
// matches a Foo object x if x.number >= 5.
|
||||
// matches a Foo object x if and only if x.number >= 5.
|
||||
template <typename Class, typename FieldType, typename FieldMatcher>
|
||||
inline PolymorphicMatcher<
|
||||
internal::FieldMatcher<Class, FieldType> > Field(
|
||||
@@ -3737,7 +3738,7 @@ inline PolymorphicMatcher<internal::FieldMatcher<Class, FieldType> > Field(
|
||||
// Creates a matcher that matches an object whose given property
|
||||
// matches 'matcher'. For example,
|
||||
// Property(&Foo::str, StartsWith("hi"))
|
||||
// matches a Foo object x if x.str() starts with "hi".
|
||||
// matches a Foo object x if and only if x.str() starts with "hi".
|
||||
template <typename Class, typename PropertyType, typename PropertyMatcher>
|
||||
inline PolymorphicMatcher<internal::PropertyMatcher<
|
||||
Class, PropertyType, PropertyType (Class::*)() const> >
|
||||
@@ -3792,11 +3793,10 @@ Property(const std::string& property_name,
|
||||
property_name, property, MatcherCast<const PropertyType&>(matcher)));
|
||||
}
|
||||
|
||||
// Creates a matcher that matches an object if the result of applying
|
||||
// a callable to x matches 'matcher'.
|
||||
// For example,
|
||||
// Creates a matcher that matches an object if and only if the result of
|
||||
// applying a callable to x matches 'matcher'. For example,
|
||||
// ResultOf(f, StartsWith("hi"))
|
||||
// matches a Foo object x if f(x) starts with "hi".
|
||||
// matches a Foo object x if and only if f(x) starts with "hi".
|
||||
// `callable` parameter can be a function, function pointer, or a functor. It is
|
||||
// required to keep no state affecting the results of the calls on it and make
|
||||
// no assumptions about how many calls will be made. Any state it keeps must be
|
||||
@@ -4345,7 +4345,7 @@ inline internal::MatcherAsPredicate<M> Matches(M matcher) {
|
||||
return internal::MatcherAsPredicate<M>(matcher);
|
||||
}
|
||||
|
||||
// Returns true if the value matches the matcher.
|
||||
// Returns true if and only if the value matches the matcher.
|
||||
template <typename T, typename M>
|
||||
inline bool Value(const T& value, M matcher) {
|
||||
return testing::Matches(matcher)(value);
|
||||
@@ -4551,8 +4551,8 @@ PolymorphicMatcher<internal::variant_matcher::VariantMatcher<T> > VariantWith(
|
||||
|
||||
// These macros allow using matchers to check values in Google Test
|
||||
// tests. ASSERT_THAT(value, matcher) and EXPECT_THAT(value, matcher)
|
||||
// succeed if the value matches the matcher. If the assertion fails,
|
||||
// the value and the description of the matcher will be printed.
|
||||
// succeed if and only if the value matches the matcher. If the assertion
|
||||
// fails, the value and the description of the matcher will be printed.
|
||||
#define ASSERT_THAT(value, matcher) ASSERT_PRED_FORMAT1(\
|
||||
::testing::internal::MakePredicateFormatterFromMatcher(matcher), value)
|
||||
#define EXPECT_THAT(value, matcher) EXPECT_PRED_FORMAT1(\
|
||||
|
||||
Reference in New Issue
Block a user