diff options
Diffstat (limited to 'googletest/include/gtest')
-rw-r--r-- | googletest/include/gtest/gtest-matchers.h | 19 | ||||
-rw-r--r-- | googletest/include/gtest/gtest-spi.h | 5 | ||||
-rw-r--r-- | googletest/include/gtest/gtest-test-part.h | 4 | ||||
-rw-r--r-- | googletest/include/gtest/gtest.h | 30 | ||||
-rw-r--r-- | googletest/include/gtest/internal/gtest-death-test-internal.h | 5 | ||||
-rw-r--r-- | googletest/include/gtest/internal/gtest-internal.h | 2 | ||||
-rw-r--r-- | googletest/include/gtest/internal/gtest-param-util-generated.h | 170 | ||||
-rw-r--r-- | googletest/include/gtest/internal/gtest-param-util-generated.h.pump | 18 | ||||
-rw-r--r-- | googletest/include/gtest/internal/gtest-param-util.h | 50 | ||||
-rw-r--r-- | googletest/include/gtest/internal/gtest-port.h | 4 |
10 files changed, 155 insertions, 152 deletions
diff --git a/googletest/include/gtest/gtest-matchers.h b/googletest/include/gtest/gtest-matchers.h index 4601fbe..9bcf5ac 100644 --- a/googletest/include/gtest/gtest-matchers.h +++ b/googletest/include/gtest/gtest-matchers.h @@ -183,16 +183,16 @@ class MatcherInterfaceAdapter : public MatcherInterface<const T&> { public: explicit MatcherInterfaceAdapter(const MatcherInterface<T>* impl) : impl_(impl) {} - virtual ~MatcherInterfaceAdapter() { delete impl_; } + ~MatcherInterfaceAdapter() override { delete impl_; } - virtual void DescribeTo(::std::ostream* os) const { impl_->DescribeTo(os); } + void DescribeTo(::std::ostream* os) const override { impl_->DescribeTo(os); } - virtual void DescribeNegationTo(::std::ostream* os) const { + void DescribeNegationTo(::std::ostream* os) const override { impl_->DescribeNegationTo(os); } - virtual bool MatchAndExplain(const T& x, - MatchResultListener* listener) const { + bool MatchAndExplain(const T& x, + MatchResultListener* listener) const override { return impl_->MatchAndExplain(x, listener); } @@ -614,18 +614,19 @@ class ComparisonBase { class Impl : public MatcherInterface<Lhs> { public: explicit Impl(const Rhs& rhs) : rhs_(rhs) {} - virtual bool MatchAndExplain( - Lhs lhs, MatchResultListener* /* listener */) const { + bool MatchAndExplain(Lhs lhs, + MatchResultListener* /* listener */) const override { return Op()(lhs, rhs_); } - virtual void DescribeTo(::std::ostream* os) const { + void DescribeTo(::std::ostream* os) const override { *os << D::Desc() << " "; UniversalPrint(rhs_, os); } - virtual void DescribeNegationTo(::std::ostream* os) const { + void DescribeNegationTo(::std::ostream* os) const override { *os << D::NegatedDesc() << " "; UniversalPrint(rhs_, os); } + private: Rhs rhs_; GTEST_DISALLOW_ASSIGN_(Impl); diff --git a/googletest/include/gtest/gtest-spi.h b/googletest/include/gtest/gtest-spi.h index 1e89839..aa38870 100644 --- a/googletest/include/gtest/gtest-spi.h +++ b/googletest/include/gtest/gtest-spi.h @@ -72,14 +72,15 @@ class GTEST_API_ ScopedFakeTestPartResultReporter TestPartResultArray* result); // The d'tor restores the previous test part result reporter. - virtual ~ScopedFakeTestPartResultReporter(); + ~ScopedFakeTestPartResultReporter() override; // Appends the TestPartResult object to the TestPartResultArray // received in the constructor. // // This method is from the TestPartResultReporterInterface // interface. - virtual void ReportTestPartResult(const TestPartResult& result); + void ReportTestPartResult(const TestPartResult& result) override; + private: void Init(); diff --git a/googletest/include/gtest/gtest-test-part.h b/googletest/include/gtest/gtest-test-part.h index fffa641..1e1cb09 100644 --- a/googletest/include/gtest/gtest-test-part.h +++ b/googletest/include/gtest/gtest-test-part.h @@ -165,8 +165,8 @@ class GTEST_API_ HasNewFatalFailureHelper : public TestPartResultReporterInterface { public: HasNewFatalFailureHelper(); - virtual ~HasNewFatalFailureHelper(); - virtual void ReportTestPartResult(const TestPartResult& result); + ~HasNewFatalFailureHelper() override; + void ReportTestPartResult(const TestPartResult& result) override; bool has_new_fatal_failure() const { return has_new_fatal_failure_; } private: bool has_new_fatal_failure_; diff --git a/googletest/include/gtest/gtest.h b/googletest/include/gtest/gtest.h index 5076419..5def00b 100644 --- a/googletest/include/gtest/gtest.h +++ b/googletest/include/gtest/gtest.h @@ -1111,21 +1111,21 @@ class TestEventListener { // above. class EmptyTestEventListener : public TestEventListener { public: - virtual void OnTestProgramStart(const UnitTest& /*unit_test*/) {} - virtual void OnTestIterationStart(const UnitTest& /*unit_test*/, - int /*iteration*/) {} - virtual void OnEnvironmentsSetUpStart(const UnitTest& /*unit_test*/) {} - virtual void OnEnvironmentsSetUpEnd(const UnitTest& /*unit_test*/) {} - virtual void OnTestCaseStart(const TestCase& /*test_case*/) {} - virtual void OnTestStart(const TestInfo& /*test_info*/) {} - virtual void OnTestPartResult(const TestPartResult& /*test_part_result*/) {} - virtual void OnTestEnd(const TestInfo& /*test_info*/) {} - virtual void OnTestCaseEnd(const TestCase& /*test_case*/) {} - virtual void OnEnvironmentsTearDownStart(const UnitTest& /*unit_test*/) {} - virtual void OnEnvironmentsTearDownEnd(const UnitTest& /*unit_test*/) {} - virtual void OnTestIterationEnd(const UnitTest& /*unit_test*/, - int /*iteration*/) {} - virtual void OnTestProgramEnd(const UnitTest& /*unit_test*/) {} + void OnTestProgramStart(const UnitTest& /*unit_test*/) override {} + void OnTestIterationStart(const UnitTest& /*unit_test*/, + int /*iteration*/) override {} + void OnEnvironmentsSetUpStart(const UnitTest& /*unit_test*/) override {} + void OnEnvironmentsSetUpEnd(const UnitTest& /*unit_test*/) override {} + void OnTestCaseStart(const TestCase& /*test_case*/) override {} + void OnTestStart(const TestInfo& /*test_info*/) override {} + void OnTestPartResult(const TestPartResult& /*test_part_result*/) override {} + void OnTestEnd(const TestInfo& /*test_info*/) override {} + void OnTestCaseEnd(const TestCase& /*test_case*/) override {} + void OnEnvironmentsTearDownStart(const UnitTest& /*unit_test*/) override {} + void OnEnvironmentsTearDownEnd(const UnitTest& /*unit_test*/) override {} + void OnTestIterationEnd(const UnitTest& /*unit_test*/, + int /*iteration*/) override {} + void OnTestProgramEnd(const UnitTest& /*unit_test*/) override {} }; // TestEventListeners lets users add listeners to track events in Google Test. diff --git a/googletest/include/gtest/internal/gtest-death-test-internal.h b/googletest/include/gtest/internal/gtest-death-test-internal.h index c3d287f..0bf1fcf 100644 --- a/googletest/include/gtest/internal/gtest-death-test-internal.h +++ b/googletest/include/gtest/internal/gtest-death-test-internal.h @@ -154,9 +154,8 @@ class DeathTestFactory { // A concrete DeathTestFactory implementation for normal use. class DefaultDeathTestFactory : public DeathTestFactory { public: - virtual bool Create(const char* statement, - Matcher<const std::string&> matcher, const char* file, - int line, DeathTest** test); + bool Create(const char* statement, Matcher<const std::string&> matcher, + const char* file, int line, DeathTest** test) override; }; // Returns true if exit_status describes a process that was terminated diff --git a/googletest/include/gtest/internal/gtest-internal.h b/googletest/include/gtest/internal/gtest-internal.h index d9d8533..b32237a 100644 --- a/googletest/include/gtest/internal/gtest-internal.h +++ b/googletest/include/gtest/internal/gtest-internal.h @@ -469,7 +469,7 @@ class TestFactoryBase { template <class TestClass> class TestFactoryImpl : public TestFactoryBase { public: - virtual Test* CreateTest() { return new TestClass; } + Test* CreateTest() override { return new TestClass; } }; #if GTEST_OS_WINDOWS diff --git a/googletest/include/gtest/internal/gtest-param-util-generated.h b/googletest/include/gtest/internal/gtest-param-util-generated.h index 724e2a2..51c181f 100644 --- a/googletest/include/gtest/internal/gtest-param-util-generated.h +++ b/googletest/include/gtest/internal/gtest-param-util-generated.h @@ -44,13 +44,13 @@ // GOOGLETEST_CM0001 DO NOT DELETE -#ifndef GTEST_INCLUDE_GTEST_INTERNAL_GTEST_PARAM_UTIL_GENERATED_H_ -#define GTEST_INCLUDE_GTEST_INTERNAL_GTEST_PARAM_UTIL_GENERATED_H_ - -#include <cassert> +#include <assert.h> #include <memory> +#ifndef GTEST_INCLUDE_GTEST_INTERNAL_GTEST_PARAM_UTIL_GENERATED_H_ +#define GTEST_INCLUDE_GTEST_INTERNAL_GTEST_PARAM_UTIL_GENERATED_H_ + #include "gtest/internal/gtest-param-util.h" #include "gtest/internal/gtest-port.h" @@ -71,12 +71,12 @@ class CartesianProductGenerator2 CartesianProductGenerator2(const ParamGenerator<T1>& g1, const ParamGenerator<T2>& g2) : g1_(g1), g2_(g2) {} - virtual ~CartesianProductGenerator2() {} + ~CartesianProductGenerator2() override {} - virtual ParamIteratorInterface<ParamType>* Begin() const { + ParamIteratorInterface<ParamType>* Begin() const override { return new Iterator(this, g1_, g1_.begin(), g2_, g2_.begin()); } - virtual ParamIteratorInterface<ParamType>* End() const { + ParamIteratorInterface<ParamType>* End() const override { return new Iterator(this, g1_, g1_.end(), g2_, g2_.end()); } @@ -93,14 +93,14 @@ class CartesianProductGenerator2 begin2_(g2.begin()), end2_(g2.end()), current2_(current2) { ComputeCurrentValue(); } - virtual ~Iterator() {} + ~Iterator() override {} - virtual const ParamGeneratorInterface<ParamType>* BaseGenerator() const { + const ParamGeneratorInterface<ParamType>* BaseGenerator() const override { return base_; } // Advance should not be called on beyond-of-range iterators // so no component iterators must be beyond end of range, either. - virtual void Advance() { + void Advance() override { assert(!AtEnd()); ++current2_; if (current2_ == end2_) { @@ -109,11 +109,11 @@ class CartesianProductGenerator2 } ComputeCurrentValue(); } - virtual ParamIteratorInterface<ParamType>* Clone() const { + ParamIteratorInterface<ParamType>* Clone() const override { return new Iterator(*this); } - virtual const ParamType* Current() const { return current_value_.get(); } - virtual bool Equals(const ParamIteratorInterface<ParamType>& other) const { + const ParamType* Current() const override { return current_value_.get(); } + bool Equals(const ParamIteratorInterface<ParamType>& other) const override { // Having the same base generator guarantees that the other // iterator is of the same type and we can downcast. GTEST_CHECK_(BaseGenerator() == other.BaseGenerator()) @@ -186,13 +186,13 @@ class CartesianProductGenerator3 CartesianProductGenerator3(const ParamGenerator<T1>& g1, const ParamGenerator<T2>& g2, const ParamGenerator<T3>& g3) : g1_(g1), g2_(g2), g3_(g3) {} - virtual ~CartesianProductGenerator3() {} + ~CartesianProductGenerator3() override {} - virtual ParamIteratorInterface<ParamType>* Begin() const { + ParamIteratorInterface<ParamType>* Begin() const override { return new Iterator(this, g1_, g1_.begin(), g2_, g2_.begin(), g3_, g3_.begin()); } - virtual ParamIteratorInterface<ParamType>* End() const { + ParamIteratorInterface<ParamType>* End() const override { return new Iterator(this, g1_, g1_.end(), g2_, g2_.end(), g3_, g3_.end()); } @@ -212,14 +212,14 @@ class CartesianProductGenerator3 begin3_(g3.begin()), end3_(g3.end()), current3_(current3) { ComputeCurrentValue(); } - virtual ~Iterator() {} + ~Iterator() override {} - virtual const ParamGeneratorInterface<ParamType>* BaseGenerator() const { + const ParamGeneratorInterface<ParamType>* BaseGenerator() const override { return base_; } // Advance should not be called on beyond-of-range iterators // so no component iterators must be beyond end of range, either. - virtual void Advance() { + void Advance() override { assert(!AtEnd()); ++current3_; if (current3_ == end3_) { @@ -232,11 +232,11 @@ class CartesianProductGenerator3 } ComputeCurrentValue(); } - virtual ParamIteratorInterface<ParamType>* Clone() const { + ParamIteratorInterface<ParamType>* Clone() const override { return new Iterator(*this); } - virtual const ParamType* Current() const { return current_value_.get(); } - virtual bool Equals(const ParamIteratorInterface<ParamType>& other) const { + const ParamType* Current() const override { return current_value_.get(); } + bool Equals(const ParamIteratorInterface<ParamType>& other) const override { // Having the same base generator guarantees that the other // iterator is of the same type and we can downcast. GTEST_CHECK_(BaseGenerator() == other.BaseGenerator()) @@ -319,13 +319,13 @@ class CartesianProductGenerator4 const ParamGenerator<T2>& g2, const ParamGenerator<T3>& g3, const ParamGenerator<T4>& g4) : g1_(g1), g2_(g2), g3_(g3), g4_(g4) {} - virtual ~CartesianProductGenerator4() {} + ~CartesianProductGenerator4() override {} - virtual ParamIteratorInterface<ParamType>* Begin() const { + ParamIteratorInterface<ParamType>* Begin() const override { return new Iterator(this, g1_, g1_.begin(), g2_, g2_.begin(), g3_, g3_.begin(), g4_, g4_.begin()); } - virtual ParamIteratorInterface<ParamType>* End() const { + ParamIteratorInterface<ParamType>* End() const override { return new Iterator(this, g1_, g1_.end(), g2_, g2_.end(), g3_, g3_.end(), g4_, g4_.end()); } @@ -349,14 +349,14 @@ class CartesianProductGenerator4 begin4_(g4.begin()), end4_(g4.end()), current4_(current4) { ComputeCurrentValue(); } - virtual ~Iterator() {} + ~Iterator() override {} - virtual const ParamGeneratorInterface<ParamType>* BaseGenerator() const { + const ParamGeneratorInterface<ParamType>* BaseGenerator() const override { return base_; } // Advance should not be called on beyond-of-range iterators // so no component iterators must be beyond end of range, either. - virtual void Advance() { + void Advance() override { assert(!AtEnd()); ++current4_; if (current4_ == end4_) { @@ -373,11 +373,11 @@ class CartesianProductGenerator4 } ComputeCurrentValue(); } - virtual ParamIteratorInterface<ParamType>* Clone() const { + ParamIteratorInterface<ParamType>* Clone() const override { return new Iterator(*this); } - virtual const ParamType* Current() const { return current_value_.get(); } - virtual bool Equals(const ParamIteratorInterface<ParamType>& other) const { + const ParamType* Current() const override { return current_value_.get(); } + bool Equals(const ParamIteratorInterface<ParamType>& other) const override { // Having the same base generator guarantees that the other // iterator is of the same type and we can downcast. GTEST_CHECK_(BaseGenerator() == other.BaseGenerator()) @@ -470,13 +470,13 @@ class CartesianProductGenerator5 const ParamGenerator<T2>& g2, const ParamGenerator<T3>& g3, const ParamGenerator<T4>& g4, const ParamGenerator<T5>& g5) : g1_(g1), g2_(g2), g3_(g3), g4_(g4), g5_(g5) {} - virtual ~CartesianProductGenerator5() {} + ~CartesianProductGenerator5() override {} - virtual ParamIteratorInterface<ParamType>* Begin() const { + ParamIteratorInterface<ParamType>* Begin() const override { return new Iterator(this, g1_, g1_.begin(), g2_, g2_.begin(), g3_, g3_.begin(), g4_, g4_.begin(), g5_, g5_.begin()); } - virtual ParamIteratorInterface<ParamType>* End() const { + ParamIteratorInterface<ParamType>* End() const override { return new Iterator(this, g1_, g1_.end(), g2_, g2_.end(), g3_, g3_.end(), g4_, g4_.end(), g5_, g5_.end()); } @@ -503,14 +503,14 @@ class CartesianProductGenerator5 begin5_(g5.begin()), end5_(g5.end()), current5_(current5) { ComputeCurrentValue(); } - virtual ~Iterator() {} + ~Iterator() override {} - virtual const ParamGeneratorInterface<ParamType>* BaseGenerator() const { + const ParamGeneratorInterface<ParamType>* BaseGenerator() const override { return base_; } // Advance should not be called on beyond-of-range iterators // so no component iterators must be beyond end of range, either. - virtual void Advance() { + void Advance() override { assert(!AtEnd()); ++current5_; if (current5_ == end5_) { @@ -531,11 +531,11 @@ class CartesianProductGenerator5 } ComputeCurrentValue(); } - virtual ParamIteratorInterface<ParamType>* Clone() const { + ParamIteratorInterface<ParamType>* Clone() const override { return new Iterator(*this); } - virtual const ParamType* Current() const { return current_value_.get(); } - virtual bool Equals(const ParamIteratorInterface<ParamType>& other) const { + const ParamType* Current() const override { return current_value_.get(); } + bool Equals(const ParamIteratorInterface<ParamType>& other) const override { // Having the same base generator guarantees that the other // iterator is of the same type and we can downcast. GTEST_CHECK_(BaseGenerator() == other.BaseGenerator()) @@ -639,13 +639,13 @@ class CartesianProductGenerator6 const ParamGenerator<T4>& g4, const ParamGenerator<T5>& g5, const ParamGenerator<T6>& g6) : g1_(g1), g2_(g2), g3_(g3), g4_(g4), g5_(g5), g6_(g6) {} - virtual ~CartesianProductGenerator6() {} + ~CartesianProductGenerator6() override {} - virtual ParamIteratorInterface<ParamType>* Begin() const { + ParamIteratorInterface<ParamType>* Begin() const override { return new Iterator(this, g1_, g1_.begin(), g2_, g2_.begin(), g3_, g3_.begin(), g4_, g4_.begin(), g5_, g5_.begin(), g6_, g6_.begin()); } - virtual ParamIteratorInterface<ParamType>* End() const { + ParamIteratorInterface<ParamType>* End() const override { return new Iterator(this, g1_, g1_.end(), g2_, g2_.end(), g3_, g3_.end(), g4_, g4_.end(), g5_, g5_.end(), g6_, g6_.end()); } @@ -675,14 +675,14 @@ class CartesianProductGenerator6 begin6_(g6.begin()), end6_(g6.end()), current6_(current6) { ComputeCurrentValue(); } - virtual ~Iterator() {} + ~Iterator() override {} - virtual const ParamGeneratorInterface<ParamType>* BaseGenerator() const { + const ParamGeneratorInterface<ParamType>* BaseGenerator() const override { return base_; } // Advance should not be called on beyond-of-range iterators // so no component iterators must be beyond end of range, either. - virtual void Advance() { + void Advance() override { assert(!AtEnd()); ++current6_; if (current6_ == end6_) { @@ -707,11 +707,11 @@ class CartesianProductGenerator6 } ComputeCurrentValue(); } - virtual ParamIteratorInterface<ParamType>* Clone() const { + ParamIteratorInterface<ParamType>* Clone() const override { return new Iterator(*this); } - virtual const ParamType* Current() const { return current_value_.get(); } - virtual bool Equals(const ParamIteratorInterface<ParamType>& other) const { + const ParamType* Current() const override { return current_value_.get(); } + bool Equals(const ParamIteratorInterface<ParamType>& other) const override { // Having the same base generator guarantees that the other // iterator is of the same type and we can downcast. GTEST_CHECK_(BaseGenerator() == other.BaseGenerator()) @@ -825,14 +825,14 @@ class CartesianProductGenerator7 const ParamGenerator<T4>& g4, const ParamGenerator<T5>& g5, const ParamGenerator<T6>& g6, const ParamGenerator<T7>& g7) : g1_(g1), g2_(g2), g3_(g3), g4_(g4), g5_(g5), g6_(g6), g7_(g7) {} - virtual ~CartesianProductGenerator7() {} + ~CartesianProductGenerator7() override {} - virtual ParamIteratorInterface<ParamType>* Begin() const { + ParamIteratorInterface<ParamType>* Begin() const override { return new Iterator(this, g1_, g1_.begin(), g2_, g2_.begin(), g3_, g3_.begin(), g4_, g4_.begin(), g5_, g5_.begin(), g6_, g6_.begin(), g7_, g7_.begin()); } - virtual ParamIteratorInterface<ParamType>* End() const { + ParamIteratorInterface<ParamType>* End() const override { return new Iterator(this, g1_, g1_.end(), g2_, g2_.end(), g3_, g3_.end(), g4_, g4_.end(), g5_, g5_.end(), g6_, g6_.end(), g7_, g7_.end()); } @@ -865,14 +865,14 @@ class CartesianProductGenerator7 begin7_(g7.begin()), end7_(g7.end()), current7_(current7) { ComputeCurrentValue(); } - virtual ~Iterator() {} + ~Iterator() override {} - virtual const ParamGeneratorInterface<ParamType>* BaseGenerator() const { + const ParamGeneratorInterface<ParamType>* BaseGenerator() const override { return base_; } // Advance should not be called on beyond-of-range iterators // so no component iterators must be beyond end of range, either. - virtual void Advance() { + void Advance() override { assert(!AtEnd()); ++current7_; if (current7_ == end7_) { @@ -901,11 +901,11 @@ class CartesianProductGenerator7 } ComputeCurrentValue(); } - virtual ParamIteratorInterface<ParamType>* Clone() const { + ParamIteratorInterface<ParamType>* Clone() const override { return new Iterator(*this); } - virtual const ParamType* Current() const { return current_value_.get(); } - virtual bool Equals(const ParamIteratorInterface<ParamType>& other) const { + const ParamType* Current() const override { return current_value_.get(); } + bool Equals(const ParamIteratorInterface<ParamType>& other) const override { // Having the same base generator guarantees that the other // iterator is of the same type and we can downcast. GTEST_CHECK_(BaseGenerator() == other.BaseGenerator()) @@ -1030,14 +1030,14 @@ class CartesianProductGenerator8 const ParamGenerator<T8>& g8) : g1_(g1), g2_(g2), g3_(g3), g4_(g4), g5_(g5), g6_(g6), g7_(g7), g8_(g8) {} - virtual ~CartesianProductGenerator8() {} + ~CartesianProductGenerator8() override {} - virtual ParamIteratorInterface<ParamType>* Begin() const { + ParamIteratorInterface<ParamType>* Begin() const override { return new Iterator(this, g1_, g1_.begin(), g2_, g2_.begin(), g3_, g3_.begin(), g4_, g4_.begin(), g5_, g5_.begin(), g6_, g6_.begin(), g7_, g7_.begin(), g8_, g8_.begin()); } - virtual ParamIteratorInterface<ParamType>* End() const { + ParamIteratorInterface<ParamType>* End() const override { return new Iterator(this, g1_, g1_.end(), g2_, g2_.end(), g3_, g3_.end(), g4_, g4_.end(), g5_, g5_.end(), g6_, g6_.end(), g7_, g7_.end(), g8_, g8_.end()); @@ -1074,14 +1074,14 @@ class CartesianProductGenerator8 begin8_(g8.begin()), end8_(g8.end()), current8_(current8) { ComputeCurrentValue(); } - virtual ~Iterator() {} + ~Iterator() override {} - virtual const ParamGeneratorInterface<ParamType>* BaseGenerator() const { + const ParamGeneratorInterface<ParamType>* BaseGenerator() const override { return base_; } // Advance should not be called on beyond-of-range iterators // so no component iterators must be beyond end of range, either. - virtual void Advance() { + void Advance() override { assert(!AtEnd()); ++current8_; if (current8_ == end8_) { @@ -1114,11 +1114,11 @@ class CartesianProductGenerator8 } ComputeCurrentValue(); } - virtual ParamIteratorInterface<ParamType>* Clone() const { + ParamIteratorInterface<ParamType>* Clone() const override { return new Iterator(*this); } - virtual const ParamType* Current() const { return current_value_.get(); } - virtual bool Equals(const ParamIteratorInterface<ParamType>& other) const { + const ParamType* Current() const override { return current_value_.get(); } + bool Equals(const ParamIteratorInterface<ParamType>& other) const override { // Having the same base generator guarantees that the other // iterator is of the same type and we can downcast. GTEST_CHECK_(BaseGenerator() == other.BaseGenerator()) @@ -1252,14 +1252,14 @@ class CartesianProductGenerator9 const ParamGenerator<T8>& g8, const ParamGenerator<T9>& g9) : g1_(g1), g2_(g2), g3_(g3), g4_(g4), g5_(g5), g6_(g6), g7_(g7), g8_(g8), g9_(g9) {} - virtual ~CartesianProductGenerator9() {} + ~CartesianProductGenerator9() override {} - virtual ParamIteratorInterface<ParamType>* Begin() const { + ParamIteratorInterface<ParamType>* Begin() const override { return new Iterator(this, g1_, g1_.begin(), g2_, g2_.begin(), g3_, g3_.begin(), g4_, g4_.begin(), g5_, g5_.begin(), g6_, g6_.begin(), g7_, g7_.begin(), g8_, g8_.begin(), g9_, g9_.begin()); } - virtual ParamIteratorInterface<ParamType>* End() const { + ParamIteratorInterface<ParamType>* End() const override { return new Iterator(this, g1_, g1_.end(), g2_, g2_.end(), g3_, g3_.end(), g4_, g4_.end(), g5_, g5_.end(), g6_, g6_.end(), g7_, g7_.end(), g8_, g8_.end(), g9_, g9_.end()); @@ -1299,14 +1299,14 @@ class CartesianProductGenerator9 begin9_(g9.begin()), end9_(g9.end()), current9_(current9) { ComputeCurrentValue(); } - virtual ~Iterator() {} + ~Iterator() override {} - virtual const ParamGeneratorInterface<ParamType>* BaseGenerator() const { + const ParamGeneratorInterface<ParamType>* BaseGenerator() const override { return base_; } // Advance should not be called on beyond-of-range iterators // so no component iterators must be beyond end of range, either. - virtual void Advance() { + void Advance() override { assert(!AtEnd()); ++current9_; if (current9_ == end9_) { @@ -1343,11 +1343,11 @@ class CartesianProductGenerator9 } ComputeCurrentValue(); } - virtual ParamIteratorInterface<ParamType>* Clone() const { + ParamIteratorInterface<ParamType>* Clone() const override { return new Iterator(*this); } - virtual const ParamType* Current() const { return current_value_.get(); } - virtual bool Equals(const ParamIteratorInterface<ParamType>& other) const { + const ParamType* Current() const override { return current_value_.get(); } + bool Equals(const ParamIteratorInterface<ParamType>& other) const override { // Having the same base generator guarantees that the other // iterator is of the same type and we can downcast. GTEST_CHECK_(BaseGenerator() == other.BaseGenerator()) @@ -1492,14 +1492,14 @@ class CartesianProductGenerator10 const ParamGenerator<T10>& g10) : g1_(g1), g2_(g2), g3_(g3), g4_(g4), g5_(g5), g6_(g6), g7_(g7), g8_(g8), g9_(g9), g10_(g10) {} - virtual ~CartesianProductGenerator10() {} + ~CartesianProductGenerator10() override {} - virtual ParamIteratorInterface<ParamType>* Begin() const { + ParamIteratorInterface<ParamType>* Begin() const override { return new Iterator(this, g1_, g1_.begin(), g2_, g2_.begin(), g3_, g3_.begin(), g4_, g4_.begin(), g5_, g5_.begin(), g6_, g6_.begin(), g7_, g7_.begin(), g8_, g8_.begin(), g9_, g9_.begin(), g10_, g10_.begin()); } - virtual ParamIteratorInterface<ParamType>* End() const { + ParamIteratorInterface<ParamType>* End() const override { return new Iterator(this, g1_, g1_.end(), g2_, g2_.end(), g3_, g3_.end(), g4_, g4_.end(), g5_, g5_.end(), g6_, g6_.end(), g7_, g7_.end(), g8_, g8_.end(), g9_, g9_.end(), g10_, g10_.end()); @@ -1542,14 +1542,14 @@ class CartesianProductGenerator10 begin10_(g10.begin()), end10_(g10.end()), current10_(current10) { ComputeCurrentValue(); } - virtual ~Iterator() {} + ~Iterator() override {} - virtual const ParamGeneratorInterface<ParamType>* BaseGenerator() const { + const ParamGeneratorInterface<ParamType>* BaseGenerator() const override { return base_; } // Advance should not be called on beyond-of-range iterators // so no component iterators must be beyond end of range, either. - virtual void Advance() { + void Advance() override { assert(!AtEnd()); ++current10_; if (current10_ == end10_) { @@ -1590,11 +1590,11 @@ class CartesianProductGenerator10 } ComputeCurrentValue(); } - virtual ParamIteratorInterface<ParamType>* Clone() const { + ParamIteratorInterface<ParamType>* Clone() const override { return new Iterator(*this); } - virtual const ParamType* Current() const { return current_value_.get(); } - virtual bool Equals(const ParamIteratorInterface<ParamType>& other) const { + const ParamType* Current() const override { return current_value_.get(); } + bool Equals(const ParamIteratorInterface<ParamType>& other) const override { // Having the same base generator guarantees that the other // iterator is of the same type and we can downcast. GTEST_CHECK_(BaseGenerator() == other.BaseGenerator()) diff --git a/googletest/include/gtest/internal/gtest-param-util-generated.h.pump b/googletest/include/gtest/internal/gtest-param-util-generated.h.pump index 92adc7b..988b02a 100644 --- a/googletest/include/gtest/internal/gtest-param-util-generated.h.pump +++ b/googletest/include/gtest/internal/gtest-param-util-generated.h.pump @@ -74,12 +74,12 @@ class CartesianProductGenerator$i CartesianProductGenerator$i($for j, [[const ParamGenerator<T$j>& g$j]]) : $for j, [[g$(j)_(g$j)]] {} - virtual ~CartesianProductGenerator$i() {} + ~CartesianProductGenerator$i() override {} - virtual ParamIteratorInterface<ParamType>* Begin() const { + ParamIteratorInterface<ParamType>* Begin() const override { return new Iterator(this, $for j, [[g$(j)_, g$(j)_.begin()]]); } - virtual ParamIteratorInterface<ParamType>* End() const { + ParamIteratorInterface<ParamType>* End() const override { return new Iterator(this, $for j, [[g$(j)_, g$(j)_.end()]]); } @@ -97,14 +97,14 @@ $for j, [[ ]] { ComputeCurrentValue(); } - virtual ~Iterator() {} + ~Iterator() override {} - virtual const ParamGeneratorInterface<ParamType>* BaseGenerator() const { + const ParamGeneratorInterface<ParamType>* BaseGenerator() const override { return base_; } // Advance should not be called on beyond-of-range iterators // so no component iterators must be beyond end of range, either. - virtual void Advance() { + void Advance() override { assert(!AtEnd()); ++current$(i)_; @@ -117,11 +117,11 @@ $for k [[ ]] ComputeCurrentValue(); } - virtual ParamIteratorInterface<ParamType>* Clone() const { + ParamIteratorInterface<ParamType>* Clone() const override { return new Iterator(*this); } - virtual const ParamType* Current() const { return current_value_.get(); } - virtual bool Equals(const ParamIteratorInterface<ParamType>& other) const { + const ParamType* Current() const override { return current_value_.get(); } + bool Equals(const ParamIteratorInterface<ParamType>& other) const override { // Having the same base generator guarantees that the other // iterator is of the same type and we can downcast. GTEST_CHECK_(BaseGenerator() == other.BaseGenerator()) diff --git a/googletest/include/gtest/internal/gtest-param-util.h b/googletest/include/gtest/internal/gtest-param-util.h index e155483..f0c5260 100644 --- a/googletest/include/gtest/internal/gtest-param-util.h +++ b/googletest/include/gtest/internal/gtest-param-util.h @@ -206,12 +206,12 @@ class RangeGenerator : public ParamGeneratorInterface<T> { RangeGenerator(T begin, T end, IncrementT step) : begin_(begin), end_(end), step_(step), end_index_(CalculateEndIndex(begin, end, step)) {} - virtual ~RangeGenerator() {} + ~RangeGenerator() override {} - virtual ParamIteratorInterface<T>* Begin() const { + ParamIteratorInterface<T>* Begin() const override { return new Iterator(this, begin_, 0, step_); } - virtual ParamIteratorInterface<T>* End() const { + ParamIteratorInterface<T>* End() const override { return new Iterator(this, end_, end_index_, step_); } @@ -221,20 +221,20 @@ class RangeGenerator : public ParamGeneratorInterface<T> { Iterator(const ParamGeneratorInterface<T>* base, T value, int index, IncrementT step) : base_(base), value_(value), index_(index), step_(step) {} - virtual ~Iterator() {} + ~Iterator() override {} - virtual const ParamGeneratorInterface<T>* BaseGenerator() const { + const ParamGeneratorInterface<T>* BaseGenerator() const override { return base_; } - virtual void Advance() { + void Advance() override { value_ = static_cast<T>(value_ + step_); index_++; } - virtual ParamIteratorInterface<T>* Clone() const { + ParamIteratorInterface<T>* Clone() const override { return new Iterator(*this); } - virtual const T* Current() const { return &value_; } - virtual bool Equals(const ParamIteratorInterface<T>& other) const { + const T* Current() const override { return &value_; } + bool Equals(const ParamIteratorInterface<T>& other) const override { // Having the same base generator guarantees that the other // iterator is of the same type and we can downcast. GTEST_CHECK_(BaseGenerator() == other.BaseGenerator()) @@ -291,12 +291,12 @@ class ValuesInIteratorRangeGenerator : public ParamGeneratorInterface<T> { template <typename ForwardIterator> ValuesInIteratorRangeGenerator(ForwardIterator begin, ForwardIterator end) : container_(begin, end) {} - virtual ~ValuesInIteratorRangeGenerator() {} + ~ValuesInIteratorRangeGenerator() override {} - virtual ParamIteratorInterface<T>* Begin() const { + ParamIteratorInterface<T>* Begin() const override { return new Iterator(this, container_.begin()); } - virtual ParamIteratorInterface<T>* End() const { + ParamIteratorInterface<T>* End() const override { return new Iterator(this, container_.end()); } @@ -308,16 +308,16 @@ class ValuesInIteratorRangeGenerator : public ParamGeneratorInterface<T> { Iterator(const ParamGeneratorInterface<T>* base, typename ContainerType::const_iterator iterator) : base_(base), iterator_(iterator) {} - virtual ~Iterator() {} + ~Iterator() override {} - virtual const ParamGeneratorInterface<T>* BaseGenerator() const { + const ParamGeneratorInterface<T>* BaseGenerator() const override { return base_; } - virtual void Advance() { + void Advance() override { ++iterator_; value_.reset(); } - virtual ParamIteratorInterface<T>* Clone() const { + ParamIteratorInterface<T>* Clone() const override { return new Iterator(*this); } // We need to use cached value referenced by iterator_ because *iterator_ @@ -327,11 +327,11 @@ class ValuesInIteratorRangeGenerator : public ParamGeneratorInterface<T> { // can advance iterator_ beyond the end of the range, and we cannot // detect that fact. The client code, on the other hand, is // responsible for not calling Current() on an out-of-range iterator. - virtual const T* Current() const { + const T* Current() const override { if (value_.get() == nullptr) value_.reset(new T(*iterator_)); return value_.get(); } - virtual bool Equals(const ParamIteratorInterface<T>& other) const { + bool Equals(const ParamIteratorInterface<T>& other) const override { // Having the same base generator guarantees that the other // iterator is of the same type and we can downcast. GTEST_CHECK_(BaseGenerator() == other.BaseGenerator()) @@ -406,7 +406,7 @@ class ParameterizedTestFactory : public TestFactoryBase { typedef typename TestClass::ParamType ParamType; explicit ParameterizedTestFactory(ParamType parameter) : parameter_(parameter) {} - virtual Test* CreateTest() { + Test* CreateTest() override { TestClass::SetParam(¶meter_); return new TestClass(); } @@ -445,7 +445,7 @@ class TestMetaFactory TestMetaFactory() {} - virtual TestFactoryBase* CreateTestFactory(ParamType parameter) { + TestFactoryBase* CreateTestFactory(ParamType parameter) override { return new ParameterizedTestFactory<TestCase>(parameter); } @@ -507,9 +507,11 @@ class ParameterizedTestCaseInfo : public ParameterizedTestCaseInfoBase { : test_case_name_(name), code_location_(code_location) {} // Test case base name for display purposes. - virtual const std::string& GetTestCaseName() const { return test_case_name_; } + const std::string& GetTestCaseName() const override { + return test_case_name_; + } // Test case id to verify identity. - virtual TypeId GetTestCaseTypeId() const { return GetTypeId<TestCase>(); } + TypeId GetTestCaseTypeId() const override { return GetTypeId<TestCase>(); } // TEST_P macro uses AddTestPattern() to record information // about a single test in a LocalTestInfo structure. // test_case_name is the base name of the test case (without invocation @@ -537,7 +539,7 @@ class ParameterizedTestCaseInfo : public ParameterizedTestCaseInfoBase { // This method should not be called more then once on any single // instance of a ParameterizedTestCaseInfoBase derived class. // UnitTest has a guard to prevent from calling this method more then once. - virtual void RegisterTests() { + void RegisterTests() override { for (typename TestInfoContainer::iterator test_it = tests_.begin(); test_it != tests_.end(); ++test_it) { std::shared_ptr<TestInfo> test_info = *test_it; @@ -587,7 +589,7 @@ class ParameterizedTestCaseInfo : public ParameterizedTestCaseInfoBase { } // for param_it } // for gen_it } // for test_it - } // RegisterTests + } // RegisterTests private: // LocalTestInfo structure keeps information about a single test registered diff --git a/googletest/include/gtest/internal/gtest-port.h b/googletest/include/gtest/internal/gtest-port.h index 3c6a557..4cd74fb 100644 --- a/googletest/include/gtest/internal/gtest-port.h +++ b/googletest/include/gtest/internal/gtest-port.h @@ -1488,7 +1488,7 @@ class ThreadWithParam : public ThreadWithParamBase { GTEST_CHECK_POSIX_SUCCESS_( pthread_create(&thread_, nullptr, &ThreadFuncWithCLinkage, base)); } - ~ThreadWithParam() { Join(); } + ~ThreadWithParam() override { Join(); } void Join() { if (!finished_) { @@ -1497,7 +1497,7 @@ class ThreadWithParam : public ThreadWithParamBase { } } - virtual void Run() { + void Run() override { if (thread_can_start_ != nullptr) thread_can_start_->WaitForNotification(); func_(param_); } |