|
Boost-Commit : |
Subject: [Boost-commit] svn:boost r86789 - trunk/libs/preprocessor/test
From: eldiener_at_[hidden]
Date: 2013-11-23 02:45:00
Author: eldiener
Date: 2013-11-23 02:45:00 EST (Sat, 23 Nov 2013)
New Revision: 86789
URL: http://svn.boost.org/trac/boost/changeset/86789
Log:
Updated tests.
Text files modified:
trunk/libs/preprocessor/test/arithmetic.cxx | 20 ++++++++++++++++++++
trunk/libs/preprocessor/test/facilities.cxx | 26 ++++++++++++++++++++++++++
2 files changed, 46 insertions(+), 0 deletions(-)
Modified: trunk/libs/preprocessor/test/arithmetic.cxx
==============================================================================
--- trunk/libs/preprocessor/test/arithmetic.cxx Fri Nov 22 22:59:40 2013 (r86788)
+++ trunk/libs/preprocessor/test/arithmetic.cxx 2013-11-23 02:45:00 EST (Sat, 23 Nov 2013) (r86789)
@@ -60,3 +60,23 @@
BEGIN BOOST_PP_MOD(BOOST_PP_MOD(5, 3), 3) == 2 END
BEGIN BOOST_PP_MOD(5, BOOST_PP_MOD(4, 3)) == 0 END
+
+/* increment */
+
+BEGIN BOOST_PP_INC(0) == 1 END
+BEGIN BOOST_PP_INC(22) == 23 END
+BEGIN BOOST_PP_INC(256) == 256 END
+
+BEGIN BOOST_PP_INC(BOOST_PP_INC(0)) == 2 END
+BEGIN BOOST_PP_INC(BOOST_PP_INC(17)) == 19 END
+BEGIN BOOST_PP_INC(BOOST_PP_INC(255)) == 256 END
+
+/* decrement */
+
+BEGIN BOOST_PP_DEC(256) == 255 END
+BEGIN BOOST_PP_DEC(47) == 46 END
+BEGIN BOOST_PP_DEC(0) == 0 END
+
+BEGIN BOOST_PP_DEC(BOOST_PP_DEC(256)) == 254 END
+BEGIN BOOST_PP_DEC(BOOST_PP_DEC(85)) == 83 END
+BEGIN BOOST_PP_DEC(BOOST_PP_DEC(1)) == 0 END
Modified: trunk/libs/preprocessor/test/facilities.cxx
==============================================================================
--- trunk/libs/preprocessor/test/facilities.cxx Fri Nov 22 22:59:40 2013 (r86788)
+++ trunk/libs/preprocessor/test/facilities.cxx 2013-11-23 02:45:00 EST (Sat, 23 Nov 2013) (r86789)
@@ -11,6 +11,8 @@
#
# include <boost/preprocessor/cat.hpp>
# include <boost/preprocessor/facilities.hpp>
+# include <boost/preprocessor/arithmetic/add.hpp>
+# include <boost/preprocessor/arithmetic/mul.hpp>
# include <libs/preprocessor/test/test.h>
BEGIN BOOST_PP_APPLY(BOOST_PP_NIL) 0 == 0 END
@@ -26,3 +28,27 @@
BEGIN BOOST_PP_IDENTITY(1)() == 1 END
BEGIN BOOST_PP_CAT(BOOST_PP_INTERCEPT, 2) 1 == 1 END
+
+#if BOOST_PP_VARIADICS
+
+#define OVMAC_1(x) BOOST_PP_ADD(x,5)
+#define OVMAC_2(x,y) BOOST_PP_ADD(x,y)
+#define OVMAC_3(x,y,z) BOOST_PP_ADD(BOOST_PP_MUL(x,y),z)
+#define OVMAC_4(x,y,z,a) BOOST_PP_ADD(BOOST_PP_MUL(x,y),BOOST_PP_MUL(a,z))
+
+#if defined(BOOST_PP_VARIADICS_MSVC)
+
+#define OVTEST(...) BOOST_PP_CAT(BOOST_PP_OVERLOAD(OVMAC_,__VA_ARGS__)(__VA_ARGS__),BOOST_PP_EMPTY())
+
+#else
+
+#define OVTEST(...) BOOST_PP_OVERLOAD(OVMAC_,__VA_ARGS__)(__VA_ARGS__)
+
+#endif
+
+BEGIN OVTEST(3,4,5) == 17 END
+BEGIN OVTEST(9,3,2,7) == 41 END
+BEGIN OVTEST(8) == 13 END
+BEGIN OVTEST(24,61) == 85 END
+
+#endif
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