]>
git.proxmox.com Git - ceph.git/blob - ceph/src/boost/libs/vmd/test/test_sequence_to_tuple.cxx
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).
7 #include <boost/vmd/is_empty.hpp>
8 #include <boost/vmd/is_list.hpp>
9 #include <boost/vmd/to_tuple.hpp>
10 #include <boost/vmd/equal.hpp>
11 #include <boost/detail/lightweight_test.hpp>
12 #include <boost/preprocessor/seq/elem.hpp>
13 #include <boost/preprocessor/tuple/elem.hpp>
18 #if BOOST_PP_VARIADICS
20 #define BOOST_VMD_REGISTER_ggh (ggh)
21 #define BOOST_VMD_DETECT_ggh_ggh
22 #define BOOST_VMD_REGISTER_dvd (dvd)
23 #define BOOST_VMD_DETECT_dvd_dvd
25 #define ANIDENTIFIER ggh
26 #define ANIDENTIFIER2 dvd
29 #define ASEQ (25)(26)(27)
30 #define ATUPLE (0,1,2,3,((a,b))((c,d))((e))((f,g,h)))
31 #define ALIST (0,(1,(2,(3,BOOST_PP_NIL))))
32 #define ANARRAY (3,(a,b,38))
33 #define ASEQUENCE ANUMBER ALIST ATUPLE ANIDENTIFIER ANARRAY ASEQ
34 #define ASEQUENCE2 ANIDENTIFIER2 ASEQ ALIST ANUMBER ATUPLE
35 #define ASEQUENCE3 ASEQ ANUMBER2 ATUPLE
40 BOOST_TEST(BOOST_VMD_EQUAL(BOOST_PP_TUPLE_ELEM(0,BOOST_PP_TUPLE_ELEM(2,BOOST_VMD_TO_TUPLE(ASEQUENCE3
,BOOST_VMD_RETURN_TYPE
))),BOOST_VMD_TYPE_TUPLE
,BOOST_VMD_TYPE_TYPE
));
41 BOOST_TEST(BOOST_VMD_IS_EMPTY(BOOST_VMD_TO_TUPLE(ASEQUENCE4
,BOOST_VMD_RETURN_TYPE
)));
42 BOOST_TEST_EQ(BOOST_PP_SEQ_ELEM(2,BOOST_PP_TUPLE_ELEM(1,BOOST_PP_TUPLE_ELEM(1,BOOST_VMD_TO_TUPLE(ASEQUENCE2
,BOOST_VMD_RETURN_TYPE
)))),27);
43 BOOST_TEST_EQ(BOOST_PP_TUPLE_ELEM(1,BOOST_PP_TUPLE_ELEM(0,BOOST_VMD_TO_TUPLE(ASEQUENCE
,BOOST_VMD_RETURN_TYPE
))),249);
47 BOOST_TEST_EQ(BOOST_PP_TUPLE_ELEM(1,BOOST_VMD_TO_TUPLE(ASEQUENCE3
)),17);
48 BOOST_TEST(BOOST_VMD_IS_EMPTY(BOOST_VMD_TO_TUPLE(ASEQUENCE4
)));
49 BOOST_TEST(BOOST_VMD_IS_LIST(BOOST_PP_TUPLE_ELEM(1,BOOST_VMD_TO_TUPLE(ASEQUENCE
))));
50 BOOST_TEST_EQ(BOOST_PP_SEQ_ELEM(2,BOOST_PP_TUPLE_ELEM(1,BOOST_VMD_TO_TUPLE(ASEQUENCE2
))),27);
54 BOOST_ERROR("No variadic macro support");
58 return boost::report_errors();