checkempty.cxx 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. # /* **************************************************************************
  2. # * *
  3. # * (C) Copyright Edward Diener 2019.
  4. # * Distributed under the Boost Software License, Version 1.0. (See
  5. # * accompanying file LICENSE_1_0.txt or copy at
  6. # * http://www.boost.org/LICENSE_1_0.txt)
  7. # * *
  8. # ************************************************************************** */
  9. #
  10. # /* See http://www.boost.org for most recent version. */
  11. #
  12. # include <libs/preprocessor/test/test.h>
  13. # include <boost/preprocessor/facilities/check_empty.hpp>
  14. # if BOOST_PP_VARIADIC_HAS_OPT()
  15. # include <boost/preprocessor/facilities/empty.hpp>
  16. #define DATA
  17. #define OBJECT OBJECT2
  18. #define OBJECT2
  19. #define FUNC(x) FUNC2(x)
  20. #define FUNC2(x)
  21. #define FUNC_GEN() ()
  22. #define FUNC_GEN2(x) ()
  23. #define FUNC_GEN3() (&)
  24. #define FUNC_GEN4(x) (y)
  25. #define FUNC_GEN5() (y,z)
  26. #define FUNC_GEN6() anything
  27. #define FUNC_GEN7(x) anything
  28. #define FUNC_GEN8(x,y) (1,2,3)
  29. #define FUNC_GEN9(x,y,z) anything
  30. #define FUNC_GEN10(x) (y) data
  31. #define NAME &name
  32. #define ATUPLE (atuple)
  33. #define ATUPLE_PLUS (atuple) data
  34. BEGIN BOOST_PP_CHECK_EMPTY(FUNC_GEN) == 0 END
  35. BEGIN BOOST_PP_CHECK_EMPTY(FUNC_GEN2) == 0 END
  36. BEGIN BOOST_PP_CHECK_EMPTY(FUNC_GEN3) == 0 END
  37. BEGIN BOOST_PP_CHECK_EMPTY(FUNC_GEN4) == 0 END
  38. BEGIN BOOST_PP_CHECK_EMPTY(FUNC_GEN5) == 0 END
  39. BEGIN BOOST_PP_CHECK_EMPTY(FUNC_GEN8) == 0 END
  40. BEGIN BOOST_PP_CHECK_EMPTY(FUNC_GEN9) == 0 END
  41. BEGIN BOOST_PP_CHECK_EMPTY(FUNC_GEN10) == 0 END
  42. BEGIN BOOST_PP_CHECK_EMPTY(BOOST_PP_EMPTY()) == 1 END
  43. BEGIN BOOST_PP_CHECK_EMPTY(DATA BOOST_PP_EMPTY()) == 1 END
  44. BEGIN BOOST_PP_CHECK_EMPTY(x BOOST_PP_EMPTY()) == 0 END
  45. BEGIN BOOST_PP_CHECK_EMPTY(OBJECT BOOST_PP_EMPTY()) == 1 END
  46. BEGIN BOOST_PP_CHECK_EMPTY(FUNC(z) BOOST_PP_EMPTY()) == 1 END
  47. BEGIN BOOST_PP_CHECK_EMPTY(FUNC_GEN6) == 0 END
  48. BEGIN BOOST_PP_CHECK_EMPTY(FUNC_GEN7) == 0 END
  49. BEGIN BOOST_PP_CHECK_EMPTY(NAME) == 0 END
  50. BEGIN BOOST_PP_CHECK_EMPTY(ATUPLE) == 0 END
  51. BEGIN BOOST_PP_CHECK_EMPTY(ATUPLE_PLUS) == 0 END
  52. # else
  53. BEGIN 1 == 1 END
  54. # endif