| 6244 | }; |
| 6245 | |
| 6246 | class IndexTracker : public TrackerBase { |
| 6247 | int m_size; |
| 6248 | int m_index; |
| 6249 | public: |
| 6250 | IndexTracker( NameAndLocation const& nameAndLocation, TrackerContext& ctx, ITracker* parent, int size ) |
| 6251 | : TrackerBase( nameAndLocation, ctx, parent ), |
| 6252 | m_size( size ), |
| 6253 | m_index( -1 ) |
| 6254 | {} |
| 6255 | virtual ~IndexTracker(); |
| 6256 | |
| 6257 | virtual bool isIndexTracker() const CATCH_OVERRIDE { return true; } |
| 6258 | |
| 6259 | static IndexTracker& acquire( TrackerContext& ctx, NameAndLocation const& nameAndLocation, int size ) { |
| 6260 | IndexTracker* tracker = CATCH_NULL; |
| 6261 | |
| 6262 | ITracker& currentTracker = ctx.currentTracker(); |
| 6263 | if( ITracker* childTracker = currentTracker.findChild( nameAndLocation ) ) { |
| 6264 | assert( childTracker ); |
| 6265 | assert( childTracker->isIndexTracker() ); |
| 6266 | tracker = static_cast<IndexTracker*>( childTracker ); |
| 6267 | } |
| 6268 | else { |
| 6269 | tracker = new IndexTracker( nameAndLocation, ctx, ¤tTracker, size ); |
| 6270 | currentTracker.addChild( tracker ); |
| 6271 | } |
| 6272 | |
| 6273 | if( !ctx.completedCycle() && !tracker->isComplete() ) { |
| 6274 | if( tracker->m_runState != ExecutingChildren && tracker->m_runState != NeedsAnotherRun ) |
| 6275 | tracker->moveNext(); |
| 6276 | tracker->open(); |
| 6277 | } |
| 6278 | |
| 6279 | return *tracker; |
| 6280 | } |
| 6281 | |
| 6282 | int index() const { return m_index; } |
| 6283 | |
| 6284 | void moveNext() { |
| 6285 | m_index++; |
| 6286 | m_children.clear(); |
| 6287 | } |
| 6288 | |
| 6289 | virtual void close() CATCH_OVERRIDE { |
| 6290 | TrackerBase::close(); |
| 6291 | if( m_runState == CompletedSuccessfully && m_index < m_size-1 ) |
| 6292 | m_runState = Executing; |
| 6293 | } |
| 6294 | }; |
| 6295 | |
| 6296 | inline ITracker& TrackerContext::startRun() { |
| 6297 | m_rootTracker = new SectionTracker( NameAndLocation( "{root}", CATCH_INTERNAL_LINEINFO ), *this, CATCH_NULL ); |
nothing calls this directly
no test coverage detected