summaryrefslogtreecommitdiffstats
path: root/googlemock/include/gmock/gmock-matchers.h
diff options
context:
space:
mode:
authorShaindel Schwartz <shaindel@google.com>2019-09-12 16:10:51 (GMT)
committerShaindel Schwartz <shaindel@google.com>2019-09-12 16:10:51 (GMT)
commitc7a03daa99e7c457561b5dd2afc0eddab166e48e (patch)
treeef122e5c8d5e0c5239a29f1a56012445f59cb867 /googlemock/include/gmock/gmock-matchers.h
parentac24edd6e06114818b1a29c99bb81153514f7fb2 (diff)
parent7bd4a7f3e9ae46bb7d99fc5fd5dd1a137496bb6a (diff)
downloadgoogletest-c7a03daa99e7c457561b5dd2afc0eddab166e48e.zip
googletest-c7a03daa99e7c457561b5dd2afc0eddab166e48e.tar.gz
googletest-c7a03daa99e7c457561b5dd2afc0eddab166e48e.tar.bz2
Merge pull request #2387 from kuzkry:iff
PiperOrigin-RevId: 268693457
Diffstat (limited to 'googlemock/include/gmock/gmock-matchers.h')
-rw-r--r--googlemock/include/gmock/gmock-matchers.h40
1 files changed, 20 insertions, 20 deletions
diff --git a/googlemock/include/gmock/gmock-matchers.h b/googlemock/include/gmock/gmock-matchers.h
index 7009215..ad16687 100644
--- a/googlemock/include/gmock/gmock-matchers.h
+++ b/googlemock/include/gmock/gmock-matchers.h
@@ -358,8 +358,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) {
@@ -417,8 +417,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.
@@ -2530,7 +2530,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;
@@ -2612,8 +2613,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()) {
@@ -3148,8 +3149,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
@@ -3213,8 +3214,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) {
@@ -3705,7 +3706,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(
@@ -3732,7 +3733,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> >
@@ -3787,11 +3788,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
@@ -4341,7 +4341,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);
@@ -4547,8 +4547,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(\