lib cleanup

[SVN r15689]
This commit is contained in:
Paul Mensonides
2002-10-03 22:04:13 +00:00
parent 7856c3b759
commit ae584c68b2
126 changed files with 565 additions and 7981 deletions

View File

@ -1,69 +0,0 @@
/* 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_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
TEST_B BOOST_PP_SUB(11,0) == 11 TEST_E
TEST_B BOOST_PP_SUB(12,1) == 11 TEST_E
TEST_B BOOST_PP_SUB(3,4) == 0 TEST_E
TEST_B BOOST_PP_MUL(0,1) == 0 TEST_E
TEST_B BOOST_PP_MUL(1,0) == 0 TEST_E
TEST_B BOOST_PP_MUL(1,1) == 1 TEST_E
TEST_B BOOST_PP_MUL(4,3) == 12 TEST_E
TEST_B BOOST_PP_DIV(2,1) == 2 TEST_E
TEST_B BOOST_PP_DIV(0,5) == 0 TEST_E
TEST_B BOOST_PP_DIV(7,3) == 2 TEST_E
TEST_B BOOST_PP_EQUAL(1,0) == 0 TEST_E
TEST_B BOOST_PP_EQUAL(10,10) == 1 TEST_E
TEST_B BOOST_PP_NOT_EQUAL(3,4) == 1 TEST_E
TEST_B BOOST_PP_NOT_EQUAL(7,7) == 0 TEST_E
TEST_B BOOST_PP_LESS_EQUAL(6,7) == 1 TEST_E
TEST_B BOOST_PP_LESS_EQUAL(8,1) == 0 TEST_E
TEST_B BOOST_PP_LESS_EQUAL(5,5) == 1 TEST_E
TEST_B BOOST_PP_GREATER_EQUAL(6,7) == 0 TEST_E
TEST_B BOOST_PP_GREATER_EQUAL(10,10) == 1 TEST_E
TEST_B BOOST_PP_GREATER_EQUAL(8,1) == 1 TEST_E
TEST_B BOOST_PP_LESS(2,1) == 0 TEST_E
TEST_B BOOST_PP_LESS(1,1) == 0 TEST_E
TEST_B BOOST_PP_LESS(1,2) == 1 TEST_E
TEST_B BOOST_PP_GREATER(2,1) == 1 TEST_E
TEST_B BOOST_PP_GREATER(1,1) == 0 TEST_E
TEST_B BOOST_PP_GREATER(1,2) == 0 TEST_E
TEST_B BOOST_PP_MIN(1,0) == 0 TEST_E
TEST_B BOOST_PP_MIN(1,2) == 1 TEST_E
TEST_B BOOST_PP_MAX(3,2) == 3 TEST_E
TEST_B BOOST_PP_MAX(4,5) == 5 TEST_E
TEST_B BOOST_PP_MOD(5,5) == 0 TEST_E
TEST_B BOOST_PP_MOD(9,5) == 4 TEST_E
TEST_B BOOST_PP_MOD(7,4) == 3 TEST_E

View File

@ -1,28 +0,0 @@
/* 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
#endif
#define C(D,X) X
#define F(D,X) BOOST_PP_DEC(X)
#define I(D,X) -X
TEST_B (FOR_TEST_MAX*(FOR_TEST_MAX+1)/2)+1 BOOST_PP_FOR(FOR_TEST_MAX,C,F,I) TEST_E

View File

@ -1,57 +0,0 @@
/* 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>
#include <boost/preprocessor/arithmetic/add.hpp>
#include <boost/preprocessor/arithmetic/sub.hpp>
#include <boost/preprocessor/comparison/less.hpp>
#include <libs/preprocessor/test/test.hpp>
/* *** */
#define TEST_LIST BOOST_PP_TUPLE_TO_LIST(4,(4,1,5,2))
TEST_B BOOST_PP_LIST_FOLD_LEFT(BOOST_PP_SUB_D,22,TEST_LIST) == 10 TEST_E
TEST_B BOOST_PP_LIST_CAT(BOOST_PP_LIST_REVERSE(TEST_LIST)) == 2514 TEST_E
TEST_B BOOST_PP_LIST_FOLD_RIGHT(BOOST_PP_SUB_D,TEST_LIST,0) == 4 TEST_E
TEST_B BOOST_PP_LIST_CAT(BOOST_PP_LIST_REST_N(2,TEST_LIST)) == 52 TEST_E
TEST_B BOOST_PP_LIST_CAT(BOOST_PP_LIST_FIRST_N(2,TEST_LIST)) == 41 TEST_E
TEST_B BOOST_PP_LIST_AT(TEST_LIST,2) == 5 TEST_E
TEST_B BOOST_PP_LIST_SIZE(TEST_LIST) == 4 TEST_E
TEST_B BOOST_PP_LIST_CAT(BOOST_PP_LIST_TRANSFORM(BOOST_PP_ADD_D,2,TEST_LIST)) == 6374 TEST_E
TEST_B BOOST_PP_LIST_CAT(BOOST_PP_LIST_APPEND(BOOST_PP_LIST_REST(TEST_LIST),TEST_LIST)) == 1524152 TEST_E
#define F(I,P,X) +X+P
TEST_B BOOST_PP_LIST_FOR_EACH(F,1,TEST_LIST) == 16 TEST_E
#undef F
TEST_B BOOST_PP_TUPLE_ELEM(4,3,BOOST_PP_LIST_TO_TUPLE(TEST_LIST)) == 2 TEST_E
TEST_B BOOST_PP_LIST_CAT(BOOST_PP_LIST_FILTER(BOOST_PP_LESS_D,3,TEST_LIST)) == 45 TEST_E
#define F(R,X) +BOOST_PP_TUPLE_ELEM(2,0,X)+2-BOOST_PP_TUPLE_ELEM(2,1,X)
TEST_B BOOST_PP_LIST_FOR_EACH_PRODUCT(F,2,(BOOST_PP_TUPLE_TO_LIST(2,(1,0)),BOOST_PP_TUPLE_TO_LIST(2,(2,3)))) == 0 TEST_E
#undef F
TEST_B BOOST_PP_LIST_CAT(BOOST_PP_LIST_FOLD_RIGHT(BOOST_PP_LIST_APPEND_D,
BOOST_PP_TUPLE_TO_LIST(3,
(BOOST_PP_TUPLE_TO_LIST(2,(0,x)),
BOOST_PP_TUPLE_TO_LIST(4,(A,1,B,2)),
BOOST_PP_TUPLE_TO_LIST(3,(C,3,D)))),
BOOST_PP_LIST_NIL)) == 0xA1B2C3D TEST_E

