boost Turtle篇

出自 http://turtle.sourceforge.net/turtle/motivation.html

implements based class function实现函数重载:

MOCK_BASE_CLASS( mock_view, view ) // declare a 'mock_view' class implementing 'view'
{
    MOCK_METHOD( display, 1 )      // implement the 'display' method from 'view' (taking 1 argument)
};
BOOST_AUTO_TEST_CASE( zero_plus_zero_is_zero )
{
    mock_view v;
    calculator c( v );
    MOCK_EXPECT( v.display ).once().with( 0 ).returns(0); // expect the 'display' method to be called once (and only once) with a parameter value equal to 0, and return 0
    c.add( 0, 0 );
}

你可能感兴趣的:(Linux,C/C++)