blob: 2d12fae20c7236ef12931008c164a9862da3038d [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
Jeff Thompson3d613fd2013-10-15 15:39:04 -070015#ifndef NDNBOOST_TEST_INTERACTION_BASED_IPP_112105GER
16#define NDNBOOST_TEST_INTERACTION_BASED_IPP_112105GER
Jeff Thompsonef2d5a42013-08-22 19:09:24 -070017
18// Boost.Test
19#include <ndnboost/test/detail/config.hpp>
20
Jeff Thompson3d613fd2013-10-15 15:39:04 -070021#if NDNBOOST_TEST_SUPPORT_INTERACTION_TESTING
Jeff Thompsonef2d5a42013-08-22 19:09:24 -070022
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 ) {
Jeff Thompson3d613fd2013-10-15 15:39:04 -070069 NDNBOOST_TEST_SETUP_ASSERT( ptr == &dummy, NDNBOOST_TEST_L( "Can't run two interation based test the same time" ) );
Jeff Thompsonef2d5a42013-08-22 19:09:24 -070070
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
Jeff Thompson3d613fd2013-10-15 15:39:04 -070090#endif // NDNBOOST_TEST_INTERACTION_BASED_IPP_112105GER