Added variadic is_empty and is_begin_parens along with tests.

This commit is contained in:
Edward Diener
2014-04-28 19:24:42 -04:00
parent 0a23b4d6a6
commit d2bfda8308
13 changed files with 375 additions and 1 deletions

View File

@ -25,9 +25,11 @@ test-suite preprocessor
[ compile control.cpp ]
[ compile debug.cpp ]
[ compile facilities.cpp ]
[ compile isempty.cpp ]
[ compile iteration.cpp ]
[ compile list.cpp ]
[ compile logical.cpp ]
[ compile punctuation.cpp ]
[ compile repetition.cpp ]
[ compile selection.cpp ]
[ compile seq.cpp ]
@ -44,6 +46,7 @@ test-suite preprocessor_nvm
[ compile control.cpp : <define>BOOST_PP_VARIADICS=0 : control_nvm ]
[ compile debug.cpp : <define>BOOST_PP_VARIADICS=0 : debug_nvm ]
[ compile facilities.cpp : <define>BOOST_PP_VARIADICS=0 : facilities_nvm ]
[ compile isempty.cpp : <define>BOOST_PP_VARIADICS=0 : isempty_nvm ]
[ compile iteration.cpp : <define>BOOST_PP_VARIADICS=0 : iteration_nvm ]
[ compile list.cpp : <define>BOOST_PP_VARIADICS=0 : list_nvm ]
[ compile logical.cpp : <define>BOOST_PP_VARIADICS=0 : logical_nvm ]
@ -80,6 +83,10 @@ test-suite preprocessor_c
: <toolset>gcc:<cflags>-std=c99
: facilities_c
]
[ compile isempty.c
: <toolset>gcc:<cflags>-std=c99
: isempty_c
]
[ compile list.c
: <toolset>gcc:<cflags>-std=c99
: list_c
@ -88,6 +95,10 @@ test-suite preprocessor_c
: <toolset>gcc:<cflags>-std=c99
: logical_c
]
[ compile punctuation.c
: <toolset>gcc:<cflags>-std=c99
: punctuation_c
]
[ compile selection.c
: <toolset>gcc:<cflags>-std=c99
: selection_c
@ -142,6 +153,11 @@ test-suite preprocessor_c_nvm
<toolset>gcc:<cflags>-std=c99
: facilities_c_nvm
]
[ compile isempty.c
: <define>BOOST_PP_VARIADICS=0
<toolset>gcc:<cflags>-std=c99
: isempty_c_nvm
]
[ compile list.c
: <define>BOOST_PP_VARIADICS=0
<toolset>gcc:<cflags>-std=c99

12
test/isempty.c Normal file
View File

@ -0,0 +1,12 @@
# /* **************************************************************************
# * *
# * (C) Copyright Edward Diener 2014.
# * Distributed under 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)
# * *
# ************************************************************************** */
#
# /* See http://www.boost.org for most recent version. */
#
# include <libs/preprocessor/test/isempty.cxx>

12
test/isempty.cpp Normal file
View File

@ -0,0 +1,12 @@
# /* **************************************************************************
# * *
# * (C) Copyright Paul Mensonides 2002.
# * Distributed under 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)
# * *
# ************************************************************************** */
#
# /* See http://www.boost.org for most recent version. */
#
# include <libs/preprocessor/test/isempty.cxx>

42
test/isempty.cxx Normal file
View File

@ -0,0 +1,42 @@
# /* **************************************************************************
# * *
# * (C) Copyright Edward Diener 2014.
# * Distributed under 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)
# * *
# ************************************************************************** */
#
# /* See http://www.boost.org for most recent version. */
#
# include <boost/preprocessor/facilities/empty.hpp>
# include <boost/preprocessor/facilities/is_empty.hpp>
# include <boost/preprocessor/facilities/is_empty_or_1.hpp>
# include <boost/preprocessor/facilities/is_1.hpp>
# include <libs/preprocessor/test/test.h>
#if BOOST_PP_VARIADICS
#define DATA
#define OBJECT OBJECT2
#define OBJECT2
#define FUNC(x) FUNC2(x)
#define FUNC2(x)
#define FUNC_GEN3() anything
#define FUNC_GEN4(x) anything
#if defined(BOOST_PP_VARIADICS_MSVC)
#else
#endif
BEGIN BOOST_PP_IS_EMPTY(BOOST_PP_EMPTY()) == 1 END
BEGIN BOOST_PP_IS_EMPTY(DATA BOOST_PP_EMPTY()) == 1 END
BEGIN BOOST_PP_IS_EMPTY(x BOOST_PP_EMPTY()) == 0 END
BEGIN BOOST_PP_IS_EMPTY(OBJECT BOOST_PP_EMPTY()) == 1 END
BEGIN BOOST_PP_IS_EMPTY(FUNC(z) BOOST_PP_EMPTY()) == 1 END
BEGIN BOOST_PP_IS_EMPTY(FUNC_GEN3) == 0 END
BEGIN BOOST_PP_IS_EMPTY(FUNC_GEN4) == 0 END
#endif

14
test/punctuation.c Normal file
View File

@ -0,0 +1,14 @@
# /* **************************************************************************
# * *
# * (C) Copyright Paul Mensonides 2002.
# * Distributed under 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)
# * *
# ************************************************************************** */
#
# /* Revised by Edward Diener (2011) */
#
# /* See http://www.boost.org for most recent version. */
#
# include <libs/preprocessor/test/punctuation.cxx>

14
test/punctuation.cpp Normal file
View File

@ -0,0 +1,14 @@
# /* **************************************************************************
# * *
# * (C) Copyright Paul Mensonides 2002.
# * Distributed under 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)
# * *
# ************************************************************************** */
#
# /* Revised by Edward Diener (2011) */
#
# /* See http://www.boost.org for most recent version. */
#
# include <libs/preprocessor/test/punctuation.cxx>

42
test/punctuation.cxx Normal file
View File

@ -0,0 +1,42 @@
# /* **************************************************************************
# * *
# * (C) Copyright Edward Diener 2014.
# * Distributed under 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)
# * *
# ************************************************************************** */
#
# /* See http://www.boost.org for most recent version. */
#
# if BOOST_PP_VARIADICS
# include <boost/preprocessor/punctuation.hpp>
# include <libs/preprocessor/test/test.h>
# define A_TUPLE (*,#,zz)
# define A_TUPLE2 (*,#,(zz,44,(e7)))
# define A_TUPLE_PLUS (mmf,34,^^,!) 456
# define PLUS_ATUPLE yyt (j,ii%)
# define JDATA ggh
# define NOT_TUPLE y6()
# define NOT_TUPLE2 &(kkkgg,(e))
# define A_SEQ (r)($)(#)
# define AN_ARRAY (4,(5,7,f,x))
# define A_LIST (e,(g,(&,BOOST_PP_NIL)))
// is_begin_parens
BEGIN BOOST_PP_IS_BEGIN_PARENS() == 0 END
BEGIN BOOST_PP_IS_BEGIN_PARENS(A_TUPLE) == 1 END
BEGIN BOOST_PP_IS_BEGIN_PARENS(A_TUPLE2) == 1 END
BEGIN BOOST_PP_IS_BEGIN_PARENS(A_TUPLE_PLUS) == 1 END
BEGIN BOOST_PP_IS_BEGIN_PARENS(PLUS_ATUPLE) == 0 END
BEGIN BOOST_PP_IS_BEGIN_PARENS(JDATA) == 0 END
BEGIN BOOST_PP_IS_BEGIN_PARENS(NOT_TUPLE) == 0 END
BEGIN BOOST_PP_IS_BEGIN_PARENS(NOT_TUPLE2) == 0 END
BEGIN BOOST_PP_IS_BEGIN_PARENS(A_SEQ) == 1 END
BEGIN BOOST_PP_IS_BEGIN_PARENS(AN_ARRAY) == 1 END
BEGIN BOOST_PP_IS_BEGIN_PARENS(A_LIST) == 1 END
BEGIN BOOST_PP_IS_BEGIN_PARENS((y)2(x)) == 1 END
#endif