1 /*
2  *  Created by Phil on 03/12/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_SECTION_H_INCLUDED
9 #define TWOBLUECUBES_CATCH_SECTION_H_INCLUDED
10 
11 #include "catch_compiler_capabilities.h"
12 #include "catch_section_info.h"
13 #include "catch_totals.h"
14 #include "catch_timer.h"
15 
16 #include <string>
17 
18 namespace Catch {
19 
20     class Section : NonCopyable {
21     public:
22         Section( SectionInfo const& info );
23         ~Section();
24 
25         // This indicates whether the section should be executed or not
26         explicit operator bool() const;
27 
28     private:
29         SectionInfo m_info;
30 
31         std::string m_name;
32         Counts m_assertions;
33         bool m_sectionIncluded;
34         Timer m_timer;
35     };
36 
37 } // end namespace Catch
38 
39 #define INTERNAL_CATCH_SECTION( ... ) \
40     CATCH_INTERNAL_START_WARNINGS_SUPPRESSION \
41     CATCH_INTERNAL_SUPPRESS_UNUSED_WARNINGS \
42     if( Catch::Section const& INTERNAL_CATCH_UNIQUE_NAME( catch_internal_Section ) = Catch::SectionInfo( CATCH_INTERNAL_LINEINFO, __VA_ARGS__ ) ) \
43     CATCH_INTERNAL_STOP_WARNINGS_SUPPRESSION
44 
45 #define INTERNAL_CATCH_DYNAMIC_SECTION( ... ) \
46     CATCH_INTERNAL_START_WARNINGS_SUPPRESSION \
47     CATCH_INTERNAL_SUPPRESS_UNUSED_WARNINGS \
48     if( Catch::Section const& INTERNAL_CATCH_UNIQUE_NAME( catch_internal_Section ) = Catch::SectionInfo( CATCH_INTERNAL_LINEINFO, (Catch::ReusableStringStream() << __VA_ARGS__).str() ) ) \
49     CATCH_INTERNAL_STOP_WARNINGS_SUPPRESSION
50 
51 #endif // TWOBLUECUBES_CATCH_SECTION_H_INCLUDED
52