bootst Turtle編

658 ワード

出自する 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 );
}