|
Boost-Commit : |
Subject: [Boost-commit] svn:boost r67276 - sandbox/tti/libs/tti/test
From: eldiener_at_[hidden]
Date: 2010-12-16 11:30:45
Author: eldiener
Date: 2010-12-16 11:30:38 EST (Thu, 16 Dec 2010)
New Revision: 67276
URL: http://svn.boost.org/trac/boost/changeset/67276
Log:
Tests for MFHasMemberData
Added:
sandbox/tti/libs/tti/test/TestMFHasMemberDataFail3.cpp (contents, props changed)
Text files modified:
sandbox/tti/libs/tti/test/Jamfile.v2 | 1 +
sandbox/tti/libs/tti/test/TestMFHasMemberData.cpp | 6 ++++++
sandbox/tti/libs/tti/test/TestMFHasMemberData.hpp | 5 +++++
sandbox/tti/libs/tti/test/TestMFHasMemberDataCompile.cpp | 5 ++++-
sandbox/tti/libs/tti/test/TestMFHasMemberDataFail.cpp | 5 ++++-
sandbox/tti/libs/tti/test/TestMFHasMemberDataFail2.cpp | 5 ++++-
6 files changed, 24 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-16 11:30:38 EST (Thu, 16 Dec 2010)
@@ -61,6 +61,7 @@
[ compile TestMFHasMemberDataCompile.cpp ]
[ compile-fail TestMFHasMemberDataFail.cpp ]
[ compile-fail TestMFHasMemberDataFail2.cpp ]
+ [ compile-fail TestMFHasMemberDataFail3.cpp ]
[ run TestMFHasMemberFunction.cpp ]
[ compile TestMFHasMemberFunctionCompile.cpp ]
[ compile-fail TestMFHasMemberFunctionFail.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-16 11:30:38 EST (Thu, 16 Dec 2010)
@@ -1,9 +1,15 @@
#include "TestMFHasMemberData.hpp"
#include <boost/detail/lightweight_test.hpp>
+#include <boost/mpl/identity.hpp>
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));
+
return boost::report_errors();
}
Modified: sandbox/tti/libs/tti/test/TestMFHasMemberData.hpp
==============================================================================
--- sandbox/tti/libs/tti/test/TestMFHasMemberData.hpp (original)
+++ sandbox/tti/libs/tti/test/TestMFHasMemberData.hpp 2010-12-16 11:30:38 EST (Thu, 16 Dec 2010)
@@ -4,4 +4,9 @@
#include "TestStructs.hpp"
#include <boost/tti/TTIntrospection.hpp>
+TTI_HAS_MEMBER(AnInt)
+TTI_HAS_MEMBER(aMember)
+TTI_TRAIT_HAS_MEMBER(CMember,cMem)
+TTI_HAS_MEMBER(someDataMember)
+
#endif // TEST_MF_HAS_MEMBER_DATA_HPP
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-16 11:30:38 EST (Thu, 16 Dec 2010)
@@ -4,7 +4,10 @@
int main()
{
- BOOST_MPL_ASSERT((boost::mpl::true_));
+ 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-16 11:30:38 EST (Thu, 16 Dec 2010)
@@ -1,10 +1,13 @@
#include "TestMFHasMemberData.hpp"
#include <boost/mpl/assert.hpp>
+#include <boost/mpl/identity.hpp>
int main()
{
- BOOST_MPL_ASSERT((boost::mpl::false_));
+ // 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> >));
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-16 11:30:38 EST (Thu, 16 Dec 2010)
@@ -1,10 +1,13 @@
#include "TestMFHasMemberData.hpp"
#include <boost/mpl/assert.hpp>
+#include <boost/mpl/identity.hpp>
int main()
{
- BOOST_MPL_ASSERT((boost::mpl::false_));
+ // 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> >));
return 0;
Added: sandbox/tti/libs/tti/test/TestMFHasMemberDataFail3.cpp
==============================================================================
--- (empty file)
+++ sandbox/tti/libs/tti/test/TestMFHasMemberDataFail3.cpp 2010-12-16 11:30:38 EST (Thu, 16 Dec 2010)
@@ -0,0 +1,14 @@
+#include "TestMFHasMemberData.hpp"
+#include <boost/mpl/assert.hpp>
+#include <boost/mpl/identity.hpp>
+
+int main()
+ {
+
+ // Wrong enclosing type
+
+ BOOST_MPL_ASSERT((tti::mf_has_member_data<tti::has_member_aMember,boost::mpl::identity<AType>,boost::mpl::identity<bool> >));
+
+ 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