LCOV - code coverage report
Current view: top level - opt/homebrew/include/boost/test/impl - unit_test_monitor.ipp (source / functions) Hit Total Coverage
Test: total_coverage.info Lines: 11 22 50.0 %
Date: 2026-06-25 07:23:43 Functions: 2 2 100.0 %

          Line data    Source code
       1             : //  (C) Copyright Gennadiy Rozental 2001.
       2             : //  Distributed under the Boost Software License, Version 1.0.
       3             : //  (See accompanying file LICENSE_1_0.txt or copy at
       4             : //  http://www.boost.org/LICENSE_1_0.txt)
       5             : 
       6             : //  See http://www.boost.org/libs/test for the library home page.
       7             : //
       8             : //  File        : $RCSfile$
       9             : //
      10             : //  Version     : $Revision$
      11             : //
      12             : //  Description : implements specific subclass of Executon Monitor used by Unit
      13             : //  Test Framework to monitor test cases run.
      14             : // ***************************************************************************
      15             : 
      16             : #ifndef BOOST_TEST_UNIT_TEST_MONITOR_IPP_012205GER
      17             : #define BOOST_TEST_UNIT_TEST_MONITOR_IPP_012205GER
      18             : 
      19             : // Boost.Test
      20             : #include <boost/test/unit_test_monitor.hpp>
      21             : #include <boost/test/framework.hpp>
      22             : #include <boost/test/tree/test_unit.hpp>
      23             : #include <boost/test/unit_test_parameters.hpp>
      24             : 
      25             : #include <boost/test/detail/suppress_warnings.hpp>
      26             : 
      27             : //____________________________________________________________________________//
      28             : 
      29             : namespace boost {
      30             : namespace unit_test {
      31             : 
      32             : // singleton pattern
      33         146 : BOOST_TEST_SINGLETON_CONS_IMPL(unit_test_monitor_t)
      34             : 
      35             : // ************************************************************************** //
      36             : // **************               unit_test_monitor              ************** //
      37             : // ************************************************************************** //
      38             : 
      39             : unit_test_monitor_t::error_level
      40        1170 : unit_test_monitor_t::execute_and_translate( boost::function<void ()> const& func, unsigned long int timeout_microseconds )
      41             : {
      42             :     BOOST_TEST_I_TRY {
      43        1170 :         p_catch_system_errors.value     = runtime_config::get<bool>( runtime_config::btrt_catch_sys_errors );
      44        1169 :         p_timeout.value                 = timeout_microseconds;
      45        1169 :         p_auto_start_dbg.value          = runtime_config::get<bool>( runtime_config::btrt_auto_start_dbg );
      46        1169 :         p_use_alt_stack.value           = runtime_config::get<bool>( runtime_config::btrt_use_alt_stack );
      47        1169 :         p_detect_fp_exceptions.value    = runtime_config::get<bool>( runtime_config::btrt_detect_fp_except );
      48             : 
      49        1169 :         vexecute( func );
      50        1168 :     }
      51             :     BOOST_TEST_I_CATCH( execution_exception, ex ) {
      52           0 :         framework::exception_caught( ex );
      53           0 :         framework::test_unit_aborted( framework::current_test_unit() );
      54             : 
      55             :         // translate execution_exception::error_code to error_level
      56           0 :         switch( ex.code() ) {
      57           0 :         case execution_exception::no_error:             return test_ok;
      58           0 :         case execution_exception::user_error:           return unexpected_exception;
      59           0 :         case execution_exception::cpp_exception_error:  return unexpected_exception;
      60           0 :         case execution_exception::system_error:         return os_exception;
      61           0 :         case execution_exception::timeout_error:        return os_timeout;
      62             :         case execution_exception::user_fatal_error:
      63           0 :         case execution_exception::system_fatal_error:   return fatal_error;
      64           0 :         default:                                        return unexpected_exception;
      65             :         }
      66           0 :     }
      67             : 
      68        1168 :     return test_ok;
      69        1170 : }
      70             : 
      71             : //____________________________________________________________________________//
      72             : 
      73             : } // namespace unit_test
      74             : } // namespace boost
      75             : 
      76             : #include <boost/test/detail/enable_warnings.hpp>
      77             : 
      78             : #endif // BOOST_TEST_UNIT_TEST_MONITOR_IPP_012205GER

Generated by: LCOV version 1.16