File Coverage

/usr/local/lib/perl5/site_perl/5.26.1/x86_64-linux/XS/libcatch.x/i/catch2/reporters/catch_reporter_streaming_base.hpp
Criterion Covered Total %
statement 2 9 22.2
branch 1 2 50.0
condition n/a
subroutine n/a
pod n/a
total 3 11 27.2


line stmt bran cond sub pod time code
1              
2             // Copyright Catch2 Authors
3             // Distributed under the Boost Software License, Version 1.0.
4             // (See accompanying file LICENSE_1_0.txt or copy at
5             // https://www.boost.org/LICENSE_1_0.txt)
6              
7             // SPDX-License-Identifier: BSL-1.0
8             #ifndef CATCH_REPORTER_STREAMING_BASE_HPP_INCLUDED
9             #define CATCH_REPORTER_STREAMING_BASE_HPP_INCLUDED
10              
11             #include
12              
13             #include
14             #include
15             #include
16              
17             namespace Catch {
18              
19             class StreamingReporterBase : public IStreamingReporter {
20             public:
21 5           StreamingReporterBase( ReporterConfig const& _config ):
22             IStreamingReporter( _config.fullConfig() ),
23 5 50         m_stream( _config.stream() ) {}
24              
25              
26             ~StreamingReporterBase() override;
27              
28 0           void benchmarkPreparing( StringRef ) override {}
29 0           void benchmarkStarting( BenchmarkInfo const& ) override {}
30             void benchmarkEnded( BenchmarkStats<> const& ) override {}
31 0           void benchmarkFailed( StringRef ) override {}
32              
33             void fatalErrorEncountered( StringRef /*error*/ ) override {}
34             void noMatchingTestCases( StringRef /*unmatchedSpec*/ ) override {}
35             void reportInvalidArguments( StringRef /*invalidArgument*/ ) override {}
36              
37             void testRunStarting( TestRunInfo const& _testRunInfo ) override;
38              
39             void testCaseStarting(TestCaseInfo const& _testInfo) override {
40             currentTestCaseInfo = &_testInfo;
41             }
42 0           void testCasePartialStarting( TestCaseInfo const&, uint64_t ) override {}
43             void sectionStarting(SectionInfo const& _sectionInfo) override {
44             m_sectionStack.push_back(_sectionInfo);
45             }
46              
47             void assertionStarting( AssertionInfo const& ) override {}
48             void assertionEnded( AssertionStats const& ) override {}
49              
50             void sectionEnded(SectionStats const& /* _sectionStats */) override {
51             m_sectionStack.pop_back();
52             }
53 0           void testCasePartialEnded( TestCaseStats const&, uint64_t ) override {}
54             void testCaseEnded(TestCaseStats const& /* _testCaseStats */) override {
55             currentTestCaseInfo = nullptr;
56             }
57             void testRunEnded( TestRunStats const& /* _testRunStats */ ) override;
58              
59 0           void skipTest(TestCaseInfo const&) override {
60             // Don't do anything with this by default.
61             // It can optionally be overridden in the derived class.
62 0           }
63              
64             void listReporters( std::vector const& descriptions ) override;
65             void listTests( std::vector const& tests ) override;
66             void listTags( std::vector const& tags ) override;
67              
68             protected:
69             //! Stream that the reporter output should be written to
70             std::ostream& m_stream;
71              
72             TestRunInfo currentTestRunInfo{ "test run has not started yet"_sr };
73             TestCaseInfo const* currentTestCaseInfo = nullptr;
74              
75             //! Stack of all _active_ sections in the _current_ test case
76             std::vector m_sectionStack;
77             };
78              
79             } // end namespace Catch
80              
81             #endif // CATCH_REPORTER_STREAMING_BASE_HPP_INCLUDED