test_is_number.cxx 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  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_number.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 (4,241,zzz)
  14. #define JDATA somevalue
  15. #define KDATA 213
  16. #define A_SEQ (num)(78)(42)
  17. #define A_LIST (eeb,(grist,(152,BOOST_PP_NIL)))
  18. BOOST_TEST(!BOOST_VMD_IS_NUMBER(BOOST_PP_TUPLE_ELEM(2,A_TUPLE)));
  19. BOOST_TEST(BOOST_VMD_IS_NUMBER(BOOST_PP_TUPLE_ELEM(1,A_TUPLE)));
  20. BOOST_TEST(!BOOST_VMD_IS_NUMBER(JDATA));
  21. BOOST_TEST(BOOST_VMD_IS_NUMBER(KDATA));
  22. BOOST_TEST(!BOOST_VMD_IS_NUMBER(BOOST_PP_SEQ_ELEM(0,A_SEQ)));
  23. BOOST_TEST(BOOST_VMD_IS_NUMBER(BOOST_PP_SEQ_ELEM(2,A_SEQ)));
  24. BOOST_TEST(!BOOST_VMD_IS_NUMBER(BOOST_PP_LIST_AT(A_LIST,0)));
  25. BOOST_TEST(BOOST_VMD_IS_NUMBER(BOOST_PP_LIST_AT(A_LIST,2)));
  26. BOOST_TEST(!BOOST_VMD_IS_NUMBER(BOOST_PP_LIST_AT(A_LIST,1)));
  27. BOOST_TEST(!BOOST_VMD_IS_NUMBER((XXX)));
  28. BOOST_TEST(!BOOST_VMD_IS_NUMBER());
  29. #else
  30. BOOST_ERROR("No variadic macro support");
  31. #endif
  32. return boost::report_errors();
  33. }