From 9e361682af15469d34bbc79a1edc27b1371ae828 Mon Sep 17 00:00:00 2001 From: Vesa Karvonen Date: Tue, 29 Jan 2002 14:28:42 +0000 Subject: [PATCH] Somewhat more C friendly. Some tests use templates. [SVN r12553] --- test/arithmetic_test.cpp | 23 +++++++++--------- test/for_test.cpp | 23 +++++++++--------- test/list_test.cpp | 23 +++++++++--------- test/logical_test.cpp | 23 +++++++++--------- test/preprocessor_test.cpp | 31 +++++++++++------------ test/repeat_2nd_test.cpp | 50 ++++++++++++++++++++------------------ test/repeat_test.cpp | 32 ++++++++++++------------ test/test.hpp | 30 ++++++++++++----------- 8 files changed, 123 insertions(+), 112 deletions(-) diff --git a/test/arithmetic_test.cpp b/test/arithmetic_test.cpp index 14e0935..3e9f520 100644 --- a/test/arithmetic_test.cpp +++ b/test/arithmetic_test.cpp @@ -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 #include @@ -17,7 +18,7 @@ #include -// *** +/* *** */ 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 diff --git a/test/for_test.cpp b/test/for_test.cpp index 2ea30fd..7f6f265 100644 --- a/test/for_test.cpp +++ b/test/for_test.cpp @@ -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 #include #include -// *** +/* *** */ #ifndef FOR_TEST_MAX #define FOR_TEST_MAX 50 diff --git a/test/list_test.cpp b/test/list_test.cpp index e438cb0..363e8cb 100644 --- a/test/list_test.cpp +++ b/test/list_test.cpp @@ -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 #include @@ -17,7 +18,7 @@ #include -// *** +/* *** */ #define TEST_LIST BOOST_PP_TUPLE_TO_LIST(4,(4,1,5,2)) diff --git a/test/logical_test.cpp b/test/logical_test.cpp index 693c252..99c6514 100644 --- a/test/logical_test.cpp +++ b/test/logical_test.cpp @@ -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 #include -// *** +/* *** */ #if !(!defined(BOOST_NO_COMPILER_CONFIG) && defined(__MWERKS__) && __MWERKS__ <= 0x2406) TEST_B BOOST_PP_NOT(MACRO MACRO_ARGS(0)) == 1 TEST_E diff --git a/test/preprocessor_test.cpp b/test/preprocessor_test.cpp index 295a517..eadc039 100644 --- a/test/preprocessor_test.cpp +++ b/test/preprocessor_test.cpp @@ -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 #include @@ -16,7 +17,7 @@ #include -// *** +/* *** */ 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 diff --git a/test/repeat_2nd_test.cpp b/test/repeat_2nd_test.cpp index fe5b9af..e6a9bb7 100644 --- a/test/repeat_2nd_test.cpp +++ b/test/repeat_2nd_test.cpp @@ -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 #include #include #include -// *** +/* *** */ -// 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 diff --git a/test/repeat_test.cpp b/test/repeat_test.cpp index 2b38b58..99e56ea 100644 --- a/test/repeat_test.cpp +++ b/test/repeat_test.cpp @@ -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 #include #include #include -// *** +/* *** */ -// 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 diff --git a/test/test.hpp b/test/test.hpp index b31c6e8..11b5796 100644 --- a/test/test.hpp +++ b/test/test.hpp @@ -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 -// 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];