• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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_SUPPRESS_UNUSED_WARNINGS \
41     if( Catch::Section const& INTERNAL_CATCH_UNIQUE_NAME( catch_internal_Section ) = Catch::SectionInfo( CATCH_INTERNAL_LINEINFO, __VA_ARGS__ ) ) \
42     CATCH_INTERNAL_UNSUPPRESS_UNUSED_WARNINGS
43 
44 #define INTERNAL_CATCH_DYNAMIC_SECTION( ... ) \
45     CATCH_INTERNAL_SUPPRESS_UNUSED_WARNINGS \
46     if( Catch::Section const& INTERNAL_CATCH_UNIQUE_NAME( catch_internal_Section ) = Catch::SectionInfo( CATCH_INTERNAL_LINEINFO, (Catch::ReusableStringStream() << __VA_ARGS__).str() ) ) \
47     CATCH_INTERNAL_UNSUPPRESS_UNUSED_WARNINGS
48 
49 #endif // TWOBLUECUBES_CATCH_SECTION_H_INCLUDED
50