Removed duplicate test

git-svn-id: https://svn.code.sf.net/p/turtle/code/trunk@657 860be788-9bd5-4423-9f1e-828f051e677b
This commit is contained in:
mat007 2013-05-20 10:48:54 +00:00
parent 0592148204
commit 8919e56678

View file

@ -395,51 +395,6 @@ BOOST_AUTO_TEST_CASE( constraints_and_arguments_are_serialized_lazily )
BOOST_CHECK( ! serialized ); BOOST_CHECK( ! serialized );
} }
namespace
{
template< typename Expected >
struct near_constraint
{
near_constraint( Expected expected, Expected threshold )
: expected_( expected )
, threshold_( threshold )
{}
template< typename Actual >
bool operator()( Actual actual ) const
{
return std::abs( actual - boost::unwrap_ref( expected_ ) )
< boost::unwrap_ref( threshold_ );
}
friend std::ostream& operator<<( std::ostream& s, const near_constraint& c )
{
return s << "near( " << mock::format( c.expected_ )
<< ", " << mock::format( c.threshold_ ) << " )";
}
Expected expected_;
Expected threshold_;
};
template< typename Expected >
mock::constraint< near_constraint< Expected > > near( Expected expected, Expected threshold )
{
return near_constraint< Expected >( expected, threshold );
}
}
BOOST_AUTO_TEST_CASE( using_custom_constraint )
{
MOCK_FUNCTOR( f, void( float ) );
MOCK_EXPECT( f ).with( near( 3.f, 0.01f ) );
f( 3.f );
const std::string expected = "f\n"
". unlimited().with( near( 3, 0.01 ) )";
std::stringstream s;
s << f;
BOOST_CHECK_EQUAL( expected, s.str() );
}
namespace namespace
{ {
struct custom_constraint_with_non_const_operator struct custom_constraint_with_non_const_operator