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 ):
|
TrackerBase::TrackerBase( NameAndLocation const& nameAndLocation, TrackerContext& ctx, ITracker* parent ):
|
||||||
ITracker(nameAndLocation),
|
ITracker(nameAndLocation, parent),
|
||||||
m_ctx( ctx ),
|
m_ctx( ctx )
|
||||||
m_parent( parent )
|
|
||||||
{}
|
{}
|
||||||
|
|
||||||
bool TrackerBase::isComplete() const {
|
bool TrackerBase::isComplete() const {
|
||||||
@ -99,11 +98,6 @@ namespace TestCaseTracking {
|
|||||||
return m_runState != NotStarted && !isComplete();
|
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() {
|
void TrackerBase::openChild() {
|
||||||
if( m_runState != ExecutingChildren ) {
|
if( m_runState != ExecutingChildren ) {
|
||||||
m_runState = ExecutingChildren;
|
m_runState = ExecutingChildren;
|
||||||
|
@ -38,11 +38,13 @@ namespace TestCaseTracking {
|
|||||||
using Children = std::vector<ITrackerPtr>;
|
using Children = std::vector<ITrackerPtr>;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
ITracker* m_parent = nullptr;
|
||||||
Children m_children;
|
Children m_children;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
ITracker(NameAndLocation const& nameAndLoc) :
|
ITracker( NameAndLocation const& nameAndLoc, ITracker* parent ):
|
||||||
m_nameAndLocation(nameAndLoc)
|
m_nameAndLocation( nameAndLoc ),
|
||||||
|
m_parent( parent )
|
||||||
{}
|
{}
|
||||||
|
|
||||||
|
|
||||||
@ -50,6 +52,9 @@ namespace TestCaseTracking {
|
|||||||
NameAndLocation const& nameAndLocation() const {
|
NameAndLocation const& nameAndLocation() const {
|
||||||
return m_nameAndLocation;
|
return m_nameAndLocation;
|
||||||
}
|
}
|
||||||
|
ITracker* parent() const {
|
||||||
|
return m_parent;
|
||||||
|
}
|
||||||
|
|
||||||
virtual ~ITracker(); // = default
|
virtual ~ITracker(); // = default
|
||||||
|
|
||||||
@ -60,8 +65,6 @@ namespace TestCaseTracking {
|
|||||||
virtual bool isOpen() const = 0; // Started but not complete
|
virtual bool isOpen() const = 0; // Started but not complete
|
||||||
virtual bool hasStarted() const = 0;
|
virtual bool hasStarted() const = 0;
|
||||||
|
|
||||||
virtual ITracker* parent() = 0;
|
|
||||||
|
|
||||||
// actions
|
// actions
|
||||||
virtual void close() = 0; // Successfully complete
|
virtual void close() = 0; // Successfully complete
|
||||||
virtual void fail() = 0;
|
virtual void fail() = 0;
|
||||||
@ -125,7 +128,6 @@ namespace TestCaseTracking {
|
|||||||
};
|
};
|
||||||
|
|
||||||
TrackerContext& m_ctx;
|
TrackerContext& m_ctx;
|
||||||
ITracker* m_parent;
|
|
||||||
CycleState m_runState = NotStarted;
|
CycleState m_runState = NotStarted;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
@ -138,8 +140,6 @@ namespace TestCaseTracking {
|
|||||||
return m_runState != NotStarted;
|
return m_runState != NotStarted;
|
||||||
}
|
}
|
||||||
|
|
||||||
ITracker* parent() override;
|
|
||||||
|
|
||||||
void openChild() override;
|
void openChild() override;
|
||||||
|
|
||||||
bool isSectionTracker() const override;
|
bool isSectionTracker() const override;
|
||||||
|
Loading…
Reference in New Issue
Block a user