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)
6 // See http://www.boost.org/libs/test for the library home page.
9 //!@brief contains wrappers, which allows to build Boost.Test with no exception
10 // ***************************************************************************
12 #ifndef BOOST_TEST_DETAIL_THROW_EXCEPTION_HPP
13 #define BOOST_TEST_DETAIL_THROW_EXCEPTION_HPP
16 #include <boost/config.hpp> // BOOST_NO_EXCEPTIONS
18 #ifdef BOOST_NO_EXCEPTIONS
24 #include <boost/test/detail/suppress_warnings.hpp>
26 //____________________________________________________________________________//
32 #ifdef BOOST_NO_EXCEPTIONS
35 BOOST_NORETURN inline void
36 throw_exception(E const& e) { abort(); }
38 #define BOOST_TEST_I_TRY
39 #define BOOST_TEST_I_CATCH( T, var ) for(T const& var = *(T*)0; false;)
40 #define BOOST_TEST_I_CATCH0( T ) if(0)
41 #define BOOST_TEST_I_CATCHALL() if(0)
42 #define BOOST_TEST_I_RETHROW
47 BOOST_NORETURN inline void
48 throw_exception(E const& e) { throw e; }
50 #define BOOST_TEST_I_TRY try
51 #define BOOST_TEST_I_CATCH( T, var ) catch( T const& var )
52 #define BOOST_TEST_I_CATCH0( T ) catch( T const& )
53 #define BOOST_TEST_I_CATCHALL() catch(...)
54 #define BOOST_TEST_I_RETHROW throw
57 //____________________________________________________________________________//
59 #define BOOST_TEST_I_THROW( E ) unit_test::ut_detail::throw_exception( E )
60 #define BOOST_TEST_I_ASSRT( cond, ex ) if( cond ) {} else BOOST_TEST_I_THROW( ex )
63 } // namespace ut_detail
64 } // namespace unit_test
67 //____________________________________________________________________________//
69 #include <boost/test/detail/enable_warnings.hpp>
71 #endif // BOOST_TEST_DETAIL_THROW_EXCEPTION_HPP