Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r81845 - trunk/libs/tti/test
From: eldiener_at_[hidden]
Date: 2012-12-10 19:47:22


Author: eldiener
Date: 2012-12-10 19:47:21 EST (Mon, 10 Dec 2012)
New Revision: 81845
URL: http://svn.boost.org/trac/boost/changeset/81845

Log:
New tests for BOOST_HAS_DATA
Added:
   trunk/libs/tti/test/test_has_data_compile.cpp (contents, props changed)
   trunk/libs/tti/test/test_has_data_fail.cpp (contents, props changed)
   trunk/libs/tti/test/test_has_data_fail2.cpp (contents, props changed)
   trunk/libs/tti/test/test_has_data_fail3.cpp (contents, props changed)
   trunk/libs/tti/test/test_has_data_fail4.cpp (contents, props changed)
   trunk/libs/tti/test/test_has_data_fail5.cpp (contents, props changed)
   trunk/libs/tti/test/test_has_data_fail6.cpp (contents, props changed)
Text files modified:
   trunk/libs/tti/test/Jamfile.v2 | 11 +++++++----
   1 files changed, 7 insertions(+), 4 deletions(-)

Modified: trunk/libs/tti/test/Jamfile.v2
==============================================================================
--- trunk/libs/tti/test/Jamfile.v2 (original)
+++ trunk/libs/tti/test/Jamfile.v2 2012-12-10 19:47:21 EST (Mon, 10 Dec 2012)
@@ -94,10 +94,13 @@
 alias ttidata
     :
         [ run test_has_data.cpp ]
-# [ compile test_has_mem_data_compile.cpp ]
-# [ compile-fail test_has_mem_data_fail.cpp ]
-# [ compile-fail test_has_mem_data_fail2.cpp ]
-# [ compile-fail test_has_mem_data_fail3.cpp ]
+ [ compile test_has_data_compile.cpp ]
+ [ compile-fail test_has_data_fail.cpp ]
+ [ compile-fail test_has_data_fail2.cpp ]
+ [ compile-fail test_has_data_fail3.cpp ]
+ [ compile-fail test_has_data_fail4.cpp ]
+ [ compile-fail test_has_data_fail5.cpp ]
+ [ compile-fail test_has_data_fail6.cpp ]
     ;
 
 #

Added: trunk/libs/tti/test/test_has_data_compile.cpp
==============================================================================
--- (empty file)
+++ trunk/libs/tti/test/test_has_data_compile.cpp 2012-12-10 19:47:21 EST (Mon, 10 Dec 2012)
@@ -0,0 +1,36 @@
+
+// (C) Copyright Edward Diener 2012
+// Use, modification and distribution are subject to the Boost Software License,
+// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt).
+
+#include "test_has_data.hpp"
+#include <boost/mpl/assert.hpp>
+
+int main()
+ {
+
+ // You can always instantiate without compiler errors
+
+ BOOST_TTI_HAS_DATA_GEN(aMember)<AType,long> aVar;
+ BOOST_TTI_HAS_DATA_GEN(SomeStaticData)<AnotherType,long> aVar2;
+ BOOST_TTI_HAS_DATA_GEN(someDataMember)<AnotherType,double> aVar3;
+
+ BOOST_MPL_ASSERT((BOOST_TTI_HAS_DATA_GEN(AnInt)<AType,int>));
+ BOOST_MPL_ASSERT_NOT((BOOST_TTI_HAS_DATA_GEN(SomeStaticData)<AnotherType,float>));
+ BOOST_MPL_ASSERT((BOOST_TTI_HAS_DATA_GEN(AnInt)<AnotherType,long>));
+ BOOST_MPL_ASSERT((BOOST_TTI_HAS_DATA_GEN(DSMember)<AType,short>));
+ BOOST_MPL_ASSERT((BOOST_TTI_HAS_DATA_GEN(aMember)<AnotherType,bool>));
+ BOOST_MPL_ASSERT_NOT((BOOST_TTI_HAS_DATA_GEN(aMember)<AnotherType,int>));
+ BOOST_MPL_ASSERT((DCMember<AnotherType,bool>));
+ BOOST_MPL_ASSERT_NOT((BOOST_TTI_HAS_DATA_GEN(someDataMember)<AType,short>));
+ BOOST_MPL_ASSERT((BOOST_TTI_HAS_DATA_GEN(IntBT)<AType,AType::BType>));
+ BOOST_MPL_ASSERT((DStatName<AnotherType,AType::AStructType>));
+ BOOST_MPL_ASSERT((DNestedData<AType,AType::BType::CType>));
+ BOOST_MPL_ASSERT((BOOST_TTI_HAS_DATA_GEN(CIntValue)<AnotherType,const int>));
+ BOOST_MPL_ASSERT((DAOther<AnotherType,AType>));
+ BOOST_MPL_ASSERT((BOOST_TTI_HAS_DATA_GEN(ONestStr)<AnotherType,AType::AStructType>));
+
+ return 0;
+
+ }

