Files

97 lines
3.8 KiB
C++

// (C) Copyright Gennadiy Rozental 2001.
// 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)
// See http://www.boost.org/libs/test for the library home page.
//
// File : $RCSfile$
//
// Version : $Revision: 74248 $
//
// Description : test tools context interfaces
// ***************************************************************************
#ifndef ACTIV_BOOST_TEST_TOOLS_CONTEXT_HPP_111712GER
#define ACTIV_BOOST_TEST_TOOLS_CONTEXT_HPP_111712GER
// Boost.Test
#include <ActivBoost/test/utils/lazy_ostream.hpp>
#include <ActivBoost/test/detail/pp_variadic.hpp>
#include <ActivBoost/preprocessor/repetition/enum_params.hpp>
#include <ActivBoost/preprocessor/repetition/enum_binary_params.hpp>
#include <ActivBoost/preprocessor/repetition/repeat_from_to.hpp>
#include <ActivBoost/preprocessor/variadic/to_seq.hpp>
#include <ActivBoost/preprocessor/variadic/size.hpp>
#include <ActivBoost/preprocessor/cat.hpp>
#include <ActivBoost/preprocessor/seq/for_each_i.hpp>
#include <ActivBoost/preprocessor/seq/for_each.hpp>
#include <ActivBoost/preprocessor/seq/enum.hpp>
#include <ActivBoost/preprocessor/control/iif.hpp>
#include <ActivBoost/preprocessor/comparison/equal.hpp>
#include <ActivBoost/test/detail/suppress_warnings.hpp>
//____________________________________________________________________________//
namespace Boost {
namespace test_tools {
namespace tt_detail {
// ************************************************************************** //
// ************** context_frame ************** //
// ************************************************************************** //
struct ACTIV_BOOST_TEST_DECL context_frame {
explicit context_frame( ::Boost::unit_test::lazy_ostream const& context_descr );
~context_frame();
operator bool();
private:
// Data members
int m_frame_id;
};
//____________________________________________________________________________//
#define ACTIV_BOOST_TEST_INFO( context_descr ) \
::Boost::unit_test::framework::add_context( ACTIV_BOOST_TEST_LAZY_MSG( context_descr ) , false ) \
/**/
#define ACTIV_BOOST_TEST_INFO_SCOPE( context_descr ) \
::Boost::test_tools::tt_detail::context_frame ACTIV_BOOST_JOIN( context_frame_, __LINE__ ) = \
::Boost::test_tools::tt_detail::context_frame(ACTIV_BOOST_TEST_LAZY_MSG( context_descr ) ) \
/**/
//____________________________________________________________________________//
#define ACTIV_BOOST_CONTEXT_PARAM(r, ctx, i, context_descr) \
if( ::Boost::test_tools::tt_detail::context_frame ACTIV_BOOST_PP_CAT(ctx, i) = \
::Boost::test_tools::tt_detail::context_frame(ACTIV_BOOST_TEST_LAZY_MSG( context_descr ) ) ) \
/**/
#define ACTIV_BOOST_CONTEXT_PARAMS( params ) \
ACTIV_BOOST_PP_SEQ_FOR_EACH_I(ACTIV_BOOST_CONTEXT_PARAM, \
ACTIV_BOOST_JOIN( context_frame_, __LINE__ ), \
params) \
/**/
#define ACTIV_BOOST_TEST_CONTEXT( ... ) \
ACTIV_BOOST_CONTEXT_PARAMS( ACTIV_BOOST_PP_VARIADIC_TO_SEQ(__VA_ARGS__) ) \
/**/
//____________________________________________________________________________//
} // namespace tt_detail
} // namespace test_tools
} // namespace Boost
#include <ActivBoost/test/detail/enable_warnings.hpp>
#endif // ACTIV_BOOST_TEST_TOOLS_CONTEXT_HPP_111712GER