| 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.3 $ | 
|---|
| 11 | // | 
|---|
| 12 | //  Description : defines framework singletom object | 
|---|
| 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 | //____________________________________________________________________________// | 
|---|
| 26 |  | 
|---|
| 27 | namespace boost { | 
|---|
| 28 |  | 
|---|
| 29 | namespace unit_test { | 
|---|
| 30 |  | 
|---|
| 31 | // ************************************************************************** // | 
|---|
| 32 | // **************                   framework                  ************** // | 
|---|
| 33 | // ************************************************************************** // | 
|---|
| 34 |  | 
|---|
| 35 | namespace framework { | 
|---|
| 36 |  | 
|---|
| 37 | // initialization | 
|---|
| 38 | void                init( int argc, char* argv[] ); | 
|---|
| 39 |  | 
|---|
| 40 | // mutation access methods | 
|---|
| 41 | void                register_test_unit( test_case* tc ); | 
|---|
| 42 | void                register_test_unit( test_suite* ts ); | 
|---|
| 43 |  | 
|---|
| 44 | void                register_observer( test_observer& ); | 
|---|
| 45 | void                reset_observers(); | 
|---|
| 46 |  | 
|---|
| 47 | // constant access methods | 
|---|
| 48 | test_suite const&   master_test_suite(); | 
|---|
| 49 | test_case const&    current_test_case(); | 
|---|
| 50 | #if BOOST_WORKAROUND(__SUNPRO_CC, BOOST_TESTED_AT(0x530) ) | 
|---|
| 51 | template<typename UnitType> | 
|---|
| 52 | UnitType const&     get( test_unit_id id ) | 
|---|
| 53 | { | 
|---|
| 54 |     return static_cast<UnitType const&>( get( id, (test_unit_type)UnitType::type ) ); | 
|---|
| 55 | } | 
|---|
| 56 | test_unit const&    get( test_unit_id, test_unit_type ); | 
|---|
| 57 | #else | 
|---|
| 58 | test_unit const&    get( test_unit_id, test_unit_type ); | 
|---|
| 59 | template<typename UnitType> | 
|---|
| 60 | UnitType const&     get( test_unit_id id ) | 
|---|
| 61 | { | 
|---|
| 62 |     return static_cast<UnitType const&>( get( id, (test_unit_type)UnitType::type ) ); | 
|---|
| 63 | } | 
|---|
| 64 | #endif | 
|---|
| 65 |  | 
|---|
| 66 | // test initiation | 
|---|
| 67 | void                run( test_unit_id = INV_TEST_UNIT_ID, bool continue_test = true ); | 
|---|
| 68 | void                run( test_unit const*, bool continue_test = true ); | 
|---|
| 69 |  | 
|---|
| 70 | // public test events dispatchers | 
|---|
| 71 | void                assertion_result( bool passed ); | 
|---|
| 72 | void                exception_caught( execution_exception const& ); | 
|---|
| 73 | void                test_unit_aborted(); | 
|---|
| 74 |  | 
|---|
| 75 | } // namespace framework | 
|---|
| 76 |  | 
|---|
| 77 | } // unit_test | 
|---|
| 78 |  | 
|---|
| 79 | } // namespace boost | 
|---|
| 80 |  | 
|---|
| 81 | //____________________________________________________________________________// | 
|---|
| 82 |  | 
|---|
| 83 | #include <boost/test/detail/enable_warnings.hpp> | 
|---|
| 84 |  | 
|---|
| 85 | // *************************************************************************** | 
|---|
| 86 | //  Revision History : | 
|---|
| 87 | //   | 
|---|
| 88 | //  $Log: framework.hpp,v $ | 
|---|
| 89 | //  Revision 1.3  2005/03/24 04:02:32  rogeeff | 
|---|
| 90 | //  portability fixes | 
|---|
| 91 | // | 
|---|
| 92 | //  Revision 1.2  2005/03/23 21:02:10  rogeeff | 
|---|
| 93 | //  Sunpro CC 5.3 fixes | 
|---|
| 94 | // | 
|---|
| 95 | //  Revision 1.1  2005/02/20 08:27:05  rogeeff | 
|---|
| 96 | //  This a major update for Boost.Test framework. See release docs for complete list of fixes/updates | 
|---|
| 97 | // | 
|---|
| 98 | // *************************************************************************** | 
|---|
| 99 |  | 
|---|
| 100 | #endif // BOOST_TEST_FRAMEWORK_HPP_020805GER | 
|---|
| 101 |  | 
|---|