blob: 03ee9be9eabcbba23e86276b3ddd52a71878b731 [file] [log] [blame]
Jeff Thompsonef2d5a42013-08-22 19:09:24 -07001// (C) Copyright Gennadiy Rozental 2005-2008.
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$
9//
10// Version : $Revision: 54633 $
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 <ndnboost/test/detail/config.hpp>
20
21#if BOOST_TEST_SUPPORT_INTERACTION_TESTING
22
23// Boost.Test
24#include <ndnboost/test/detail/config.hpp>
25#include <ndnboost/test/utils/callback.hpp>
26#include <ndnboost/test/interaction_based.hpp>
27#include <ndnboost/test/mock_object.hpp>
28#include <ndnboost/test/framework.hpp> // for setup_error
29
30#include <ndnboost/test/detail/suppress_warnings.hpp>
31
32// STL
33#include <stdexcept>
34#include <string>
35
36//____________________________________________________________________________//
37
38namespace ndnboost {
39
40namespace itest { // interaction-based testing
41
42// ************************************************************************** //
43// ************** manager ************** //
44// ************************************************************************** //
45
46manager::manager()
47{
48 instance_ptr( true, this );
49}
50
51//____________________________________________________________________________//
52
53manager::~manager()
54{
55 instance_ptr( true );
56}
57
58//____________________________________________________________________________//
59
60manager*
61manager::instance_ptr( bool reset, manager* new_ptr )
62{
63 static manager dummy( 0 );
64
65 static manager* ptr = &dummy;
66
67 if( reset ) {
68 if( new_ptr ) {
69 BOOST_TEST_SETUP_ASSERT( ptr == &dummy, BOOST_TEST_L( "Can't run two interation based test the same time" ) );
70
71 ptr = new_ptr;
72 }
73 else
74 ptr = &dummy;
75 }
76
77 return ptr;
78}
79
80} // namespace itest
81
82} // namespace ndnboost
83
84//____________________________________________________________________________//
85
86#include <ndnboost/test/detail/enable_warnings.hpp>
87
88#endif // not ancient compiler
89
90#endif // BOOST_TEST_INTERACTION_BASED_IPP_112105GER