sl@0: // (C) Copyright Gennadiy Rozental 2005. sl@0: // Distributed under the Boost Software License, Version 1.0. sl@0: // (See accompanying file LICENSE_1_0.txt or copy at sl@0: // http://www.boost.org/LICENSE_1_0.txt) sl@0: sl@0: // See http://www.boost.org/libs/test for the library home page. sl@0: // sl@0: // File : $RCSfile: framework.hpp,v $ sl@0: // sl@0: // Version : $Revision: 1.5 $ sl@0: // sl@0: // Description : defines framework interface sl@0: // *************************************************************************** sl@0: sl@0: #ifndef BOOST_TEST_FRAMEWORK_HPP_020805GER sl@0: #define BOOST_TEST_FRAMEWORK_HPP_020805GER sl@0: sl@0: // Boost.Test sl@0: #include sl@0: #include sl@0: #include sl@0: sl@0: #include sl@0: sl@0: // STL sl@0: #include sl@0: sl@0: //____________________________________________________________________________// sl@0: sl@0: namespace boost { sl@0: sl@0: namespace unit_test { sl@0: sl@0: // ************************************************************************** // sl@0: // ************** framework ************** // sl@0: // ************************************************************************** // sl@0: sl@0: namespace framework { sl@0: sl@0: // initialization sl@0: BOOST_TEST_DECL void init( int argc, char* argv[] ); sl@0: sl@0: // mutation access methods sl@0: BOOST_TEST_DECL void register_test_unit( test_case* tc ); sl@0: BOOST_TEST_DECL void register_test_unit( test_suite* ts ); sl@0: sl@0: BOOST_TEST_DECL void register_observer( test_observer& ); sl@0: BOOST_TEST_DECL void deregister_observer( test_observer& ); sl@0: BOOST_TEST_DECL void reset_observers(); sl@0: sl@0: BOOST_TEST_DECL master_test_suite_t& master_test_suite(); sl@0: sl@0: // constant access methods sl@0: BOOST_TEST_DECL test_case const& current_test_case(); sl@0: #if BOOST_WORKAROUND(__SUNPRO_CC, BOOST_TESTED_AT(0x530) ) sl@0: template sl@0: UnitType const& get( test_unit_id id ) sl@0: { sl@0: return static_cast( get( id, (test_unit_type)UnitType::type ) ); sl@0: } sl@0: test_unit const& get( test_unit_id, test_unit_type ); sl@0: #else sl@0: test_unit const& get( test_unit_id, test_unit_type ); sl@0: template sl@0: UnitType const& get( test_unit_id id ) sl@0: { sl@0: return static_cast( get( id, (test_unit_type)UnitType::type ) ); sl@0: } sl@0: #endif sl@0: sl@0: // test initiation sl@0: BOOST_TEST_DECL void run( test_unit_id = INV_TEST_UNIT_ID, bool continue_test = true ); sl@0: BOOST_TEST_DECL void run( test_unit const*, bool continue_test = true ); sl@0: sl@0: // public test events dispatchers sl@0: BOOST_TEST_DECL void assertion_result( bool passed ); sl@0: BOOST_TEST_DECL void exception_caught( execution_exception const& ); sl@0: BOOST_TEST_DECL void test_unit_aborted( test_unit const& ); sl@0: sl@0: // ************************************************************************** // sl@0: // ************** framework errors ************** // sl@0: // ************************************************************************** // sl@0: sl@0: struct internal_error : std::runtime_error { sl@0: internal_error( const_string m ) : std::runtime_error( std::string( m.begin(), m.size() ) ) {} sl@0: }; sl@0: sl@0: struct setup_error : std::runtime_error { sl@0: setup_error( const_string m ) : std::runtime_error( std::string( m.begin(), m.size() ) ) {} sl@0: }; sl@0: sl@0: } // namespace framework sl@0: sl@0: } // unit_test sl@0: sl@0: } // namespace boost sl@0: sl@0: //____________________________________________________________________________// sl@0: sl@0: #include sl@0: sl@0: // *************************************************************************** sl@0: // Revision History : sl@0: // sl@0: // $Log: framework.hpp,v $ sl@0: // Revision 1.5 2006/03/19 07:27:52 rogeeff sl@0: // streamline test setup error message sl@0: // sl@0: // Revision 1.4 2005/12/14 05:08:44 rogeeff sl@0: // dll support introduced sl@0: // sl@0: // Revision 1.3 2005/03/24 04:02:32 rogeeff sl@0: // portability fixes sl@0: // sl@0: // Revision 1.2 2005/03/23 21:02:10 rogeeff sl@0: // Sunpro CC 5.3 fixes sl@0: // sl@0: // Revision 1.1 2005/02/20 08:27:05 rogeeff sl@0: // This a major update for Boost.Test framework. See release docs for complete list of fixes/updates sl@0: // sl@0: // *************************************************************************** sl@0: sl@0: #endif // BOOST_TEST_FRAMEWORK_HPP_020805GER sl@0: