• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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/elem.hpp>
8 #include <boost/vmd/is_empty.hpp>
9 #include <boost/detail/lightweight_test.hpp>
10 #include <boost/preprocessor/tuple/elem.hpp>
11 
main()12 int main()
13   {
14 
15 #if BOOST_PP_VARIADICS
16 
17   #define BOOST_VMD_REGISTER_ggh (ggh)
18 
19   #define ANIDENTIFIER ggh
20   #define ANUMBER 249
21   #define ASEQ (25)(26)(27)
22   #define ASEQ2 (75)(76)(77)
23   #define ASEQ3 (147)(148)(149)
24   #define ASEQ5 (221)(222)(223)
25   #define ATUPLE (0,1,2,3,((a,b))((c,d))((e))((f,g,h)))
26   #define ALIST (0,(1,(2,(3,BOOST_PP_NIL))))
27   #define ANARRAY (3,(a,b,38))
28   #define ANARRAY2 (5,(c,d,133,22,15))
29   #define ASEQUENCE ANUMBER ALIST ATUPLE ANIDENTIFIER ANARRAY ASEQ
30   #define ASEQUENCE2 ANIDENTIFIER ANARRAY2 ALIST ASEQ2 ATUPLE
31   #define ASEQUENCE3 ASEQ3 ANIDENTIFIER ATUPLE ALIST
32   #define ASEQUENCE4
33   #define ASEQUENCE5 ALIST ASEQ5 ATUPLE ANIDENTIFIER
34 
35   #define A_SEQ_PLUS (mmf)(34)(^^)(!) 456
36   #define PLUS_ASEQ yyt (j)(ii%)
37   #define JDATA ggh
38   #define KDATA (a)(b) name
39   #define A_SEQ (25)(26)(27) 33
40   #define ATUPLE2 (0,1,2,3,((VMD_TEST_88_,VMD_TEST_1_))((VMD_TEST_99_,VMD_TEST_3_))((VMD_TEST_2_))((VMD_TEST_99_,VMD_TEST_100_,VMD_TEST_101_)) gene)
41 
42   BOOST_TEST(BOOST_VMD_IS_EMPTY(BOOST_VMD_ELEM(5,ASEQUENCE,BOOST_VMD_RETURN_ONLY_AFTER,BOOST_VMD_TYPE_SEQ)));
43   BOOST_TEST(!BOOST_VMD_IS_EMPTY(BOOST_VMD_ELEM(3,ASEQUENCE2,BOOST_VMD_RETURN_ONLY_AFTER,BOOST_VMD_TYPE_SEQ)));
44   BOOST_TEST(!BOOST_VMD_IS_EMPTY(BOOST_VMD_ELEM(0,ASEQUENCE3,BOOST_VMD_RETURN_ONLY_AFTER,BOOST_VMD_TYPE_SEQ)));
45   BOOST_TEST(BOOST_VMD_IS_EMPTY(BOOST_VMD_ELEM(0,ASEQUENCE4,BOOST_VMD_RETURN_ONLY_AFTER,BOOST_VMD_TYPE_SEQ)));
46   BOOST_TEST(!BOOST_VMD_IS_EMPTY(BOOST_VMD_ELEM(1,ASEQUENCE5,BOOST_VMD_RETURN_ONLY_AFTER,BOOST_VMD_TYPE_SEQ)));
47 
48   BOOST_TEST(BOOST_VMD_IS_EMPTY(BOOST_VMD_ELEM(0,anything,BOOST_VMD_RETURN_ONLY_AFTER,BOOST_VMD_TYPE_SEQ)));
49   BOOST_TEST_EQ(BOOST_VMD_ELEM(0,A_SEQ_PLUS,BOOST_VMD_RETURN_ONLY_AFTER,BOOST_VMD_TYPE_SEQ),456);
50   BOOST_TEST(BOOST_VMD_IS_EMPTY(BOOST_VMD_ELEM(0,PLUS_ASEQ,BOOST_VMD_RETURN_ONLY_AFTER,BOOST_VMD_TYPE_SEQ)));
51   BOOST_TEST(BOOST_VMD_IS_EMPTY(BOOST_VMD_ELEM(0,JDATA,BOOST_VMD_RETURN_ONLY_AFTER,BOOST_VMD_TYPE_SEQ)));
52   BOOST_TEST(!BOOST_VMD_IS_EMPTY(BOOST_VMD_ELEM(0,KDATA,BOOST_VMD_RETURN_ONLY_AFTER,BOOST_VMD_TYPE_SEQ)));
53   BOOST_TEST_EQ(BOOST_VMD_ELEM(0,A_SEQ,BOOST_VMD_RETURN_ONLY_AFTER,BOOST_VMD_TYPE_SEQ),33);
54   BOOST_TEST(!BOOST_VMD_IS_EMPTY(BOOST_VMD_ELEM(0,BOOST_PP_TUPLE_ELEM(4,ATUPLE2),BOOST_VMD_RETURN_ONLY_AFTER,BOOST_VMD_TYPE_SEQ)));
55 
56 #else
57 
58 BOOST_ERROR("No variadic macro support");
59 
60 #endif
61 
62   return boost::report_errors();
63 
64   }
65