Wire Sysio Wire Sysion 1.0.0
Loading...
Searching...
No Matches
Catch::CumulativeReporterBase< DerivedT > Struct Template Referenceabstract

#include <catch_reporter_bases.hpp>

Inheritance diagram for Catch::CumulativeReporterBase< DerivedT >:
Collaboration diagram for Catch::CumulativeReporterBase< DerivedT >:

Classes

struct  BySectionInfo
 
struct  Node
 
struct  SectionNode
 

Public Types

using TestCaseNode = Node<TestCaseStats, SectionNode>
 
using TestGroupNode = Node<TestGroupStats, TestCaseNode>
 
using TestRunNode = Node<TestRunStats, TestGroupNode>
 

Public Member Functions

 CumulativeReporterBase (ReporterConfig const &_config)
 
 ~CumulativeReporterBase () override=default
 
ReporterPreferences getPreferences () const override
 
void testRunStarting (TestRunInfo const &) override
 
void testGroupStarting (GroupInfo const &) override
 
void testCaseStarting (TestCaseInfo const &) override
 
void sectionStarting (SectionInfo const &sectionInfo) override
 
void assertionStarting (AssertionInfo const &) override
 
bool assertionEnded (AssertionStats const &assertionStats) override
 
void sectionEnded (SectionStats const &sectionStats) override
 
void testCaseEnded (TestCaseStats const &testCaseStats) override
 
void testGroupEnded (TestGroupStats const &testGroupStats) override
 
void testRunEnded (TestRunStats const &testRunStats) override
 
virtual void testRunEndedCumulative ()=0
 
void skipTest (TestCaseInfo const &) override
 
- Public Member Functions inherited from Catch::IStreamingReporter
virtual ~IStreamingReporter ()=default
 
virtual void noMatchingTestCases (std::string const &spec)=0
 
virtual void benchmarkStarting (BenchmarkInfo const &)
 
virtual void benchmarkEnded (BenchmarkStats const &)
 
virtual void fatalErrorEncountered (StringRef name)
 
virtual bool isMulti () const
 

Static Public Member Functions

static std::set< VerbositygetSupportedVerbosities ()
 

Public Attributes

IConfigPtr m_config
 
std::ostream & stream
 
std::vector< AssertionStatsm_assertions
 
std::vector< std::vector< std::shared_ptr< SectionNode > > > m_sections
 
std::vector< std::shared_ptr< TestCaseNode > > m_testCases
 
std::vector< std::shared_ptr< TestGroupNode > > m_testGroups
 
std::vector< std::shared_ptr< TestRunNode > > m_testRuns
 
std::shared_ptr< SectionNodem_rootSection
 
std::shared_ptr< SectionNodem_deepestSection
 
std::vector< std::shared_ptr< SectionNode > > m_sectionStack
 
ReporterPreferences m_reporterPrefs
 

Detailed Description

template<typename DerivedT>
struct Catch::CumulativeReporterBase< DerivedT >

Definition at line 101 of file catch_reporter_bases.hpp.

Member Typedef Documentation

◆ TestCaseNode

template<typename DerivedT >
using Catch::CumulativeReporterBase< DerivedT >::TestCaseNode = Node<TestCaseStats, SectionNode>

Definition at line 145 of file catch_reporter_bases.hpp.

◆ TestGroupNode

template<typename DerivedT >
using Catch::CumulativeReporterBase< DerivedT >::TestGroupNode = Node<TestGroupStats, TestCaseNode>

Definition at line 146 of file catch_reporter_bases.hpp.

◆ TestRunNode

template<typename DerivedT >
using Catch::CumulativeReporterBase< DerivedT >::TestRunNode = Node<TestRunStats, TestGroupNode>

Definition at line 147 of file catch_reporter_bases.hpp.

Constructor & Destructor Documentation

◆ CumulativeReporterBase()

template<typename DerivedT >
Catch::CumulativeReporterBase< DerivedT >::CumulativeReporterBase ( ReporterConfig const & _config)
inline

Definition at line 149 of file catch_reporter_bases.hpp.

150 : m_config( _config.fullConfig() ),
151 stream( _config.stream() )
152 {
154 if( !DerivedT::getSupportedVerbosities().count( m_config->verbosity() ) )
155 CATCH_ERROR( "Verbosity level not supported by this reporter" );
156 }
#define CATCH_ERROR(msg)
int * count

◆ ~CumulativeReporterBase()

template<typename DerivedT >
Catch::CumulativeReporterBase< DerivedT >::~CumulativeReporterBase ( )
overridedefault

Member Function Documentation

◆ assertionEnded()

template<typename DerivedT >
bool Catch::CumulativeReporterBase< DerivedT >::assertionEnded ( AssertionStats const & assertionStats)
inlineoverridevirtual

Implements Catch::IStreamingReporter.

Reimplemented in Catch::JunitReporter.

Definition at line 199 of file catch_reporter_bases.hpp.

