2013-12-03 19:52:41 +01:00
|
|
|
/*
|
|
|
|
* Created by Phil on 03/12/2013.
|
|
|
|
* Copyright 2013 Two Blue Cubes Ltd. All rights reserved.
|
|
|
|
*
|
|
|
|
* Distributed under the Boost Software License, Version 1.0. (See accompanying
|
|
|
|
* file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
|
|
|
*/
|
|
|
|
#ifndef TWOBLUECUBES_CATCH_SECTION_H_INCLUDED
|
|
|
|
#define TWOBLUECUBES_CATCH_SECTION_H_INCLUDED
|
|
|
|
|
|
|
|
#include "catch_section_info.h"
|
|
|
|
#include "catch_totals.hpp"
|
|
|
|
#include "catch_timer.h"
|
|
|
|
|
|
|
|
#include <string>
|
|
|
|
|
|
|
|
namespace Catch {
|
|
|
|
|
2015-11-20 09:31:17 +01:00
|
|
|
struct IRunContext;
|
|
|
|
|
2014-10-03 09:15:27 +02:00
|
|
|
class Section : NonCopyable {
|
2013-12-03 19:52:41 +01:00
|
|
|
public:
|
2014-07-09 08:39:57 +02:00
|
|
|
Section( SectionInfo const& info );
|
2013-12-03 19:52:41 +01:00
|
|
|
~Section();
|
|
|
|
|
|
|
|
// This indicates whether the section should be executed or not
|
2014-07-09 08:39:57 +02:00
|
|
|
operator bool() const;
|
2013-12-03 19:52:41 +01:00
|
|
|
|
|
|
|
private:
|
|
|
|
SectionInfo m_info;
|
|
|
|
|
|
|
|
std::string m_name;
|
|
|
|
Counts m_assertions;
|
2015-11-20 09:31:17 +01:00
|
|
|
IRunContext& m_runContext;
|
2013-12-03 19:52:41 +01:00
|
|
|
bool m_sectionIncluded;
|
|
|
|
Timer m_timer;
|
|
|
|
};
|
|
|
|
|
|
|
|
} // end namespace Catch
|
|
|
|
|
|
|
|
#ifdef CATCH_CONFIG_VARIADIC_MACROS
|
|
|
|
#define INTERNAL_CATCH_SECTION( ... ) \
|
2014-07-09 08:39:57 +02:00
|
|
|
if( Catch::Section const& INTERNAL_CATCH_UNIQUE_NAME( catch_internal_Section ) = Catch::SectionInfo( CATCH_INTERNAL_LINEINFO, __VA_ARGS__ ) )
|
2013-12-03 19:52:41 +01:00
|
|
|
#else
|
|
|
|
#define INTERNAL_CATCH_SECTION( name, desc ) \
|
2014-07-09 08:39:57 +02:00
|
|
|
if( Catch::Section const& INTERNAL_CATCH_UNIQUE_NAME( catch_internal_Section ) = Catch::SectionInfo( CATCH_INTERNAL_LINEINFO, name, desc ) )
|
2013-12-03 19:52:41 +01:00
|
|
|
#endif
|
|
|
|
|
|
|
|
#endif // TWOBLUECUBES_CATCH_SECTION_H_INCLUDED
|