Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-12-15 10:09:21

0001 //  (C) Copyright Gennadiy Rozental 2001.
0002 //  Distributed under the Boost Software License, Version 1.0.
0003 //  (See accompanying file LICENSE_1_0.txt or copy at
0004 //  http://www.boost.org/LICENSE_1_0.txt)
0005 
0006 //  See http://www.boost.org/libs/test for the library home page.
0007 //
0008 /// @file
0009 /// @brief defines specific version of execution monitor used to managed run unit of test cases
0010 ///
0011 /// Translates execution exception into error level
0012 // ***************************************************************************
0013 
0014 #ifndef BOOST_TEST_UNIT_TEST_MONITOR_HPP_020905GER
0015 #define BOOST_TEST_UNIT_TEST_MONITOR_HPP_020905GER
0016 
0017 // Boost.Test
0018 #include <boost/test/execution_monitor.hpp>
0019 #include <boost/test/detail/fwd_decl.hpp>
0020 
0021 #include <boost/test/detail/suppress_warnings.hpp>
0022 
0023 //____________________________________________________________________________//
0024 
0025 namespace boost {
0026 namespace unit_test {
0027 
0028 // ************************************************************************** //
0029 // **************               unit_test_monitor              ************** //
0030 // ************************************************************************** //
0031 
0032 class BOOST_TEST_DECL unit_test_monitor_t :public execution_monitor {
0033 public:
0034     enum error_level {
0035         test_ok                 =  0,
0036         /// Indicates a failure to prepare the unit test (eg. fixture). Does not
0037         /// account for tests skipped because of parent tests failed/skipped.
0038         test_setup_failure    = -1,
0039         unexpected_exception    = -2,
0040         os_exception            = -3,
0041         os_timeout              = -4,
0042         fatal_error             = -5  // includes both system and user
0043     };
0044 
0045     static bool is_critical_error( error_level e ) { return e <= fatal_error; }
0046 
0047     // monitor method
0048     // timeout is expressed in seconds
0049     error_level execute_and_translate( boost::function<void ()> const& func, unsigned long int timeout_microseconds = 0 );
0050 
0051     // singleton pattern
0052     BOOST_TEST_SINGLETON_CONS( unit_test_monitor_t )
0053 };
0054 
0055 BOOST_TEST_SINGLETON_INST( unit_test_monitor )
0056 
0057 } // namespace unit_test
0058 } // namespace boost
0059 
0060 #include <boost/test/detail/enable_warnings.hpp>
0061 
0062 #endif // BOOST_TEST_UNIT_TEST_MONITOR_HPP_020905GER