File indexing completed on 2025-12-16 10:09:49
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012 #ifndef BOOST_TEST_DETAIL_THROW_EXCEPTION_HPP
0013 #define BOOST_TEST_DETAIL_THROW_EXCEPTION_HPP
0014
0015
0016 #include <boost/config.hpp> // BOOST_NO_EXCEPTIONS
0017
0018 #ifdef BOOST_NO_EXCEPTIONS
0019
0020 #include <stdlib.h>
0021
0022 #endif
0023
0024 #include <boost/test/detail/suppress_warnings.hpp>
0025
0026
0027
0028 namespace boost {
0029 namespace unit_test {
0030 namespace ut_detail {
0031
0032 #ifdef BOOST_NO_EXCEPTIONS
0033
0034 template<typename E>
0035 BOOST_NORETURN inline void
0036 throw_exception(E const& ) { abort(); }
0037
0038 #define BOOST_TEST_I_TRY
0039 #define BOOST_TEST_I_CATCH( T, var ) for(T const& var = *(T*)0; false;)
0040 #define BOOST_TEST_I_CATCH0( T ) if(0)
0041 #define BOOST_TEST_I_CATCHALL() if(0)
0042 #define BOOST_TEST_I_RETHROW
0043
0044 #else
0045
0046 template<typename E>
0047 BOOST_NORETURN inline void
0048 throw_exception(E const& e) { throw e; }
0049
0050 #define BOOST_TEST_I_TRY try
0051 #define BOOST_TEST_I_CATCH( T, var ) catch( T const& var )
0052 #define BOOST_TEST_I_CATCH0( T ) catch( T const& )
0053 #define BOOST_TEST_I_CATCHALL() catch(...)
0054 #define BOOST_TEST_I_RETHROW throw
0055 #endif
0056
0057
0058
0059 #define BOOST_TEST_I_THROW( E ) unit_test::ut_detail::throw_exception( E )
0060 #define BOOST_TEST_I_ASSRT( cond, ex ) if( cond ) {} else BOOST_TEST_I_THROW( ex )
0061
0062
0063 }
0064 }
0065 }
0066
0067
0068
0069 #include <boost/test/detail/enable_warnings.hpp>
0070
0071 #endif