199 {
200 assert(!m_sectionStack.empty());
201 // AssertionResult holds a pointer to a temporary DecomposedExpression,
202 // which getExpandedExpression() calls to build the expression string.
203 // Our section stack copy of the assertionResult will likely outlive the
204 // temporary, so it must be expanded or discarded now to avoid calling
205 // a destroyed object later.
206 prepareExpandedExpression(const_cast<AssertionResult&>( assertionStats.assertionResult ) );
207 SectionNode& sectionNode = *m_sectionStack.back();
208 sectionNode.assertions.push_back(assertionStats);
209 return true;
210 }
void prepareExpandedExpression(AssertionResult &result)
std::vector< std::shared_ptr< SectionNode > > m_sectionStack
Here is the call graph for this function:
Here is the caller graph for this function:

◆ assertionStarting()

template<typename DerivedT >
void Catch::CumulativeReporterBase< DerivedT >::assertionStarting ( AssertionInfo const & )
inlineoverridevirtual

Implements Catch::IStreamingReporter.

Definition at line 197 of file catch_reporter_bases.hpp.

197{}

◆ getPreferences()

template<typename DerivedT >
ReporterPreferences Catch::CumulativeReporterBase< DerivedT >::getPreferences ( ) const
inlineoverridevirtual

Implements Catch::IStreamingReporter.

Definition at line 159 of file catch_reporter_bases.hpp.

159 {
160 return m_reporterPrefs;
161 }

◆ getSupportedVerbosities()

template<typename DerivedT >
static std::set< Verbosity > Catch::CumulativeReporterBase< DerivedT >::getSupportedVerbosities ( )
inlinestatic

Definition at line 163 of file catch_reporter_bases.hpp.

163 {
164 return { Verbosity::Normal };
165 }

◆ sectionEnded()

template<typename DerivedT >
void Catch::CumulativeReporterBase< DerivedT >::sectionEnded ( SectionStats const & sectionStats)
inlineoverridevirtual

Implements Catch::IStreamingReporter.

Definition at line 211 of file catch_reporter_bases.hpp.

211 {
212 assert(!m_sectionStack.empty());
213 SectionNode& node = *m_sectionStack.back();
214 node.stats = sectionStats;
215 m_sectionStack.pop_back();
216 }

◆ sectionStarting()

template<typename DerivedT >
void Catch::CumulativeReporterBase< DerivedT >::sectionStarting ( SectionInfo const & sectionInfo)
inlineoverridevirtual

Implements Catch::IStreamingReporter.

Definition at line 172 of file catch_reporter_bases.hpp.

172 {
173 SectionStats incompleteStats( sectionInfo, Counts(), 0, false );
174 std::shared_ptr<SectionNode> node;
175 if( m_sectionStack.empty() ) {
176 if( !m_rootSection )
177 m_rootSection = std::make_shared<SectionNode>( incompleteStats );
178 node = m_rootSection;
179 }
180 else {
181 SectionNode& parentNode = *m_sectionStack.back();
182 auto it =
183 std::find_if( parentNode.childSections.begin(),
184 parentNode.childSections.end(),
185 BySectionInfo( sectionInfo ) );
186 if( it == parentNode.childSections.end() ) {
187 node = std::make_shared<SectionNode>( incompleteStats );
188 parentNode.childSections.push_back( node );
189 }
190 else
191 node = *it;
192 }
193 m_sectionStack.push_back( node );
194 m_deepestSection = std::move(node);
195 }
std::shared_ptr< SectionNode > m_deepestSection
std::shared_ptr< SectionNode > m_rootSection

◆ skipTest()

template<typename DerivedT >
void Catch::CumulativeReporterBase< DerivedT >::skipTest ( TestCaseInfo const & )
inlineoverridevirtual

Implements Catch::IStreamingReporter.

Definition at line 241 of file catch_reporter_bases.hpp.

241{}

◆ testCaseEnded()

template<typename DerivedT >
void Catch::CumulativeReporterBase< DerivedT >::testCaseEnded ( TestCaseStats const & testCaseStats)
inlineoverridevirtual

Implements Catch::IStreamingReporter.

Reimplemented in Catch::JunitReporter.

Definition at line 217 of file catch_reporter_bases.hpp.

217 {
218 auto node = std::make_shared<TestCaseNode>(testCaseStats);
219 assert(m_sectionStack.size() == 0);
220 node->children.push_back(m_rootSection);
221 m_testCases.push_back(node);
222 m_rootSection.reset();
223
224 assert(m_deepestSection);
225 m_deepestSection->stdOut = testCaseStats.stdOut;
226 m_deepestSection->stdErr = testCaseStats.stdErr;
227 }
std::vector< std::shared_ptr< TestCaseNode > > m_testCases
Here is the caller graph for this function:

◆ testCaseStarting()

template<typename DerivedT >
void Catch::CumulativeReporterBase< DerivedT >::testCaseStarting ( TestCaseInfo const & )
inlineoverridevirtual

Implements Catch::IStreamingReporter.

