context.hpp 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. // (C) Copyright Gennadiy Rozental 2001.
  2. // Distributed under the Boost Software License, Version 1.0.
  3. // (See accompanying file LICENSE_1_0.txt or copy at
  4. // http://www.boost.org/LICENSE_1_0.txt)
  5. // See http://www.boost.org/libs/test for the library home page.
  6. //
  7. // File : $RCSfile$
  8. //
  9. // Version : $Revision: 74248 $
  10. //
  11. // Description : test tools context interfaces
  12. // ***************************************************************************
  13. #ifndef BOOST_TEST_TOOLS_CONTEXT_HPP_111712GER
  14. #define BOOST_TEST_TOOLS_CONTEXT_HPP_111712GER
  15. // Boost.Test
  16. #include <boost/test/utils/lazy_ostream.hpp>
  17. #include <boost/test/detail/suppress_warnings.hpp>
  18. //____________________________________________________________________________//
  19. namespace boost {
  20. namespace test_tools {
  21. namespace tt_detail {
  22. // ************************************************************************** //
  23. // ************** context_frame ************** //
  24. // ************************************************************************** //
  25. struct BOOST_TEST_DECL context_frame {
  26. explicit context_frame( ::boost::unit_test::lazy_ostream const& context_descr );
  27. ~context_frame();
  28. operator bool();
  29. private:
  30. // Data members
  31. int m_frame_id;
  32. };
  33. //____________________________________________________________________________//
  34. #define BOOST_TEST_INFO( context_descr ) \
  35. ::boost::unit_test::framework::add_context( BOOST_TEST_LAZY_MSG( context_descr ) , false ) \
  36. /**/
  37. //____________________________________________________________________________//
  38. #define BOOST_TEST_CONTEXT( context_descr ) \
  39. if( ::boost::test_tools::tt_detail::context_frame BOOST_JOIN( context_frame_, __LINE__ ) = \
  40. ::boost::test_tools::tt_detail::context_frame( BOOST_TEST_LAZY_MSG( context_descr ) ) ) \
  41. /**/
  42. //____________________________________________________________________________//
  43. } // namespace tt_detail
  44. } // namespace test_tools
  45. } // namespace boost
  46. #include <boost/test/detail/enable_warnings.hpp>
  47. #endif // BOOST_TEST_TOOLS_CONTEXT_HPP_111712GER