aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAbseil Team <absl-team@google.com>2018-12-03 11:30:02 -0500
committerGennadiy Civil <misterg@google.com>2018-12-03 12:54:11 -0500
commit26743363be8f579ee7d637e5b15cbf73e9e18a4a (patch)
treefb89238693dad174c6ddaf57f04bae3c8f41d7fb
parenta42cdf2abdc0ab7ddfbafc098cafdd6152ae1b70 (diff)
downloadgoogletest-26743363be8f579ee7d637e5b15cbf73e9e18a4a.tar.gz
googletest-26743363be8f579ee7d637e5b15cbf73e9e18a4a.tar.bz2
googletest-26743363be8f579ee7d637e5b15cbf73e9e18a4a.zip
Googletest export
Applied fixes for ClangTidy modernize-use-override and modernize-use-using. PiperOrigin-RevId: 223800219
-rw-r--r--googlemock/include/gmock/gmock-actions.h24
-rw-r--r--googlemock/include/gmock/gmock-generated-nice-strict.h6
-rw-r--r--googlemock/include/gmock/gmock-generated-nice-strict.h.pump2
-rw-r--r--googlemock/include/gmock/gmock-matchers.h177
-rw-r--r--googlemock/include/gmock/gmock-spec-builders.h45
-rw-r--r--googlemock/src/gmock-cardinalities.cc10
-rw-r--r--googlemock/src/gmock-internal-utils.cc4
-rw-r--r--googlemock/test/gmock-actions_test.cc10
-rw-r--r--googlemock/test/gmock-cardinalities_test.cc6
-rw-r--r--googlemock/test/gmock-generated-matchers_test.cc5
-rw-r--r--googlemock/test/gmock-internal-utils_test.cc10
-rw-r--r--googlemock/test/gmock-matchers_test.cc21
-rw-r--r--googlemock/test/gmock-spec-builders_test.cc10
-rw-r--r--googletest/include/gtest/gtest-matchers.h19
-rw-r--r--googletest/include/gtest/gtest-spi.h5
-rw-r--r--googletest/include/gtest/gtest-test-part.h4
-rw-r--r--googletest/include/gtest/gtest.h30
-rw-r--r--googletest/include/gtest/internal/gtest-death-test-internal.h5
-rw-r--r--googletest/include/gtest/internal/gtest-internal.h2
-rw-r--r--googletest/include/gtest/internal/gtest-param-util-generated.h170
-rw-r--r--googletest/include/gtest/internal/gtest-param-util-generated.h.pump18
-rw-r--r--googletest/include/gtest/internal/gtest-param-util.h50
-rw-r--r--googletest/include/gtest/internal/gtest-port.h4
-rw-r--r--googletest/samples/prime_tables.h10
-rw-r--r--googletest/samples/sample10_unittest.cc4
-rw-r--r--googletest/samples/sample3_unittest.cc2
-rw-r--r--googletest/samples/sample5_unittest.cc6
-rw-r--r--googletest/samples/sample6_unittest.cc2
-rw-r--r--googletest/samples/sample7_unittest.cc6
-rw-r--r--googletest/samples/sample8_unittest.cc10
-rw-r--r--googletest/samples/sample9_unittest.cc10
-rw-r--r--googletest/src/gtest-death-test.cc13
-rw-r--r--googletest/src/gtest-internal-inl.h34
-rw-r--r--googletest/src/gtest.cc58
-rw-r--r--googletest/test/googletest-catch-exceptions-test_.cc26
-rw-r--r--googletest/test/googletest-death-test-test.cc22
-rw-r--r--googletest/test/googletest-death-test_ex_test.cc2
-rw-r--r--googletest/test/googletest-filepath-test.cc4
-rw-r--r--googletest/test/googletest-listener-test.cc46
-rw-r--r--googletest/test/googletest-options-test.cc4
-rw-r--r--googletest/test/googletest-output-test_.cc52
-rw-r--r--googletest/test/googletest-param-test-test.cc6
-rw-r--r--googletest/test/googletest-shuffle-test_.cc6
-rw-r--r--googletest/test/gtest-typed-test_test.cc8
-rw-r--r--googletest/test/gtest-unittest-api_test.cc2
-rw-r--r--googletest/test/gtest_environment_test.cc4
-rw-r--r--googletest/test/gtest_pred_impl_unittest.cc20
-rw-r--r--googletest/test/gtest_repeat_test.cc4
-rw-r--r--googletest/test/gtest_unittest.cc48
-rw-r--r--googletest/test/gtest_xml_outfile1_test_.cc8
-rw-r--r--googletest/test/gtest_xml_outfile2_test_.cc8
51 files changed, 507 insertions, 555 deletions
diff --git a/googlemock/include/gmock/gmock-actions.h b/googlemock/include/gmock/gmock-actions.h
index 9a637ce7..7105830d 100644
--- a/googlemock/include/gmock/gmock-actions.h
+++ b/googlemock/include/gmock/gmock-actions.h
@@ -257,7 +257,7 @@ class DefaultValue {
class FixedValueProducer : public ValueProducer {
public:
explicit FixedValueProducer(T value) : value_(value) {}
- virtual T Produce() { return value_; }
+ T Produce() override { return value_; }
private:
const T value_;
@@ -268,7 +268,7 @@ class DefaultValue {
public:
explicit FactoryValueProducer(FactoryFunction factory)
: factory_(factory) {}
- virtual T Produce() { return factory_(); }
+ T Produce() override { return factory_(); }
private:
const FactoryFunction factory_;
@@ -472,7 +472,7 @@ class PolymorphicAction {
explicit MonomorphicImpl(const Impl& impl) : impl_(impl) {}
- virtual Result Perform(const ArgumentTuple& args) {
+ Result Perform(const ArgumentTuple& args) override {
return impl_.template Perform<Result>(args);
}
@@ -518,7 +518,7 @@ class ActionAdaptor : public ActionInterface<F1> {
explicit ActionAdaptor(const Action<F2>& from) : impl_(from.impl_) {}
- virtual Result Perform(const ArgumentTuple& args) {
+ Result Perform(const ArgumentTuple& args) override {
return impl_->Perform(args);
}
@@ -609,7 +609,7 @@ class ReturnAction {
: value_before_cast_(*value),
value_(ImplicitCast_<Result>(value_before_cast_)) {}
- virtual Result Perform(const ArgumentTuple&) { return value_; }
+ Result Perform(const ArgumentTuple&) override { return value_; }
private:
GTEST_COMPILE_ASSERT_(!is_reference<Result>::value,
@@ -633,7 +633,7 @@ class ReturnAction {
explicit Impl(const std::shared_ptr<R>& wrapper)
: performed_(false), wrapper_(wrapper) {}
- virtual Result Perform(const ArgumentTuple&) {
+ Result Perform(const ArgumentTuple&) override {
GTEST_CHECK_(!performed_)
<< "A ByMove() action should only be performed once.";
performed_ = true;
@@ -712,9 +712,7 @@ class ReturnRefAction {
explicit Impl(T& ref) : ref_(ref) {} // NOLINT
- virtual Result Perform(const ArgumentTuple&) {
- return ref_;
- }
+ Result Perform(const ArgumentTuple&) override { return ref_; }
private:
T& ref_;
@@ -761,9 +759,7 @@ class ReturnRefOfCopyAction {
explicit Impl(const T& value) : value_(value) {} // NOLINT
- virtual Result Perform(const ArgumentTuple&) {
- return value_;
- }
+ Result Perform(const ArgumentTuple&) override { return value_; }
private:
T value_;
@@ -973,7 +969,7 @@ class IgnoreResultAction {
explicit Impl(const A& action) : action_(action) {}
- virtual void Perform(const ArgumentTuple& args) {
+ void Perform(const ArgumentTuple& args) override {
// Performs the action and ignores its result.
action_.Perform(args);
}
@@ -1048,7 +1044,7 @@ class DoBothAction {
Impl(const Action<VoidResult>& action1, const Action<F>& action2)
: action1_(action1), action2_(action2) {}
- virtual Result Perform(const ArgumentTuple& args) {
+ Result Perform(const ArgumentTuple& args) override {
action1_.Perform(args);
return action2_.Perform(args);
}
diff --git a/googlemock/include/gmock/gmock-generated-nice-strict.h b/googlemock/include/gmock/gmock-generated-nice-strict.h
index 91ba1d9b..a2e8b9ad 100644
--- a/googlemock/include/gmock/gmock-generated-nice-strict.h
+++ b/googlemock/include/gmock/gmock-generated-nice-strict.h
@@ -181,7 +181,7 @@ class NiceMock : public MockClass {
#endif // GTEST_LANG_CXX11
- ~NiceMock() {
+ ~NiceMock() { // NOLINT
::testing::Mock::UnregisterCallReaction(
internal::ImplicitCast_<MockClass*>(this));
}
@@ -299,7 +299,7 @@ class NaggyMock : public MockClass {
#endif // GTEST_LANG_CXX11
- ~NaggyMock() {
+ ~NaggyMock() { // NOLINT
::testing::Mock::UnregisterCallReaction(
internal::ImplicitCast_<MockClass*>(this));
}
@@ -417,7 +417,7 @@ class StrictMock : public MockClass {
#endif // GTEST_LANG_CXX11
- ~StrictMock() {
+ ~StrictMock() { // NOLINT
::testing::Mock::UnregisterCallReaction(
internal::ImplicitCast_<MockClass*>(this));
}
diff --git a/googlemock/include/gmock/gmock-generated-nice-strict.h.pump b/googlemock/include/gmock/gmock-generated-nice-strict.h.pump
index ed49f4ab..024baeda 100644
--- a/googlemock/include/gmock/gmock-generated-nice-strict.h.pump
+++ b/googlemock/include/gmock/gmock-generated-nice-strict.h.pump
@@ -135,7 +135,7 @@ $range j 1..i
]]
#endif // GTEST_LANG_CXX11
- ~$clazz() {
+ ~$clazz() { // NOLINT
::testing::Mock::UnregisterCallReaction(
internal::ImplicitCast_<MockClass*>(this));
}
diff --git a/googlemock/include/gmock/gmock-matchers.h b/googlemock/include/gmock/gmock-matchers.h
index 69dfd830..801c8dfb 100644
--- a/googlemock/include/gmock/gmock-matchers.h
+++ b/googlemock/include/gmock/gmock-matchers.h
@@ -193,7 +193,7 @@ class MatcherCastImpl<T, Matcher<U> > {
: source_matcher_(source_matcher) {}
// We delegate the matching logic to the source matcher.
- virtual bool MatchAndExplain(T x, MatchResultListener* listener) const {
+ bool MatchAndExplain(T x, MatchResultListener* listener) const override {
#if GTEST_LANG_CXX11
using FromType = typename std::remove_cv<typename std::remove_pointer<
typename std::remove_reference<T>::type>::type>::type;
@@ -213,11 +213,11 @@ class MatcherCastImpl<T, Matcher<U> > {
return source_matcher_.MatchAndExplain(static_cast<U>(x), listener);
}
- virtual void DescribeTo(::std::ostream* os) const {
+ void DescribeTo(::std::ostream* os) const override {
source_matcher_.DescribeTo(os);
}
- virtual void DescribeNegationTo(::std::ostream* os) const {
+ void DescribeNegationTo(::std::ostream* os) const override {
source_matcher_.DescribeNegationTo(os);
}
@@ -494,12 +494,12 @@ OutIter TransformTupleValues(Func f, const Tuple& t, OutIter out) {
template <typename T>
class AnyMatcherImpl : public MatcherInterface<GTEST_REFERENCE_TO_CONST_(T)> {
public:
- virtual bool MatchAndExplain(GTEST_REFERENCE_TO_CONST_(T) /* x */,
- MatchResultListener* /* listener */) const {
+ bool MatchAndExplain(GTEST_REFERENCE_TO_CONST_(T) /* x */,
+ MatchResultListener* /* listener */) const override {
return true;
}
- virtual void DescribeTo(::std::ostream* os) const { *os << "is anything"; }
- virtual void DescribeNegationTo(::std::ostream* os) const {
+ void DescribeTo(::std::ostream* os) const override { *os << "is anything"; }
+ void DescribeNegationTo(::std::ostream* os) const override {
// This is mostly for completeness' safe, as it's not very useful
// to write Not(A<bool>()). However we cannot completely rule out
// such a possibility, and it doesn't hurt to be prepared.
@@ -604,18 +604,18 @@ class RefMatcher<T&> {
// MatchAndExplain() takes a Super& (as opposed to const Super&)
// in order to match the interface MatcherInterface<Super&>.
- virtual bool MatchAndExplain(
- Super& x, MatchResultListener* listener) const {
+ bool MatchAndExplain(Super& x,
+ MatchResultListener* listener) const override {
*listener << "which is located @" << static_cast<const void*>(&x);
return &x == &object_;
}
- virtual void DescribeTo(::std::ostream* os) const {
+ void DescribeTo(::std::ostream* os) const override {
*os << "references the variable ";
UniversalPrinter<Super&>::Print(object_, os);
}
- virtual void DescribeNegationTo(::std::ostream* os) const {
+ void DescribeNegationTo(::std::ostream* os) const override {
*os << "does not reference the variable ";
UniversalPrinter<Super&>::Print(object_, os);
}
@@ -933,15 +933,14 @@ class PairMatchBase {
template <typename Tuple>
class Impl : public MatcherInterface<Tuple> {
public:
- virtual bool MatchAndExplain(
- Tuple args,
- MatchResultListener* /* listener */) const {
+ bool MatchAndExplain(Tuple args,
+ MatchResultListener* /* listener */) const override {
return Op()(::std::get<0>(args), ::std::get<1>(args));
}
- virtual void DescribeTo(::std::ostream* os) const {
+ void DescribeTo(::std::ostream* os) const override {
*os << "are " << GetDesc;
}
- virtual void DescribeNegationTo(::std::ostream* os) const {
+ void DescribeNegationTo(::std::ostream* os) const override {
*os << "aren't " << GetDesc;
}
};
@@ -982,16 +981,16 @@ class NotMatcherImpl : public MatcherInterface<GTEST_REFERENCE_TO_CONST_(T)> {
explicit NotMatcherImpl(const Matcher<T>& matcher)
: matcher_(matcher) {}
- virtual bool MatchAndExplain(GTEST_REFERENCE_TO_CONST_(T) x,
- MatchResultListener* listener) const {
+ bool MatchAndExplain(GTEST_REFERENCE_TO_CONST_(T) x,
+ MatchResultListener* listener) const override {
return !matcher_.MatchAndExplain(x, listener);
}
- virtual void DescribeTo(::std::ostream* os) const {
+ void DescribeTo(::std::ostream* os) const override {
matcher_.DescribeNegationTo(os);
}
- virtual void DescribeNegationTo(::std::ostream* os) const {
+ void DescribeNegationTo(::std::ostream* os) const override {
matcher_.DescribeTo(os);
}
@@ -1032,7 +1031,7 @@ class AllOfMatcherImpl
explicit AllOfMatcherImpl(std::vector<Matcher<T> > matchers)
: matchers_(std::move(matchers)) {}
- virtual void DescribeTo(::std::ostream* os) const {
+ void DescribeTo(::std::ostream* os) const override {
*os << "(";
for (size_t i = 0; i < matchers_.size(); ++i) {
if (i != 0) *os << ") and (";
@@ -1041,7 +1040,7 @@ class AllOfMatcherImpl
*os << ")";
}
- virtual void DescribeNegationTo(::std::ostream* os) const {
+ void DescribeNegationTo(::std::ostream* os) const override {
*os << "(";
for (size_t i = 0; i < matchers_.size(); ++i) {
if (i != 0) *os << ") or (";
@@ -1050,8 +1049,8 @@ class AllOfMatcherImpl
*os << ")";
}
- virtual bool MatchAndExplain(GTEST_REFERENCE_TO_CONST_(T) x,
- MatchResultListener* listener) const {
+ bool MatchAndExplain(GTEST_REFERENCE_TO_CONST_(T) x,
+ MatchResultListener* listener) const override {
// If either matcher1_ or matcher2_ doesn't match x, we only need
// to explain why one of them fails.
std::string all_match_result;
@@ -1139,7 +1138,7 @@ class AnyOfMatcherImpl
explicit AnyOfMatcherImpl(std::vector<Matcher<T> > matchers)
: matchers_(std::move(matchers)) {}
- virtual void DescribeTo(::std::ostream* os) const {
+ void DescribeTo(::std::ostream* os) const override {
*os << "(";
for (size_t i = 0; i < matchers_.size(); ++i) {
if (i != 0) *os << ") or (";
@@ -1148,7 +1147,7 @@ class AnyOfMatcherImpl
*os << ")";
}
- virtual void DescribeNegationTo(::std::ostream* os) const {
+ void DescribeNegationTo(::std::ostream* os) const override {
*os << "(";
for (size_t i = 0; i < matchers_.size(); ++i) {
if (i != 0) *os << ") and (";
@@ -1157,8 +1156,8 @@ class AnyOfMatcherImpl
*os << ")";
}
- virtual bool MatchAndExplain(GTEST_REFERENCE_TO_CONST_(T) x,
- MatchResultListener* listener) const {
+ bool MatchAndExplain(GTEST_REFERENCE_TO_CONST_(T) x,
+ MatchResultListener* listener) const override {
std::string no_match_result;
// If either matcher1_ or matcher2_ matches x, we just need to
@@ -1363,8 +1362,8 @@ class FloatingEqMatcher {
nan_eq_nan_(nan_eq_nan),
max_abs_error_(max_abs_error) {}
- virtual bool MatchAndExplain(T value,
- MatchResultListener* listener) const {
+ bool MatchAndExplain(T value,
+ MatchResultListener* listener) const override {
const FloatingPoint<FloatType> actual(value), expected(expected_);
// Compares NaNs first, if nan_eq_nan_ is true.
@@ -1398,7 +1397,7 @@ class FloatingEqMatcher {
}
}
- virtual void DescribeTo(::std::ostream* os) const {
+ void DescribeTo(::std::ostream* os) const override {
// os->precision() returns the previously set precision, which we
// store to restore the ostream to its original configuration
// after outputting.
@@ -1419,7 +1418,7 @@ class FloatingEqMatcher {
os->precision(old_precision);
}
- virtual void DescribeNegationTo(::std::ostream* os) const {
+ void DescribeNegationTo(::std::ostream* os) const override {
// As before, get original precision.
const ::std::streamsize old_precision = os->precision(
::std::numeric_limits<FloatType>::digits10 + 2);
@@ -1525,8 +1524,8 @@ class FloatingEq2Matcher {
max_abs_error_(max_abs_error),
nan_eq_nan_(nan_eq_nan) {}
- virtual bool MatchAndExplain(Tuple args,
- MatchResultListener* listener) const {
+ bool MatchAndExplain(Tuple args,
+ MatchResultListener* listener) const override {
if (max_abs_error_ == -1) {
FloatingEqMatcher<FloatType> fm(::std::get<0>(args), nan_eq_nan_);
return static_cast<Matcher<FloatType>>(fm).MatchAndExplain(
@@ -1538,10 +1537,10 @@ class FloatingEq2Matcher {
::std::get<1>(args), listener);
}
}
- virtual void DescribeTo(::std::ostream* os) const {
+ void DescribeTo(::std::ostream* os) const override {
*os << "are " << GetDesc;
}
- virtual void DescribeNegationTo(::std::ostream* os) const {
+ void DescribeNegationTo(::std::ostream* os) const override {
*os << "aren't " << GetDesc;
}
@@ -1590,18 +1589,18 @@ class PointeeMatcher {
explicit Impl(const InnerMatcher& matcher)
: matcher_(MatcherCast<const Pointee&>(matcher)) {}
- virtual void DescribeTo(::std::ostream* os) const {
+ void DescribeTo(::std::ostream* os) const override {
*os << "points to a value that ";
matcher_.DescribeTo(os);
}
- virtual void DescribeNegationTo(::std::ostream* os) const {
+ void DescribeNegationTo(::std::ostream* os) const override {
*os << "does not point to a value that ";
matcher_.DescribeTo(os);
}
- virtual bool MatchAndExplain(Pointer pointer,
- MatchResultListener* listener) const {
+ bool MatchAndExplain(Pointer pointer,
+ MatchResultListener* listener) const override {
if (GetRawPointer(pointer) == nullptr) return false;
*listener << "which points to ";
@@ -1901,17 +1900,17 @@ class ResultOfMatcher {
Impl(const CallableStorageType& callable, const M& matcher)
: callable_(callable), matcher_(MatcherCast<ResultType>(matcher)) {}
- virtual void DescribeTo(::std::ostream* os) const {
+ void DescribeTo(::std::ostream* os) const override {
*os << "is mapped by the given callable to a value that ";
matcher_.DescribeTo(os);
}
- virtual void DescribeNegationTo(::std::ostream* os) const {
+ void DescribeNegationTo(::std::ostream* os) const override {
*os << "is mapped by the given callable to a value that ";
matcher_.DescribeNegationTo(os);
}
- virtual bool MatchAndExplain(T obj, MatchResultListener* listener) const {
+ bool MatchAndExplain(T obj, MatchResultListener* listener) const override {
*listener << "which is mapped by the given callable to ";
// Cannot pass the return value directly to MatchPrintAndExplain, which
// takes a non-const reference as argument.
@@ -1962,17 +1961,17 @@ class SizeIsMatcher {
explicit Impl(const SizeMatcher& size_matcher)
: size_matcher_(MatcherCast<SizeType>(size_matcher)) {}
- virtual void DescribeTo(::std::ostream* os) const {
+ void DescribeTo(::std::ostream* os) const override {
*os << "size ";
size_matcher_.DescribeTo(os);
}
- virtual void DescribeNegationTo(::std::ostream* os) const {
+ void DescribeNegationTo(::std::ostream* os) const override {
*os << "size ";
size_matcher_.DescribeNegationTo(os);
}
- virtual bool MatchAndExplain(Container container,
- MatchResultListener* listener) const {
+ bool MatchAndExplain(Container container,
+ MatchResultListener* listener) const override {
SizeType size = container.size();
StringMatchResultListener size_listener;
const bool result = size_matcher_.MatchAndExplain(size, &size_listener);
@@ -2016,17 +2015,17 @@ class BeginEndDistanceIsMatcher {
explicit Impl(const DistanceMatcher& distance_matcher)
: distance_matcher_(MatcherCast<DistanceType>(distance_matcher)) {}
- virtual void DescribeTo(::std::ostream* os) const {
+ void DescribeTo(::std::ostream* os) const override {
*os << "distance between begin() and end() ";
distance_matcher_.DescribeTo(os);
}
- virtual void DescribeNegationTo(::std::ostream* os) const {
+ void DescribeNegationTo(::std::ostream* os) const override {
*os << "distance between begin() and end() ";
distance_matcher_.DescribeNegationTo(os);
}
- virtual bool MatchAndExplain(Container container,
- MatchResultListener* listener) const {
+ bool MatchAndExplain(Container container,
+ MatchResultListener* listener) const override {
#if GTEST_HAS_STD_BEGIN_AND_END_
using std::begin;
using std::end;
@@ -2182,18 +2181,18 @@ class WhenSortedByMatcher {
Impl(const Comparator& comparator, const ContainerMatcher& matcher)
: comparator_(comparator), matcher_(matcher) {}
- virtual void DescribeTo(::std::ostream* os) const {
+ void DescribeTo(::std::ostream* os) const override {
*os << "(when sorted) ";
matcher_.DescribeTo(os);
}
- virtual void DescribeNegationTo(::std::ostream* os) const {
+ void DescribeNegationTo(::std::ostream* os) const override {
*os << "(when sorted) ";
matcher_.DescribeNegationTo(os);
}
- virtual bool MatchAndExplain(LhsContainer lhs,
- MatchResultListener* listener) const {
+ bool MatchAndExplain(LhsContainer lhs,
+ MatchResultListener* listener) const override {
LhsStlContainerReference lhs_stl_container = LhsView::ConstReference(lhs);
::std::vector<LhsValue> sorted_container(lhs_stl_container.begin(),
lhs_stl_container.end());
@@ -2284,14 +2283,14 @@ class PointwiseMatcher {
: mono_tuple_matcher_(SafeMatcherCast<InnerMatcherArg>(tuple_matcher)),
rhs_(rhs) {}
- virtual void DescribeTo(::std::ostream* os) const {
+ void DescribeTo(::std::ostream* os) const override {
*os << "contains " << rhs_.size()
<< " values, where each value and its corresponding value in ";
UniversalPrinter<RhsStlContainer>::Print(rhs_, os);
*os << " ";
mono_tuple_matcher_.DescribeTo(os);
}
- virtual void DescribeNegationTo(::std::ostream* os) const {
+ void DescribeNegationTo(::std::ostream* os) const override {
*os << "doesn't contain exactly " << rhs_.size()
<< " values, or contains a value x at some index i"
<< " where x and the i-th value of ";
@@ -2300,8 +2299,8 @@ class PointwiseMatcher {
mono_tuple_matcher_.DescribeNegationTo(os);
}
- virtual bool MatchAndExplain(LhsContainer lhs,
- MatchResultListener* listener) const {
+ bool MatchAndExplain(LhsContainer lhs,
+ MatchResultListener* listener) const override {
LhsStlContainerReference lhs_stl_container = LhsView::ConstReference(lhs);
const size_t actual_size = lhs_stl_container.size();
if (actual_size != rhs_.size()) {
@@ -2408,18 +2407,18 @@ class ContainsMatcherImpl : public QuantifierMatcherImpl<Container> {
: QuantifierMatcherImpl<Container>(inner_matcher) {}
// Describes what this matcher does.
- virtual void DescribeTo(::std::ostream* os) const {
+ void DescribeTo(::std::ostream* os) const override {
*os << "contains at least one element that ";
this->inner_matcher_.DescribeTo(os);
}
- virtual void DescribeNegationTo(::std::ostream* os) const {
+ void DescribeNegationTo(::std::ostream* os) const override {
*os << "doesn't contain any element that ";
this->inner_matcher_.DescribeTo(os);
}
- virtual bool MatchAndExplain(Container container,
- MatchResultListener* listener) const {
+ bool MatchAndExplain(Container container,
+ MatchResultListener* listener) const override {
return this->MatchAndExplainImpl(false, container, listener);
}
@@ -2437,18 +2436,18 @@ class EachMatcherImpl : public QuantifierMatcherImpl<Container> {
: QuantifierMatcherImpl<Container>(inner_matcher) {}
// Describes what this matcher does.
- virtual void DescribeTo(::std::ostream* os) const {
+ void DescribeTo(::std::ostream* os) const override {
*os << "only contains elements that ";
this->inner_matcher_.DescribeTo(os);
}
- virtual void DescribeNegationTo(::std::ostream* os) const {
+ void DescribeNegationTo(::std::ostream* os) const override {
*os << "contains some element that ";
this->inner_matcher_.DescribeNegationTo(os);
}
- virtual bool MatchAndExplain(Container container,
- MatchResultListener* listener) const {
+ bool MatchAndExplain(Container container,
+ MatchResultListener* listener) const override {
return this->MatchAndExplainImpl(true, container, listener);
}
@@ -2551,8 +2550,8 @@ class KeyMatcherImpl : public MatcherInterface<PairType> {
}
// Returns true iff 'key_value.first' (the key) matches the inner matcher.
- virtual bool MatchAndExplain(PairType key_value,
- MatchResultListener* listener) const {
+ bool MatchAndExplain(PairType key_value,
+ MatchResultListener* listener) const override {
StringMatchResultListener inner_listener;
const bool match = inner_matcher_.MatchAndExplain(
pair_getters::First(key_value, Rank0()), &inner_listener);
@@ -2564,13 +2563,13 @@ class KeyMatcherImpl : public MatcherInterface<PairType> {
}
// Describes what this matcher does.
- virtual void DescribeTo(::std::ostream* os) const {
+ void DescribeTo(::std::ostream* os) const override {
*os << "has a key that ";
inner_matcher_.DescribeTo(os);
}
// Describes what the negation of this matcher does.
- virtual void DescribeNegationTo(::std::ostream* os) const {
+ void DescribeNegationTo(::std::ostream* os) const override {
*os << "doesn't have a key that ";
inner_matcher_.DescribeTo(os);
}
@@ -2616,7 +2615,7 @@ class PairMatcherImpl : public MatcherInterface<PairType> {
}
// Describes what this matcher does.
- virtual void DescribeTo(::std::ostream* os) const {
+ void DescribeTo(::std::ostream* os) const override {
*os << "has a first field that ";
first_matcher_.DescribeTo(os);
*os << ", and has a second field that ";
@@ -2624,7 +2623,7 @@ class PairMatcherImpl : public MatcherInterface<PairType> {
}
// Describes what the negation of this matcher does.
- virtual void DescribeNegationTo(::std::ostream* os) const {
+ void DescribeNegationTo(::std::ostream* os) const override {
*os << "has a first field that ";
first_matcher_.DescribeNegationTo(os);
*os << ", or has a second field that ";
@@ -2633,8 +2632,8 @@ class PairMatcherImpl : public MatcherInterface<PairType> {
// Returns true iff 'a_pair.first' matches first_matcher and 'a_pair.second'
// matches second_matcher.
- virtual bool MatchAndExplain(PairType a_pair,
- MatchResultListener* listener) const {
+ bool MatchAndExplain(PairType a_pair,
+ MatchResultListener* listener) const override {
if (!listener->IsInterested()) {
// If the listener is not interested, we don't need to construct the
// explanation.
@@ -2726,7 +2725,7 @@ class ElementsAreMatcherImpl : public MatcherInterface<Container> {
}
// Describes what this matcher does.
- virtual void DescribeTo(::std::ostream* os) const {
+ void DescribeTo(::std::ostream* os) const override {
if (count() == 0) {
*os << "is empty";
} else if (count() == 1) {
@@ -2745,7 +2744,7 @@ class ElementsAreMatcherImpl : public MatcherInterface<Container> {
}
// Describes what the negation of this matcher does.
- virtual void DescribeNegationTo(::std::ostream* os) const {
+ void DescribeNegationTo(::std::ostream* os) const override {
if (count() == 0) {
*os << "isn't empty";
return;
@@ -2761,8 +2760,8 @@ class ElementsAreMatcherImpl : public MatcherInterface<Container> {
}
}
- virtual bool MatchAndExplain(Container container,
- MatchResultListener* listener) const {
+ bool MatchAndExplain(Container container,
+ MatchResultListener* listener) const override {
// To work with stream-like "containers", we must only walk
// through the elements in one pass.
@@ -2982,17 +2981,17 @@ class UnorderedElementsAreMatcherImpl
}
// Describes what this matcher does.
- virtual void DescribeTo(::std::ostream* os) const {
+ void DescribeTo(::std::ostream* os) const override {
return UnorderedElementsAreMatcherImplBase::DescribeToImpl(os);
}
// Describes what the negation of this matcher does.
- virtual void DescribeNegationTo(::std::ostream* os) const {
+ void DescribeNegationTo(::std::ostream* os) const override {
return UnorderedElementsAreMatcherImplBase::DescribeNegationToImpl(os);
}
- virtual bool MatchAndExplain(Container container,
- MatchResultListener* listener) const {
+ bool MatchAndExplain(Container container,
+ MatchResultListener* listener) const override {
StlContainerReference stl_container = View::ConstReference(container);
::std::vector<std::string> element_printouts;
MatchMatrix matrix =
@@ -3205,14 +3204,14 @@ class BoundSecondMatcher {
: mono_tuple2_matcher_(SafeMatcherCast<const ArgTuple&>(tm)),
second_value_(second) {}
- virtual void DescribeTo(::std::ostream* os) const {
+ void DescribeTo(::std::ostream* os) const override {
*os << "and ";
UniversalPrint(second_value_, os);
*os << " ";
mono_tuple2_matcher_.DescribeTo(os);
}
- virtual bool MatchAndExplain(T x, MatchResultListener* listener) const {
+ bool MatchAndExplain(T x, MatchResultListener* listener) const override {
return mono_tuple2_matcher_.MatchAndExplain(ArgTuple(x, second_value_),
listener);
}
@@ -3267,18 +3266,18 @@ class OptionalMatcher {
explicit Impl(const ValueMatcher& value_matcher)
: value_matcher_(MatcherCast<ValueType>(value_matcher)) {}
- virtual void DescribeTo(::std::ostream* os) const {
+ void DescribeTo(::std::ostream* os) const override {
*os << "value ";
value_matcher_.DescribeTo(os);
}
- virtual void DescribeNegationTo(::std::ostream* os) const {
+ void DescribeNegationTo(::std::ostream* os) const override {
*os << "value ";
value_matcher_.DescribeNegationTo(os);
}
- virtual bool MatchAndExplain(Optional optional,
- MatchResultListener* listener) const {
+ bool MatchAndExplain(Optional optional,
+ MatchResultListener* listener) const override {
if (!optional) {
*listener << "which is not engaged";
return false;
diff --git a/googlemock/include/gmock/gmock-spec-builders.h b/googlemock/include/gmock/gmock-spec-builders.h
index 9dce2247..3fe31734 100644
--- a/googlemock/include/gmock/gmock-spec-builders.h
+++ b/googlemock/include/gmock/gmock-spec-builders.h
@@ -903,7 +903,7 @@ class TypedExpectation : public ExpectationBase {
extra_matcher_(A<const ArgumentTuple&>()),
repeated_action_(DoDefault()) {}
- virtual ~TypedExpectation() {
+ ~TypedExpectation() override {
// Check the validity of the action count if it hasn't been done
// yet (for example, if the expectation was never used).
CheckActionCountIfNotDone();
@@ -1069,7 +1069,7 @@ class TypedExpectation : public ExpectationBase {
// If this mock method has an extra matcher (i.e. .With(matcher)),
// describes it to the ostream.
- virtual void MaybeDescribeExtraMatcherTo(::std::ostream* os) {
+ void MaybeDescribeExtraMatcherTo(::std::ostream* os) override {
if (extra_matcher_specified_) {
*os << " Expected args: ";
extra_matcher_.DescribeTo(os);
@@ -1083,9 +1083,7 @@ class TypedExpectation : public ExpectationBase {
// Returns an Expectation object that references and co-owns this
// expectation.
- virtual Expectation GetHandle() {
- return owner_->GetHandleOf(this);
- }
+ Expectation GetHandle() override { return owner_->GetHandleOf(this); }
// The following methods will be called only after the EXPECT_CALL()
// statement finishes and when the current thread holds
@@ -1387,7 +1385,7 @@ class ActionResultHolder : public UntypedActionResultHolderBase {
}
// Prints the held value as an action's result to os.
- virtual void PrintAsActionResult(::std::ostream* os) const {
+ void PrintAsActionResult(::std::ostream* os) const override {
*os << "\n Returns: ";
// T may be a reference type, so we don't use UniversalPrint().
UniversalPrinter<T>::Print(result_.Peek(), os);
@@ -1431,7 +1429,7 @@ class ActionResultHolder<void> : public UntypedActionResultHolderBase {
public:
void Unwrap() { }
- virtual void PrintAsActionResult(::std::ostream* /* os */) const {}
+ void PrintAsActionResult(::std::ostream* /* os */) const override {}
// Performs the given mock function's default action and returns ownership
// of an empty ActionResultHolder*.
@@ -1490,8 +1488,7 @@ class FunctionMocker<R(Args...)> : public UntypedFunctionMockerBase {
// The destructor verifies that all expectations on this mock
// function have been satisfied. If not, it will report Google Test
// non-fatal failures for the violations.
- virtual ~FunctionMocker()
- GTEST_LOCK_EXCLUDED_(g_gmock_mutex) {
+ ~FunctionMocker() override GTEST_LOCK_EXCLUDED_(g_gmock_mutex) {
MutexLock l(&g_gmock_mutex);
VerifyAndClearExpectationsLocked();
Mock::UnregisterLocked(this);
@@ -1547,9 +1544,9 @@ class FunctionMocker<R(Args...)> : public UntypedFunctionMockerBase {
// the error message to describe the call in the case the default
// action fails. The caller is responsible for deleting the result.
// L = *
- virtual UntypedActionResultHolderBase* UntypedPerformDefaultAction(
+ UntypedActionResultHolderBase* UntypedPerformDefaultAction(
void* untyped_args, // must point to an ArgumentTuple
- const std::string& call_description) const {
+ const std::string& call_description) const override {
ArgumentTuple* args = static_cast<ArgumentTuple*>(untyped_args);
return ResultHolder::PerformDefaultAction(this, std::move(*args),
call_description);
@@ -1559,8 +1556,8 @@ class FunctionMocker<R(Args...)> : public UntypedFunctionMockerBase {
// the action's result. The caller is responsible for deleting the
// result.
// L = *
- virtual UntypedActionResultHolderBase* UntypedPerformAction(
- const void* untyped_action, void* untyped_args) const {
+ UntypedActionResultHolderBase* UntypedPerformAction(
+ const void* untyped_action, void* untyped_args) const override {
// Make a copy of the action before performing it, in case the
// action deletes the mock object (and thus deletes itself).
const Action<F> action = *static_cast<const Action<F>*>(untyped_action);
@@ -1570,7 +1567,7 @@ class FunctionMocker<R(Args...)> : public UntypedFunctionMockerBase {
// Implements UntypedFunctionMockerBase::ClearDefaultActionsLocked():
// clears the ON_CALL()s set on this mock function.
- virtual void ClearDefaultActionsLocked()
+ void ClearDefaultActionsLocked() override
GTEST_EXCLUSIVE_LOCK_REQUIRED_(g_gmock_mutex) {
g_gmock_mutex.AssertHeld();
@@ -1674,10 +1671,9 @@ class FunctionMocker<R(Args...)> : public UntypedFunctionMockerBase {
// Writes a message that the call is uninteresting (i.e. neither
// explicitly expected nor explicitly unexpected) to the given
// ostream.
- virtual void UntypedDescribeUninterestingCall(
- const void* untyped_args,
- ::std::ostream* os) const
- GTEST_LOCK_EXCLUDED_(g_gmock_mutex) {
+ void UntypedDescribeUninterestingCall(const void* untyped_args,
+ ::std::ostream* os) const override
+ GTEST_LOCK_EXCLUDED_(g_gmock_mutex) {
const ArgumentTuple& args =
*static_cast<const ArgumentTuple*>(untyped_args);
*os << "Uninteresting mock function call - ";
@@ -1702,11 +1698,10 @@ class FunctionMocker<R(Args...)> : public UntypedFunctionMockerBase {
// section. The reason is that we have no control on what the
// action does (it can invoke an arbitrary user function or even a
// mock function) and excessive locking could cause a dead lock.
- virtual const ExpectationBase* UntypedFindMatchingExpectation(
- const void* untyped_args,
- const void** untyped_action, bool* is_excessive,
- ::std::ostream* what, ::std::ostream* why)
- GTEST_LOCK_EXCLUDED_(g_gmock_mutex) {
+ const ExpectationBase* UntypedFindMatchingExpectation(
+ const void* untyped_args, const void** untyped_action, bool* is_excessive,
+ ::std::ostream* what, ::std::ostream* why) override
+ GTEST_LOCK_EXCLUDED_(g_gmock_mutex) {
const ArgumentTuple& args =
*static_cast<const ArgumentTuple*>(untyped_args);
MutexLock l(&g_gmock_mutex);
@@ -1728,8 +1723,8 @@ class FunctionMocker<R(Args...)> : public UntypedFunctionMockerBase {
}
// Prints the given function arguments to the ostream.
- virtual void UntypedPrintArgs(const void* untyped_args,
- ::std::ostream* os) const {
+ void UntypedPrintArgs(const void* untyped_args,
+ ::std::ostream* os) const override {
const ArgumentTuple& args =
*static_cast<const ArgumentTuple*>(untyped_args);
UniversalPrint(args, os);
diff --git a/googlemock/src/gmock-cardinalities.cc b/googlemock/src/gmock-cardinalities.cc
index 0549f727..7463f438 100644
--- a/googlemock/src/gmock-cardinalities.cc
+++ b/googlemock/src/gmock-cardinalities.cc
@@ -70,18 +70,18 @@ class BetweenCardinalityImpl : public CardinalityInterface {
// Conservative estimate on the lower/upper bound of the number of
// calls allowed.
- virtual int ConservativeLowerBound() const { return min_; }
- virtual int ConservativeUpperBound() const { return max_; }
+ int ConservativeLowerBound() const override { return min_; }
+ int ConservativeUpperBound() const override { return max_; }
- virtual bool IsSatisfiedByCallCount(int call_count) const {
+ bool IsSatisfiedByCallCount(int call_count) const override {
return min_ <= call_count && call_count <= max_;
}
- virtual bool IsSaturatedByCallCount(int call_count) const {
+ bool IsSaturatedByCallCount(int call_count) const override {
return call_count >= max_;
}
- virtual void DescribeTo(::std::ostream* os) const;
+ void DescribeTo(::std::ostream* os) const override;
private:
const int min_;
diff --git a/googlemock/src/gmock-internal-utils.cc b/googlemock/src/gmock-internal-utils.cc
index e3a67485..937d830a 100644
--- a/googlemock/src/gmock-internal-utils.cc
+++ b/googlemock/src/gmock-internal-utils.cc
@@ -93,8 +93,8 @@ GTEST_API_ std::string ConvertIdentifierNameToWords(const char* id_name) {
// use Google Mock with a testing framework other than Google Test.
class GoogleTestFailureReporter : public FailureReporterInterface {
public:
- virtual void ReportFailure(FailureType type, const char* file, int line,
- const std::string& message) {
+ void ReportFailure(FailureType type, const char* file, int line,
+ const std::string& message) override {
AssertHelper(type == kFatal ?
TestPartResult::kFatalFailure :
TestPartResult::kNonFatalFailure,
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_;
diff --git a/googletest/include/gtest/gtest-matchers.h b/googletest/include/gtest/gtest-matchers.h
index 4601fbe2..9bcf5ac2 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 1e898393..aa38870e 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 fffa6415..1e1cb097 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 5076419c..5def00b1 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 c3d287f8..0bf1fcfb 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 d9d85338..b32237a1 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 724e2a26..51c181f8 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 92adc7bb..988b02a7 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 e1554830..f0c52600 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(&parameter_);
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 3c6a5570..4cd74fb6 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_);
}
diff --git a/googletest/samples/prime_tables.h b/googletest/samples/prime_tables.h
index 523c50b9..119545a1 100644
--- a/googletest/samples/prime_tables.h
+++ b/googletest/samples/prime_tables.h
@@ -54,7 +54,7 @@ class PrimeTable {
// Implementation #1 calculates the primes on-the-fly.
class OnTheFlyPrimeTable : public PrimeTable {
public:
- virtual bool IsPrime(int n) const {
+ bool IsPrime(int n) const override {
if (n <= 1) return false;
for (int i = 2; i*i <= n; i++) {
@@ -65,7 +65,7 @@ class OnTheFlyPrimeTable : public PrimeTable {
return true;
}
- virtual int GetNextPrime(int p) const {
+ int GetNextPrime(int p) const override {
for (int n = p + 1; n > 0; n++) {
if (IsPrime(n)) return n;
}
@@ -83,13 +83,13 @@ class PreCalculatedPrimeTable : public PrimeTable {
: is_prime_size_(max + 1), is_prime_(new bool[max + 1]) {
CalculatePrimesUpTo(max);
}
- virtual ~PreCalculatedPrimeTable() { delete[] is_prime_; }
+ ~PreCalculatedPrimeTable() override { delete[] is_prime_; }
- virtual bool IsPrime(int n) const {
+ bool IsPrime(int n) const override {
return 0 <= n && n < is_prime_size_ && is_prime_[n];
}
- virtual int GetNextPrime(int p) const {
+ int GetNextPrime(int p) const override {
for (int n = p + 1; n < is_prime_size_; n++) {
if (is_prime_[n]) return n;
}
diff --git a/googletest/samples/sample10_unittest.cc b/googletest/samples/sample10_unittest.cc
index 3da21586..36cdac22 100644
--- a/googletest/samples/sample10_unittest.cc
+++ b/googletest/samples/sample10_unittest.cc
@@ -74,12 +74,12 @@ int Water::allocated_ = 0;
class LeakChecker : public EmptyTestEventListener {
private:
// Called before a test starts.
- virtual void OnTestStart(const TestInfo& /* test_info */) {
+ void OnTestStart(const TestInfo& /* test_info */) override {
initially_allocated_ = Water::allocated();
}
// Called after a test ends.
- virtual void OnTestEnd(const TestInfo& /* test_info */) {
+ void OnTestEnd(const TestInfo& /* test_info */) override {
int difference = Water::allocated() - initially_allocated_;
// You can generate a failure in any event handler except
diff --git a/googletest/samples/sample3_unittest.cc b/googletest/samples/sample3_unittest.cc
index 97ce55dc..b19416d5 100644
--- a/googletest/samples/sample3_unittest.cc
+++ b/googletest/samples/sample3_unittest.cc
@@ -71,7 +71,7 @@ class QueueTestSmpl3 : public testing::Test {
// virtual void SetUp() will be called before each test is run. You
// should define it if you need to initialize the variables.
// Otherwise, this can be skipped.
- virtual void SetUp() {
+ void SetUp() override {
q1_.Enqueue(1);
q2_.Enqueue(2);
q2_.Enqueue(3);
diff --git a/googletest/samples/sample5_unittest.cc b/googletest/samples/sample5_unittest.cc
index e71b9036..0a21dd21 100644
--- a/googletest/samples/sample5_unittest.cc
+++ b/googletest/samples/sample5_unittest.cc
@@ -63,11 +63,11 @@ class QuickTest : public testing::Test {
protected:
// Remember that SetUp() is run immediately before a test starts.
// This is a good place to record the start time.
- virtual void SetUp() { start_time_ = time(nullptr); }
+ void SetUp() override { start_time_ = time(nullptr); }
// TearDown() is invoked immediately after a test finishes. Here we
// check if the test was too slow.
- virtual void TearDown() {
+ void TearDown() override {
// Gets the time when the test finishes
const time_t end_time = time(nullptr);
@@ -140,7 +140,7 @@ TEST_F(IntegerFunctionTest, IsPrime) {
// stuff inside the body of the test fixture, as usual.
class QueueTest : public QuickTest {
protected:
- virtual void SetUp() {
+ void SetUp() override {
// First, we need to set up the super fixture (QuickTest).
QuickTest::SetUp();
diff --git a/googletest/samples/sample6_unittest.cc b/googletest/samples/sample6_unittest.cc
index ddf2f1c1..d234429f 100644
--- a/googletest/samples/sample6_unittest.cc
+++ b/googletest/samples/sample6_unittest.cc
@@ -61,7 +61,7 @@ class PrimeTableTest : public testing::Test {
// implemented by T.
PrimeTableTest() : table_(CreatePrimeTable<T>()) {}
- virtual ~PrimeTableTest() { delete table_; }
+ ~PrimeTableTest() override { delete table_; }
// Note that we test an implementation via the base interface
// instead of the actual implementation class. This is important
diff --git a/googletest/samples/sample7_unittest.cc b/googletest/samples/sample7_unittest.cc
index e1e09b0a..7e6e35ea 100644
--- a/googletest/samples/sample7_unittest.cc
+++ b/googletest/samples/sample7_unittest.cc
@@ -65,9 +65,9 @@ PrimeTable* CreatePreCalculatedPrimeTable() {
// create and store an instance of PrimeTable.
class PrimeTableTestSmpl7 : public TestWithParam<CreatePrimeTableFunc*> {
public:
- virtual ~PrimeTableTestSmpl7() { delete table_; }
- virtual void SetUp() { table_ = (*GetParam())(); }
- virtual void TearDown() {
+ ~PrimeTableTestSmpl7() override { delete table_; }
+ void SetUp() override { table_ = (*GetParam())(); }
+ void TearDown() override {
delete table_;
table_ = nullptr;
}
diff --git a/googletest/samples/sample8_unittest.cc b/googletest/samples/sample8_unittest.cc
index a3eacc73..39163a83 100644
--- a/googletest/samples/sample8_unittest.cc
+++ b/googletest/samples/sample8_unittest.cc
@@ -53,19 +53,19 @@ class HybridPrimeTable : public PrimeTable {
? nullptr
: new PreCalculatedPrimeTable(max_precalculated)),
max_precalculated_(max_precalculated) {}
- virtual ~HybridPrimeTable() {
+ ~HybridPrimeTable() override {
delete on_the_fly_impl_;
delete precalc_impl_;
}
- virtual bool IsPrime(int n) const {
+ bool IsPrime(int n) const override {
if (precalc_impl_ != nullptr && n < max_precalculated_)
return precalc_impl_->IsPrime(n);
else
return on_the_fly_impl_->IsPrime(n);
}
- virtual int GetNextPrime(int p) const {
+ int GetNextPrime(int p) const override {
int next_prime = -1;
if (precalc_impl_ != nullptr && p < max_precalculated_)
next_prime = precalc_impl_->GetNextPrime(p);
@@ -91,13 +91,13 @@ using ::testing::Combine;
// HybridPrimeTable instance.
class PrimeTableTest : public TestWithParam< ::std::tuple<bool, int> > {
protected:
- virtual void SetUp() {
+ void SetUp() override {
bool force_on_the_fly;
int max_precalculated;
std::tie(force_on_the_fly, max_precalculated) = GetParam();
table_ = new HybridPrimeTable(force_on_the_fly, max_precalculated);
}
- virtual void TearDown() {
+ void TearDown() override {
delete table_;
table_ = nullptr;
}
diff --git a/googletest/samples/sample9_unittest.cc b/googletest/samples/sample9_unittest.cc
index 53f9af5b..c0d8ff22 100644
--- a/googletest/samples/sample9_unittest.cc
+++ b/googletest/samples/sample9_unittest.cc
@@ -49,16 +49,16 @@ namespace {
class TersePrinter : public EmptyTestEventListener {
private:
// Called before any test activity starts.
- virtual void OnTestProgramStart(const UnitTest& /* unit_test */) {}
+ void OnTestProgramStart(const UnitTest& /* unit_test */) override {}
// Called after all test activities have ended.
- virtual void OnTestProgramEnd(const UnitTest& unit_test) {
+ void OnTestProgramEnd(const UnitTest& unit_test) override {
fprintf(stdout, "TEST %s\n", unit_test.Passed() ? "PASSED" : "FAILED");
fflush(stdout);
}
// Called before a test starts.
- virtual void OnTestStart(const TestInfo& test_info) {
+ void OnTestStart(const TestInfo& test_info) override {
fprintf(stdout,
"*** Test %s.%s starting.\n",
test_info.test_case_name(),
@@ -67,7 +67,7 @@ class TersePrinter : public EmptyTestEventListener {
}
// Called after a failed assertion or a SUCCEED() invocation.
- virtual void OnTestPartResult(const TestPartResult& test_part_result) {
+ void OnTestPartResult(const TestPartResult& test_part_result) override {
fprintf(stdout,
"%s in %s:%d\n%s\n",
test_part_result.failed() ? "*** Failure" : "Success",
@@ -78,7 +78,7 @@ class TersePrinter : public EmptyTestEventListener {
}
// Called after a test ends.
- virtual void OnTestEnd(const TestInfo& test_info) {
+ void OnTestEnd(const TestInfo& test_info) override {
fprintf(stdout,
"*** Test %s.%s ending.\n",
test_info.test_case_name(),
diff --git a/googletest/src/gtest-death-test.cc b/googletest/src/gtest-death-test.cc
index ff04e54e..fb885e23 100644
--- a/googletest/src/gtest-death-test.cc
+++ b/googletest/src/gtest-death-test.cc
@@ -407,10 +407,10 @@ class DeathTestImpl : public DeathTest {
write_fd_(-1) {}
// read_fd_ is expected to be closed and cleared by a derived class.
- ~DeathTestImpl() { GTEST_DEATH_TEST_CHECK_(read_fd_ == -1); }
+ ~DeathTestImpl() override { GTEST_DEATH_TEST_CHECK_(read_fd_ == -1); }
- void Abort(AbortReason reason);
- virtual bool Passed(bool status_ok);
+ void Abort(AbortReason reason) override;
+ bool Passed(bool status_ok) override;
const char* statement() const { return statement_; }
bool spawned() const { return spawned_; }
@@ -1065,7 +1065,7 @@ class ForkingDeathTest : public DeathTestImpl {
ForkingDeathTest(const char* statement, Matcher<const std::string&> matcher);
// All of these virtual functions are inherited from DeathTest.
- virtual int Wait();
+ int Wait() override;
protected:
void set_child_pid(pid_t child_pid) { child_pid_ = child_pid; }
@@ -1101,7 +1101,7 @@ class NoExecDeathTest : public ForkingDeathTest {
public:
NoExecDeathTest(const char* a_statement, Matcher<const std::string&> matcher)
: ForkingDeathTest(a_statement, std::move(matcher)) {}
- virtual TestRole AssumeRole();
+ TestRole AssumeRole() override;
};
// The AssumeRole process for a fork-and-run death test. It implements a
@@ -1159,7 +1159,8 @@ class ExecDeathTest : public ForkingDeathTest {
: ForkingDeathTest(a_statement, std::move(matcher)),
file_(file),
line_(line) {}
- virtual TestRole AssumeRole();
+ TestRole AssumeRole() override;
+
private:
static ::std::vector<std::string> GetArgvsForDeathTestChildProcess() {
::std::vector<std::string> args = GetInjectableArgvs();
diff --git a/googletest/src/gtest-internal-inl.h b/googletest/src/gtest-internal-inl.h
index 91f923d7..55d3a694 100644
--- a/googletest/src/gtest-internal-inl.h
+++ b/googletest/src/gtest-internal-inl.h
@@ -443,8 +443,8 @@ class OsStackTraceGetter : public OsStackTraceGetterInterface {
public:
OsStackTraceGetter() {}
- virtual std::string CurrentStackTrace(int max_depth, int skip_count);
- virtual void UponLeavingGTest();
+ std::string CurrentStackTrace(int max_depth, int skip_count) override;
+ void UponLeavingGTest() override;
private:
#if GTEST_HAS_ABSL
@@ -475,7 +475,7 @@ class DefaultGlobalTestPartResultReporter
explicit DefaultGlobalTestPartResultReporter(UnitTestImpl* unit_test);
// Implements the TestPartResultReporterInterface. Reports the test part
// result in the current test.
- virtual void ReportTestPartResult(const TestPartResult& result);
+ void ReportTestPartResult(const TestPartResult& result) override;
private:
UnitTestImpl* const unit_test_;
@@ -491,7 +491,7 @@ class DefaultPerThreadTestPartResultReporter
explicit DefaultPerThreadTestPartResultReporter(UnitTestImpl* unit_test);
// Implements the TestPartResultReporterInterface. The implementation just
// delegates to the current global test part result reporter of *unit_test_.
- virtual void ReportTestPartResult(const TestPartResult& result);
+ void ReportTestPartResult(const TestPartResult& result) override;
private:
UnitTestImpl* const unit_test_;
@@ -1063,13 +1063,13 @@ class StreamingListener : public EmptyTestEventListener {
MakeConnection();
}
- virtual ~SocketWriter() {
+ ~SocketWriter() override {
if (sockfd_ != -1)
CloseConnection();
}
// Sends a string to the socket.
- virtual void Send(const std::string& message) {
+ void Send(const std::string& message) override {
GTEST_CHECK_(sockfd_ != -1)
<< "Send() can be called only when there is a connection.";
@@ -1086,7 +1086,7 @@ class StreamingListener : public EmptyTestEventListener {
void MakeConnection();
// Closes the socket.
- void CloseConnection() {
+ void CloseConnection() override {
GTEST_CHECK_(sockfd_ != -1)
<< "CloseConnection() can be called only when there is a connection.";
@@ -1112,11 +1112,11 @@ class StreamingListener : public EmptyTestEventListener {
explicit StreamingListener(AbstractSocketWriter* socket_writer)
: socket_writer_(socket_writer) { Start(); }
- void OnTestProgramStart(const UnitTest& /* unit_test */) {
+ void OnTestProgramStart(const UnitTest& /* unit_test */) override {
SendLn("event=TestProgramStart");
}
- void OnTestProgramEnd(const UnitTest& unit_test) {
+ void OnTestProgramEnd(const UnitTest& unit_test) override {
// Note that Google Test current only report elapsed time for each
// test iteration, not for the entire test program.
SendLn("event=TestProgramEnd&passed=" + FormatBool(unit_test.Passed()));
@@ -1125,39 +1125,41 @@ class StreamingListener : public EmptyTestEventListener {
socket_writer_->CloseConnection();
}
- void OnTestIterationStart(const UnitTest& /* unit_test */, int iteration) {
+ void OnTestIterationStart(const UnitTest& /* unit_test */,
+ int iteration) override {
SendLn("event=TestIterationStart&iteration=" +
StreamableToString(iteration));
}
- void OnTestIterationEnd(const UnitTest& unit_test, int /* iteration */) {
+ void OnTestIterationEnd(const UnitTest& unit_test,
+ int /* iteration */) override {
SendLn("event=TestIterationEnd&passed=" +
FormatBool(unit_test.Passed()) + "&elapsed_time=" +
StreamableToString(unit_test.elapsed_time()) + "ms");
}
- void OnTestCaseStart(const TestCase& test_case) {
+ void OnTestCaseStart(const TestCase& test_case) override {
SendLn(std::string("event=TestCaseStart&name=") + test_case.name());
}
- void OnTestCaseEnd(const TestCase& test_case) {
+ void OnTestCaseEnd(const TestCase& test_case) override {
SendLn("event=TestCaseEnd&passed=" + FormatBool(test_case.Passed())
+ "&elapsed_time=" + StreamableToString(test_case.elapsed_time())
+ "ms");
}
- void OnTestStart(const TestInfo& test_info) {
+ void OnTestStart(const TestInfo& test_info) override {
SendLn(std::string("event=TestStart&name=") + test_info.name());
}
- void OnTestEnd(const TestInfo& test_info) {
+ void OnTestEnd(const TestInfo& test_info) override {
SendLn("event=TestEnd&passed=" +
FormatBool((test_info.result())->Passed()) +
"&elapsed_time=" +
StreamableToString((test_info.result())->elapsed_time()) + "ms");
}
- void OnTestPartResult(const TestPartResult& test_part_result) {
+ void OnTestPartResult(const TestPartResult& test_part_result) override {
const char* file_name = test_part_result.file_name();
if (file_name == nullptr) file_name = "";
SendLn("event=TestPartResult&file=" + UrlEncode(file_name) +
diff --git a/googletest/src/gtest.cc b/googletest/src/gtest.cc
index 424de30d..a5581f72 100644
--- a/googletest/src/gtest.cc
+++ b/googletest/src/gtest.cc
@@ -3111,19 +3111,19 @@ class PrettyUnitTestResultPrinter : public TestEventListener {
}
// The following methods override what's in the TestEventListener class.
- 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& 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& 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 {}
private:
static void PrintFailedTests(const UnitTest& unit_test);
@@ -3352,7 +3352,7 @@ void PrettyUnitTestResultPrinter::OnTestIterationEnd(const UnitTest& unit_test,
class TestEventRepeater : public TestEventListener {
public:
TestEventRepeater() : forwarding_enabled_(true) {}
- virtual ~TestEventRepeater();
+ ~TestEventRepeater() override;
void Append(TestEventListener *listener);
TestEventListener* Release(TestEventListener* listener);
@@ -3361,19 +3361,19 @@ class TestEventRepeater : public TestEventListener {
bool forwarding_enabled() const { return forwarding_enabled_; }
void set_forwarding_enabled(bool enable) { forwarding_enabled_ = enable; }
- 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& 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& 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;
private:
// Controls whether events will be forwarded to listeners_. Set to false
@@ -3466,7 +3466,7 @@ class XmlUnitTestResultPrinter : public EmptyTestEventListener {
public:
explicit XmlUnitTestResultPrinter(const char* output_file);
- virtual void OnTestIterationEnd(const UnitTest& unit_test, int iteration);
+ void OnTestIterationEnd(const UnitTest& unit_test, int iteration) override;
void ListTestsMatchingFilter(const std::vector<TestCase*>& test_cases);
// Prints an XML summary of all unit tests.
@@ -3924,7 +3924,7 @@ class JsonUnitTestResultPrinter : public EmptyTestEventListener {
public:
explicit JsonUnitTestResultPrinter(const char* output_file);
- virtual void OnTestIterationEnd(const UnitTest& unit_test, int iteration);
+ void OnTestIterationEnd(const UnitTest& unit_test, int iteration) override;
// Prints an JSON summary of all unit tests.
static void PrintJsonTestList(::std::ostream* stream,
diff --git a/googletest/test/googletest-catch-exceptions-test_.cc b/googletest/test/googletest-catch-exceptions-test_.cc
index 75d1d2da..8270f648 100644
--- a/googletest/test/googletest-catch-exceptions-test_.cc
+++ b/googletest/test/googletest-catch-exceptions-test_.cc
@@ -116,17 +116,17 @@ class CxxExceptionInConstructorTest : public Test {
}
protected:
- ~CxxExceptionInConstructorTest() {
+ ~CxxExceptionInConstructorTest() override {
ADD_FAILURE() << "CxxExceptionInConstructorTest destructor "
<< "called unexpectedly.";
}
- virtual void SetUp() {
+ void SetUp() override {
ADD_FAILURE() << "CxxExceptionInConstructorTest::SetUp() "
<< "called unexpectedly.";
}
- virtual void TearDown() {
+ void TearDown() override {
ADD_FAILURE() << "CxxExceptionInConstructorTest::TearDown() "
<< "called unexpectedly.";
}
@@ -157,19 +157,19 @@ class CxxExceptionInSetUpTestCaseTest : public Test {
}
protected:
- ~CxxExceptionInSetUpTestCaseTest() {
+ ~CxxExceptionInSetUpTestCaseTest() override {
printf("%s",
"CxxExceptionInSetUpTestCaseTest destructor "
"called as expected.\n");
}
- virtual void SetUp() {
+ void SetUp() override {
printf("%s",
"CxxExceptionInSetUpTestCaseTest::SetUp() "
"called as expected.\n");
}
- virtual void TearDown() {
+ void TearDown() override {
printf("%s",
"CxxExceptionInSetUpTestCaseTest::TearDown() "
"called as expected.\n");
@@ -200,15 +200,15 @@ class CxxExceptionInSetUpTest : public Test {
}
protected:
- ~CxxExceptionInSetUpTest() {
+ ~CxxExceptionInSetUpTest() override {
printf("%s",
"CxxExceptionInSetUpTest destructor "
"called as expected.\n");
}
- virtual void SetUp() { throw std::runtime_error("Standard C++ exception"); }
+ void SetUp() override { throw std::runtime_error("Standard C++ exception"); }
- virtual void TearDown() {
+ void TearDown() override {
printf("%s",
"CxxExceptionInSetUpTest::TearDown() "
"called as expected.\n");
@@ -229,13 +229,13 @@ class CxxExceptionInTearDownTest : public Test {
}
protected:
- ~CxxExceptionInTearDownTest() {
+ ~CxxExceptionInTearDownTest() override {
printf("%s",
"CxxExceptionInTearDownTest destructor "
"called as expected.\n");
}
- virtual void TearDown() {
+ void TearDown() override {
throw std::runtime_error("Standard C++ exception");
}
};
@@ -251,13 +251,13 @@ class CxxExceptionInTestBodyTest : public Test {
}
protected:
- ~CxxExceptionInTestBodyTest() {
+ ~CxxExceptionInTestBodyTest() override {
printf("%s",
"CxxExceptionInTestBodyTest destructor "
"called as expected.\n");
}
- virtual void TearDown() {
+ void TearDown() override {
printf("%s",
"CxxExceptionInTestBodyTest::TearDown() "
"called as expected.\n");
diff --git a/googletest/test/googletest-death-test-test.cc b/googletest/test/googletest-death-test-test.cc
index 5d87e1a4..a1a8f181 100644
--- a/googletest/test/googletest-death-test-test.cc
+++ b/googletest/test/googletest-death-test-test.cc
@@ -128,9 +128,7 @@ class TestForDeathTest : public testing::Test {
protected:
TestForDeathTest() : original_dir_(FilePath::GetCurrentDir()) {}
- virtual ~TestForDeathTest() {
- posix::ChDir(original_dir_.c_str());
- }
+ ~TestForDeathTest() override { posix::ChDir(original_dir_.c_str()); }
// A static member function that's expected to die.
static void StaticMemberFunction() { DieInside("StaticMemberFunction"); }
@@ -885,9 +883,9 @@ TEST_F(TestForDeathTest, DeathTestMultiLineMatchPass) {
class MockDeathTestFactory : public DeathTestFactory {
public:
MockDeathTestFactory();
- virtual bool Create(const char* statement,
- testing::Matcher<const std::string&> matcher,
- const char* file, int line, DeathTest** test);
+ bool Create(const char* statement,
+ testing::Matcher<const std::string&> matcher, const char* file,
+ int line, DeathTest** test) override;
// Sets the parameters for subsequent calls to Create.
void SetParameters(bool create, DeathTest::TestRole role,
@@ -942,22 +940,20 @@ class MockDeathTest : public DeathTest {
TestRole role, int status, bool passed) :
parent_(parent), role_(role), status_(status), passed_(passed) {
}
- virtual ~MockDeathTest() {
- parent_->test_deleted_ = true;
- }
- virtual TestRole AssumeRole() {
+ ~MockDeathTest() override { parent_->test_deleted_ = true; }
+ TestRole AssumeRole() override {
++parent_->assume_role_calls_;
return role_;
}
- virtual int Wait() {
+ int Wait() override {
++parent_->wait_calls_;
return status_;
}
- virtual bool Passed(bool exit_status_ok) {
+ bool Passed(bool exit_status_ok) override {
parent_->passed_args_.push_back(exit_status_ok);
return passed_;
}
- virtual void Abort(AbortReason reason) {
+ void Abort(AbortReason reason) override {
parent_->abort_args_.push_back(reason);
}
diff --git a/googletest/test/googletest-death-test_ex_test.cc b/googletest/test/googletest-death-test_ex_test.cc
index b8b9470f..cf0d9704 100644
--- a/googletest/test/googletest-death-test_ex_test.cc
+++ b/googletest/test/googletest-death-test_ex_test.cc
@@ -59,7 +59,7 @@ TEST(CxxExceptionDeathTest, ExceptionIsFailure) {
class TestException : public std::exception {
public:
- virtual const char* what() const throw() { return "exceptional message"; }
+ const char* what() const throw() override { return "exceptional message"; }
};
TEST(CxxExceptionDeathTest, PrintsMessageForStdExceptions) {
diff --git a/googletest/test/googletest-filepath-test.cc b/googletest/test/googletest-filepath-test.cc
index 72d1c440..674799a5 100644
--- a/googletest/test/googletest-filepath-test.cc
+++ b/googletest/test/googletest-filepath-test.cc
@@ -479,7 +479,7 @@ TEST(AssignmentOperatorTest, ConstAssignedToNonConst) {
class DirectoryCreationTest : public Test {
protected:
- virtual void SetUp() {
+ void SetUp() override {
testdata_path_.Set(FilePath(
TempDir() + GetCurrentExecutableName().string() +
"_directory_creation" GTEST_PATH_SEP_ "test" GTEST_PATH_SEP_));
@@ -496,7 +496,7 @@ class DirectoryCreationTest : public Test {
posix::RmDir(testdata_path_.c_str());
}
- virtual void TearDown() {
+ void TearDown() override {
remove(testdata_file_.c_str());
remove(unique_file0_.c_str());
remove(unique_file1_.c_str());
diff --git a/googletest/test/googletest-listener-test.cc b/googletest/test/googletest-listener-test.cc
index a4f42eb6..1f5f5c53 100644
--- a/googletest/test/googletest-listener-test.cc
+++ b/googletest/test/googletest-listener-test.cc
@@ -57,63 +57,63 @@ class EventRecordingListener : public TestEventListener {
explicit EventRecordingListener(const char* name) : name_(name) {}
protected:
- virtual void OnTestProgramStart(const UnitTest& /*unit_test*/) {
+ void OnTestProgramStart(const UnitTest& /*unit_test*/) override {
g_events->push_back(GetFullMethodName("OnTestProgramStart"));
}
- virtual void OnTestIterationStart(const UnitTest& /*unit_test*/,
- int iteration) {
+ void OnTestIterationStart(const UnitTest& /*unit_test*/,
+ int iteration) override {
Message message;
message << GetFullMethodName("OnTestIterationStart")
<< "(" << iteration << ")";
g_events->push_back(message.GetString());
}
- virtual void OnEnvironmentsSetUpStart(const UnitTest& /*unit_test*/) {
+ void OnEnvironmentsSetUpStart(const UnitTest& /*unit_test*/) override {
g_events->push_back(GetFullMethodName("OnEnvironmentsSetUpStart"));
}
- virtual void OnEnvironmentsSetUpEnd(const UnitTest& /*unit_test*/) {
+ void OnEnvironmentsSetUpEnd(const UnitTest& /*unit_test*/) override {
g_events->push_back(GetFullMethodName("OnEnvironmentsSetUpEnd"));
}
- virtual void OnTestCaseStart(const TestCase& /*test_case*/) {
+ void OnTestCaseStart(const TestCase& /*test_case*/) override {
g_events->push_back(GetFullMethodName("OnTestCaseStart"));
}
- virtual void OnTestStart(const TestInfo& /*test_info*/) {
+ void OnTestStart(const TestInfo& /*test_info*/) override {
g_events->push_back(GetFullMethodName("OnTestStart"));
}
- virtual void OnTestPartResult(const TestPartResult& /*test_part_result*/) {
+ void OnTestPartResult(const TestPartResult& /*test_part_result*/) override {
g_events->push_back(GetFullMethodName("OnTestPartResult"));
}
- virtual void OnTestEnd(const TestInfo& /*test_info*/) {
+ void OnTestEnd(const TestInfo& /*test_info*/) override {
g_events->push_back(GetFullMethodName("OnTestEnd"));
}
- virtual void OnTestCaseEnd(const TestCase& /*test_case*/) {
+ void OnTestCaseEnd(const TestCase& /*test_case*/) override {
g_events->push_back(GetFullMethodName("OnTestCaseEnd"));
}
- virtual void OnEnvironmentsTearDownStart(const UnitTest& /*unit_test*/) {
+ void OnEnvironmentsTearDownStart(const UnitTest& /*unit_test*/) override {
g_events->push_back(GetFullMethodName("OnEnvironmentsTearDownStart"));
}
- virtual void OnEnvironmentsTearDownEnd(const UnitTest& /*unit_test*/) {
+ void OnEnvironmentsTearDownEnd(const UnitTest& /*unit_test*/) override {
g_events->push_back(GetFullMethodName("OnEnvironmentsTearDownEnd"));
}
- virtual void OnTestIterationEnd(const UnitTest& /*unit_test*/,
- int iteration) {
+ void OnTestIterationEnd(const UnitTest& /*unit_test*/,
+ int iteration) override {
Message message;
message << GetFullMethodName("OnTestIterationEnd")
<< "(" << iteration << ")";
g_events->push_back(message.GetString());
}
- virtual void OnTestProgramEnd(const UnitTest& /*unit_test*/) {
+ void OnTestProgramEnd(const UnitTest& /*unit_test*/) override {
g_events->push_back(GetFullMethodName("OnTestProgramEnd"));
}
@@ -127,13 +127,9 @@ class EventRecordingListener : public TestEventListener {
class EnvironmentInvocationCatcher : public Environment {
protected:
- virtual void SetUp() {
- g_events->push_back("Environment::SetUp");
- }
+ void SetUp() override { g_events->push_back("Environment::SetUp"); }
- virtual void TearDown() {
- g_events->push_back("Environment::TearDown");
- }
+ void TearDown() override { g_events->push_back("Environment::TearDown"); }
};
class ListenerTest : public Test {
@@ -146,13 +142,9 @@ class ListenerTest : public Test {
g_events->push_back("ListenerTest::TearDownTestCase");
}
- virtual void SetUp() {
- g_events->push_back("ListenerTest::SetUp");
- }
+ void SetUp() override { g_events->push_back("ListenerTest::SetUp"); }
- virtual void TearDown() {
- g_events->push_back("ListenerTest::TearDown");
- }
+ void TearDown() override { g_events->push_back("ListenerTest::TearDown"); }
};
TEST_F(ListenerTest, DoesFoo) {
diff --git a/googletest/test/googletest-options-test.cc b/googletest/test/googletest-options-test.cc
index 7a27a72b..08aa9d82 100644
--- a/googletest/test/googletest-options-test.cc
+++ b/googletest/test/googletest-options-test.cc
@@ -126,7 +126,7 @@ TEST(OutputFileHelpersTest, GetCurrentExecutableName) {
class XmlOutputChangeDirTest : public Test {
protected:
- virtual void SetUp() {
+ void SetUp() override {
original_working_dir_ = FilePath::GetCurrentDir();
posix::ChDir("..");
// This will make the test fail if run from the root directory.
@@ -134,7 +134,7 @@ class XmlOutputChangeDirTest : public Test {
FilePath::GetCurrentDir().string());
}
- virtual void TearDown() {
+ void TearDown() override {
posix::ChDir(original_working_dir_.string().c_str());
}
diff --git a/googletest/test/googletest-output-test_.cc b/googletest/test/googletest-output-test_.cc
index e3cebf4d..67de2d17 100644
--- a/googletest/test/googletest-output-test_.cc
+++ b/googletest/test/googletest-output-test_.cc
@@ -364,15 +364,13 @@ class NonFatalFailureInFixtureConstructorTest : public testing::Test {
ADD_FAILURE() << "Expected failure #1, in the test fixture c'tor.";
}
- ~NonFatalFailureInFixtureConstructorTest() {
+ ~NonFatalFailureInFixtureConstructorTest() override {
ADD_FAILURE() << "Expected failure #5, in the test fixture d'tor.";
}
- virtual void SetUp() {
- ADD_FAILURE() << "Expected failure #2, in SetUp().";
- }
+ void SetUp() override { ADD_FAILURE() << "Expected failure #2, in SetUp()."; }
- virtual void TearDown() {
+ void TearDown() override {
ADD_FAILURE() << "Expected failure #4, in TearDown.";
}
};
@@ -389,17 +387,17 @@ class FatalFailureInFixtureConstructorTest : public testing::Test {
Init();
}
- ~FatalFailureInFixtureConstructorTest() {
+ ~FatalFailureInFixtureConstructorTest() override {
ADD_FAILURE() << "Expected failure #2, in the test fixture d'tor.";
}
- virtual void SetUp() {
+ void SetUp() override {
ADD_FAILURE() << "UNEXPECTED failure in SetUp(). "
<< "We should never get here, as the test fixture c'tor "
<< "had a fatal failure.";
}
- virtual void TearDown() {
+ void TearDown() override {
ADD_FAILURE() << "UNEXPECTED failure in TearDown(). "
<< "We should never get here, as the test fixture c'tor "
<< "had a fatal failure.";
@@ -420,18 +418,15 @@ TEST_F(FatalFailureInFixtureConstructorTest, FailureInConstructor) {
// Tests non-fatal failures in SetUp().
class NonFatalFailureInSetUpTest : public testing::Test {
protected:
- virtual ~NonFatalFailureInSetUpTest() {
- Deinit();
- }
+ ~NonFatalFailureInSetUpTest() override { Deinit(); }
- virtual void SetUp() {
+ void SetUp() override {
printf("(expecting 4 failures)\n");
ADD_FAILURE() << "Expected failure #1, in SetUp().";
}
- virtual void TearDown() {
- FAIL() << "Expected failure #3, in TearDown().";
- }
+ void TearDown() override { FAIL() << "Expected failure #3, in TearDown()."; }
+
private:
void Deinit() {
FAIL() << "Expected failure #4, in the test fixture d'tor.";
@@ -445,18 +440,15 @@ TEST_F(NonFatalFailureInSetUpTest, FailureInSetUp) {
// Tests fatal failures in SetUp().
class FatalFailureInSetUpTest : public testing::Test {
protected:
- virtual ~FatalFailureInSetUpTest() {
- Deinit();
- }
+ ~FatalFailureInSetUpTest() override { Deinit(); }
- virtual void SetUp() {
+ void SetUp() override {
printf("(expecting 3 failures)\n");
FAIL() << "Expected failure #1, in SetUp().";
}
- virtual void TearDown() {
- FAIL() << "Expected failure #2, in TearDown().";
- }
+ void TearDown() override { FAIL() << "Expected failure #2, in TearDown()."; }
+
private:
void Deinit() {
FAIL() << "Expected failure #3, in the test fixture d'tor.";
@@ -508,7 +500,7 @@ static void ThreadRoutine(SpawnThreadNotifications* notifications) {
class DeathTestAndMultiThreadsTest : public testing::Test {
protected:
// Starts a thread and waits for it to begin.
- virtual void SetUp() {
+ void SetUp() override {
thread_.reset(new ThreadWithParam<SpawnThreadNotifications*>(
&ThreadRoutine, &notifications_, nullptr));
notifications_.spawn_thread_started.WaitForNotification();
@@ -518,7 +510,7 @@ class DeathTestAndMultiThreadsTest : public testing::Test {
// a manager thread might still be left running that will interfere
// with later death tests. This is unfortunate, but this class
// cleans up after itself as best it can.
- virtual void TearDown() {
+ void TearDown() override {
notifications_.spawn_thread_ok_to_terminate.Notify();
}
@@ -1037,11 +1029,9 @@ TEST_F(ExpectFailureTest, ExpectNonFatalFailureOnAllThreads) {
class FooEnvironment : public testing::Environment {
public:
- virtual void SetUp() {
- printf("%s", "FooEnvironment::SetUp() called.\n");
- }
+ void SetUp() override { printf("%s", "FooEnvironment::SetUp() called.\n"); }
- virtual void TearDown() {
+ void TearDown() override {
printf("%s", "FooEnvironment::TearDown() called.\n");
FAIL() << "Expected fatal failure.";
}
@@ -1049,11 +1039,9 @@ class FooEnvironment : public testing::Environment {
class BarEnvironment : public testing::Environment {
public:
- virtual void SetUp() {
- printf("%s", "BarEnvironment::SetUp() called.\n");
- }
+ void SetUp() override { printf("%s", "BarEnvironment::SetUp() called.\n"); }
- virtual void TearDown() {
+ void TearDown() override {
printf("%s", "BarEnvironment::TearDown() called.\n");
ADD_FAILURE() << "Expected non-fatal failure.";
}
diff --git a/googletest/test/googletest-param-test-test.cc b/googletest/test/googletest-param-test-test.cc
index 04b92ca9..fc33378c 100644
--- a/googletest/test/googletest-param-test-test.cc
+++ b/googletest/test/googletest-param-test-test.cc
@@ -562,7 +562,7 @@ class TestGenerationEnvironment : public ::testing::Environment {
void TearDownExecuted() { tear_down_count_++; }
void TestBodyExecuted() { test_body_count_++; }
- virtual void TearDown() {
+ void TearDown() override {
// If all MultipleTestGenerationTest tests have been de-selected
// by the filter flag, the following checks make no sense.
bool perform_check = false;
@@ -619,11 +619,11 @@ class TestGenerationTest : public TestWithParam<int> {
Environment::Instance()->FixtureConstructorExecuted();
current_parameter_ = GetParam();
}
- virtual void SetUp() {
+ void SetUp() override {
Environment::Instance()->SetUpExecuted();
EXPECT_EQ(current_parameter_, GetParam());
}
- virtual void TearDown() {
+ void TearDown() override {
Environment::Instance()->TearDownExecuted();
EXPECT_EQ(current_parameter_, GetParam());
}
diff --git a/googletest/test/googletest-shuffle-test_.cc b/googletest/test/googletest-shuffle-test_.cc
index e72f1571..c1fc1066 100644
--- a/googletest/test/googletest-shuffle-test_.cc
+++ b/googletest/test/googletest-shuffle-test_.cc
@@ -76,12 +76,12 @@ TEST(DISABLED_D, DISABLED_B) {}
// iteration with a "----" marker.
class TestNamePrinter : public EmptyTestEventListener {
public:
- virtual void OnTestIterationStart(const UnitTest& /* unit_test */,
- int /* iteration */) {
+ void OnTestIterationStart(const UnitTest& /* unit_test */,
+ int /* iteration */) override {
printf("----\n");
}
- virtual void OnTestStart(const TestInfo& test_info) {
+ void OnTestStart(const TestInfo& test_info) override {
printf("%s.%s\n", test_info.test_case_name(), test_info.name());
}
};
diff --git a/googletest/test/gtest-typed-test_test.cc b/googletest/test/gtest-typed-test_test.cc
index 95e9e0e1..de6cc534 100644
--- a/googletest/test/gtest-typed-test_test.cc
+++ b/googletest/test/gtest-typed-test_test.cc
@@ -68,14 +68,14 @@ class CommonTest : public Test {
CommonTest() : value_(1) {}
- virtual ~CommonTest() { EXPECT_EQ(3, value_); }
+ ~CommonTest() override { EXPECT_EQ(3, value_); }
- virtual void SetUp() {
+ void SetUp() override {
EXPECT_EQ(1, value_);
value_++;
}
- virtual void TearDown() {
+ void TearDown() override {
EXPECT_EQ(2, value_);
value_++;
}
@@ -215,7 +215,7 @@ using testing::internal::TypedTestCasePState;
class TypedTestCasePStateTest : public Test {
protected:
- virtual void SetUp() {
+ void SetUp() override {
state_.AddTestName("foo.cc", 0, "FooTest", "A");
state_.AddTestName("foo.cc", 0, "FooTest", "B");
state_.AddTestName("foo.cc", 0, "FooTest", "C");
diff --git a/googletest/test/gtest-unittest-api_test.cc b/googletest/test/gtest-unittest-api_test.cc
index 78982869..2bcbedf1 100644
--- a/googletest/test/gtest-unittest-api_test.cc
+++ b/googletest/test/gtest-unittest-api_test.cc
@@ -232,7 +232,7 @@ TEST(DISABLED_Test, Dummy2) {}
class FinalSuccessChecker : public Environment {
protected:
- virtual void TearDown() {
+ void TearDown() override {
UnitTest* unit_test = UnitTest::GetInstance();
EXPECT_EQ(1 + kTypedTestCases, unit_test->successful_test_case_count());
diff --git a/googletest/test/gtest_environment_test.cc b/googletest/test/gtest_environment_test.cc
index bc9524d6..fea542a3 100644
--- a/googletest/test/gtest_environment_test.cc
+++ b/googletest/test/gtest_environment_test.cc
@@ -53,7 +53,7 @@ class MyEnvironment : public testing::Environment {
// Depending on the value of failure_in_set_up_, SetUp() will
// generate a non-fatal failure, generate a fatal failure, or
// succeed.
- virtual void SetUp() {
+ void SetUp() override {
set_up_was_run_ = true;
switch (failure_in_set_up_) {
@@ -69,7 +69,7 @@ class MyEnvironment : public testing::Environment {
}
// Generates a non-fatal failure.
- virtual void TearDown() {
+ void TearDown() override {
tear_down_was_run_ = true;
ADD_FAILURE() << "Expected non-fatal failure in global tear-down.";
}
diff --git a/googletest/test/gtest_pred_impl_unittest.cc b/googletest/test/gtest_pred_impl_unittest.cc
index b466c150..2019a30c 100644
--- a/googletest/test/gtest_pred_impl_unittest.cc
+++ b/googletest/test/gtest_pred_impl_unittest.cc
@@ -122,13 +122,13 @@ struct PredFormatFunctor1 {
class Predicate1Test : public testing::Test {
protected:
- virtual void SetUp() {
+ void SetUp() override {
expected_to_finish_ = true;
finished_ = false;
n1_ = 0;
}
- virtual void TearDown() {
+ void TearDown() override {
// Verifies that each of the predicate's arguments was evaluated
// exactly once.
EXPECT_EQ(1, n1_) <<
@@ -514,13 +514,13 @@ struct PredFormatFunctor2 {
class Predicate2Test : public testing::Test {
protected:
- virtual void SetUp() {
+ void SetUp() override {
expected_to_finish_ = true;
finished_ = false;
n1_ = n2_ = 0;
}
- virtual void TearDown() {
+ void TearDown() override {
// Verifies that each of the predicate's arguments was evaluated
// exactly once.
EXPECT_EQ(1, n1_) <<
@@ -948,13 +948,13 @@ struct PredFormatFunctor3 {
class Predicate3Test : public testing::Test {
protected:
- virtual void SetUp() {
+ void SetUp() override {
expected_to_finish_ = true;
finished_ = false;
n1_ = n2_ = n3_ = 0;
}
- virtual void TearDown() {
+ void TearDown() override {
// Verifies that each of the predicate's arguments was evaluated
// exactly once.
EXPECT_EQ(1, n1_) <<
@@ -1424,13 +1424,13 @@ struct PredFormatFunctor4 {
class Predicate4Test : public testing::Test {
protected:
- virtual void SetUp() {
+ void SetUp() override {
expected_to_finish_ = true;
finished_ = false;
n1_ = n2_ = n3_ = n4_ = 0;
}
- virtual void TearDown() {
+ void TearDown() override {
// Verifies that each of the predicate's arguments was evaluated
// exactly once.
EXPECT_EQ(1, n1_) <<
@@ -1942,13 +1942,13 @@ struct PredFormatFunctor5 {
class Predicate5Test : public testing::Test {
protected:
- virtual void SetUp() {
+ void SetUp() override {
expected_to_finish_ = true;
finished_ = false;
n1_ = n2_ = n3_ = n4_ = n5_ = 0;
}
- virtual void TearDown() {
+ void TearDown() override {
// Verifies that each of the predicate's arguments was evaluated
// exactly once.
EXPECT_EQ(1, n1_) <<
diff --git a/googletest/test/gtest_repeat_test.cc b/googletest/test/gtest_repeat_test.cc
index 1e8f499b..2ab82ca0 100644
--- a/googletest/test/gtest_repeat_test.cc
+++ b/googletest/test/gtest_repeat_test.cc
@@ -74,8 +74,8 @@ int g_environment_tear_down_count = 0;
class MyEnvironment : public testing::Environment {
public:
MyEnvironment() {}
- virtual void SetUp() { g_environment_set_up_count++; }
- virtual void TearDown() { g_environment_tear_down_count++; }
+ void SetUp() override { g_environment_set_up_count++; }
+ void TearDown() override { g_environment_tear_down_count++; }
};
// A test that should fail.
diff --git a/googletest/test/gtest_unittest.cc b/googletest/test/gtest_unittest.cc
index 04dd87dc..9ddb37d0 100644
--- a/googletest/test/gtest_unittest.cc
+++ b/googletest/test/gtest_unittest.cc
@@ -78,7 +78,7 @@ class StreamingListenerTest : public Test {
class FakeSocketWriter : public StreamingListener::AbstractSocketWriter {
public:
// Sends a string to the socket.
- virtual void Send(const std::string& message) { output_ += message; }
+ void Send(const std::string& message) override { output_ += message; }
std::string output_;
};
@@ -438,7 +438,7 @@ class FormatEpochTimeInMillisAsIso8601Test : public Test {
static const TimeInMillis kMillisPerSec = 1000;
private:
- virtual void SetUp() {
+ void SetUp() override {
saved_tz_ = nullptr;
GTEST_DISABLE_MSC_DEPRECATED_PUSH_(/* getenv, strdup: deprecated */)
@@ -452,7 +452,7 @@ class FormatEpochTimeInMillisAsIso8601Test : public Test {
SetTimeZone("UTC+00");
}
- virtual void TearDown() {
+ void TearDown() override {
SetTimeZone(saved_tz_);
free(const_cast<char*>(saved_tz_));
saved_tz_ = nullptr;
@@ -1361,7 +1361,7 @@ class TestResultTest : public Test {
// ... and 3 TestResult objects.
TestResult * r0, * r1, * r2;
- virtual void SetUp() {
+ void SetUp() override {
// pr1 is for success.
pr1 = new TestPartResult(TestPartResult::kSuccess,
"foo/bar.cc",
@@ -1398,7 +1398,7 @@ class TestResultTest : public Test {
results2->push_back(*pr2);
}
- virtual void TearDown() {
+ void TearDown() override {
delete pr1;
delete pr2;
@@ -1826,12 +1826,12 @@ TEST(ShouldRunTestOnShardTest, IsPartitionWhenThereIsOneShard) {
class ShouldShardTest : public testing::Test {
protected:
- virtual void SetUp() {
+ void SetUp() override {
index_var_ = GTEST_FLAG_PREFIX_UPPER_ "INDEX";
total_var_ = GTEST_FLAG_PREFIX_UPPER_ "TOTAL";
}
- virtual void TearDown() {
+ void TearDown() override {
SetEnv(index_var_, "");
SetEnv(total_var_, "");
}
@@ -2094,7 +2094,7 @@ TEST_F(UnitTestRecordPropertyTest,
class UnitTestRecordPropertyTestEnvironment : public Environment {
public:
- virtual void TearDown() {
+ void TearDown() override {
ExpectNonFatalFailureRecordingPropertyWithReservedKeyOutsideOfTestCase(
"tests");
ExpectNonFatalFailureRecordingPropertyWithReservedKeyOutsideOfTestCase(
@@ -2707,7 +2707,7 @@ class FloatingPointTest : public Test {
typedef typename testing::internal::FloatingPoint<RawType> Floating;
typedef typename Floating::Bits Bits;
- virtual void SetUp() {
+ void SetUp() override {
const size_t max_ulps = Floating::kMaxUlps;
// The bits that represent 0.0.
@@ -5061,7 +5061,7 @@ class TestLifeCycleTest : public Test {
// Destructor. Decrements the number of test objects that uses this
// fixture.
- ~TestLifeCycleTest() { count_--; }
+ ~TestLifeCycleTest() override { count_--; }
// Returns the number of live test objects that uses this fixture.
int count() const { return count_; }
@@ -5448,7 +5448,7 @@ class SetUpTestCaseTest : public Test {
}
// This will be called before each test in this test case.
- virtual void SetUp() {
+ void SetUp() override {
// SetUpTestCase() should be called only once, so counter_ should
// always be 1.
EXPECT_EQ(1, counter_);
@@ -5628,7 +5628,7 @@ struct Flags {
class ParseFlagsTest : public Test {
protected:
// Clears the flags before each test.
- virtual void SetUp() {
+ void SetUp() override {
GTEST_FLAG(also_run_disabled_tests) = false;
GTEST_FLAG(break_on_failure) = false;
GTEST_FLAG(catch_exceptions) = false;
@@ -6316,12 +6316,8 @@ TEST(NestedTestingNamespaceTest, Failure) {
// successfully.
class ProtectedFixtureMethodsTest : public Test {
protected:
- virtual void SetUp() {
- Test::SetUp();
- }
- virtual void TearDown() {
- Test::TearDown();
- }
+ void SetUp() override { Test::SetUp(); }
+ void TearDown() override { Test::TearDown(); }
};
// StreamingAssertionsTest tests the streaming versions of a representative
@@ -6699,13 +6695,13 @@ class TestListener : public EmptyTestEventListener {
: on_start_counter_(on_start_counter),
is_destroyed_(is_destroyed) {}
- virtual ~TestListener() {
+ ~TestListener() override {
if (is_destroyed_)
*is_destroyed_ = true;
}
protected:
- virtual void OnTestProgramStart(const UnitTest& /*unit_test*/) {
+ void OnTestProgramStart(const UnitTest& /*unit_test*/) override {
if (on_start_counter_ != nullptr) (*on_start_counter_)++;
}
@@ -6774,21 +6770,21 @@ class SequenceTestingListener : public EmptyTestEventListener {
: vector_(vector), id_(id) {}
protected:
- virtual void OnTestProgramStart(const UnitTest& /*unit_test*/) {
+ void OnTestProgramStart(const UnitTest& /*unit_test*/) override {
vector_->push_back(GetEventDescription("OnTestProgramStart"));
}
- virtual void OnTestProgramEnd(const UnitTest& /*unit_test*/) {
+ void OnTestProgramEnd(const UnitTest& /*unit_test*/) override {
vector_->push_back(GetEventDescription("OnTestProgramEnd"));
}
- virtual void OnTestIterationStart(const UnitTest& /*unit_test*/,
- int /*iteration*/) {
+ void OnTestIterationStart(const UnitTest& /*unit_test*/,
+ int /*iteration*/) override {
vector_->push_back(GetEventDescription("OnTestIterationStart"));
}
- virtual void OnTestIterationEnd(const UnitTest& /*unit_test*/,
- int /*iteration*/) {
+ void OnTestIterationEnd(const UnitTest& /*unit_test*/,
+ int /*iteration*/) override {
vector_->push_back(GetEventDescription("OnTestIterationEnd"));
}
diff --git a/googletest/test/gtest_xml_outfile1_test_.cc b/googletest/test/gtest_xml_outfile1_test_.cc
index a38ebac8..19aa252a 100644
--- a/googletest/test/gtest_xml_outfile1_test_.cc
+++ b/googletest/test/gtest_xml_outfile1_test_.cc
@@ -34,12 +34,8 @@
class PropertyOne : public testing::Test {
protected:
- virtual void SetUp() {
- RecordProperty("SetUpProp", 1);
- }
- virtual void TearDown() {
- RecordProperty("TearDownProp", 1);
- }
+ void SetUp() override { RecordProperty("SetUpProp", 1); }
+ void TearDown() override { RecordProperty("TearDownProp", 1); }
};
TEST_F(PropertyOne, TestSomeProperties) {
diff --git a/googletest/test/gtest_xml_outfile2_test_.cc b/googletest/test/gtest_xml_outfile2_test_.cc
index afaf15a5..f9a2a6e9 100644
--- a/googletest/test/gtest_xml_outfile2_test_.cc
+++ b/googletest/test/gtest_xml_outfile2_test_.cc
@@ -34,12 +34,8 @@
class PropertyTwo : public testing::Test {
protected:
- virtual void SetUp() {
- RecordProperty("SetUpProp", 2);
- }
- virtual void TearDown() {
- RecordProperty("TearDownProp", 2);
- }
+ void SetUp() override { RecordProperty("SetUpProp", 2); }
+ void TearDown() override { RecordProperty("TearDownProp", 2); }
};
TEST_F(PropertyTwo, TestSomeProperties) {