Wire Sysio Wire Sysion 1.0.0
Loading...
Searching...
No Matches
Catch::TestCaseTracking::SectionTracker Class Reference

#include <catch_test_case_tracker.h>

Inheritance diagram for Catch::TestCaseTracking::SectionTracker:
Collaboration diagram for Catch::TestCaseTracking::SectionTracker:

Public Member Functions

 SectionTracker (NameAndLocation const &nameAndLocation, TrackerContext &ctx, ITracker *parent)
 
bool isSectionTracker () const override
 
bool isComplete () const override
 
void tryOpen ()
 
void addInitialFilters (std::vector< std::string > const &filters)
 
void addNextFilters (std::vector< std::string > const &filters)
 
- Public Member Functions inherited from Catch::TestCaseTracking::TrackerBase
 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
 
bool hasChildren () const override
 
void addChild (ITrackerPtr const &child) override
 
ITrackerPtr findChild (NameAndLocation const &nameAndLocation) override
 
ITrackerparent () override
 
void openChild () override
 
bool isSectionTracker () const override
 
bool isGeneratorTracker () const override
 
void open ()
 
void close () override
 
void fail () override
 
void markAsNeedingAnotherRun () override
 
- Public Member Functions inherited from Catch::TestCaseTracking::ITracker
virtual ~ITracker ()
 

Static Public Member Functions

static SectionTrackeracquire (TrackerContext &ctx, NameAndLocation const &nameAndLocation)
 

Additional Inherited Members

- Protected Types inherited from Catch::TestCaseTracking::TrackerBase
enum  CycleState {
  NotStarted , Executing , ExecutingChildren , NeedsAnotherRun ,
  CompletedSuccessfully , Failed
}
 
using Children = std::vector<ITrackerPtr>
 
- Protected Attributes inherited from Catch::TestCaseTracking::TrackerBase
NameAndLocation m_nameAndLocation
 
TrackerContextm_ctx
 
ITrackerm_parent
 
Children m_children
 
CycleState m_runState = NotStarted
 

Detailed Description

Definition at line 134 of file catch_test_case_tracker.h.

Constructor & Destructor Documentation

◆ SectionTracker()

Catch::TestCaseTracking::SectionTracker::SectionTracker ( NameAndLocation const & nameAndLocation,
TrackerContext & ctx,
ITracker * parent )

Definition at line 176 of file catch_test_case_tracker.cpp.

177 : TrackerBase( nameAndLocation, ctx, parent )
178 {
179 if( parent ) {
180 while( !parent->isSectionTracker() )
181 parent = &parent->parent();
182
183 SectionTracker& parentSection = static_cast<SectionTracker&>( *parent );
184 addNextFilters( parentSection.m_filters );
185 }
186 }
void addNextFilters(std::vector< std::string > const &filters)
SectionTracker(NameAndLocation const &nameAndLocation, TrackerContext &ctx, ITracker *parent)
NameAndLocation const & nameAndLocation() const override
TrackerBase(NameAndLocation const &nameAndLocation, TrackerContext &ctx, ITracker *parent)
Here is the call graph for this function:

Member Function Documentation

◆ acquire()

SectionTracker & Catch::TestCaseTracking::SectionTracker::acquire ( TrackerContext & ctx,
NameAndLocation const & nameAndLocation )
static

Definition at line 201 of file catch_test_case_tracker.cpp.

201 {
202 std::shared_ptr<SectionTracker> section;
203
204 ITracker& currentTracker = ctx.currentTracker();
205 if( ITrackerPtr childTracker = currentTracker.findChild( nameAndLocation ) ) {
206 assert( childTracker );
207 assert( childTracker->isSectionTracker() );
208 section = std::static_pointer_cast<SectionTracker>( childTracker );
209 }
210 else {
211 section = std::make_shared<SectionTracker>( nameAndLocation, ctx, &currentTracker );
212 currentTracker.addChild( section );
213 }
214 if( !ctx.completedCycle() )
215 section->tryOpen();
216 return *section;
217 }
std::shared_ptr< ITracker > ITrackerPtr
Here is the call graph for this function:
Here is the caller graph for this function:

◆ addInitialFilters()

void Catch::TestCaseTracking::SectionTracker::addInitialFilters ( std::vector< std::string > const & filters)

Definition at line 224 of file catch_test_case_tracker.cpp.

224 {
225 if( !filters.empty() ) {
226 m_filters.push_back(""); // Root - should never be consulted
227 m_filters.push_back(""); // Test Case - not a section filter
228 m_filters.insert( m_filters.end(), filters.begin(), filters.end() );
229 }
230 }

◆ addNextFilters()

void Catch::TestCaseTracking::SectionTracker::addNextFilters ( std::vector< std::string > const & filters)

Definition at line 231 of file catch_test_case_tracker.cpp.

231 {
232 if( filters.size() > 1 )
233 m_filters.insert( m_filters.end(), ++filters.begin(), filters.end() );
234 }
Here is the caller graph for this function:

◆ isComplete()

bool Catch::TestCaseTracking::SectionTracker::isComplete ( ) const
overridevirtual

Implements Catch::TestCaseTracking::ITracker.

Definition at line 188 of file catch_test_case_tracker.cpp.

188 {
189 bool complete = true;
190
191 if ((m_filters.empty() || m_filters[0] == "") ||
192 std::find(m_filters.begin(), m_filters.end(),
193 m_nameAndLocation.name) != m_filters.end())
194 complete = TrackerBase::isComplete();
195 return complete;
196
197 }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ isSectionTracker()

bool Catch::TestCaseTracking::SectionTracker::isSectionTracker ( ) const
overridevirtual

Implements Catch::TestCaseTracking::ITracker.

Definition at line 199 of file catch_test_case_tracker.cpp.

199{ return true; }

◆ tryOpen()

void Catch::TestCaseTracking::SectionTracker::tryOpen ( )

Definition at line 219 of file catch_test_case_tracker.cpp.

219 {
220 if( !isComplete() && (m_filters.empty() || m_filters[0].empty() || m_filters[0] == m_nameAndLocation.name ) )
221 open();
222 }
Here is the call graph for this function:

The documentation for this class was generated from the following files: