diff --git a/build/vc100/turtle.vcxproj b/build/vc100/turtle.vcxproj
index 23e6a1c..0a321cb 100644
--- a/build/vc100/turtle.vcxproj
+++ b/build/vc100/turtle.vcxproj
@@ -53,8 +53,10 @@
+
+
{831F2DEE-1E35-4533-A3B2-12C01BA8DA1D}
diff --git a/build/vc100/turtle.vcxproj.filters b/build/vc100/turtle.vcxproj.filters
index ecf86ac..d62fb0c 100644
--- a/build/vc100/turtle.vcxproj.filters
+++ b/build/vc100/turtle.vcxproj.filters
@@ -118,5 +118,11 @@
Source Files
+
+ Source Files
+
+
+ Source Files
+
\ No newline at end of file
diff --git a/test/test_object.cpp b/test/test_object.cpp
index cec330d..9d9e083 100644
--- a/test/test_object.cpp
+++ b/test/test_object.cpp
@@ -7,7 +7,8 @@
// http://www.boost.org/LICENSE_1_0.txt)
#include "mock_error.hpp"
-#include
+#include
+#include
#include
#include
diff --git a/turtle/detail/function.hpp b/turtle/detail/function.hpp
index 0727005..ebe958d 100644
--- a/turtle/detail/function.hpp
+++ b/turtle/detail/function.hpp
@@ -47,18 +47,4 @@
#undef BOOST_PP_FILENAME_1
#undef BOOST_PP_ITERATION_LIMITS
-namespace mock
-{
- template< typename Signature >
- bool verify( const detail::function< Signature >& f )
- {
- return f.verify();
- }
- template< typename Signature >
- void reset( detail::function< Signature >& f )
- {
- f.reset();
- }
-} // mock
-
#endif // MOCK_FUNCTION_HPP_INCLUDED
diff --git a/turtle/detail/root.hpp b/turtle/detail/root.hpp
index aa351c9..2bac0e8 100644
--- a/turtle/detail/root.hpp
+++ b/turtle/detail/root.hpp
@@ -123,15 +123,6 @@ namespace detail
};
BOOST_TEST_SINGLETON_INST( root )
}
-
- inline bool verify()
- {
- return detail::root.verify();
- }
- inline void reset()
- {
- detail::root.reset();
- }
} // mock
#endif // MOCK_ROOT_HPP_INCLUDED
diff --git a/turtle/mock.hpp b/turtle/mock.hpp
index cf048f7..8706f71 100644
--- a/turtle/mock.hpp
+++ b/turtle/mock.hpp
@@ -11,6 +11,8 @@
#include "config.hpp"
#include "object.hpp"
+#include "reset.hpp"
+#include "verify.hpp"
#include "detail/function.hpp"
#include "detail/type_name.hpp"
#include "detail/signature.hpp"
diff --git a/turtle/object.hpp b/turtle/object.hpp
index 78d13e5..31a71e5 100644
--- a/turtle/object.hpp
+++ b/turtle/object.hpp
@@ -20,18 +20,7 @@
namespace mock
{
- class object
- {
- public:
- object()
- : impl_( new detail::object_impl() )
- {}
- protected:
- ~object()
- {}
- public:
- boost::shared_ptr< detail::object_impl > impl_;
- };
+ class object;
namespace detail
{
@@ -39,11 +28,7 @@ namespace detail
E& configure( const object& o, E& e,
boost::unit_test::const_string instance,
boost::optional< type_name > type,
- boost::unit_test::const_string name )
- {
- e.configure( *o.impl_, o.impl_.get(), instance, type, name );
- return e;
- }
+ boost::unit_test::const_string name );
template< typename T, typename E >
E& configure( const T& t, E& e,
@@ -58,14 +43,30 @@ namespace detail
return e;
}
}
- inline bool verify( const object& o )
+ class object
{
- return o.impl_->verify();
- }
- inline void reset( object& o )
- {
- o.impl_->reset();
- }
+ public:
+ object()
+ : impl_( new detail::object_impl() )
+ {}
+ protected:
+ ~object()
+ {}
+ private:
+ friend void reset( const object& o );
+ friend bool verify( const object& o );
+ template< typename E >
+ friend E& detail::configure( const object& o, E& e,
+ boost::unit_test::const_string instance,
+ boost::optional< detail::type_name > type,
+ boost::unit_test::const_string name )
+ {
+ e.configure( *o.impl_, o.impl_.get(), instance, type, name );
+ return e;
+ }
+ private:
+ boost::shared_ptr< detail::object_impl > impl_;
+ };
} // mock
#endif // MOCK_OBJECT_HPP_INCLUDED
diff --git a/turtle/reset.hpp b/turtle/reset.hpp
new file mode 100644
index 0000000..ddf9a7d
--- /dev/null
+++ b/turtle/reset.hpp
@@ -0,0 +1,33 @@
+// http://turtle.sourceforge.net
+//
+// Copyright Mathieu Champlon 2012
+//
+// Distributed under the Boost Software License, Version 1.0.
+// (See accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+
+#ifndef MOCK_RESET_HPP_INCLUDED
+#define MOCK_RESET_HPP_INCLUDED
+
+#include "object.hpp"
+#include "detail/root.hpp"
+#include "detail/function.hpp"
+
+namespace mock
+{
+ inline void reset()
+ {
+ detail::root.reset();
+ }
+ inline void reset( const object& o )
+ {
+ o.impl_->reset();
+ }
+ template< typename Signature >
+ void reset( detail::function< Signature >& f )
+ {
+ f.reset();
+ }
+} // mock
+
+#endif // MOCK_RESET_HPP_INCLUDED
diff --git a/turtle/verify.hpp b/turtle/verify.hpp
new file mode 100644
index 0000000..060e9a8
--- /dev/null
+++ b/turtle/verify.hpp
@@ -0,0 +1,33 @@
+// http://turtle.sourceforge.net
+//
+// Copyright Mathieu Champlon 2012
+//
+// Distributed under the Boost Software License, Version 1.0.
+// (See accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+
+#ifndef MOCK_VERIFY_HPP_INCLUDED
+#define MOCK_VERIFY_HPP_INCLUDED
+
+#include "object.hpp"
+#include "detail/root.hpp"
+#include "detail/function.hpp"
+
+namespace mock
+{
+ inline bool verify()
+ {
+ return detail::root.verify();
+ }
+ inline bool verify( const object& o )
+ {
+ return o.impl_->verify();
+ }
+ template< typename Signature >
+ bool verify( const detail::function< Signature >& f )
+ {
+ return f.verify();
+ }
+} // mock
+
+#endif // MOCK_VERIFY_HPP_INCLUDED