| 
									
										
										
										
											2010-11-09 23:24:00 +00: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)
 | 
					
						
							|  |  |  |  */ | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2013-12-03 18:52:41 +00:00
										 |  |  | #include "catch_section.h"
 | 
					
						
							| 
									
										
										
										
											2010-11-29 19:40:44 +00:00
										 |  |  | #include "catch_capture.hpp"
 | 
					
						
							| 
									
										
										
										
											2018-01-26 10:59:47 -05:00
										 |  |  | #include "catch_uncaught_exceptions.h"
 | 
					
						
							| 
									
										
										
										
											2010-11-29 19:40:44 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2012-05-16 08:02:20 +01:00
										 |  |  | namespace Catch { | 
					
						
							| 
									
										
										
										
											2012-05-15 07:42:26 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2014-07-09 07:39:57 +01:00
										 |  |  |     Section::Section( SectionInfo const& info ) | 
					
						
							|  |  |  |     :   m_info( info ), | 
					
						
							| 
									
										
										
										
											2014-05-20 18:49:28 +01:00
										 |  |  |         m_sectionIncluded( getResultCapture().sectionStarted( m_info, m_assertions ) ) | 
					
						
							| 
									
										
										
										
											2013-12-03 18:52:41 +00:00
										 |  |  |     { | 
					
						
							|  |  |  |         m_timer.start(); | 
					
						
							|  |  |  |     } | 
					
						
							| 
									
										
										
										
											2013-07-03 19:14:59 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2013-12-03 18:52:41 +00:00
										 |  |  |     Section::~Section() { | 
					
						
							| 
									
										
										
										
											2015-09-26 18:12:21 -07:00
										 |  |  |         if( m_sectionIncluded ) { | 
					
						
							|  |  |  |             SectionEndInfo endInfo( m_info, m_assertions, m_timer.getElapsedSeconds() ); | 
					
						
							| 
									
										
										
										
											2018-01-26 10:59:47 -05:00
										 |  |  |             if( uncaught_exceptions() ) | 
					
						
							| 
									
										
										
										
											2015-09-26 18:12:21 -07:00
										 |  |  |                 getResultCapture().sectionEndedEarly( endInfo ); | 
					
						
							|  |  |  |             else | 
					
						
							|  |  |  |                 getResultCapture().sectionEnded( endInfo ); | 
					
						
							|  |  |  |         } | 
					
						
							| 
									
										
										
										
											2013-12-03 18:52:41 +00:00
										 |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     // This indicates whether the section should be executed or not
 | 
					
						
							| 
									
										
										
										
											2014-07-09 07:39:57 +01:00
										 |  |  |     Section::operator bool() const { | 
					
						
							| 
									
										
										
										
											2013-12-03 18:52:41 +00:00
										 |  |  |         return m_sectionIncluded; | 
					
						
							|  |  |  |     } | 
					
						
							| 
									
										
										
										
											2010-11-09 23:24:00 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2013-12-03 18:52:41 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  | } // end namespace Catch
 |