forked from catchorg/Catch2
51 lines
1.7 KiB
C++
51 lines
1.7 KiB
C++
|
|
// Copyright Catch2 Authors
|
|
// Distributed under the Boost Software License, Version 1.0.
|
|
// (See accompanying file LICENSE_1_0.txt or copy at
|
|
// https://www.boost.org/LICENSE_1_0.txt)
|
|
|
|
// SPDX-License-Identifier: BSL-1.0
|
|
#ifndef CATCH_SECTION_HPP_INCLUDED
|
|
#define CATCH_SECTION_HPP_INCLUDED
|
|
|
|
#include <catch2/internal/catch_compiler_capabilities.hpp>
|
|
#include <catch2/internal/catch_noncopyable.hpp>
|
|
#include <catch2/catch_section_info.hpp>
|
|
#include <catch2/catch_timer.hpp>
|
|
#include <catch2/catch_totals.hpp>
|
|
#include <catch2/internal/catch_unique_name.hpp>
|
|
|
|
namespace Catch {
|
|
|
|
class Section : Detail::NonCopyable {
|
|
public:
|
|
Section( SectionInfo&& info );
|
|
~Section();
|
|
|
|
// This indicates whether the section should be executed or not
|
|
explicit operator bool() const;
|
|
|
|
private:
|
|
SectionInfo m_info;
|
|
|
|
Counts m_assertions;
|
|
bool m_sectionIncluded;
|
|
Timer m_timer;
|
|
};
|
|
|
|
} // end namespace Catch
|
|
|
|
#define INTERNAL_CATCH_SECTION( ... ) \
|
|
CATCH_INTERNAL_START_WARNINGS_SUPPRESSION \
|
|
CATCH_INTERNAL_SUPPRESS_UNUSED_VARIABLE_WARNINGS \
|
|
if( Catch::Section const& INTERNAL_CATCH_UNIQUE_NAME( catch_internal_Section ) = Catch::SectionInfo( CATCH_INTERNAL_LINEINFO, __VA_ARGS__ ) ) \
|
|
CATCH_INTERNAL_STOP_WARNINGS_SUPPRESSION
|
|
|
|
#define INTERNAL_CATCH_DYNAMIC_SECTION( ... ) \
|
|
CATCH_INTERNAL_START_WARNINGS_SUPPRESSION \
|
|
CATCH_INTERNAL_SUPPRESS_UNUSED_VARIABLE_WARNINGS \
|
|
if( Catch::Section const& INTERNAL_CATCH_UNIQUE_NAME( catch_internal_Section ) = Catch::SectionInfo( CATCH_INTERNAL_LINEINFO, (Catch::ReusableStringStream() << __VA_ARGS__).str() ) ) \
|
|
CATCH_INTERNAL_STOP_WARNINGS_SUPPRESSION
|
|
|
|
#endif // CATCH_SECTION_HPP_INCLUDED
|