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