2
0
mirror of https://github.com/boostorg/tti.git synced 2026-01-26 07:02:14 +00:00

Testing variadic macro functionality

[SVN r67242]
This commit is contained in:
Edward Diener
2010-12-15 17:12:57 +00:00
parent e395edf104
commit 483971959a
6 changed files with 41 additions and 3 deletions

View File

@@ -93,4 +93,6 @@ alias ttiVM
[ compile TestVMHasTemplateCheckParamsCompile.cpp : <include>../../../../variadic_macro_data ]
[ compile-fail TestVMHasTemplateCheckParamsFail.cpp : <include>../../../../variadic_macro_data ]
[ compile-fail TestVMHasTemplateCheckParamsFail2.cpp : <include>../../../../variadic_macro_data ]
[ compile-fail TestVMHasTemplateCheckParamsFail3.cpp : <include>../../../../variadic_macro_data ]
[ compile-fail TestVMHasTemplateCheckParamsFail4.cpp : <include>../../../../variadic_macro_data ]
;

View File

@@ -4,6 +4,15 @@
int main()
{
BOOST_TEST(tti::has_template_check_params_ATPMemberTemplate<AType>::value);
BOOST_TEST(tti::HaveCL<AType>::value);
BOOST_TEST(tti::has_template_check_params_AMemberTemplate<AType>::value);
BOOST_TEST(tti::HaveAnotherMT<AType>::value);
BOOST_TEST(tti::has_template_check_params_SomeMemberTemplate<AnotherType>::value);
BOOST_TEST(tti::ATemplateWithParms<AnotherType>::value);
BOOST_TEST(tti::has_template_check_params_SimpleTMP<AnotherType>::value);
BOOST_TEST(!tti::has_template_check_params_TemplateNotExist<AnotherType>::value);
return boost::report_errors();
}

View File

@@ -4,4 +4,15 @@
#include "TestStructs.hpp"
#include <boost/tti/TTIntrospectionVM.hpp>
TTI_VM_HAS_TEMPLATE_CHECK_PARAMS(ATPMemberTemplate,class)
TTI_VM_TRAIT_HAS_TEMPLATE_CHECK_PARAMS(HaveCL,CLMemberTemplate,class,class)
TTI_VM_HAS_TEMPLATE_CHECK_PARAMS(AMemberTemplate,int)
TTI_VM_TRAIT_HAS_TEMPLATE_CHECK_PARAMS(HaveAnotherMT,AnotherMemberTemplate,int,int)
TTI_VM_HAS_TEMPLATE_CHECK_PARAMS(SomeMemberTemplate,class,class,class,class,class,class)
TTI_VM_TRAIT_HAS_TEMPLATE_CHECK_PARAMS(ATemplateWithParms,ManyParameters,class,class,int,class,template <class> class InnerTemplate,class,long)
TTI_VM_HAS_TEMPLATE_CHECK_PARAMS(SimpleTMP,class,class,class,class)
TTI_VM_HAS_TEMPLATE_CHECK_PARAMS(TemplateNotExist,int,class,template <class> class ATemplate)
TTI_VM_TRAIT_HAS_TEMPLATE_CHECK_PARAMS(WrongParametersForMP,ManyParameters,class,class,int,class,template <class,class> class InnerTemplate,class,long)
TTI_VM_TRAIT_HAS_TEMPLATE_CHECK_PARAMS(WrongParameters2ForMP,ManyParameters,class,long,int,class,template <class> class InnerTemplate,class,long)
#endif // TEST_VM_HAS_TEMPLATE_CHECK_PARAMS_HPP

View File

@@ -4,7 +4,19 @@
int main()
{
BOOST_MPL_ASSERT((boost::mpl::true_));
// You can always instantiate without compiler errors
tti::has_template_check_params_TemplateNotExist<AnotherType> aVar1;
// Compile time asserts
BOOST_MPL_ASSERT((tti::has_template_check_params_ATPMemberTemplate<AType>));
BOOST_MPL_ASSERT((tti::HaveCL<AType>));
BOOST_MPL_ASSERT((tti::has_template_check_params_AMemberTemplate<AType>));
BOOST_MPL_ASSERT((tti::HaveAnotherMT<AType>));
BOOST_MPL_ASSERT((tti::has_template_check_params_SomeMemberTemplate<AnotherType>));
BOOST_MPL_ASSERT((tti::ATemplateWithParms<AnotherType>));
BOOST_MPL_ASSERT((tti::has_template_check_params_SimpleTMP<AnotherType>));
return 0;

View File

@@ -4,7 +4,9 @@
int main()
{
BOOST_MPL_ASSERT((boost::mpl::false_));
// TemplateNotExist does not exist at all
BOOST_MPL_ASSERT((tti::has_template_check_params_TemplateNotExist<AType>));
return 0;

View File

@@ -4,7 +4,9 @@
int main()
{
BOOST_MPL_ASSERT((boost::mpl::false_));
// Wrong enclosing type
BOOST_MPL_ASSERT((tti::HaveCL<AnotherType>));
return 0;