mirror of
https://github.com/mat007/turtle.git
synced 2026-06-22 12:13:43 +00:00
Cleanup
git-svn-id: https://svn.code.sf.net/p/turtle/code/trunk@581 860be788-9bd5-4423-9f1e-828f051e677b
This commit is contained in:
parent
970b9b6b7b
commit
3c0bb8e16e
8 changed files with 79 additions and 82 deletions
|
|
@ -18,9 +18,9 @@ namespace mock
|
|||
struct constraint
|
||||
{
|
||||
constraint( const Constraint& c )
|
||||
: f_( c )
|
||||
: c_( c )
|
||||
{}
|
||||
Constraint f_;
|
||||
Constraint c_;
|
||||
};
|
||||
|
||||
namespace detail
|
||||
|
|
@ -75,20 +75,20 @@ namespace detail
|
|||
class not_
|
||||
{
|
||||
public:
|
||||
explicit not_( const Constraint& f )
|
||||
: f_( f )
|
||||
explicit not_( const Constraint& c )
|
||||
: c_( c )
|
||||
{}
|
||||
template< typename Actual >
|
||||
bool operator()( const Actual& actual ) const
|
||||
{
|
||||
return ! f_( actual );
|
||||
return ! c_( actual );
|
||||
}
|
||||
friend std::ostream& operator<<( std::ostream& s, const not_& n )
|
||||
{
|
||||
return s << "! " << mock::format( n.f_ );
|
||||
return s << "! " << mock::format( n.c_ );
|
||||
}
|
||||
private:
|
||||
Constraint f_;
|
||||
Constraint c_;
|
||||
};
|
||||
}
|
||||
|
||||
|
|
@ -97,7 +97,7 @@ namespace detail
|
|||
operator||( const constraint< Constraint1 >& lhs,
|
||||
const constraint< Constraint2 >& rhs )
|
||||
{
|
||||
return detail::or_< Constraint1, Constraint2 >( lhs.f_, rhs.f_ );
|
||||
return detail::or_< Constraint1, Constraint2 >( lhs.c_, rhs.c_ );
|
||||
}
|
||||
|
||||
template< typename Constraint1, typename Constraint2 >
|
||||
|
|
@ -105,14 +105,14 @@ namespace detail
|
|||
operator&&( const constraint< Constraint1 >& lhs,
|
||||
const constraint< Constraint2 >& rhs )
|
||||
{
|
||||
return detail::and_< Constraint1, Constraint2 >( lhs.f_, rhs.f_ );
|
||||
return detail::and_< Constraint1, Constraint2 >( lhs.c_, rhs.c_ );
|
||||
}
|
||||
|
||||
template< typename Constraint >
|
||||
const constraint< detail::not_< Constraint > >
|
||||
operator!( const constraint< Constraint >& c )
|
||||
{
|
||||
return detail::not_< Constraint >( c.f_ );
|
||||
return detail::not_< Constraint >( c.c_ );
|
||||
}
|
||||
} // mock
|
||||
|
||||
|
|
@ -137,7 +137,7 @@ namespace detail
|
|||
{ \
|
||||
constraint() \
|
||||
{} \
|
||||
detail::N f_; \
|
||||
detail::N c_; \
|
||||
}; \
|
||||
const constraint< detail::N > N;
|
||||
|
||||
|
|
|
|||
|
|
@ -50,7 +50,7 @@ namespace detail
|
|||
|
||||
void calls( const functor_type& f )
|
||||
{
|
||||
if( !f )
|
||||
if( ! f )
|
||||
throw std::invalid_argument( "null functor" );
|
||||
f_ = f;
|
||||
}
|
||||
|
|
@ -92,7 +92,7 @@ namespace detail
|
|||
|
||||
void calls( const functor_type& f )
|
||||
{
|
||||
if( !f )
|
||||
if( ! f )
|
||||
throw std::invalid_argument( "null functor" );
|
||||
f_ = f;
|
||||
}
|
||||
|
|
@ -127,7 +127,7 @@ namespace detail
|
|||
|
||||
void calls( const functor_type& f )
|
||||
{
|
||||
if( !f )
|
||||
if( ! f )
|
||||
throw std::invalid_argument( "null functor" );
|
||||
f_ = f;
|
||||
}
|
||||
|
|
@ -173,7 +173,7 @@ namespace detail
|
|||
|
||||
void calls( const functor_type& f )
|
||||
{
|
||||
if( !f )
|
||||
if( ! f )
|
||||
throw std::invalid_argument( "null functor" );
|
||||
f_ = f;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -128,4 +128,3 @@ namespace detail
|
|||
#undef MOCK_EXPECTATION_ARGS
|
||||
#undef MOCK_EXPECTATION_IS_VALID
|
||||
#undef MOCK_EXPECTATION_SERIALIZE
|
||||
#undef MOCK_EXPECTATION
|
||||
|
|
|
|||
|
|
@ -70,7 +70,7 @@ namespace detail
|
|||
{
|
||||
for( expectations_cit it = expectations_.begin();
|
||||
it != expectations_.end(); ++it )
|
||||
if( !it->verify() )
|
||||
if( ! it->verify() )
|
||||
{
|
||||
valid_ = false;
|
||||
error_type::fail( "verification failed",
|
||||
|
|
@ -133,9 +133,9 @@ namespace detail
|
|||
}
|
||||
|
||||
friend std::ostream& operator<<(
|
||||
std::ostream& s, const function_impl& e )
|
||||
std::ostream& s, const function_impl& impl )
|
||||
{
|
||||
return s << lazy_context( &e ) << lazy_expectations( &e );
|
||||
return s << lazy_context( &impl ) << lazy_expectations( &impl );
|
||||
}
|
||||
|
||||
struct lazy_context
|
||||
|
|
|
|||
|
|
@ -30,8 +30,7 @@ namespace detail
|
|||
virtual bool invoked() const = 0;
|
||||
virtual bool exhausted() const = 0;
|
||||
|
||||
friend inline std::ostream& operator<<(
|
||||
std::ostream& s, const invocation& i )
|
||||
friend std::ostream& operator<<( std::ostream& s, const invocation& i )
|
||||
{
|
||||
return i.serialize( s );
|
||||
}
|
||||
|
|
|
|||
|
|
@ -52,8 +52,7 @@ namespace mock
|
|||
}
|
||||
|
||||
template< typename Context >
|
||||
static void call( const Context& context,
|
||||
const char* file, int line )
|
||||
static void call( const Context& context, const char* file, int line )
|
||||
{
|
||||
boost::unit_test::framework::assertion_result( true );
|
||||
boost::unit_test::unit_test_log
|
||||
|
|
|
|||
|
|
@ -66,7 +66,7 @@ namespace mock
|
|||
{
|
||||
public:
|
||||
explicit matcher( const constraint< Constraint >& c )
|
||||
: c_( c.f_ )
|
||||
: c_( c.c_ )
|
||||
{}
|
||||
virtual bool operator()( Actual actual )
|
||||
{
|
||||
|
|
@ -90,19 +90,19 @@ namespace mock
|
|||
{
|
||||
public:
|
||||
explicit matcher( const Functor& f )
|
||||
: f_( f )
|
||||
: c_( f )
|
||||
{}
|
||||
virtual bool operator()( Actual actual )
|
||||
{
|
||||
return f_( actual );
|
||||
return c_( actual );
|
||||
}
|
||||
private:
|
||||
virtual void serialize( std::ostream& s ) const
|
||||
{
|
||||
s << mock::format( f_ );
|
||||
s << mock::format( c_ );
|
||||
}
|
||||
private:
|
||||
Functor f_;
|
||||
Functor c_;
|
||||
};
|
||||
} // mock
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue