mirror of
https://github.com/mat007/turtle.git
synced 2026-06-22 12:13:43 +00:00
Moved some components into a detail sub-directory
git-svn-id: https://svn.code.sf.net/p/turtle/code/trunk@478 860be788-9bd5-4423-9f1e-828f051e677b
This commit is contained in:
parent
dc2d66245f
commit
4a128a0221
28 changed files with 188 additions and 145 deletions
69
turtle/detail/args.hpp
Normal file
69
turtle/detail/args.hpp
Normal file
|
|
@ -0,0 +1,69 @@
|
|||
// http://turtle.sourceforge.net
|
||||
//
|
||||
// Copyright Mathieu Champlon 2010
|
||||
//
|
||||
// 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_ARGS_HPP_INCLUDED
|
||||
#define MOCK_ARGS_HPP_INCLUDED
|
||||
|
||||
#include <boost/function_types/parameter_types.hpp>
|
||||
#include <boost/function_types/function_arity.hpp>
|
||||
#include <boost/preprocessor/arithmetic/inc.hpp>
|
||||
#include <boost/mpl/at.hpp>
|
||||
|
||||
namespace mock
|
||||
{
|
||||
namespace detail
|
||||
{
|
||||
struct invalid_type
|
||||
{
|
||||
private:
|
||||
invalid_type();
|
||||
};
|
||||
|
||||
template< typename S, int n, bool B >
|
||||
struct arg_imp
|
||||
{
|
||||
typedef invalid_type type;
|
||||
};
|
||||
template< typename S, int n >
|
||||
struct arg_imp< S, n, true >
|
||||
{
|
||||
typedef BOOST_DEDUCED_TYPENAME
|
||||
boost::mpl::at_c<
|
||||
BOOST_DEDUCED_TYPENAME
|
||||
boost::function_types::parameter_types< S >,
|
||||
n - 1
|
||||
>::type type;
|
||||
};
|
||||
template< typename S, int n, int N >
|
||||
struct arg :
|
||||
arg_imp< S, n, boost::function_types::function_arity< S >::value == N >
|
||||
{
|
||||
BOOST_MPL_ASSERT_RELATION( n, >, 0 );
|
||||
BOOST_MPL_ASSERT_RELATION( n, <=, N );
|
||||
};
|
||||
}
|
||||
} // mock
|
||||
|
||||
#define MOCK_ARG(N, n, S, tpn) \
|
||||
BOOST_PP_COMMA_IF(n) tpn \
|
||||
mock::detail::arg< S, BOOST_PP_INC(n), N >::type p##n
|
||||
#define MOCK_ARG_PROXY(z, n, d) \
|
||||
MOCK_ARG( \
|
||||
BOOST_PP_ARRAY_ELEM(0, d), \
|
||||
n, \
|
||||
BOOST_PP_ARRAY_ELEM(1, d), \
|
||||
BOOST_PP_ARRAY_ELEM(2, d) )
|
||||
|
||||
#define MOCK_ARGS(n, S, tpn) \
|
||||
BOOST_PP_REPEAT(n, MOCK_ARG_PROXY, (3, (n, S, tpn)))
|
||||
|
||||
#define MOCK_DECL(M, n, S, c, tpn) \
|
||||
tpn boost::function_types::result_type< S >::type M( \
|
||||
MOCK_ARGS(n, S, tpn) ) c
|
||||
|
||||
#endif // MOCK_ARGS_HPP_INCLUDED
|
||||
51
turtle/detail/child.hpp
Normal file
51
turtle/detail/child.hpp
Normal file
|
|
@ -0,0 +1,51 @@
|
|||
// http://turtle.sourceforge.net
|
||||
//
|
||||
// Copyright Mathieu Champlon 2011
|
||||
//
|
||||
// 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_CHILD_HPP_INCLUDED
|
||||
#define MOCK_CHILD_HPP_INCLUDED
|
||||
|
||||
#include "detail/type_name.hpp"
|
||||
#include "detail/parent.hpp"
|
||||
#include <boost/test/utils/basic_cstring/basic_cstring.hpp>
|
||||
#include <boost/optional.hpp>
|
||||
#include <ostream>
|
||||
|
||||
namespace mock
|
||||
{
|
||||
namespace detail
|
||||
{
|
||||
class child
|
||||
{
|
||||
public:
|
||||
child()
|
||||
: parent_( 0 )
|
||||
{}
|
||||
void update( parent& p,
|
||||
boost::unit_test::const_string instance,
|
||||
const boost::optional< type_name >& type,
|
||||
boost::unit_test::const_string name )
|
||||
{
|
||||
if( instance != "?." || name_.empty() )
|
||||
p = parent( instance, type );
|
||||
parent_ = &p;
|
||||
name_ = name;
|
||||
}
|
||||
friend std::ostream& operator<<( std::ostream& s, const child& c )
|
||||
{
|
||||
if( c.parent_ )
|
||||
s << *c.parent_;
|
||||
return s << c.name_;
|
||||
}
|
||||
private:
|
||||
const parent* parent_;
|
||||
boost::unit_test::const_string name_;
|
||||
};
|
||||
}
|
||||
} // mock
|
||||
|
||||
#endif // MOCK_CHILD_HPP_INCLUDED
|
||||
43
turtle/detail/context.hpp
Normal file
43
turtle/detail/context.hpp
Normal file
|
|
@ -0,0 +1,43 @@
|
|||
// http://turtle.sourceforge.net
|
||||
//
|
||||
// Copyright Mathieu Champlon 2011
|
||||
//
|
||||
// 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_CONTEXT_HPP_INCLUDED
|
||||
#define MOCK_CONTEXT_HPP_INCLUDED
|
||||
|
||||
#include "detail/type_name.hpp"
|
||||
#include <boost/noncopyable.hpp>
|
||||
#include <boost/optional.hpp>
|
||||
#include <boost/test/utils/basic_cstring/basic_cstring.hpp>
|
||||
#include <ostream>
|
||||
|
||||
namespace mock
|
||||
{
|
||||
namespace detail
|
||||
{
|
||||
class verifiable;
|
||||
|
||||
class context : boost::noncopyable
|
||||
{
|
||||
public:
|
||||
context() {}
|
||||
virtual ~context() {}
|
||||
|
||||
virtual void add( const void* p, verifiable& v,
|
||||
boost::unit_test::const_string instance,
|
||||
const boost::optional< type_name >& type,
|
||||
boost::unit_test::const_string name ) = 0;
|
||||
virtual void add( verifiable& v ) = 0;
|
||||
virtual void remove( verifiable& v ) = 0;
|
||||
|
||||
virtual void serialize( std::ostream& s,
|
||||
const verifiable& v ) const = 0;
|
||||
};
|
||||
}
|
||||
} // mock
|
||||
|
||||
#endif // MOCK_CONTEXT_HPP_INCLUDED
|
||||
64
turtle/detail/group.hpp
Normal file
64
turtle/detail/group.hpp
Normal file
|
|
@ -0,0 +1,64 @@
|
|||
// http://turtle.sourceforge.net
|
||||
//
|
||||
// Copyright Mathieu Champlon 2011
|
||||
//
|
||||
// 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_GROUP_HPP_INCLUDED
|
||||
#define MOCK_GROUP_HPP_INCLUDED
|
||||
|
||||
#include "detail/verifiable.hpp"
|
||||
#include <functional>
|
||||
#include <algorithm>
|
||||
#include <vector>
|
||||
|
||||
namespace mock
|
||||
{
|
||||
namespace detail
|
||||
{
|
||||
class group
|
||||
{
|
||||
public:
|
||||
void add( verifiable& v )
|
||||
{
|
||||
verifiables_.push_back( &v );
|
||||
}
|
||||
void remove( verifiable& v )
|
||||
{
|
||||
verifiables_.erase(
|
||||
std::remove( verifiables_.begin(), verifiables_.end(), &v ),
|
||||
verifiables_.end() );
|
||||
}
|
||||
|
||||
bool verify() const
|
||||
{
|
||||
bool valid = true;
|
||||
for( verifiables_cit it = verifiables_.begin();
|
||||
it != verifiables_.end(); ++it )
|
||||
if( ! (*it)->verify() )
|
||||
valid = false;
|
||||
return valid;
|
||||
}
|
||||
void reset()
|
||||
{
|
||||
const verifiables_t verifiables = verifiables_;
|
||||
for( verifiables_cit it = verifiables.begin();
|
||||
it != verifiables.end(); ++it )
|
||||
if( std::find( verifiables_.begin(), verifiables_.end(), *it )
|
||||
!= verifiables_.end() )
|
||||
(*it)->reset();
|
||||
}
|
||||
|
||||
private:
|
||||
typedef std::vector< verifiable* > verifiables_t;
|
||||
typedef verifiables_t::iterator verifiables_it;
|
||||
typedef verifiables_t::const_iterator verifiables_cit;
|
||||
|
||||
verifiables_t verifiables_;
|
||||
};
|
||||
}
|
||||
} // mock
|
||||
|
||||
#endif // MOCK_GROUP_HPP_INCLUDED
|
||||
78
turtle/detail/lambda.hpp
Normal file
78
turtle/detail/lambda.hpp
Normal file
|
|
@ -0,0 +1,78 @@
|
|||
// http://turtle.sourceforge.net
|
||||
//
|
||||
// Copyright Mathieu Champlon 2011
|
||||
//
|
||||
// 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_LAMBDA_HPP_INCLUDED
|
||||
#define MOCK_LAMBDA_HPP_INCLUDED
|
||||
|
||||
#include "../config.hpp"
|
||||
#ifdef MOCK_USE_BOOST_PHOENIX
|
||||
#include <boost/spirit/home/phoenix/bind.hpp>
|
||||
#else
|
||||
#include <boost/bind.hpp>
|
||||
#endif
|
||||
#include <boost/function.hpp>
|
||||
|
||||
namespace mock
|
||||
{
|
||||
namespace detail
|
||||
{
|
||||
#ifdef MOCK_USE_BOOST_PHOENIX
|
||||
using boost::phoenix::bind;
|
||||
#else
|
||||
using boost::bind;
|
||||
#endif
|
||||
|
||||
template< typename Result, typename Signature >
|
||||
struct lambda
|
||||
{
|
||||
typedef BOOST_DEDUCED_TYPENAME
|
||||
boost::function< Signature > functor_type;
|
||||
|
||||
template< typename T >
|
||||
static functor_type make_val( T t )
|
||||
{
|
||||
return mock::detail::bind( &do_identity< T >, t );
|
||||
}
|
||||
template< typename T >
|
||||
static functor_type make_val( boost::reference_wrapper< T > t )
|
||||
{
|
||||
return mock::detail::bind(
|
||||
&do_ref_identity< T >, t.get_pointer() );
|
||||
}
|
||||
template< typename T >
|
||||
static functor_type make_throw( T t )
|
||||
{
|
||||
return mock::detail::bind( &do_throw< T >, t );
|
||||
}
|
||||
static functor_type make_nothing()
|
||||
{
|
||||
return mock::detail::bind( &do_nothing );
|
||||
}
|
||||
|
||||
template< typename T >
|
||||
static T do_identity( T t )
|
||||
{
|
||||
return t;
|
||||
}
|
||||
template< typename T >
|
||||
static T& do_ref_identity( T* t )
|
||||
{
|
||||
return *t;
|
||||
}
|
||||
template< typename T >
|
||||
static Result do_throw( T t )
|
||||
{
|
||||
throw t;
|
||||
}
|
||||
static void do_nothing()
|
||||
{}
|
||||
};
|
||||
}
|
||||
} // mock
|
||||
|
||||
#endif // MOCK_LAMBDA_HPP_INCLUDED
|
||||
45
turtle/detail/parent.hpp
Normal file
45
turtle/detail/parent.hpp
Normal file
|
|
@ -0,0 +1,45 @@
|
|||
// http://turtle.sourceforge.net
|
||||
//
|
||||
// Copyright Mathieu Champlon 2011
|
||||
//
|
||||
// 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_PARENT_HPP_INCLUDED
|
||||
#define MOCK_PARENT_HPP_INCLUDED
|
||||
|
||||
#include "detail/type_name.hpp"
|
||||
#include <boost/optional.hpp>
|
||||
#include <boost/test/utils/basic_cstring/io.hpp>
|
||||
#include <ostream>
|
||||
|
||||
namespace mock
|
||||
{
|
||||
namespace detail
|
||||
{
|
||||
class parent
|
||||
{
|
||||
public:
|
||||
parent()
|
||||
{}
|
||||
parent( boost::unit_test::const_string instance,
|
||||
const boost::optional< type_name >& type )
|
||||
: instance_( instance )
|
||||
, type_( type )
|
||||
{}
|
||||
friend std::ostream& operator<<( std::ostream& s, const parent& p )
|
||||
{
|
||||
s << p.instance_;
|
||||
if( p.type_ )
|
||||
s << *p.type_ << "::";
|
||||
return s;
|
||||
}
|
||||
private:
|
||||
boost::unit_test::const_string instance_;
|
||||
boost::optional< type_name > type_;
|
||||
};
|
||||
}
|
||||
} // mock
|
||||
|
||||
#endif // MOCK_PARENT_HPP_INCLUDED
|
||||
140
turtle/detail/root.hpp
Normal file
140
turtle/detail/root.hpp
Normal file
|
|
@ -0,0 +1,140 @@
|
|||
// http://turtle.sourceforge.net
|
||||
//
|
||||
// Copyright Mathieu Champlon 2008
|
||||
//
|
||||
// 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_ROOT_HPP_INCLUDED
|
||||
#define MOCK_ROOT_HPP_INCLUDED
|
||||
|
||||
#include "detail/parent.hpp"
|
||||
#include "detail/group.hpp"
|
||||
#include "detail/context.hpp"
|
||||
#include "detail/child.hpp"
|
||||
#include <boost/test/utils/trivial_singleton.hpp>
|
||||
#include <ostream>
|
||||
#include <map>
|
||||
|
||||
namespace mock
|
||||
{
|
||||
namespace detail
|
||||
{
|
||||
class root_t : public boost::unit_test::singleton< root_t >,
|
||||
public detail::context
|
||||
{
|
||||
public:
|
||||
virtual void add( const void* p, verifiable& v,
|
||||
boost::unit_test::const_string instance,
|
||||
const boost::optional< type_name >& type,
|
||||
boost::unit_test::const_string name )
|
||||
{
|
||||
children_it it = children_.lower_bound( &v );
|
||||
if( it == children_.end() ||
|
||||
children_.key_comp()( &v, it->first ) )
|
||||
it = children_.insert( it,
|
||||
std::make_pair( &v, counter_child( parents_, p ) ) );
|
||||
it->second.update( instance, type, name );
|
||||
}
|
||||
virtual void add( verifiable& v )
|
||||
{
|
||||
group_.add( v );
|
||||
}
|
||||
|
||||
virtual void remove( verifiable& v )
|
||||
{
|
||||
group_.remove( v );
|
||||
children_.erase( &v );
|
||||
}
|
||||
|
||||
bool verify() const
|
||||
{
|
||||
return group_.verify();
|
||||
}
|
||||
void reset()
|
||||
{
|
||||
group_.reset();
|
||||
}
|
||||
|
||||
virtual void serialize( std::ostream& s, const verifiable& v ) const
|
||||
{
|
||||
children_cit it = children_.find( &v );
|
||||
if( it != children_.end() )
|
||||
s << it->second;
|
||||
else
|
||||
s << "?";
|
||||
}
|
||||
|
||||
private:
|
||||
typedef std::map< const void*,
|
||||
std::pair< parent, std::size_t > > parents_t;
|
||||
typedef parents_t::iterator parents_it;
|
||||
|
||||
class counter_child
|
||||
{
|
||||
public:
|
||||
counter_child( parents_t& parents, const void* p )
|
||||
: parents_( &parents )
|
||||
, it_( parents.insert(
|
||||
std::make_pair( p, parents_t::mapped_type() ) ).first )
|
||||
{
|
||||
++it_->second.second;
|
||||
}
|
||||
counter_child( const counter_child& rhs )
|
||||
: parents_( rhs.parents_ )
|
||||
, it_( rhs.it_ )
|
||||
, child_( rhs.child_ )
|
||||
{
|
||||
++it_->second.second;
|
||||
}
|
||||
~counter_child()
|
||||
{
|
||||
if( --it_->second.second == 0 )
|
||||
parents_->erase( it_ );
|
||||
}
|
||||
void update( boost::unit_test::const_string instance,
|
||||
const boost::optional< type_name >& type,
|
||||
boost::unit_test::const_string name )
|
||||
{
|
||||
child_.update( it_->second.first, instance, type, name );
|
||||
}
|
||||
friend std::ostream& operator<<( std::ostream& s,
|
||||
const counter_child& c )
|
||||
{
|
||||
return s << c.child_;
|
||||
}
|
||||
|
||||
private:
|
||||
counter_child& operator=( const counter_child& );
|
||||
|
||||
parents_t* parents_;
|
||||
parents_it it_;
|
||||
child child_;
|
||||
};
|
||||
|
||||
typedef std::map< const verifiable*, counter_child > children_t;
|
||||
typedef children_t::const_iterator children_cit;
|
||||
typedef children_t::iterator children_it;
|
||||
|
||||
parents_t parents_;
|
||||
children_t children_;
|
||||
group group_;
|
||||
|
||||
private:
|
||||
BOOST_TEST_SINGLETON_CONS( root_t );
|
||||
};
|
||||
BOOST_TEST_SINGLETON_INST( root )
|
||||
}
|
||||
|
||||
inline bool verify()
|
||||
{
|
||||
return mock::detail::root.verify();
|
||||
}
|
||||
inline void reset()
|
||||
{
|
||||
mock::detail::root.reset();
|
||||
}
|
||||
} // mock
|
||||
|
||||
#endif // MOCK_ROOT_HPP_INCLUDED
|
||||
62
turtle/detail/signature.hpp
Normal file
62
turtle/detail/signature.hpp
Normal file
|
|
@ -0,0 +1,62 @@
|
|||
// 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_SIGNATURE_HPP_INCLUDED
|
||||
#define MOCK_SIGNATURE_HPP_INCLUDED
|
||||
|
||||
#include <boost/function_types/parameter_types.hpp>
|
||||
#include <boost/function_types/function_type.hpp>
|
||||
#include <boost/function_types/result_type.hpp>
|
||||
#include <boost/mpl/single_view.hpp>
|
||||
#include <boost/mpl/joint_view.hpp>
|
||||
#include <boost/mpl/pop_front.hpp>
|
||||
#define BOOST_TYPEOF_SILENT
|
||||
#include <boost/typeof/typeof.hpp>
|
||||
|
||||
namespace mock
|
||||
{
|
||||
namespace detail
|
||||
{
|
||||
template< typename M >
|
||||
struct signature :
|
||||
boost::function_types::function_type<
|
||||
boost::mpl::joint_view<
|
||||
boost::mpl::single_view<
|
||||
BOOST_DEDUCED_TYPENAME
|
||||
boost::function_types::result_type< M >::type
|
||||
>,
|
||||
BOOST_DEDUCED_TYPENAME boost::mpl::pop_front<
|
||||
BOOST_DEDUCED_TYPENAME
|
||||
boost::function_types::parameter_types< M >
|
||||
>::type
|
||||
>
|
||||
>
|
||||
{};
|
||||
|
||||
template< typename T >
|
||||
struct base
|
||||
{
|
||||
typedef T base_type;
|
||||
};
|
||||
}
|
||||
|
||||
// if an error is generated by the line below it means
|
||||
// the method is ambiguous : use MOCK_METHOD_EXT instead
|
||||
template< typename T >
|
||||
T& ambiguous_method_name_use_MOCK_METHOD_EXT_instead( const T& );
|
||||
|
||||
} // mock
|
||||
|
||||
#define MOCK_SIGNATURE(M) \
|
||||
mock::detail::signature< \
|
||||
BOOST_TYPEOF( \
|
||||
mock::ambiguous_method_name_use_MOCK_METHOD_EXT_instead( \
|
||||
&base_type::M ) ) \
|
||||
>::type
|
||||
|
||||
#endif // MOCK_SIGNATURE_HPP_INCLUDED
|
||||
85
turtle/detail/type_name.hpp
Normal file
85
turtle/detail/type_name.hpp
Normal file
|
|
@ -0,0 +1,85 @@
|
|||
// http://turtle.sourceforge.net
|
||||
//
|
||||
// Copyright Mathieu Champlon 2009
|
||||
//
|
||||
// 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_TYPE_NAME_HPP_INCLUDED
|
||||
#define MOCK_TYPE_NAME_HPP_INCLUDED
|
||||
|
||||
#include <boost/test/utils/basic_cstring/io.hpp>
|
||||
#include <stdexcept>
|
||||
#include <typeinfo>
|
||||
#include <ostream>
|
||||
#ifdef __GNUC__
|
||||
#include <cxxabi.h>
|
||||
#include <cstdlib>
|
||||
#endif
|
||||
|
||||
namespace mock
|
||||
{
|
||||
namespace detail
|
||||
{
|
||||
class type_name
|
||||
{
|
||||
public:
|
||||
explicit type_name( const std::type_info& info )
|
||||
: info_( &info )
|
||||
{}
|
||||
friend std::ostream& operator<<( std::ostream& s, const type_name& t )
|
||||
{
|
||||
t.serialize( s, *t.info_ );
|
||||
return s;
|
||||
}
|
||||
private:
|
||||
void serialize( std::ostream& s, const std::type_info& info ) const
|
||||
{
|
||||
const char* name = info.name();
|
||||
#ifdef __GNUC__
|
||||
size_t size = 0;
|
||||
int status = 0;
|
||||
char* result = abi::__cxa_demangle( name, NULL, &size, &status );
|
||||
struct guard
|
||||
{
|
||||
explicit guard( char* p )
|
||||
: p_( p )
|
||||
{}
|
||||
~guard()
|
||||
{
|
||||
free( p_ );
|
||||
}
|
||||
private:
|
||||
char* p_;
|
||||
} g( result );
|
||||
if( result )
|
||||
serialize( s, result );
|
||||
else
|
||||
#endif
|
||||
serialize( s, name );
|
||||
}
|
||||
void serialize( std::ostream& s,
|
||||
boost::unit_test::const_string name ) const
|
||||
{
|
||||
boost::unit_test::const_string::size_type p = name.rfind( "::" );
|
||||
if( p != boost::unit_test::const_string::npos )
|
||||
{
|
||||
s << name.substr( p + 2 );
|
||||
return;
|
||||
}
|
||||
p = name.rfind( " " );
|
||||
if( p != boost::unit_test::const_string::npos )
|
||||
{
|
||||
s << name.substr( p + 1 );
|
||||
return;
|
||||
}
|
||||
s << name;
|
||||
}
|
||||
|
||||
const std::type_info* info_;
|
||||
};
|
||||
}
|
||||
} // mock
|
||||
|
||||
#endif // MOCK_TYPE_NAME_HPP_INCLUDED
|
||||
31
turtle/detail/verifiable.hpp
Normal file
31
turtle/detail/verifiable.hpp
Normal file
|
|
@ -0,0 +1,31 @@
|
|||
// http://turtle.sourceforge.net
|
||||
//
|
||||
// Copyright Mathieu Champlon 2008
|
||||
//
|
||||
// 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_VERIFIABLE_HPP_INCLUDED
|
||||
#define MOCK_VERIFIABLE_HPP_INCLUDED
|
||||
|
||||
#include <boost/noncopyable.hpp>
|
||||
|
||||
namespace mock
|
||||
{
|
||||
namespace detail
|
||||
{
|
||||
class verifiable : private boost::noncopyable
|
||||
{
|
||||
public:
|
||||
verifiable() {}
|
||||
virtual ~verifiable() {}
|
||||
|
||||
virtual bool verify() const = 0;
|
||||
|
||||
virtual void reset() = 0;
|
||||
};
|
||||
}
|
||||
} // mock
|
||||
|
||||
#endif // MOCK_VERIFIABLE_HPP_INCLUDED
|
||||
31
turtle/detail/yes_no_type.hpp
Normal file
31
turtle/detail/yes_no_type.hpp
Normal file
|
|
@ -0,0 +1,31 @@
|
|||
// http://turtle.sourceforge.net
|
||||
//
|
||||
// Copyright Mathieu Champlon 2011
|
||||
//
|
||||
// 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_YES_NO_TYPE_HPP_INCLUDED
|
||||
#define MOCK_YES_NO_TYPE_HPP_INCLUDED
|
||||
|
||||
#include <boost/static_assert.hpp>
|
||||
|
||||
namespace mock
|
||||
{
|
||||
namespace detail
|
||||
{
|
||||
typedef char no_type;
|
||||
struct yes_type
|
||||
{
|
||||
char no_type[2];
|
||||
};
|
||||
BOOST_STATIC_ASSERT( sizeof( yes_type ) != sizeof( no_type ) );
|
||||
|
||||
template< typename T > void operator,( yes_type, const T& );
|
||||
no_type operator,( yes_type, yes_type );
|
||||
no_type operator,( no_type, yes_type );
|
||||
}
|
||||
} // mock
|
||||
|
||||
#endif // MOCK_YES_NO_TYPE_HPP_INCLUDED
|
||||
Loading…
Add table
Add a link
Reference in a new issue