2015-08-05 20:02:17 +02:00
|
|
|
/*
|
|
|
|
* Created by Phil on 5/08/2015.
|
|
|
|
* Copyright 2015 Two Blue Cubes Ltd. All rights reserved.
|
|
|
|
*
|
|
|
|
* Distributed under the Boost Software License, Version 1.0. (See accompanying
|
|
|
|
* file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
|
|
|
*/
|
|
|
|
|
2017-07-19 10:13:47 +02:00
|
|
|
#include "catch_reporter_multi.h"
|
|
|
|
|
2015-08-05 20:02:17 +02:00
|
|
|
namespace Catch {
|
|
|
|
|
2017-07-19 10:13:47 +02:00
|
|
|
void MultipleReporters::add( IStreamingReporterPtr&& reporter ) {
|
2017-04-29 20:38:34 +02:00
|
|
|
m_reporters.push_back( std::move( reporter ) );
|
2015-08-05 20:02:17 +02:00
|
|
|
}
|
2015-11-04 19:01:28 +01:00
|
|
|
|
2017-07-19 10:13:47 +02:00
|
|
|
ReporterPreferences MultipleReporters::getPreferences() const {
|
2015-08-05 20:02:17 +02:00
|
|
|
return m_reporters[0]->getPreferences();
|
|
|
|
}
|
2015-11-04 19:01:28 +01:00
|
|
|
|
2017-07-19 23:20:30 +02:00
|
|
|
std::set<Verbosity> MultipleReporters::getSupportedVerbosities() {
|
2017-07-19 23:15:54 +02:00
|
|
|
return { };
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2017-07-19 10:13:47 +02:00
|
|
|
void MultipleReporters::noMatchingTestCases( std::string const& spec ) {
|
2017-04-25 12:06:52 +02:00
|
|
|
for( auto const& reporter : m_reporters )
|
|
|
|
reporter->noMatchingTestCases( spec );
|
2015-08-05 20:02:17 +02:00
|
|
|
}
|
|
|
|
|
2015-11-04 19:01:28 +01:00
|
|
|
|
2017-07-19 10:13:47 +02:00
|
|
|
void MultipleReporters::testRunStarting( TestRunInfo const& testRunInfo ) {
|
2017-04-25 12:06:52 +02:00
|
|
|
for( auto const& reporter : m_reporters )
|
|
|
|
reporter->testRunStarting( testRunInfo );
|
2015-08-05 20:02:17 +02:00
|
|
|
}
|
|
|
|
|
2017-07-19 10:13:47 +02:00
|
|
|
void MultipleReporters::testGroupStarting( GroupInfo const& groupInfo ) {
|
2017-04-25 12:06:52 +02:00
|
|
|
for( auto const& reporter : m_reporters )
|
|
|
|
reporter->testGroupStarting( groupInfo );
|
2015-08-05 20:02:17 +02:00
|
|
|
}
|
|
|
|
|
2015-11-04 19:01:28 +01:00
|
|
|
|
2017-07-19 10:13:47 +02:00
|
|
|
void MultipleReporters::testCaseStarting( TestCaseInfo const& testInfo ) {
|
2017-04-25 12:06:52 +02:00
|
|
|
for( auto const& reporter : m_reporters )
|
|
|
|
reporter->testCaseStarting( testInfo );
|
2015-08-05 20:02:17 +02:00
|
|
|
}
|
|
|
|
|
2017-07-19 10:13:47 +02:00
|
|
|
void MultipleReporters::sectionStarting( SectionInfo const& sectionInfo ) {
|
2017-04-25 12:06:52 +02:00
|
|
|
for( auto const& reporter : m_reporters )
|
|
|
|
reporter->sectionStarting( sectionInfo );
|
2015-08-05 20:02:17 +02:00
|
|
|
}
|
|
|
|
|
2017-07-19 10:13:47 +02:00
|
|
|
void MultipleReporters::assertionStarting( AssertionInfo const& assertionInfo ) {
|
2017-04-25 12:06:52 +02:00
|
|
|
for( auto const& reporter : m_reporters )
|
|
|
|
reporter->assertionStarting( assertionInfo );
|
2015-08-05 20:02:17 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
// The return value indicates if the messages buffer should be cleared:
|
2017-07-19 10:13:47 +02:00
|
|
|
bool MultipleReporters::assertionEnded( AssertionStats const& assertionStats ) {
|
2015-08-05 20:02:17 +02:00
|
|
|
bool clearBuffer = false;
|
2017-04-25 12:06:52 +02:00
|
|
|
for( auto const& reporter : m_reporters )
|
|
|
|
clearBuffer |= reporter->assertionEnded( assertionStats );
|
2015-08-05 20:02:17 +02:00
|
|
|
return clearBuffer;
|
|
|
|
}
|
|
|
|
|
2017-07-19 10:13:47 +02:00
|
|
|
void MultipleReporters::sectionEnded( SectionStats const& sectionStats ) {
|
2017-04-25 12:06:52 +02:00
|
|
|
for( auto const& reporter : m_reporters )
|
|
|
|
reporter->sectionEnded( sectionStats );
|
2015-08-05 20:02:17 +02:00
|
|
|
}
|
|
|
|
|
2017-07-19 10:13:47 +02:00
|
|
|
void MultipleReporters::testCaseEnded( TestCaseStats const& testCaseStats ) {
|
2017-04-25 12:06:52 +02:00
|
|
|
for( auto const& reporter : m_reporters )
|
|
|
|
reporter->testCaseEnded( testCaseStats );
|
2015-08-05 20:02:17 +02:00
|
|
|
}
|
|
|
|
|
2017-07-19 10:13:47 +02:00
|
|
|
void MultipleReporters::testGroupEnded( TestGroupStats const& testGroupStats ) {
|
2017-04-25 12:06:52 +02:00
|
|
|
for( auto const& reporter : m_reporters )
|
|
|
|
reporter->testGroupEnded( testGroupStats );
|
2015-08-05 20:02:17 +02:00
|
|
|
}
|
|
|
|
|
2017-07-19 10:13:47 +02:00
|
|
|
void MultipleReporters::testRunEnded( TestRunStats const& testRunStats ) {
|
2017-04-25 12:06:52 +02:00
|
|
|
for( auto const& reporter : m_reporters )
|
|
|
|
reporter->testRunEnded( testRunStats );
|
2015-08-05 20:02:17 +02:00
|
|
|
}
|
|
|
|
|
2015-11-04 19:01:28 +01:00
|
|
|
|
2017-07-19 10:13:47 +02:00
|
|
|
void MultipleReporters::skipTest( TestCaseInfo const& testInfo ) {
|
2017-04-25 12:06:52 +02:00
|
|
|
for( auto const& reporter : m_reporters )
|
|
|
|
reporter->skipTest( testInfo );
|
2015-08-05 20:02:17 +02:00
|
|
|
}
|
2017-01-26 23:13:12 +01:00
|
|
|
|
2017-07-19 10:13:47 +02:00
|
|
|
bool MultipleReporters::isMulti() const {
|
2017-04-29 20:38:34 +02:00
|
|
|
return true;
|
2016-04-28 08:54:57 +02:00
|
|
|
}
|
2017-01-26 23:13:12 +01:00
|
|
|
|
2015-08-05 20:02:17 +02:00
|
|
|
} // end namespace Catch
|