• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 # /* **************************************************************************
2 #  *                                                                          *
3 #  *     (C) Copyright Paul Mensonides 2002.
4 #  *     Distributed under the Boost Software License, Version 1.0. (See
5 #  *     accompanying file LICENSE_1_0.txt or copy at
6 #  *     http://www.boost.org/LICENSE_1_0.txt)
7 #  *                                                                          *
8 #  ************************************************************************** */
9 #
10 # /* See http://www.boost.org for most recent version. */
11 #
12 # include <boost/preprocessor/cat.hpp>
13 # include <boost/preprocessor/facilities.hpp>
14 # include <boost/preprocessor/arithmetic/add.hpp>
15 # include <boost/preprocessor/arithmetic/mul.hpp>
16 # include <libs/preprocessor/test/test.h>
17 
18 BEGIN BOOST_PP_APPLY(BOOST_PP_NIL) 0 == 0 END
19 BEGIN BOOST_PP_APPLY((0)) == 0 END
20 
21 BEGIN BOOST_PP_APPLY((BOOST_PP_EMPTY))() 0 == 0 END
22 
23 # define MACRO(x, y, z) 1
24 # define ARGS (1, 2, 3)
25 
26 BEGIN BOOST_PP_EXPAND(MACRO ARGS) == 1 END
27 
28 BEGIN BOOST_PP_IDENTITY(1)() == 1 END
29 BEGIN BOOST_PP_IDENTITY_N(36,10)(0,1,2,3,4,5,6,7,8,9) == 36 END
30 
31 BEGIN BOOST_PP_CAT(BOOST_PP_INTERCEPT, 2) 1 == 1 END
32 
33 #if BOOST_PP_VARIADICS
34 
35 #define OVMAC_1(x) BOOST_PP_ADD(x,5)
36 #define OVMAC_2(x,y) BOOST_PP_ADD(x,y)
37 #define OVMAC_3(x,y,z) BOOST_PP_ADD(BOOST_PP_MUL(x,y),z)
38 #define OVMAC_4(x,y,z,a) BOOST_PP_ADD(BOOST_PP_MUL(x,y),BOOST_PP_MUL(a,z))
39 
40 #if BOOST_PP_VARIADICS_MSVC
41 
42 #define OVTEST(...) BOOST_PP_CAT(BOOST_PP_OVERLOAD(OVMAC_,__VA_ARGS__)(__VA_ARGS__),BOOST_PP_EMPTY())
43 
44 #else
45 
46 #define OVTEST(...) BOOST_PP_OVERLOAD(OVMAC_,__VA_ARGS__)(__VA_ARGS__)
47 
48 #endif
49 
50 BEGIN OVTEST(3,4,5) == 17 END
51 BEGIN OVTEST(9,3,2,7) == 41 END
52 BEGIN OVTEST(8) == 13 END
53 BEGIN OVTEST(24,61) == 85 END
54 
55 #endif
56