diff options
Diffstat (limited to 'googlemock/test')
-rw-r--r-- | googlemock/test/gmock-actions_test.cc | 10 | ||||
-rw-r--r-- | googlemock/test/gmock-cardinalities_test.cc | 6 | ||||
-rw-r--r-- | googlemock/test/gmock-generated-matchers_test.cc | 5 | ||||
-rw-r--r-- | googlemock/test/gmock-internal-utils_test.cc | 10 | ||||
-rw-r--r-- | googlemock/test/gmock-matchers_test.cc | 21 | ||||
-rw-r--r-- | googlemock/test/gmock-spec-builders_test.cc | 10 |
6 files changed, 27 insertions, 35 deletions
diff --git a/googlemock/test/gmock-actions_test.cc b/googlemock/test/gmock-actions_test.cc index 321648ca..938a11bf 100644 --- a/googlemock/test/gmock-actions_test.cc +++ b/googlemock/test/gmock-actions_test.cc @@ -379,7 +379,7 @@ typedef int MyGlobalFunction(bool, int); class MyActionImpl : public ActionInterface<MyGlobalFunction> { public: - virtual int Perform(const std::tuple<bool, int>& args) { + int Perform(const std::tuple<bool, int>& args) override { return std::get<0>(args) ? std::get<1>(args) : 0; } }; @@ -443,7 +443,7 @@ TEST(ActionTest, IsCopyable) { class IsNotZero : public ActionInterface<bool(int)> { // NOLINT public: - virtual bool Perform(const std::tuple<int>& arg) { + bool Perform(const std::tuple<int>& arg) override { return std::get<0>(arg) != 0; } }; @@ -1087,7 +1087,7 @@ TEST(WithArgsTest, TenArgs) { // Tests using WithArgs with an action that is not Invoke(). class SubtractAction : public ActionInterface<int(int, int)> { public: - virtual int Perform(const std::tuple<int, int>& args) { + int Perform(const std::tuple<int, int>& args) override { return std::get<0>(args) - std::get<1>(args); } }; @@ -1155,8 +1155,8 @@ TEST(WithArgsTest, InnerActionWithConversion) { class SetErrnoAndReturnTest : public testing::Test { protected: - virtual void SetUp() { errno = 0; } - virtual void TearDown() { errno = 0; } + void SetUp() override { errno = 0; } + void TearDown() override { errno = 0; } }; TEST_F(SetErrnoAndReturnTest, Int) { diff --git a/googlemock/test/gmock-cardinalities_test.cc b/googlemock/test/gmock-cardinalities_test.cc index 132591bc..60fd06a3 100644 --- a/googlemock/test/gmock-cardinalities_test.cc +++ b/googlemock/test/gmock-cardinalities_test.cc @@ -396,17 +396,17 @@ TEST(ExactlyTest, HasCorrectBounds) { class EvenCardinality : public CardinalityInterface { public: // Returns true iff call_count calls will satisfy this cardinality. - virtual bool IsSatisfiedByCallCount(int call_count) const { + bool IsSatisfiedByCallCount(int call_count) const override { return (call_count % 2 == 0); } // Returns true iff call_count calls will saturate this cardinality. - virtual bool IsSaturatedByCallCount(int /* call_count */) const { + bool IsSaturatedByCallCount(int /* call_count */) const override { return false; } // Describes self to an ostream. - virtual void DescribeTo(::std::ostream* ss) const { + void DescribeTo(::std::ostream* ss) const override { *ss << "called even number of times"; } }; diff --git a/googlemock/test/gmock-generated-matchers_test.cc b/googlemock/test/gmock-generated-matchers_test.cc index c66f6756..727c8eaa 100644 --- a/googlemock/test/gmock-generated-matchers_test.cc +++ b/googlemock/test/gmock-generated-matchers_test.cc @@ -117,12 +117,11 @@ class GreaterThanMatcher : public MatcherInterface<int> { public: explicit GreaterThanMatcher(int rhs) : rhs_(rhs) {} - virtual void DescribeTo(::std::ostream* os) const { + void DescribeTo(::std::ostream* os) const override { *os << "is greater than " << rhs_; } - virtual bool MatchAndExplain(int lhs, - MatchResultListener* listener) const { + bool MatchAndExplain(int lhs, MatchResultListener* listener) const override { const int diff = lhs - rhs_; if (diff > 0) { *listener << "which is " << diff << " more than " << rhs_; diff --git a/googlemock/test/gmock-internal-utils_test.cc b/googlemock/test/gmock-internal-utils_test.cc index aa0162b8..48fcacc7 100644 --- a/googlemock/test/gmock-internal-utils_test.cc +++ b/googlemock/test/gmock-internal-utils_test.cc @@ -379,11 +379,9 @@ TEST(ExpectTest, FailsNonfatallyOnFalse) { class LogIsVisibleTest : public ::testing::Test { protected: - virtual void SetUp() { - original_verbose_ = GMOCK_FLAG(verbose); - } + void SetUp() override { original_verbose_ = GMOCK_FLAG(verbose); } - virtual void TearDown() { GMOCK_FLAG(verbose) = original_verbose_; } + void TearDown() override { GMOCK_FLAG(verbose) = original_verbose_; } std::string original_verbose_; }; @@ -442,11 +440,11 @@ TEST(LogTest, NoStackTraceWhenStackFramesToSkipIsNegative) { } struct MockStackTraceGetter : testing::internal::OsStackTraceGetterInterface { - virtual std::string CurrentStackTrace(int max_depth, int skip_count) { + std::string CurrentStackTrace(int max_depth, int skip_count) override { return (testing::Message() << max_depth << "::" << skip_count << "\n") .GetString(); } - virtual void UponLeavingGTest() {} + void UponLeavingGTest() override {} }; // Tests that in opt mode, a positive stack_frames_to_skip argument is diff --git a/googlemock/test/gmock-matchers_test.cc b/googlemock/test/gmock-matchers_test.cc index cb2d1ae0..5dc09f35 100644 --- a/googlemock/test/gmock-matchers_test.cc +++ b/googlemock/test/gmock-matchers_test.cc @@ -162,12 +162,9 @@ class GreaterThanMatcher : public MatcherInterface<int> { public: explicit GreaterThanMatcher(int rhs) : rhs_(rhs) {} - virtual void DescribeTo(ostream* os) const { - *os << "is > " << rhs_; - } + void DescribeTo(ostream* os) const override { *os << "is > " << rhs_; } - virtual bool MatchAndExplain(int lhs, - MatchResultListener* listener) const { + bool MatchAndExplain(int lhs, MatchResultListener* listener) const override { const int diff = lhs - rhs_; if (diff > 0) { *listener << "which is " << diff << " more than " << rhs_; @@ -257,14 +254,12 @@ TEST(MatchResultListenerTest, IsInterestedWorks) { // change. class EvenMatcherImpl : public MatcherInterface<int> { public: - virtual bool MatchAndExplain(int x, - MatchResultListener* /* listener */) const { + bool MatchAndExplain(int x, + MatchResultListener* /* listener */) const override { return x % 2 == 0; } - virtual void DescribeTo(ostream* os) const { - *os << "is an even number"; - } + void DescribeTo(ostream* os) const override { *os << "is an even number"; } // We deliberately don't define DescribeNegationTo() and // ExplainMatchResultTo() here, to make sure the definition of these @@ -280,7 +275,7 @@ TEST(MatcherInterfaceTest, CanBeImplementedUsingPublishedAPI) { class NewEvenMatcherImpl : public MatcherInterface<int> { public: - virtual bool MatchAndExplain(int x, MatchResultListener* listener) const { + bool MatchAndExplain(int x, MatchResultListener* listener) const override { const bool match = x % 2 == 0; // Verifies that we can stream to a listener directly. *listener << "value % " << 2; @@ -292,9 +287,7 @@ class NewEvenMatcherImpl : public MatcherInterface<int> { return match; } - virtual void DescribeTo(ostream* os) const { - *os << "is an even number"; - } + void DescribeTo(ostream* os) const override { *os << "is an even number"; } }; TEST(MatcherInterfaceTest, CanBeImplementedUsingNewAPI) { diff --git a/googlemock/test/gmock-spec-builders_test.cc b/googlemock/test/gmock-spec-builders_test.cc index 325747de..8427bf16 100644 --- a/googlemock/test/gmock-spec-builders_test.cc +++ b/googlemock/test/gmock-spec-builders_test.cc @@ -1952,17 +1952,17 @@ TEST(DeletingMockEarlyTest, Failure2) { class EvenNumberCardinality : public CardinalityInterface { public: // Returns true iff call_count calls will satisfy this cardinality. - virtual bool IsSatisfiedByCallCount(int call_count) const { + bool IsSatisfiedByCallCount(int call_count) const override { return call_count % 2 == 0; } // Returns true iff call_count calls will saturate this cardinality. - virtual bool IsSaturatedByCallCount(int /* call_count */) const { + bool IsSaturatedByCallCount(int /* call_count */) const override { return false; } // Describes self to an ostream. - virtual void DescribeTo(::std::ostream* os) const { + void DescribeTo(::std::ostream* os) const override { *os << "called even number of times"; } }; @@ -2023,7 +2023,9 @@ class VerboseFlagPreservingFixture : public testing::Test { VerboseFlagPreservingFixture() : saved_verbose_flag_(GMOCK_FLAG(verbose)) {} - ~VerboseFlagPreservingFixture() { GMOCK_FLAG(verbose) = saved_verbose_flag_; } + ~VerboseFlagPreservingFixture() override { + GMOCK_FLAG(verbose) = saved_verbose_flag_; + } private: const std::string saved_verbose_flag_; |