Reworked MOCK_CONSTRAINT to be able to provide names to parameters

git-svn-id: https://svn.code.sf.net/p/turtle/code/trunk@667 860be788-9bd5-4423-9f1e-828f051e677b
This commit is contained in:
mat007 2013-06-04 22:01:57 +00:00
parent bd2fc97bb9
commit 8d08012cdf
10 changed files with 195 additions and 51 deletions

28
test/test_constraint.cpp Normal file
View file

@ -0,0 +1,28 @@
// http://turtle.sourceforge.net
//
// Copyright Mathieu Champlon 2013
//
// 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)
#include <turtle/constraint.hpp>
#include <boost/test/auto_unit_test.hpp>
#ifndef BOOST_NO_VARIADIC_MACROS
namespace
{
MOCK_CONSTRAINT( constraint_0, actual == 0 )
MOCK_CONSTRAINT( constraint_1, expected, actual == expected )
MOCK_CONSTRAINT( constraint_2, expected_0, expected_1, actual == expected_0 || actual == expected_1 )
}
BOOST_AUTO_TEST_CASE( mock_constraint_is_supported_by_compilers_with_variadic_macros )
{
BOOST_CHECK( constraint_0.c_( 0 ) );
BOOST_CHECK( constraint_1( 0 ).c_( 0 ) );
BOOST_CHECK( constraint_2( 0, 0 ).c_( 0 ) );
}
#endif // BOOST_NO_VARIADIC_MACROS