1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071 |
- #ifndef BOOST_TEST_DETAIL_THROW_EXCEPTION_HPP
- #define BOOST_TEST_DETAIL_THROW_EXCEPTION_HPP
- #include <boost/config.hpp> // BOOST_NO_EXCEPTIONS
- #ifdef BOOST_NO_EXCEPTIONS
- #include <stdlib.h>
- #endif
- #include <boost/test/detail/suppress_warnings.hpp>
- namespace boost {
- namespace unit_test {
- namespace ut_detail {
- #ifdef BOOST_NO_EXCEPTIONS
- template<typename E>
- BOOST_NORETURN inline void
- throw_exception(E const& ) { abort(); }
- #define BOOST_TEST_I_TRY
- #define BOOST_TEST_I_CATCH( T, var ) for(T const& var = *(T*)0; false;)
- #define BOOST_TEST_I_CATCH0( T ) if(0)
- #define BOOST_TEST_I_CATCHALL() if(0)
- #define BOOST_TEST_I_RETHROW
- #else
- template<typename E>
- BOOST_NORETURN inline void
- throw_exception(E const& e) { throw e; }
- #define BOOST_TEST_I_TRY try
- #define BOOST_TEST_I_CATCH( T, var ) catch( T const& var )
- #define BOOST_TEST_I_CATCH0( T ) catch( T const& )
- #define BOOST_TEST_I_CATCHALL() catch(...)
- #define BOOST_TEST_I_RETHROW throw
- #endif
- #define BOOST_TEST_I_THROW( E ) unit_test::ut_detail::throw_exception( E )
- #define BOOST_TEST_I_ASSRT( cond, ex ) if( cond ) {} else BOOST_TEST_I_THROW( ex )
- }
- }
- }
- #include <boost/test/detail/enable_warnings.hpp>
- #endif
|