MCPcopy Create free account
hub / github.com/FidoProject/Fido / runCurrentTest

Method runCurrentTest

tests/catch.h:6066–6110  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

6064 private:
6065
6066 void runCurrentTest( std::string& redirectedCout, std::string& redirectedCerr ) {
6067 TestCaseInfo const& testCaseInfo = m_activeTestCase->getTestCaseInfo();
6068 SectionInfo testCaseSection( testCaseInfo.lineInfo, testCaseInfo.name, testCaseInfo.description );
6069 m_reporter->sectionStarting( testCaseSection );
6070 Counts prevAssertions = m_totals.assertions;
6071 double duration = 0;
6072 try {
6073 m_lastAssertionInfo = AssertionInfo( "TEST_CASE", testCaseInfo.lineInfo, "", ResultDisposition::Normal );
6074
6075 seedRng( *m_config );
6076
6077 Timer timer;
6078 timer.start();
6079 if( m_reporter->getPreferences().shouldRedirectStdOut ) {
6080 StreamRedirect coutRedir( Catch::cout(), redirectedCout );
6081 StreamRedirect cerrRedir( Catch::cerr(), redirectedCerr );
6082 invokeActiveTestCase();
6083 }
6084 else {
6085 invokeActiveTestCase();
6086 }
6087 duration = timer.getElapsedSeconds();
6088 }
6089 catch( TestFailureException& ) {
6090 // This just means the test was aborted due to failure
6091 }
6092 catch(...) {
6093 makeUnexpectedResultBuilder().useActiveException();
6094 }
6095 m_testCaseTracker->close();
6096 handleUnfinishedSections();
6097 m_messages.clear();
6098
6099 Counts assertions = m_totals.assertions - prevAssertions;
6100 bool missingAssertions = testForMissingAssertions( assertions );
6101
6102 if( testCaseInfo.okToFail() ) {
6103 std::swap( assertions.failedButOk, assertions.failed );
6104 m_totals.assertions.failed -= assertions.failedButOk;
6105 m_totals.assertions.failedButOk += assertions.failedButOk;
6106 }
6107
6108 SectionStats testCaseSectionStats( testCaseSection, assertions, duration, missingAssertions );
6109 m_reporter->sectionEnded( testCaseSectionStats );
6110 }
6111
6112 void invokeActiveTestCase() {
6113 FatalConditionHandler fatalConditionHandler; // Handle signals

Callers

nothing calls this directly

Calls 9

AssertionInfoClass · 0.85
seedRngFunction · 0.85
startMethod · 0.80
getElapsedSecondsMethod · 0.80
useActiveExceptionMethod · 0.80
okToFailMethod · 0.80
sectionStartingMethod · 0.45
getPreferencesMethod · 0.45
sectionEndedMethod · 0.45

Tested by

no test coverage detected