Added: trunk/libs/tti/test/test_has_data_fail.cpp
==============================================================================
--- (empty file)
+++ trunk/libs/tti/test/test_has_data_fail.cpp 2012-12-10 19:47:21 EST (Mon, 10 Dec 2012)
@@ -0,0 +1,19 @@
+
+// (C) Copyright Edward Diener 2012
+// Use, modification and distribution are subject to the Boost Software License,
+// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt).
+
+#include "test_has_data.hpp"
+#include <boost/mpl/assert.hpp>
+
+int main()
+ {
+
+ // someDataMember does not exist at all
+
+ BOOST_MPL_ASSERT(( BOOST_TTI_HAS_DATA_GEN(someDataMember)<AType,short> ));
+
+ return 0;
+
+ }

Added: trunk/libs/tti/test/test_has_data_fail2.cpp
==============================================================================
--- (empty file)
+++ trunk/libs/tti/test/test_has_data_fail2.cpp 2012-12-10 19:47:21 EST (Mon, 10 Dec 2012)
@@ -0,0 +1,19 @@
+
+// (C) Copyright Edward Diener 2012
+// Use, modification and distribution are subject to the Boost Software License,
+// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt).
+
+#include "test_has_data.hpp"
+#include <boost/mpl/assert.hpp>
+
+int main()
+ {
+
+ // Wrong data signature for aMember
+
+ BOOST_MPL_ASSERT(( BOOST_TTI_HAS_DATA_GEN(aMember)<AnotherType,int> ));
+
+ return 0;
+
+ }

Added: trunk/libs/tti/test/test_has_data_fail3.cpp
==============================================================================
--- (empty file)
+++ trunk/libs/tti/test/test_has_data_fail3.cpp 2012-12-10 19:47:21 EST (Mon, 10 Dec 2012)
@@ -0,0 +1,18 @@
+
+// (C) Copyright Edward Diener 2012
+// Use, modification and distribution are subject to the Boost Software License,
+// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt).
+
+#include "test_has_data.hpp"
+
+int main()
+ {
+
+ // Data signature has type which does not exist
+
+ BOOST_TTI_HAS_DATA_GEN(aMember)<AnotherType,AType::NTHType> aVar;
+
+ return 0;
+
+ }

Added: trunk/libs/tti/test/test_has_data_fail4.cpp
==============================================================================
--- (empty file)
+++ trunk/libs/tti/test/test_has_data_fail4.cpp 2012-12-10 19:47:21 EST (Mon, 10 Dec 2012)
@@ -0,0 +1,19 @@
+
+// (C) Copyright Edward Diener 2012
+// Use, modification and distribution are subject to the Boost Software License,
+// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt).
+
+#include "test_has_data.hpp"
+#include <boost/mpl/assert.hpp>
+
+int main()
+ {
+
+ // SomeStaticData does not exist at all
+
+ BOOST_MPL_ASSERT((BOOST_TTI_HAS_DATA_GEN(SomeStaticData)<AnotherType,float>));
+
+ return 0;
+
+ }

Added: trunk/libs/tti/test/test_has_data_fail5.cpp
==============================================================================
--- (empty file)
+++ trunk/libs/tti/test/test_has_data_fail5.cpp 2012-12-10 19:47:21 EST (Mon, 10 Dec 2012)
@@ -0,0 +1,19 @@
+
+// (C) Copyright Edward Diener 2012
+// Use, modification and distribution are subject to the Boost Software License,
+// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt).
+
+#include "test_has_data.hpp"
+#include <boost/mpl/assert.hpp>
+
+int main()
+ {
+
+ // Wrong enclosing type for DSMember
+
+ BOOST_MPL_ASSERT((BOOST_TTI_DATA_GEN(DSMember)<AnotherType,short>));
+
+ return 0;
+
+ }

Added: trunk/libs/tti/test/test_has_data_fail6.cpp
==============================================================================
--- (empty file)
+++ trunk/libs/tti/test/test_has_data_fail6.cpp 2012-12-10 19:47:21 EST (Mon, 10 Dec 2012)
@@ -0,0 +1,18 @@
+
+// (C) Copyright Edward Diener 2012
+// Use, modification and distribution are subject to the Boost Software License,
+// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt).
+
+#include "test_has_data.hpp"
+
+int main()
+ {
+
+ // Data signature has type which does not exist
+
+ BOOST_TTI_HAS_DATA_GEN(DSMember)<NoType,short> aVar;
+
+ 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