test_after_seq_elem.cxx 2.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. // (C) Copyright Edward Diener 2011-2015
  2. // Use, modification and distribution are subject to the Boost Software License,
  3. // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
  4. // http://www.boost.org/LICENSE_1_0.txt).
  5. #include <boost/vmd/elem.hpp>
  6. #include <boost/vmd/is_empty.hpp>
  7. #include <boost/detail/lightweight_test.hpp>
  8. #include <boost/preprocessor/tuple/elem.hpp>
  9. int main()
  10. {
  11. #if BOOST_PP_VARIADICS
  12. #define BOOST_VMD_REGISTER_ggh (ggh)
  13. #define ANIDENTIFIER ggh
  14. #define ANUMBER 249
  15. #define ASEQ (25)(26)(27)
  16. #define ASEQ2 (75)(76)(77)
  17. #define ASEQ3 (147)(148)(149)
  18. #define ASEQ5 (221)(222)(223)
  19. #define ATUPLE (0,1,2,3,((a,b))((c,d))((e))((f,g,h)))
  20. #define ALIST (0,(1,(2,(3,BOOST_PP_NIL))))
  21. #define ANARRAY (3,(a,b,38))
  22. #define ANARRAY2 (5,(c,d,133,22,15))
  23. #define ASEQUENCE ANUMBER ALIST ATUPLE ANIDENTIFIER ANARRAY ASEQ
  24. #define ASEQUENCE2 ANIDENTIFIER ANARRAY2 ALIST ASEQ2 ATUPLE
  25. #define ASEQUENCE3 ASEQ3 ANIDENTIFIER ATUPLE ALIST
  26. #define ASEQUENCE4
  27. #define ASEQUENCE5 ALIST ASEQ5 ATUPLE ANIDENTIFIER
  28. #define A_SEQ_PLUS (mmf)(34)(^^)(!) 456
  29. #define PLUS_ASEQ yyt (j)(ii%)
  30. #define JDATA ggh
  31. #define KDATA (a)(b) name
  32. #define A_SEQ (25)(26)(27) 33
  33. #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)
  34. BOOST_TEST(BOOST_VMD_IS_EMPTY(BOOST_VMD_ELEM(5,ASEQUENCE,BOOST_VMD_RETURN_ONLY_AFTER,BOOST_VMD_TYPE_SEQ)));
  35. BOOST_TEST(!BOOST_VMD_IS_EMPTY(BOOST_VMD_ELEM(3,ASEQUENCE2,BOOST_VMD_RETURN_ONLY_AFTER,BOOST_VMD_TYPE_SEQ)));
  36. BOOST_TEST(!BOOST_VMD_IS_EMPTY(BOOST_VMD_ELEM(0,ASEQUENCE3,BOOST_VMD_RETURN_ONLY_AFTER,BOOST_VMD_TYPE_SEQ)));
  37. BOOST_TEST(BOOST_VMD_IS_EMPTY(BOOST_VMD_ELEM(0,ASEQUENCE4,BOOST_VMD_RETURN_ONLY_AFTER,BOOST_VMD_TYPE_SEQ)));
  38. BOOST_TEST(!BOOST_VMD_IS_EMPTY(BOOST_VMD_ELEM(1,ASEQUENCE5,BOOST_VMD_RETURN_ONLY_AFTER,BOOST_VMD_TYPE_SEQ)));
  39. BOOST_TEST(BOOST_VMD_IS_EMPTY(BOOST_VMD_ELEM(0,anything,BOOST_VMD_RETURN_ONLY_AFTER,BOOST_VMD_TYPE_SEQ)));
  40. BOOST_TEST_EQ(BOOST_VMD_ELEM(0,A_SEQ_PLUS,BOOST_VMD_RETURN_ONLY_AFTER,BOOST_VMD_TYPE_SEQ),456);
  41. BOOST_TEST(BOOST_VMD_IS_EMPTY(BOOST_VMD_ELEM(0,PLUS_ASEQ,BOOST_VMD_RETURN_ONLY_AFTER,BOOST_VMD_TYPE_SEQ)));
  42. BOOST_TEST(BOOST_VMD_IS_EMPTY(BOOST_VMD_ELEM(0,JDATA,BOOST_VMD_RETURN_ONLY_AFTER,BOOST_VMD_TYPE_SEQ)));
  43. BOOST_TEST(!BOOST_VMD_IS_EMPTY(BOOST_VMD_ELEM(0,KDATA,BOOST_VMD_RETURN_ONLY_AFTER,BOOST_VMD_TYPE_SEQ)));
  44. BOOST_TEST_EQ(BOOST_VMD_ELEM(0,A_SEQ,BOOST_VMD_RETURN_ONLY_AFTER,BOOST_VMD_TYPE_SEQ),33);
  45. 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)));
  46. #else
  47. BOOST_ERROR("No variadic macro support");
  48. #endif
  49. return boost::report_errors();
  50. }