mirror of
https://github.com/boostorg/preprocessor.git
synced 2025-07-15 05:26:33 +02:00
initial revision
[SVN r15198]
This commit is contained in:
63
regression/arithmetic.cpp
Normal file
63
regression/arithmetic.cpp
Normal file
@ -0,0 +1,63 @@
|
||||
# /* **************************************************************************
|
||||
# * *
|
||||
# * (C) Copyright Paul Mensonides 2002. Permission to copy, use, *
|
||||
# * modify, sell, and distribute this software is granted provided *
|
||||
# * this copyright notice appears in all copies. This software is *
|
||||
# * provided "as is" without express or implied warranty, and with *
|
||||
# * no claim at to its suitability for any purpose. *
|
||||
# * *
|
||||
# ************************************************************************** */
|
||||
#
|
||||
# /* See http://www.boost.org for most recent version. */
|
||||
#
|
||||
# include <boost/preprocessor/arithmetic.hpp>
|
||||
# include <boost/preprocessor/config/limits.hpp>
|
||||
# include <libs/preprocessor/regression/test.h>
|
||||
|
||||
// addition
|
||||
|
||||
BEGIN BOOST_PP_ADD(2, 3) == 5 END
|
||||
|
||||
BEGIN BOOST_PP_ADD(BOOST_PP_ADD(2, 2), 2) == 6 END
|
||||
BEGIN BOOST_PP_ADD(2, BOOST_PP_ADD(1, 4)) == 7 END
|
||||
BEGIN BOOST_PP_ADD(BOOST_PP_ADD(2, 2), BOOST_PP_ADD(2, 2)) == 8 END
|
||||
|
||||
// subtraction
|
||||
|
||||
BEGIN BOOST_PP_SUB(11, 0) == 11 END
|
||||
BEGIN BOOST_PP_SUB(12, 1) == 11 END
|
||||
BEGIN BOOST_PP_SUB(3, 4) == 0 END
|
||||
|
||||
BEGIN BOOST_PP_SUB(5, BOOST_PP_SUB(3, 2)) == 4 END
|
||||
BEGIN BOOST_PP_SUB(BOOST_PP_SUB(10, 5), 2) == 3 END
|
||||
BEGIN BOOST_PP_SUB(BOOST_PP_SUB(7, 3), BOOST_PP_SUB(10, 8)) == 2 END
|
||||
|
||||
// multiplication
|
||||
|
||||
BEGIN BOOST_PP_MUL(0, 1) == 0 END
|
||||
BEGIN BOOST_PP_MUL(1, 0) == 0 END
|
||||
BEGIN BOOST_PP_MUL(1, 1) == 1 END
|
||||
BEGIN BOOST_PP_MUL(4, 3) == 12 END
|
||||
|
||||
BEGIN BOOST_PP_MUL(BOOST_PP_MUL(2, 2), 2) == 8 END
|
||||
BEGIN BOOST_PP_MUL(2, BOOST_PP_MUL(2, 2)) == 8 END
|
||||
BEGIN BOOST_PP_MUL(BOOST_PP_MUL(2, 2), BOOST_PP_MUL(2, 2)) == 16 END
|
||||
|
||||
// division
|
||||
|
||||
BEGIN BOOST_PP_DIV(2, 1) == 2 END
|
||||
BEGIN BOOST_PP_DIV(0, 5) == 0 END
|
||||
BEGIN BOOST_PP_DIV(7, 3) == 2 END
|
||||
|
||||
BEGIN BOOST_PP_DIV(BOOST_PP_DIV(4, 2), 2) == 1 END
|
||||
BEGIN BOOST_PP_DIV(10, BOOST_PP_DIV(10, 2)) == 2 END
|
||||
BEGIN BOOST_PP_DIV(BOOST_PP_DIV(10, 2), BOOST_PP_DIV(4, 2)) == 2 END
|
||||
|
||||
// modulus
|
||||
|
||||
BEGIN BOOST_PP_MOD(5, 5) == 0 END
|
||||
BEGIN BOOST_PP_MOD(9, 5) == 4 END
|
||||
BEGIN BOOST_PP_MOD(7, 4) == 3 END
|
||||
|
||||
BEGIN BOOST_PP_MOD(BOOST_PP_MOD(5, 3), 3) == 2 END
|
||||
BEGIN BOOST_PP_MOD(5, BOOST_PP_MOD(4, 3)) == 0 END
|
36
regression/array.cpp
Normal file
36
regression/array.cpp
Normal file
@ -0,0 +1,36 @@
|
||||
# /* **************************************************************************
|
||||
# * *
|
||||
# * (C) Copyright Paul Mensonides 2002. Permission to copy, use, *
|
||||
# * modify, sell, and distribute this software is granted provided *
|
||||
# * this copyright notice appears in all copies. This software is *
|
||||
# * provided "as is" without express or implied warranty, and with *
|
||||
# * no claim at to its suitability for any purpose. *
|
||||
# * *
|
||||
# ************************************************************************** */
|
||||
#
|
||||
# /* See http://www.boost.org for most recent version. */
|
||||
#
|
||||
# include <boost/preprocessor/array.hpp>
|
||||
# include <libs/preprocessor/regression/test.h>
|
||||
|
||||
# define ARRAY (3, (0, 1, 2))
|
||||
|
||||
// element access
|
||||
|
||||
BEGIN BOOST_PP_ARRAY_ELEM(1, ARRAY) == 1 END
|
||||
BEGIN BOOST_PP_ARRAY_ELEM(2, (5, (0, 1, 2, 3, 4))) == 2 END
|
||||
|
||||
# define P1 (3,
|
||||
# define P2 (
|
||||
# define P3 0, 1
|
||||
# define P4 , 2)
|
||||
# define P5 )
|
||||
|
||||
BEGIN BOOST_PP_ARRAY_ELEM(0, P1 P2 P3 P4 P5) == 0 END
|
||||
|
||||
// size
|
||||
|
||||
BEGIN BOOST_PP_ARRAY_SIZE(ARRAY) == 3 END
|
||||
BEGIN BOOST_PP_ARRAY_SIZE((5, (0, 1, 2, 3, 4))) == 5 END
|
||||
|
||||
BEGIN BOOST_PP_ARRAY_SIZE(P1 P2 P3 P4 P5) == 5 END
|
46
regression/comparison.cpp
Normal file
46
regression/comparison.cpp
Normal file
@ -0,0 +1,46 @@
|
||||
# /* **************************************************************************
|
||||
# * *
|
||||
# * (C) Copyright Paul Mensonides 2002. Permission to copy, use, *
|
||||
# * modify, sell, and distribute this software is granted provided *
|
||||
# * this copyright notice appears in all copies. This software is *
|
||||
# * provided "as is" without express or implied warranty, and with *
|
||||
# * no claim at to its suitability for any purpose. *
|
||||
# * *
|
||||
# ************************************************************************** */
|
||||
#
|
||||
# /* See http://www.boost.org for most recent version. */
|
||||
#
|
||||
# include <boost/preprocessor/comparison.hpp>
|
||||
# include <libs/preprocessor/regression/test.h>
|
||||
|
||||
// equality
|
||||
|
||||
BEGIN BOOST_PP_EQUAL(2, 0) == 0 END
|
||||
BEGIN BOOST_PP_EQUAL(2, 2) == 1 END
|
||||
|
||||
// inequality
|
||||
|
||||
BEGIN BOOST_PP_NOT_EQUAL(2, 0) == 1 END
|
||||
BEGIN BOOST_PP_NOT_EQUAL(2, 2) == 0 END
|
||||
|
||||
// less
|
||||
|
||||
BEGIN BOOST_PP_LESS(2, 1) == 0 END
|
||||
BEGIN BOOST_PP_LESS(1, 2) == 1 END
|
||||
|
||||
// less_equal
|
||||
|
||||
BEGIN BOOST_PP_LESS_EQUAL(2, 1) == 0 END
|
||||
BEGIN BOOST_PP_LESS_EQUAL(1, 2) == 1 END
|
||||
BEGIN BOOST_PP_LESS_EQUAL(2, 2) == 1 END
|
||||
|
||||
// greater
|
||||
|
||||
BEGIN BOOST_PP_GREATER(2, 1) == 1 END
|
||||
BEGIN BOOST_PP_GREATER(1, 2) == 0 END
|
||||
|
||||
// greater_equal
|
||||
|
||||
BEGIN BOOST_PP_GREATER_EQUAL(2, 1) == 1 END
|
||||
BEGIN BOOST_PP_GREATER_EQUAL(1, 2) == 0 END
|
||||
BEGIN BOOST_PP_GREATER_EQUAL(2, 2) == 1 END
|
41
regression/control.cpp
Normal file
41
regression/control.cpp
Normal file
@ -0,0 +1,41 @@
|
||||
# /* **************************************************************************
|
||||
# * *
|
||||
# * (C) Copyright Paul Mensonides 2002. Permission to copy, use, *
|
||||
# * modify, sell, and distribute this software is granted provided *
|
||||
# * this copyright notice appears in all copies. This software is *
|
||||
# * provided "as is" without express or implied warranty, and with *
|
||||
# * no claim at to its suitability for any purpose. *
|
||||
# * *
|
||||
# ************************************************************************** */
|
||||
#
|
||||
# /* See http://www.boost.org for most recent version. */
|
||||
#
|
||||
# include <boost/preprocessor/arithmetic/add.hpp>
|
||||
# include <boost/preprocessor/arithmetic/dec.hpp>
|
||||
# include <boost/preprocessor/control.hpp>
|
||||
# include <libs/preprocessor/regression/test.h>
|
||||
|
||||
# define TR(x) 1
|
||||
|
||||
BEGIN BOOST_PP_EXPR_IIF(0, TR)(0) == 0 END
|
||||
BEGIN BOOST_PP_EXPR_IIF(1, TR)(0) == 1 END
|
||||
|
||||
BEGIN BOOST_PP_EXPR_IF(3, TR)(0) == 1 END
|
||||
BEGIN BOOST_PP_EXPR_IF(0, TR)(0) == 0 END
|
||||
|
||||
BEGIN BOOST_PP_IIF(0, 1, 0) == 0 END
|
||||
BEGIN BOOST_PP_IIF(1, 1, 0) == 1 END
|
||||
|
||||
BEGIN BOOST_PP_IF(0, 1, 0) == 0 END
|
||||
BEGIN BOOST_PP_IF(9, 1, 0) == 1 END
|
||||
|
||||
# define PRED(d, state) state
|
||||
# define OP_1(d, state) BOOST_PP_DEC(state)
|
||||
|
||||
BEGIN BOOST_PP_WHILE(PRED, OP_1, 50) == 0 END
|
||||
|
||||
# define OP_2(d, state) BOOST_PP_DEC(BOOST_PP_ADD(BOOST_PP_WHILE(PRED, OP_1, state), state))
|
||||
# define OP_3(d, state) BOOST_PP_DEC(BOOST_PP_ADD_D(d, BOOST_PP_WHILE_ ## d(PRED, OP_1, state), state))
|
||||
|
||||
BEGIN BOOST_PP_WHILE(PRED, OP_3, 10) == 0 END
|
||||
BEGIN BOOST_PP_WHILE(PRED, OP_3, 10) == 0 END
|
22
regression/debug.cpp
Normal file
22
regression/debug.cpp
Normal file
@ -0,0 +1,22 @@
|
||||
# /* **************************************************************************
|
||||
# * *
|
||||
# * (C) Copyright Paul Mensonides 2002. Permission to copy, use, *
|
||||
# * modify, sell, and distribute this software is granted provided *
|
||||
# * this copyright notice appears in all copies. This software is *
|
||||
# * provided "as is" without express or implied warranty, and with *
|
||||
# * no claim at to its suitability for any purpose. *
|
||||
# * *
|
||||
# ************************************************************************** */
|
||||
#
|
||||
# /* See http://www.boost.org for most recent version. */
|
||||
#
|
||||
# include <boost/preprocessor/debug.hpp>
|
||||
# include <libs/preprocessor/regression/test.h>
|
||||
|
||||
BEGIN sizeof(BOOST_PP_ASSERT_MSG(0, "text") "") / sizeof(char) != 1 END
|
||||
BEGIN sizeof(BOOST_PP_ASSERT_MSG(1, "text") "") / sizeof(char) == 1 END
|
||||
|
||||
BOOST_PP_ASSERT(10)
|
||||
|
||||
# line BOOST_PP_LINE(100, __FILE__)
|
||||
BEGIN __LINE__ == 100 END
|
29
regression/facilities.cpp
Normal file
29
regression/facilities.cpp
Normal file
@ -0,0 +1,29 @@
|
||||
# /* **************************************************************************
|
||||
# * *
|
||||
# * (C) Copyright Paul Mensonides 2002. Permission to copy, use, *
|
||||
# * modify, sell, and distribute this software is granted provided *
|
||||
# * this copyright notice appears in all copies. This software is *
|
||||
# * provided "as is" without express or implied warranty, and with *
|
||||
# * no claim at to its suitability for any purpose. *
|
||||
# * *
|
||||
# ************************************************************************** */
|
||||
#
|
||||
# /* See http://www.boost.org for most recent version. */
|
||||
#
|
||||
# include <boost/preprocessor/cat.hpp>
|
||||
# include <boost/preprocessor/facilities.hpp>
|
||||
# include <libs/preprocessor/regression/test.h>
|
||||
|
||||
BEGIN BOOST_PP_APPLY(BOOST_PP_NIL) 0 == 0 END
|
||||
BEGIN BOOST_PP_APPLY((0)) == 0 END
|
||||
|
||||
BEGIN BOOST_PP_APPLY((BOOST_PP_EMPTY))() 0 == 0 END
|
||||
|
||||
# define MACRO(x, y, z) 1
|
||||
# define ARGS (1, 2, 3)
|
||||
|
||||
BEGIN BOOST_PP_EXPAND(MACRO ARGS) == 1 END
|
||||
|
||||
BEGIN BOOST_PP_IDENTITY(1)() == 1 END
|
||||
|
||||
BEGIN BOOST_PP_CAT(BOOST_PP_INTERCEPT, 2) 1 == 1 END
|
34
regression/iteration.cpp
Normal file
34
regression/iteration.cpp
Normal file
@ -0,0 +1,34 @@
|
||||
# /* **************************************************************************
|
||||
# * *
|
||||
# * (C) Copyright Paul Mensonides 2002. Permission to copy, use, *
|
||||
# * modify, sell, and distribute this software is granted provided *
|
||||
# * this copyright notice appears in all copies. This software is *
|
||||
# * provided "as is" without express or implied warranty, and with *
|
||||
# * no claim at to its suitability for any purpose. *
|
||||
# * *
|
||||
# ************************************************************************** */
|
||||
#
|
||||
# /* See http://www.boost.org for most recent version. */
|
||||
#
|
||||
# if !BOOST_PP_IS_SELFISH
|
||||
#
|
||||
# include <libs/preprocessor/regression/iteration.h>
|
||||
#
|
||||
# define TEST(n) BEGIN n == n END
|
||||
#
|
||||
# define BOOST_PP_LOCAL_MACRO(n) TEST(n)
|
||||
# define BOOST_PP_LOCAL_LIMITS (1, 5)
|
||||
# include BOOST_PP_LOCAL_ITERATE()
|
||||
#
|
||||
# define BOOST_PP_LOCAL_MACRO(n) TEST(n)
|
||||
# define BOOST_PP_LOCAL_LIMITS (5, 1)
|
||||
# include BOOST_PP_LOCAL_ITERATE()
|
||||
#
|
||||
# define BOOST_PP_INDIRECT_SELF "iteration.cpp" // <libs/preprocessor/regression/iteration.cpp>
|
||||
# include BOOST_PP_INCLUDE_SELF()
|
||||
#
|
||||
# else
|
||||
|
||||
BEGIN BOOST_PP_IS_SELFISH == 1 END
|
||||
|
||||
# endif
|
61
regression/iteration.h
Normal file
61
regression/iteration.h
Normal file
@ -0,0 +1,61 @@
|
||||
# /* **************************************************************************
|
||||
# * *
|
||||
# * (C) Copyright Paul Mensonides 2002. Permission to copy, use, *
|
||||
# * modify, sell, and distribute this software is granted provided *
|
||||
# * this copyright notice appears in all copies. This software is *
|
||||
# * provided "as is" without express or implied warranty, and with *
|
||||
# * no claim at to its suitability for any purpose. *
|
||||
# * *
|
||||
# ************************************************************************** */
|
||||
#
|
||||
# /* See http://www.boost.org for most recent version. */
|
||||
#
|
||||
# if !BOOST_PP_IS_ITERATING
|
||||
#
|
||||
# include <boost/preprocessor/cat.hpp>
|
||||
# include <boost/preprocessor/iteration.hpp>
|
||||
# include <libs/preprocessor/regression/test.h>
|
||||
#
|
||||
# define NO_FLAGS
|
||||
#
|
||||
# define BOOST_PP_ITERATION_PARAMS_1 (3, (1, 10, <libs/preprocessor/regression/iteration.h>))
|
||||
# include BOOST_PP_ITERATE()
|
||||
#
|
||||
# undef NO_FLAGS
|
||||
#
|
||||
# define BOOST_PP_ITERATION_PARAMS_1 (4, (1, 5, <libs/preprocessor/regression/iteration.h>, 0x0001))
|
||||
# include BOOST_PP_ITERATE()
|
||||
#
|
||||
# define BOOST_PP_ITERATION_PARAMS_1 (4, (1, 5, <libs/preprocessor/regression/iteration.h>, 0x0002))
|
||||
# include BOOST_PP_ITERATE()
|
||||
#
|
||||
# elif defined NO_FLAGS
|
||||
|
||||
struct BOOST_PP_CAT(X, BOOST_PP_ITERATION()) {
|
||||
BEGIN
|
||||
BOOST_PP_ITERATION() >= BOOST_PP_ITERATION_START() &&
|
||||
BOOST_PP_ITERATION() <= BOOST_PP_ITERATION_FINISH()
|
||||
END
|
||||
};
|
||||
|
||||
# elif BOOST_PP_ITERATION_DEPTH() == 1 \
|
||||
&& BOOST_PP_ITERATION_FLAGS() == 0x0001
|
||||
|
||||
struct BOOST_PP_CAT(Y, BOOST_PP_ITERATION()) { };
|
||||
|
||||
# elif BOOST_PP_ITERATION_DEPTH() == 1 \
|
||||
&& BOOST_PP_ITERATION_FLAGS() == 0x0002
|
||||
|
||||
# define BOOST_PP_ITERATION_PARAMS_2 (3, (1, BOOST_PP_ITERATION(), <libs/preprocessor/regression/iteration.h>))
|
||||
# include BOOST_PP_ITERATE()
|
||||
|
||||
# elif BOOST_PP_ITERATION_DEPTH() == 2 \
|
||||
&& BOOST_PP_FRAME_FLAGS(1) == 0x0002
|
||||
|
||||
struct BOOST_PP_CAT(Z, BOOST_PP_CAT(BOOST_PP_ITERATION(), BOOST_PP_RELATIVE_ITERATION(1))) { };
|
||||
|
||||
# else
|
||||
#
|
||||
# error shouldn't get here!
|
||||
#
|
||||
# endif
|
55
regression/list.cpp
Normal file
55
regression/list.cpp
Normal file
@ -0,0 +1,55 @@
|
||||
# /* **************************************************************************
|
||||
# * *
|
||||
# * (C) Copyright Paul Mensonides 2002. Permission to copy, use, *
|
||||
# * modify, sell, and distribute this software is granted provided *
|
||||
# * this copyright notice appears in all copies. This software is *
|
||||
# * provided "as is" without express or implied warranty, and with *
|
||||
# * no claim at to its suitability for any purpose. *
|
||||
# * *
|
||||
# ************************************************************************** */
|
||||
#
|
||||
# /* See http://www.boost.org for most recent version. */
|
||||
#
|
||||
# include <boost/preprocessor/arithmetic/add.hpp>
|
||||
# include <boost/preprocessor/arithmetic/sub.hpp>
|
||||
# include <boost/preprocessor/comparison/less.hpp>
|
||||
# include <boost/preprocessor/list.hpp>
|
||||
# include <boost/preprocessor/tuple/elem.hpp>
|
||||
# include <libs/preprocessor/regression/test.h>
|
||||
|
||||
# define LIST (4, (1, (5, (2, BOOST_PP_NIL))))
|
||||
|
||||
# define REVERSAL(d, x, y) BOOST_PP_SUB_D(d, y, x)
|
||||
|
||||
BEGIN BOOST_PP_LIST_FOLD_LEFT(BOOST_PP_SUB_D, 22, LIST) == 10 END
|
||||
BEGIN BOOST_PP_LIST_FOLD_RIGHT(BOOST_PP_ADD_D, 0, LIST) == 12 END
|
||||
BEGIN BOOST_PP_LIST_FOLD_RIGHT(REVERSAL, 0, LIST) == 4 END
|
||||
|
||||
BEGIN BOOST_PP_LIST_CAT(BOOST_PP_LIST_REVERSE(LIST)) == 2514 END
|
||||
|
||||
BEGIN BOOST_PP_LIST_CAT(BOOST_PP_LIST_REST_N(2, LIST)) == 52 END
|
||||
BEGIN BOOST_PP_LIST_CAT(BOOST_PP_LIST_FIRST_N(2, LIST)) == 41 END
|
||||
|
||||
BEGIN BOOST_PP_LIST_AT(LIST, 2) == 5 END
|
||||
BEGIN BOOST_PP_LIST_SIZE(LIST) == 4 END
|
||||
|
||||
BEGIN BOOST_PP_LIST_CAT(BOOST_PP_LIST_TRANSFORM(BOOST_PP_ADD_D, 2, LIST)) == 6374 END
|
||||
BEGIN BOOST_PP_LIST_CAT(BOOST_PP_LIST_APPEND(BOOST_PP_LIST_REST(LIST), LIST)) == 1524152 END
|
||||
|
||||
# define F1(r, state, x) + x + state
|
||||
BEGIN BOOST_PP_LIST_FOR_EACH(F1, 1, LIST) == 16 END
|
||||
|
||||
BEGIN BOOST_PP_TUPLE_ELEM(4, 3, BOOST_PP_LIST_TO_TUPLE(LIST)) == 2 END
|
||||
|
||||
BEGIN BOOST_PP_LIST_CAT(BOOST_PP_LIST_FILTER(BOOST_PP_LESS_D, 3, LIST)) == 45 END
|
||||
|
||||
# define F2(r, x) + BOOST_PP_TUPLE_ELEM(2, 0, x) + 2 - BOOST_PP_TUPLE_ELEM(2, 1, x)
|
||||
BEGIN BOOST_PP_LIST_FOR_EACH_PRODUCT(F2, 2, ( (1, (0, BOOST_PP_NIL)), (2, (3, BOOST_PP_NIL)) )) == 0 END
|
||||
|
||||
# define L1 (0, (x, BOOST_PP_NIL))
|
||||
# define L2 (a, (1, (b, (2, BOOST_PP_NIL))))
|
||||
# define L3 (c, (3, (d, BOOST_PP_NIL)))
|
||||
|
||||
# define LL (L1, (L2, (L3, BOOST_PP_NIL)))
|
||||
|
||||
BEGIN BOOST_PP_LIST_CAT(BOOST_PP_LIST_FOLD_LEFT(BOOST_PP_LIST_APPEND_D, BOOST_PP_NIL, LL)) == 0x0a1b2c3d END
|
37
regression/logical.cpp
Normal file
37
regression/logical.cpp
Normal file
@ -0,0 +1,37 @@
|
||||
# /* **************************************************************************
|
||||
# * *
|
||||
# * (C) Copyright Paul Mensonides 2002. Permission to copy, use, *
|
||||
# * modify, sell, and distribute this software is granted provided *
|
||||
# * this copyright notice appears in all copies. This software is *
|
||||
# * provided "as is" without express or implied warranty, and with *
|
||||
# * no claim at to its suitability for any purpose. *
|
||||
# * *
|
||||
# ************************************************************************** */
|
||||
#
|
||||
# /* See http://www.boost.org for most recent version. */
|
||||
#
|
||||
# include <boost/preprocessor/logical.hpp>
|
||||
# include <libs/preprocessor/regression/test.h>
|
||||
|
||||
BEGIN BOOST_PP_NOT(0) == 1 END
|
||||
BEGIN BOOST_PP_NOT(2) == 0 END
|
||||
|
||||
BEGIN BOOST_PP_AND(0, 0) == 0 END
|
||||
BEGIN BOOST_PP_AND(0, 3) == 0 END
|
||||
BEGIN BOOST_PP_AND(4, 0) == 0 END
|
||||
BEGIN BOOST_PP_AND(5, 6) == 1 END
|
||||
|
||||
BEGIN BOOST_PP_OR(0, 0) == 0 END
|
||||
BEGIN BOOST_PP_OR(0, 7) == 1 END
|
||||
BEGIN BOOST_PP_OR(8, 0) == 1 END
|
||||
BEGIN BOOST_PP_OR(9, 1) == 1 END
|
||||
|
||||
BEGIN BOOST_PP_XOR(0, 0) == 0 END
|
||||
BEGIN BOOST_PP_XOR(0, 2) == 1 END
|
||||
BEGIN BOOST_PP_XOR(3, 0) == 1 END
|
||||
BEGIN BOOST_PP_XOR(4, 5) == 0 END
|
||||
|
||||
BEGIN BOOST_PP_NOR(0, 0) == 1 END
|
||||
BEGIN BOOST_PP_NOR(0, 6) == 0 END
|
||||
BEGIN BOOST_PP_NOR(7, 0) == 0 END
|
||||
BEGIN BOOST_PP_NOR(8, 9) == 0 END
|
51
regression/repetition.cpp
Normal file
51
regression/repetition.cpp
Normal file
@ -0,0 +1,51 @@
|
||||
# /* **************************************************************************
|
||||
# * *
|
||||
# * (C) Copyright Paul Mensonides 2002. Permission to copy, use, *
|
||||
# * modify, sell, and distribute this software is granted provided *
|
||||
# * this copyright notice appears in all copies. This software is *
|
||||
# * provided "as is" without express or implied warranty, and with *
|
||||
# * no claim at to its suitability for any purpose. *
|
||||
# * *
|
||||
# ************************************************************************** */
|
||||
#
|
||||
# /* See http://www.boost.org for most recent version. */
|
||||
#
|
||||
# include <boost/preprocessor/arithmetic/inc.hpp>
|
||||
# include <boost/preprocessor/cat.hpp>
|
||||
# include <boost/preprocessor/comparison/equal.hpp>
|
||||
# include <boost/preprocessor/comparison/not_equal.hpp>
|
||||
# include <boost/preprocessor/facilities/intercept.hpp>
|
||||
# include <boost/preprocessor/repetition.hpp>
|
||||
# include <libs/preprocessor/regression/test.h>
|
||||
|
||||
# define MAX 10
|
||||
|
||||
# define NTH(z, n, data) data ## n
|
||||
|
||||
int add(BOOST_PP_ENUM_PARAMS(MAX, int x)) {
|
||||
return BOOST_PP_REPEAT(MAX, NTH, + x);
|
||||
}
|
||||
|
||||
const int r = add(BOOST_PP_ENUM_PARAMS(MAX, 1 BOOST_PP_INTERCEPT));
|
||||
|
||||
# define CONSTANT(z, n, text) BOOST_PP_CAT(text, n) = n
|
||||
const int BOOST_PP_ENUM(MAX, CONSTANT, default_param_);
|
||||
|
||||
# define TEST(n) \
|
||||
void BOOST_PP_CAT(test_enum_params, n)(BOOST_PP_ENUM_PARAMS(n, int x)); \
|
||||
void BOOST_PP_CAT(test_enum_params_with_a_default, n)(BOOST_PP_ENUM_PARAMS_WITH_A_DEFAULT(n, int x, 0)); \
|
||||
void BOOST_PP_CAT(test_enum_params_with_defaults, n)(BOOST_PP_ENUM_PARAMS_WITH_DEFAULTS(n, int x, default_param_));
|
||||
|
||||
TEST(0)
|
||||
TEST(MAX)
|
||||
|
||||
template<BOOST_PP_ENUM_PARAMS(MAX, class T)> struct no_rescan;
|
||||
|
||||
# define F1(z, n, p) p n
|
||||
BEGIN 1 + (4+5+6) BOOST_PP_REPEAT_FROM_TO(4, 7, F1, -) END
|
||||
|
||||
# define PRED(r, state) BOOST_PP_NOT_EQUAL(state, BOOST_PP_INC(MAX))
|
||||
# define OP(r, state) BOOST_PP_INC(state)
|
||||
# define MACRO(r, state) BOOST_PP_COMMA_IF(BOOST_PP_NOT_EQUAL(state, 1)) BOOST_PP_CAT(class T, state)
|
||||
|
||||
template<BOOST_PP_FOR(1, PRED, OP, MACRO)> struct for_test;
|
22
regression/selection.cpp
Normal file
22
regression/selection.cpp
Normal file
@ -0,0 +1,22 @@
|
||||
# /* **************************************************************************
|
||||
# * *
|
||||
# * (C) Copyright Paul Mensonides 2002. Permission to copy, use, *
|
||||
# * modify, sell, and distribute this software is granted provided *
|
||||
# * this copyright notice appears in all copies. This software is *
|
||||
# * provided "as is" without express or implied warranty, and with *
|
||||
# * no claim at to its suitability for any purpose. *
|
||||
# * *
|
||||
# ************************************************************************** */
|
||||
#
|
||||
# /* See http://www.boost.org for most recent version. */
|
||||
#
|
||||
# include <boost/preprocessor/selection.hpp>
|
||||
# include <libs/preprocessor/regression/test.h>
|
||||
|
||||
BEGIN BOOST_PP_MAX(2, 2) == 2 END
|
||||
BEGIN BOOST_PP_MAX(2, 1) == 2 END
|
||||
BEGIN BOOST_PP_MAX(1, 2) == 2 END
|
||||
|
||||
BEGIN BOOST_PP_MIN(2, 2) == 2 END
|
||||
BEGIN BOOST_PP_MIN(2, 1) == 1 END
|
||||
BEGIN BOOST_PP_MIN(1, 2) == 1 END
|
28
regression/slot.cpp
Normal file
28
regression/slot.cpp
Normal file
@ -0,0 +1,28 @@
|
||||
# /* **************************************************************************
|
||||
# * *
|
||||
# * (C) Copyright Paul Mensonides 2002. Permission to copy, use, *
|
||||
# * modify, sell, and distribute this software is granted provided *
|
||||
# * this copyright notice appears in all copies. This software is *
|
||||
# * provided "as is" without express or implied warranty, and with *
|
||||
# * no claim at to its suitability for any purpose. *
|
||||
# * *
|
||||
# ************************************************************************** */
|
||||
#
|
||||
# /* See http://www.boost.org for most recent version. */
|
||||
#
|
||||
# include <boost/preprocessor/slot.hpp>
|
||||
# include <libs/preprocessor/regression/test.h>
|
||||
|
||||
# define X() 4
|
||||
|
||||
# define BOOST_PP_VALUE 1 + 2 + 3 + X()
|
||||
# include BOOST_PP_ASSIGN_SLOT(1)
|
||||
|
||||
# undef X
|
||||
|
||||
BEGIN BOOST_PP_SLOT(1) == 10 END
|
||||
|
||||
# define BOOST_PP_VALUE BOOST_PP_SLOT(1) * BOOST_PP_SLOT(1)
|
||||
# include BOOST_PP_ASSIGN_SLOT(1)
|
||||
|
||||
BEGIN BOOST_PP_SLOT(1) == 100 END
|
8
regression/test.cpp
Normal file
8
regression/test.cpp
Normal file
@ -0,0 +1,8 @@
|
||||
const int default_param_0 = 0 , default_param_1 = 1 , default_param_2 = 2 , default_param_3 = 3 , default_param_4 = 4 , default_param_5 = 5 , default_param_6 =
|
||||
6 , default_param_7 = 7 , default_param_8 = 8 , default_param_9 = 9 , default_param_10 = 10 , default_param_11 = 11 , default_param_12 = 12 , default_param_13 =
|
||||
13 , default_param_14 = 14 , default_param_15 = 15 , default_param_16 = 16 , default_param_17 = 17 , default_param_18 = 18 , default_param_19 = 19 , default_param_20 = 20 , default_param_21 = 21 , default_param_22 = 22 , default_param_23 = 23 , default_param_24 = 24 , default_param_25 = 25 , default_param_26 = 26 , default_param_27 = 27 , default_param_28 = 28 , default_param_29 = 29 , default_param_30 = 30 , default_param_31 = 31 , default_param_32 = 32 , default_param_33 =
|
||||
33 , default_param_34 = 34 , default_param_35 = 35 , default_param_36 = 36 , default_param_37 = 37 , default_param_38 = 38 , default_param_39 = 39 , default_param_40 = 40 , default_param_41 = 41 , default_param_42 = 42 , default_param_43 = 43 , default_param_44 = 44 , default_param_45 = 45 , default_param_46 = 46 , default_param_47 = 47 , default_param_48 = 48 , default_param_49 = 49;
|
||||
|
||||
int main(void) {
|
||||
return 0;
|
||||
}
|
33
regression/test.h
Normal file
33
regression/test.h
Normal file
@ -0,0 +1,33 @@
|
||||
# /* Copyright (C) 2001
|
||||
# * Housemarque Oy
|
||||
# * http://www.housemarque.com
|
||||
# *
|
||||
# * Permission to copy, use, modify, sell and distribute this software is
|
||||
# * granted provided this copyright notice appears in all copies. This
|
||||
# * software is provided "as is" without express or implied warranty, and
|
||||
# * with no claim as to its suitability for any purpose.
|
||||
# */
|
||||
#
|
||||
# /* Revised by Paul Mensonides (2002) */
|
||||
#
|
||||
# /* See http://www.boost.org for most recent version. */
|
||||
#
|
||||
# ifndef BOOST_LIBS_PREPROCESSOR_REGRESSION_TEST_H
|
||||
# define BOOST_LIBS_PREPROCESSOR_REGRESSION_TEST_H
|
||||
#
|
||||
# include <boost/preprocessor/cat.hpp>
|
||||
#
|
||||
# define BEGIN typedef int BOOST_PP_CAT(test_, __LINE__)[((
|
||||
# define END )==1) ? 1 : -1];
|
||||
|
||||
#include <cstdio>
|
||||
|
||||
namespace std { }
|
||||
using namespace std;
|
||||
|
||||
int main(void) {
|
||||
printf("pass " __TIME__);
|
||||
return 0;
|
||||
}
|
||||
|
||||
# endif
|
25
regression/tuple.cpp
Normal file
25
regression/tuple.cpp
Normal file
@ -0,0 +1,25 @@
|
||||
# /* **************************************************************************
|
||||
# * *
|
||||
# * (C) Copyright Paul Mensonides 2002. Permission to copy, use, *
|
||||
# * modify, sell, and distribute this software is granted provided *
|
||||
# * this copyright notice appears in all copies. This software is *
|
||||
# * provided "as is" without express or implied warranty, and with *
|
||||
# * no claim at to its suitability for any purpose. *
|
||||
# * *
|
||||
# ************************************************************************** */
|
||||
#
|
||||
# /* See http://www.boost.org for most recent version. */
|
||||
#
|
||||
# include <boost/preprocessor/tuple.hpp>
|
||||
# include <libs/preprocessor/regression/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 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)
|
||||
|
||||
BEGIN CALC(T2) == 7 END
|
||||
BEGIN CALC(BOOST_PP_TUPLE_REVERSE(3, T2)) == 6 END
|
Reference in New Issue
Block a user