mirror of
https://github.com/mat007/turtle.git
synced 2026-06-22 12:13:43 +00:00
Use std::reference_wrapper instead of boost
This commit is contained in:
parent
353849e9ad
commit
35e43d58a6
16 changed files with 116 additions and 90 deletions
|
|
@ -86,8 +86,8 @@ struct near_constraint
|
|||
template< typename Actual >
|
||||
bool operator()( Actual actual ) const
|
||||
{
|
||||
return std::abs( actual - boost::unwrap_ref( expected_ ) )
|
||||
< boost::unwrap_ref( threshold_ );
|
||||
return std::abs( actual - unwrap_ref( expected_ ) )
|
||||
< unwrap_ref( threshold_ );
|
||||
}
|
||||
|
||||
friend std::ostream& operator<<( std::ostream& s, const near_constraint& c )
|
||||
|
|
@ -127,7 +127,7 @@ BOOST_AUTO_TEST_CASE( forty_one_plus_one_is_forty_two_plus_or_minus_one )
|
|||
mock_view v;
|
||||
calculator c( v );
|
||||
int expected, threshold;
|
||||
MOCK_EXPECT( v.display ).with( near( boost::cref( expected ), boost::cref( threshold ) ) );
|
||||
MOCK_EXPECT( v.display ).with( near( std::cref( expected ), std::cref( threshold ) ) );
|
||||
expected = 42;
|
||||
threshold = 1;
|
||||
c.add( 41, 1 );
|
||||
|
|
|
|||
|
|
@ -44,7 +44,7 @@ BOOST_AUTO_TEST_CASE( method_is_called_two_times_with_the_same_value )
|
|||
my_class c( mock );
|
||||
int value;
|
||||
MOCK_EXPECT( mock.method ).once().with( mock::retrieve( value ) ); // on first call retrieve the value, this expectation takes precedence because it can never fail
|
||||
MOCK_EXPECT( mock.method ).once().with( boost::cref( value ) ); // on second call compare the previously retrieved value with the newly received one
|
||||
MOCK_EXPECT( mock.method ).once().with( std::cref( value ) ); // on second call compare the previously retrieved value with the newly received one
|
||||
c.process();
|
||||
}
|
||||
//]
|
||||
|
|
|
|||
|
|
@ -740,7 +740,7 @@ BOOST_AUTO_TEST_CASE( demonstrates_configuring_actions_with_references )
|
|||
{
|
||||
mock_class c;
|
||||
int i = 0;
|
||||
MOCK_EXPECT( c.method ).returns( boost::ref( i ) ); // wrap i to store a reference
|
||||
MOCK_EXPECT( c.method ).returns( std::ref( i ) ); // wrap i to store a reference
|
||||
c.method() = 42; // really change i and not just the stored copy
|
||||
BOOST_CHECK_EQUAL( 42, i ); // indeed
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue