aboutsummaryrefslogtreecommitdiffstats
path: root/googlemock/test/gmock-matchers_test.cc
diff options
context:
space:
mode:
authorGennadiy Civil <gennadiycivil@users.noreply.github.com>2018-10-19 13:30:13 -0700
committerGitHub <noreply@github.com>2018-10-19 13:30:13 -0700
commitc955e33497965a90c936a221610bdfb7fad3ca49 (patch)
tree803c4727654f51b8e70071f54498903a93ecb724 /googlemock/test/gmock-matchers_test.cc
parent3149e0e88bf09841009851a478dd835fc557aaa1 (diff)
parentf410177a8b54705bb5efaa7be4ef322153349187 (diff)
downloadgoogletest-c955e33497965a90c936a221610bdfb7fad3ca49.tar.gz
googletest-c955e33497965a90c936a221610bdfb7fad3ca49.tar.bz2
googletest-c955e33497965a90c936a221610bdfb7fad3ca49.zip
Merge branch 'master' into python3-tests
Diffstat (limited to 'googlemock/test/gmock-matchers_test.cc')
-rw-r--r--googlemock/test/gmock-matchers_test.cc230
1 files changed, 98 insertions, 132 deletions
diff --git a/googlemock/test/gmock-matchers_test.cc b/googlemock/test/gmock-matchers_test.cc
index ceff5b08..f4e9e9f7 100644
--- a/googlemock/test/gmock-matchers_test.cc
+++ b/googlemock/test/gmock-matchers_test.cc
@@ -136,7 +136,6 @@ using testing::Value;
using testing::WhenSorted;
using testing::WhenSortedBy;
using testing::_;
-using testing::get;
using testing::internal::DummyMatchResultListener;
using testing::internal::ElementMatcherPair;
using testing::internal::ElementMatcherPairs;
@@ -153,8 +152,6 @@ using testing::internal::Strings;
using testing::internal::linked_ptr;
using testing::internal::scoped_ptr;
using testing::internal::string;
-using testing::make_tuple;
-using testing::tuple;
// For testing ExplainMatchResultTo().
class GreaterThanMatcher : public MatcherInterface<int> {
@@ -2239,8 +2236,7 @@ TEST(GlobalWideEndsWithTest, CanDescribeSelf) {
#endif // GTEST_HAS_GLOBAL_WSTRING
-
-typedef ::testing::tuple<long, int> Tuple2; // NOLINT
+typedef ::std::tuple<long, int> Tuple2; // NOLINT
// Tests that Eq() matches a 2-tuple where the first field == the
// second field.
@@ -2334,7 +2330,7 @@ TEST(Ne2Test, CanDescribeSelf) {
// Tests that FloatEq() matches a 2-tuple where
// FloatEq(first field) matches the second field.
TEST(FloatEq2Test, MatchesEqualArguments) {
- typedef ::testing::tuple<float, float> Tpl;
+ typedef ::std::tuple<float, float> Tpl;
Matcher<const Tpl&> m = FloatEq();
EXPECT_TRUE(m.Matches(Tpl(1.0f, 1.0f)));
EXPECT_TRUE(m.Matches(Tpl(0.3f, 0.1f + 0.1f + 0.1f)));
@@ -2343,14 +2339,14 @@ TEST(FloatEq2Test, MatchesEqualArguments) {
// Tests that FloatEq() describes itself properly.
TEST(FloatEq2Test, CanDescribeSelf) {
- Matcher<const ::testing::tuple<float, float>&> m = FloatEq();
+ Matcher<const ::std::tuple<float, float>&> m = FloatEq();
EXPECT_EQ("are an almost-equal pair", Describe(m));
}
// Tests that NanSensitiveFloatEq() matches a 2-tuple where
// NanSensitiveFloatEq(first field) matches the second field.
TEST(NanSensitiveFloatEqTest, MatchesEqualArgumentsWithNaN) {
- typedef ::testing::tuple<float, float> Tpl;
+ typedef ::std::tuple<float, float> Tpl;
Matcher<const Tpl&> m = NanSensitiveFloatEq();
EXPECT_TRUE(m.Matches(Tpl(1.0f, 1.0f)));
EXPECT_TRUE(m.Matches(Tpl(std::numeric_limits<float>::quiet_NaN(),
@@ -2362,14 +2358,14 @@ TEST(NanSensitiveFloatEqTest, MatchesEqualArgumentsWithNaN) {
// Tests that NanSensitiveFloatEq() describes itself properly.
TEST(NanSensitiveFloatEqTest, CanDescribeSelfWithNaNs) {
- Matcher<const ::testing::tuple<float, float>&> m = NanSensitiveFloatEq();
+ Matcher<const ::std::tuple<float, float>&> m = NanSensitiveFloatEq();
EXPECT_EQ("are an almost-equal pair", Describe(m));
}
// Tests that DoubleEq() matches a 2-tuple where
// DoubleEq(first field) matches the second field.
TEST(DoubleEq2Test, MatchesEqualArguments) {
- typedef ::testing::tuple<double, double> Tpl;
+ typedef ::std::tuple<double, double> Tpl;
Matcher<const Tpl&> m = DoubleEq();
EXPECT_TRUE(m.Matches(Tpl(1.0, 1.0)));
EXPECT_TRUE(m.Matches(Tpl(0.3, 0.1 + 0.1 + 0.1)));
@@ -2378,14 +2374,14 @@ TEST(DoubleEq2Test, MatchesEqualArguments) {
// Tests that DoubleEq() describes itself properly.
TEST(DoubleEq2Test, CanDescribeSelf) {
- Matcher<const ::testing::tuple<double, double>&> m = DoubleEq();
+ Matcher<const ::std::tuple<double, double>&> m = DoubleEq();
EXPECT_EQ("are an almost-equal pair", Describe(m));
}
// Tests that NanSensitiveDoubleEq() matches a 2-tuple where
// NanSensitiveDoubleEq(first field) matches the second field.
TEST(NanSensitiveDoubleEqTest, MatchesEqualArgumentsWithNaN) {
- typedef ::testing::tuple<double, double> Tpl;
+ typedef ::std::tuple<double, double> Tpl;
Matcher<const Tpl&> m = NanSensitiveDoubleEq();
EXPECT_TRUE(m.Matches(Tpl(1.0f, 1.0f)));
EXPECT_TRUE(m.Matches(Tpl(std::numeric_limits<double>::quiet_NaN(),
@@ -2397,14 +2393,14 @@ TEST(NanSensitiveDoubleEqTest, MatchesEqualArgumentsWithNaN) {
// Tests that DoubleEq() describes itself properly.
TEST(NanSensitiveDoubleEqTest, CanDescribeSelfWithNaNs) {
- Matcher<const ::testing::tuple<double, double>&> m = NanSensitiveDoubleEq();
+ Matcher<const ::std::tuple<double, double>&> m = NanSensitiveDoubleEq();
EXPECT_EQ("are an almost-equal pair", Describe(m));
}
// Tests that FloatEq() matches a 2-tuple where
// FloatNear(first field, max_abs_error) matches the second field.
TEST(FloatNear2Test, MatchesEqualArguments) {
- typedef ::testing::tuple<float, float> Tpl;
+ typedef ::std::tuple<float, float> Tpl;
Matcher<const Tpl&> m = FloatNear(0.5f);
EXPECT_TRUE(m.Matches(Tpl(1.0f, 1.0f)));
EXPECT_TRUE(m.Matches(Tpl(1.3f, 1.0f)));
@@ -2413,14 +2409,14 @@ TEST(FloatNear2Test, MatchesEqualArguments) {
// Tests that FloatNear() describes itself properly.
TEST(FloatNear2Test, CanDescribeSelf) {
- Matcher<const ::testing::tuple<float, float>&> m = FloatNear(0.5f);
+ Matcher<const ::std::tuple<float, float>&> m = FloatNear(0.5f);
EXPECT_EQ("are an almost-equal pair", Describe(m));
}
// Tests that NanSensitiveFloatNear() matches a 2-tuple where
// NanSensitiveFloatNear(first field) matches the second field.
TEST(NanSensitiveFloatNearTest, MatchesNearbyArgumentsWithNaN) {
- typedef ::testing::tuple<float, float> Tpl;
+ typedef ::std::tuple<float, float> Tpl;
Matcher<const Tpl&> m = NanSensitiveFloatNear(0.5f);
EXPECT_TRUE(m.Matches(Tpl(1.0f, 1.0f)));
EXPECT_TRUE(m.Matches(Tpl(1.1f, 1.0f)));
@@ -2433,15 +2429,14 @@ TEST(NanSensitiveFloatNearTest, MatchesNearbyArgumentsWithNaN) {
// Tests that NanSensitiveFloatNear() describes itself properly.
TEST(NanSensitiveFloatNearTest, CanDescribeSelfWithNaNs) {
- Matcher<const ::testing::tuple<float, float>&> m =
- NanSensitiveFloatNear(0.5f);
+ Matcher<const ::std::tuple<float, float>&> m = NanSensitiveFloatNear(0.5f);
EXPECT_EQ("are an almost-equal pair", Describe(m));
}
// Tests that FloatEq() matches a 2-tuple where
// DoubleNear(first field, max_abs_error) matches the second field.
TEST(DoubleNear2Test, MatchesEqualArguments) {
- typedef ::testing::tuple<double, double> Tpl;
+ typedef ::std::tuple<double, double> Tpl;
Matcher<const Tpl&> m = DoubleNear(0.5);
EXPECT_TRUE(m.Matches(Tpl(1.0, 1.0)));
EXPECT_TRUE(m.Matches(Tpl(1.3, 1.0)));
@@ -2450,14 +2445,14 @@ TEST(DoubleNear2Test, MatchesEqualArguments) {
// Tests that DoubleNear() describes itself properly.
TEST(DoubleNear2Test, CanDescribeSelf) {
- Matcher<const ::testing::tuple<double, double>&> m = DoubleNear(0.5);
+ Matcher<const ::std::tuple<double, double>&> m = DoubleNear(0.5);
EXPECT_EQ("are an almost-equal pair", Describe(m));
}
// Tests that NanSensitiveDoubleNear() matches a 2-tuple where
// NanSensitiveDoubleNear(first field) matches the second field.
TEST(NanSensitiveDoubleNearTest, MatchesNearbyArgumentsWithNaN) {
- typedef ::testing::tuple<double, double> Tpl;
+ typedef ::std::tuple<double, double> Tpl;
Matcher<const Tpl&> m = NanSensitiveDoubleNear(0.5f);
EXPECT_TRUE(m.Matches(Tpl(1.0f, 1.0f)));
EXPECT_TRUE(m.Matches(Tpl(1.1f, 1.0f)));
@@ -2470,8 +2465,7 @@ TEST(NanSensitiveDoubleNearTest, MatchesNearbyArgumentsWithNaN) {
// Tests that NanSensitiveDoubleNear() describes itself properly.
TEST(NanSensitiveDoubleNearTest, CanDescribeSelfWithNaNs) {
- Matcher<const ::testing::tuple<double, double>&> m =
- NanSensitiveDoubleNear(0.5f);
+ Matcher<const ::std::tuple<double, double>&> m = NanSensitiveDoubleNear(0.5f);
EXPECT_EQ("are an almost-equal pair", Describe(m));
}
@@ -2553,29 +2547,16 @@ TEST(AllOfTest, MatchesWhenAllMatch) {
Ne(8), Ne(9)));
AllOfMatches(10, AllOf(Ne(1), Ne(2), Ne(3), Ne(4), Ne(5), Ne(6), Ne(7), Ne(8),
Ne(9), Ne(10)));
+ AllOfMatches(
+ 50, AllOf(Ne(1), Ne(2), Ne(3), Ne(4), Ne(5), Ne(6), Ne(7), Ne(8), Ne(9),
+ Ne(10), Ne(11), Ne(12), Ne(13), Ne(14), Ne(15), Ne(16), Ne(17),
+ Ne(18), Ne(19), Ne(20), Ne(21), Ne(22), Ne(23), Ne(24), Ne(25),
+ Ne(26), Ne(27), Ne(28), Ne(29), Ne(30), Ne(31), Ne(32), Ne(33),
+ Ne(34), Ne(35), Ne(36), Ne(37), Ne(38), Ne(39), Ne(40), Ne(41),
+ Ne(42), Ne(43), Ne(44), Ne(45), Ne(46), Ne(47), Ne(48), Ne(49),
+ Ne(50)));
}
-#if GTEST_LANG_CXX11
-// Tests the variadic version of the AllOfMatcher.
-TEST(AllOfTest, VariadicMatchesWhenAllMatch) {
- // Make sure AllOf is defined in the right namespace and does not depend on
- // ADL.
- ::testing::AllOf(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11);
- Matcher<int> m = AllOf(Ne(1), Ne(2), Ne(3), Ne(4), Ne(5), Ne(6), Ne(7), Ne(8),
- Ne(9), Ne(10), Ne(11));
- EXPECT_THAT(Describe(m), EndsWith("and (isn't equal to 11)"));
- AllOfMatches(11, m);
- AllOfMatches(50, AllOf(Ne(1), Ne(2), Ne(3), Ne(4), Ne(5), Ne(6), Ne(7), Ne(8),
- Ne(9), Ne(10), Ne(11), Ne(12), Ne(13), Ne(14), Ne(15),
- Ne(16), Ne(17), Ne(18), Ne(19), Ne(20), Ne(21), Ne(22),
- Ne(23), Ne(24), Ne(25), Ne(26), Ne(27), Ne(28), Ne(29),
- Ne(30), Ne(31), Ne(32), Ne(33), Ne(34), Ne(35), Ne(36),
- Ne(37), Ne(38), Ne(39), Ne(40), Ne(41), Ne(42), Ne(43),
- Ne(44), Ne(45), Ne(46), Ne(47), Ne(48), Ne(49),
- Ne(50)));
-}
-
-#endif // GTEST_LANG_CXX11
// Tests that AllOf(m1, ..., mn) describes itself properly.
TEST(AllOfTest, CanDescribeSelf) {
@@ -2584,59 +2565,51 @@ TEST(AllOfTest, CanDescribeSelf) {
EXPECT_EQ("(is <= 2) and (is >= 1)", Describe(m));
m = AllOf(Gt(0), Ne(1), Ne(2));
- EXPECT_EQ("(is > 0) and "
- "((isn't equal to 1) and "
- "(isn't equal to 2))",
- Describe(m));
-
+ std::string expected_descr1 =
+ "(is > 0) and (isn't equal to 1) and (isn't equal to 2)";
+ EXPECT_EQ(expected_descr1, Describe(m));
m = AllOf(Gt(0), Ne(1), Ne(2), Ne(3));
- EXPECT_EQ("((is > 0) and "
- "(isn't equal to 1)) and "
- "((isn't equal to 2) and "
- "(isn't equal to 3))",
- Describe(m));
-
+ std::string expected_descr2 =
+ "(is > 0) and (isn't equal to 1) and (isn't equal to 2) and (isn't equal "
+ "to 3)";
+ EXPECT_EQ(expected_descr2, Describe(m));
m = AllOf(Ge(0), Lt(10), Ne(3), Ne(5), Ne(7));
- EXPECT_EQ("((is >= 0) and "
- "(is < 10)) and "
- "((isn't equal to 3) and "
- "((isn't equal to 5) and "
- "(isn't equal to 7)))",
- Describe(m));
+ std::string expected_descr3 =
+ "(is >= 0) and (is < 10) and (isn't equal to 3) and (isn't equal to 5) "
+ "and (isn't equal to 7)";
+ EXPECT_EQ(expected_descr3, Describe(m));
}
// Tests that AllOf(m1, ..., mn) describes its negation properly.
TEST(AllOfTest, CanDescribeNegation) {
Matcher<int> m;
m = AllOf(Le(2), Ge(1));
- EXPECT_EQ("(isn't <= 2) or "
- "(isn't >= 1)",
- DescribeNegation(m));
+ std::string expected_descr4 = "(isn't <= 2) or (isn't >= 1)";
+ EXPECT_EQ(expected_descr4, DescribeNegation(m));
m = AllOf(Gt(0), Ne(1), Ne(2));
- EXPECT_EQ("(isn't > 0) or "
- "((is equal to 1) or "
- "(is equal to 2))",
- DescribeNegation(m));
-
+ std::string expected_descr5 =
+ "(isn't > 0) or (is equal to 1) or (is equal to 2)";
+ EXPECT_EQ(expected_descr5, DescribeNegation(m));
m = AllOf(Gt(0), Ne(1), Ne(2), Ne(3));
- EXPECT_EQ("((isn't > 0) or "
- "(is equal to 1)) or "
- "((is equal to 2) or "
- "(is equal to 3))",
- DescribeNegation(m));
-
+ std::string expected_descr6 =
+ "(isn't > 0) or (is equal to 1) or (is equal to 2) or (is equal to 3)";
+ EXPECT_EQ(expected_descr6, DescribeNegation(m));
m = AllOf(Ge(0), Lt(10), Ne(3), Ne(5), Ne(7));
- EXPECT_EQ("((isn't >= 0) or "
- "(isn't < 10)) or "
- "((is equal to 3) or "
- "((is equal to 5) or "
- "(is equal to 7)))",
- DescribeNegation(m));
+ std::string expected_desr7 =
+ "(isn't >= 0) or (isn't < 10) or (is equal to 3) or (is equal to 5) or "
+ "(is equal to 7)";
+ EXPECT_EQ(expected_desr7, DescribeNegation(m));
+
+ m = AllOf(Ne(1), Ne(2), Ne(3), Ne(4), Ne(5), Ne(6), Ne(7), Ne(8), Ne(9),
+ Ne(10), Ne(11));
+ AllOf(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11);
+ EXPECT_THAT(Describe(m), EndsWith("and (isn't equal to 11)"));
+ AllOfMatches(11, m);
}
// Tests that monomorphic matchers are safely cast by the AllOf matcher.
@@ -2817,28 +2790,22 @@ TEST(ElementsAreTest, HugeMatcherUnordered) {
TEST(AnyOfTest, CanDescribeSelf) {
Matcher<int> m;
m = AnyOf(Le(1), Ge(3));
+
EXPECT_EQ("(is <= 1) or (is >= 3)",
Describe(m));
m = AnyOf(Lt(0), Eq(1), Eq(2));
- EXPECT_EQ("(is < 0) or "
- "((is equal to 1) or (is equal to 2))",
- Describe(m));
+ EXPECT_EQ("(is < 0) or (is equal to 1) or (is equal to 2)", Describe(m));
m = AnyOf(Lt(0), Eq(1), Eq(2), Eq(3));
- EXPECT_EQ("((is < 0) or "
- "(is equal to 1)) or "
- "((is equal to 2) or "
- "(is equal to 3))",
+ EXPECT_EQ("(is < 0) or (is equal to 1) or (is equal to 2) or (is equal to 3)",
Describe(m));
m = AnyOf(Le(0), Gt(10), 3, 5, 7);
- EXPECT_EQ("((is <= 0) or "
- "(is > 10)) or "
- "((is equal to 3) or "
- "((is equal to 5) or "
- "(is equal to 7)))",
- Describe(m));
+ EXPECT_EQ(
+ "(is <= 0) or (is > 10) or (is equal to 3) or (is equal to 5) or (is "
+ "equal to 7)",
+ Describe(m));
}
// Tests that AnyOf(m1, ..., mn) describes its negation properly.
@@ -2849,24 +2816,20 @@ TEST(AnyOfTest, CanDescribeNegation) {
DescribeNegation(m));
m = AnyOf(Lt(0), Eq(1), Eq(2));
- EXPECT_EQ("(isn't < 0) and "
- "((isn't equal to 1) and (isn't equal to 2))",
+ EXPECT_EQ("(isn't < 0) and (isn't equal to 1) and (isn't equal to 2)",
DescribeNegation(m));
m = AnyOf(Lt(0), Eq(1), Eq(2), Eq(3));
- EXPECT_EQ("((isn't < 0) and "
- "(isn't equal to 1)) and "
- "((isn't equal to 2) and "
- "(isn't equal to 3))",
- DescribeNegation(m));
+ EXPECT_EQ(
+ "(isn't < 0) and (isn't equal to 1) and (isn't equal to 2) and (isn't "
+ "equal to 3)",
+ DescribeNegation(m));
m = AnyOf(Le(0), Gt(10), 3, 5, 7);
- EXPECT_EQ("((isn't <= 0) and "
- "(isn't > 10)) and "
- "((isn't equal to 3) and "
- "((isn't equal to 5) and "
- "(isn't equal to 7)))",
- DescribeNegation(m));
+ EXPECT_EQ(
+ "(isn't <= 0) and (isn't > 10) and (isn't equal to 3) and (isn't equal "
+ "to 5) and (isn't equal to 7)",
+ DescribeNegation(m));
}
// Tests that monomorphic matchers are safely cast by the AnyOf matcher.
@@ -3102,8 +3065,8 @@ TEST(DescribeMatcherTest, WorksWithPolymorphicMatcher) {
}
TEST(AllArgsTest, WorksForTuple) {
- EXPECT_THAT(make_tuple(1, 2L), AllArgs(Lt()));
- EXPECT_THAT(make_tuple(2L, 1), Not(AllArgs(Lt())));
+ EXPECT_THAT(std::make_tuple(1, 2L), AllArgs(Lt()));
+ EXPECT_THAT(std::make_tuple(2L, 1), Not(AllArgs(Lt())));
}
TEST(AllArgsTest, WorksForNonTuple) {
@@ -5081,11 +5044,11 @@ TEST(ContainerEqExtraTest, WorksForNativeArrayAsTuple) {
const int b[] = {1, 2, 3, 4};
const int* const p1 = a1;
- EXPECT_THAT(make_tuple(p1, 3), ContainerEq(a2));
- EXPECT_THAT(make_tuple(p1, 3), Not(ContainerEq(b)));
+ EXPECT_THAT(std::make_tuple(p1, 3), ContainerEq(a2));
+ EXPECT_THAT(std::make_tuple(p1, 3), Not(ContainerEq(b)));
const int c[] = {1, 3, 2};
- EXPECT_THAT(make_tuple(p1, 3), Not(ContainerEq(c)));
+ EXPECT_THAT(std::make_tuple(p1, 3), Not(ContainerEq(c)));
}
TEST(ContainerEqExtraTest, CopiesNativeArrayParameter) {
@@ -6267,13 +6230,15 @@ TEST(PolymorphicMatcherTest, CanAccessImpl) {
TEST(MatcherTupleTest, ExplainsMatchFailure) {
stringstream ss1;
- ExplainMatchFailureTupleTo(make_tuple(Matcher<char>(Eq('a')), GreaterThan(5)),
- make_tuple('a', 10), &ss1);
+ ExplainMatchFailureTupleTo(
+ std::make_tuple(Matcher<char>(Eq('a')), GreaterThan(5)),
+ std::make_tuple('a', 10), &ss1);
EXPECT_EQ("", ss1.str()); // Successful match.
stringstream ss2;
- ExplainMatchFailureTupleTo(make_tuple(GreaterThan(5), Matcher<char>(Eq('a'))),
- make_tuple(2, 'b'), &ss2);
+ ExplainMatchFailureTupleTo(
+ std::make_tuple(GreaterThan(5), Matcher<char>(Eq('a'))),
+ std::make_tuple(2, 'b'), &ss2);
EXPECT_EQ(" Expected arg #0: is > 5\n"
" Actual: 2, which is 3 less than 5\n"
" Expected arg #1: is equal to 'a' (97, 0x61)\n"
@@ -6281,8 +6246,9 @@ TEST(MatcherTupleTest, ExplainsMatchFailure) {
ss2.str()); // Failed match where both arguments need explanation.
stringstream ss3;
- ExplainMatchFailureTupleTo(make_tuple(GreaterThan(5), Matcher<char>(Eq('a'))),
- make_tuple(2, 'a'), &ss3);
+ ExplainMatchFailureTupleTo(
+ std::make_tuple(GreaterThan(5), Matcher<char>(Eq('a'))),
+ std::make_tuple(2, 'a'), &ss3);
EXPECT_EQ(" Expected arg #0: is > 5\n"
" Actual: 2, which is 3 less than 5\n",
ss3.str()); // Failed match where only one argument needs
@@ -6371,21 +6337,21 @@ TEST(EachTest, AcceptsMatcher) {
TEST(EachTest, WorksForNativeArrayAsTuple) {
const int a[] = {1, 2};
const int* const pointer = a;
- EXPECT_THAT(make_tuple(pointer, 2), Each(Gt(0)));
- EXPECT_THAT(make_tuple(pointer, 2), Not(Each(Gt(1))));
+ EXPECT_THAT(std::make_tuple(pointer, 2), Each(Gt(0)));
+ EXPECT_THAT(std::make_tuple(pointer, 2), Not(Each(Gt(1))));
}
// For testing Pointwise().
class IsHalfOfMatcher {
public:
template <typename T1, typename T2>
- bool MatchAndExplain(const tuple<T1, T2>& a_pair,
+ bool MatchAndExplain(const std::tuple<T1, T2>& a_pair,
MatchResultListener* listener) const {
- if (get<0>(a_pair) == get<1>(a_pair)/2) {
- *listener << "where the second is " << get<1>(a_pair);
+ if (std::get<0>(a_pair) == std::get<1>(a_pair) / 2) {
+ *listener << "where the second is " << std::get<1>(a_pair);
return true;
} else {
- *listener << "where the second/2 is " << get<1>(a_pair)/2;
+ *listener << "where the second/2 is " << std::get<1>(a_pair) / 2;
return false;
}
}
@@ -6502,13 +6468,13 @@ TEST(PointwiseTest, AcceptsCorrectContent) {
TEST(PointwiseTest, AllowsMonomorphicInnerMatcher) {
const double lhs[3] = {1, 2, 3};
const int rhs[3] = {2, 4, 6};
- const Matcher<tuple<const double&, const int&> > m1 = IsHalfOf();
+ const Matcher<std::tuple<const double&, const int&>> m1 = IsHalfOf();
EXPECT_THAT(lhs, Pointwise(m1, rhs));
EXPECT_EQ("", Explain(Pointwise(m1, rhs), lhs));
- // This type works as a tuple<const double&, const int&> can be
- // implicitly cast to tuple<double, int>.
- const Matcher<tuple<double, int> > m2 = IsHalfOf();
+ // This type works as a std::tuple<const double&, const int&> can be
+ // implicitly cast to std::tuple<double, int>.
+ const Matcher<std::tuple<double, int>> m2 = IsHalfOf();
EXPECT_THAT(lhs, Pointwise(m2, rhs));
EXPECT_EQ("", Explain(Pointwise(m2, rhs), lhs));
}
@@ -6618,12 +6584,12 @@ TEST(UnorderedPointwiseTest, AcceptsCorrectContentInDifferentOrder) {
TEST(UnorderedPointwiseTest, AllowsMonomorphicInnerMatcher) {
const double lhs[3] = {1, 2, 3};
const int rhs[3] = {4, 6, 2};
- const Matcher<tuple<const double&, const int&> > m1 = IsHalfOf();
+ const Matcher<std::tuple<const double&, const int&>> m1 = IsHalfOf();
EXPECT_THAT(lhs, UnorderedPointwise(m1, rhs));
- // This type works as a tuple<const double&, const int&> can be
- // implicitly cast to tuple<double, int>.
- const Matcher<tuple<double, int> > m2 = IsHalfOf();
+ // This type works as a std::tuple<const double&, const int&> can be
+ // implicitly cast to std::tuple<double, int>.
+ const Matcher<std::tuple<double, int>> m2 = IsHalfOf();
EXPECT_THAT(lhs, UnorderedPointwise(m2, rhs));
}