diff options
Diffstat (limited to 'src/boost/libs/preprocessor/test')
73 files changed, 3472 insertions, 0 deletions
diff --git a/src/boost/libs/preprocessor/test/CMakeLists.txt b/src/boost/libs/preprocessor/test/CMakeLists.txt new file mode 100644 index 000000000..aba5bf547 --- /dev/null +++ b/src/boost/libs/preprocessor/test/CMakeLists.txt @@ -0,0 +1,33 @@ +# Copyright 2018, 2019 Peter Dimov +# 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 + +include(BoostTest OPTIONAL RESULT_VARIABLE HAVE_BOOST_TEST) + +if(NOT HAVE_BOOST_TEST) + return() +endif() + +enable_language(C) + +set(tests_common arithmetic array comparison control debug facilities list logical punctuation selection seq slot stringize tuple variadic isempty) +set(tests_c ${tests_common}) +set(tests_cpp ${tests_common} iteration repetition quick) + +set(BOOST_TEST_LINK_LIBRARIES Boost::preprocessor) + +include_directories(../../..) # for `include <libs/preprocessor/...>` to work + +foreach(test IN LISTS tests_c) + + boost_test(TYPE compile SOURCES ${test}.c) + boost_test(TYPE compile NAME ${test}_c_nvm SOURCES ${test}.c COMPILE_DEFINITIONS BOOST_PP_VARIADICS=0) + +endforeach() + +foreach(test IN LISTS tests_cpp) + + boost_test(TYPE compile SOURCES ${test}.cpp) + boost_test(TYPE compile NAME ${test}_cpp_nvm SOURCES ${test}.cpp COMPILE_DEFINITIONS BOOST_PP_VARIADICS=0) + +endforeach() diff --git a/src/boost/libs/preprocessor/test/Jamfile.v2 b/src/boost/libs/preprocessor/test/Jamfile.v2 new file mode 100644 index 000000000..42475a5ab --- /dev/null +++ b/src/boost/libs/preprocessor/test/Jamfile.v2 @@ -0,0 +1,273 @@ +#~ Copyright Rene Rivera 2008 +#~ 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) + +import testing ; +import cast ; + +project preprocessor_tests : requirements <warnings>on + <toolset>gcc-4.3.0:<warnings>all + <toolset>gcc-4.3.0:<cxxflags>-Wno-variadic-macros + <toolset>gcc-4.4.0:<warnings>all + <toolset>gcc-4.4.0:<cxxflags>-Wno-variadic-macros + <toolset>gcc-4.5.0:<warnings>all + <toolset>gcc-4.5.0:<cxxflags>-Wno-variadic-macros + <toolset>gcc-4.5.0:<linkflags>"-Wl,--enable-auto-import" + <toolset>gcc-4.5.2:<warnings>all + <toolset>gcc-4.5.2:<cxxflags>-Wno-variadic-macros + <toolset>msvc:<warnings>all + ; + +alias preprocessor : : + <toolset>gcc + <toolset-gcc:version>3.4 + ; + +alias preprocessor : : + <toolset>gcc + <toolset-gcc:version>4.1 + ; + +alias preprocessor : : + <toolset>gcc + <toolset-gcc:version>4.2 + ; + +alias preprocessor + : + [ compile arithmetic.cpp ] + [ compile array.cpp ] + [ compile comparison.cpp ] + [ compile control.cpp ] + [ compile debug.cpp ] + [ compile facilities.cpp ] + [ compile iteration.cpp ] + [ compile list.cpp ] + [ compile logical.cpp ] + [ compile punctuation.cpp ] + [ compile repetition.cpp ] + [ compile selection.cpp ] + [ compile seq.cpp ] + [ compile slot.cpp ] + [ compile stringize.cpp ] + [ compile tuple.cpp ] + [ compile variadic.cpp ] + ; + +alias preprocessor_nvm + : + [ compile arithmetic.cpp : <define>BOOST_PP_VARIADICS=0 : arithmetic_nvm ] + [ compile array.cpp : <define>BOOST_PP_VARIADICS=0 : array_nvm ] + [ compile comparison.cpp : <define>BOOST_PP_VARIADICS=0 : comparison_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 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 ] + [ compile repetition.cpp : <define>BOOST_PP_VARIADICS=0 : repetition_nvm ] + [ compile selection.cpp : <define>BOOST_PP_VARIADICS=0 : selection_nvm ] + [ compile seq.cpp : <define>BOOST_PP_VARIADICS=0 : seq_nvm ] + [ compile slot.cpp : <define>BOOST_PP_VARIADICS=0 : slot_nvm ] + [ compile stringize.cpp : <define>BOOST_PP_VARIADICS=0 : stringize_nvm ] + [ compile tuple.cpp : <define>BOOST_PP_VARIADICS=0 : tuple_nvm ] + ; + +alias preprocessor_c + : + [ compile arithmetic.c + : + : arithmetic_c + ] + [ compile array.c + : + : array_c + ] + [ compile comparison.c + : + : comparison_c + ] + [ compile control.c + : + : control_c + ] + [ compile debug.c + : + : debug_c + ] + [ compile facilities.c + : + : facilities_c + ] + [ compile list.c + : + : list_c + ] + [ compile logical.c + : + : logical_c + ] + [ compile punctuation.c + : + : punctuation_c + ] + [ compile selection.c + : + : selection_c + ] + [ compile seq.c + : + : seq_c + ] + [ compile slot.c + : + : slot_c + ] + [ compile stringize.c + : + : stringize_c + ] + [ compile tuple.c + : + : tuple_c + ] + [ compile variadic.c + : + : variadic_c + ] + ; + +alias preprocessor_c_nvm + : + [ compile arithmetic.c + : <define>BOOST_PP_VARIADICS=0 + : arithmetic_c_nvm + ] + [ compile array.c + : <define>BOOST_PP_VARIADICS=0 + : array_c_nvm + ] + [ compile comparison.c + : <define>BOOST_PP_VARIADICS=0 + : comparison_c_nvm + ] + [ compile control.c + : <define>BOOST_PP_VARIADICS=0 + : control_c_nvm + ] + [ compile debug.c + : <define>BOOST_PP_VARIADICS=0 + : debug_c_nvm + ] + [ compile facilities.c + : <define>BOOST_PP_VARIADICS=0 + : facilities_c_nvm + ] + [ compile list.c + : <define>BOOST_PP_VARIADICS=0 + : list_c_nvm + ] + [ compile logical.c + : <define>BOOST_PP_VARIADICS=0 + : logical_c_nvm + ] + [ compile selection.c + : <define>BOOST_PP_VARIADICS=0 + : selection_c_nvm + ] + [ compile seq.c + : <define>BOOST_PP_VARIADICS=0 + : seq_c_nvm + ] + [ compile slot.c + : <define>BOOST_PP_VARIADICS=0 + : slot_c_nvm + ] + [ compile stringize.c + : <define>BOOST_PP_VARIADICS=0 + : stringize_c_nvm + ] + [ compile tuple.c + : <define>BOOST_PP_VARIADICS=0 + : tuple_c_nvm + ] + ; + +alias preprocessor_isempty : : + <toolset>gcc + <toolset-gcc:version>3.4 + ; + +alias preprocessor_isempty : : + <toolset>gcc + <toolset-gcc:version>4.1 + ; + +alias preprocessor_isempty : : + <toolset>gcc + <toolset-gcc:version>4.2 + ; + +alias preprocessor_isempty + : + [ compile isempty.cpp ] + [ compile checkempty.cpp ] + [ compile-fail isempty_variadic_standard_failure.cpp : <define>BOOST_PP_VARIADICS=1 ] + [ compile-fail isempty_variadic_standard_failure2.cpp : <define>BOOST_PP_VARIADICS=1 ] + [ compile vaopt.cpp ] + ; + +alias preprocessor_isempty_nvm + : + [ compile isempty.cpp : <define>BOOST_PP_VARIADICS=0 : isempty_nvm ] + ; + +alias preprocessor_isempty_c + : + [ compile isempty.c + : + : isempty_c + ] + [ compile-fail isempty_variadic_standard_failure.c + : <define>BOOST_PP_VARIADICS=1 + : isempty_variadic_standard_failure_c + ] + [ compile-fail isempty_variadic_standard_failure2.c + : <define>BOOST_PP_VARIADICS=1 + : isempty_variadic_standard_failure2_c + ] + ; + +alias preprocessor_isempty_c_nvm + : + [ compile isempty.c + : <define>BOOST_PP_VARIADICS=0 + : isempty_c_nvm + ] + ; + +alias preprocessor_config + : + [ run config_info.cpp ] + ; + +alias test_clang_cuda + : + [ compile [ cast _ cpp : clang_cuda.cu ] + : <cxxflags>-nocudalib + <cxxflags>-nocudainc + <cxxflags>"-x cuda" + : clang_cuda_cu + ] + ; + +explicit test_clang_cuda ; + +alias test_iso + : + [ run cpp_standard.cpp ] + ; + +explicit test_iso ; + +explicit compile quick.cpp ; # "Quick" test (for CI) diff --git a/src/boost/libs/preprocessor/test/arithmetic.c b/src/boost/libs/preprocessor/test/arithmetic.c new file mode 100644 index 000000000..53a071e90 --- /dev/null +++ b/src/boost/libs/preprocessor/test/arithmetic.c @@ -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/arithmetic.cxx> diff --git a/src/boost/libs/preprocessor/test/arithmetic.cpp b/src/boost/libs/preprocessor/test/arithmetic.cpp new file mode 100644 index 000000000..53a071e90 --- /dev/null +++ b/src/boost/libs/preprocessor/test/arithmetic.cpp @@ -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/arithmetic.cxx> diff --git a/src/boost/libs/preprocessor/test/arithmetic.cxx b/src/boost/libs/preprocessor/test/arithmetic.cxx new file mode 100644 index 000000000..5d48928f2 --- /dev/null +++ b/src/boost/libs/preprocessor/test/arithmetic.cxx @@ -0,0 +1,82 @@ +# /* ************************************************************************** +# * * +# * (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 <boost/preprocessor/arithmetic.hpp> +# include <boost/preprocessor/config/limits.hpp> +# include <libs/preprocessor/test/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 + +/* 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 diff --git a/src/boost/libs/preprocessor/test/array.c b/src/boost/libs/preprocessor/test/array.c new file mode 100644 index 000000000..9150747b5 --- /dev/null +++ b/src/boost/libs/preprocessor/test/array.c @@ -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/array.cxx> diff --git a/src/boost/libs/preprocessor/test/array.cpp b/src/boost/libs/preprocessor/test/array.cpp new file mode 100644 index 000000000..9150747b5 --- /dev/null +++ b/src/boost/libs/preprocessor/test/array.cpp @@ -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/array.cxx> diff --git a/src/boost/libs/preprocessor/test/array.cxx b/src/boost/libs/preprocessor/test/array.cxx new file mode 100644 index 000000000..e6925ab10 --- /dev/null +++ b/src/boost/libs/preprocessor/test/array.cxx @@ -0,0 +1,192 @@ +# /* ************************************************************************** +# * * +# * (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,2013) */ +# +# /* See http://www.boost.org for most recent version. */ +# +# include <boost/preprocessor/array.hpp> +# include <libs/preprocessor/test/test.h> +# include <boost/preprocessor/facilities/is_empty.hpp> +# include <boost/preprocessor/list/at.hpp> +# include <boost/preprocessor/list/size.hpp> +# include <boost/preprocessor/seq/elem.hpp> +# include <boost/preprocessor/seq/size.hpp> +# include <boost/preprocessor/tuple/elem.hpp> +# include <boost/preprocessor/tuple/size.hpp> +# if BOOST_PP_VARIADICS +# include <boost/preprocessor/variadic/size.hpp> +# include <boost/preprocessor/variadic/elem.hpp> +# endif + +# define ARRAY_EMPTY (0, ()) +# define ARRAY_ONE (1, ()) +# define ARRAY (3, (0, 1, 2)) +# define ARRAY_LARGE (33, (0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32)) +# define ARRAY_VERY_LARGE (64, (0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63)) + +// element access + +BEGIN BOOST_PP_IS_EMPTY(BOOST_PP_ARRAY_ELEM(0, ARRAY_ONE)) == 1 END +BEGIN BOOST_PP_ARRAY_ELEM(1, ARRAY) == 1 END +BEGIN BOOST_PP_ARRAY_ELEM(2, (5, (0, 1, 2, 3, 4))) == 2 END +BEGIN BOOST_PP_ARRAY_ELEM(28, ARRAY_LARGE) == 28 END +BEGIN BOOST_PP_ARRAY_ELEM(17, (33, (0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32))) == 17 END +BEGIN BOOST_PP_ARRAY_ELEM(42, ARRAY_VERY_LARGE) == 42 END +BEGIN BOOST_PP_ARRAY_ELEM(62, (64, (0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63))) == 62 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(ARRAY_LARGE) == 33 END +BEGIN BOOST_PP_ARRAY_SIZE((33, (0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32))) == 33 END +BEGIN BOOST_PP_ARRAY_SIZE(ARRAY_VERY_LARGE) == 64 END +BEGIN BOOST_PP_ARRAY_SIZE((64, (0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63))) == 64 END +BEGIN BOOST_PP_ARRAY_SIZE(ARRAY_EMPTY) == 0 END +BEGIN BOOST_PP_ARRAY_SIZE(ARRAY_ONE) == 1 END + +// enum + +# if BOOST_PP_VARIADICS + +BEGIN BOOST_PP_VARIADIC_ELEM(2,BOOST_PP_ARRAY_ENUM(ARRAY)) == 2 END +BEGIN BOOST_PP_VARIADIC_ELEM(3,BOOST_PP_ARRAY_ENUM((5, (0, 1, 2, 3, 4)))) == 3 END +BEGIN BOOST_PP_VARIADIC_ELEM(31,BOOST_PP_ARRAY_ENUM(ARRAY_LARGE)) == 31 END +BEGIN BOOST_PP_VARIADIC_ELEM(13,BOOST_PP_ARRAY_ENUM((33, (0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32)))) == 13 END +BEGIN BOOST_PP_VARIADIC_ELEM(39,BOOST_PP_ARRAY_ENUM(ARRAY_VERY_LARGE)) == 39 END +BEGIN BOOST_PP_VARIADIC_ELEM(24,BOOST_PP_ARRAY_ENUM((64, (0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63)))) == 24 END +BEGIN BOOST_PP_VARIADIC_SIZE(BOOST_PP_ARRAY_ENUM((5, (0, 1, 2, 3, 4)))) == 5 END +BEGIN BOOST_PP_VARIADIC_SIZE(BOOST_PP_ARRAY_ENUM(ARRAY_LARGE)) == 33 END +BEGIN BOOST_PP_VARIADIC_SIZE(BOOST_PP_ARRAY_ENUM(ARRAY_VERY_LARGE)) == 64 END +BEGIN BOOST_PP_VARIADIC_SIZE(BOOST_PP_ARRAY_ENUM((64, (0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63)))) == 64 END +BEGIN BOOST_PP_VARIADIC_SIZE(BOOST_PP_ARRAY_ENUM(ARRAY_ONE)) == 1 END + +# endif + +// to_list + +BEGIN BOOST_PP_LIST_AT(BOOST_PP_ARRAY_TO_LIST(ARRAY), 1) == 1 END +BEGIN BOOST_PP_LIST_AT(BOOST_PP_ARRAY_TO_LIST((5, (0, 1, 2, 3, 4))), 4) == 4 END +BEGIN BOOST_PP_LIST_AT(BOOST_PP_ARRAY_TO_LIST((33, (0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32))), 26) == 26 END +BEGIN BOOST_PP_LIST_AT(BOOST_PP_ARRAY_TO_LIST(ARRAY_VERY_LARGE), 60) == 60 END +BEGIN BOOST_PP_LIST_SIZE(BOOST_PP_ARRAY_TO_LIST(ARRAY_EMPTY)) == 0 END +BEGIN BOOST_PP_LIST_SIZE(BOOST_PP_ARRAY_TO_LIST(ARRAY_ONE)) == 1 END + +// to_seq + +BEGIN BOOST_PP_IS_EMPTY(BOOST_PP_SEQ_ELEM(0, BOOST_PP_ARRAY_TO_SEQ(ARRAY_ONE))) == 1 END +BEGIN BOOST_PP_SEQ_ELEM(0, BOOST_PP_ARRAY_TO_SEQ(ARRAY)) == 0 END +BEGIN BOOST_PP_SEQ_ELEM(3, BOOST_PP_ARRAY_TO_SEQ((5, (0, 1, 2, 3, 4)))) == 3 END +BEGIN BOOST_PP_SEQ_ELEM(17, BOOST_PP_ARRAY_TO_SEQ(ARRAY_LARGE)) == 17 END +BEGIN BOOST_PP_SEQ_ELEM(42, BOOST_PP_ARRAY_TO_SEQ((64, (0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63)))) == 42 END + +// to_tuple + +# if BOOST_PP_VARIADICS + +BEGIN BOOST_PP_IS_EMPTY(BOOST_PP_TUPLE_ELEM(0, BOOST_PP_ARRAY_TO_TUPLE(ARRAY_ONE))) == 1 END +BEGIN BOOST_PP_TUPLE_ELEM(2, BOOST_PP_ARRAY_TO_TUPLE(ARRAY)) == 2 END +BEGIN BOOST_PP_TUPLE_ELEM(1, BOOST_PP_ARRAY_TO_TUPLE((5, (0, 1, 2, 3, 4)))) == 1 END +BEGIN BOOST_PP_TUPLE_ELEM(26, BOOST_PP_ARRAY_TO_TUPLE(ARRAY_LARGE)) == 26 END +BEGIN BOOST_PP_TUPLE_ELEM(37, BOOST_PP_ARRAY_TO_TUPLE((64, (0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63)))) == 37 END + +# else + +BEGIN BOOST_PP_IS_EMPTY(BOOST_PP_TUPLE_ELEM(1, 0, BOOST_PP_ARRAY_TO_TUPLE(ARRAY_ONE))) == 1 END +BEGIN BOOST_PP_TUPLE_ELEM(3, 2, BOOST_PP_ARRAY_TO_TUPLE(ARRAY)) == 2 END +BEGIN BOOST_PP_TUPLE_ELEM(5, 1, BOOST_PP_ARRAY_TO_TUPLE((5, (0, 1, 2, 3, 4)))) == 1 END +BEGIN BOOST_PP_TUPLE_ELEM(33, 26, BOOST_PP_ARRAY_TO_TUPLE(ARRAY_LARGE)) == 26 END +BEGIN BOOST_PP_TUPLE_ELEM(64, 37, BOOST_PP_ARRAY_TO_TUPLE((64, (0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63)))) == 37 END + +# endif + +// insert + +BEGIN BOOST_PP_ARRAY_ELEM(0, BOOST_PP_ARRAY_INSERT(ARRAY_ONE,0,63)) == 63 END +BEGIN BOOST_PP_ARRAY_ELEM(0, BOOST_PP_ARRAY_INSERT(ARRAY,2,40)) == 0 END +BEGIN BOOST_PP_ARRAY_ELEM(1, BOOST_PP_ARRAY_INSERT(ARRAY,1,40)) == 40 END +BEGIN BOOST_PP_ARRAY_ELEM(2, BOOST_PP_ARRAY_INSERT(ARRAY,1,40)) == 1 END +BEGIN BOOST_PP_ARRAY_SIZE(BOOST_PP_ARRAY_INSERT(ARRAY,1,40)) == 4 END + +BEGIN BOOST_PP_ARRAY_ELEM(8, BOOST_PP_ARRAY_INSERT(ARRAY_LARGE,22,1000)) == 8 END +BEGIN BOOST_PP_ARRAY_ELEM(22, BOOST_PP_ARRAY_INSERT(ARRAY_LARGE,22,1000)) == 1000 END +BEGIN BOOST_PP_ARRAY_ELEM(26, BOOST_PP_ARRAY_INSERT(ARRAY_LARGE,22,1000)) == 25 END +BEGIN BOOST_PP_ARRAY_SIZE(BOOST_PP_ARRAY_INSERT(ARRAY_LARGE,22,1000)) == 34 END + +BEGIN BOOST_PP_ARRAY_ELEM(0, BOOST_PP_ARRAY_INSERT(ARRAY_EMPTY,0,25)) == 25 END +BEGIN BOOST_PP_ARRAY_SIZE(BOOST_PP_ARRAY_INSERT(ARRAY_EMPTY,0,1000)) == 1 END + +// pop_back + +BEGIN BOOST_PP_ARRAY_SIZE(BOOST_PP_ARRAY_POP_BACK(ARRAY)) == 2 END +BEGIN BOOST_PP_ARRAY_SIZE(BOOST_PP_ARRAY_POP_BACK(ARRAY_LARGE)) == 32 END +BEGIN BOOST_PP_ARRAY_SIZE(BOOST_PP_ARRAY_POP_BACK(ARRAY_VERY_LARGE)) == 63 END + +// pop_front + +BEGIN BOOST_PP_ARRAY_SIZE(BOOST_PP_ARRAY_POP_FRONT(ARRAY)) == 2 END +BEGIN BOOST_PP_ARRAY_SIZE(BOOST_PP_ARRAY_POP_FRONT(ARRAY_LARGE)) == 32 END +BEGIN BOOST_PP_ARRAY_SIZE(BOOST_PP_ARRAY_POP_FRONT(ARRAY_VERY_LARGE)) == 63 END + +BEGIN BOOST_PP_ARRAY_ELEM(1, BOOST_PP_ARRAY_POP_FRONT(ARRAY)) == 2 END +BEGIN BOOST_PP_ARRAY_ELEM(31, BOOST_PP_ARRAY_POP_FRONT(ARRAY_LARGE)) == 32 END +BEGIN BOOST_PP_ARRAY_ELEM(55, BOOST_PP_ARRAY_POP_FRONT(ARRAY_VERY_LARGE)) == 56 END + +// push_back + +BEGIN BOOST_PP_ARRAY_SIZE(BOOST_PP_ARRAY_PUSH_BACK(ARRAY, 3)) == 4 END +BEGIN BOOST_PP_ARRAY_SIZE(BOOST_PP_ARRAY_PUSH_BACK(ARRAY_LARGE, 33)) == 34 END +BEGIN BOOST_PP_ARRAY_SIZE(BOOST_PP_ARRAY_PUSH_BACK(ARRAY_EMPTY, 10)) == 1 END +BEGIN BOOST_PP_ARRAY_SIZE(BOOST_PP_ARRAY_PUSH_BACK(ARRAY_ONE, 44)) == 2 END +BEGIN BOOST_PP_ARRAY_ELEM(0, BOOST_PP_ARRAY_PUSH_BACK(ARRAY, 3)) == 0 END +BEGIN BOOST_PP_ARRAY_ELEM(33, BOOST_PP_ARRAY_PUSH_BACK(ARRAY_LARGE, 33)) == 33 END +BEGIN BOOST_PP_ARRAY_ELEM(0, BOOST_PP_ARRAY_PUSH_BACK(ARRAY_EMPTY, 136)) == 136 END +BEGIN BOOST_PP_ARRAY_ELEM(1, BOOST_PP_ARRAY_PUSH_BACK(ARRAY_ONE, 245)) == 245 END + +// push_front + +BEGIN BOOST_PP_ARRAY_SIZE(BOOST_PP_ARRAY_PUSH_FRONT(ARRAY, 555)) == 4 END +BEGIN BOOST_PP_ARRAY_SIZE(BOOST_PP_ARRAY_PUSH_FRONT(ARRAY_LARGE, 666)) == 34 END +BEGIN BOOST_PP_ARRAY_SIZE(BOOST_PP_ARRAY_PUSH_FRONT(ARRAY_EMPTY, 10)) == 1 END +BEGIN BOOST_PP_ARRAY_SIZE(BOOST_PP_ARRAY_PUSH_FRONT(ARRAY_ONE, 131)) == 2 END +BEGIN BOOST_PP_ARRAY_ELEM(0, BOOST_PP_ARRAY_PUSH_FRONT(ARRAY, 555)) == 555 END +BEGIN BOOST_PP_ARRAY_ELEM(33, BOOST_PP_ARRAY_PUSH_FRONT(ARRAY_LARGE, 33)) == 32 END +BEGIN BOOST_PP_ARRAY_ELEM(0, BOOST_PP_ARRAY_PUSH_FRONT(ARRAY_EMPTY, 136)) == 136 END +BEGIN BOOST_PP_ARRAY_ELEM(0, BOOST_PP_ARRAY_PUSH_FRONT(ARRAY_ONE, 56)) == 56 END + +// remove + +BEGIN BOOST_PP_ARRAY_SIZE(BOOST_PP_ARRAY_REMOVE(ARRAY_ONE, 0)) == 0 END +BEGIN BOOST_PP_ARRAY_SIZE(BOOST_PP_ARRAY_REMOVE(ARRAY, 1)) == 2 END +BEGIN BOOST_PP_ARRAY_SIZE(BOOST_PP_ARRAY_REMOVE(ARRAY_LARGE, 17)) == 32 END +BEGIN BOOST_PP_ARRAY_SIZE(BOOST_PP_ARRAY_REMOVE(ARRAY_VERY_LARGE, 27)) == 63 END +BEGIN BOOST_PP_ARRAY_ELEM(0, BOOST_PP_ARRAY_REMOVE(ARRAY, 2)) == 0 END +BEGIN BOOST_PP_ARRAY_ELEM(29, BOOST_PP_ARRAY_REMOVE(ARRAY_LARGE, 25)) == 30 END +BEGIN BOOST_PP_ARRAY_ELEM(62, BOOST_PP_ARRAY_REMOVE(ARRAY_VERY_LARGE, 48)) == 63 END + +// replace + +BEGIN BOOST_PP_ARRAY_SIZE(BOOST_PP_ARRAY_REPLACE(ARRAY_ONE, 0, 3)) == 1 END +BEGIN BOOST_PP_ARRAY_SIZE(BOOST_PP_ARRAY_REPLACE(ARRAY_VERY_LARGE, 27, 1000)) == 64 END +BEGIN BOOST_PP_ARRAY_ELEM(0, BOOST_PP_ARRAY_REPLACE(ARRAY_ONE, 0, 68)) == 68 END +BEGIN BOOST_PP_ARRAY_ELEM(0, BOOST_PP_ARRAY_REPLACE(ARRAY, 1, 44)) == 0 END +BEGIN BOOST_PP_ARRAY_ELEM(29, BOOST_PP_ARRAY_REPLACE(ARRAY_LARGE, 29, 999)) == 999 END +BEGIN BOOST_PP_ARRAY_ELEM(38, BOOST_PP_ARRAY_REPLACE(ARRAY_VERY_LARGE, 37, 1)) == 38 END +BEGIN BOOST_PP_ARRAY_ELEM(28, BOOST_PP_ARRAY_REPLACE(ARRAY_VERY_LARGE, 28, 1)) == 1 END + +// reverse + +BEGIN BOOST_PP_ARRAY_SIZE(BOOST_PP_ARRAY_REVERSE(ARRAY_VERY_LARGE)) == 64 END +BEGIN BOOST_PP_IS_EMPTY(BOOST_PP_ARRAY_ELEM(0, BOOST_PP_ARRAY_REVERSE(ARRAY_ONE))) == 1 END +BEGIN BOOST_PP_ARRAY_ELEM(0, BOOST_PP_ARRAY_REVERSE(ARRAY)) == 2 END +BEGIN BOOST_PP_ARRAY_ELEM(29, BOOST_PP_ARRAY_REVERSE(ARRAY_LARGE)) == 3 END +BEGIN BOOST_PP_ARRAY_ELEM(38, BOOST_PP_ARRAY_REVERSE(ARRAY_VERY_LARGE)) == 25 END +BEGIN BOOST_PP_ARRAY_SIZE(BOOST_PP_ARRAY_REVERSE(ARRAY_EMPTY)) == 0 END +BEGIN BOOST_PP_ARRAY_SIZE(BOOST_PP_ARRAY_REVERSE(ARRAY_ONE)) == 1 END diff --git a/src/boost/libs/preprocessor/test/checkempty.cpp b/src/boost/libs/preprocessor/test/checkempty.cpp new file mode 100644 index 000000000..63067082e --- /dev/null +++ b/src/boost/libs/preprocessor/test/checkempty.cpp @@ -0,0 +1,12 @@ +# /* ************************************************************************** +# * * +# * (C) Copyright Edward Diener 2019. +# * 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/checkempty.cxx> diff --git a/src/boost/libs/preprocessor/test/checkempty.cxx b/src/boost/libs/preprocessor/test/checkempty.cxx new file mode 100644 index 000000000..ef32da1ff --- /dev/null +++ b/src/boost/libs/preprocessor/test/checkempty.cxx @@ -0,0 +1,61 @@ +# /* ************************************************************************** +# * * +# * (C) Copyright Edward Diener 2019. +# * 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/test.h> +# include <boost/preprocessor/facilities/check_empty.hpp> + +# if BOOST_PP_VARIADIC_HAS_OPT() + +# include <boost/preprocessor/facilities/empty.hpp> + +#define DATA +#define OBJECT OBJECT2 +#define OBJECT2 +#define FUNC(x) FUNC2(x) +#define FUNC2(x) +#define FUNC_GEN() () +#define FUNC_GEN2(x) () +#define FUNC_GEN3() (&) +#define FUNC_GEN4(x) (y) +#define FUNC_GEN5() (y,z) +#define FUNC_GEN6() anything +#define FUNC_GEN7(x) anything +#define FUNC_GEN8(x,y) (1,2,3) +#define FUNC_GEN9(x,y,z) anything +#define FUNC_GEN10(x) (y) data +#define NAME &name +#define ATUPLE (atuple) +#define ATUPLE_PLUS (atuple) data + +BEGIN BOOST_PP_CHECK_EMPTY(FUNC_GEN) == 0 END +BEGIN BOOST_PP_CHECK_EMPTY(FUNC_GEN2) == 0 END +BEGIN BOOST_PP_CHECK_EMPTY(FUNC_GEN3) == 0 END +BEGIN BOOST_PP_CHECK_EMPTY(FUNC_GEN4) == 0 END +BEGIN BOOST_PP_CHECK_EMPTY(FUNC_GEN5) == 0 END +BEGIN BOOST_PP_CHECK_EMPTY(FUNC_GEN8) == 0 END +BEGIN BOOST_PP_CHECK_EMPTY(FUNC_GEN9) == 0 END +BEGIN BOOST_PP_CHECK_EMPTY(FUNC_GEN10) == 0 END +BEGIN BOOST_PP_CHECK_EMPTY(BOOST_PP_EMPTY()) == 1 END +BEGIN BOOST_PP_CHECK_EMPTY(DATA BOOST_PP_EMPTY()) == 1 END +BEGIN BOOST_PP_CHECK_EMPTY(x BOOST_PP_EMPTY()) == 0 END +BEGIN BOOST_PP_CHECK_EMPTY(OBJECT BOOST_PP_EMPTY()) == 1 END +BEGIN BOOST_PP_CHECK_EMPTY(FUNC(z) BOOST_PP_EMPTY()) == 1 END +BEGIN BOOST_PP_CHECK_EMPTY(FUNC_GEN6) == 0 END +BEGIN BOOST_PP_CHECK_EMPTY(FUNC_GEN7) == 0 END +BEGIN BOOST_PP_CHECK_EMPTY(NAME) == 0 END +BEGIN BOOST_PP_CHECK_EMPTY(ATUPLE) == 0 END +BEGIN BOOST_PP_CHECK_EMPTY(ATUPLE_PLUS) == 0 END + +# else + +BEGIN 1 == 1 END + +# endif diff --git a/src/boost/libs/preprocessor/test/clang_cuda.cu b/src/boost/libs/preprocessor/test/clang_cuda.cu new file mode 100644 index 000000000..e13d65634 --- /dev/null +++ b/src/boost/libs/preprocessor/test/clang_cuda.cu @@ -0,0 +1,26 @@ +# /* ************************************************************************** +# * * +# * (C) Copyright Edward Diener 2019. +# * 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/test_macro.h> + +#if defined(__clang__) && defined(__CUDACC__) && defined(__CUDA__) + +BEGIN BOOST_PP_VARIADICS == 1 END + +#else + +BEGIN 0 == 1 END + +#endif + +int main(void) { + return 0; +} diff --git a/src/boost/libs/preprocessor/test/cmake_install_test/CMakeLists.txt b/src/boost/libs/preprocessor/test/cmake_install_test/CMakeLists.txt new file mode 100644 index 000000000..7c788bc5c --- /dev/null +++ b/src/boost/libs/preprocessor/test/cmake_install_test/CMakeLists.txt @@ -0,0 +1,17 @@ +# Copyright 2018, 2019 Peter Dimov +# 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 + +cmake_minimum_required(VERSION 3.5...3.16) + +project(cmake_install_test LANGUAGES CXX) + +find_package(boost_preprocessor REQUIRED) + +add_executable(quick ../quick.cpp) +target_link_libraries(quick Boost::preprocessor) + +enable_testing() +add_test(quick quick) + +add_custom_target(check COMMAND ${CMAKE_CTEST_COMMAND} --output-on-failure -C $<CONFIG>) diff --git a/src/boost/libs/preprocessor/test/cmake_subdir_test/CMakeLists.txt b/src/boost/libs/preprocessor/test/cmake_subdir_test/CMakeLists.txt new file mode 100644 index 000000000..1181e4aa6 --- /dev/null +++ b/src/boost/libs/preprocessor/test/cmake_subdir_test/CMakeLists.txt @@ -0,0 +1,17 @@ +# Copyright 2018, 2019 Peter Dimov +# 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 + +cmake_minimum_required(VERSION 3.5...3.16) + +project(cmake_subdir_test LANGUAGES CXX) + +add_subdirectory(../.. boostorg/preprocessor) + +add_executable(quick ../quick.cpp) +target_link_libraries(quick Boost::preprocessor) + +enable_testing() +add_test(quick quick) + +add_custom_target(check COMMAND ${CMAKE_CTEST_COMMAND} --output-on-failure -C $<CONFIG>) diff --git a/src/boost/libs/preprocessor/test/comparison.c b/src/boost/libs/preprocessor/test/comparison.c new file mode 100644 index 000000000..5f7daea40 --- /dev/null +++ b/src/boost/libs/preprocessor/test/comparison.c @@ -0,0 +1,13 @@ +# /* ************************************************************************** +# * * +# * (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/comparison.cxx> + diff --git a/src/boost/libs/preprocessor/test/comparison.cpp b/src/boost/libs/preprocessor/test/comparison.cpp new file mode 100644 index 000000000..40720c604 --- /dev/null +++ b/src/boost/libs/preprocessor/test/comparison.cpp @@ -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/comparison.cxx> diff --git a/src/boost/libs/preprocessor/test/comparison.cxx b/src/boost/libs/preprocessor/test/comparison.cxx new file mode 100644 index 000000000..77e7b1af1 --- /dev/null +++ b/src/boost/libs/preprocessor/test/comparison.cxx @@ -0,0 +1,45 @@ +# /* ************************************************************************** +# * * +# * (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 <boost/preprocessor/comparison.hpp> +# include <libs/preprocessor/test/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 diff --git a/src/boost/libs/preprocessor/test/config_info.cpp b/src/boost/libs/preprocessor/test/config_info.cpp new file mode 100644 index 000000000..471d3dfca --- /dev/null +++ b/src/boost/libs/preprocessor/test/config_info.cpp @@ -0,0 +1,106 @@ +# /* ************************************************************************** +# * * +# * (C) Copyright Edward Diener 2014,2019. +# * 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 <iostream> +#include <iomanip> +#include <string.h> +#include <boost/preprocessor/stringize.hpp> +#include <boost/preprocessor/variadic/has_opt.hpp> + +static unsigned int indent = 4; +static unsigned int width = 40; + +using std::cout; +using std::istream; + +void print_separator() +{ + std::cout << +"\n\n*********************************************************************\n\n"; +} + +void print_macro(const char* name, const char* value) +{ + // if name == value+1 then then macro is not defined, + // in which case we don't print anything: + if(0 != strcmp(name, value+1)) + { + for(unsigned i = 0; i < indent; ++i) std::cout.put(' '); + std::cout << std::setw(width); + cout.setf(istream::left, istream::adjustfield); + std::cout << name; + if(value[1]) + { + // macro has a value: + std::cout << value << "\n"; + } + else + { + // macro is defined but has no value: + std::cout << " [no value]\n"; + } + } +} + +#define PRINT_MACRO(X) print_macro(#X, BOOST_PP_STRINGIZE(=X)) + +void print_macros() +{ + + print_separator(); + + PRINT_MACRO(__GCCXML__); + PRINT_MACRO(__WAVE__); + PRINT_MACRO(__MWERKS__); + PRINT_MACRO(__EDG__); + PRINT_MACRO(_MSC_VER); + PRINT_MACRO(__clang__); + PRINT_MACRO(__DMC__); + PRINT_MACRO(__BORLANDC__); + PRINT_MACRO(__IBMC__); + PRINT_MACRO(__IBMCPP__); + PRINT_MACRO(__SUNPRO_CC); + PRINT_MACRO(__CUDACC__); + PRINT_MACRO(__PATHSCALE__); + PRINT_MACRO(__CODEGEARC__); + PRINT_MACRO(__HP_aCC); + PRINT_MACRO(__SC__); + PRINT_MACRO(__MRC__); + PRINT_MACRO(__PGI); + PRINT_MACRO(__INTEL_COMPILER); + PRINT_MACRO(__GNUC__); + PRINT_MACRO(__GXX_EXPERIMENTAL_CXX0X__); + + print_separator(); + + PRINT_MACRO(__cplusplus); + PRINT_MACRO(__STDC_VERSION__); + PRINT_MACRO(__EDG_VERSION__); + PRINT_MACRO(__INTELLISENSE__); + PRINT_MACRO(__WAVE_HAS_VARIADICS__); + + print_separator(); + + PRINT_MACRO(BOOST_PP_CONFIG_ERRORS); + PRINT_MACRO(BOOST_PP_CONFIG_EXTENDED_LINE_INFO); + PRINT_MACRO(BOOST_PP_CONFIG_FLAGS()); + PRINT_MACRO(BOOST_PP_VARIADICS); + PRINT_MACRO(BOOST_PP_VARIADICS_MSVC); + PRINT_MACRO(BOOST_PP_VARIADIC_HAS_OPT()); +} + +int main() +{ + + print_macros(); + + return 0; +} diff --git a/src/boost/libs/preprocessor/test/control.c b/src/boost/libs/preprocessor/test/control.c new file mode 100644 index 000000000..db729d900 --- /dev/null +++ b/src/boost/libs/preprocessor/test/control.c @@ -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/control.cxx> diff --git a/src/boost/libs/preprocessor/test/control.cpp b/src/boost/libs/preprocessor/test/control.cpp new file mode 100644 index 000000000..db729d900 --- /dev/null +++ b/src/boost/libs/preprocessor/test/control.cpp @@ -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/control.cxx> diff --git a/src/boost/libs/preprocessor/test/control.cxx b/src/boost/libs/preprocessor/test/control.cxx new file mode 100644 index 000000000..0a2bb766b --- /dev/null +++ b/src/boost/libs/preprocessor/test/control.cxx @@ -0,0 +1,40 @@ +# /* ************************************************************************** +# * * +# * (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 <boost/preprocessor/arithmetic/add.hpp> +# include <boost/preprocessor/arithmetic/dec.hpp> +# include <boost/preprocessor/control.hpp> +# include <libs/preprocessor/test/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_2, 10) == 0 END +BEGIN BOOST_PP_WHILE(PRED, OP_3, 10) == 0 END diff --git a/src/boost/libs/preprocessor/test/cpp_standard.cpp b/src/boost/libs/preprocessor/test/cpp_standard.cpp new file mode 100644 index 000000000..885fc81d5 --- /dev/null +++ b/src/boost/libs/preprocessor/test/cpp_standard.cpp @@ -0,0 +1,551 @@ +#include <iostream> +#include <iomanip> +#include <string> +#include <boost/preprocessor/config/config.hpp> + +static unsigned int indent = 4; +static unsigned int width = 90; + +using std::cout; +using std::istream; + +void print_separator() +{ + std::cout << +"\n\n*********************************************************************\n\n"; +} + +std::string remove_spaces(const std::string ss) + { + + bool inquotes(false); + bool escape(false); + char qchar; + int len(static_cast<int>(ss.length())); + + std::string ret; + + for (int i = 0; i < len; ++i) + { + + char ch(ss[i]); + + if (inquotes) + { + if (escape) + { + escape = false; + } + else if (ch == '\\') + { + escape = true; + } + else if (ch == qchar) + { + inquotes = false; + } + ret.push_back(ch); + } + else + { + if (ch == '\'' || ch == '"') + { + inquotes = true; + qchar = ch; + ret.push_back(ch); + } + else if (ch != ' ') + { + ret.push_back(ch); + } + } + } + + return ret; + } + +int print_macro(const std::string name,const std::string expected, const std::string expansion) +{ + int bret(0); + const std::string sg("Success: "); + const std::string sb("Failure: "); + for(unsigned i = 0; i < indent; ++i) std::cout.put(' '); + if (name == expansion) + { + if (expected == expansion) + { + std::cout << sg; + std::cout << std::setw(width); + cout.setf(istream::left, istream::adjustfield); + std::cout << name; + std::cout << " [no value]\n"; + } + else + { + std::cout << sb; + std::cout << std::setw(width); + cout.setf(istream::left, istream::adjustfield); + std::cout << name; + std::cout << " [no value]: "; + std::cout << " [expected]: "; + std::cout << expected << "\n"; + bret = 1; + } + } + else + { + + std::string sexpected(remove_spaces(expected)); + std::string sexpansion(remove_spaces(expansion)); + + if (sexpected == sexpansion) + { + std::cout << sg; + std::cout << std::setw(width); + cout.setf(istream::left, istream::adjustfield); + std::cout << name; + std::cout << expansion << "\n"; + } + else + { + std::cout << sb; + std::cout << std::setw(width); + cout.setf(istream::left, istream::adjustfield); + std::cout << name; + std::cout << expansion; + std::cout << " [expected]: "; + std::cout << expected << "\n"; + bret = 1; + } + } + return bret; +} + +#if !BOOST_PP_VARIADICS + +#define STRINGIZE(arg) # arg + +#define PRINT_MACRO_RESULTS(X,exp) print_macro(std::string(# X), std::string(# exp), std::string(STRINGIZE(X))) +#define PRINT_MACRO(x) std::string(# x) +#define PRINT_EXPECTED(x) std::string(# x) +#define PRINT_EXPANSION(x) std::string(STRINGIZE(x)) + +#else + +#define STRINGIZE(...) # __VA_ARGS__ + +#define PRINT_MACRO_RESULTS(X,...) print_macro(std::string(# X), std::string(# __VA_ARGS__), std::string(STRINGIZE(X))) +#define PRINT_MACRO(...) std::string(# __VA_ARGS__) +#define PRINT_EXPECTED(...) std::string(# __VA_ARGS__) +#define PRINT_EXPANSION(...) std::string(STRINGIZE(__VA_ARGS__)) + +#endif + +#if __cplusplus > 201703L + +int print_macros_common_c20() +{ + + int bret = 0; + +#define LPAREN() ( +#define G(Q) 42 +#define F(R, X, ...) __VA_OPT__(G R X) ) + +// int x = F(LPAREN(), 0, <:-); + +// replaced by + +// int x = 42; + +bret += PRINT_MACRO_RESULTS(int x = F(LPAREN(), 0, <:-);,int x = 42;); + +#undef LPAREN +#undef G +#undef F + +#define F(...) f(0 __VA_OPT__(,) __VA_ARGS__) +#define G(X, ...) f(0, X __VA_OPT__(,) __VA_ARGS__) +#define SDEF(sname, ...) S sname __VA_OPT__(= { __VA_ARGS__ }) +#define EMP + +// F(a, b, c) +// F() +// F(EMP) + +// replaced by + +// f(0, a, b, c) +// f(0) +// f(0) + +// G(a, b, c) +// G(a, ) +// G(a) + +// replaced by + +// f(0, a, b, c) +// f(0, a) +// f(0, a) + +// SDEF(foo); +// SDEF(bar, 1, 2); + +// replaced by + +// S foo; +// S bar = { 1, 2 }; + +bret += PRINT_MACRO_RESULTS(F(a, b, c),f(0, a, b, c)); +bret += PRINT_MACRO_RESULTS(F(),f(0)); +bret += PRINT_MACRO_RESULTS(F(EMP),f(0)); +bret += PRINT_MACRO_RESULTS(G(a, b, c),f(0, a, b, c)); +bret += PRINT_MACRO_RESULTS(G(a, ),f(0, a)); +bret += PRINT_MACRO_RESULTS(G(a),f(0, a)); +bret += PRINT_MACRO_RESULTS(SDEF(foo);,S foo;); +bret += PRINT_MACRO_RESULTS(SDEF(bar, 1, 2);,S bar = { 1, 2 };); + +#undef F +#undef G +#undef SDEF +#undef EMP + +#define H2(X, Y, ...) __VA_OPT__(X ## Y,) __VA_ARGS__ +#define H3(X, ...) #__VA_OPT__(X##X X##X) +#define H4(X, ...) __VA_OPT__(a X ## X) ## b +#define H5A(...) __VA_OPT__()/**/__VA_OPT__() +#define H5B(X) a ## X ## b +#define H5C(X) H5B(X) + +// H2(a, b, c, d) + +// replaced by + +// ab, c, d + +// H3(, 0) + +// replaced by + +// "" + +// H4(, 1) + +// replaced by + +// a b + +// H5C(H5A()) + +// replaced by + +// ab + +bret += PRINT_MACRO_RESULTS(H2(a, b, c, d),ab, c, d); +bret += PRINT_MACRO_RESULTS(H3(, 0),""); +bret += PRINT_MACRO_RESULTS(H4(, 1),a b); +bret += PRINT_MACRO_RESULTS(H5C(H5A()),ab); + +#undef H2 +#undef H3 +#undef H4 +#undef H5A +#undef H5B +#undef H5C + + return bret; + +} + +#endif + +int print_macros_common_1() +{ + + int bret = 0; + +#define x 3 +#define f(a) f(x * (a)) +#undef x + +#define x 2 +#define g f +#define z z[0] +#define h g(~ +#define m(a) a(w) +#define w 0,1 +#define t(a) a + +// f(y+1) + f(f(z)) % t(t(g)(0) + t)(1); +// g(x+(3,4)-w) | h 5) & m(f)^m(m); + +// results in + +// f(2 * (y+1)) + f(2 * (f(2 * (z[0])))) % f(2 * (0)) + t(1); +// f(2 * (2+(3,4)-0,1)) | f(2 * ( ~ 5)) & f(2 * (0,1))^m(0,1); + +bret += PRINT_MACRO_RESULTS(f(y+1) + f(f(z)) % t(t(g)(0) + t)(1);,f(2 * (y+1)) + f(2 * (f(2 * (z[0])))) % f(2 * (0)) + t(1);); + +#define PRINT_INPUT g(x+(3,4)-w) | h 5) & m(f)^m(m); + +bret += print_macro + ( + std::string("g(x+(3,4)-w) | h 5) & m(f)^m(m);"), + PRINT_EXPECTED(f(2 * (2+(3,4)-0,1)) | f(2 * ( ~ 5)) & f(2 * (0,1))^m(0,1);), + PRINT_EXPANSION(PRINT_INPUT) + ); + +#undef PRINT_INPUT + +#undef f +#undef x +#undef g +#undef z +#undef h +#undef m +#undef w +#undef t + + return bret; + +} + +int print_macros_common_4() +{ + + int bret = 0; + +#define str(s) # s +#define xstr(s) str(s) +#define debug(s, t) printf("x" # s "= %d, x" # t "= %s", x ## s, x ## t) +#define INCFILE(n) vers ## n +#define glue(a, b) a ## b +#define xglue(a, b) glue(a, b) +#define HIGHLOW "hello" +#define LOW LOW ", world" + +// debug(1, 2); +// fputs(str(strncmp("abc\0d", "abc", ’\4’) // this goes away +// == 0) str(: @\n), s); +// #include xstr(INCFILE(2).h) +// glue(HIGH, LOW); +// xglue(HIGH, LOW) + +// results in + +// printf("x" "1" "= %d, x" "2" "= %s", x1, x2); +// fputs("strncmp(\"abc\\0d\", \"abc\", ’\\4’) == 0" ": @\n", s); +// #include "vers2.h" (after macro replacement, before file access) +// "hello"; +// "hello" ", world" + +bret += PRINT_MACRO_RESULTS(debug(1, 2);,printf("x" "1" "= %d, x" "2" "= %s", x1, x2);); +bret += print_macro + ( + std::string("fputs(str(strncmp(\"abc\\0d\", \"abc\", '\\4') /* this goes away */== 0) str(: @\\n), s);"), + PRINT_EXPECTED(fputs("strncmp(\"abc\\0d\", \"abc\", '\\4') == 0" ": @\n", s);), + PRINT_EXPANSION(fputs(str(strncmp("abc\0d", "abc", '\4') /* this goes away */== 0) str(: @\n), s);) + ); +bret += PRINT_MACRO_RESULTS(xstr(INCFILE(2).h),"vers2.h"); +bret += PRINT_MACRO_RESULTS(glue(HIGH, LOW);,"hello";); + +#if __cplusplus <= 199711L + +bret += print_macro + ( + PRINT_MACRO(xglue(HIGH, LOW)), + std::string("\"hello\" \", world\""), + PRINT_EXPANSION(xglue(HIGH, LOW)) + ); + +#else + +bret += PRINT_MACRO_RESULTS(xglue(HIGH, LOW),"hello" ", world"); + +#endif + +#undef str +#undef xstr +#undef debug +#undef INCFILE +#undef glue +#undef xglue +#undef HIGHLOW +#undef LOW + + return bret; + +} + +int print_macros_common_2() +{ + + int bret = 0; + +#define hash_hash # ## # +#define mkstr(a) # a +#define in_between(a) mkstr(a) +#define join(c, d) in_between(c hash_hash d) + +// char p[] = join(x, y); + +// equivalent to + +// char p[] = "x ## y"; + +bret += PRINT_MACRO_RESULTS(char p[] = join(x, y);,char p[] = "x ## y";); + +#undef hash_hash +#undef mkstr +#undef in_between +#undef join + + return bret; + +} + +#if BOOST_PP_VARIADICS && __cplusplus > 199711L + +int print_macros_common_3() +{ + + int bret = 0; + +#define p() int +#define q(x) x +#define r(x,y) x ## y +#define str(x) # x + +// p() i[q()] = { q(1), r(2,3), r(4,), r(,5), r(,) }; +// char c[2][6] = { str(hello), str() }; + +// results in + +// int i[] = { 1, 23, 4, 5, }; +// char c[2][6] = { "hello", "" }; + +bret += print_macro + ( + PRINT_MACRO(p() i[q()] = { q(1), r(2,3), r(4,), r(,5), r(,) };), + PRINT_EXPECTED(int i[] = { 1, 23, 4, 5, };), + PRINT_EXPANSION(p() i[q()] = { q(1), r(2,3), r(4,), r(,5), r(,) };) + ); +bret += print_macro + ( + PRINT_MACRO(char c[2][6] = { str(hello), str() };), + PRINT_EXPECTED(char c[2][6] = { "hello", "" };), + PRINT_EXPANSION(char c[2][6] = { str(hello), str() };) + ); + +#undef p +#undef q +#undef r +#undef str + +bret += print_macros_common_4(); + +#define t(x,y,z) x ## y ## z + +// int j[] = { t(1,2,3), t(,4,5), t(6,,7), t(8,9,), t(10,,), t(,11,), t(,,12), t(,,) }; + +// results in + +// int j[] = { 123, 45, 67, 89, 10, 11, 12, }; + +bret += print_macro + ( + PRINT_MACRO(int j[] = { t(1,2,3), t(,4,5), t(6,,7), t(8,9,), t(10,,), t(,11,), t(,,12), t(,,) };), + PRINT_EXPECTED(int j[] = { 123, 45, 67, 89, 10, 11, 12, };), + PRINT_EXPANSION(int j[] = { t(1,2,3), t(,4,5), t(6,,7), t(8,9,), t(10,,), t(,11,), t(,,12), t(,,) };) + ); + +#undef t + +#define debug(...) fprintf(stderr, __VA_ARGS__) +#define showlist(...) puts(#__VA_ARGS__) +#define report(test, ...) ((test) ? puts(#test) : printf(__VA_ARGS__)) + +// debug("Flag"); +// debug("X = %d\n", x); +// showlist(The first, second, and third items.); +// report(x>y, "x is %d but y is %d", x, y); + +// results in + +// fprintf(stderr, "Flag"); +// fprintf(stderr, "X = %d\n", x); +// puts("The first, second, and third items."); +// ((x>y) ? puts("x>y") : printf("x is %d but y is %d", x, y)); + +#define save_stderr stderr +#undef stderr + +bret += PRINT_MACRO_RESULTS(debug("Flag");,fprintf(stderr, "Flag");); +bret += PRINT_MACRO_RESULTS(debug("X = %d\n", x);,fprintf(stderr, "X = %d\n", x);); + +#define stderr save_stderr + +bret += PRINT_MACRO_RESULTS(showlist(The first, second, and third items.);,puts("The first, second, and third items.");); +bret += PRINT_MACRO_RESULTS(report(x>y, "x is %d but y is %d", x, y);,((x>y) ? puts("x>y") : printf("x is %d but y is %d", x, y));); + +#undef debug +#undef showlist +#undef report + + return bret; + +} + +#endif + +int print_macros() +{ + int bret = 0; + + print_separator(); + + std::cout << "__cplusplus = " << __cplusplus; + + print_separator(); + +#define OBJ_LIKE (1-1) +#define OBJ_LIKE /* white space */ (1-1) /* other */ +#define FTN_LIKE(a) ( a ) +#define FTN_LIKE( a )( /* note the white space */ a /* other stuff on this line */ ) + +#if !BOOST_PP_VARIADICS + +bret += print_macros_common_1(); +bret += print_macros_common_4(); + +#elif __cplusplus <= 199711L + +bret += print_macros_common_2(); +bret += print_macros_common_1(); +bret += print_macros_common_4(); + +#elif __cplusplus <= 201703L + +bret += print_macros_common_2(); +bret += print_macros_common_1(); +bret += print_macros_common_3(); + +#else + +bret += print_macros_common_c20(); +bret += print_macros_common_2(); +bret += print_macros_common_1(); +bret += print_macros_common_3(); + +#endif + + print_separator(); + + return bret; +} + +int main() +{ + return (print_macros()); +} diff --git a/src/boost/libs/preprocessor/test/debug.c b/src/boost/libs/preprocessor/test/debug.c new file mode 100644 index 000000000..7325e336d --- /dev/null +++ b/src/boost/libs/preprocessor/test/debug.c @@ -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/debug.cxx> diff --git a/src/boost/libs/preprocessor/test/debug.cpp b/src/boost/libs/preprocessor/test/debug.cpp new file mode 100644 index 000000000..7325e336d --- /dev/null +++ b/src/boost/libs/preprocessor/test/debug.cpp @@ -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/debug.cxx> diff --git a/src/boost/libs/preprocessor/test/debug.cxx b/src/boost/libs/preprocessor/test/debug.cxx new file mode 100644 index 000000000..6c4c5fa74 --- /dev/null +++ b/src/boost/libs/preprocessor/test/debug.cxx @@ -0,0 +1,21 @@ +# /* ************************************************************************** +# * * +# * (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 <boost/preprocessor/debug.hpp> +# include <libs/preprocessor/test/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 diff --git a/src/boost/libs/preprocessor/test/facilities.c b/src/boost/libs/preprocessor/test/facilities.c new file mode 100644 index 000000000..25cef0884 --- /dev/null +++ b/src/boost/libs/preprocessor/test/facilities.c @@ -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/facilities.cxx> diff --git a/src/boost/libs/preprocessor/test/facilities.cpp b/src/boost/libs/preprocessor/test/facilities.cpp new file mode 100644 index 000000000..25cef0884 --- /dev/null +++ b/src/boost/libs/preprocessor/test/facilities.cpp @@ -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/facilities.cxx> diff --git a/src/boost/libs/preprocessor/test/facilities.cxx b/src/boost/libs/preprocessor/test/facilities.cxx new file mode 100644 index 000000000..772c2cfbf --- /dev/null +++ b/src/boost/libs/preprocessor/test/facilities.cxx @@ -0,0 +1,55 @@ +# /* ************************************************************************** +# * * +# * (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 <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 +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_IDENTITY_N(36,10)(0,1,2,3,4,5,6,7,8,9) == 36 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 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 diff --git a/src/boost/libs/preprocessor/test/isempty.c b/src/boost/libs/preprocessor/test/isempty.c new file mode 100644 index 000000000..bd4c2c6a5 --- /dev/null +++ b/src/boost/libs/preprocessor/test/isempty.c @@ -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> diff --git a/src/boost/libs/preprocessor/test/isempty.cpp b/src/boost/libs/preprocessor/test/isempty.cpp new file mode 100644 index 000000000..bd4c2c6a5 --- /dev/null +++ b/src/boost/libs/preprocessor/test/isempty.cpp @@ -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> diff --git a/src/boost/libs/preprocessor/test/isempty.cxx b/src/boost/libs/preprocessor/test/isempty.cxx new file mode 100644 index 000000000..f83fe7bf3 --- /dev/null +++ b/src/boost/libs/preprocessor/test/isempty.cxx @@ -0,0 +1,158 @@ +# /* ************************************************************************** +# * * +# * (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/config/config.hpp> +# +#if (BOOST_PP_CONFIG_FLAGS() & BOOST_PP_CONFIG_STRICT()) || (BOOST_PP_CONFIG_FLAGS() & BOOST_PP_CONFIG_MSVC()) + +# include <boost/preprocessor/facilities/empty.hpp> +# include <boost/preprocessor/facilities/is_empty.hpp> +# include <libs/preprocessor/test/test.h> + +#define DATA +#define OBJECT OBJECT2 +#define OBJECT2 +#define FUNC(x) FUNC2(x) +#define FUNC2(x) +#define FUNC_GEN() () +#define FUNC_GEN2(x) () +#define FUNC_GEN3() (&) +#define FUNC_GEN4(x) (y) +#define FUNC_GEN5() (y,z) +#define FUNC_GEN6() anything +#define FUNC_GEN7(x) anything +#define FUNC_GEN8(x,y) (1,2,3) +#define FUNC_GEN9(x,y,z) anything +#define FUNC_GEN10(x) (y) data +#define NAME &name +#define ATUPLE (atuple) +#define ATUPLE_PLUS (atuple) data + +#if BOOST_PP_VARIADICS + +# include <boost/preprocessor/variadic/has_opt.hpp> + +#if defined(__cplusplus) && __cplusplus > 201703L && BOOST_PP_VARIADIC_HAS_OPT() + +BEGIN BOOST_PP_IS_EMPTY(FUNC_GEN) == 0 END +BEGIN BOOST_PP_IS_EMPTY(FUNC_GEN2) == 0 END +BEGIN BOOST_PP_IS_EMPTY(FUNC_GEN3) == 0 END +BEGIN BOOST_PP_IS_EMPTY(FUNC_GEN4) == 0 END +BEGIN BOOST_PP_IS_EMPTY(FUNC_GEN5) == 0 END +BEGIN BOOST_PP_IS_EMPTY(FUNC_GEN8) == 0 END +BEGIN BOOST_PP_IS_EMPTY(FUNC_GEN9) == 0 END +BEGIN BOOST_PP_IS_EMPTY(FUNC_GEN10) == 0 END + +#elif BOOST_PP_VARIADICS_MSVC /* Testing the VC++ variadic version */ + +/* INCORRECT */ + +BEGIN BOOST_PP_IS_EMPTY(FUNC_GEN) == 1 END +BEGIN BOOST_PP_IS_EMPTY(FUNC_GEN2) == 1 END +BEGIN BOOST_PP_IS_EMPTY(FUNC_GEN3) == 1 END +BEGIN BOOST_PP_IS_EMPTY(FUNC_GEN4) == 1 END +BEGIN BOOST_PP_IS_EMPTY(FUNC_GEN5) == 1 END +BEGIN BOOST_PP_IS_EMPTY(FUNC_GEN8) == 1 END +BEGIN BOOST_PP_IS_EMPTY(FUNC_GEN10) == 1 END + +/* CORRECT */ + +BEGIN BOOST_PP_IS_EMPTY(FUNC_GEN9) == 0 END + +#else /* Testing the non-VC++ variadic version */ + +/* CORRECT */ + +BEGIN BOOST_PP_IS_EMPTY(FUNC_GEN) == 0 END +BEGIN BOOST_PP_IS_EMPTY(FUNC_GEN2) == 0 END +BEGIN BOOST_PP_IS_EMPTY(FUNC_GEN3) == 0 END +BEGIN BOOST_PP_IS_EMPTY(FUNC_GEN4) == 0 END +BEGIN BOOST_PP_IS_EMPTY(FUNC_GEN5) == 0 END +BEGIN BOOST_PP_IS_EMPTY(FUNC_GEN10) == 0 END + +/* COMPILER ERROR */ + +// BEGIN BOOST_PP_IS_EMPTY(FUNC_GEN8) == 0 END +// BEGIN BOOST_PP_IS_EMPTY(FUNC_GEN9) == 0 END + +#endif + +/* Testing the variadic version */ + +/* CORRECT */ + +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_GEN6) == 0 END +BEGIN BOOST_PP_IS_EMPTY(FUNC_GEN7) == 0 END +BEGIN BOOST_PP_IS_EMPTY(NAME) == 0 END +BEGIN BOOST_PP_IS_EMPTY(ATUPLE) == 0 END +BEGIN BOOST_PP_IS_EMPTY(ATUPLE_PLUS) == 0 END + +#else + +#if BOOST_PP_CONFIG_FLAGS() & BOOST_PP_CONFIG_MSVC() /* Testing the VC++ non-variadic version */ + +/* INCORRECT */ + +BEGIN BOOST_PP_IS_EMPTY(FUNC_GEN) == 1 END +BEGIN BOOST_PP_IS_EMPTY(FUNC_GEN2) == 1 END +BEGIN BOOST_PP_IS_EMPTY(FUNC_GEN3) == 1 END +BEGIN BOOST_PP_IS_EMPTY(FUNC_GEN4) == 1 END +BEGIN BOOST_PP_IS_EMPTY(FUNC_GEN5) == 1 END +BEGIN BOOST_PP_IS_EMPTY(FUNC_GEN8) == 1 END +BEGIN BOOST_PP_IS_EMPTY(ATUPLE) == 1 END +BEGIN BOOST_PP_IS_EMPTY(FUNC_GEN10) == 1 END +BEGIN BOOST_PP_IS_EMPTY(ATUPLE_PLUS) == 1 END + +/* CORRECT */ + +BEGIN BOOST_PP_IS_EMPTY(NAME) == 0 END + +#else /* Testing the non-VC++ non-variadic version */ + +/* CORRECT */ + +BEGIN BOOST_PP_IS_EMPTY(FUNC_GEN) == 0 END +BEGIN BOOST_PP_IS_EMPTY(FUNC_GEN2) == 0 END +BEGIN BOOST_PP_IS_EMPTY(FUNC_GEN3) == 0 END +BEGIN BOOST_PP_IS_EMPTY(FUNC_GEN4) == 0 END +BEGIN BOOST_PP_IS_EMPTY(FUNC_GEN5) == 0 END +BEGIN BOOST_PP_IS_EMPTY(FUNC_GEN8) == 0 END +BEGIN BOOST_PP_IS_EMPTY(FUNC_GEN10) == 0 END + +/* UNDEFINED BEHAVIOR */ + +// BEGIN BOOST_PP_IS_EMPTY(ATUPLE) == 0 END +// BEGIN BOOST_PP_IS_EMPTY(ATUPLE_PLUS) == 1 END +// BEGIN BOOST_PP_IS_EMPTY(NAME) == 0 END + +#endif + +/* Testing the non-variadic version */ + +/* CORRECT */ + +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_GEN6) == 0 END +BEGIN BOOST_PP_IS_EMPTY(FUNC_GEN7) == 0 END +BEGIN BOOST_PP_IS_EMPTY(FUNC_GEN9) == 0 END + +#endif + +#endif diff --git a/src/boost/libs/preprocessor/test/isempty_variadic_standard_failure.c b/src/boost/libs/preprocessor/test/isempty_variadic_standard_failure.c new file mode 100644 index 000000000..36f6ff7eb --- /dev/null +++ b/src/boost/libs/preprocessor/test/isempty_variadic_standard_failure.c @@ -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_variadic_standard_failure.cxx> diff --git a/src/boost/libs/preprocessor/test/isempty_variadic_standard_failure.cpp b/src/boost/libs/preprocessor/test/isempty_variadic_standard_failure.cpp new file mode 100644 index 000000000..36f6ff7eb --- /dev/null +++ b/src/boost/libs/preprocessor/test/isempty_variadic_standard_failure.cpp @@ -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_variadic_standard_failure.cxx> diff --git a/src/boost/libs/preprocessor/test/isempty_variadic_standard_failure.cxx b/src/boost/libs/preprocessor/test/isempty_variadic_standard_failure.cxx new file mode 100644 index 000000000..5c7b03d8a --- /dev/null +++ b/src/boost/libs/preprocessor/test/isempty_variadic_standard_failure.cxx @@ -0,0 +1,35 @@ +# /* ************************************************************************** +# * * +# * (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/is_empty.hpp> +# include <libs/preprocessor/test/test.h> + +#if BOOST_PP_VARIADICS && (BOOST_PP_CONFIG_FLAGS() & BOOST_PP_CONFIG_STRICT()) && !BOOST_PP_VARIADICS_MSVC + +#define FUNC_GEN8(x,y) (1,2,3) + +#if defined(__cplusplus) && __cplusplus > 201703L + +# include <boost/preprocessor/variadic/has_opt.hpp> + +BEGIN BOOST_PP_IS_EMPTY(FUNC_GEN8) == BOOST_PP_VARIADIC_HAS_OPT() END + +#else + +BEGIN BOOST_PP_IS_EMPTY(FUNC_GEN8) == 0 END + +#endif + +#else + +BEGIN 1 == 0 END + +#endif diff --git a/src/boost/libs/preprocessor/test/isempty_variadic_standard_failure2.c b/src/boost/libs/preprocessor/test/isempty_variadic_standard_failure2.c new file mode 100644 index 000000000..a2aa690b8 --- /dev/null +++ b/src/boost/libs/preprocessor/test/isempty_variadic_standard_failure2.c @@ -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_variadic_standard_failure2.cxx> diff --git a/src/boost/libs/preprocessor/test/isempty_variadic_standard_failure2.cpp b/src/boost/libs/preprocessor/test/isempty_variadic_standard_failure2.cpp new file mode 100644 index 000000000..a2aa690b8 --- /dev/null +++ b/src/boost/libs/preprocessor/test/isempty_variadic_standard_failure2.cpp @@ -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_variadic_standard_failure2.cxx> diff --git a/src/boost/libs/preprocessor/test/isempty_variadic_standard_failure2.cxx b/src/boost/libs/preprocessor/test/isempty_variadic_standard_failure2.cxx new file mode 100644 index 000000000..7c9d1addf --- /dev/null +++ b/src/boost/libs/preprocessor/test/isempty_variadic_standard_failure2.cxx @@ -0,0 +1,35 @@ +# /* ************************************************************************** +# * * +# * (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/is_empty.hpp> +# include <libs/preprocessor/test/test.h> + +#if BOOST_PP_VARIADICS && (BOOST_PP_CONFIG_FLAGS() & BOOST_PP_CONFIG_STRICT()) && !BOOST_PP_VARIADICS_MSVC + +#define FUNC_GEN9(x,y,z) anything + +#if defined(__cplusplus) && __cplusplus > 201703L + +# include <boost/preprocessor/variadic/has_opt.hpp> + +BEGIN BOOST_PP_IS_EMPTY(FUNC_GEN9) == BOOST_PP_VARIADIC_HAS_OPT() END + +#else + +BEGIN BOOST_PP_IS_EMPTY(FUNC_GEN9) == 0 END + +#endif + +#else + +BEGIN 1 == 0 END + +#endif diff --git a/src/boost/libs/preprocessor/test/iteration.cpp b/src/boost/libs/preprocessor/test/iteration.cpp new file mode 100644 index 000000000..35494efe1 --- /dev/null +++ b/src/boost/libs/preprocessor/test/iteration.cpp @@ -0,0 +1,33 @@ +# /* ************************************************************************** +# * * +# * (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. */ +# +# if !BOOST_PP_IS_SELFISH +# +# include <libs/preprocessor/test/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/test/iteration.cpp> +# include BOOST_PP_INCLUDE_SELF() +# +# else + +BEGIN BOOST_PP_IS_SELFISH == 1 END + +# endif diff --git a/src/boost/libs/preprocessor/test/iteration.h b/src/boost/libs/preprocessor/test/iteration.h new file mode 100644 index 000000000..97e676b20 --- /dev/null +++ b/src/boost/libs/preprocessor/test/iteration.h @@ -0,0 +1,62 @@ +# /* ************************************************************************** +# * * +# * (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. */ +# +# if !BOOST_PP_IS_ITERATING +# +# include <boost/preprocessor/cat.hpp> +# include <boost/preprocessor/iteration.hpp> +# include <libs/preprocessor/test/test.h> +# +# define NO_FLAGS +# +# define BOOST_PP_ITERATION_PARAMS_1 (3, (1, 10, <libs/preprocessor/test/iteration.h>)) +# include BOOST_PP_ITERATE() +# +# undef NO_FLAGS +# +# define BOOST_PP_ITERATION_PARAMS_1 (4, (1, 5, <libs/preprocessor/test/iteration.h>, 0x0001)) +# include BOOST_PP_ITERATE() +# +# define BOOST_PP_ITERATION_PARAMS_1 (4, (1, 5, <libs/preprocessor/test/iteration.h>, 0x0002)) +# include BOOST_PP_ITERATE() +# +# else +# if 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/test/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 should not get here! +# +# endif +# endif diff --git a/src/boost/libs/preprocessor/test/list.c b/src/boost/libs/preprocessor/test/list.c new file mode 100644 index 000000000..23bb7b18b --- /dev/null +++ b/src/boost/libs/preprocessor/test/list.c @@ -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/list.cxx> diff --git a/src/boost/libs/preprocessor/test/list.cpp b/src/boost/libs/preprocessor/test/list.cpp new file mode 100644 index 000000000..23bb7b18b --- /dev/null +++ b/src/boost/libs/preprocessor/test/list.cpp @@ -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/list.cxx> diff --git a/src/boost/libs/preprocessor/test/list.cxx b/src/boost/libs/preprocessor/test/list.cxx new file mode 100644 index 000000000..7c99d70b1 --- /dev/null +++ b/src/boost/libs/preprocessor/test/list.cxx @@ -0,0 +1,91 @@ +# /* ************************************************************************** +# * * +# * (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 <boost/preprocessor/arithmetic/add.hpp> +# include <boost/preprocessor/arithmetic/sub.hpp> +# include <boost/preprocessor/comparison/equal.hpp> +# include <boost/preprocessor/comparison/less.hpp> +# include <boost/preprocessor/control/iif.hpp> +# include <boost/preprocessor/facilities/is_empty.hpp> +# include <boost/preprocessor/list.hpp> +# include <boost/preprocessor/tuple/elem.hpp> +# include <boost/preprocessor/tuple/size.hpp> +# include <boost/preprocessor/array/elem.hpp> +# include <boost/preprocessor/array/size.hpp> +# include <boost/preprocessor/seq/elem.hpp> +# include <boost/preprocessor/seq/size.hpp> +# include <boost/preprocessor/variadic/elem.hpp> +# include <libs/preprocessor/test/test.h> + +# define LISTNIL BOOST_PP_NIL +# define LIST (4, (1, (5, (2, BOOST_PP_NIL)))) +# define REVERSAL(d, x, y) BOOST_PP_SUB_D(d, y, x) +# define F1(r, state, x) + x + state +# define FI2(r, state, i, x) BOOST_PP_IIF(BOOST_PP_EQUAL(i,1),+ x + x + state,+ x + state) +# define F2(r, x) + BOOST_PP_TUPLE_ELEM(2, 0, x) + 2 - BOOST_PP_TUPLE_ELEM(2, 1, x) +# 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_FIRST(LIST) == 4 END +BEGIN BOOST_PP_LIST_IS_CONS(LIST) == 1 END +BEGIN BOOST_PP_LIST_IS_CONS(LISTNIL) == 0 END +BEGIN BOOST_PP_LIST_IS_NIL(LIST) == 0 END +BEGIN BOOST_PP_LIST_IS_NIL(LISTNIL) == 1 END + +#if BOOST_PP_VARIADICS + +BEGIN BOOST_PP_VARIADIC_ELEM(2,BOOST_PP_LIST_ENUM(LIST)) == 5 END + +#endif + +BEGIN BOOST_PP_LIST_FOLD_LEFT(BOOST_PP_SUB_D, 22, LIST) == 10 END +BEGIN BOOST_PP_LIST_FOLD_LEFT(BOOST_PP_SUB_D, 22, LISTNIL) == 22 END +BEGIN BOOST_PP_LIST_FOLD_RIGHT(BOOST_PP_ADD_D, 0, LIST) == 12 END +BEGIN BOOST_PP_LIST_FOLD_RIGHT(BOOST_PP_ADD_D, 0, LISTNIL) == 0 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_IS_NIL(BOOST_PP_LIST_REVERSE(LISTNIL)) == 1 END + +BEGIN BOOST_PP_LIST_CAT(BOOST_PP_LIST_REST_N(2, LIST)) == 52 END +BEGIN BOOST_PP_LIST_IS_NIL(BOOST_PP_LIST_REST_N(0, LISTNIL)) == 1 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_SIZE(LISTNIL) == 0 END + +BEGIN BOOST_PP_LIST_CAT(BOOST_PP_LIST_TRANSFORM(BOOST_PP_ADD_D, 2, LIST)) == 6374 END +BEGIN BOOST_PP_LIST_IS_NIL(BOOST_PP_LIST_TRANSFORM(BOOST_PP_ADD_D, 2, LISTNIL)) == 1 END +BEGIN BOOST_PP_LIST_CAT(BOOST_PP_LIST_APPEND(BOOST_PP_LIST_REST(LIST), LIST)) == 1524152 END +BEGIN BOOST_PP_LIST_CAT(BOOST_PP_LIST_APPEND(LIST,LISTNIL)) == 4152 END +BEGIN BOOST_PP_LIST_CAT(BOOST_PP_LIST_APPEND(LISTNIL,LIST)) == 4152 END +BEGIN BOOST_PP_LIST_IS_NIL(BOOST_PP_LIST_APPEND(LISTNIL,LISTNIL)) == 1 END + +BEGIN BOOST_PP_LIST_FOR_EACH(F1, 1, LIST) == 16 END +BEGIN BOOST_PP_LIST_FOR_EACH_I(FI2, 1, LIST) == 17 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 +BEGIN BOOST_PP_LIST_IS_NIL(BOOST_PP_LIST_FILTER(BOOST_PP_LESS_D, 3, LISTNIL)) == 1 END + +BEGIN BOOST_PP_LIST_FOR_EACH_PRODUCT(F2, 2, ( (1, (0, BOOST_PP_NIL)), (2, (3, BOOST_PP_NIL)) )) == 0 END + +BEGIN BOOST_PP_LIST_CAT(BOOST_PP_LIST_FOLD_LEFT(BOOST_PP_LIST_APPEND_D, BOOST_PP_NIL, LL)) == 0x0a1b2c3d END + +BEGIN BOOST_PP_ARRAY_ELEM(2, BOOST_PP_LIST_TO_ARRAY(LIST)) == 5 END +BEGIN BOOST_PP_ARRAY_SIZE(BOOST_PP_LIST_TO_ARRAY(LISTNIL)) == 0 END +BEGIN BOOST_PP_SEQ_ELEM(3, BOOST_PP_LIST_TO_SEQ(LIST)) == 2 END diff --git a/src/boost/libs/preprocessor/test/logical.c b/src/boost/libs/preprocessor/test/logical.c new file mode 100644 index 000000000..9f5028708 --- /dev/null +++ b/src/boost/libs/preprocessor/test/logical.c @@ -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/logical.cxx> diff --git a/src/boost/libs/preprocessor/test/logical.cpp b/src/boost/libs/preprocessor/test/logical.cpp new file mode 100644 index 000000000..9f5028708 --- /dev/null +++ b/src/boost/libs/preprocessor/test/logical.cpp @@ -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/logical.cxx> diff --git a/src/boost/libs/preprocessor/test/logical.cxx b/src/boost/libs/preprocessor/test/logical.cxx new file mode 100644 index 000000000..30bde7b69 --- /dev/null +++ b/src/boost/libs/preprocessor/test/logical.cxx @@ -0,0 +1,59 @@ +# /* ************************************************************************** +# * * +# * (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 <boost/preprocessor/logical.hpp> +# include <libs/preprocessor/test/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 + +BEGIN BOOST_PP_BOOL(22) == 1 END +BEGIN BOOST_PP_BOOL(0) == 0 END + +BEGIN BOOST_PP_BITAND(0, 0) == 0 END +BEGIN BOOST_PP_BITAND(0, 1) == 0 END +BEGIN BOOST_PP_BITAND(1, 0) == 0 END +BEGIN BOOST_PP_BITAND(1, 1) == 1 END + +BEGIN BOOST_PP_BITNOR(0, 0) == 1 END +BEGIN BOOST_PP_BITNOR(0, 1) == 0 END +BEGIN BOOST_PP_BITNOR(1, 0) == 0 END +BEGIN BOOST_PP_BITNOR(1, 1) == 0 END + +BEGIN BOOST_PP_BITOR(0, 0) == 0 END +BEGIN BOOST_PP_BITOR(0, 1) == 1 END +BEGIN BOOST_PP_BITOR(1, 0) == 1 END +BEGIN BOOST_PP_BITOR(1, 1) == 1 END + +BEGIN BOOST_PP_BITXOR(0, 0) == 0 END +BEGIN BOOST_PP_BITXOR(0, 1) == 1 END +BEGIN BOOST_PP_BITXOR(1, 0) == 1 END +BEGIN BOOST_PP_BITXOR(1, 1) == 0 END diff --git a/src/boost/libs/preprocessor/test/punctuation.c b/src/boost/libs/preprocessor/test/punctuation.c new file mode 100644 index 000000000..8fc5dfc3c --- /dev/null +++ b/src/boost/libs/preprocessor/test/punctuation.c @@ -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> diff --git a/src/boost/libs/preprocessor/test/punctuation.cpp b/src/boost/libs/preprocessor/test/punctuation.cpp new file mode 100644 index 000000000..8fc5dfc3c --- /dev/null +++ b/src/boost/libs/preprocessor/test/punctuation.cpp @@ -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> diff --git a/src/boost/libs/preprocessor/test/punctuation.cxx b/src/boost/libs/preprocessor/test/punctuation.cxx new file mode 100644 index 000000000..8e60e9a60 --- /dev/null +++ b/src/boost/libs/preprocessor/test/punctuation.cxx @@ -0,0 +1,54 @@ +# /* ************************************************************************** +# * * +# * (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))) +# define DATA (5 + 3) * 4 +# define DATA2 4 * (5 + 3) +# define DATA3 4 * (5 + 3) * (2 + 1) +# define DATA4 (5 + 3) * (2 + 1) * 4 + + +// 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 + +// remove_parens + +BEGIN BOOST_PP_REMOVE_PARENS(DATA) == 17 END +BEGIN BOOST_PP_REMOVE_PARENS(DATA2)== 32 END +BEGIN BOOST_PP_REMOVE_PARENS(DATA3)== 96 END +BEGIN BOOST_PP_REMOVE_PARENS(DATA4)== 41 END + +#endif diff --git a/src/boost/libs/preprocessor/test/quick.cpp b/src/boost/libs/preprocessor/test/quick.cpp new file mode 100644 index 000000000..73372a3cc --- /dev/null +++ b/src/boost/libs/preprocessor/test/quick.cpp @@ -0,0 +1,43 @@ +// Copyright 2002 Paul Mensonides +// Copyright 2019 Peter Dimov +// Distributed under the Boost Software License, Version 1.0. +// https://www.boost.org/LICENSE_1_0.txt + +#include <boost/preprocessor/comparison.hpp> +#include "test_macro.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 + +int main() +{ +} diff --git a/src/boost/libs/preprocessor/test/repetition.cpp b/src/boost/libs/preprocessor/test/repetition.cpp new file mode 100644 index 000000000..9c5fe9b0f --- /dev/null +++ b/src/boost/libs/preprocessor/test/repetition.cpp @@ -0,0 +1,50 @@ +# /* ************************************************************************** +# * * +# * (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 <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/test/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; diff --git a/src/boost/libs/preprocessor/test/selection.c b/src/boost/libs/preprocessor/test/selection.c new file mode 100644 index 000000000..f8fdaba6d --- /dev/null +++ b/src/boost/libs/preprocessor/test/selection.c @@ -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/selection.cxx> diff --git a/src/boost/libs/preprocessor/test/selection.cpp b/src/boost/libs/preprocessor/test/selection.cpp new file mode 100644 index 000000000..f8fdaba6d --- /dev/null +++ b/src/boost/libs/preprocessor/test/selection.cpp @@ -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/selection.cxx> diff --git a/src/boost/libs/preprocessor/test/selection.cxx b/src/boost/libs/preprocessor/test/selection.cxx new file mode 100644 index 000000000..b52893492 --- /dev/null +++ b/src/boost/libs/preprocessor/test/selection.cxx @@ -0,0 +1,21 @@ +# /* ************************************************************************** +# * * +# * (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 <boost/preprocessor/selection.hpp> +# include <libs/preprocessor/test/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 diff --git a/src/boost/libs/preprocessor/test/seq.c b/src/boost/libs/preprocessor/test/seq.c new file mode 100644 index 000000000..e36c5d142 --- /dev/null +++ b/src/boost/libs/preprocessor/test/seq.c @@ -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/seq.cxx> diff --git a/src/boost/libs/preprocessor/test/seq.cpp b/src/boost/libs/preprocessor/test/seq.cpp new file mode 100644 index 000000000..e36c5d142 --- /dev/null +++ b/src/boost/libs/preprocessor/test/seq.cpp @@ -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/seq.cxx> diff --git a/src/boost/libs/preprocessor/test/seq.cxx b/src/boost/libs/preprocessor/test/seq.cxx new file mode 100644 index 000000000..88b2208ac --- /dev/null +++ b/src/boost/libs/preprocessor/test/seq.cxx @@ -0,0 +1,222 @@ +# /* ************************************************************************** +# * * +# * (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 <boost/preprocessor/arithmetic/add.hpp> +# include <boost/preprocessor/arithmetic/mod.hpp> +# include <boost/preprocessor/arithmetic/sub.hpp> +# include <boost/preprocessor/cat.hpp> +# include <boost/preprocessor/comparison/equal.hpp> +# include <boost/preprocessor/comparison/less.hpp> +# include <boost/preprocessor/control/iif.hpp> +# include <boost/preprocessor/facilities/is_empty.hpp> +# include <boost/preprocessor/logical/not.hpp> +# include <boost/preprocessor/seq.hpp> +# include <boost/preprocessor/array/elem.hpp> +# include <boost/preprocessor/array/size.hpp> +# include <boost/preprocessor/tuple/elem.hpp> +# include <boost/preprocessor/tuple/size.hpp> +# include <boost/preprocessor/list/at.hpp> +# include <boost/preprocessor/list/size.hpp> +# include <boost/preprocessor/variadic/elem.hpp> +# include <boost/preprocessor/variadic/size.hpp> +# include <libs/preprocessor/test/test.h> + +# define SEQ_NONE () +# define SEQ (4)(1)(5)(2) + +# define SEQ_100 \ + (1)(2)(3)(4)(5)(6)(7)(8)(9) \ + (10)(11)(12)(13)(14)(15)(16)(17)(18)(19) \ + (20)(21)(22)(23)(24)(25)(26)(27)(28)(29) \ + (30)(31)(32)(33)(34)(35)(36)(37)(38)(39) \ + (40)(41)(42)(43)(44)(45)(46)(47)(48)(49) \ + (50)(51)(52)(53)(54)(55)(56)(57)(58)(59) \ + (60)(61)(62)(63)(64)(65)(66)(67)(68)(69) \ + (70)(71)(72)(73)(74)(75)(76)(77)(78)(79) \ + (80)(81)(82)(83)(84)(85)(86)(87)(88)(89) \ + (90)(91)(92)(93)(94)(95)(96)(97)(98)(99) \ + (100) + +# define SEQ_255 \ + (1)(2)(3)(4)(5)(6)(7)(8)(9) \ + (10)(11)(12)(13)(14)(15)(16)(17)(18)(19) \ + (20)(21)(22)(23)(24)(25)(26)(27)(28)(29) \ + (30)(31)(32)(33)(34)(35)(36)(37)(38)(39) \ + (40)(41)(42)(43)(44)(45)(46)(47)(48)(49) \ + (50)(51)(52)(53)(54)(55)(56)(57)(58)(59) \ + (60)(61)(62)(63)(64)(65)(66)(67)(68)(69) \ + (70)(71)(72)(73)(74)(75)(76)(77)(78)(79) \ + (80)(81)(82)(83)(84)(85)(86)(87)(88)(89) \ + (90)(91)(92)(93)(94)(95)(96)(97)(98)(99) \ + (100)(101)(102)(103)(104)(105)(106)(107)(108)(109) \ + (110)(111)(112)(113)(114)(115)(116)(117)(118)(119) \ + (120)(121)(122)(123)(124)(125)(126)(127)(128)(129) \ + (130)(131)(132)(133)(134)(135)(136)(137)(138)(139) \ + (140)(141)(142)(143)(144)(145)(146)(147)(148)(149) \ + (150)(151)(152)(153)(154)(155)(156)(157)(158)(159) \ + (160)(161)(162)(163)(164)(165)(166)(167)(168)(169) \ + (170)(171)(172)(173)(174)(175)(176)(177)(178)(179) \ + (180)(181)(182)(183)(184)(185)(186)(187)(188)(189) \ + (190)(191)(192)(193)(194)(195)(196)(197)(198)(199) \ + (200)(201)(202)(203)(204)(205)(206)(207)(208)(209) \ + (210)(211)(212)(213)(214)(215)(216)(217)(218)(219) \ + (220)(221)(222)(223)(224)(225)(226)(227)(228)(229) \ + (230)(231)(232)(233)(234)(235)(236)(237)(238)(239) \ + (240)(241)(242)(243)(244)(245)(246)(247)(248)(249) \ + (250)(251)(252)(253)(254)(255) + +# define SEQ_256 SEQ_255(256) + +# define SEQVAR (4,5,8,3,61)(1,0)(5,22,43)(2)(17,45,33) + +# define REVERSAL(s, x, y) BOOST_PP_SUB(y, x) +# define SUB_S(s, x, y) BOOST_PP_SUB(x, y) +# define ADD_S(s, x, y) BOOST_PP_ADD(x, y) +# define CAT_S(s, x, y) BOOST_PP_CAT(x, BOOST_PP_IS_EMPTY(y)) + +BEGIN BOOST_PP_IS_EMPTY(BOOST_PP_SEQ_HEAD(SEQ_NONE)) == 1 END +BEGIN BOOST_PP_SEQ_HEAD(SEQ) == 4 END +BEGIN BOOST_PP_SEQ_HEAD(SEQ_255) == 1 END +BEGIN BOOST_PP_SEQ_HEAD(SEQ_256) == 1 END + +BEGIN BOOST_PP_SEQ_FOLD_LEFT(CAT_S, 1, SEQ_NONE) == 11 END +BEGIN BOOST_PP_SEQ_FOLD_LEFT(SUB_S, 22, SEQ) == 10 END +BEGIN BOOST_PP_SEQ_FOLD_RIGHT(CAT_S, 2, SEQ_NONE) == 21 END +BEGIN BOOST_PP_SEQ_FOLD_RIGHT(ADD_S, 0, SEQ) == 12 END +BEGIN BOOST_PP_SEQ_FOLD_RIGHT(REVERSAL, 0, SEQ) == 4 END + +BEGIN BOOST_PP_IS_EMPTY(BOOST_PP_SEQ_CAT(BOOST_PP_SEQ_REVERSE(SEQ_NONE))) == 1 END +BEGIN BOOST_PP_SEQ_CAT(BOOST_PP_SEQ_REVERSE(SEQ)) == 2514 END + +BEGIN BOOST_PP_SEQ_CAT(BOOST_PP_SEQ_REST_N(2, SEQ)) == 52 END +BEGIN BOOST_PP_SEQ_CAT(BOOST_PP_SEQ_REST_N(99, SEQ_100)) == 100 END +BEGIN BOOST_PP_SEQ_CAT(BOOST_PP_SEQ_REST_N(255, SEQ_256)) == 256 END +BEGIN BOOST_PP_IS_EMPTY(BOOST_PP_SEQ_CAT(BOOST_PP_SEQ_FIRST_N(1, SEQ_NONE))) == 1 END +BEGIN BOOST_PP_SEQ_CAT(BOOST_PP_SEQ_FIRST_N(2, SEQ)) == 41 END +BEGIN BOOST_PP_SEQ_ELEM(50,BOOST_PP_SEQ_FIRST_N(100, SEQ_100)) == 51 END +BEGIN BOOST_PP_SEQ_ELEM(100,BOOST_PP_SEQ_FIRST_N(255, SEQ_255)) == 101 END +BEGIN BOOST_PP_SEQ_ELEM(200,BOOST_PP_SEQ_FIRST_N(256, SEQ_256)) == 201 END + +BEGIN BOOST_PP_IS_EMPTY(BOOST_PP_SEQ_ELEM(0, SEQ_NONE)) == 1 END +BEGIN BOOST_PP_SEQ_SIZE(SEQ_NONE) == 1 END +BEGIN BOOST_PP_SEQ_ELEM(2, SEQ) == 5 END +BEGIN BOOST_PP_SEQ_ELEM(20, SEQ_255) == 21 END +BEGIN BOOST_PP_SEQ_ELEM(254, SEQ_255) == 255 END +BEGIN BOOST_PP_SEQ_ELEM(220, SEQ_256) == 221 END +BEGIN BOOST_PP_SEQ_ELEM(255, SEQ_256) == 256 END +BEGIN BOOST_PP_SEQ_SIZE(SEQ) == 4 END + +BEGIN BOOST_PP_SEQ_CAT(BOOST_PP_SEQ_TRANSFORM(CAT_S, 13, SEQ_NONE)) == 131 END +BEGIN BOOST_PP_SEQ_CAT(BOOST_PP_SEQ_TRANSFORM(ADD_S, 2, SEQ)) == 6374 END +BEGIN BOOST_PP_SEQ_CAT(BOOST_PP_SEQ_TAIL(SEQ) SEQ) == 1524152 END + +# define F1(r, state, x) + x + state +# define FI2(r, state, i, x) BOOST_PP_IIF(BOOST_PP_EQUAL(i,2),+ x + x + state,+ x + state) +BEGIN BOOST_PP_SEQ_FOR_EACH(F1, 1, SEQ) == 16 END +BEGIN BOOST_PP_SEQ_FOR_EACH_I(FI2, 1, SEQ) == 21 END + +BEGIN BOOST_PP_TUPLE_ELEM(4, 3, BOOST_PP_SEQ_TO_TUPLE(SEQ)) == 2 END +BEGIN BOOST_PP_IS_EMPTY(BOOST_PP_TUPLE_ELEM(1, 0, BOOST_PP_SEQ_TO_TUPLE(SEQ_NONE))) == 1 END + +#if BOOST_PP_VARIADICS + +BEGIN BOOST_PP_TUPLE_SIZE(BOOST_PP_SEQ_TO_TUPLE(SEQ_NONE)) == 1 END + +#endif + +BEGIN BOOST_PP_ARRAY_ELEM(3, BOOST_PP_SEQ_TO_ARRAY(SEQ)) == 2 END + +BEGIN BOOST_PP_IS_EMPTY(BOOST_PP_ARRAY_ELEM(0, BOOST_PP_SEQ_TO_ARRAY(SEQ_NONE))) == 1 END +BEGIN BOOST_PP_ARRAY_SIZE(BOOST_PP_SEQ_TO_ARRAY(SEQ_NONE)) == 1 END + +# define LESS_S(s, x, y) BOOST_PP_LESS(x, y) +# define FILTER_MOD_S(s, data, elem) BOOST_PP_NOT(BOOST_PP_MOD(elem,data)) +BEGIN BOOST_PP_SEQ_CAT(BOOST_PP_SEQ_FILTER(LESS_S, 3, SEQ)) == 45 END +BEGIN BOOST_PP_SEQ_ELEM(4,BOOST_PP_SEQ_FILTER(FILTER_MOD_S, 20, SEQ_100)) == 100 END +BEGIN BOOST_PP_SEQ_ELEM(2,BOOST_PP_SEQ_FILTER(FILTER_MOD_S, 30, SEQ_100)) == 90 END + +BEGIN BOOST_PP_SEQ_CAT(BOOST_PP_SEQ_INSERT(SEQ_NONE, 0, 7)) == 7 END +BEGIN BOOST_PP_SEQ_CAT(BOOST_PP_SEQ_INSERT(SEQ, 0, 3)) == 34152 END +BEGIN BOOST_PP_SEQ_CAT(BOOST_PP_SEQ_INSERT(SEQ, 2, 3)) == 41352 END +BEGIN BOOST_PP_SEQ_CAT(BOOST_PP_SEQ_INSERT(SEQ, 4, 3)) == 41523 END +BEGIN BOOST_PP_SEQ_SIZE(BOOST_PP_SEQ_INSERT(SEQ_255, 0, 100)) == 256 END +BEGIN BOOST_PP_SEQ_ELEM(255,BOOST_PP_SEQ_INSERT(SEQ_255, 0, 100)) == 255 END +BEGIN BOOST_PP_SEQ_ELEM(0,BOOST_PP_SEQ_INSERT(SEQ_255, 0, 113)) == 113 END + +BEGIN BOOST_PP_SEQ_CAT(BOOST_PP_SEQ_POP_BACK(SEQ)) == 415 END +BEGIN BOOST_PP_SEQ_SIZE(BOOST_PP_SEQ_POP_BACK(SEQ_256)) == 255 END +BEGIN BOOST_PP_SEQ_ELEM(254,BOOST_PP_SEQ_POP_BACK(SEQ_256)) == 255 END +BEGIN BOOST_PP_SEQ_ELEM(100,BOOST_PP_SEQ_POP_BACK(SEQ_256)) == 101 END +BEGIN BOOST_PP_SEQ_CAT(BOOST_PP_SEQ_POP_FRONT(SEQ)) == 152 END +BEGIN BOOST_PP_SEQ_SIZE(BOOST_PP_SEQ_POP_FRONT(SEQ_256)) == 255 END +BEGIN BOOST_PP_SEQ_ELEM(0,BOOST_PP_SEQ_POP_FRONT(SEQ_256)) == 2 END +BEGIN BOOST_PP_SEQ_ELEM(254,BOOST_PP_SEQ_POP_FRONT(SEQ_256)) == 256 END + +BEGIN BOOST_PP_SEQ_CAT(BOOST_PP_SEQ_PUSH_FRONT(SEQ_NONE, 145)) == 145 END +BEGIN BOOST_PP_SEQ_CAT(BOOST_PP_SEQ_PUSH_FRONT(SEQ, 3)) == 34152 END +BEGIN BOOST_PP_SEQ_SIZE(BOOST_PP_SEQ_PUSH_FRONT(SEQ_255, 57)) == 256 END +BEGIN BOOST_PP_SEQ_ELEM(0,BOOST_PP_SEQ_PUSH_FRONT(SEQ_255, 222)) == 222 END +BEGIN BOOST_PP_SEQ_ELEM(255,BOOST_PP_SEQ_PUSH_FRONT(SEQ_255, 111)) == 255 END +BEGIN BOOST_PP_SEQ_CAT(BOOST_PP_SEQ_PUSH_BACK(SEQ_NONE, 79)) == 79 END +BEGIN BOOST_PP_SEQ_CAT(BOOST_PP_SEQ_PUSH_BACK(SEQ, 3)) == 41523 END +BEGIN BOOST_PP_SEQ_SIZE(BOOST_PP_SEQ_PUSH_BACK(SEQ_255, 199)) == 256 END +BEGIN BOOST_PP_SEQ_ELEM(254,BOOST_PP_SEQ_PUSH_BACK(SEQ_255, 99)) == 255 END +BEGIN BOOST_PP_SEQ_ELEM(255,BOOST_PP_SEQ_PUSH_BACK(SEQ_255, 99)) == 99 END + +BEGIN BOOST_PP_SEQ_CAT(BOOST_PP_SEQ_REMOVE(SEQ, 0)) == 152 END +BEGIN BOOST_PP_SEQ_CAT(BOOST_PP_SEQ_REMOVE(SEQ, 2)) == 412 END +BEGIN BOOST_PP_SEQ_CAT(BOOST_PP_SEQ_REMOVE(SEQ, 3)) == 415 END + +BEGIN BOOST_PP_SEQ_SIZE(BOOST_PP_SEQ_REMOVE(SEQ_255, 254)) == 254 END +BEGIN BOOST_PP_SEQ_SIZE(BOOST_PP_SEQ_REMOVE(SEQ_256, 255)) == 255 END + +BEGIN BOOST_PP_SEQ_CAT(BOOST_PP_SEQ_REPLACE(SEQ_NONE, 0, 22)) == 22 END +BEGIN BOOST_PP_SEQ_CAT(BOOST_PP_SEQ_REPLACE(SEQ, 0, 3)) == 3152 END +BEGIN BOOST_PP_SEQ_CAT(BOOST_PP_SEQ_REPLACE(SEQ, 1, 3)) == 4352 END +BEGIN BOOST_PP_SEQ_CAT(BOOST_PP_SEQ_REPLACE(SEQ, 3, 3)) == 4153 END +BEGIN BOOST_PP_SEQ_SIZE(BOOST_PP_SEQ_REPLACE(SEQ_256, 255, 22)) == 256 END +BEGIN BOOST_PP_SEQ_ELEM(233,BOOST_PP_SEQ_REPLACE(SEQ_256, 255, 22)) == 234 END +BEGIN BOOST_PP_SEQ_ELEM(255,BOOST_PP_SEQ_REPLACE(SEQ_256, 255, 22)) == 22 END + +BEGIN BOOST_PP_SEQ_CAT(BOOST_PP_SEQ_SUBSEQ(SEQ, 0, 4)) == 4152 END +BEGIN BOOST_PP_SEQ_CAT(BOOST_PP_SEQ_SUBSEQ(SEQ, 0, 2)) == 41 END +BEGIN BOOST_PP_SEQ_CAT(BOOST_PP_SEQ_SUBSEQ(SEQ, 1, 2)) == 15 END +BEGIN BOOST_PP_SEQ_CAT(BOOST_PP_SEQ_SUBSEQ(SEQ, 2, 2)) == 52 END + +# define F2(r, x) + BOOST_PP_SEQ_ELEM(0, x) + 2 - BOOST_PP_SEQ_ELEM(1, x) + +#define ADD_NIL(x) x(nil) + +BEGIN BOOST_PP_SEQ_FOR_EACH_PRODUCT(F2, ((1)(0)) ((2)(3))) == 0 END + +# define L1 (0)(x) +# define L2 (a)(1)(b)(2) +# define L3 (c)(3)(d) + +# define LL (L1)(L2)(L3) + +#define SEQ_APPEND(s, state, elem) state elem +BEGIN BOOST_PP_SEQ_CAT(BOOST_PP_SEQ_TAIL(BOOST_PP_SEQ_FOLD_LEFT(SEQ_APPEND, (~), LL))) == 0x0a1b2c3d END +BEGIN BOOST_PP_SEQ_SIZE(BOOST_PP_SEQ_TAIL(BOOST_PP_SEQ_FOLD_LEFT(SEQ_APPEND, (~), LL))) == 9 END + +BEGIN BOOST_PP_LIST_AT(BOOST_PP_SEQ_TO_LIST(SEQ), 2) == 5 END +BEGIN BOOST_PP_IS_EMPTY(BOOST_PP_LIST_AT(BOOST_PP_SEQ_TO_LIST(SEQ_NONE),0)) == 1 END +BEGIN BOOST_PP_LIST_SIZE(BOOST_PP_SEQ_TO_LIST(SEQ_NONE)) == 1 END + +#if BOOST_PP_VARIADICS + +BEGIN BOOST_PP_VARIADIC_SIZE(BOOST_PP_SEQ_ENUM(SEQ_NONE)) == 1 END +BEGIN BOOST_PP_VARIADIC_ELEM(0,BOOST_PP_SEQ_ENUM(SEQ)) == 4 END +BEGIN BOOST_PP_TUPLE_ELEM(2,BOOST_PP_SEQ_ELEM(0,BOOST_PP_VARIADIC_SEQ_TO_SEQ(SEQVAR))) == 8 END + +#endif diff --git a/src/boost/libs/preprocessor/test/slot.c b/src/boost/libs/preprocessor/test/slot.c new file mode 100644 index 000000000..4b97bcdcf --- /dev/null +++ b/src/boost/libs/preprocessor/test/slot.c @@ -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/slot.cxx> diff --git a/src/boost/libs/preprocessor/test/slot.cpp b/src/boost/libs/preprocessor/test/slot.cpp new file mode 100644 index 000000000..4b97bcdcf --- /dev/null +++ b/src/boost/libs/preprocessor/test/slot.cpp @@ -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/slot.cxx> diff --git a/src/boost/libs/preprocessor/test/slot.cxx b/src/boost/libs/preprocessor/test/slot.cxx new file mode 100644 index 000000000..2b5b3f8f1 --- /dev/null +++ b/src/boost/libs/preprocessor/test/slot.cxx @@ -0,0 +1,53 @@ +# /* ************************************************************************** +# * * +# * (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 <boost/preprocessor/slot.hpp> +# include <libs/preprocessor/test/test.h> +# include <boost/preprocessor/slot/counter.hpp> + +# 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 + +BEGIN BOOST_PP_COUNTER == 0 END + +#include BOOST_PP_UPDATE_COUNTER() + +BEGIN BOOST_PP_COUNTER == 1 END + +#include BOOST_PP_UPDATE_COUNTER() +#include BOOST_PP_UPDATE_COUNTER() + +BEGIN BOOST_PP_COUNTER == 3 END + +#include BOOST_PP_UPDATE_COUNTER() +#include BOOST_PP_UPDATE_COUNTER() +#include BOOST_PP_UPDATE_COUNTER() + +BEGIN BOOST_PP_COUNTER == 6 END + +#include BOOST_PP_UPDATE_COUNTER() +#include BOOST_PP_UPDATE_COUNTER() +#include BOOST_PP_UPDATE_COUNTER() +#include BOOST_PP_UPDATE_COUNTER() +#include BOOST_PP_UPDATE_COUNTER() + +BEGIN BOOST_PP_COUNTER == 11 END diff --git a/src/boost/libs/preprocessor/test/stringize.c b/src/boost/libs/preprocessor/test/stringize.c new file mode 100644 index 000000000..0ac19ecc7 --- /dev/null +++ b/src/boost/libs/preprocessor/test/stringize.c @@ -0,0 +1,12 @@ +# /* ************************************************************************** +# * * +# * (C) Copyright Edward Diener 2018. +# * 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/stringize.cxx> diff --git a/src/boost/libs/preprocessor/test/stringize.cpp b/src/boost/libs/preprocessor/test/stringize.cpp new file mode 100644 index 000000000..0ac19ecc7 --- /dev/null +++ b/src/boost/libs/preprocessor/test/stringize.cpp @@ -0,0 +1,12 @@ +# /* ************************************************************************** +# * * +# * (C) Copyright Edward Diener 2018. +# * 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/stringize.cxx> diff --git a/src/boost/libs/preprocessor/test/stringize.cxx b/src/boost/libs/preprocessor/test/stringize.cxx new file mode 100644 index 000000000..527279b47 --- /dev/null +++ b/src/boost/libs/preprocessor/test/stringize.cxx @@ -0,0 +1,38 @@ +# /* ************************************************************************** +# * * +# * (C) Copyright Edward Diener 2018. +# * 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/stringize.hpp> +# include <boost/preprocessor/wstringize.hpp> +# include <boost/preprocessor/arithmetic/inc.hpp> +# if !defined __cplusplus +#include <wchar.h> +#endif +# include <libs/preprocessor/test/test.h> + +#define VDATA 1,2,3,4 +#define NDATA +#define DATA data +#define FDATA(x) BOOST_PP_INC(x) + +# if ~BOOST_PP_CONFIG_FLAGS() & BOOST_PP_CONFIG_MSVC() +BEGIN sizeof(BOOST_PP_STRINGIZE(NDATA)) / sizeof(char) == 1 END +BEGIN sizeof(BOOST_PP_WSTRINGIZE(NDATA)) / sizeof(wchar_t) == 1 END +#endif +BEGIN sizeof(BOOST_PP_STRINGIZE(DATA)) / sizeof(char) == 5 END +BEGIN sizeof(BOOST_PP_STRINGIZE(FDATA(1))) / sizeof(char) == 2 END +BEGIN sizeof(BOOST_PP_STRINGIZE(FDATA(9))) / sizeof(char) == 3 END +BEGIN sizeof(BOOST_PP_WSTRINGIZE(DATA)) / sizeof(wchar_t) == 5 END +BEGIN sizeof(BOOST_PP_WSTRINGIZE(FDATA(1))) / sizeof(wchar_t) == 2 END +BEGIN sizeof(BOOST_PP_WSTRINGIZE(FDATA(9))) / sizeof(wchar_t) == 3 END +#if BOOST_PP_VARIADICS +BEGIN sizeof(BOOST_PP_STRINGIZE(VDATA)) / sizeof(char) == 8 END +BEGIN sizeof(BOOST_PP_WSTRINGIZE(VDATA)) / sizeof(wchar_t) == 8 END +#endif diff --git a/src/boost/libs/preprocessor/test/test.h b/src/boost/libs/preprocessor/test/test.h new file mode 100644 index 000000000..d1d60c38a --- /dev/null +++ b/src/boost/libs/preprocessor/test/test.h @@ -0,0 +1,20 @@ +# /* Copyright (C) 2001 +# * Housemarque Oy +# * http://www.housemarque.com +# * +# * 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 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 <libs/preprocessor/test/test_macro.h> +# include <libs/preprocessor/test/test_main.h> +# +# endif diff --git a/src/boost/libs/preprocessor/test/test_macro.h b/src/boost/libs/preprocessor/test/test_macro.h new file mode 100644 index 000000000..f9fe1f427 --- /dev/null +++ b/src/boost/libs/preprocessor/test/test_macro.h @@ -0,0 +1,22 @@ +# /* Copyright (C) 2001 +# * Housemarque Oy +# * http://www.housemarque.com +# * +# * 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 Paul Mensonides (2002) */ +# +# /* See http://www.boost.org for most recent version. */ +# +# ifndef BOOST_LIBS_PREPROCESSOR_REGRESSION_TEST_MACRO_H +# define BOOST_LIBS_PREPROCESSOR_REGRESSION_TEST_MACRO_H +# +# include <boost/preprocessor/cat.hpp> +# +# define BEGIN typedef int BOOST_PP_CAT(test_, __LINE__)[(( +# define END )==1) ? 1 : -1]; +# +# endif diff --git a/src/boost/libs/preprocessor/test/test_main.h b/src/boost/libs/preprocessor/test/test_main.h new file mode 100644 index 000000000..23797c264 --- /dev/null +++ b/src/boost/libs/preprocessor/test/test_main.h @@ -0,0 +1,32 @@ +# /* Copyright (C) 2001 +# * Housemarque Oy +# * http://www.housemarque.com +# * +# * 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 Paul Mensonides (2002) */ +# +# /* See http://www.boost.org for most recent version. */ +# +# ifndef BOOST_LIBS_PREPROCESSOR_REGRESSION_TEST_MAIN_H +# define BOOST_LIBS_PREPROCESSOR_REGRESSION_TEST_MAIN_H +# +#if defined(__cplusplus) +#include <cstdio> +#if !defined(_STLP_MSVC) || _STLP_MSVC >= 1300 +namespace std { } +using namespace std; +#endif +#else +#include <stdio.h> +#endif + +int main(void) { + printf("pass " __TIME__); + return 0; +} + +# endif diff --git a/src/boost/libs/preprocessor/test/tuple.c b/src/boost/libs/preprocessor/test/tuple.c new file mode 100644 index 000000000..e9864a04a --- /dev/null +++ b/src/boost/libs/preprocessor/test/tuple.c @@ -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/tuple.cxx> diff --git a/src/boost/libs/preprocessor/test/tuple.cpp b/src/boost/libs/preprocessor/test/tuple.cpp new file mode 100644 index 000000000..e9864a04a --- /dev/null +++ b/src/boost/libs/preprocessor/test/tuple.cpp @@ -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/tuple.cxx> diff --git a/src/boost/libs/preprocessor/test/tuple.cxx b/src/boost/libs/preprocessor/test/tuple.cxx new file mode 100644 index 000000000..0f334f409 --- /dev/null +++ b/src/boost/libs/preprocessor/test/tuple.cxx @@ -0,0 +1,266 @@ +# /* ************************************************************************** +# * * +# * (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,2014) */ +# +# /* See http://www.boost.org for most recent version. */ +# +# include <boost/preprocessor/cat.hpp> +# include <boost/preprocessor/control/if.hpp> +# include <boost/preprocessor/tuple.hpp> +# include <boost/preprocessor/array/elem.hpp> +# include <boost/preprocessor/array/size.hpp> +# include <boost/preprocessor/list/at.hpp> +# include <boost/preprocessor/list/size.hpp> +# include <boost/preprocessor/seq/elem.hpp> +# include <boost/preprocessor/seq/size.hpp> +# include <boost/preprocessor/facilities/is_empty.hpp> +# if BOOST_PP_VARIADICS +# include <boost/preprocessor/variadic/size.hpp> +# include <boost/preprocessor/variadic/elem.hpp> +# endif +# include <libs/preprocessor/test/test.h> +# include <libs/preprocessor/test/tuple_elem_bug_test.cxx> + +# define TUPLE (0, 1, 2, 3, 4, 5) +# define TUPLE_NONE () +# define TUPLE_LARGE (0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32) +# define TUPLE_VERY_LARGE (0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63) +# define T2 (+3, /2, +6) + +#if BOOST_PP_VARIADICS + +# define CALC(x) BOOST_PP_TUPLE_ELEM(0, x) BOOST_PP_TUPLE_ELEM(1, x) BOOST_PP_TUPLE_ELEM(2, x) +# define TEST_EAT BOOST_PP_TUPLE_EAT()(1, 2) 4 +# define TEST_EAT_NONE BOOST_PP_TUPLE_EAT()() 17 +# define TEST_EAT_LARGE BOOST_PP_TUPLE_EAT()(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32) 6 +# define TEST_EAT_VERY_LARGE BOOST_PP_TUPLE_EAT()(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63) 8 + +#else + +# 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 TEST_EAT BOOST_PP_TUPLE_EAT(2)(1, 2) 4 +# define TEST_EAT_NONE BOOST_PP_TUPLE_EAT(1)() 17 +# define TEST_EAT_LARGE BOOST_PP_TUPLE_EAT(33)(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32) 6 +# define TEST_EAT_VERY_LARGE BOOST_PP_TUPLE_EAT(64)(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63) 8 + +#endif + +// elem + +BEGIN BOOST_PP_IS_EMPTY(BOOST_PP_TUPLE_ELEM(1, 0, TUPLE_NONE)) == 1 END +BEGIN BOOST_PP_TUPLE_ELEM(6, 3, TUPLE) == 3 END +BEGIN BOOST_PP_TUPLE_ELEM(6, 5, TUPLE) == 5 END +BEGIN BOOST_PP_TUPLE_ELEM(33, 15, TUPLE_LARGE) == 15 END +BEGIN BOOST_PP_TUPLE_ELEM(33, 27, TUPLE_LARGE) == 27 END +BEGIN BOOST_PP_TUPLE_ELEM(33, 32, TUPLE_LARGE) == 32 END +BEGIN BOOST_PP_TUPLE_ELEM(64, 22, TUPLE_VERY_LARGE) == 22 END +BEGIN BOOST_PP_TUPLE_ELEM(64, 47, TUPLE_VERY_LARGE) == 47 END +BEGIN BOOST_PP_TUPLE_ELEM(64, 63, TUPLE_VERY_LARGE) == 63 END + +// reverse + +BEGIN BOOST_PP_IS_EMPTY(BOOST_PP_TUPLE_ELEM(1, 0, BOOST_PP_TUPLE_REVERSE(1,TUPLE_NONE))) == 1 END +BEGIN BOOST_PP_TUPLE_ELEM(6, 2, BOOST_PP_TUPLE_REVERSE(6,TUPLE)) == 3 END +BEGIN BOOST_PP_TUPLE_ELEM(33, 27, BOOST_PP_TUPLE_REVERSE(33,TUPLE_LARGE)) == 5 END +BEGIN BOOST_PP_TUPLE_ELEM(64, 43, BOOST_PP_TUPLE_REVERSE(64,TUPLE_VERY_LARGE)) == 20 END +BEGIN CALC(T2) == 7 END +BEGIN CALC(BOOST_PP_TUPLE_REVERSE(3, T2)) == 6 END + +// eat + +BEGIN TEST_EAT == 4 END +BEGIN TEST_EAT_NONE == 17 END +BEGIN TEST_EAT_LARGE == 6 END +BEGIN TEST_EAT_VERY_LARGE == 8 END + +// to_array + +BEGIN BOOST_PP_ARRAY_ELEM(3,BOOST_PP_TUPLE_TO_ARRAY(6,TUPLE)) == 3 END +BEGIN BOOST_PP_ARRAY_ELEM(29,BOOST_PP_TUPLE_TO_ARRAY(33,TUPLE_LARGE)) == 29 END +BEGIN BOOST_PP_ARRAY_ELEM(61,BOOST_PP_TUPLE_TO_ARRAY(64,TUPLE_VERY_LARGE)) == 61 END +BEGIN BOOST_PP_IS_EMPTY(BOOST_PP_ARRAY_ELEM(0,BOOST_PP_TUPLE_TO_ARRAY(1,TUPLE_NONE))) == 1 END +BEGIN BOOST_PP_ARRAY_SIZE(BOOST_PP_TUPLE_TO_ARRAY(1,TUPLE_NONE)) == 1 END + +// to_list + +BEGIN BOOST_PP_LIST_AT(BOOST_PP_TUPLE_TO_LIST(6,TUPLE), 2) == 2 END +BEGIN BOOST_PP_LIST_AT(BOOST_PP_TUPLE_TO_LIST(33,TUPLE_LARGE), 19) == 19 END +BEGIN BOOST_PP_LIST_AT(BOOST_PP_TUPLE_TO_LIST(64,TUPLE_VERY_LARGE), 62) == 62 END +BEGIN BOOST_PP_IS_EMPTY(BOOST_PP_LIST_AT(BOOST_PP_TUPLE_TO_LIST(1,TUPLE_NONE), 0)) == 1 END +BEGIN BOOST_PP_LIST_SIZE(BOOST_PP_TUPLE_TO_LIST(1,TUPLE_NONE)) == 1 END + +// to_seq + +BEGIN BOOST_PP_SEQ_ELEM(4,BOOST_PP_TUPLE_TO_SEQ(6,TUPLE)) == 4 END +BEGIN BOOST_PP_SEQ_ELEM(31,BOOST_PP_TUPLE_TO_SEQ(33,TUPLE_LARGE)) == 31 END +BEGIN BOOST_PP_SEQ_ELEM(55,BOOST_PP_TUPLE_TO_SEQ(64,TUPLE_VERY_LARGE)) == 55 END +BEGIN BOOST_PP_IS_EMPTY(BOOST_PP_SEQ_ELEM(0,BOOST_PP_TUPLE_TO_SEQ(1,TUPLE_NONE))) == 1 END +BEGIN BOOST_PP_SEQ_SIZE(BOOST_PP_TUPLE_TO_SEQ(1,TUPLE_NONE)) == 1 END + +#if BOOST_PP_VARIADICS + +// elem + +BEGIN BOOST_PP_IS_EMPTY(BOOST_PP_TUPLE_ELEM(0, TUPLE_NONE)) == 1 END +BEGIN BOOST_PP_TUPLE_ELEM(3, TUPLE) == 3 END +BEGIN BOOST_PP_TUPLE_ELEM(5, TUPLE) == 5 END +BEGIN BOOST_PP_TUPLE_ELEM(15, TUPLE_LARGE) == 15 END +BEGIN BOOST_PP_TUPLE_ELEM(27, TUPLE_LARGE) == 27 END +BEGIN BOOST_PP_TUPLE_ELEM(32, TUPLE_LARGE) == 32 END +BEGIN BOOST_PP_TUPLE_ELEM(22, TUPLE_VERY_LARGE) == 22 END +BEGIN BOOST_PP_TUPLE_ELEM(47, TUPLE_VERY_LARGE) == 47 END +BEGIN BOOST_PP_TUPLE_ELEM(63, TUPLE_VERY_LARGE) == 63 END + +// reverse + +BEGIN BOOST_PP_IS_EMPTY(BOOST_PP_TUPLE_ELEM(0, BOOST_PP_TUPLE_REVERSE(TUPLE_NONE))) == 1 END +BEGIN BOOST_PP_TUPLE_ELEM(2, BOOST_PP_TUPLE_REVERSE(TUPLE)) == 3 END +BEGIN BOOST_PP_TUPLE_ELEM(27, BOOST_PP_TUPLE_REVERSE(TUPLE_LARGE)) == 5 END +BEGIN BOOST_PP_TUPLE_ELEM(43, BOOST_PP_TUPLE_REVERSE(TUPLE_VERY_LARGE)) == 20 END +BEGIN CALC(BOOST_PP_TUPLE_REVERSE(T2)) == 6 END +BEGIN BOOST_PP_VARIADIC_ELEM(2,BOOST_PP_TUPLE_ENUM(BOOST_PP_TUPLE_REVERSE(TUPLE))) == 3 END +BEGIN BOOST_PP_VARIADIC_ELEM(27,BOOST_PP_TUPLE_ENUM(BOOST_PP_TUPLE_REVERSE(TUPLE_LARGE))) == 5 END +BEGIN BOOST_PP_VARIADIC_ELEM(45,BOOST_PP_TUPLE_ENUM(BOOST_PP_TUPLE_REVERSE(TUPLE_VERY_LARGE))) == 18 END + +// enum + +BEGIN BOOST_PP_VARIADIC_SIZE(BOOST_PP_TUPLE_ENUM(TUPLE_NONE)) == 1 END +BEGIN BOOST_PP_VARIADIC_SIZE(BOOST_PP_TUPLE_ENUM(TUPLE)) == 6 END +BEGIN BOOST_PP_VARIADIC_SIZE(BOOST_PP_TUPLE_ENUM(TUPLE_LARGE)) == 33 END +BEGIN BOOST_PP_VARIADIC_SIZE(BOOST_PP_TUPLE_ENUM(TUPLE_VERY_LARGE)) == 64 END + +// insert + +BEGIN BOOST_PP_TUPLE_ELEM(0, BOOST_PP_TUPLE_INSERT(TUPLE_NONE,0,40)) == 40 END +BEGIN BOOST_PP_TUPLE_SIZE(BOOST_PP_TUPLE_INSERT(TUPLE_NONE,0,40)) == 2 END + +BEGIN BOOST_PP_TUPLE_ELEM(0, BOOST_PP_TUPLE_INSERT(TUPLE,2,40)) == 0 END +BEGIN BOOST_PP_TUPLE_ELEM(1, BOOST_PP_TUPLE_INSERT(TUPLE,1,40)) == 40 END +BEGIN BOOST_PP_TUPLE_ELEM(2, BOOST_PP_TUPLE_INSERT(TUPLE,1,40)) == 1 END +BEGIN BOOST_PP_TUPLE_SIZE(BOOST_PP_TUPLE_INSERT(TUPLE,1,40)) == 7 END + +BEGIN BOOST_PP_TUPLE_ELEM(8, BOOST_PP_TUPLE_INSERT(TUPLE_LARGE,22,1000)) == 8 END +BEGIN BOOST_PP_TUPLE_ELEM(22, BOOST_PP_TUPLE_INSERT(TUPLE_LARGE,22,1000)) == 1000 END +BEGIN BOOST_PP_TUPLE_ELEM(26, BOOST_PP_TUPLE_INSERT(TUPLE_LARGE,22,1000)) == 25 END +BEGIN BOOST_PP_TUPLE_SIZE(BOOST_PP_TUPLE_INSERT(TUPLE_LARGE,22,1000)) == 34 END + +// pop_back + +BEGIN BOOST_PP_TUPLE_SIZE(BOOST_PP_TUPLE_POP_BACK(TUPLE)) == 5 END +BEGIN BOOST_PP_TUPLE_SIZE(BOOST_PP_TUPLE_POP_BACK(TUPLE_LARGE)) == 32 END +BEGIN BOOST_PP_TUPLE_SIZE(BOOST_PP_TUPLE_POP_BACK(TUPLE_VERY_LARGE)) == 63 END + +// pop_front + +BEGIN BOOST_PP_TUPLE_SIZE(BOOST_PP_TUPLE_POP_FRONT(TUPLE)) == 5 END +BEGIN BOOST_PP_TUPLE_SIZE(BOOST_PP_TUPLE_POP_FRONT(TUPLE_LARGE)) == 32 END +BEGIN BOOST_PP_TUPLE_SIZE(BOOST_PP_TUPLE_POP_FRONT(TUPLE_VERY_LARGE)) == 63 END + +BEGIN BOOST_PP_TUPLE_ELEM(1, BOOST_PP_TUPLE_POP_FRONT(TUPLE)) == 2 END +BEGIN BOOST_PP_TUPLE_ELEM(31, BOOST_PP_TUPLE_POP_FRONT(TUPLE_LARGE)) == 32 END +BEGIN BOOST_PP_TUPLE_ELEM(55, BOOST_PP_TUPLE_POP_FRONT(TUPLE_VERY_LARGE)) == 56 END + +// push_back + +BEGIN BOOST_PP_TUPLE_SIZE(BOOST_PP_TUPLE_PUSH_BACK(TUPLE_NONE, 1)) == 2 END +BEGIN BOOST_PP_TUPLE_SIZE(BOOST_PP_TUPLE_PUSH_BACK(TUPLE, 6)) == 7 END +BEGIN BOOST_PP_TUPLE_SIZE(BOOST_PP_TUPLE_PUSH_BACK(TUPLE_LARGE, 33)) == 34 END +BEGIN BOOST_PP_TUPLE_ELEM(1, BOOST_PP_TUPLE_PUSH_BACK(TUPLE_NONE, 1)) == 1 END +BEGIN BOOST_PP_TUPLE_ELEM(0, BOOST_PP_TUPLE_PUSH_BACK(TUPLE, 6)) == 0 END +BEGIN BOOST_PP_TUPLE_ELEM(33, BOOST_PP_TUPLE_PUSH_BACK(TUPLE_LARGE, 33)) == 33 END + +// push_front + +BEGIN BOOST_PP_TUPLE_SIZE(BOOST_PP_TUPLE_PUSH_FRONT(TUPLE_NONE, 55)) == 2 END +BEGIN BOOST_PP_TUPLE_SIZE(BOOST_PP_TUPLE_PUSH_FRONT(TUPLE, 555)) == 7 END +BEGIN BOOST_PP_TUPLE_SIZE(BOOST_PP_TUPLE_PUSH_FRONT(TUPLE_LARGE, 666)) == 34 END +BEGIN BOOST_PP_TUPLE_ELEM(0, BOOST_PP_TUPLE_PUSH_FRONT(TUPLE_NONE, 55)) == 55 END +BEGIN BOOST_PP_TUPLE_ELEM(0, BOOST_PP_TUPLE_PUSH_FRONT(TUPLE, 555)) == 555 END +BEGIN BOOST_PP_TUPLE_ELEM(33, BOOST_PP_TUPLE_PUSH_FRONT(TUPLE_LARGE, 33)) == 32 END + +// rem + +#if BOOST_PP_VARIADICS_MSVC && _MSC_VER <= 1400 + +BEGIN BOOST_PP_VARIADIC_SIZE(BOOST_PP_TUPLE_REM(1)()) == 1 END +BEGIN BOOST_PP_VARIADIC_SIZE(BOOST_PP_TUPLE_REM(33)(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32)) == 33 END +BEGIN BOOST_PP_VARIADIC_SIZE(BOOST_PP_TUPLE_REM(64)(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63)) == 64 END + +#else + +#if BOOST_PP_VARIADICS_MSVC +BEGIN BOOST_PP_IS_EMPTY(BOOST_PP_TUPLE_REM_CAT() TUPLE_NONE) == 1 END +#else +BEGIN BOOST_PP_IS_EMPTY(BOOST_PP_TUPLE_REM() TUPLE_NONE) == 1 END +#endif + +BEGIN BOOST_PP_VARIADIC_SIZE(BOOST_PP_TUPLE_REM()(0, 1, 2, 3, 4, 5)) == 6 END +BEGIN BOOST_PP_VARIADIC_SIZE(BOOST_PP_TUPLE_REM()(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32)) == 33 END +BEGIN BOOST_PP_VARIADIC_SIZE(BOOST_PP_TUPLE_REM()(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63)) == 64 END + +#endif + +// rem_ctor + +BEGIN BOOST_PP_VARIADIC_SIZE(BOOST_PP_TUPLE_REM_CTOR(TUPLE_NONE)) == 1 END +BEGIN BOOST_PP_VARIADIC_SIZE(BOOST_PP_TUPLE_REM_CTOR(TUPLE)) == 6 END +BEGIN BOOST_PP_VARIADIC_SIZE(BOOST_PP_TUPLE_REM_CTOR(TUPLE_LARGE)) == 33 END +BEGIN BOOST_PP_VARIADIC_SIZE(BOOST_PP_TUPLE_REM_CTOR(TUPLE_VERY_LARGE)) == 64 END + +// remove + +BEGIN BOOST_PP_TUPLE_SIZE(BOOST_PP_TUPLE_REMOVE(TUPLE, 1)) == 5 END +BEGIN BOOST_PP_TUPLE_SIZE(BOOST_PP_TUPLE_REMOVE(TUPLE_LARGE, 17)) == 32 END +BEGIN BOOST_PP_TUPLE_SIZE(BOOST_PP_TUPLE_REMOVE(TUPLE_VERY_LARGE, 27)) == 63 END +BEGIN BOOST_PP_TUPLE_ELEM(0, BOOST_PP_TUPLE_REMOVE(TUPLE, 2)) == 0 END +BEGIN BOOST_PP_TUPLE_ELEM(29, BOOST_PP_TUPLE_REMOVE(TUPLE_LARGE, 25)) == 30 END +BEGIN BOOST_PP_TUPLE_ELEM(62, BOOST_PP_TUPLE_REMOVE(TUPLE_VERY_LARGE, 48)) == 63 END + +// replace + +BEGIN BOOST_PP_TUPLE_SIZE(BOOST_PP_TUPLE_REPLACE(TUPLE_VERY_LARGE, 27, 1000)) == 64 END +BEGIN BOOST_PP_TUPLE_ELEM(0, BOOST_PP_TUPLE_REPLACE(TUPLE_NONE, 0, 71)) == 71 END +BEGIN BOOST_PP_TUPLE_ELEM(0, BOOST_PP_TUPLE_REPLACE(TUPLE, 1, 44)) == 0 END +BEGIN BOOST_PP_TUPLE_ELEM(29, BOOST_PP_TUPLE_REPLACE(TUPLE_LARGE, 29, 999)) == 999 END +BEGIN BOOST_PP_TUPLE_ELEM(38, BOOST_PP_TUPLE_REPLACE(TUPLE_VERY_LARGE, 37, 1)) == 38 END +BEGIN BOOST_PP_TUPLE_ELEM(28, BOOST_PP_TUPLE_REPLACE(TUPLE_VERY_LARGE, 28, 1)) == 1 END + +// size + +BEGIN BOOST_PP_TUPLE_SIZE(TUPLE_NONE) == 1 END +BEGIN BOOST_PP_TUPLE_SIZE(TUPLE) == 6 END +BEGIN BOOST_PP_TUPLE_SIZE(TUPLE_LARGE) == 33 END +BEGIN BOOST_PP_TUPLE_SIZE(TUPLE_VERY_LARGE) == 64 END + +// to_array + +BEGIN BOOST_PP_ARRAY_ELEM(3,BOOST_PP_TUPLE_TO_ARRAY(TUPLE)) == 3 END +BEGIN BOOST_PP_ARRAY_ELEM(29,BOOST_PP_TUPLE_TO_ARRAY(TUPLE_LARGE)) == 29 END +BEGIN BOOST_PP_ARRAY_ELEM(61,BOOST_PP_TUPLE_TO_ARRAY(TUPLE_VERY_LARGE)) == 61 END +BEGIN BOOST_PP_IS_EMPTY(BOOST_PP_ARRAY_ELEM(0,BOOST_PP_TUPLE_TO_ARRAY(TUPLE_NONE))) == 1 END +BEGIN BOOST_PP_ARRAY_SIZE(BOOST_PP_TUPLE_TO_ARRAY(TUPLE_NONE)) == 1 END + +// to_tuple + +BEGIN BOOST_PP_LIST_AT(BOOST_PP_TUPLE_TO_LIST(TUPLE), 2) == 2 END +BEGIN BOOST_PP_LIST_AT(BOOST_PP_TUPLE_TO_LIST(TUPLE_LARGE), 19) == 19 END +BEGIN BOOST_PP_LIST_AT(BOOST_PP_TUPLE_TO_LIST(TUPLE_VERY_LARGE), 62) == 62 END +BEGIN BOOST_PP_IS_EMPTY(BOOST_PP_LIST_AT(BOOST_PP_TUPLE_TO_LIST(TUPLE_NONE), 0)) == 1 END +BEGIN BOOST_PP_LIST_SIZE(BOOST_PP_TUPLE_TO_LIST(TUPLE_NONE)) == 1 END + +// to_seq + +BEGIN BOOST_PP_SEQ_ELEM(4,BOOST_PP_TUPLE_TO_SEQ(TUPLE)) == 4 END +BEGIN BOOST_PP_SEQ_ELEM(31,BOOST_PP_TUPLE_TO_SEQ(TUPLE_LARGE)) == 31 END +BEGIN BOOST_PP_SEQ_ELEM(55,BOOST_PP_TUPLE_TO_SEQ(TUPLE_VERY_LARGE)) == 55 END +BEGIN BOOST_PP_IS_EMPTY(BOOST_PP_SEQ_ELEM(0,BOOST_PP_TUPLE_TO_SEQ(TUPLE_NONE))) == 1 END +BEGIN BOOST_PP_SEQ_SIZE(BOOST_PP_TUPLE_TO_SEQ(TUPLE_NONE)) == 1 END + +#endif diff --git a/src/boost/libs/preprocessor/test/tuple_elem_bug_test.cxx b/src/boost/libs/preprocessor/test/tuple_elem_bug_test.cxx new file mode 100644 index 000000000..c3656096a --- /dev/null +++ b/src/boost/libs/preprocessor/test/tuple_elem_bug_test.cxx @@ -0,0 +1,38 @@ +# /* ************************************************************************** +# * * +# * (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/cat.hpp> +# include <boost/preprocessor/control/if.hpp> +# include <boost/preprocessor/tuple.hpp> +# include <libs/preprocessor/test/test.h> + +#define TN_GEN_ONE(p) (1) +#define TN_GEN_ZERO(p) (0) +#define TN_TEST_ONE_MORE(parameter,ens) \ + BOOST_PP_IF \ + ( \ + BOOST_PP_CAT(BOOST_PP_TUPLE_ELEM(1,0,ens),0), \ + TN_GEN_ONE, \ + TN_GEN_ZERO \ + ) \ + (parameter) \ +/**/ +#define TN_TEST_ONE(parameter,ens) \ + BOOST_PP_TUPLE_ELEM \ + ( \ + 1, \ + 0, \ + TN_TEST_ONE_MORE(parameter,ens) \ + ) \ +/**/ + +BEGIN TN_TEST_ONE(A,(1)) == 1 END +BEGIN TN_TEST_ONE(A,()) == 0 END diff --git a/src/boost/libs/preprocessor/test/vaopt.cpp b/src/boost/libs/preprocessor/test/vaopt.cpp new file mode 100644 index 000000000..9801a19e2 --- /dev/null +++ b/src/boost/libs/preprocessor/test/vaopt.cpp @@ -0,0 +1,12 @@ +# /* ************************************************************************** +# * * +# * (C) Copyright Edward Diener 2019. +# * 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/vaopt.cxx> diff --git a/src/boost/libs/preprocessor/test/vaopt.cxx b/src/boost/libs/preprocessor/test/vaopt.cxx new file mode 100644 index 000000000..6cb870218 --- /dev/null +++ b/src/boost/libs/preprocessor/test/vaopt.cxx @@ -0,0 +1,88 @@ +# /* ************************************************************************** +# * * +# * (C) Copyright Edward Diener 2019. +# * 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/test.h> +# include <boost/preprocessor/variadic/has_opt.hpp> + +# if BOOST_PP_VARIADIC_HAS_OPT() + +# include <boost/preprocessor/facilities/empty.hpp> +# include <boost/preprocessor/facilities/va_opt.hpp> +# include <boost/preprocessor/variadic/elem.hpp> + +#define DATA +#define OBJECT OBJECT2 +#define OBJECT2 +#define FUNC(x) FUNC2(x) +#define FUNC2(x) +#define FUNC_GEN() () +#define FUNC_GEN2(x) () +#define FUNC_GEN3() (&) +#define FUNC_GEN4(x) (y) +#define FUNC_GEN5() (y,z) +#define FUNC_GEN6() anything +#define FUNC_GEN7(x) anything +#define FUNC_GEN8(x,y) (1,2,3) +#define FUNC_GEN9(x,y,z) anything +#define FUNC_GEN10(x) (y) data +#define NAME &name +#define ATUPLE (atuple) +#define ATUPLE_PLUS (atuple) data + +#define TRY_PASS_EMPTY_STD(...) BOOST_PP_VARIADIC_ELEM(0, __VA_OPT__ (0,) 1) +#define TRY_PASS_EMPTY_BOOST(...) BOOST_PP_VARIADIC_ELEM(0,BOOST_PP_VA_OPT((0),(1),__VA_ARGS__)) + +BEGIN TRY_PASS_EMPTY_STD(FUNC_GEN) == 0 END +BEGIN TRY_PASS_EMPTY_BOOST(FUNC_GEN) == 0 END +BEGIN TRY_PASS_EMPTY_STD(FUNC_GEN2) == 0 END +BEGIN TRY_PASS_EMPTY_BOOST(FUNC_GEN2) == 0 END +BEGIN TRY_PASS_EMPTY_STD(FUNC_GEN3) == 0 END +BEGIN TRY_PASS_EMPTY_BOOST(FUNC_GEN3) == 0 END +BEGIN TRY_PASS_EMPTY_STD(FUNC_GEN4) == 0 END +BEGIN TRY_PASS_EMPTY_BOOST(FUNC_GEN4) == 0 END +BEGIN TRY_PASS_EMPTY_STD(FUNC_GEN5) == 0 END +BEGIN TRY_PASS_EMPTY_BOOST(FUNC_GEN5) == 0 END +BEGIN TRY_PASS_EMPTY_STD(FUNC_GEN8) == 0 END +BEGIN TRY_PASS_EMPTY_BOOST(FUNC_GEN8) == 0 END +BEGIN TRY_PASS_EMPTY_STD(FUNC_GEN9) == 0 END +BEGIN TRY_PASS_EMPTY_BOOST(FUNC_GEN9) == 0 END +BEGIN TRY_PASS_EMPTY_STD(FUNC_GEN10) == 0 END +BEGIN TRY_PASS_EMPTY_BOOST(FUNC_GEN10) == 0 END +BEGIN TRY_PASS_EMPTY_STD(BOOST_PP_EMPTY()) == 1 END +BEGIN TRY_PASS_EMPTY_BOOST(BOOST_PP_EMPTY()) == 1 END +BEGIN TRY_PASS_EMPTY_STD(DATA BOOST_PP_EMPTY()) == 1 END +BEGIN TRY_PASS_EMPTY_BOOST(DATA BOOST_PP_EMPTY()) == 1 END +BEGIN TRY_PASS_EMPTY_STD() == 1 END +BEGIN TRY_PASS_EMPTY_BOOST() == 1 END +BEGIN TRY_PASS_EMPTY_STD(DATA) == 1 END +BEGIN TRY_PASS_EMPTY_BOOST(DATA) == 1 END +BEGIN TRY_PASS_EMPTY_STD(x BOOST_PP_EMPTY()) == 0 END +BEGIN TRY_PASS_EMPTY_BOOST(x BOOST_PP_EMPTY()) == 0 END +BEGIN TRY_PASS_EMPTY_STD(OBJECT BOOST_PP_EMPTY()) == 1 END +BEGIN TRY_PASS_EMPTY_BOOST(OBJECT BOOST_PP_EMPTY()) == 1 END +BEGIN TRY_PASS_EMPTY_STD(FUNC(z) BOOST_PP_EMPTY()) == 1 END +BEGIN TRY_PASS_EMPTY_BOOST(FUNC(z) BOOST_PP_EMPTY()) == 1 END +BEGIN TRY_PASS_EMPTY_STD(FUNC_GEN6) == 0 END +BEGIN TRY_PASS_EMPTY_BOOST(FUNC_GEN6) == 0 END +BEGIN TRY_PASS_EMPTY_STD(FUNC_GEN7) == 0 END +BEGIN TRY_PASS_EMPTY_BOOST(FUNC_GEN7) == 0 END +BEGIN TRY_PASS_EMPTY_STD(NAME) == 0 END +BEGIN TRY_PASS_EMPTY_BOOST(NAME) == 0 END +BEGIN TRY_PASS_EMPTY_STD(ATUPLE) == 0 END +BEGIN TRY_PASS_EMPTY_BOOST(ATUPLE) == 0 END +BEGIN TRY_PASS_EMPTY_STD(ATUPLE_PLUS) == 0 END +BEGIN TRY_PASS_EMPTY_BOOST(ATUPLE_PLUS) == 0 END + +# else + +BEGIN 1 == 1 END + +# endif diff --git a/src/boost/libs/preprocessor/test/variadic.c b/src/boost/libs/preprocessor/test/variadic.c new file mode 100644 index 000000000..a9d25323f --- /dev/null +++ b/src/boost/libs/preprocessor/test/variadic.c @@ -0,0 +1,12 @@ +# /* ************************************************************************** +# * * +# * (C) Copyright Edward Diener 2011. +# * 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/variadic.cxx> diff --git a/src/boost/libs/preprocessor/test/variadic.cpp b/src/boost/libs/preprocessor/test/variadic.cpp new file mode 100644 index 000000000..a9d25323f --- /dev/null +++ b/src/boost/libs/preprocessor/test/variadic.cpp @@ -0,0 +1,12 @@ +# /* ************************************************************************** +# * * +# * (C) Copyright Edward Diener 2011. +# * 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/variadic.cxx> diff --git a/src/boost/libs/preprocessor/test/variadic.cxx b/src/boost/libs/preprocessor/test/variadic.cxx new file mode 100644 index 000000000..e1a3a15b8 --- /dev/null +++ b/src/boost/libs/preprocessor/test/variadic.cxx @@ -0,0 +1,56 @@ +# /* ************************************************************************** +# * * +# * (C) Copyright Edward Diener 2011. +# * 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/variadic.hpp> +# include <boost/preprocessor/array/size.hpp> +# include <boost/preprocessor/array/elem.hpp> +# include <boost/preprocessor/list/at.hpp> +# include <boost/preprocessor/list/size.hpp> +# include <boost/preprocessor/seq/elem.hpp> +# include <boost/preprocessor/seq/size.hpp> +# include <boost/preprocessor/tuple/size.hpp> +# include <boost/preprocessor/tuple/elem.hpp> +# include <libs/preprocessor/test/test.h> + +#if BOOST_PP_VARIADICS + +#define VDATA 0,1,2,3,4,5,6 +#define VDATA_LARGE 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32 +#define VDATA_VERY_LARGE 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63 + +BEGIN BOOST_PP_VARIADIC_ELEM(4,VDATA) == 4 END +BEGIN BOOST_PP_VARIADIC_ELEM(6,7,11,3,8,14,85,56,92,165) == 56 END +BEGIN BOOST_PP_VARIADIC_ELEM(29,VDATA_LARGE) == 29 END +BEGIN BOOST_PP_VARIADIC_ELEM(57,VDATA_VERY_LARGE) == 57 END +BEGIN BOOST_PP_VARIADIC_ELEM(35, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63) == 35 END +BEGIN BOOST_PP_VARIADIC_SIZE(VDATA) == 7 END +BEGIN BOOST_PP_VARIADIC_SIZE(7,11,3,8,14,85,56,92,165) == 9 END +BEGIN BOOST_PP_VARIADIC_SIZE(VDATA_LARGE) == 33 END +BEGIN BOOST_PP_VARIADIC_SIZE(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32) == 33 END +BEGIN BOOST_PP_VARIADIC_SIZE(VDATA_VERY_LARGE) == 64 END +BEGIN BOOST_PP_ARRAY_SIZE(BOOST_PP_VARIADIC_TO_ARRAY(VDATA)) == 7 END +BEGIN BOOST_PP_ARRAY_SIZE(BOOST_PP_VARIADIC_TO_ARRAY(VDATA_VERY_LARGE)) == 64 END +BEGIN BOOST_PP_ARRAY_ELEM(4,BOOST_PP_VARIADIC_TO_ARRAY(7,11,3,8,14,85,56,92,165)) == 14 END +BEGIN BOOST_PP_ARRAY_ELEM(30,BOOST_PP_VARIADIC_TO_ARRAY(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32)) == 30 END +BEGIN BOOST_PP_LIST_AT(BOOST_PP_VARIADIC_TO_LIST(VDATA),3) == 3 END +BEGIN BOOST_PP_LIST_AT(BOOST_PP_VARIADIC_TO_LIST(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63),49) == 49 END +BEGIN BOOST_PP_LIST_SIZE(BOOST_PP_VARIADIC_TO_LIST(7,11,3,8,14,85,56,92,165)) == 9 END +BEGIN BOOST_PP_LIST_SIZE(BOOST_PP_VARIADIC_TO_LIST(VDATA_LARGE)) == 33 END +BEGIN BOOST_PP_SEQ_ELEM(5,BOOST_PP_VARIADIC_TO_SEQ(VDATA)) == 5 END +BEGIN BOOST_PP_SEQ_ELEM(16,BOOST_PP_VARIADIC_TO_SEQ(VDATA_LARGE)) == 16 END +BEGIN BOOST_PP_SEQ_SIZE(BOOST_PP_VARIADIC_TO_SEQ(3,78,22,11,3)) == 5 END +BEGIN BOOST_PP_SEQ_SIZE(BOOST_PP_VARIADIC_TO_SEQ(VDATA_VERY_LARGE)) == 64 END +BEGIN BOOST_PP_TUPLE_SIZE(BOOST_PP_VARIADIC_TO_TUPLE(VDATA)) == 7 END +BEGIN BOOST_PP_TUPLE_SIZE(BOOST_PP_VARIADIC_TO_TUPLE(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63)) == 64 END +BEGIN BOOST_PP_TUPLE_ELEM(8,BOOST_PP_VARIADIC_TO_TUPLE(7,11,3,8,14,85,56,92,165)) == 165 END +BEGIN BOOST_PP_TUPLE_ELEM(27,BOOST_PP_VARIADIC_TO_TUPLE(VDATA_LARGE)) == 27 END + +#endif |