helper_macros_test.cpp 746 B

123456789101112131415161718192021222324252627282930
  1. // Copyright 2017 Peter Dimov.
  2. //
  3. // Distributed under the Boost Software License, Version 1.0.
  4. //
  5. // See accompanying file LICENSE_1_0.txt or copy at
  6. // http://www.boost.org/LICENSE_1_0.txt
  7. #include <boost/config/helper_macros.hpp>
  8. #include <boost/core/lightweight_test.hpp>
  9. int main()
  10. {
  11. #define X pumpkin
  12. BOOST_TEST_CSTR_EQ( BOOST_STRINGIZE(X), "pumpkin" );
  13. BOOST_TEST_CSTR_EQ( BOOST_STRINGIZE(__LINE__), "16" );
  14. #define Y 2
  15. int BOOST_JOIN(X, Y) = 0;
  16. (void)pumpkin2;
  17. int BOOST_JOIN(X, __LINE__) = 0;
  18. (void)pumpkin23;
  19. BOOST_TEST_CSTR_EQ( BOOST_STRINGIZE(BOOST_JOIN(X, Y)), "pumpkin2" );
  20. BOOST_TEST_CSTR_EQ( BOOST_STRINGIZE(BOOST_JOIN(X, __LINE__)), "pumpkin27" );
  21. return boost::report_errors();
  22. }