Imported Upstream version 1.72.0
[platform/upstream/boost.git] / libs / vmd / test / test_doc_assert.cxx
1
2 //  (C) Copyright Edward Diener 2011-2015
3 //  Use, modification and distribution are subject to the Boost Software License,
4 //  Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
5 //  http://www.boost.org/LICENSE_1_0.txt).
6
7 #include <boost/vmd/assert_is_tuple.hpp>
8 #include <boost/preprocessor/cat.hpp>
9 #include <boost/preprocessor/comparison/greater.hpp>
10 #include <boost/preprocessor/control/iif.hpp>
11 #include <boost/preprocessor/tuple/size.hpp>
12 #include <boost/detail/lightweight_test.hpp>
13
14 int main()
15   {
16   
17 #if BOOST_PP_VARIADICS
18  
19 #if BOOST_VMD_MSVC
20
21  #define AMACRO(atuple) \
22      BOOST_PP_CAT \
23         ( \
24         BOOST_VMD_ASSERT_IS_TUPLE(atuple), \
25         BOOST_PP_IIF(BOOST_PP_GREATER(BOOST_PP_TUPLE_SIZE(atuple), 2),1,0) \
26         )
27         
28 #else
29
30  #define AMACRO(atuple) \
31      BOOST_VMD_ASSERT_IS_TUPLE(atuple) \
32      BOOST_PP_IIF(BOOST_PP_GREATER(BOOST_PP_TUPLE_SIZE(atuple), 2),1,0)
33      
34 #endif
35
36  BOOST_TEST(AMACRO((1,2,3)));
37  BOOST_TEST(!AMACRO((1,2)));
38  
39 #else
40
41   BOOST_VMD_ASSERT(0)
42   
43 #endif
44
45   return boost::report_errors();
46   
47   }