mirror of
https://github.com/catchorg/Catch2.git
synced 2024-11-26 15:26:11 +01:00
Devirtualize ITracker::parent
This commit is contained in:
parent
a14d67cace
commit
c064322a9d
@ -84,9 +84,8 @@ namespace TestCaseTracking {
|
||||
|
||||
|
||||
TrackerBase::TrackerBase( NameAndLocation const& nameAndLocation, TrackerContext& ctx, ITracker* parent ):
|
||||
ITracker(nameAndLocation),
|
||||
m_ctx( ctx ),
|
||||
m_parent( parent )
|
||||
ITracker(nameAndLocation, parent),
|
||||
m_ctx( ctx )
|
||||
{}
|
||||
|
||||
bool TrackerBase::isComplete() const {
|
||||
@ -99,11 +98,6 @@ namespace TestCaseTracking {
|
||||
return m_runState != NotStarted && !isComplete();
|
||||
}
|
||||
|
||||
ITracker* TrackerBase::parent() {
|
||||
assert( m_parent ); // Should always be non-null except for root
|
||||
return m_parent;
|
||||
}
|
||||
|
||||
void TrackerBase::openChild() {
|
||||
if( m_runState != ExecutingChildren ) {
|
||||
m_runState = ExecutingChildren;
|
||||
|
@ -38,11 +38,13 @@ namespace TestCaseTracking {
|
||||
using Children = std::vector<ITrackerPtr>;
|
||||
|
||||
protected:
|
||||
ITracker* m_parent = nullptr;
|
||||
Children m_children;
|
||||
|
||||
public:
|
||||
ITracker(NameAndLocation const& nameAndLoc) :
|
||||
m_nameAndLocation(nameAndLoc)
|
||||
ITracker( NameAndLocation const& nameAndLoc, ITracker* parent ):
|
||||
m_nameAndLocation( nameAndLoc ),
|
||||
m_parent( parent )
|
||||
{}
|
||||
|
||||
|
||||
@ -50,6 +52,9 @@ namespace TestCaseTracking {
|
||||
NameAndLocation const& nameAndLocation() const {
|
||||
return m_nameAndLocation;
|
||||
}
|
||||
ITracker* parent() const {
|
||||
return m_parent;
|
||||
}
|
||||
|
||||
virtual ~ITracker(); // = default
|
||||
|
||||
@ -60,8 +65,6 @@ namespace TestCaseTracking {
|
||||
virtual bool isOpen() const = 0; // Started but not complete
|
||||
virtual bool hasStarted() const = 0;
|
||||
|
||||
virtual ITracker* parent() = 0;
|
||||
|
||||
// actions
|
||||
virtual void close() = 0; // Successfully complete
|
||||
virtual void fail() = 0;
|
||||
@ -125,7 +128,6 @@ namespace TestCaseTracking {
|
||||
};
|
||||
|
||||
TrackerContext& m_ctx;
|
||||
ITracker* m_parent;
|
||||
CycleState m_runState = NotStarted;
|
||||
|
||||
public:
|
||||
@ -138,8 +140,6 @@ namespace TestCaseTracking {
|
||||
return m_runState != NotStarted;
|
||||
}
|
||||
|
||||
ITracker* parent() override;
|
||||
|
||||
void openChild() override;
|
||||
|
||||
bool isSectionTracker() const override;
|
||||
|
Loading…
Reference in New Issue
Block a user