2010-11-10 00:24:00 +01:00
|
|
|
/*
|
|
|
|
* Created by Phil on 03/11/2010.
|
|
|
|
* Copyright 2010 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_HPP_INCLUDED
|
|
|
|
#define TWOBLUECUBES_CATCH_SECTION_HPP_INCLUDED
|
|
|
|
|
2013-12-03 19:52:41 +01:00
|
|
|
#include "catch_section.h"
|
2010-11-29 20:40:44 +01:00
|
|
|
#include "catch_capture.hpp"
|
2013-04-22 09:19:17 +02:00
|
|
|
#include "catch_compiler_capabilities.h"
|
2013-08-07 19:56:35 +02:00
|
|
|
#include "catch_timer.h"
|
2010-11-29 20:40:44 +01:00
|
|
|
|
2012-05-16 09:02:20 +02:00
|
|
|
namespace Catch {
|
2012-05-15 08:42:26 +02:00
|
|
|
|
2014-07-09 08:39:57 +02:00
|
|
|
SectionInfo::SectionInfo
|
|
|
|
( SourceLineInfo const& _lineInfo,
|
|
|
|
std::string const& _name,
|
|
|
|
std::string const& _description )
|
|
|
|
: name( _name ),
|
|
|
|
description( _description ),
|
|
|
|
lineInfo( _lineInfo )
|
|
|
|
{}
|
|
|
|
|
|
|
|
Section::Section( SectionInfo const& info )
|
|
|
|
: m_info( info ),
|
2014-05-20 19:49:28 +02:00
|
|
|
m_sectionIncluded( getResultCapture().sectionStarted( m_info, m_assertions ) )
|
2013-12-03 19:52:41 +01:00
|
|
|
{
|
|
|
|
m_timer.start();
|
|
|
|
}
|
2013-07-03 20:14:59 +02:00
|
|
|
|
2013-12-03 19:52:41 +01:00
|
|
|
Section::~Section() {
|
|
|
|
if( m_sectionIncluded )
|
2014-05-20 19:49:28 +02:00
|
|
|
getResultCapture().sectionEnded( m_info, m_assertions, m_timer.getElapsedSeconds() );
|
2013-12-03 19:52:41 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
// This indicates whether the section should be executed or not
|
2014-07-09 08:39:57 +02:00
|
|
|
Section::operator bool() const {
|
2013-12-03 19:52:41 +01:00
|
|
|
return m_sectionIncluded;
|
|
|
|
}
|
2010-11-10 00:24:00 +01:00
|
|
|
|
2013-12-03 19:52:41 +01:00
|
|
|
|
|
|
|
} // end namespace Catch
|
2010-11-10 00:24:00 +01:00
|
|
|
|
|
|
|
#endif // TWOBLUECUBES_CATCH_SECTION_HPP_INCLUDED
|