1
// (C) Copyright Gennadiy Rozental 2005.
1
// (C) Copyright Gennadiy Rozental 2005-2008.
2
2
// Distributed under the Boost Software License, Version 1.0.
3
3
// (See accompanying file LICENSE_1_0.txt or copy at
4
4
// http://www.boost.org/LICENSE_1_0.txt)
6
6
// See http://www.boost.org/libs/test for the library home page.
8
// File : $RCSfile: unit_test_monitor.ipp,v $
10
// Version : $Revision: 1.3 $
10
// Version : $Revision: 49312 $
12
12
// Description : implements specific subclass of Executon Monitor used by Unit
13
13
// Test Framework to monitor test cases run.
20
20
#include <boost/test/unit_test_monitor.hpp>
21
#include <boost/test/unit_test_suite.hpp>
21
#include <boost/test/unit_test_suite_impl.hpp>
22
22
#include <boost/test/test_tools.hpp>
23
23
#include <boost/test/framework.hpp>
33
33
namespace unit_test {
36
struct zero_return_wrapper {
37
explicit zero_return_wrapper( callback0<> const& f ) : m_f( f ) {}
38
struct zero_return_wrapper_t {
39
explicit zero_return_wrapper_t( F const& f ) : m_f( f ) {}
39
41
int operator()() { m_f(); return 0; }
41
callback0<> const& m_f;
47
zero_return_wrapper_t<F>
48
zero_return_wrapper( F const& f )
50
return zero_return_wrapper_t<F>( f );
46
55
// ************************************************************************** //
51
60
unit_test_monitor_t::execute_and_translate( test_case const& tc )
54
execute( callback0<int>( zero_return_wrapper( tc.test_func() ) ),
55
runtime_config::catch_sys_errors(),
63
p_catch_system_errors.value = runtime_config::catch_sys_errors();
64
p_timeout.value = tc.p_timeout.get();
65
p_auto_start_dbg.value = runtime_config::auto_start_dbg();
66
p_use_alt_stack.value = runtime_config::use_alt_stack();
67
p_detect_fp_exceptions.value = runtime_config::detect_fp_exceptions();
69
execute( callback0<int>( zero_return_wrapper( tc.test_func() ) ) );
58
71
catch( execution_exception const& ex ) {
59
72
framework::exception_caught( ex );
60
framework::test_unit_aborted();
73
framework::test_unit_aborted( framework::current_test_case() );
62
75
// translate execution_exception::error_code to error_level
63
76
switch( ex.code() ) {
86
99
#include <boost/test/detail/enable_warnings.hpp>
88
// ***************************************************************************
91
// $Log: unit_test_monitor.ipp,v $
92
// Revision 1.3 2005/02/20 08:27:07 rogeeff
93
// This a major update for Boost.Test framework. See release docs for complete list of fixes/updates
95
// Revision 1.2 2005/02/01 06:40:07 rogeeff
97
// old log entries removed
98
// minor stilistic changes
99
// depricated tools removed
101
// Revision 1.1 2005/01/22 19:22:13 rogeeff
102
// implementation moved into headers section to eliminate dependency of included/minimal component on src directory
104
// Revision 1.17 2005/01/19 16:34:07 vawjr
105
// Changed the \r\r\n back to \r\n on windows so we don't get errors when compiling
106
// on VC++8.0. I don't know why Microsoft thinks it's a good idea to call this an error,
107
// but they do. I also don't know why people insist on checking out files on Windows and
108
// copying them to a unix system to check them in (which will cause exactly this problem)
110
// Revision 1.16 2005/01/18 08:30:08 rogeeff
111
// unit_test_log rework:
112
// eliminated need for ::instance()
113
// eliminated need for << end and ...END macro
114
// straitend interface between log and formatters
115
// change compiler like formatter name
116
// minimized unit_test_log interface and reworked to use explicit calls
118
// ***************************************************************************
120
101
#endif // BOOST_TEST_UNIT_TEST_MONITOR_IPP_012205GER