catch_reporter_listening.h 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. /*
  2. * Created by Martin on 19/07/2017.
  3. *
  4. * Distributed under the Boost Software License, Version 1.0. (See accompanying
  5. * file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
  6. */
  7. #ifndef TWOBLUECUBES_CATCH_MULTI_REPORTER_H_INCLUDED
  8. #define TWOBLUECUBES_CATCH_MULTI_REPORTER_H_INCLUDED
  9. #include "../internal/catch_interfaces_reporter.h"
  10. namespace Catch {
  11. class ListeningReporter : public IStreamingReporter {
  12. using Reporters = std::vector<IStreamingReporterPtr>;
  13. Reporters m_listeners;
  14. IStreamingReporterPtr m_reporter = nullptr;
  15. ReporterPreferences m_preferences;
  16. public:
  17. ListeningReporter();
  18. void addListener( IStreamingReporterPtr&& listener );
  19. void addReporter( IStreamingReporterPtr&& reporter );
  20. public: // IStreamingReporter
  21. ReporterPreferences getPreferences() const override;
  22. void noMatchingTestCases( std::string const& spec ) override;
  23. void reportInvalidArguments(std::string const&arg) override;
  24. static std::set<Verbosity> getSupportedVerbosities();
  25. #if defined(CATCH_CONFIG_ENABLE_BENCHMARKING)
  26. void benchmarkPreparing(std::string const& name) override;
  27. void benchmarkStarting( BenchmarkInfo const& benchmarkInfo ) override;
  28. void benchmarkEnded( BenchmarkStats<> const& benchmarkStats ) override;
  29. void benchmarkFailed(std::string const&) override;
  30. #endif // CATCH_CONFIG_ENABLE_BENCHMARKING
  31. void testRunStarting( TestRunInfo const& testRunInfo ) override;
  32. void testGroupStarting( GroupInfo const& groupInfo ) override;
  33. void testCaseStarting( TestCaseInfo const& testInfo ) override;
  34. void sectionStarting( SectionInfo const& sectionInfo ) override;
  35. void assertionStarting( AssertionInfo const& assertionInfo ) override;
  36. // The return value indicates if the messages buffer should be cleared:
  37. bool assertionEnded( AssertionStats const& assertionStats ) override;
  38. void sectionEnded( SectionStats const& sectionStats ) override;
  39. void testCaseEnded( TestCaseStats const& testCaseStats ) override;
  40. void testGroupEnded( TestGroupStats const& testGroupStats ) override;
  41. void testRunEnded( TestRunStats const& testRunStats ) override;
  42. void skipTest( TestCaseInfo const& testInfo ) override;
  43. bool isMulti() const override;
  44. };
  45. } // end namespace Catch
  46. #endif // TWOBLUECUBES_CATCH_MULTI_REPORTER_H_INCLUDED