concat.cpp 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. // Copyright Abel Sinkovics (abel@sinkovics.hu) 2013.
  2. // Distributed under the Boost Software License, Version 1.0.
  3. // (See accompanying file LICENSE_1_0.txt or copy at
  4. // http://www.boost.org/LICENSE_1_0.txt)
  5. #include <boost/metaparse/config.hpp>
  6. #if BOOST_METAPARSE_STD >= 2011
  7. #include <boost/metaparse/v1/cpp11/impl/concat.hpp>
  8. #include <boost/metaparse/string.hpp>
  9. #include <boost/mpl/equal_to.hpp>
  10. #include <boost/mpl/char.hpp>
  11. #include <boost/mpl/assert.hpp>
  12. #include "test_case.hpp"
  13. BOOST_METAPARSE_TEST_CASE(concat)
  14. {
  15. using boost::metaparse::v1::impl::concat;
  16. using boost::metaparse::string;
  17. using boost::mpl::equal_to;
  18. typedef string<> empty;
  19. typedef string<'h','e','l','l','o'> hello;
  20. // test_empty_empty
  21. BOOST_MPL_ASSERT((equal_to<empty, concat<empty, empty>::type>));
  22. // test_empty_hello
  23. BOOST_MPL_ASSERT((equal_to<hello, concat<empty, hello>::type>));
  24. // test_hello_empty
  25. BOOST_MPL_ASSERT((equal_to<hello, concat<hello, empty>::type>));
  26. // test_hello_hello
  27. BOOST_MPL_ASSERT((
  28. equal_to<
  29. string<'h','e','l','l','o','h','e','l','l','o'>,
  30. concat<hello, hello>::type
  31. >
  32. ));
  33. }
  34. #endif