Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r67368 - sandbox/tti/libs/tti/test
From: eldiener_at_[hidden]
Date: 2010-12-20 12:13:22


Author: eldiener
Date: 2010-12-20 12:13:19 EST (Mon, 20 Dec 2010)
New Revision: 67368
URL: http://svn.boost.org/trac/boost/changeset/67368

Log:
Added tests
Added:
   sandbox/tti/libs/tti/test/TestMFHasMemberFunctionFail3.cpp (contents, props changed)
   sandbox/tti/libs/tti/test/TestMFHasStaticDataFail3.cpp (contents, props changed)
   sandbox/tti/libs/tti/test/TestMFHasStaticFunctionFail3.cpp (contents, props changed)
Text files modified:
   sandbox/tti/libs/tti/test/Jamfile.v2 | 3 +
   sandbox/tti/libs/tti/test/TestMFHasMemberData.cpp | 39 ++++++++++++++++-
   sandbox/tti/libs/tti/test/TestMFHasMemberDataCompile.cpp | 35 ++++++++++++++-
   sandbox/tti/libs/tti/test/TestMFHasMemberDataFail.cpp | 8 +++
   sandbox/tti/libs/tti/test/TestMFHasMemberDataFail2.cpp | 8 +++
   sandbox/tti/libs/tti/test/TestMFHasMemberDataFail3.cpp | 8 +++
   sandbox/tti/libs/tti/test/TestMFHasMemberFunction.cpp | 60 ++++++++++++++++++++++++++++
   sandbox/tti/libs/tti/test/TestMFHasMemberFunction.hpp | 9 ++++
   sandbox/tti/libs/tti/test/TestMFHasMemberFunctionCompile.cpp | 85 +++++++++++++++++++++++++++++++++++++++
   sandbox/tti/libs/tti/test/TestMFHasMemberFunctionFail.cpp | 13 +++++
   sandbox/tti/libs/tti/test/TestMFHasMemberFunctionFail2.cpp | 10 ++++
   sandbox/tti/libs/tti/test/TestMFHasStaticData.cpp | 9 ++++
   sandbox/tti/libs/tti/test/TestMFHasStaticData.hpp | 3 +
   sandbox/tti/libs/tti/test/TestMFHasStaticDataCompile.cpp | 19 ++++++++
   sandbox/tti/libs/tti/test/TestMFHasStaticDataFail.cpp | 10 ++++
   sandbox/tti/libs/tti/test/TestMFHasStaticDataFail2.cpp | 10 ++++
   sandbox/tti/libs/tti/test/TestMFHasStaticFunction.cpp | 33 +++++++++++++++
   sandbox/tti/libs/tti/test/TestMFHasStaticFunction.hpp | 8 +++
   sandbox/tti/libs/tti/test/TestMFHasStaticFunctionCompile.cpp | 51 +++++++++++++++++++++++
   sandbox/tti/libs/tti/test/TestMFHasStaticFunctionFail.cpp | 12 +++++
   sandbox/tti/libs/tti/test/TestMFHasStaticFunctionFail2.cpp | 12 +++++
   21 files changed, 425 insertions(+), 20 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-20 12:13:19 EST (Mon, 20 Dec 2010)
@@ -66,14 +66,17 @@
         [ compile TestMFHasMemberFunctionCompile.cpp ]
         [ compile-fail TestMFHasMemberFunctionFail.cpp ]
         [ compile-fail TestMFHasMemberFunctionFail2.cpp ]
+ [ compile-fail TestMFHasMemberFunctionFail3.cpp ]
         [ run TestMFHasStaticData.cpp ]
         [ compile TestMFHasStaticDataCompile.cpp ]
         [ compile-fail TestMFHasStaticDataFail.cpp ]
         [ compile-fail TestMFHasStaticDataFail2.cpp ]
+ [ compile-fail TestMFHasStaticDataFail3.cpp ]
         [ run TestMFHasStaticFunction.cpp ]
         [ compile TestMFHasStaticFunctionCompile.cpp ]
         [ compile-fail TestMFHasStaticFunctionFail.cpp ]
         [ compile-fail TestMFHasStaticFunctionFail2.cpp ]
