]> git.proxmox.com Git - ceph.git/blob - ceph/src/boost/libs/vmd/test/test_sequence_elem.cxx
add subtree-ish sources for 12.0.3
[ceph.git] / ceph / src / boost / libs / vmd / test / test_sequence_elem.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/is_identifier.hpp>
8 #include <boost/vmd/is_empty.hpp>
9 #include <boost/vmd/is_number.hpp>
10 #include <boost/vmd/elem.hpp>
11 #include <boost/vmd/is_type.hpp>
12 #include <boost/vmd/equal.hpp>
13 #include <boost/detail/lightweight_test.hpp>
14 #include <boost/preprocessor/seq/elem.hpp>
15 #include <boost/preprocessor/tuple/elem.hpp>
16
17 int main()
18 {
19
20 #if BOOST_PP_VARIADICS
21
22 #define BOOST_VMD_REGISTER_ggh (ggh)
23 #define BOOST_VMD_DETECT_ggh_ggh
24 #define BOOST_VMD_REGISTER_dvd (dvd)
25 #define BOOST_VMD_DETECT_dvd_dvd
26
27 #define ANIDENTIFIER ggh
28 #define ANIDENTIFIER2 dvd
29 #define ANUMBER 249
30 #define ANUMBER2 17
31 #define ASEQ (25)(26)(27)
32 #define ATUPLE (0,1,2,3,((a,b))((c,d))((e))((f,g,h)))
33 #define ALIST (0,(1,(2,(3,BOOST_PP_NIL))))
34 #define ANARRAY (3,(a,b,38))
35 #define ATYPE BOOST_VMD_TYPE_LIST
36 #define ASEQUENCE ANUMBER ALIST ATUPLE ANIDENTIFIER ANARRAY ASEQ
37 #define ASEQUENCE2 ANIDENTIFIER2 ASEQ ALIST ANUMBER ATUPLE
38 #define ASEQUENCE3 ATYPE ASEQ ANUMBER2 ATUPLE
39 #define ASEQUENCE4
40
41 BOOST_TEST_EQ(BOOST_PP_TUPLE_ELEM(2,BOOST_PP_TUPLE_ELEM(1,BOOST_VMD_ELEM(2,ASEQUENCE3,BOOST_VMD_RETURN_TYPE,BOOST_VMD_RETURN_AFTER))),2);
42 BOOST_TEST_EQ(BOOST_PP_SEQ_ELEM(0,BOOST_PP_TUPLE_ELEM(1,BOOST_PP_TUPLE_ELEM(0,BOOST_VMD_ELEM(1,ASEQUENCE2,BOOST_VMD_RETURN_TYPE,BOOST_VMD_RETURN_AFTER)))),25);
43 BOOST_TEST(BOOST_VMD_IS_IDENTIFIER(BOOST_VMD_ELEM(0,BOOST_PP_TUPLE_ELEM(1,BOOST_VMD_ELEM(2,ASEQUENCE,BOOST_VMD_RETURN_TYPE,BOOST_VMD_RETURN_AFTER)),BOOST_VMD_TYPE_IDENTIFIER)));
44 BOOST_TEST(BOOST_VMD_IS_EMPTY(BOOST_PP_TUPLE_ELEM(0,BOOST_VMD_ELEM(2,ASEQUENCE4,BOOST_VMD_RETURN_TYPE,BOOST_VMD_RETURN_AFTER))));
45
46 BOOST_TEST_EQ(BOOST_PP_TUPLE_ELEM(2,BOOST_PP_TUPLE_ELEM(0,BOOST_VMD_ELEM(2,ASEQUENCE,BOOST_VMD_RETURN_AFTER))),2);
47 BOOST_TEST_EQ(BOOST_PP_SEQ_ELEM(0,BOOST_PP_TUPLE_ELEM(0,BOOST_VMD_ELEM(1,ASEQUENCE2,BOOST_VMD_RETURN_AFTER))),25);
48 BOOST_TEST(BOOST_VMD_IS_NUMBER(BOOST_VMD_ELEM(0,BOOST_PP_TUPLE_ELEM(1,BOOST_VMD_ELEM(1,ASEQUENCE3,BOOST_VMD_RETURN_AFTER)),BOOST_VMD_TYPE_NUMBER)));
49 BOOST_TEST(BOOST_VMD_IS_EMPTY(BOOST_PP_TUPLE_ELEM(0,BOOST_VMD_ELEM(0,ASEQUENCE4,BOOST_VMD_RETURN_AFTER))));
50
51 BOOST_TEST(BOOST_VMD_EQUAL(BOOST_PP_TUPLE_ELEM(0,BOOST_VMD_ELEM(4,ASEQUENCE,BOOST_VMD_RETURN_TYPE)),BOOST_VMD_TYPE_ARRAY,BOOST_VMD_TYPE_TYPE));
52 BOOST_TEST_EQ(BOOST_PP_TUPLE_ELEM(1,BOOST_VMD_ELEM(3,ASEQUENCE2,BOOST_VMD_RETURN_TYPE)),249);
53 BOOST_TEST_EQ(BOOST_PP_SEQ_ELEM(2,BOOST_PP_TUPLE_ELEM(1,BOOST_VMD_ELEM(1,ASEQUENCE3,BOOST_VMD_RETURN_TYPE))),27);
54 BOOST_TEST(BOOST_VMD_IS_EMPTY(BOOST_VMD_ELEM(4,ASEQUENCE3,BOOST_VMD_RETURN_TYPE)));
55
56 BOOST_TEST(BOOST_VMD_IS_IDENTIFIER(BOOST_VMD_ELEM(3,ASEQUENCE),(tvt,aaa,ggh)));
57 BOOST_TEST_EQ(BOOST_PP_TUPLE_ELEM(3,BOOST_VMD_ELEM(4,ASEQUENCE2)),3);
58 BOOST_TEST_EQ(BOOST_PP_SEQ_ELEM(0,BOOST_VMD_ELEM(1,ASEQUENCE3)),25);
59 BOOST_TEST(BOOST_VMD_IS_EMPTY(BOOST_VMD_ELEM(0,ASEQUENCE4)));
60
61 BOOST_TEST(BOOST_VMD_IS_TYPE(BOOST_VMD_ELEM(0,ASEQUENCE3)));
62 BOOST_TEST(BOOST_VMD_EQUAL(BOOST_PP_TUPLE_ELEM(0,BOOST_VMD_ELEM(0,ASEQUENCE3,BOOST_VMD_RETURN_TYPE)),BOOST_VMD_TYPE_TYPE,BOOST_VMD_TYPE_TYPE));
63
64 #else
65
66 BOOST_ERROR("No variadic macro support");
67
68 #endif
69
70 return boost::report_errors();
71
72 }