Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r71000 - branches/pplib/variadics/libs/preprocessor/test
From: eldiener_at_[hidden]
Date: 2011-04-05 09:57:49


Author: eldiener
Date: 2011-04-05 09:57:47 EDT (Tue, 05 Apr 2011)
New Revision: 71000
URL: http://svn.boost.org/trac/boost/changeset/71000

Log:
Updated tests for variadic macros.
Text files modified:
   branches/pplib/variadics/libs/preprocessor/test/array.cpp | 2 +
   branches/pplib/variadics/libs/preprocessor/test/tuple.cpp | 52 +++++++++++++++++++++------------------
   2 files changed, 30 insertions(+), 24 deletions(-)

Modified: branches/pplib/variadics/libs/preprocessor/test/array.cpp
==============================================================================
--- branches/pplib/variadics/libs/preprocessor/test/array.cpp (original)
+++ branches/pplib/variadics/libs/preprocessor/test/array.cpp 2011-04-05 09:57:47 EDT (Tue, 05 Apr 2011)
@@ -15,6 +15,7 @@
 # include <boost/preprocessor/seq/elem.hpp>
 # include <boost/preprocessor/tuple/elem.hpp>
 # if BOOST_PP_VARIADICS
+# include <boost/preprocessor/variadic/size.hpp>
 # include <boost/preprocessor/variadic/elem.hpp>
 # endif
 
@@ -36,6 +37,7 @@
 
 BEGIN BOOST_PP_VARIADIC_ELEM(2,BOOST_PP_ARRAY_ENUM(ARRAY)) == 2 END
 BEGIN BOOST_PP_VARIADIC_ELEM(3,BOOST_PP_ARRAY_ENUM((5, (0, 1, 2, 3, 4)))) == 3 END
+BEGIN BOOST_PP_VARIADIC_SIZE(BOOST_PP_ARRAY_ENUM((5, (0, 1, 2, 3, 4)))) == 5 END
 
 # endif
 

Modified: branches/pplib/variadics/libs/preprocessor/test/tuple.cpp
==============================================================================
--- branches/pplib/variadics/libs/preprocessor/test/tuple.cpp (original)
+++ branches/pplib/variadics/libs/preprocessor/test/tuple.cpp 2011-04-05 09:57:47 EDT (Tue, 05 Apr 2011)
@@ -13,45 +13,49 @@
 # include <boost/preprocessor/arithmetic/add.hpp>
 # include <boost/preprocessor/cat.hpp>
 # include <boost/preprocessor/control/if.hpp>
+# include <boost/preprocessor/array/elem.hpp>
+# include <boost/preprocessor/list/at.hpp>
+# include <boost/preprocessor/seq/elem.hpp>
+# if BOOST_PP_VARIADICS
+# include <boost/preprocessor/variadic/size.hpp>
+# include <boost/preprocessor/variadic/elem.hpp>
+# endif
 # include <libs/preprocessor/test/test.h>
 
 # define TUPLE (0, 1, 2, 3, 4, 5)
-
-BEGIN BOOST_PP_TUPLE_ELEM(6, 3, TUPLE) == 3 END
-BEGIN BOOST_PP_TUPLE_ELEM(6, 5, TUPLE) == 5 END
+# define T2 (+3, /2, +6)
 
 #if BOOST_PP_VARIADICS
 
-BEGIN BOOST_PP_TUPLE_ELEM(3, TUPLE) == 3 END
-BEGIN BOOST_PP_TUPLE_ELEM(5, TUPLE) == 5 END
+# define CALC(x) BOOST_PP_TUPLE_ELEM(0, x) BOOST_PP_TUPLE_ELEM(1, x) BOOST_PP_TUPLE_ELEM(2, x)
+# define TEST_EAT BOOST_PP_TUPLE_EAT()(1, 2) 4
 
-#endif
+#else
 
 # define CALC(x) BOOST_PP_TUPLE_ELEM(3, 0, x) BOOST_PP_TUPLE_ELEM(3, 1, x) BOOST_PP_TUPLE_ELEM(3, 2, x)
-# define T2 (+3, /2, +6)
+# define TEST_EAT BOOST_PP_TUPLE_EAT(2)(1, 2) 4
+
+#endif
 
+BEGIN BOOST_PP_TUPLE_ELEM(6, 3, TUPLE) == 3 END
+BEGIN BOOST_PP_TUPLE_ELEM(6, 5, TUPLE) == 5 END
 BEGIN CALC(T2) == 7 END
 BEGIN CALC(BOOST_PP_TUPLE_REVERSE(3, T2)) == 6 END
+BEGIN TEST_EAT == 4 END
+BEGIN BOOST_PP_ARRAY_ELEM(3,BOOST_PP_TUPLE_TO_ARRAY(6,TUPLE)) == 3 END
+BEGIN BOOST_PP_LIST_AT(BOOST_PP_TUPLE_TO_LIST(6,TUPLE), 2) == 2 END
+BEGIN BOOST_PP_SEQ_ELEM(4,BOOST_PP_TUPLE_TO_SEQ(6,TUPLE)) == 4 END
 
 #if BOOST_PP_VARIADICS
 
-#undef CALC
-
-# define CALC(x) BOOST_PP_TUPLE_ELEM(0, x) BOOST_PP_TUPLE_ELEM(1, x) BOOST_PP_TUPLE_ELEM(2, x)
-
-BEGIN CALC(T2) == 7 END
+BEGIN BOOST_PP_TUPLE_ELEM(3, TUPLE) == 3 END
+BEGIN BOOST_PP_TUPLE_ELEM(5, TUPLE) == 5 END
 BEGIN CALC(BOOST_PP_TUPLE_REVERSE(T2)) == 6 END
+BEGIN BOOST_PP_VARIADIC_ELEM(2,BOOST_PP_TUPLE_ENUM(BOOST_PP_TUPLE_REVERSE(TUPLE))) == 3 END
+BEGIN BOOST_PP_VARIADIC_SIZE(BOOST_PP_TUPLE_ENUM(TUPLE)) == 6 END
+BEGIN BOOST_PP_TUPLE_SIZE(TUPLE) == 6 END
+BEGIN BOOST_PP_ARRAY_ELEM(3,BOOST_PP_TUPLE_TO_ARRAY(TUPLE)) == 3 END
+BEGIN BOOST_PP_LIST_AT(BOOST_PP_TUPLE_TO_LIST(TUPLE), 2) == 2 END
+BEGIN BOOST_PP_SEQ_ELEM(4,BOOST_PP_TUPLE_TO_SEQ(TUPLE)) == 4 END
 
 #endif
-
-#if BOOST_PP_VARIADICS
-
-#define TEST_EAT BOOST_PP_TUPLE_EAT()(1, 2) 4
-
-#else
-
-#define TEST_EAT BOOST_PP_TUPLE_EAT(2)(1, 2) 4
-
-#endif
-
-BEGIN TEST_EAT == 4 END


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