|
|
|
@ -2680,7 +2680,7 @@ TEST(AllOfTest, ExplainsResult) { |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// Helper to allow easy testing of AnyOf matchers with num parameters.
|
|
|
|
|
void AnyOfMatches(int num, const Matcher<int>& m) { |
|
|
|
|
static void AnyOfMatches(int num, const Matcher<int>& m) { |
|
|
|
|
SCOPED_TRACE(Describe(m)); |
|
|
|
|
EXPECT_FALSE(m.Matches(0)); |
|
|
|
|
for (int i = 1; i <= num; ++i) { |
|
|
|
@ -2689,6 +2689,18 @@ void AnyOfMatches(int num, const Matcher<int>& m) { |
|
|
|
|
EXPECT_FALSE(m.Matches(num + 1)); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
#if GTEST_LANG_CXX11 |
|
|
|
|
static void AnyOfStringMatches(int num, const Matcher<std::string>& m) { |
|
|
|
|
SCOPED_TRACE(Describe(m)); |
|
|
|
|
EXPECT_FALSE(m.Matches(std::to_string(0))); |
|
|
|
|
|
|
|
|
|
for (int i = 1; i <= num; ++i) { |
|
|
|
|
EXPECT_TRUE(m.Matches(std::to_string(i))); |
|
|
|
|
} |
|
|
|
|
EXPECT_FALSE(m.Matches(std::to_string(num + 1))); |
|
|
|
|
} |
|
|
|
|
#endif |
|
|
|
|
|
|
|
|
|
// Tests that AnyOf(m1, ..., mn) matches any value that matches at
|
|
|
|
|
// least one of the given matchers.
|
|
|
|
|
TEST(AnyOfTest, MatchesWhenAnyMatches) { |
|
|
|
@ -2746,6 +2758,12 @@ TEST(AnyOfTest, VariadicMatchesWhenAnyMatches) { |
|
|
|
|
21, 22, 23, 24, 25, 26, 27, 28, 29, 30, |
|
|
|
|
31, 32, 33, 34, 35, 36, 37, 38, 39, 40, |
|
|
|
|
41, 42, 43, 44, 45, 46, 47, 48, 49, 50)); |
|
|
|
|
AnyOfStringMatches( |
|
|
|
|
50, AnyOf("1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12", |
|
|
|
|
"13", "14", "15", "16", "17", "18", "19", "20", "21", "22", |
|
|
|
|
"23", "24", "25", "26", "27", "28", "29", "30", "31", "32", |
|
|
|
|
"33", "34", "35", "36", "37", "38", "39", "40", "41", "42", |
|
|
|
|
"43", "44", "45", "46", "47", "48", "49", "50")); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// Tests the variadic version of the ElementsAreMatcher
|
|
|
|
@ -4220,13 +4238,17 @@ TEST(PropertyTest, WorksForReferenceToConstProperty) { |
|
|
|
|
// ref-qualified.
|
|
|
|
|
TEST(PropertyTest, WorksForRefQualifiedProperty) { |
|
|
|
|
Matcher<const AClass&> m = Property(&AClass::s_ref, StartsWith("hi")); |
|
|
|
|
Matcher<const AClass&> m_with_name = |
|
|
|
|
Property("s", &AClass::s_ref, StartsWith("hi")); |
|
|
|
|
|
|
|
|
|
AClass a; |
|
|
|
|
a.set_s("hill"); |
|
|
|
|
EXPECT_TRUE(m.Matches(a)); |
|
|
|
|
EXPECT_TRUE(m_with_name.Matches(a)); |
|
|
|
|
|
|
|
|
|
a.set_s("hole"); |
|
|
|
|
EXPECT_FALSE(m.Matches(a)); |
|
|
|
|
EXPECT_FALSE(m_with_name.Matches(a)); |
|
|
|
|
} |
|
|
|
|
#endif |
|
|
|
|
|
|
|
|
@ -4570,7 +4592,7 @@ TEST(ResultOfTest, WorksForFunctors) { |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// Tests that ResultOf(f, ...) compiles and works as expected when f is a
|
|
|
|
|
// functor with more then one operator() defined. ResultOf() must work
|
|
|
|
|
// functor with more than one operator() defined. ResultOf() must work
|
|
|
|
|
// for each defined operator().
|
|
|
|
|
struct PolymorphicFunctor { |
|
|
|
|
typedef int result_type; |
|
|
|
@ -6764,4 +6786,3 @@ TEST(NotTest, WorksOnMoveOnlyType) { |
|
|
|
|
|
|
|
|
|
} // namespace gmock_matchers_test
|
|
|
|
|
} // namespace testing
|
|
|
|
|
|
|
|
|
|