MCPcopy Create free account
hub / github.com/catchorg/Catch2 / createGeneratorTracker

Method createGeneratorTracker

extras/catch_amalgamated.cpp:6358–6391  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

6356 }
6357
6358 IGeneratorTracker* RunContext::createGeneratorTracker(
6359 StringRef generatorName,
6360 SourceLineInfo lineInfo,
6361 Generators::GeneratorBasePtr&& generator ) {
6362
6363 // TBD: Do we want to avoid the warning if the generator is filtered?
6364 if ( m_config->warnAboutInfiniteGenerators() &&
6365 !generator->isFinite() ) {
6366 // We want the semantics of `FAIL()`, but we inline it
6367 // to avoid issues with conditionally prefixed macros
6368 INTERNAL_CATCH_MSG( "FAIL",
6369 Catch::ResultWas::ExplicitFailure,
6370 Catch::ResultDisposition::Normal,
6371 "GENERATE() would run infinitely" );
6372 }
6373
6374 auto nameAndLoc = TestCaseTracking::NameAndLocation( static_cast<std::string>( generatorName ), lineInfo );
6375 auto& currentTracker = m_trackerContext.currentTracker();
6376 assert(
6377 currentTracker.nameAndLocation() != nameAndLoc &&
6378 "Trying to create tracker for a generator that already has one" );
6379
6380 auto newTracker =
6381 Catch::Detail::make_unique<Generators::GeneratorTracker>(
6382 CATCH_MOVE( nameAndLoc ),
6383 m_trackerContext,
6384 &currentTracker,
6385 CATCH_MOVE( generator ) );
6386 auto ret = newTracker.get();
6387 currentTracker.addChild( CATCH_MOVE( newTracker ) );
6388
6389 ret->open();
6390 return ret;
6391 }
6392
6393 bool RunContext::testForMissingAssertions(Counts& assertions) {
6394 if (assertions.total() != 0)

Callers 1

createGeneratorTrackerFunction · 0.45

Calls 6

NameAndLocationClass · 0.70
isFiniteMethod · 0.45
getMethod · 0.45
addChildMethod · 0.45
openMethod · 0.45

Tested by

no test coverage detected