|
Boost-Commit : |
Subject: [Boost-commit] svn:boost r65760 - sandbox/variadic_macro_data/libs/variadic_macro_data/test
From: eldiener_at_[hidden]
Date: 2010-10-04 22:42:38
Author: eldiener
Date: 2010-10-04 22:42:37 EDT (Mon, 04 Oct 2010)
New Revision: 65760
URL: http://svn.boost.org/trac/boost/changeset/65760
Log:
Better tests
Text files modified:
sandbox/variadic_macro_data/libs/variadic_macro_data/test/TestData.cpp | 50 ++++++++++++++++++++++++++++++++++++---
1 files changed, 46 insertions(+), 4 deletions(-)
Modified: sandbox/variadic_macro_data/libs/variadic_macro_data/test/TestData.cpp
==============================================================================
--- sandbox/variadic_macro_data/libs/variadic_macro_data/test/TestData.cpp (original)
+++ sandbox/variadic_macro_data/libs/variadic_macro_data/test/TestData.cpp 2010-10-04 22:42:37 EDT (Mon, 04 Oct 2010)
@@ -1,23 +1,32 @@
#include <boost/variadic_macro_data/VariadicMacroData.hpp>
#include <boost/detail/lightweight_test.hpp>
#include <vector>
+#include <string>
#include <boost/type_traits/is_same.hpp>
+#include <boost/type_traits/is_const.hpp>
#include <boost/preprocessor/arithmetic/inc.hpp>
+#include <boost/preprocessor/cat.hpp>
+#include <boost/preprocessor/control.hpp>
+#include <boost/preprocessor/comparison/less.hpp>
+#include <boost/preprocessor/logical/and.hpp>
+#include <boost/preprocessor/logical/bitor.hpp>
+#include <boost/preprocessor/selection/max.hpp>
+#include <boost/preprocessor/stringize.hpp>
int main()
{
#if !defined(BOOST_NO_VARIADIC_MACROS)
- #define VMD_TEST_THE_DATA 657,1298,the,*,we99,33,++,jjgg,+=
+ #define VMD_TEST_THE_DATA 147,12,the,*,we99,33,++,jjgg,+=,0,1
int mSize(VMD_DATA_SIZE(VMD_TEST_THE_DATA));
- BOOST_TEST_EQ(mSize,9);
+ BOOST_TEST_EQ(mSize,11);
mSize VMD_DATA_ELEM(8,VMD_TEST_THE_DATA) 5;
- BOOST_TEST_EQ(mSize,14);
+ BOOST_TEST_EQ(mSize,16);
int aSize(VMD_DATA_SIZE(23,ll,678,456));
@@ -25,14 +34,47 @@
aSize += mSize VMD_DATA_ELEM(3,VMD_TEST_THE_DATA) VMD_DATA_SIZE(VMD_TEST_THE_DATA);
- BOOST_TEST_EQ(aSize,130);
+ BOOST_TEST_EQ(aSize,4 + (16 * 11));
BOOST_TEST_EQ(BOOST_PP_INC(VMD_DATA_ELEM(5,VMD_TEST_THE_DATA)),34);
+ aSize BOOST_PP_CAT(VMD_DATA_ELEM(3,VMD_TEST_THE_DATA),=) VMD_DATA_ELEM(1,VMD_TEST_THE_DATA);
+
+ BOOST_TEST_EQ(aSize,(4 + (16 * 11)) * 12);
+
int anElement(VMD_DATA_ELEM(2,23,ll,678,456));
BOOST_TEST_EQ(anElement,678);
+ BOOST_TEST_EQ(BOOST_PP_LESS(VMD_DATA_SIZE(VMD_TEST_THE_DATA),12),1);
+
+ typedef BOOST_PP_EXPR_IF(VMD_DATA_ELEM(9,VMD_TEST_THE_DATA),const) int AnIntType;
+
+ BOOST_TEST(!(boost::is_const<AnIntType>::value));
+
+ typedef BOOST_PP_EXPR_IIF(VMD_DATA_ELEM(10,VMD_TEST_THE_DATA),const) int AnotherIntType;
+
+ BOOST_TEST(boost::is_const<AnotherIntType>::value);
+
+ BOOST_TEST_EQ(BOOST_PP_IF(VMD_DATA_ELEM(5,VMD_TEST_THE_DATA),10,20),10);
+
+ BOOST_TEST_EQ(BOOST_PP_IIF(VMD_DATA_ELEM(9,VMD_TEST_THE_DATA),10,20),20);
+
+ bool tb(BOOST_PP_AND(VMD_DATA_ELEM(9,VMD_TEST_THE_DATA),VMD_DATA_ELEM(1,VMD_TEST_THE_DATA)));
+
+ BOOST_TEST_EQ(tb,false);
+
+ tb = BOOST_PP_BITOR(VMD_DATA_ELEM(10,VMD_TEST_THE_DATA),VMD_DATA_ELEM(10,VMD_TEST_THE_DATA));
+
+ BOOST_TEST_EQ(tb,true);
+
+ BOOST_TEST_EQ(BOOST_PP_MAX(VMD_DATA_ELEM(1,VMD_TEST_THE_DATA),VMD_DATA_SIZE(VMD_TEST_THE_DATA)),12);
+
+ std::string ss(BOOST_PP_STRINGIZE(VMD_DATA_ELEM(4,VMD_TEST_THE_DATA)));
+ std::string ss2("we99");
+
+ BOOST_TEST(ss == ss2);
+
#define VMD_TEST_EXPAND(...) int,__VA_ARGS__
int numberOfTypes(VMD_DATA_SIZE(VMD_TEST_EXPAND(unsigned,long,short,unsigned long)));
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