ossrv_pub/boost_apis/boost/test/framework.hpp
changeset 0 e4d67989cc36
equal deleted inserted replaced
-1:000000000000 0:e4d67989cc36
       
     1 //  (C) Copyright Gennadiy Rozental 2005.
       
     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: framework.hpp,v $
       
     9 //
       
    10 //  Version     : $Revision: 1.5 $
       
    11 //
       
    12 //  Description : defines framework interface
       
    13 // ***************************************************************************
       
    14 
       
    15 #ifndef BOOST_TEST_FRAMEWORK_HPP_020805GER
       
    16 #define BOOST_TEST_FRAMEWORK_HPP_020805GER
       
    17 
       
    18 // Boost.Test
       
    19 #include <boost/test/detail/global_typedef.hpp>
       
    20 #include <boost/test/detail/fwd_decl.hpp>
       
    21 #include <boost/test/utils/trivial_singleton.hpp>
       
    22 
       
    23 #include <boost/test/detail/suppress_warnings.hpp>
       
    24 
       
    25 // STL
       
    26 #include <stdexcept>
       
    27 
       
    28 //____________________________________________________________________________//
       
    29 
       
    30 namespace boost {
       
    31 
       
    32 namespace unit_test {
       
    33 
       
    34 // ************************************************************************** //
       
    35 // **************                   framework                  ************** //
       
    36 // ************************************************************************** //
       
    37 
       
    38 namespace framework {
       
    39 
       
    40 // initialization
       
    41 BOOST_TEST_DECL void    init( int argc, char* argv[] );
       
    42 
       
    43 // mutation access methods
       
    44 BOOST_TEST_DECL void    register_test_unit( test_case* tc );
       
    45 BOOST_TEST_DECL void    register_test_unit( test_suite* ts );
       
    46 
       
    47 BOOST_TEST_DECL void    register_observer( test_observer& );
       
    48 BOOST_TEST_DECL void    deregister_observer( test_observer& );
       
    49 BOOST_TEST_DECL void    reset_observers();
       
    50 
       
    51 BOOST_TEST_DECL master_test_suite_t& master_test_suite();
       
    52 
       
    53 // constant access methods
       
    54 BOOST_TEST_DECL test_case const&    current_test_case();
       
    55 #if BOOST_WORKAROUND(__SUNPRO_CC, BOOST_TESTED_AT(0x530) )
       
    56 template<typename UnitType>
       
    57 UnitType const&         get( test_unit_id id )
       
    58 {
       
    59     return static_cast<UnitType const&>( get( id, (test_unit_type)UnitType::type ) );
       
    60 }
       
    61 test_unit const&        get( test_unit_id, test_unit_type );
       
    62 #else
       
    63 test_unit const&        get( test_unit_id, test_unit_type );
       
    64 template<typename UnitType>
       
    65 UnitType const&         get( test_unit_id id )
       
    66 {
       
    67     return static_cast<UnitType const&>( get( id, (test_unit_type)UnitType::type ) );
       
    68 }
       
    69 #endif
       
    70 
       
    71 // test initiation
       
    72 BOOST_TEST_DECL void    run( test_unit_id = INV_TEST_UNIT_ID, bool continue_test = true );
       
    73 BOOST_TEST_DECL void    run( test_unit const*, bool continue_test = true );
       
    74 
       
    75 // public test events dispatchers
       
    76 BOOST_TEST_DECL void    assertion_result( bool passed );
       
    77 BOOST_TEST_DECL void    exception_caught( execution_exception const& );
       
    78 BOOST_TEST_DECL void    test_unit_aborted( test_unit const& );
       
    79 
       
    80 // ************************************************************************** //
       
    81 // **************                framework errors              ************** //
       
    82 // ************************************************************************** //
       
    83 
       
    84 struct internal_error : std::runtime_error {
       
    85     internal_error( const_string m ) : std::runtime_error( std::string( m.begin(), m.size() ) ) {}
       
    86 };
       
    87 
       
    88 struct setup_error : std::runtime_error {
       
    89     setup_error( const_string m ) : std::runtime_error( std::string( m.begin(), m.size() ) ) {}
       
    90 };
       
    91 
       
    92 } // namespace framework
       
    93 
       
    94 } // unit_test
       
    95 
       
    96 } // namespace boost
       
    97 
       
    98 //____________________________________________________________________________//
       
    99 
       
   100 #include <boost/test/detail/enable_warnings.hpp>
       
   101 
       
   102 // ***************************************************************************
       
   103 //  Revision History :
       
   104 //  
       
   105 //  $Log: framework.hpp,v $
       
   106 //  Revision 1.5  2006/03/19 07:27:52  rogeeff
       
   107 //  streamline test setup error message
       
   108 //
       
   109 //  Revision 1.4  2005/12/14 05:08:44  rogeeff
       
   110 //  dll support introduced
       
   111 //
       
   112 //  Revision 1.3  2005/03/24 04:02:32  rogeeff
       
   113 //  portability fixes
       
   114 //
       
   115 //  Revision 1.2  2005/03/23 21:02:10  rogeeff
       
   116 //  Sunpro CC 5.3 fixes
       
   117 //
       
   118 //  Revision 1.1  2005/02/20 08:27:05  rogeeff
       
   119 //  This a major update for Boost.Test framework. See release docs for complete list of fixes/updates
       
   120 //
       
   121 // ***************************************************************************
       
   122 
       
   123 #endif // BOOST_TEST_FRAMEWORK_HPP_020805GER
       
   124