diff options
Diffstat (limited to 'googlemock/test/gmock-matchers_test.cc')
-rw-r--r-- | googlemock/test/gmock-matchers_test.cc | 35 |
1 files changed, 1 insertions, 34 deletions
diff --git a/googlemock/test/gmock-matchers_test.cc b/googlemock/test/gmock-matchers_test.cc index f5e25e07..a61d040b 100644 --- a/googlemock/test/gmock-matchers_test.cc +++ b/googlemock/test/gmock-matchers_test.cc @@ -6387,7 +6387,7 @@ class SampleOptional { explicit SampleOptional(T value) : value_(std::move(value)), has_value_(true) {} SampleOptional() : value_(), has_value_(false) {} - explicit operator bool() const { return has_value_; } + operator bool() const { return has_value_; } const T& operator*() const { return value_; } private: @@ -6427,39 +6427,6 @@ TEST(OptionalTest, WorksWithMoveOnly) { EXPECT_TRUE(m.Matches(SampleOptional<std::unique_ptr<int>>(nullptr))); } -TEST(OptionalTest, TupleDescribesSelf) { - const Matcher<std::tuple<SampleOptional<int>, int>> m = Optional(Eq()); - EXPECT_EQ("are optionals where the values are an equal pair", Describe(m)); -} - -TEST(OptionalTest, TupleExplainsSelf) { - const Matcher<std::tuple<SampleOptional<int>, int>> m = Optional(Eq()); - EXPECT_EQ("which match", - Explain(m, std::make_tuple(SampleOptional<int>(1), 1))); - EXPECT_EQ("whose values don't match", - Explain(m, std::make_tuple(SampleOptional<int>(1), 2))); -} - -TEST(OptionalTest, TupleMatchesNonEmpty) { - const Matcher<std::tuple<SampleOptional<int>, int>> m1 = Optional(Eq()); - const Matcher<std::tuple<SampleOptional<int>, int>> m2 = Optional(Lt()); - EXPECT_TRUE(m1.Matches(std::make_tuple(SampleOptional<int>(1), 1))); - EXPECT_FALSE(m1.Matches(std::make_tuple(SampleOptional<int>(1), 2))); - EXPECT_FALSE(m2.Matches(std::make_tuple(SampleOptional<int>(1), 1))); - EXPECT_TRUE(m2.Matches(std::make_tuple(SampleOptional<int>(1), 2))); -} - -TEST(OptionalTest, TupleDoesNotMatchNullopt) { - const Matcher<std::tuple<SampleOptional<int>, int>> m1 = Optional(Eq()); - EXPECT_FALSE(m1.Matches(std::make_tuple(SampleOptional<int>(), 1))); -} - -TEST(OptionalTest, TupleWorksInPointwise) { - std::vector<SampleOptional<int>> v = { - SampleOptional<int>(1), SampleOptional<int>(2), SampleOptional<int>(3)}; - EXPECT_THAT(v, Pointwise(Optional(Eq()), {1, 2, 3})); -} - class SampleVariantIntString { public: SampleVariantIntString(int i) : i_(i), has_int_(true) {} |