1 /*
2  *  Created by Phil on 6th April 2013.
3  *  Copyright 2013 Two Blue Cubes Ltd. All rights reserved.
4  *
5  *  Distributed under the Boost Software License, Version 1.0. (See accompanying
6  *  file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
7  */
8 #ifndef TWOBLUECUBES_CATCH_LEGACY_REPORTER_ADAPTER_H_INCLUDED
9 #define TWOBLUECUBES_CATCH_LEGACY_REPORTER_ADAPTER_H_INCLUDED
10 
11 #include "catch_interfaces_reporter.h"
12 
13 namespace Catch
14 {
15     // Deprecated
16     struct IReporter : IShared {
17         virtual ~IReporter();
18 
19         virtual bool shouldRedirectStdout() const = 0;
20 
21         virtual void StartTesting() = 0;
22         virtual void EndTesting( Totals const& totals ) = 0;
23         virtual void StartGroup( std::string const& groupName ) = 0;
24         virtual void EndGroup( std::string const& groupName, Totals const& totals ) = 0;
25         virtual void StartTestCase( TestCaseInfo const& testInfo ) = 0;
26         virtual void EndTestCase( TestCaseInfo const& testInfo, Totals const& totals, std::string const& stdOut, std::string const& stdErr ) = 0;
27         virtual void StartSection( std::string const& sectionName, std::string const& description ) = 0;
28         virtual void EndSection( std::string const& sectionName, Counts const& assertions ) = 0;
29         virtual void NoAssertionsInSection( std::string const& sectionName ) = 0;
30         virtual void NoAssertionsInTestCase( std::string const& testName ) = 0;
31         virtual void Aborted() = 0;
32         virtual void Result( AssertionResult const& result ) = 0;
33     };
34 
35     class LegacyReporterAdapter : public SharedImpl<IStreamingReporter>
36     {
37     public:
38         LegacyReporterAdapter( Ptr<IReporter> const& legacyReporter );
39         virtual ~LegacyReporterAdapter();
40 
41         virtual ReporterPreferences getPreferences() const;
42         virtual void noMatchingTestCases( std::string const& );
43         virtual void testRunStarting( TestRunInfo const& );
44         virtual void testGroupStarting( GroupInfo const& groupInfo );
45         virtual void testCaseStarting( TestCaseInfo const& testInfo );
46         virtual void sectionStarting( SectionInfo const& sectionInfo );
47         virtual void assertionStarting( AssertionInfo const& );
48         virtual bool assertionEnded( AssertionStats const& assertionStats );
49         virtual void sectionEnded( SectionStats const& sectionStats );
50         virtual void testCaseEnded( TestCaseStats const& testCaseStats );
51         virtual void testGroupEnded( TestGroupStats const& testGroupStats );
52         virtual void testRunEnded( TestRunStats const& testRunStats );
53         virtual void skipTest( TestCaseInfo const& );
54 
55     private:
56         Ptr<IReporter> m_legacyReporter;
57     };
58 }
59 
60 #endif // TWOBLUECUBES_CATCH_LEGACY_REPORTER_ADAPTER_H_INCLUDED
61