mirror of
https://github.com/boostorg/contract.git
synced 2026-02-21 15:02:26 +00:00
tested access on msvc, gcc, clang, and wave
This commit is contained in:
@@ -1,26 +1,68 @@
|
||||
|
||||
#include <boost/contract/ext_/preprocessor/traits/func/aux_/index.hpp>
|
||||
#define BOOST_CONTRACT_EXT_PP_FUNC_TRAITS_AUX_INDEX_TEST \
|
||||
BOOST_CONTRACT_EXT_PP_FUNC_TRAITS_AUX_TEMPLATE_INDEX
|
||||
|
||||
#include "../aux_/pp_traits.hpp"
|
||||
#include <boost/contract/ext_/preprocessor/traits/func.hpp>
|
||||
#include <boost/contract/ext_/preprocessor/utility/is_empty.hpp>
|
||||
#include <boost/preprocessor/facilities/empty.hpp>
|
||||
#include <boost/detail/lightweight_test.hpp>
|
||||
#include <boost/preprocessor/list/for_each_i.hpp>
|
||||
#include <boost/preprocessor/logical/not.hpp>
|
||||
#include <boost/preprocessor/control/iif.hpp>
|
||||
#include <boost/preprocessor/punctuation/comma_if.hpp>
|
||||
#include <boost/preprocessor/tuple/eat.hpp>
|
||||
#include <boost/preprocessor/tuple/rem.hpp>
|
||||
|
||||
#include <boost/preprocessor/variadic/size.hpp>
|
||||
// NOTE: Some extra test macros are necessary here to regenerate the sign back
|
||||
// from the parsed trait to check if the parsing was correct. But, at the end
|
||||
// these are valuable tests also because they use the TPARAM_TRAITS macros.
|
||||
|
||||
#define BOOST_CONTRACT_TEST_TPARAM_(r, unused, i, tparam_traits) \
|
||||
BOOST_PP_COMMA_IF(i) \
|
||||
BOOST_CONTRACT_EXT_PP_TPARAM_TRAITS_KIND(tparam_traits) \
|
||||
BOOST_CONTRACT_EXT_PP_TPARAM_TRAITS_NAME(tparam_traits) \
|
||||
BOOST_PP_IIF(BOOST_CONTRACT_EXT_PP_IS_EMPTY( \
|
||||
BOOST_CONTRACT_EXT_PP_TPARAM_TRAITS_DEFAULT(tparam_traits)), \
|
||||
BOOST_PP_TUPLE_EAT(2) \
|
||||
, \
|
||||
BOOST_PP_TUPLE_REM(2) \
|
||||
)( \
|
||||
BOOST_PP_EMPTY(), \
|
||||
default BOOST_CONTRACT_EXT_PP_TPARAM_TRAITS_DEFAULT(tparam_traits) \
|
||||
)
|
||||
|
||||
#define BOOST_CONTRACT_TEST_TPARAMS_(func_traits) \
|
||||
( \
|
||||
BOOST_PP_LIST_FOR_EACH_I(BOOST_CONTRACT_TEST_TPARAM_, ~, \
|
||||
BOOST_CONTRACT_EXT_PP_FUNC_TRAITS_TPARAMS(func_traits)) \
|
||||
)
|
||||
|
||||
#define BOOST_CONTRACT_TEST_TEMPLATE_(func_traits) \
|
||||
BOOST_PP_IIF(BOOST_CONTRACT_EXT_PP_IS_EMPTY( \
|
||||
BOOST_CONTRACT_EXT_PP_FUNC_TRAITS_TEMPLATE(func_traits)), \
|
||||
BOOST_PP_TUPLE_EAT(1) \
|
||||
, \
|
||||
template BOOST_CONTRACT_TEST_TPARAMS_ \
|
||||
)(func_traits)
|
||||
|
||||
#define BOOST_CONTRACT_TEST_(trait) \
|
||||
BOOST_CONTRACT_TEST_AUX_PP_TRAITS_CHECK_EQUAL( \
|
||||
BOOST_CONTRACT_TEST_AUX_PP_TRAITS( \
|
||||
BOOST_CONTRACT_TEST_TEMPLATE_, \
|
||||
BOOST_CONTRACT_EXT_PP_FUNC_TRAITS, \
|
||||
BOOST_CONTRACT_EXT_PP_FUNC_TRAITS_TEMPLATE, \
|
||||
trait (int&) (f) ( int x, (int&) y ), \
|
||||
BOOST_PP_EMPTY(), \
|
||||
trait, \
|
||||
(std::map<int, char>&) (f) ( int x, (std::map<int, char>&) y ), \
|
||||
trait \
|
||||
)
|
||||
|
||||
int main ( ) {
|
||||
BOOST_CONTRACT_TEST_( BOOST_PP_EMPTY() )
|
||||
BOOST_CONTRACT_TEST_( BOOST_PP_EMPTY() ) // None.
|
||||
|
||||
BOOST_CONTRACT_TEST_(
|
||||
BOOST_CONTRACT_TEST_( // Type, w/ default, and variadic.
|
||||
template(
|
||||
typename T,
|
||||
class U, default (std::pair<int, char>),
|
||||
class U, default (std::map<int, char>),
|
||||
typename... V
|
||||
)
|
||||
)
|
||||
@@ -78,6 +120,6 @@ int main ( ) {
|
||||
)
|
||||
)
|
||||
*/
|
||||
return boost::report_errors();
|
||||
return BOOST_CONTRACT_TEST_AUX_PP_TRAITS_REPORT_ERRORS;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user