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_MULTI_HPP_INCLUDED
0009 #define CATCH_REPORTER_MULTI_HPP_INCLUDED
0010 
0011 #include <catch2/interfaces/catch_interfaces_reporter.hpp>
0012 
0013 namespace Catch {
0014 
0015     class MultiReporter final : public IEventListener {
0016         /*
0017          * Stores all added reporters and listeners
0018          *
0019          * All Listeners are stored before all reporters, and individual
0020          * listeners/reporters are stored in order of insertion.
0021          */
0022         std::vector<IEventListenerPtr> m_reporterLikes;
0023         bool m_haveNoncapturingReporters = false;
0024 
0025         // Keep track of how many listeners we have already inserted,
0026         // so that we can insert them into the main vector at the right place
0027         size_t m_insertedListeners = 0;
0028 
0029         void updatePreferences(IEventListener const& reporterish);
0030 
0031     public:
0032         using IEventListener::IEventListener;
0033 
0034         void addListener( IEventListenerPtr&& listener );
0035         void addReporter( IEventListenerPtr&& reporter );
0036 
0037     public: // IEventListener
0038 
0039         void noMatchingTestCases( StringRef unmatchedSpec ) override;
0040         void fatalErrorEncountered( StringRef error ) override;
0041         void reportInvalidTestSpec( StringRef arg ) override;
0042 
0043         void benchmarkPreparing( StringRef name ) override;
0044         void benchmarkStarting( BenchmarkInfo const& benchmarkInfo ) override;
0045         void benchmarkEnded( BenchmarkStats<> const& benchmarkStats ) override;
0046         void benchmarkFailed( StringRef error ) override;
0047 
0048         void testRunStarting( TestRunInfo const& testRunInfo ) override;
0049         void testCaseStarting( TestCaseInfo const& testInfo ) override;
0050         void testCasePartialStarting(TestCaseInfo const& testInfo, uint64_t partNumber) override;
0051         void sectionStarting( SectionInfo const& sectionInfo ) override;
0052         void assertionStarting( AssertionInfo const& assertionInfo ) override;
0053 
0054         void assertionEnded( AssertionStats const& assertionStats ) override;
0055         void sectionEnded( SectionStats const& sectionStats ) override;
0056         void testCasePartialEnded(TestCaseStats const& testInfo, uint64_t partNumber) override;
0057         void testCaseEnded( TestCaseStats const& testCaseStats ) override;
0058         void testRunEnded( TestRunStats const& testRunStats ) override;
0059 
0060         void skipTest( TestCaseInfo const& testInfo ) override;
0061 
0062         void listReporters(std::vector<ReporterDescription> const& descriptions) override;
0063         void listListeners(std::vector<ListenerDescription> const& descriptions) override;
0064         void listTests(std::vector<TestCaseHandle> const& tests) override;
0065         void listTags(std::vector<TagInfo> const& tags) override;
0066 
0067 
0068     };
0069 
0070 } // end namespace Catch
0071 
0072 #endif // CATCH_REPORTER_MULTI_HPP_INCLUDED