test_assert_is_identifier.cxx 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  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/assert_is_identifier.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 (*,#,zzz)
  14. #define JDATA somevalue
  15. #define A_SEQ (num)(%)(#)
  16. #define A_LIST (eeb,(grist,(&,BOOST_PP_NIL)))
  17. #define BOOST_VMD_REGISTER_zzz (zzz)
  18. #define BOOST_VMD_DETECT_zzz_zzz
  19. #define BOOST_VMD_REGISTER_somevalue (somevalue)
  20. #define BOOST_VMD_DETECT_somevalue_somevalue
  21. #define BOOST_VMD_REGISTER_num (num)
  22. #define BOOST_VMD_DETECT_num_num
  23. #define BOOST_VMD_REGISTER_eeb (eeb)
  24. #define BOOST_VMD_DETECT_eeb_eeb
  25. #define BOOST_VMD_REGISTER_grist (grist)
  26. #define BOOST_VMD_DETECT_grist_grist
  27. BOOST_VMD_ASSERT_IS_IDENTIFIER(BOOST_PP_TUPLE_ELEM(2,A_TUPLE),zzz)
  28. BOOST_VMD_ASSERT_IS_IDENTIFIER(JDATA,somevalue)
  29. BOOST_VMD_ASSERT_IS_IDENTIFIER(BOOST_PP_SEQ_ELEM(0,A_SEQ),num)
  30. BOOST_VMD_ASSERT_IS_IDENTIFIER(BOOST_PP_LIST_AT(A_LIST,0),eeb)
  31. BOOST_VMD_ASSERT_IS_IDENTIFIER(BOOST_PP_LIST_AT(A_LIST,1),grist)
  32. #else
  33. BOOST_VMD_ASSERT(0)
  34. #endif
  35. return boost::report_errors();
  36. }