catch_interfaces_reporter.cpp 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114
  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. #include "catch_interfaces_reporter.h"
  8. #include "../reporters/catch_reporter_listening.h"
  9. namespace Catch {
  10. ReporterConfig::ReporterConfig( IConfigPtr const& _fullConfig )
  11. : m_stream( &_fullConfig->stream() ), m_fullConfig( _fullConfig ) {}
  12. ReporterConfig::ReporterConfig( IConfigPtr const& _fullConfig, std::ostream& _stream )
  13. : m_stream( &_stream ), m_fullConfig( _fullConfig ) {}
  14. std::ostream& ReporterConfig::stream() const { return *m_stream; }
  15. IConfigPtr ReporterConfig::fullConfig() const { return m_fullConfig; }
  16. TestRunInfo::TestRunInfo( std::string const& _name ) : name( _name ) {}
  17. GroupInfo::GroupInfo( std::string const& _name,
  18. std::size_t _groupIndex,
  19. std::size_t _groupsCount )
  20. : name( _name ),
  21. groupIndex( _groupIndex ),
  22. groupsCounts( _groupsCount )
  23. {}
  24. AssertionStats::AssertionStats( AssertionResult const& _assertionResult,
  25. std::vector<MessageInfo> const& _infoMessages,
  26. Totals const& _totals )
  27. : assertionResult( _assertionResult ),
  28. infoMessages( _infoMessages ),
  29. totals( _totals )
  30. {
  31. assertionResult.m_resultData.lazyExpression.m_transientExpression = _assertionResult.m_resultData.lazyExpression.m_transientExpression;
  32. if( assertionResult.hasMessage() ) {
  33. // Copy message into messages list.
  34. // !TBD This should have been done earlier, somewhere
  35. MessageBuilder builder( assertionResult.getTestMacroName(), assertionResult.getSourceInfo(), assertionResult.getResultType() );
  36. builder << assertionResult.getMessage();
  37. builder.m_info.message = builder.m_stream.str();
  38. infoMessages.push_back( builder.m_info );
  39. }
  40. }
  41. AssertionStats::~AssertionStats() = default;
  42. SectionStats::SectionStats( SectionInfo const& _sectionInfo,
  43. Counts const& _assertions,
  44. double _durationInSeconds,
  45. bool _missingAssertions )
  46. : sectionInfo( _sectionInfo ),
  47. assertions( _assertions ),
  48. durationInSeconds( _durationInSeconds ),
  49. missingAssertions( _missingAssertions )
  50. {}
  51. SectionStats::~SectionStats() = default;
  52. TestCaseStats::TestCaseStats( TestCaseInfo const& _testInfo,
  53. Totals const& _totals,
  54. std::string const& _stdOut,
  55. std::string const& _stdErr,
  56. bool _aborting )
  57. : testInfo( _testInfo ),
  58. totals( _totals ),
  59. stdOut( _stdOut ),
  60. stdErr( _stdErr ),
  61. aborting( _aborting )
  62. {}
  63. TestCaseStats::~TestCaseStats() = default;
  64. TestGroupStats::TestGroupStats( GroupInfo const& _groupInfo,
  65. Totals const& _totals,
  66. bool _aborting )
  67. : groupInfo( _groupInfo ),
  68. totals( _totals ),
  69. aborting( _aborting )
  70. {}
  71. TestGroupStats::TestGroupStats( GroupInfo const& _groupInfo )
  72. : groupInfo( _groupInfo ),
  73. aborting( false )
  74. {}
  75. TestGroupStats::~TestGroupStats() = default;
  76. TestRunStats::TestRunStats( TestRunInfo const& _runInfo,
  77. Totals const& _totals,
  78. bool _aborting )
  79. : runInfo( _runInfo ),
  80. totals( _totals ),
  81. aborting( _aborting )
  82. {}
  83. TestRunStats::~TestRunStats() = default;
  84. void IStreamingReporter::fatalErrorEncountered( StringRef ) {}
  85. bool IStreamingReporter::isMulti() const { return false; }
  86. IReporterFactory::~IReporterFactory() = default;
  87. IReporterRegistry::~IReporterRegistry() = default;
  88. } // end namespace Catch