Changed project layout

git-svn-id: https://svn.code.sf.net/p/turtle/code/trunk@460 860be788-9bd5-4423-9f1e-828f051e677b
This commit is contained in:
mat007 2012-06-15 21:14:48 +00:00
parent b22842eade
commit 3358ddda0e
55 changed files with 32 additions and 0 deletions

38
test/test_max_args.cpp Normal file
View file

@ -0,0 +1,38 @@
//
// Copyright Mathieu Champlon 2008
//
// Distributed under the Boost Software License, Version 1.0.
// (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
//
// See http://turtle.sf.net for documentation.
#include "mock_error.hpp"
#include <turtle/mock.hpp>
#include <boost/test/auto_unit_test.hpp>
#include <boost/preprocessor/repetition/enum.hpp>
#define IDENTITY(z, n, d) d
namespace
{
struct my_custom_mock
{
MOCK_METHOD_EXT( method, MOCK_MAX_ARGS, void( BOOST_PP_ENUM(MOCK_MAX_ARGS, IDENTITY, int) ), method )
MOCK_METHOD_EXT( method2, MOCK_MAX_ARGS, int( BOOST_PP_ENUM(MOCK_MAX_ARGS, IDENTITY, int) ), method2 )
};
}
BOOST_AUTO_TEST_CASE( call_mock_method_with_max_number_of_args )
{
my_custom_mock m;
MOCK_EXPECT( m.method ).once().with( BOOST_PP_ENUM(MOCK_MAX_ARGS, IDENTITY, 0) );
m.method( BOOST_PP_ENUM(MOCK_MAX_ARGS, IDENTITY, 0) );
}
BOOST_AUTO_TEST_CASE( call_mock_method_with_max_number_of_args_and_returning_something )
{
my_custom_mock m;
MOCK_EXPECT( m.method2 ).once().with( BOOST_PP_ENUM(MOCK_MAX_ARGS, IDENTITY, 0) ).returns( 42 );
BOOST_CHECK_EQUAL( 42, m.method2( BOOST_PP_ENUM(MOCK_MAX_ARGS, IDENTITY, 0) ) );
}