View File

@ -1,40 +0,0 @@
/* 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_B BOOST_PP_NOT(0) == 1 TEST_E
TEST_B BOOST_PP_NOT(2) == 0 TEST_E
TEST_B BOOST_PP_AND(0,0) == 0 TEST_E
TEST_B BOOST_PP_AND(0,3) == 0 TEST_E
TEST_B BOOST_PP_AND(4,0) == 0 TEST_E
TEST_B BOOST_PP_AND(5,6) == 1 TEST_E
TEST_B BOOST_PP_OR(0,0) == 0 TEST_E
TEST_B BOOST_PP_OR(0,7) == 1 TEST_E
TEST_B BOOST_PP_OR(8,0) == 1 TEST_E
TEST_B BOOST_PP_OR(9,1) == 1 TEST_E
TEST_B BOOST_PP_XOR(0,0) == 0 TEST_E
TEST_B BOOST_PP_XOR(0,2) == 1 TEST_E
TEST_B BOOST_PP_XOR(3,0) == 1 TEST_E
TEST_B BOOST_PP_XOR(4,5) == 0 TEST_E
TEST_B BOOST_PP_NOR(0,0) == 1 TEST_E
TEST_B BOOST_PP_NOR(0,6) == 0 TEST_E
TEST_B BOOST_PP_NOR(7,0) == 0 TEST_E
TEST_B BOOST_PP_NOR(8,9) == 0 TEST_E

View File

@ -1,57 +0,0 @@
/* 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/identity.hpp>
#include <boost/preprocessor/if.hpp>
#include <boost/preprocessor/expr_if.hpp>
#include <boost/preprocessor/cat.hpp>
#include <boost/preprocessor/stringize.hpp>
#include <boost/preprocessor/tuple/elem.hpp>
#include <libs/preprocessor/test/test.hpp>
/* *** */
struct Container
{
#define BOOST_PP_DEF(CV)\
CV() int& operator[](int i) CV();
BOOST_PP_DEF(BOOST_PP_EMPTY)
BOOST_PP_DEF(BOOST_PP_IDENTITY(const))
BOOST_PP_DEF(BOOST_PP_IDENTITY(volatile))
BOOST_PP_DEF(BOOST_PP_IDENTITY(const volatile))
#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
/* *** */
TEST_B BOOST_PP_EXPR_IF(1,1) TEST_E
/* *** */
TEST_B BOOST_PP_CAT(BOOST_PP_IF(1,tru,fals), e) TEST_E
/* *** */
char stringize_test[3] = BOOST_PP_STRINGIZE(__LINE__);
/* *** */
TEST_B BOOST_PP_TUPLE_ELEM(2,0,(1,0)) TEST_E

View File

@ -1,62 +0,0 @@
/* 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_from_to.hpp>
#include <libs/preprocessor/test/test.hpp>
/* *** */
/* RATIONALE:
* - BOOST_PP_REPEAT, BOOST_PP_ENUM, BOOST_PP_REPEAT_FROM_TO and must work
* recursively 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(BOOST_PP_INC(IS_FUNCTION_HELPER_TEST_MAX),IS_FUNCTION_HELPER,A)
#undef IS_FUNCTION_HELPER
/* *** */
#define ELEM(_,X) X
#define COL(I,_) - BOOST_PP_TUPLE_ELEM(2,0,(BOOST_PP_ENUM(2,ELEM,I)))
#define ROW(I,_) BOOST_PP_REPEAT(I,COL,_)
TEST_B 0 == (1 +1+2 +1+2+3) BOOST_PP_REPEAT_FROM_TO(2,5,ROW,_) TEST_E
#undef ROW
#undef COL
#undef ELEM

View File

@ -1,56 +0,0 @@
/* 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>
#include <boost/preprocessor/repeat_from_to.hpp>
#include <libs/preprocessor/test/test.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) BOOST_PP_CAT(A,I) = I
const int BOOST_PP_ENUM(ENUM_PARAMS_TEST_MAX, CONSTANT, default_param_);
#undef CONSTANT
#define TEST_ENUM_PARAMS(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_ENUM_PARAMS(0)
TEST_ENUM_PARAMS(ENUM_PARAMS_TEST_MAX)
#undef TEST_ENUM_PARAMS
template<BOOST_PP_ENUM_PARAMS(ENUM_PARAMS_TEST_MAX,class T)>
struct no_rescan;
/* *** */
#define F(I,P) P I
TEST_B 1 + (4+5+6) BOOST_PP_REPEAT_FROM_TO(4,7,F,-) TEST_E
#undef F

View File

@ -1,28 +0,0 @@
#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>
/* 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];
#define MACRO(X) X
#define MACRO_ARGS(X) (X)
#endif

View File

@ -1,12 +0,0 @@
/* Copyright (C) 2002 Vesa Karvonen
*
* 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.
*/
/* This simply attempts to include all preprocessor library headers. */
#include <boost/preprocessor.hpp>