mirror of
https://github.com/boostorg/preprocessor.git
synced 2025-07-13 20:46:34 +02:00
Split unit test for more fine grained test results
[SVN r12159]
This commit is contained in:
68
test/arithmetic_test.cpp
Normal file
68
test/arithmetic_test.cpp
Normal file
@ -0,0 +1,68 @@
|
|||||||
|
// Copyright (C) 2001
|
||||||
|
// Housemarque Oy
|
||||||
|
// http://www.housemarque.com
|
||||||
|
//
|
||||||
|
// Permission to copy, use, modify, sell and distribute this software is
|
||||||
|
// granted provided this copyright notice appears in all copies. This
|
||||||
|
// software is provided "as is" without express or implied warranty, and
|
||||||
|
// with no claim as to its suitability for any purpose.
|
||||||
|
|
||||||
|
// See http://www.boost.org for most recent version.
|
||||||
|
|
||||||
|
#include <boost/preprocessor/arithmetic.hpp>
|
||||||
|
#include <boost/preprocessor/comparison.hpp>
|
||||||
|
#include <boost/preprocessor/limits.hpp>
|
||||||
|
#include <boost/preprocessor/min.hpp>
|
||||||
|
#include <boost/preprocessor/max.hpp>
|
||||||
|
|
||||||
|
#include <libs/preprocessor/test/test.hpp>
|
||||||
|
|
||||||
|
// ***
|
||||||
|
|
||||||
|
TEST(BOOST_PP_ADD(2,3) == 5)
|
||||||
|
TEST(BOOST_PP_ADD(11,BOOST_PP_SUB(BOOST_PP_LIMIT_MAG,10)) == BOOST_PP_LIMIT_MAG)
|
||||||
|
|
||||||
|
TEST(BOOST_PP_SUB(11,0) == 11)
|
||||||
|
TEST(BOOST_PP_SUB(12,1) == 11)
|
||||||
|
TEST(BOOST_PP_SUB(3,4) == 0)
|
||||||
|
|
||||||
|
TEST(BOOST_PP_MUL(0,1) == 0)
|
||||||
|
TEST(BOOST_PP_MUL(1,0) == 0)
|
||||||
|
TEST(BOOST_PP_MUL(1,1) == 1)
|
||||||
|
TEST(BOOST_PP_MUL(4,3) == 12)
|
||||||
|
|
||||||
|
TEST(BOOST_PP_DIV(2,1) == 2)
|
||||||
|
TEST(BOOST_PP_DIV(0,5) == 0)
|
||||||
|
TEST(BOOST_PP_DIV(7,3) == 2)
|
||||||
|
|
||||||
|
TEST(BOOST_PP_EQUAL(1,0) == 0)
|
||||||
|
TEST(BOOST_PP_EQUAL(10,10) == 1)
|
||||||
|
|
||||||
|
TEST(BOOST_PP_NOT_EQUAL(3,4) == 1)
|
||||||
|
TEST(BOOST_PP_NOT_EQUAL(7,7) == 0)
|
||||||
|
|
||||||
|
TEST(BOOST_PP_LESS_EQUAL(6,7) == 1)
|
||||||
|
TEST(BOOST_PP_LESS_EQUAL(8,1) == 0)
|
||||||
|
TEST(BOOST_PP_LESS_EQUAL(5,5) == 1)
|
||||||
|
|
||||||
|
TEST(BOOST_PP_GREATER_EQUAL(6,7) == 0)
|
||||||
|
TEST(BOOST_PP_GREATER_EQUAL(10,10) == 1)
|
||||||
|
TEST(BOOST_PP_GREATER_EQUAL(8,1) == 1)
|
||||||
|
|
||||||
|
TEST(BOOST_PP_LESS(2,1) == 0)
|
||||||
|
TEST(BOOST_PP_LESS(1,1) == 0)
|
||||||
|
TEST(BOOST_PP_LESS(1,2) == 1)
|
||||||
|
|
||||||
|
TEST(BOOST_PP_GREATER(2,1) == 1)
|
||||||
|
TEST(BOOST_PP_GREATER(1,1) == 0)
|
||||||
|
TEST(BOOST_PP_GREATER(1,2) == 0)
|
||||||
|
|
||||||
|
TEST(BOOST_PP_MIN(1,0) == 0)
|
||||||
|
TEST(BOOST_PP_MIN(1,2) == 1)
|
||||||
|
|
||||||
|
TEST(BOOST_PP_MAX(3,2) == 3)
|
||||||
|
TEST(BOOST_PP_MAX(4,5) == 5)
|
||||||
|
|
||||||
|
TEST(BOOST_PP_MOD(5,5) == 0)
|
||||||
|
TEST(BOOST_PP_MOD(9,5) == 4)
|
||||||
|
TEST(BOOST_PP_MOD(7,4) == 3)
|
34
test/logical_test.cpp
Normal file
34
test/logical_test.cpp
Normal file
@ -0,0 +1,34 @@
|
|||||||
|
// Copyright (C) 2001
|
||||||
|
// Housemarque Oy
|
||||||
|
// http://www.housemarque.com
|
||||||
|
//
|
||||||
|
// Permission to copy, use, modify, sell and distribute this software is
|
||||||
|
// granted provided this copyright notice appears in all copies. This
|
||||||
|
// software is provided "as is" without express or implied warranty, and
|
||||||
|
// with no claim as to its suitability for any purpose.
|
||||||
|
|
||||||
|
// See http://www.boost.org for most recent version.
|
||||||
|
|
||||||
|
#include <boost/preprocessor/logical.hpp>
|
||||||
|
|
||||||
|
#include <libs/preprocessor/test/test.hpp>
|
||||||
|
|
||||||
|
// ***
|
||||||
|
|
||||||
|
TEST(BOOST_PP_NOT(0) == 1)
|
||||||
|
TEST(BOOST_PP_NOT(1) == 0)
|
||||||
|
|
||||||
|
TEST(BOOST_PP_AND(0,0) == 0)
|
||||||
|
TEST(BOOST_PP_AND(0,1) == 0)
|
||||||
|
TEST(BOOST_PP_AND(1,0) == 0)
|
||||||
|
TEST(BOOST_PP_AND(1,1) == 1)
|
||||||
|
|
||||||
|
TEST(BOOST_PP_OR(0,0) == 0)
|
||||||
|
TEST(BOOST_PP_OR(0,1) == 1)
|
||||||
|
TEST(BOOST_PP_OR(1,0) == 1)
|
||||||
|
TEST(BOOST_PP_OR(1,1) == 1)
|
||||||
|
|
||||||
|
TEST(BOOST_PP_XOR(0,0) == 0)
|
||||||
|
TEST(BOOST_PP_XOR(0,1) == 1)
|
||||||
|
TEST(BOOST_PP_XOR(1,0) == 1)
|
||||||
|
TEST(BOOST_PP_XOR(1,1) == 0)
|
@ -9,165 +9,37 @@
|
|||||||
|
|
||||||
// See http://www.boost.org for most recent version.
|
// See http://www.boost.org for most recent version.
|
||||||
|
|
||||||
#include <boost/preprocessor.hpp>
|
#include <boost/preprocessor/empty.hpp>
|
||||||
|
#include <boost/preprocessor/if.hpp>
|
||||||
|
#include <boost/preprocessor/cat.hpp>
|
||||||
|
#include <boost/preprocessor/stringize.hpp>
|
||||||
|
|
||||||
|
#include <libs/preprocessor/test/test.hpp>
|
||||||
|
|
||||||
// ***
|
// ***
|
||||||
|
|
||||||
struct Container
|
struct Container
|
||||||
{
|
{
|
||||||
#define BOOST_PREPROCESSOR_DEF(CV)\
|
#define BOOST_PP_DEF(CV)\
|
||||||
CV int& operator[](int i) CV;
|
CV int& operator[](int i) CV;
|
||||||
|
|
||||||
BOOST_PREPROCESSOR_DEF(BOOST_PREPROCESSOR_EMPTY())
|
BOOST_PP_DEF(BOOST_PP_EMPTY())
|
||||||
BOOST_PREPROCESSOR_DEF(const)
|
BOOST_PP_DEF(const)
|
||||||
BOOST_PREPROCESSOR_DEF(volatile)
|
BOOST_PP_DEF(volatile)
|
||||||
BOOST_PREPROCESSOR_DEF(const volatile)
|
BOOST_PP_DEF(const volatile)
|
||||||
|
|
||||||
#undef BOOST_PREPROCESSOR_DEF
|
#undef BOOST_PP_DEF
|
||||||
};
|
};
|
||||||
|
|
||||||
// ***
|
// ***
|
||||||
|
|
||||||
int test_logic_1[0+(BOOST_PREPROCESSOR_NOT(0) == 1)];
|
TEST(BOOST_PP_IF(BOOST_PP_IF(1,1,1),true,false) &&
|
||||||
int test_logic_2[0+(BOOST_PREPROCESSOR_NOT(1) == 0)];
|
BOOST_PP_IF(BOOST_PP_IF(0,0,0),false,true))
|
||||||
|
|
||||||
int test_logic_3[0+(BOOST_PREPROCESSOR_AND(0,0) == 0)];
|
|
||||||
int test_logic_4[0+(BOOST_PREPROCESSOR_AND(0,1) == 0)];
|
|
||||||
int test_logic_5[0+(BOOST_PREPROCESSOR_AND(1,0) == 0)];
|
|
||||||
int test_logic_6[0+(BOOST_PREPROCESSOR_AND(1,1) == 1)];
|
|
||||||
|
|
||||||
int test_logic_7[0+(BOOST_PREPROCESSOR_OR(0,0) == 0)];
|
|
||||||
int test_logic_8[0+(BOOST_PREPROCESSOR_OR(0,1) == 1)];
|
|
||||||
int test_logic_9[0+(BOOST_PREPROCESSOR_OR(1,0) == 1)];
|
|
||||||
int test_logic_a[0+(BOOST_PREPROCESSOR_OR(1,1) == 1)];
|
|
||||||
|
|
||||||
int test_logic_b[0+(BOOST_PREPROCESSOR_XOR(0,0) == 0)];
|
|
||||||
int test_logic_c[0+(BOOST_PREPROCESSOR_XOR(0,1) == 1)];
|
|
||||||
int test_logic_d[0+(BOOST_PREPROCESSOR_XOR(1,0) == 1)];
|
|
||||||
int test_logic_e[0+(BOOST_PREPROCESSOR_XOR(1,1) == 0)];
|
|
||||||
|
|
||||||
// ***
|
// ***
|
||||||
|
|
||||||
int if_test[
|
TEST(BOOST_PP_CAT(BOOST_PP_IF(1,tru,fals), e))
|
||||||
0+(BOOST_PREPROCESSOR_IF(BOOST_PREPROCESSOR_INC(0),true,false) &&
|
|
||||||
BOOST_PREPROCESSOR_IF(BOOST_PREPROCESSOR_DEC(1),false,true))];
|
|
||||||
|
|
||||||
// ***
|
// ***
|
||||||
|
|
||||||
int cat_test[
|
char stringize_test[4] = BOOST_PP_STRINGIZE(__LINE__);
|
||||||
0+(BOOST_PREPROCESSOR_CAT(BOOST_PREPROCESSOR_IF(1,tru,fals), e))];
|
|
||||||
|
|
||||||
// ***
|
|
||||||
|
|
||||||
char stringize_test[4] = BOOST_PREPROCESSOR_STRINGIZE(__LINE__);
|
|
||||||
|
|
||||||
// ***
|
|
||||||
|
|
||||||
// RATIONALE:
|
|
||||||
// - All forms of ENUM_PARAMS must be tested with 0 and n, where n is
|
|
||||||
// sufficiently large to exceed imaginable usage like. 50 should be
|
|
||||||
// suffient in this case.
|
|
||||||
|
|
||||||
#ifndef ENUM_PARAMS_TEST_MAX
|
|
||||||
#define ENUM_PARAMS_TEST_MAX 50
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#define CONSTANT(I,A) const A##I = I;
|
|
||||||
BOOST_PREPROCESSOR_REPEAT(ENUM_PARAMS_TEST_MAX, CONSTANT, int default_param_)
|
|
||||||
#undef CONSTANT
|
|
||||||
|
|
||||||
#define TEST_ENUM_PARAMS(N)\
|
|
||||||
void BOOST_PREPROCESSOR_CAT(test_enum_params,N)(\
|
|
||||||
BOOST_PREPROCESSOR_ENUM_PARAMS(N, double x));\
|
|
||||||
void BOOST_PREPROCESSOR_CAT(test_enum_params_with_a_default,N)(\
|
|
||||||
BOOST_PREPROCESSOR_ENUM_PARAMS_WITH_A_DEFAULT(N, double x, 0));\
|
|
||||||
void BOOST_PREPROCESSOR_CAT(test_enum_params_with_defaults,N)(\
|
|
||||||
BOOST_PREPROCESSOR_ENUM_PARAMS_WITH_DEFAULTS(N, double x, default_param_));
|
|
||||||
|
|
||||||
TEST_ENUM_PARAMS(0)
|
|
||||||
TEST_ENUM_PARAMS(ENUM_PARAMS_TEST_MAX)
|
|
||||||
|
|
||||||
#undef TEST_ENUM_PARAMS
|
|
||||||
|
|
||||||
// ***
|
|
||||||
|
|
||||||
// RATIONALE:
|
|
||||||
// - BOOST_PREPROCESSOR_REPEAT, BOOST_PREPROCESSOR_REPEAT_2ND, ... must work
|
|
||||||
// together.
|
|
||||||
// - BOOST_PREPROCESSOR_REPEAT is already tested with
|
|
||||||
// BOOST_PREPROCESSOR_ENUM_PARAMS.
|
|
||||||
// - The tested repeat count should exceed imaginable usage.
|
|
||||||
// - Testing the generation of is_function_helper()s upto 40 arguments should
|
|
||||||
// be sufficient in this case. Many compilers may fail the repetition tests
|
|
||||||
// (at least with higher counts). However, the primary purpose of the
|
|
||||||
// repetition primitives is to enable configurability with reasonable
|
|
||||||
// defaults, and not necessarily "the most impressive repetition".
|
|
||||||
// - ENUM_SHIFTED_PARAMS must be tested so that the shifted range is shown to
|
|
||||||
// be correct.
|
|
||||||
|
|
||||||
#ifndef IS_FUNCTION_HELPER_TEST_MAX
|
|
||||||
#define IS_FUNCTION_HELPER_TEST_MAX 40
|
|
||||||
#endif
|
|
||||||
|
|
||||||
typedef char yes_type;
|
|
||||||
|
|
||||||
#define IS_FUNCTION_HELPER(I,A)\
|
|
||||||
template\
|
|
||||||
<BOOST_PREPROCESSOR_ENUM_PARAMS(BOOST_PREPROCESSOR_INC(I),class P)>\
|
|
||||||
yes_type is_function_helper(\
|
|
||||||
P0 (*)(BOOST_PREPROCESSOR_ENUM_SHIFTED_PARAMS(BOOST_PREPROCESSOR_INC(I),P)));
|
|
||||||
|
|
||||||
BOOST_PREPROCESSOR_REPEAT_2ND(BOOST_PREPROCESSOR_INC(IS_FUNCTION_HELPER_TEST_MAX),IS_FUNCTION_HELPER,A)
|
|
||||||
|
|
||||||
#undef IS_FUNCTION_HELPER
|
|
||||||
|
|
||||||
// ***
|
|
||||||
|
|
||||||
int test_arithmetic_1[0+(BOOST_PREPROCESSOR_ADD(2,3)==5)];
|
|
||||||
int test_arithmetic_2[0+(BOOST_PREPROCESSOR_ADD(11,BOOST_PREPROCESSOR_SUB(BOOST_PREPROCESSOR_LIMIT_MAG,10))==BOOST_PREPROCESSOR_LIMIT_MAG)];
|
|
||||||
|
|
||||||
int test_arithmetic_4[0+(BOOST_PREPROCESSOR_SUB(11,0)==11)];
|
|
||||||
int test_arithmetic_5[0+(BOOST_PREPROCESSOR_SUB(12,1)==11)];
|
|
||||||
int test_arithmetic_6[0+(BOOST_PREPROCESSOR_SUB(3,4)==0)];
|
|
||||||
|
|
||||||
int test_arithmetic_7[0+(BOOST_PREPROCESSOR_MUL(0,1)==0)];
|
|
||||||
int test_arithmetic_8[0+(BOOST_PREPROCESSOR_MUL(1,0)==0)];
|
|
||||||
int test_arithmetic_9[0+(BOOST_PREPROCESSOR_MUL(1,1)==1)];
|
|
||||||
int test_arithmetic_10[0+(BOOST_PREPROCESSOR_MUL(4,3)==12)];
|
|
||||||
|
|
||||||
int test_arithmetic_11[0+(BOOST_PREPROCESSOR_DIV(2,1)==2)];
|
|
||||||
int test_arithmetic_12[0+(BOOST_PREPROCESSOR_DIV(0,5)==0)];
|
|
||||||
int test_arithmetic_13[0+(BOOST_PREPROCESSOR_DIV(7,3)==2)];
|
|
||||||
|
|
||||||
int test_arithmetic_15[0+(BOOST_PREPROCESSOR_EQUAL(1,0)==0)];
|
|
||||||
int test_arithmetic_16[0+(BOOST_PREPROCESSOR_EQUAL(10,10)==1)];
|
|
||||||
int test_arithmetic_17[0+(BOOST_PREPROCESSOR_NOT_EQUAL(3,4)==1)];
|
|
||||||
int test_arithmetic_18[0+(BOOST_PREPROCESSOR_NOT_EQUAL(7,7)==0)];
|
|
||||||
int test_arithmetic_19[0+(BOOST_PREPROCESSOR_LESS_EQUAL(6,7)==1)];
|
|
||||||
int test_arithmetic_20[0+(BOOST_PREPROCESSOR_LESS_EQUAL(8,1)==0)];
|
|
||||||
int test_arithmetic_21[0+(BOOST_PREPROCESSOR_LESS_EQUAL(5,5)==1)];
|
|
||||||
int test_arithmetic_22[0+(BOOST_PREPROCESSOR_GREATER_EQUAL(6,7)==0)];
|
|
||||||
int test_arithmetic_23[0+(BOOST_PREPROCESSOR_GREATER_EQUAL(10,10)==1)];
|
|
||||||
int test_arithmetic_24[0+(BOOST_PREPROCESSOR_GREATER_EQUAL(8,1)==1)];
|
|
||||||
int test_arithmetic_25[0+(BOOST_PREPROCESSOR_LESS(2,1)==0)];
|
|
||||||
int test_arithmetic_26[0+(BOOST_PREPROCESSOR_LESS(1,1)==0)];
|
|
||||||
int test_arithmetic_27[0+(BOOST_PREPROCESSOR_LESS(1,2)==1)];
|
|
||||||
int test_arithmetic_28[0+(BOOST_PREPROCESSOR_GREATER(2,1)==1)];
|
|
||||||
int test_arithmetic_29[0+(BOOST_PREPROCESSOR_GREATER(1,1)==0)];
|
|
||||||
int test_arithmetic_30[0+(BOOST_PREPROCESSOR_GREATER(1,2)==0)];
|
|
||||||
|
|
||||||
int test_arithmetic_31[0+(BOOST_PREPROCESSOR_MIN(1,0)==0)];
|
|
||||||
int test_arithmetic_32[0+(BOOST_PREPROCESSOR_MIN(1,2)==1)];
|
|
||||||
int test_arithmetic_33[0+(BOOST_PREPROCESSOR_MAX(3,2)==3)];
|
|
||||||
int test_arithmetic_34[0+(BOOST_PREPROCESSOR_MAX(4,5)==5)];
|
|
||||||
|
|
||||||
int test_arithmetic_35[0+(BOOST_PREPROCESSOR_MOD(5,5)==0)];
|
|
||||||
int test_arithmetic_36[0+(BOOST_PREPROCESSOR_MOD(9,5)==4)];
|
|
||||||
int test_arithmetic_37[0+(BOOST_PREPROCESSOR_MOD(7,4)==3)];
|
|
||||||
|
|
||||||
// ***
|
|
||||||
|
|
||||||
int
|
|
||||||
main()
|
|
||||||
{ return 0;
|
|
||||||
}
|
|
||||||
|
47
test/repeat_2nd_test.cpp
Normal file
47
test/repeat_2nd_test.cpp
Normal file
@ -0,0 +1,47 @@
|
|||||||
|
// Copyright (C) 2001
|
||||||
|
// Housemarque Oy
|
||||||
|
// http://www.housemarque.com
|
||||||
|
//
|
||||||
|
// Permission to copy, use, modify, sell and distribute this software is
|
||||||
|
// granted provided this copyright notice appears in all copies. This
|
||||||
|
// software is provided "as is" without express or implied warranty, and
|
||||||
|
// with no claim as to its suitability for any purpose.
|
||||||
|
|
||||||
|
// See http://www.boost.org for most recent version.
|
||||||
|
|
||||||
|
#include <boost/preprocessor/enum_params.hpp>
|
||||||
|
#include <boost/preprocessor/enum_shifted_params.hpp>
|
||||||
|
#include <boost/preprocessor/inc.hpp>
|
||||||
|
#include <boost/preprocessor/repeat_2nd.hpp>
|
||||||
|
|
||||||
|
// ***
|
||||||
|
|
||||||
|
// RATIONALE:
|
||||||
|
// - BOOST_PP_REPEAT, BOOST_PP_REPEAT_2ND, ... must work
|
||||||
|
// together.
|
||||||
|
// - BOOST_PP_REPEAT is already tested with
|
||||||
|
// BOOST_PP_ENUM_PARAMS.
|
||||||
|
// - The tested repeat count should exceed imaginable usage.
|
||||||
|
// - Testing the generation of is_function_helper()s upto 40 arguments should
|
||||||
|
// be sufficient in this case. Many compilers may fail the repetition tests
|
||||||
|
// (at least with higher counts). However, the primary purpose of the
|
||||||
|
// repetition primitives is to enable configurability with reasonable
|
||||||
|
// defaults, and not necessarily "the most impressive repetition".
|
||||||
|
// - ENUM_SHIFTED_PARAMS must be tested so that the shifted range is shown to
|
||||||
|
// be correct.
|
||||||
|
|
||||||
|
#ifndef IS_FUNCTION_HELPER_TEST_MAX
|
||||||
|
#define IS_FUNCTION_HELPER_TEST_MAX 40
|
||||||
|
#endif
|
||||||
|
|
||||||
|
typedef char yes_type;
|
||||||
|
|
||||||
|
#define IS_FUNCTION_HELPER(I,A)\
|
||||||
|
template\
|
||||||
|
<BOOST_PP_ENUM_PARAMS(BOOST_PP_INC(I),class P)>\
|
||||||
|
yes_type is_function_helper(\
|
||||||
|
P0 (*)(BOOST_PP_ENUM_SHIFTED_PARAMS(BOOST_PP_INC(I),P)));
|
||||||
|
|
||||||
|
BOOST_PP_REPEAT_2ND(BOOST_PP_INC(IS_FUNCTION_HELPER_TEST_MAX),IS_FUNCTION_HELPER,A)
|
||||||
|
|
||||||
|
#undef IS_FUNCTION_HELPER
|
43
test/repeat_test.cpp
Normal file
43
test/repeat_test.cpp
Normal file
@ -0,0 +1,43 @@
|
|||||||
|
// Copyright (C) 2001
|
||||||
|
// Housemarque Oy
|
||||||
|
// http://www.housemarque.com
|
||||||
|
//
|
||||||
|
// Permission to copy, use, modify, sell and distribute this software is
|
||||||
|
// granted provided this copyright notice appears in all copies. This
|
||||||
|
// software is provided "as is" without express or implied warranty, and
|
||||||
|
// with no claim as to its suitability for any purpose.
|
||||||
|
|
||||||
|
// See http://www.boost.org for most recent version.
|
||||||
|
|
||||||
|
#include <boost/preprocessor/cat.hpp>
|
||||||
|
#include <boost/preprocessor/enum_params.hpp>
|
||||||
|
#include <boost/preprocessor/enum_params_with_a_default.hpp>
|
||||||
|
#include <boost/preprocessor/enum_params_with_defaults.hpp>
|
||||||
|
|
||||||
|
// ***
|
||||||
|
|
||||||
|
// RATIONALE:
|
||||||
|
// - All forms of ENUM_PARAMS must be tested with 0 and n, where n is
|
||||||
|
// sufficiently large to exceed imaginable usage like. 50 should be
|
||||||
|
// suffient in this case.
|
||||||
|
|
||||||
|
#ifndef ENUM_PARAMS_TEST_MAX
|
||||||
|
#define ENUM_PARAMS_TEST_MAX 50
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#define CONSTANT(I,A) const A##I = I;
|
||||||
|
BOOST_PP_REPEAT(ENUM_PARAMS_TEST_MAX, CONSTANT, int default_param_)
|
||||||
|
#undef CONSTANT
|
||||||
|
|
||||||
|
#define TEST_ENUM_PARAMS(N)\
|
||||||
|
void BOOST_PP_CAT(test_enum_params,N)(\
|
||||||
|
BOOST_PP_ENUM_PARAMS(N, double x));\
|
||||||
|
void BOOST_PP_CAT(test_enum_params_with_a_default,N)(\
|
||||||
|
BOOST_PP_ENUM_PARAMS_WITH_A_DEFAULT(N, double x, 0));\
|
||||||
|
void BOOST_PP_CAT(test_enum_params_with_defaults,N)(\
|
||||||
|
BOOST_PP_ENUM_PARAMS_WITH_DEFAULTS(N, double x, default_param_));
|
||||||
|
|
||||||
|
TEST_ENUM_PARAMS(0)
|
||||||
|
TEST_ENUM_PARAMS(ENUM_PARAMS_TEST_MAX)
|
||||||
|
|
||||||
|
#undef TEST_ENUM_PARAMS
|
18
test/test.hpp
Normal file
18
test/test.hpp
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
#ifndef BOOST_LIBS_PREPROCESSOR_TEST_TEST_HPP
|
||||||
|
#define BOOST_LIBS_PREPROCESSOR_TEST_TEST_HPP
|
||||||
|
|
||||||
|
// Copyright (C) 2001
|
||||||
|
// Housemarque Oy
|
||||||
|
// http://www.housemarque.com
|
||||||
|
//
|
||||||
|
// Permission to copy, use, modify, sell and distribute this software is
|
||||||
|
// granted provided this copyright notice appears in all copies. This
|
||||||
|
// software is provided "as is" without express or implied warranty, and
|
||||||
|
// with no claim as to its suitability for any purpose.
|
||||||
|
|
||||||
|
// See http://www.boost.org for most recent version.
|
||||||
|
|
||||||
|
#include <boost/preprocessor/cat.hpp>
|
||||||
|
|
||||||
|
#define TEST(C) typedef BOOST_PP_CAT(test_,__LINE__)[((C)==1) ? 1 : -1];
|
||||||
|
#endif
|
Reference in New Issue
Block a user