forked from boostorg/preprocessor
new tests
[SVN r15688]
This commit is contained in:
63
test/arithmetic.cpp
Normal file
63
test/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
|
26
test/array.cpp
Normal file
26
test/array.cpp
Normal file
@ -0,0 +1,26 @@
|
||||
# /* **************************************************************************
|
||||
# * *
|
||||
# * (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
|
||||
|
||||
// size
|
||||
|
||||
BEGIN BOOST_PP_ARRAY_SIZE(ARRAY) == 3 END
|
||||
BEGIN BOOST_PP_ARRAY_SIZE((5, (0, 1, 2, 3, 4))) == 5 END
|
46
test/comparison.cpp
Normal file
46
test/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
test/control.cpp
Normal file
41
test/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
test/debug.cpp
Normal file
22
test/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
test/facilities.cpp
Normal file
29
test/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
test/iteration.cpp
Normal file
34
test/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 <libs/preprocessor/regression/iteration.cpp>
|
||||
# include BOOST_PP_INCLUDE_SELF()
|
||||
#
|
||||
# else
|
||||
|
||||
BEGIN BOOST_PP_IS_SELFISH == 1 END
|
||||
|
||||
# endif
|
55
test/list.cpp
Normal file
55
test/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
test/logical.cpp
Normal file
37
test/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
test/repetition.cpp
Normal file
51
test/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
test/selection.cpp
Normal file
22
test/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
test/slot.cpp
Normal file
28
test/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
|
25
test/tuple.cpp
Normal file
25
test/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