test_is_type.cxx 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839
  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/is_type.hpp>
  6. #include <boost/detail/lightweight_test.hpp>
  7. #include <boost/preprocessor/list/at.hpp>
  8. #include <boost/preprocessor/seq/elem.hpp>
  9. #include <boost/preprocessor/tuple/elem.hpp>
  10. int main()
  11. {
  12. #if BOOST_PP_VARIADICS
  13. #define A_TUPLE (*,#,BOOST_VMD_TYPE_ARRAY)
  14. #define JDATA BOOST_VMD_TYPE_LIST
  15. #define KDATA 222
  16. #define A_SEQ (BOOST_VMD_TYPE_TUPLE)(-)(#)
  17. #define A_LIST (BOOST_VMD_TYPE_SEQ,(BOOST_VMD_TYPE_EMPTY,(&,BOOST_PP_NIL)))
  18. BOOST_TEST(BOOST_VMD_IS_TYPE(BOOST_PP_TUPLE_ELEM(2,A_TUPLE)));
  19. BOOST_TEST(BOOST_VMD_IS_TYPE(JDATA));
  20. BOOST_TEST(BOOST_VMD_IS_TYPE(BOOST_PP_SEQ_ELEM(0,A_SEQ)));
  21. BOOST_TEST(BOOST_VMD_IS_TYPE(BOOST_PP_LIST_AT(A_LIST,0)));
  22. BOOST_TEST(BOOST_VMD_IS_TYPE(BOOST_PP_LIST_AT(A_LIST,1)));
  23. BOOST_TEST(!BOOST_VMD_IS_TYPE(KDATA));
  24. #else
  25. BOOST_ERROR("No variadic macro support");
  26. #endif
  27. return boost::report_errors();
  28. }