git-svn-id: https://svn.code.sf.net/p/turtle/code/trunk@337 860be788-9bd5-4423-9f1e-828f051e677b
This commit is contained in:
mat007 2011-05-19 14:47:07 +00:00
parent 92019d62b0
commit 90cd7f7bd8
4 changed files with 14 additions and 11 deletions

View file

@ -197,7 +197,7 @@ namespace mock
expectation_type& expect() expectation_type& expect()
{ {
if( ! parent_ ) if( ! parent_ )
set_parent( root ); set_parent( mock::detail::root );
expectations_.push_back( expectation_type() ); expectations_.push_back( expectation_type() );
valid_ = true; valid_ = true;
return expectations_.back(); return expectations_.back();

View file

@ -35,13 +35,13 @@ namespace mock
return name_; return name_;
} }
void add( verifiable& e ) void add( verifiable& v )
{ {
v_.push_back( &e ); v_.push_back( &v );
} }
void remove( verifiable& e ) void remove( verifiable& v )
{ {
v_.erase( std::remove( v_.begin(), v_.end(), &e ), v_.end() ); v_.erase( std::remove( v_.begin(), v_.end(), &v ), v_.end() );
} }
virtual bool verify() const virtual bool verify() const

View file

@ -59,13 +59,13 @@ namespace mock
{ {
if( ! parent_ ) if( ! parent_ )
{ {
root.add( *this ); mock::detail::root.add( *this );
parent_ = &root; parent_ = &mock::detail::root;
} }
t.set_parent( *this ); t.set_parent( *this );
} }
protected: private:
virtual void untie() virtual void untie()
{ {
parent_ = 0; parent_ = 0;

View file

@ -14,24 +14,27 @@
#include <boost/test/utils/trivial_singleton.hpp> #include <boost/test/utils/trivial_singleton.hpp>
namespace mock namespace mock
{
namespace detail
{ {
class root_t : public boost::unit_test::singleton< root_t >, public node class root_t : public boost::unit_test::singleton< root_t >, public node
{ {
protected: private:
virtual void untie() virtual void untie()
{} {}
private: private:
BOOST_TEST_SINGLETON_CONS( root_t ); BOOST_TEST_SINGLETON_CONS( root_t );
}; };
BOOST_TEST_SINGLETON_INST( root ) BOOST_TEST_SINGLETON_INST( root )
}
inline bool verify() inline bool verify()
{ {
return root.verify(); return mock::detail::root.verify();
} }
inline void reset() inline void reset()
{ {
root.reset(); mock::detail::root.reset();
} }
} }