Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 09:54:07

0001 
0002 //              Copyright Catch2 Authors
0003 // Distributed under the Boost Software License, Version 1.0.
0004 //   (See accompanying file LICENSE.txt or copy at
0005 //        https://www.boost.org/LICENSE_1_0.txt)
0006 
0007 // SPDX-License-Identifier: BSL-1.0
0008 #ifndef CATCH_REPORTER_STREAMING_BASE_HPP_INCLUDED
0009 #define CATCH_REPORTER_STREAMING_BASE_HPP_INCLUDED
0010 
0011 #include <catch2/reporters/catch_reporter_common_base.hpp>
0012 #include <catch2/internal/catch_move_and_forward.hpp>
0013 
0014 #include <vector>
0015 
0016 namespace Catch {
0017 
0018     class StreamingReporterBase : public ReporterBase {
0019     public:
0020         // GCC5 compat: we cannot use inherited constructor, because it
0021         //              doesn't implement backport of P0136
0022         StreamingReporterBase(ReporterConfig&& _config):
0023             ReporterBase(CATCH_MOVE(_config))
0024         {}
0025         ~StreamingReporterBase() override;
0026 
0027         void benchmarkPreparing( StringRef ) override {}
0028         void benchmarkStarting( BenchmarkInfo const& ) override {}
0029         void benchmarkEnded( BenchmarkStats<> const& ) override {}
0030         void benchmarkFailed( StringRef ) override {}
0031 
0032         void fatalErrorEncountered( StringRef /*error*/ ) override {}
0033         void noMatchingTestCases( StringRef /*unmatchedSpec*/ ) override {}
0034         void reportInvalidTestSpec( StringRef /*invalidArgument*/ ) override {}
0035 
0036         void testRunStarting( TestRunInfo const& _testRunInfo ) override;
0037 
0038         void testCaseStarting(TestCaseInfo const& _testInfo) override  {
0039             currentTestCaseInfo = &_testInfo;
0040         }
0041         void testCasePartialStarting( TestCaseInfo const&, uint64_t ) override {}
0042         void sectionStarting(SectionInfo const& _sectionInfo) override {
0043             m_sectionStack.push_back(_sectionInfo);
0044         }
0045 
0046         void assertionStarting( AssertionInfo const& ) override {}
0047         void assertionEnded( AssertionStats const& ) override {}
0048 
0049         void sectionEnded(SectionStats const& /* _sectionStats */) override {
0050             m_sectionStack.pop_back();
0051         }
0052         void testCasePartialEnded( TestCaseStats const&, uint64_t ) override {}
0053         void testCaseEnded(TestCaseStats const& /* _testCaseStats */) override {
0054             currentTestCaseInfo = nullptr;
0055         }
0056         void testRunEnded( TestRunStats const& /* _testRunStats */ ) override;
0057 
0058         void skipTest(TestCaseInfo const&) override {
0059             // Don't do anything with this by default.
0060             // It can optionally be overridden in the derived class.
0061         }
0062 
0063     protected:
0064         TestRunInfo currentTestRunInfo{ "test run has not started yet"_sr };
0065         TestCaseInfo const* currentTestCaseInfo = nullptr;
0066 
0067         //! Stack of all _active_ sections in the _current_ test case
0068         std::vector<SectionInfo> m_sectionStack;
0069     };
0070 
0071 } // end namespace Catch
0072 
0073 #endif // CATCH_REPORTER_STREAMING_BASE_HPP_INCLUDED