+ [ compile-fail TestMFHasStaticFunctionFail3.cpp ]
         [ run TestMFHasType.cpp ]
         [ compile TestMFHasTypeCompile.cpp ]
         [ compile-fail TestMFHasTypeFail.cpp ]

Modified: sandbox/tti/libs/tti/test/TestMFHasMemberData.cpp
==============================================================================
--- sandbox/tti/libs/tti/test/TestMFHasMemberData.cpp (original)
+++ sandbox/tti/libs/tti/test/TestMFHasMemberData.cpp 2010-12-20 12:13:19 EST (Mon, 20 Dec 2010)
@@ -5,10 +5,41 @@
 int main()
   {
   
- BOOST_TEST((tti::mf_has_member_data<tti::has_member_AnInt,boost::mpl::identity<AType>,boost::mpl::identity<int> >::value));
- BOOST_TEST((tti::mf_has_member_data<tti::has_member_AnInt,boost::mpl::identity<AnotherType>,boost::mpl::identity<long> >::value));
- BOOST_TEST((tti::mf_has_member_data<tti::has_member_aMember,boost::mpl::identity<AnotherType>,boost::mpl::identity<bool> >::value));
- BOOST_TEST((tti::mf_has_member_data<tti::CMember,boost::mpl::identity<AnotherType>,boost::mpl::identity<bool> >::value));
+ BOOST_TEST((tti::mf_has_member_data
+ <
+ tti::has_member_AnInt,
+ boost::mpl::identity<AType>,
+ boost::mpl::identity<int>
+ >
+ ::value
+ ));
+
+ BOOST_TEST((tti::mf_has_member_data
+ <
+ tti::has_member_AnInt,
+ boost::mpl::identity<AnotherType>,
+ boost::mpl::identity<long>
+ >
+ ::value
+ ));
+
+ BOOST_TEST((tti::mf_has_member_data
+ <
+ tti::has_member_aMember,
+ boost::mpl::identity<AnotherType>,
+ boost::mpl::identity<bool>
+ >
+ ::value
+ ));
+
+ BOOST_TEST((tti::mf_has_member_data
+ <
+ tti::CMember,
+ boost::mpl::identity<AnotherType>,
+ boost::mpl::identity<bool>
+ >
+ ::value
+ ));
   
   return boost::report_errors();
 

Modified: sandbox/tti/libs/tti/test/TestMFHasMemberDataCompile.cpp
==============================================================================
--- sandbox/tti/libs/tti/test/TestMFHasMemberDataCompile.cpp (original)
+++ sandbox/tti/libs/tti/test/TestMFHasMemberDataCompile.cpp 2010-12-20 12:13:19 EST (Mon, 20 Dec 2010)
@@ -4,10 +4,37 @@
 int main()
   {
   
- BOOST_MPL_ASSERT((tti::mf_has_member_data<tti::has_member_AnInt,boost::mpl::identity<AType>,boost::mpl::identity<int> >));
- BOOST_MPL_ASSERT((tti::mf_has_member_data<tti::has_member_AnInt,boost::mpl::identity<AnotherType>,boost::mpl::identity<long> >));
- BOOST_MPL_ASSERT((tti::mf_has_member_data<tti::has_member_aMember,boost::mpl::identity<AnotherType>,boost::mpl::identity<bool> >));
- BOOST_MPL_ASSERT((tti::mf_has_member_data<tti::CMember,boost::mpl::identity<AnotherType>,boost::mpl::identity<bool> >));
+ BOOST_MPL_ASSERT((tti::mf_has_member_data
+ <
+ tti::has_member_AnInt,
+ boost::mpl::identity<AType>,
+ boost::mpl::identity<int>
+ >
+ ));
+
+ BOOST_MPL_ASSERT((tti::mf_has_member_data
+ <
+ tti::has_member_AnInt,
+ boost::mpl::identity<AnotherType>,
+ boost::mpl::identity<long>
+ >
+ ));
+
+ BOOST_MPL_ASSERT((tti::mf_has_member_data
+ <
+ tti::has_member_aMember,
+ boost::mpl::identity<AnotherType>,
+ boost::mpl::identity<bool>
+ >
+ ));
+
+ BOOST_MPL_ASSERT((tti::mf_has_member_data
+ <
+ tti::CMember,
+ boost::mpl::identity<AnotherType>,
+ boost::mpl::identity<bool>
+ >
+ ));
   
   return 0;
 

Modified: sandbox/tti/libs/tti/test/TestMFHasMemberDataFail.cpp
==============================================================================
--- sandbox/tti/libs/tti/test/TestMFHasMemberDataFail.cpp (original)
+++ sandbox/tti/libs/tti/test/TestMFHasMemberDataFail.cpp 2010-12-20 12:13:19 EST (Mon, 20 Dec 2010)
@@ -7,7 +7,13 @@
   
   // someDataMember does not exist at all
   
- BOOST_MPL_ASSERT((tti::mf_has_member_data<tti::has_member_someDataMember,boost::mpl::identity<AnotherType>,boost::mpl::identity<short> >));
+ BOOST_MPL_ASSERT((tti::mf_has_member_data
+ <
+ tti::has_member_someDataMember,
+ boost::mpl::identity<AnotherType>,
+ boost::mpl::identity<short>
+ >
+ ));
   
   return 0;
 

Modified: sandbox/tti/libs/tti/test/TestMFHasMemberDataFail2.cpp
==============================================================================
--- sandbox/tti/libs/tti/test/TestMFHasMemberDataFail2.cpp (original)
+++ sandbox/tti/libs/tti/test/TestMFHasMemberDataFail2.cpp 2010-12-20 12:13:19 EST (Mon, 20 Dec 2010)
@@ -7,7 +7,13 @@
   
   // Wrong data signature for AnInt
   
- BOOST_MPL_ASSERT((tti::mf_has_member_data<tti::has_member_AnInt,boost::mpl::identity<AnotherType>,boost::mpl::identity<double> >));
+ BOOST_MPL_ASSERT((tti::mf_has_member_data
+ <
+ tti::has_member_AnInt,
+ boost::mpl::identity<AnotherType>,
+ boost::mpl::identity<double>
+ >
+ ));
   
   return 0;
 

Modified: sandbox/tti/libs/tti/test/TestMFHasMemberDataFail3.cpp
==============================================================================
--- sandbox/tti/libs/tti/test/TestMFHasMemberDataFail3.cpp (original)
+++ sandbox/tti/libs/tti/test/TestMFHasMemberDataFail3.cpp 2010-12-20 12:13:19 EST (Mon, 20 Dec 2010)
@@ -7,7 +7,13 @@
   
   // Wrong enclosing type
   
- BOOST_MPL_ASSERT((tti::mf_has_member_data<tti::has_member_aMember,boost::mpl::identity<AType>,boost::mpl::identity<bool> >));
+ BOOST_MPL_ASSERT((tti::mf_has_member_data
+ <
+ tti::has_member_aMember,
+ boost::mpl::identity<AType>,
+ boost::mpl::identity<bool>
+ >
+ ));
   
   return 0;
 

Modified: sandbox/tti/libs/tti/test/TestMFHasMemberFunction.cpp
==============================================================================
--- sandbox/tti/libs/tti/test/TestMFHasMemberFunction.cpp (original)
+++ sandbox/tti/libs/tti/test/TestMFHasMemberFunction.cpp 2010-12-20 12:13:19 EST (Mon, 20 Dec 2010)
@@ -4,6 +4,66 @@
 int main()
   {
   
+ BOOST_TEST((tti::mf_has_member_function
+ <
+ tti::has_member_VoidFunction,
+ boost::mpl::identity<AType>,
+ boost::mpl::identity<void>
+ >
+ ::value
+ ));
+
+ BOOST_TEST((tti::mf_has_member_function
+ <
+ tti::FunctionReturningInt,
+ boost::mpl::identity<AType>,
+ boost::mpl::identity<int>
+ >
+ ::value
+ ));
+
+ BOOST_TEST((tti::mf_has_member_function
+ <
+ tti::FunctionReturningInt,
+ boost::mpl::identity<AnotherType>,
+ boost::mpl::identity<double>,
+ boost::mpl::identity<int>
+ >
+ ::value
+ ));
+
+ BOOST_TEST((tti::mf_has_member_function
+ <
+ tti::has_member_aFunction,
+ boost::mpl::identity<AnotherType>,
+ boost::mpl::identity<AType>,
+ boost::mpl::identity<int>
+ >
+ ::value
+ ));
+
+ BOOST_TEST((tti::mf_has_member_function
+ <
+ tti::AnotherIntFunction,
+ boost::mpl::identity<AnotherType>,
+ boost::mpl::identity<int>,
+ boost::mpl::identity<AType>
+ >
+ ::value
+ ));
+
+ BOOST_TEST((tti::mf_has_member_function
+ <
+ tti::has_member_sFunction,
+ boost::mpl::identity<AnotherType>,
+ tti::member_type_AnIntType<AType>,
+ boost::mpl::identity<int>,
+ boost::mpl::identity<long>,
+ boost::mpl::identity<double>
+ >
+ ::value
+ ));
+
   return boost::report_errors();
 
   }

Modified: sandbox/tti/libs/tti/test/TestMFHasMemberFunction.hpp
==============================================================================
--- sandbox/tti/libs/tti/test/TestMFHasMemberFunction.hpp (original)
+++ sandbox/tti/libs/tti/test/TestMFHasMemberFunction.hpp 2010-12-20 12:13:19 EST (Mon, 20 Dec 2010)
@@ -4,4 +4,13 @@
 #include "TestStructs.hpp"
 #include <boost/tti/TTIntrospection.hpp>
 
+TTI_HAS_MEMBER(VoidFunction)
+TTI_TRAIT_HAS_MEMBER(FunctionReturningInt,IntFunction)
+TTI_HAS_MEMBER(aFunction)
+TTI_TRAIT_HAS_MEMBER(AnotherIntFunction,anotherFunction)
+TTI_HAS_MEMBER(sFunction)
+TTI_HAS_MEMBER(someFunctionMember)
+
+TTI_MEMBER_TYPE(AnIntType)
+
 #endif // TEST_MF_HAS_MEMBER_FUNCTION_HPP

Modified: sandbox/tti/libs/tti/test/TestMFHasMemberFunctionCompile.cpp
==============================================================================
--- sandbox/tti/libs/tti/test/TestMFHasMemberFunctionCompile.cpp (original)
+++ sandbox/tti/libs/tti/test/TestMFHasMemberFunctionCompile.cpp 2010-12-20 12:13:19 EST (Mon, 20 Dec 2010)
@@ -4,8 +4,91 @@
 int main()
   {
   
- BOOST_MPL_ASSERT((boost::mpl::true_));
+ // You can always instantiate without compiler errors
   
+ tti::mf_has_member_function
+ <
+ tti::FunctionReturningInt,
+ boost::mpl::identity<AnotherType>,
+ boost::mpl::identity<short>
+ > aVar;
+
+ tti::mf_has_member_function
+ <
+ tti::has_member_sFunction,
+ boost::mpl::identity<AnotherType>,
+ tti::member_type_AnIntType<AnotherType>,
+ boost::mpl::identity<int>,
+ boost::mpl::identity<long>,
+ boost::mpl::identity<double>
+ > aVar2;
+
+ tti::mf_has_member_function
+ <
+ tti::has_member_someFunctionMember,
+ boost::mpl::identity<AnotherType>,
+ boost::mpl::identity<short>,
+ boost::mpl::identity<double>,
+ boost::mpl::identity<int>,
+ boost::mpl::identity<long>
+ > aVar3;
+
+ // Compile time asserts
+
+ BOOST_MPL_ASSERT((tti::mf_has_member_function
+ <
+ tti::has_member_VoidFunction,
+ boost::mpl::identity<AType>,
+ boost::mpl::identity<void>
+ >
+ ));
+
+ BOOST_MPL_ASSERT((tti::mf_has_member_function
+ <
+ tti::FunctionReturningInt,
+ boost::mpl::identity<AType>,
+ boost::mpl::identity<int>
+ >
+ ));
+
+ BOOST_MPL_ASSERT((tti::mf_has_member_function
+ <
+ tti::FunctionReturningInt,
+ boost::mpl::identity<AnotherType>,
+ boost::mpl::identity<double>,
+ boost::mpl::identity<int>
+ >
+ ));
+
+ BOOST_MPL_ASSERT((tti::mf_has_member_function
+ <
+ tti::has_member_aFunction,
+ boost::mpl::identity<AnotherType>,
+ boost::mpl::identity<AType>,
+ boost::mpl::identity<int>
+ >
+ ));
+
+ BOOST_MPL_ASSERT((tti::mf_has_member_function
+ <
+ tti::AnotherIntFunction,
+ boost::mpl::identity<AnotherType>,
+ boost::mpl::identity<int>,
+ boost::mpl::identity<AType>
+ >
+ ));
+
+ BOOST_MPL_ASSERT((tti::mf_has_member_function
+ <
+ tti::has_member_sFunction,
+ boost::mpl::identity<AnotherType>,
+ tti::member_type_AnIntType<AType>,
+ boost::mpl::identity<int>,
+ boost::mpl::identity<long>,
+ boost::mpl::identity<double>
+ >
+ ));
+
   return 0;
 
   }

Modified: sandbox/tti/libs/tti/test/TestMFHasMemberFunctionFail.cpp
==============================================================================
--- sandbox/tti/libs/tti/test/TestMFHasMemberFunctionFail.cpp (original)
+++ sandbox/tti/libs/tti/test/TestMFHasMemberFunctionFail.cpp 2010-12-20 12:13:19 EST (Mon, 20 Dec 2010)
@@ -4,7 +4,18 @@
 int main()
   {
   
- BOOST_MPL_ASSERT((boost::mpl::false_));
+ // someFunctionMember does not exist at all
+
+ BOOST_MPL_ASSERT((tti::mf_has_member_function
+ <
+ tti::has_member_someFunctionMember,
+ boost::mpl::identity<AnotherType>,
+ boost::mpl::identity<short>,
+ boost::mpl::identity<double>,
+ boost::mpl::identity<int>,
+ boost::mpl::identity<long>
+ >
+ ));
   
   return 0;
 

Modified: sandbox/tti/libs/tti/test/TestMFHasMemberFunctionFail2.cpp
==============================================================================
--- sandbox/tti/libs/tti/test/TestMFHasMemberFunctionFail2.cpp (original)
+++ sandbox/tti/libs/tti/test/TestMFHasMemberFunctionFail2.cpp 2010-12-20 12:13:19 EST (Mon, 20 Dec 2010)
@@ -4,7 +4,15 @@
 int main()
   {
   
- BOOST_MPL_ASSERT((boost::mpl::false_));
+ // Wrong function signature
+
+ BOOST_MPL_ASSERT((tti::mf_has_member_function
+ <
+ tti::FunctionReturningInt,
+ boost::mpl::identity<AnotherType>,
+ boost::mpl::identity<short>
+ >
+ ));
   
   return 0;
 

Added: sandbox/tti/libs/tti/test/TestMFHasMemberFunctionFail3.cpp
==============================================================================
--- (empty file)
+++ sandbox/tti/libs/tti/test/TestMFHasMemberFunctionFail3.cpp 2010-12-20 12:13:19 EST (Mon, 20 Dec 2010)
@@ -0,0 +1,22 @@
+#include "TestMFHasMemberFunction.hpp"
+#include <boost/mpl/assert.hpp>
+
+int main()
+ {
+
+ // Wrong enclosing type for nested type
+
+ BOOST_MPL_ASSERT((tti::mf_has_member_function
+ <
+ tti::has_member_sFunction,
+ boost::mpl::identity<AnotherType>,
+ tti::member_type_AnIntType<AnotherType>,
+ boost::mpl::identity<int>,
+ boost::mpl::identity<long>,
+ boost::mpl::identity<double>
+ >
+ ));
+
+ return 0;
+
+ }

Modified: sandbox/tti/libs/tti/test/TestMFHasStaticData.cpp
==============================================================================
--- sandbox/tti/libs/tti/test/TestMFHasStaticData.cpp (original)
+++ sandbox/tti/libs/tti/test/TestMFHasStaticData.cpp 2010-12-20 12:13:19 EST (Mon, 20 Dec 2010)
@@ -4,6 +4,15 @@
 int main()
   {
   
+ BOOST_TEST((tti::mf_has_static_data
+ <
+ tti::has_static_member_DSMember,
+ boost::mpl::identity<AType>,
+ boost::mpl::identity<short>
+ >
+ ::value
+ ));
+
   return boost::report_errors();
 
   }

Modified: sandbox/tti/libs/tti/test/TestMFHasStaticData.hpp
==============================================================================
--- sandbox/tti/libs/tti/test/TestMFHasStaticData.hpp (original)
+++ sandbox/tti/libs/tti/test/TestMFHasStaticData.hpp 2010-12-20 12:13:19 EST (Mon, 20 Dec 2010)
@@ -4,4 +4,7 @@
 #include "TestStructs.hpp"
 #include <boost/tti/TTIntrospection.hpp>
 
+TTI_HAS_STATIC_MEMBER(DSMember)
+TTI_HAS_STATIC_MEMBER(SomeStaticData)
+
 #endif // TEST_MF_HAS_STATIC_DATA_HPP

Modified: sandbox/tti/libs/tti/test/TestMFHasStaticDataCompile.cpp
==============================================================================
--- sandbox/tti/libs/tti/test/TestMFHasStaticDataCompile.cpp (original)
+++ sandbox/tti/libs/tti/test/TestMFHasStaticDataCompile.cpp 2010-12-20 12:13:19 EST (Mon, 20 Dec 2010)
@@ -4,7 +4,24 @@
 int main()
   {
   
- BOOST_MPL_ASSERT((boost::mpl::true_));
+ // You can always instantiate without compiler errors
+
+ tti::mf_has_static_data
+ <
+ tti::has_static_member_SomeStaticData,
+ boost::mpl::identity<AnotherType>,
+ boost::mpl::identity<double>
+ > aVar;
+
+ // Compile time asserts
+
+ BOOST_MPL_ASSERT((tti::mf_has_static_data
+ <
+ tti::has_static_member_DSMember,
+ boost::mpl::identity<AType>,
+ boost::mpl::identity<short>
+ >
+ ));
   
   return 0;
 

Modified: sandbox/tti/libs/tti/test/TestMFHasStaticDataFail.cpp
==============================================================================
--- sandbox/tti/libs/tti/test/TestMFHasStaticDataFail.cpp (original)
+++ sandbox/tti/libs/tti/test/TestMFHasStaticDataFail.cpp 2010-12-20 12:13:19 EST (Mon, 20 Dec 2010)
@@ -4,7 +4,15 @@
 int main()
   {
   
- BOOST_MPL_ASSERT((boost::mpl::false_));
+ // SomeStaticData does not exist at all
+
+ BOOST_MPL_ASSERT((tti::mf_has_static_data
+ <
+ tti::has_static_member_SomeStaticData,
+ boost::mpl::identity<AnotherType>,
+ boost::mpl::identity<int>
+ >
+ ));
   
   return 0;
 

Modified: sandbox/tti/libs/tti/test/TestMFHasStaticDataFail2.cpp
==============================================================================
--- sandbox/tti/libs/tti/test/TestMFHasStaticDataFail2.cpp (original)
+++ sandbox/tti/libs/tti/test/TestMFHasStaticDataFail2.cpp 2010-12-20 12:13:19 EST (Mon, 20 Dec 2010)
@@ -4,7 +4,15 @@
 int main()
   {
   
- BOOST_MPL_ASSERT((boost::mpl::false_));
+ // Wrong enclosing type
+
+ BOOST_MPL_ASSERT((tti::mf_has_static_data
+ <
+ tti::has_static_member_DSMember,
+ boost::mpl::identity<AnotherType>,
+ boost::mpl::identity<short>
+ >
+ ));
   
   return 0;
 

Added: sandbox/tti/libs/tti/test/TestMFHasStaticDataFail3.cpp
==============================================================================
--- (empty file)
+++ sandbox/tti/libs/tti/test/TestMFHasStaticDataFail3.cpp 2010-12-20 12:13:19 EST (Mon, 20 Dec 2010)
@@ -0,0 +1,19 @@
+#include "TestMFHasStaticData.hpp"
+#include <boost/mpl/assert.hpp>
+
+int main()
+ {
+
+ // Wrong member type
+
+ BOOST_MPL_ASSERT((tti::mf_has_static_data
+ <
+ tti::has_static_member_DSMember,
+ boost::mpl::identity<AType>,
+ boost::mpl::identity<int>
+ >
+ ));
+
+ return 0;
+
+ }

Modified: sandbox/tti/libs/tti/test/TestMFHasStaticFunction.cpp
==============================================================================
--- sandbox/tti/libs/tti/test/TestMFHasStaticFunction.cpp (original)
+++ sandbox/tti/libs/tti/test/TestMFHasStaticFunction.cpp 2010-12-20 12:13:19 EST (Mon, 20 Dec 2010)
@@ -4,6 +4,39 @@
 int main()
   {
   
+ BOOST_TEST((tti::mf_has_static_function
+ <
+ tti::HaveTheSIntFunction,
+ boost::mpl::identity<AType>,
+ boost::mpl::identity<int>,
+ boost::mpl::identity<long>,
+ boost::mpl::identity<double>
+ >
+ ::value
+ ));
+
+ BOOST_TEST((tti::mf_has_static_function
+ <
+ tti::TheTIntFunction,
+ boost::mpl::identity<AnotherType>,
+ boost::mpl::identity<AType>,
+ boost::mpl::identity<long>,
+ boost::mpl::identity<double>
+ >
+ ::value
+ ));
+
+ BOOST_TEST((tti::mf_has_static_function
+ <
+ tti::has_static_member_TSFunction,
+ boost::mpl::identity<AnotherType>,
+ tti::member_type_AStructType<AType>,
+ tti::NameIntType<AType>,
+ boost::mpl::identity<double>
+ >
+ ::value
+ ));
+
   return boost::report_errors();
 
   }

Modified: sandbox/tti/libs/tti/test/TestMFHasStaticFunction.hpp
==============================================================================
--- sandbox/tti/libs/tti/test/TestMFHasStaticFunction.hpp (original)
+++ sandbox/tti/libs/tti/test/TestMFHasStaticFunction.hpp 2010-12-20 12:13:19 EST (Mon, 20 Dec 2010)
@@ -4,4 +4,12 @@
 #include "TestStructs.hpp"
 #include <boost/tti/TTIntrospection.hpp>
 
+TTI_TRAIT_HAS_STATIC_MEMBER(HaveTheSIntFunction,SIntFunction)
+TTI_TRAIT_HAS_STATIC_MEMBER(TheTIntFunction,TIntFunction)
+TTI_HAS_STATIC_MEMBER(TSFunction)
+TTI_TRAIT_HAS_STATIC_MEMBER(Pickedname,SomeStaticFunction)
+
+TTI_MEMBER_TYPE(AStructType)
+TTI_TRAIT_MEMBER_TYPE(NameIntType,AnIntType)
+
 #endif // TEST_MF_HAS_STATIC_FUNCTION_HPP

Modified: sandbox/tti/libs/tti/test/TestMFHasStaticFunctionCompile.cpp
==============================================================================
--- sandbox/tti/libs/tti/test/TestMFHasStaticFunctionCompile.cpp (original)
+++ sandbox/tti/libs/tti/test/TestMFHasStaticFunctionCompile.cpp 2010-12-20 12:13:19 EST (Mon, 20 Dec 2010)
@@ -4,7 +4,56 @@
 int main()
   {
   
- BOOST_MPL_ASSERT((boost::mpl::true_));
+ // You can always instantiate without compiler errors
+
+ tti::mf_has_static_function
+ <
+ tti::HaveTheSIntFunction,
+ boost::mpl::identity<AType>,
+ boost::mpl::identity<int>,
+ boost::mpl::identity<long>,
+ boost::mpl::identity<short>
+ > aVar;
+
+ tti::mf_has_static_function
+ <
+ tti::Pickedname,
+ boost::mpl::identity<AType>,
+ boost::mpl::identity<double>,
+ boost::mpl::identity<float>
+ > aVar2;
+
+ // Compile time asserts
+
+ BOOST_MPL_ASSERT((tti::mf_has_static_function
+ <
+ tti::HaveTheSIntFunction,
+ boost::mpl::identity<AType>,
+ boost::mpl::identity<int>,
+ boost::mpl::identity<long>,
+ boost::mpl::identity<double>
+ >
+ ));
+
+ BOOST_MPL_ASSERT((tti::mf_has_static_function
+ <
+ tti::TheTIntFunction,
+ boost::mpl::identity<AnotherType>,
+ boost::mpl::identity<AType>,
+ boost::mpl::identity<long>,
+ boost::mpl::identity<double>
+ >
+ ));
+
+ BOOST_MPL_ASSERT((tti::mf_has_static_function
+ <
+ tti::has_static_member_TSFunction,
+ boost::mpl::identity<AnotherType>,
+ tti::member_type_AStructType<AType>,
+ tti::NameIntType<AType>,
+ boost::mpl::identity<double>
+ >
+ ));
   
   return 0;
 

Modified: sandbox/tti/libs/tti/test/TestMFHasStaticFunctionFail.cpp
==============================================================================
--- sandbox/tti/libs/tti/test/TestMFHasStaticFunctionFail.cpp (original)
+++ sandbox/tti/libs/tti/test/TestMFHasStaticFunctionFail.cpp 2010-12-20 12:13:19 EST (Mon, 20 Dec 2010)
@@ -4,7 +4,17 @@
 int main()
   {
   
- BOOST_MPL_ASSERT((boost::mpl::false_));
+ // SomeStaticFunction does not exist at all
+
+ BOOST_MPL_ASSERT((tti::mf_has_static_function
+ <
+ tti::Pickedname,
+ boost::mpl::identity<AType>,
+ boost::mpl::identity<short>,
+ boost::mpl::identity<int>,
+ boost::mpl::identity<long>
+ >
+ ));
   
   return 0;
 

Modified: sandbox/tti/libs/tti/test/TestMFHasStaticFunctionFail2.cpp
==============================================================================
--- sandbox/tti/libs/tti/test/TestMFHasStaticFunctionFail2.cpp (original)
+++ sandbox/tti/libs/tti/test/TestMFHasStaticFunctionFail2.cpp 2010-12-20 12:13:19 EST (Mon, 20 Dec 2010)
@@ -4,7 +4,17 @@
 int main()
   {
   
- BOOST_MPL_ASSERT((boost::mpl::false_));
+ // Wrong enclosing type
+
+ BOOST_MPL_ASSERT((tti::mf_has_static_function
+ <
+ tti::HaveTheSIntFunction,
+ boost::mpl::identity<AnotherType>,
+ boost::mpl::identity<int>,
+ boost::mpl::identity<long>,
+ boost::mpl::identity<double>
+ >
+ ));
   
   return 0;
 

Added: sandbox/tti/libs/tti/test/TestMFHasStaticFunctionFail3.cpp
==============================================================================
--- (empty file)
+++ sandbox/tti/libs/tti/test/TestMFHasStaticFunctionFail3.cpp 2010-12-20 12:13:19 EST (Mon, 20 Dec 2010)
@@ -0,0 +1,21 @@
+#include "TestMFHasStaticFunction.hpp"
+#include <boost/mpl/assert.hpp>
+
+int main()
+ {
+
+ // Wrong function parameter type
+
+ BOOST_MPL_ASSERT((tti::mf_has_static_function
+ <
+ tti::has_static_member_TSFunction,
+ boost::mpl::identity<AnotherType>,
+ tti::member_type_AStructType<AType>,
+ tti::NameIntType<AnotherType>,
+ boost::mpl::identity<double>
+ >
+ ));
+
+ 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