Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r67242 - sandbox/tti/libs/tti/test
From: eldiener_at_[hidden]
Date: 2010-12-15 12:12:59


Author: eldiener
Date: 2010-12-15 12:12:57 EST (Wed, 15 Dec 2010)
New Revision: 67242
URL: http://svn.boost.org/trac/boost/changeset/67242

Log:
Testing variadic macro functionality
Text files modified:
   sandbox/tti/libs/tti/test/Jamfile.v2 | 2 ++
   sandbox/tti/libs/tti/test/TestVMHasTemplateCheckParams.cpp | 9 +++++++++
   sandbox/tti/libs/tti/test/TestVMHasTemplateCheckParams.hpp | 11 +++++++++++
   sandbox/tti/libs/tti/test/TestVMHasTemplateCheckParamsCompile.cpp | 14 +++++++++++++-
   sandbox/tti/libs/tti/test/TestVMHasTemplateCheckParamsFail.cpp | 4 +++-
   sandbox/tti/libs/tti/test/TestVMHasTemplateCheckParamsFail2.cpp | 4 +++-
   6 files changed, 41 insertions(+), 3 deletions(-)

Modified: sandbox/tti/libs/tti/test/Jamfile.v2
==============================================================================
--- sandbox/tti/libs/tti/test/Jamfile.v2 (original)
+++ sandbox/tti/libs/tti/test/Jamfile.v2 2010-12-15 12:12:57 EST (Wed, 15 Dec 2010)
@@ -93,4 +93,6 @@
         [ 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 ]
     ;

Modified: sandbox/tti/libs/tti/test/TestVMHasTemplateCheckParams.cpp
==============================================================================
--- sandbox/tti/libs/tti/test/TestVMHasTemplateCheckParams.cpp (original)
+++ sandbox/tti/libs/tti/test/TestVMHasTemplateCheckParams.cpp 2010-12-15 12:12:57 EST (Wed, 15 Dec 2010)
@@ -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();
 
   }

Modified: sandbox/tti/libs/tti/test/TestVMHasTemplateCheckParams.hpp
==============================================================================
--- sandbox/tti/libs/tti/test/TestVMHasTemplateCheckParams.hpp (original)
+++ sandbox/tti/libs/tti/test/TestVMHasTemplateCheckParams.hpp 2010-12-15 12:12:57 EST (Wed, 15 Dec 2010)
@@ -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

Modified: sandbox/tti/libs/tti/test/TestVMHasTemplateCheckParamsCompile.cpp
==============================================================================
--- sandbox/tti/libs/tti/test/TestVMHasTemplateCheckParamsCompile.cpp (original)
+++ sandbox/tti/libs/tti/test/TestVMHasTemplateCheckParamsCompile.cpp 2010-12-15 12:12:57 EST (Wed, 15 Dec 2010)
@@ -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;
 

Modified: sandbox/tti/libs/tti/test/TestVMHasTemplateCheckParamsFail.cpp
==============================================================================
--- sandbox/tti/libs/tti/test/TestVMHasTemplateCheckParamsFail.cpp (original)
+++ sandbox/tti/libs/tti/test/TestVMHasTemplateCheckParamsFail.cpp 2010-12-15 12:12:57 EST (Wed, 15 Dec 2010)
@@ -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;
 

Modified: sandbox/tti/libs/tti/test/TestVMHasTemplateCheckParamsFail2.cpp
==============================================================================
--- sandbox/tti/libs/tti/test/TestVMHasTemplateCheckParamsFail2.cpp (original)
+++ sandbox/tti/libs/tti/test/TestVMHasTemplateCheckParamsFail2.cpp 2010-12-15 12:12:57 EST (Wed, 15 Dec 2010)
@@ -4,7 +4,9 @@
 int main()
   {
   
- BOOST_MPL_ASSERT((boost::mpl::false_));
+ // Wrong enclosing type
+
+ BOOST_MPL_ASSERT((tti::HaveCL<AnotherType>));
   
   return 0;
 


Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk