~ubuntu-branches/ubuntu/wily/bombono-dvd/wily

« back to all changes in this revision

Viewing changes to libs/boost-lib/boost/test/impl/unit_test_monitor.ipp

  • Committer: Bazaar Package Importer
  • Author(s): Alessio Treglia
  • Date: 2010-11-04 11:46:25 UTC
  • mto: This revision was merged to the branch mainline in revision 8.
  • Revision ID: james.westby@ubuntu.com-20101104114625-8xfdhvhpsm51i0nu
Tags: upstream-0.8.0
ImportĀ upstreamĀ versionĀ 0.8.0

Show diffs side-by-side

added added

removed removed

Lines of Context:
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)
5
5
 
6
6
//  See http://www.boost.org/libs/test for the library home page.
7
7
//
8
 
//  File        : $RCSfile: unit_test_monitor.ipp,v $
 
8
//  File        : $RCSfile$
9
9
//
10
 
//  Version     : $Revision: 1.3 $
 
10
//  Version     : $Revision: 49312 $
11
11
//
12
12
//  Description : implements specific subclass of Executon Monitor used by Unit
13
13
//  Test Framework to monitor test cases run.
18
18
 
19
19
// Boost.Test
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>
24
24
 
33
33
namespace unit_test {
34
34
 
35
35
namespace {
36
 
struct zero_return_wrapper {
37
 
    explicit zero_return_wrapper( callback0<> const& f ) : m_f( f ) {}
 
36
 
 
37
template<typename F>
 
38
struct zero_return_wrapper_t {
 
39
    explicit zero_return_wrapper_t( F const& f ) : m_f( f ) {}
38
40
    
39
41
    int operator()() { m_f(); return 0; }
40
42
    
41
 
    callback0<> const& m_f;
 
43
    F const& m_f;
42
44
};
43
45
 
 
46
template<typename F>
 
47
zero_return_wrapper_t<F>
 
48
zero_return_wrapper( F const& f )
 
49
{
 
50
    return zero_return_wrapper_t<F>( f );
 
51
}
 
52
 
44
53
}
45
54
 
46
55
// ************************************************************************** //
51
60
unit_test_monitor_t::execute_and_translate( test_case const& tc )
52
61
{
53
62
    try {
54
 
        execute( callback0<int>( zero_return_wrapper( tc.test_func() ) ),
55
 
                 runtime_config::catch_sys_errors(),
56
 
                 tc.p_timeout );
 
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();
 
68
 
 
69
        execute( callback0<int>( zero_return_wrapper( tc.test_func() ) ) );
57
70
    }
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() );
61
74
 
62
75
        // translate execution_exception::error_code to error_level
63
76
        switch( ex.code() ) {
85
98
 
86
99
#include <boost/test/detail/enable_warnings.hpp>
87
100
 
88
 
// ***************************************************************************
89
 
//  Revision History :
90
 
//
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
94
 
//
95
 
//  Revision 1.2  2005/02/01 06:40:07  rogeeff
96
 
//  copyright update
97
 
//  old log entries removed
98
 
//  minor stilistic changes
99
 
//  depricated tools removed
100
 
//
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
103
 
//
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)
109
 
//
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
117
 
//
118
 
// ***************************************************************************
119
 
 
120
101
#endif // BOOST_TEST_UNIT_TEST_MONITOR_IPP_012205GER