From 61461dfd1ded8791499af80e52f3972d927944e1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Ho=C5=99e=C5=88ovsk=C3=BD?= Date: Thu, 10 Jun 2021 00:02:40 +0200 Subject: [PATCH] Move default impls of isFooTracker to the interface --- .../internal/catch_test_case_tracker.cpp | 5 ++--- .../internal/catch_test_case_tracker.hpp | 20 +++++++++++++------ 2 files changed, 16 insertions(+), 9 deletions(-) diff --git a/src/catch2/internal/catch_test_case_tracker.cpp b/src/catch2/internal/catch_test_case_tracker.cpp index b040f63a..7d5d574a 100644 --- a/src/catch2/internal/catch_test_case_tracker.cpp +++ b/src/catch2/internal/catch_test_case_tracker.cpp @@ -45,6 +45,8 @@ namespace TestCaseTracking { return ( it != m_children.end() ) ? it->get() : nullptr; } + bool ITracker::isSectionTracker() const { return false; } + bool ITracker::isGeneratorTracker() const { return false; } ITracker& TrackerContext::startRun() { @@ -106,9 +108,6 @@ namespace TestCaseTracking { } } - bool TrackerBase::isSectionTracker() const { return false; } - bool TrackerBase::isGeneratorTracker() const { return false; } - void TrackerBase::open() { m_runState = Executing; moveToThis(); diff --git a/src/catch2/internal/catch_test_case_tracker.hpp b/src/catch2/internal/catch_test_case_tracker.hpp index 8c2222af..d018210c 100644 --- a/src/catch2/internal/catch_test_case_tracker.hpp +++ b/src/catch2/internal/catch_test_case_tracker.hpp @@ -86,9 +86,20 @@ namespace TestCaseTracking { virtual void openChild() = 0; - // Debug/ checking - virtual bool isSectionTracker() const = 0; - virtual bool isGeneratorTracker() const = 0; + /** + * Returns true if the instance is a section tracker + * + * Subclasses should override to true if they are, replaces RTTI + * for internal debug checks. + */ + virtual bool isSectionTracker() const; + /** + * Returns true if the instance is a generator tracker + * + * Subclasses should override to true if they are, replaces RTTI + * for internal debug checks. + */ + virtual bool isGeneratorTracker() const; }; class TrackerContext { @@ -142,9 +153,6 @@ namespace TestCaseTracking { void openChild() override; - bool isSectionTracker() const override; - bool isGeneratorTracker() const override; - void open(); void close() override;