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_section_info.h" 12 #include "catch_totals.hpp" 13 #include "catch_timer.h" 14 15 #include <string> 16 17 namespace Catch { 18 19 class Section : NonCopyable { 20 public: 21 Section( SectionInfo const& info ); 22 ~Section(); 23 24 // This indicates whether the section should be executed or not 25 operator bool() const; 26 27 private: 28 SectionInfo m_info; 29 30 std::string m_name; 31 Counts m_assertions; 32 bool m_sectionIncluded; 33 Timer m_timer; 34 }; 35 36 } // end namespace Catch 37 38 #ifdef CATCH_CONFIG_VARIADIC_MACROS 39 #define INTERNAL_CATCH_SECTION( ... ) \ 40 if( Catch::Section const& INTERNAL_CATCH_UNIQUE_NAME( catch_internal_Section ) = Catch::SectionInfo( CATCH_INTERNAL_LINEINFO, __VA_ARGS__ ) ) 41 #else 42 #define INTERNAL_CATCH_SECTION( name, desc ) \ 43 if( Catch::Section const& INTERNAL_CATCH_UNIQUE_NAME( catch_internal_Section ) = Catch::SectionInfo( CATCH_INTERNAL_LINEINFO, name, desc ) ) 44 #endif 45 46 #endif // TWOBLUECUBES_CATCH_SECTION_H_INCLUDED 47