Reimplemented in Catch::JunitReporter.

Definition at line 170 of file catch_reporter_bases.hpp.

170{}

◆ testGroupEnded()

template<typename DerivedT >
void Catch::CumulativeReporterBase< DerivedT >::testGroupEnded ( TestGroupStats const & testGroupStats)
inlineoverridevirtual

Implements Catch::IStreamingReporter.

Reimplemented in Catch::JunitReporter.

Definition at line 228 of file catch_reporter_bases.hpp.

228 {
229 auto node = std::make_shared<TestGroupNode>(testGroupStats);
230 node->children.swap(m_testCases);
231 m_testGroups.push_back(node);
232 }
std::vector< std::shared_ptr< TestGroupNode > > m_testGroups
Here is the caller graph for this function:

◆ testGroupStarting()

template<typename DerivedT >
void Catch::CumulativeReporterBase< DerivedT >::testGroupStarting ( GroupInfo const & )
inlineoverridevirtual

Implements Catch::IStreamingReporter.

Reimplemented in Catch::JunitReporter.

Definition at line 168 of file catch_reporter_bases.hpp.

168{}
Here is the caller graph for this function:

◆ testRunEnded()

template<typename DerivedT >
void Catch::CumulativeReporterBase< DerivedT >::testRunEnded ( TestRunStats const & testRunStats)
inlineoverridevirtual

Implements Catch::IStreamingReporter.

Definition at line 233 of file catch_reporter_bases.hpp.

233 {
234 auto node = std::make_shared<TestRunNode>(testRunStats);
235 node->children.swap(m_testGroups);
236 m_testRuns.push_back(node);
238 }
std::vector< std::shared_ptr< TestRunNode > > m_testRuns
virtual void testRunEndedCumulative()=0
Here is the call graph for this function:

◆ testRunEndedCumulative()

template<typename DerivedT >
virtual void Catch::CumulativeReporterBase< DerivedT >::testRunEndedCumulative ( )
pure virtual

Implemented in Catch::JunitReporter.

Here is the caller graph for this function:

◆ testRunStarting()

template<typename DerivedT >
void Catch::CumulativeReporterBase< DerivedT >::testRunStarting ( TestRunInfo const & )
inlineoverridevirtual

Implements Catch::IStreamingReporter.

Reimplemented in Catch::JunitReporter.

Definition at line 167 of file catch_reporter_bases.hpp.

167{}
Here is the caller graph for this function:

Member Data Documentation

◆ m_assertions

template<typename DerivedT >
std::vector<AssertionStats> Catch::CumulativeReporterBase< DerivedT >::m_assertions

Definition at line 245 of file catch_reporter_bases.hpp.

◆ m_config

template<typename DerivedT >
IConfigPtr Catch::CumulativeReporterBase< DerivedT >::m_config

Definition at line 243 of file catch_reporter_bases.hpp.

◆ m_deepestSection

template<typename DerivedT >
std::shared_ptr<SectionNode> Catch::CumulativeReporterBase< DerivedT >::m_deepestSection

Definition at line 253 of file catch_reporter_bases.hpp.

◆ m_reporterPrefs

template<typename DerivedT >
ReporterPreferences Catch::CumulativeReporterBase< DerivedT >::m_reporterPrefs

Definition at line 255 of file catch_reporter_bases.hpp.

◆ m_rootSection

template<typename DerivedT >
std::shared_ptr<SectionNode> Catch::CumulativeReporterBase< DerivedT >::m_rootSection

Definition at line 252 of file catch_reporter_bases.hpp.

◆ m_sections

template<typename DerivedT >
std::vector<std::vector<std::shared_ptr<SectionNode> > > Catch::CumulativeReporterBase< DerivedT >::m_sections

Definition at line 246 of file catch_reporter_bases.hpp.

◆ m_sectionStack

template<typename DerivedT >
std::vector<std::shared_ptr<SectionNode> > Catch::CumulativeReporterBase< DerivedT >::m_sectionStack

Definition at line 254 of file catch_reporter_bases.hpp.

◆ m_testCases

template<typename DerivedT >
std::vector<std::shared_ptr<TestCaseNode> > Catch::CumulativeReporterBase< DerivedT >::m_testCases

Definition at line 247 of file catch_reporter_bases.hpp.

◆ m_testGroups

template<typename DerivedT >
std::vector<std::shared_ptr<TestGroupNode> > Catch::CumulativeReporterBase< DerivedT >::m_testGroups

Definition at line 248 of file catch_reporter_bases.hpp.

◆ m_testRuns

template<typename DerivedT >
std::vector<std::shared_ptr<TestRunNode> > Catch::CumulativeReporterBase< DerivedT >::m_testRuns

Definition at line 250 of file catch_reporter_bases.hpp.

◆ stream

template<typename DerivedT >
std::ostream& Catch::CumulativeReporterBase< DerivedT >::stream

Definition at line 244 of file catch_reporter_bases.hpp.


The documentation for this struct was generated from the following file: