mirror of
https://github.com/catchorg/Catch2.git
synced 2024-11-25 23:06:10 +01:00
Devirtualize NameAndLocation query on trackers
This commit is contained in:
parent
de53773e46
commit
b74996a29c
@ -64,15 +64,12 @@ namespace TestCaseTracking {
|
||||
}
|
||||
|
||||
|
||||
TrackerBase::TrackerBase( NameAndLocation const& nameAndLocation, TrackerContext& ctx, ITracker* parent )
|
||||
: m_nameAndLocation( nameAndLocation ),
|
||||
TrackerBase::TrackerBase( NameAndLocation const& nameAndLocation, TrackerContext& ctx, ITracker* parent ):
|
||||
ITracker(nameAndLocation),
|
||||
m_ctx( ctx ),
|
||||
m_parent( parent )
|
||||
{}
|
||||
|
||||
NameAndLocation const& TrackerBase::nameAndLocation() const {
|
||||
return m_nameAndLocation;
|
||||
}
|
||||
bool TrackerBase::isComplete() const {
|
||||
return m_runState == CompletedSuccessfully || m_runState == Failed;
|
||||
}
|
||||
|
@ -29,15 +29,26 @@ namespace TestCaseTracking {
|
||||
}
|
||||
};
|
||||
|
||||
struct ITracker;
|
||||
class ITracker;
|
||||
|
||||
using ITrackerPtr = std::shared_ptr<ITracker>;
|
||||
|
||||
struct ITracker {
|
||||
virtual ~ITracker();
|
||||
class ITracker {
|
||||
NameAndLocation m_nameAndLocation;
|
||||
|
||||
public:
|
||||
ITracker(NameAndLocation const& nameAndLoc) :
|
||||
m_nameAndLocation(nameAndLoc)
|
||||
{}
|
||||
|
||||
|
||||
// static queries
|
||||
virtual NameAndLocation const& nameAndLocation() const = 0;
|
||||
NameAndLocation const& nameAndLocation() const {
|
||||
return m_nameAndLocation;
|
||||
}
|
||||
|
||||
virtual ~ITracker();
|
||||
|
||||
|
||||
// dynamic queries
|
||||
virtual bool isComplete() const = 0; // Successfully completed or failed
|
||||
@ -98,7 +109,6 @@ namespace TestCaseTracking {
|
||||
};
|
||||
|
||||
using Children = std::vector<ITrackerPtr>;
|
||||
NameAndLocation m_nameAndLocation;
|
||||
TrackerContext& m_ctx;
|
||||
ITracker* m_parent;
|
||||
Children m_children;
|
||||
@ -107,7 +117,6 @@ namespace TestCaseTracking {
|
||||
public:
|
||||
TrackerBase( NameAndLocation const& nameAndLocation, TrackerContext& ctx, ITracker* parent );
|
||||
|
||||
NameAndLocation const& nameAndLocation() const override;
|
||||
bool isComplete() const override;
|
||||
bool isSuccessfullyCompleted() const override;
|
||||
bool isOpen() const override;
|
||||
|
Loading…
Reference in New Issue
Block a user