forked from boostorg/preprocessor
Somewhat more C friendly. Some tests use templates.
[SVN r12553]
This commit is contained in:
@ -1,13 +1,14 @@
|
||||
// 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.
|
||||
/* 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>
|
||||
@ -17,7 +18,7 @@
|
||||
|
||||
#include <libs/preprocessor/test/test.hpp>
|
||||
|
||||
// ***
|
||||
/* *** */
|
||||
|
||||
TEST_B BOOST_PP_ADD(2,3) == 5 TEST_E
|
||||
TEST_B BOOST_PP_ADD(21,BOOST_PP_SUB(BOOST_PP_LIMIT_MAG,20)) == BOOST_PP_LIMIT_MAG TEST_E
|
||||
|
@ -1,20 +1,21 @@
|
||||
// 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.
|
||||
/* 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/for.hpp>
|
||||
#include <boost/preprocessor/dec.hpp>
|
||||
|
||||
#include <libs/preprocessor/test/test.hpp>
|
||||
|
||||
// ***
|
||||
/* *** */
|
||||
|
||||
#ifndef FOR_TEST_MAX
|
||||
#define FOR_TEST_MAX 50
|
||||
|
@ -1,13 +1,14 @@
|
||||
// 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.
|
||||
/* 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/list.hpp>
|
||||
#include <boost/preprocessor/tuple/to_list.hpp>
|
||||
@ -17,7 +18,7 @@
|
||||
|
||||
#include <libs/preprocessor/test/test.hpp>
|
||||
|
||||
// ***
|
||||
/* *** */
|
||||
|
||||
#define TEST_LIST BOOST_PP_TUPLE_TO_LIST(4,(4,1,5,2))
|
||||
|
||||
|
@ -1,19 +1,20 @@
|
||||
// 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.
|
||||
/* 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>
|
||||
|
||||
// ***
|
||||
/* *** */
|
||||
|
||||
#if !(!defined(BOOST_NO_COMPILER_CONFIG) && defined(__MWERKS__) && __MWERKS__ <= 0x2406)
|
||||
TEST_B BOOST_PP_NOT(MACRO MACRO_ARGS(0)) == 1 TEST_E
|
||||
|
@ -1,13 +1,14 @@
|
||||
// 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.
|
||||
/* 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/empty.hpp>
|
||||
#include <boost/preprocessor/if.hpp>
|
||||
@ -16,7 +17,7 @@
|
||||
|
||||
#include <libs/preprocessor/test/test.hpp>
|
||||
|
||||
// ***
|
||||
/* *** */
|
||||
|
||||
struct Container
|
||||
{
|
||||
@ -31,23 +32,23 @@ struct Container
|
||||
#undef BOOST_PP_DEF
|
||||
};
|
||||
|
||||
// ***
|
||||
/* *** */
|
||||
|
||||
TEST_B BOOST_PP_IF(BOOST_PP_IF(1,1,1),true,false) &&
|
||||
BOOST_PP_IF(BOOST_PP_IF(0,0,0),false,true) TEST_E
|
||||
|
||||
// ***
|
||||
/* *** */
|
||||
|
||||
#if !(!defined(BOOST_NO_COMPILER_CONFIG) && defined(__MWERKS__) && __MWERKS__ <= 0x2406)
|
||||
TEST_B BOOST_PP_CAT(BOOST_PP_IF(1,tru,fals), MACRO MACRO_ARGS(e)) TEST_E
|
||||
#endif
|
||||
|
||||
// ***
|
||||
/* *** */
|
||||
|
||||
#if !(!defined(BOOST_NO_COMPILER_CONFIG) && defined(__MWERKS__) && __MWERKS__ <= 0x2406)
|
||||
char stringize_test[2] = BOOST_PP_STRINGIZE(MACRO MACRO_ARGS(X));
|
||||
#endif
|
||||
|
||||
// ***
|
||||
/* *** */
|
||||
|
||||
TEST_B BOOST_PP_TUPLE_ELEM(2,0,(1,0)) TEST_E
|
||||
|
@ -1,34 +1,36 @@
|
||||
// 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.
|
||||
/* 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.
|
||||
/* 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
|
||||
|
@ -1,25 +1,27 @@
|
||||
// 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.
|
||||
/* 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.
|
||||
/* 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
|
||||
|
@ -1,23 +1,25 @@
|
||||
#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.
|
||||
/* 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>
|
||||
|
||||
// The TEST macro has been broken into two pieces to avoid
|
||||
// double expansion:
|
||||
// 1. as a macro argument
|
||||
// 2. rescan
|
||||
/* The TEST macro has been broken into two pieces to avoid
|
||||
* double expansion:
|
||||
* 1. as a macro argument
|
||||
* 2. rescan
|
||||
*/
|
||||
#define TEST_B typedef int BOOST_PP_CAT(test_,__LINE__)[((
|
||||
#define TEST_E )==1) ? 1 : -1];
|
||||
|
||||
|
Reference in New Issue
Block a user