File indexing completed on 2025-01-30 10:01:01
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016 #ifndef BOOST_TEST_UNIT_TEST_MONITOR_IPP_012205GER
0017 #define BOOST_TEST_UNIT_TEST_MONITOR_IPP_012205GER
0018
0019
0020 #include <boost/test/unit_test_monitor.hpp>
0021 #include <boost/test/framework.hpp>
0022 #include <boost/test/tree/test_unit.hpp>
0023 #include <boost/test/unit_test_parameters.hpp>
0024
0025 #include <boost/test/detail/suppress_warnings.hpp>
0026
0027
0028
0029 namespace boost {
0030 namespace unit_test {
0031
0032
0033 BOOST_TEST_SINGLETON_CONS_IMPL(unit_test_monitor_t)
0034
0035
0036
0037
0038
0039 unit_test_monitor_t::error_level
0040 unit_test_monitor_t::execute_and_translate( boost::function<void ()> const& func, unsigned long int timeout_microseconds )
0041 {
0042 BOOST_TEST_I_TRY {
0043 p_catch_system_errors.value = runtime_config::get<bool>( runtime_config::btrt_catch_sys_errors );
0044 p_timeout.value = timeout_microseconds;
0045 p_auto_start_dbg.value = runtime_config::get<bool>( runtime_config::btrt_auto_start_dbg );
0046 p_use_alt_stack.value = runtime_config::get<bool>( runtime_config::btrt_use_alt_stack );
0047 p_detect_fp_exceptions.value = runtime_config::get<bool>( runtime_config::btrt_detect_fp_except );
0048
0049 vexecute( func );
0050 }
0051 BOOST_TEST_I_CATCH( execution_exception, ex ) {
0052 framework::exception_caught( ex );
0053 framework::test_unit_aborted( framework::current_test_unit() );
0054
0055
0056 switch( ex.code() ) {
0057 case execution_exception::no_error: return test_ok;
0058 case execution_exception::user_error: return unexpected_exception;
0059 case execution_exception::cpp_exception_error: return unexpected_exception;
0060 case execution_exception::system_error: return os_exception;
0061 case execution_exception::timeout_error: return os_timeout;
0062 case execution_exception::user_fatal_error:
0063 case execution_exception::system_fatal_error: return fatal_error;
0064 default: return unexpected_exception;
0065 }
0066 }
0067
0068 return test_ok;
0069 }
0070
0071
0072
0073 }
0074 }
0075
0076 #include <boost/test/detail/enable_warnings.hpp>
0077
0078 #endif