| 1 | // Copyright 2021 Peter Dimov |
| 2 | // Distributed under the Boost Software License, Version 1.0. |
| 3 | // https://www.boost.org/LICENSE_1_0.txt |
| 4 | |
| 5 | #include <boost/describe/detail/pp_utilities.hpp> |
| 6 | #include <boost/describe/detail/config.hpp> |
| 7 | #include <boost/core/lightweight_test.hpp> |
| 8 | |
| 9 | #if !defined(BOOST_DESCRIBE_CXX11) |
| 10 | |
| 11 | #include <boost/config/pragma_message.hpp> |
| 12 | |
| 13 | BOOST_PRAGMA_MESSAGE("Skipping test because C++11 is not available" ) |
| 14 | int main() {} |
| 15 | |
| 16 | #else |
| 17 | |
| 18 | #define S(x) S2(x) |
| 19 | #define S2(x) S3(x) |
| 20 | #define S3(x) #x |
| 21 | |
| 22 | char const * s1 = S((BOOST_DESCRIBE_PP_PARSE(x))); |
| 23 | char const * s2 = S((BOOST_DESCRIBE_PP_PARSE(() y))); |
| 24 | char const * s3 = S((BOOST_DESCRIBE_PP_PARSE((a) z))); |
| 25 | char const * s4 = S((BOOST_DESCRIBE_PP_PARSE((a, b) w))); |
| 26 | |
| 27 | int main() |
| 28 | { |
| 29 | BOOST_TEST_CSTR_EQ( s1, "(0, ~, x)" ); |
| 30 | BOOST_TEST_CSTR_EQ( s2, "(1, (), y)" ); |
| 31 | BOOST_TEST_CSTR_EQ( s3, "(1, (a), z)" ); |
| 32 | BOOST_TEST_CSTR_EQ( s4, "(1, (a, b), w)" ); |
| 33 | |
| 34 | return boost::report_errors(); |
| 35 | } |
| 36 | |
| 37 | #endif // !defined(BOOST_DESCRIBE_CXX11) |
| 38 | |