diff options
Diffstat (limited to 'boost/test/impl/unit_test_monitor.ipp')
-rw-r--r-- | boost/test/impl/unit_test_monitor.ipp | 42 |
1 files changed, 8 insertions, 34 deletions
diff --git a/boost/test/impl/unit_test_monitor.ipp b/boost/test/impl/unit_test_monitor.ipp index dc912f544e..8c931f203f 100644 --- a/boost/test/impl/unit_test_monitor.ipp +++ b/boost/test/impl/unit_test_monitor.ipp @@ -1,4 +1,4 @@ -// (C) Copyright Gennadiy Rozental 2005-2008. +// (C) Copyright Gennadiy Rozental 2005-2014. // Distributed under the Boost Software License, Version 1.0. // (See accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) @@ -18,57 +18,34 @@ // Boost.Test #include <boost/test/unit_test_monitor.hpp> -#include <boost/test/unit_test_suite_impl.hpp> -#include <boost/test/test_tools.hpp> #include <boost/test/framework.hpp> - -#include <boost/test/detail/unit_test_parameters.hpp> +#include <boost/test/tree/test_unit.hpp> +#include <boost/test/unit_test_parameters.hpp> #include <boost/test/detail/suppress_warnings.hpp> //____________________________________________________________________________// namespace boost { - namespace unit_test { -namespace { - -template<typename F> -struct zero_return_wrapper_t { - explicit zero_return_wrapper_t( F const& f ) : m_f( f ) {} - - int operator()() { m_f(); return 0; } - - F const& m_f; -}; - -template<typename F> -zero_return_wrapper_t<F> -zero_return_wrapper( F const& f ) -{ - return zero_return_wrapper_t<F>( f ); -} - -} - // ************************************************************************** // // ************** unit_test_monitor ************** // // ************************************************************************** // unit_test_monitor_t::error_level -unit_test_monitor_t::execute_and_translate( test_case const& tc ) +unit_test_monitor_t::execute_and_translate( boost::function<void ()> const& func, unsigned timeout ) { - try { + BOOST_TEST_IMPL_TRY { p_catch_system_errors.value = runtime_config::catch_sys_errors(); - p_timeout.value = tc.p_timeout.get(); + p_timeout.value = timeout; p_auto_start_dbg.value = runtime_config::auto_start_dbg(); p_use_alt_stack.value = runtime_config::use_alt_stack(); p_detect_fp_exceptions.value = runtime_config::detect_fp_exceptions(); - execute( callback0<int>( zero_return_wrapper( tc.test_func() ) ) ); + vexecute( func ); } - catch( execution_exception const& ex ) { + BOOST_TEST_IMPL_CATCH( execution_exception, ex ) { framework::exception_caught( ex ); framework::test_unit_aborted( framework::current_test_case() ); @@ -91,11 +68,8 @@ unit_test_monitor_t::execute_and_translate( test_case const& tc ) //____________________________________________________________________________// } // namespace unit_test - } // namespace boost -//____________________________________________________________________________// - #include <boost/test/detail/enable_warnings.hpp> #endif // BOOST_TEST_UNIT_TEST_MONITOR_IPP_012205GER |