mirror of
https://github.com/catchorg/Catch2.git
synced 2024-11-26 07:16:10 +01:00
Split imply from TrackedSection class to avoid use of incomplete type
- see #450
This commit is contained in:
parent
804896cdfa
commit
6d5797231c
@ -33,32 +33,15 @@ namespace SectionTracking {
|
|||||||
|
|
||||||
RunState runState() const { return m_runState; }
|
RunState runState() const { return m_runState; }
|
||||||
|
|
||||||
TrackedSection* findChild( std::string const& childName ) {
|
TrackedSection* findChild( std::string const& childName );
|
||||||
TrackedSections::iterator it = m_children.find( childName );
|
TrackedSection* acquireChild( std::string const& childName );
|
||||||
return it != m_children.end()
|
|
||||||
? &it->second
|
|
||||||
: NULL;
|
|
||||||
}
|
|
||||||
TrackedSection* acquireChild( std::string const& childName ) {
|
|
||||||
if( TrackedSection* child = findChild( childName ) )
|
|
||||||
return child;
|
|
||||||
m_children.insert( std::make_pair( childName, TrackedSection( childName, this ) ) );
|
|
||||||
return findChild( childName );
|
|
||||||
}
|
|
||||||
void enter() {
|
void enter() {
|
||||||
if( m_runState == NotStarted )
|
if( m_runState == NotStarted )
|
||||||
m_runState = Executing;
|
m_runState = Executing;
|
||||||
}
|
}
|
||||||
void leave() {
|
void leave();
|
||||||
for( TrackedSections::const_iterator it = m_children.begin(), itEnd = m_children.end();
|
|
||||||
it != itEnd;
|
|
||||||
++it )
|
|
||||||
if( it->second.runState() != Completed ) {
|
|
||||||
m_runState = ExecutingChildren;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
m_runState = Completed;
|
|
||||||
}
|
|
||||||
TrackedSection* getParent() {
|
TrackedSection* getParent() {
|
||||||
return m_parent;
|
return m_parent;
|
||||||
}
|
}
|
||||||
@ -71,9 +54,31 @@ namespace SectionTracking {
|
|||||||
RunState m_runState;
|
RunState m_runState;
|
||||||
TrackedSections m_children;
|
TrackedSections m_children;
|
||||||
TrackedSection* m_parent;
|
TrackedSection* m_parent;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
inline TrackedSection* TrackedSection::findChild( std::string const& childName ) {
|
||||||
|
TrackedSections::iterator it = m_children.find( childName );
|
||||||
|
return it != m_children.end()
|
||||||
|
? &it->second
|
||||||
|
: NULL;
|
||||||
|
}
|
||||||
|
inline TrackedSection* TrackedSection::acquireChild( std::string const& childName ) {
|
||||||
|
if( TrackedSection* child = findChild( childName ) )
|
||||||
|
return child;
|
||||||
|
m_children.insert( std::make_pair( childName, TrackedSection( childName, this ) ) );
|
||||||
|
return findChild( childName );
|
||||||
|
}
|
||||||
|
inline void TrackedSection::leave() {
|
||||||
|
for( TrackedSections::const_iterator it = m_children.begin(), itEnd = m_children.end();
|
||||||
|
it != itEnd;
|
||||||
|
++it )
|
||||||
|
if( it->second.runState() != Completed ) {
|
||||||
|
m_runState = ExecutingChildren;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
m_runState = Completed;
|
||||||
|
}
|
||||||
|
|
||||||
class TestCaseTracker {
|
class TestCaseTracker {
|
||||||
public:
|
public:
|
||||||
TestCaseTracker( std::string const& testCaseName )
|
TestCaseTracker( std::string const& testCaseName )
|
||||||
|
Loading…
Reference in New Issue
Block a user