Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: downloads/boost_1_34_1/boost/test/impl/interaction_based.ipp @ 44

Last change on this file since 44 was 29, checked in by landauf, 16 years ago

updated boost from 1_33_1 to 1_34_1

File size: 3.5 KB
Line 
1//  (C) Copyright Gennadiy Rozental 2005.
2//  Use, modification, and distribution are subject to the
3//  Boost Software License, Version 1.0. (See accompanying file
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: interaction_based.ipp,v $
9//
10//  Version     : $Revision: 1.7 $
11//
12//  Description : Facilities to perform interaction-based testing
13// ***************************************************************************
14
15#ifndef BOOST_TEST_INTERACTION_BASED_IPP_112105GER
16#define BOOST_TEST_INTERACTION_BASED_IPP_112105GER
17
18// Boost.Test
19#include <boost/test/detail/config.hpp>
20
21#if !BOOST_WORKAROUND(__GNUC__, < 3) && \
22    !BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x564)) && \
23    !BOOST_WORKAROUND(BOOST_MSVC, <1310) && \
24    !BOOST_WORKAROUND(__SUNPRO_CC, BOOST_TESTED_AT(0x530))
25
26// Boost.Test
27#include <boost/test/detail/config.hpp>
28#include <boost/test/utils/callback.hpp>
29#include <boost/test/interaction_based.hpp>
30#include <boost/test/mock_object.hpp>
31#include <boost/test/framework.hpp>     // for setup_error
32
33#include <boost/test/detail/suppress_warnings.hpp>
34
35// STL
36#include <stdexcept>
37#include <string>
38
39//____________________________________________________________________________//
40
41namespace boost {
42
43namespace itest { // interaction-based testing
44
45// ************************************************************************** //
46// **************                    manager                   ************** //
47// ************************************************************************** //
48
49manager::manager()
50{
51    instance_ptr( true, this );
52}
53
54//____________________________________________________________________________//
55
56manager::~manager()
57{
58    instance_ptr( true );
59}
60
61//____________________________________________________________________________//
62   
63manager*
64manager::instance_ptr( bool reset, manager* new_ptr )
65{
66    static manager dummy( 0 );
67   
68    static manager* ptr = &dummy;
69   
70    if( reset ) {
71        if( new_ptr ) {
72            if( ptr != &dummy )
73                throw unit_test::framework::setup_error( BOOST_TEST_L( "Couldn't run two interation based test the same time" ) );
74               
75            ptr = new_ptr;
76        }
77        else
78            ptr = &dummy;
79    }
80   
81    return ptr;
82}
83   
84}  // namespace itest
85
86}  // namespace boost
87
88//____________________________________________________________________________//
89
90#include <boost/test/detail/enable_warnings.hpp>
91
92#endif // not ancient compiler
93
94// ***************************************************************************
95//  Revision History :
96//
97//  $Log: interaction_based.ipp,v $
98//  Revision 1.7  2006/03/19 07:27:52  rogeeff
99//  streamline test setup error message
100//
101//  Revision 1.6  2006/02/23 15:10:00  rogeeff
102//  vc70 out
103//
104//  Revision 1.5  2006/02/22 16:13:34  rogeeff
105//  ifdef out for non supported compilers
106//
107//  Revision 1.4  2006/01/28 08:52:35  rogeeff
108//  operator new overloads made inline to:
109//  1. prevent issues with export them from DLL
110//  2. release link issue fixed
111//
112//  Revision 1.3  2006/01/15 11:14:39  rogeeff
113//  simpl_mock -> mock_object<>::prototype()
114//  operator new need to be rethinked
115//
116//  Revision 1.2  2005/12/22 15:49:32  rogeeff
117//  sunpro port
118//  made operator new conformant
119//
120//  Revision 1.1  2005/12/14 05:56:56  rogeeff
121//  Interraction based / logged expectation testing is introduced
122//
123// ***************************************************************************
124
125#endif // BOOST_TEST_INTERACTION_BASED_IPP_112105GER
Note: See TracBrowser for help on using the repository browser.