update_c.cpp 1.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  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/cpp98/impl/update_c.hpp>
  8. #include <boost/metaparse/string.hpp>
  9. #include <boost/mpl/equal_to.hpp>
  10. #include <boost/mpl/assert.hpp>
  11. #include "test_case.hpp"
  12. BOOST_METAPARSE_TEST_CASE(update_c)
  13. {
  14. using boost::metaparse::v1::impl::update_c;
  15. using boost::metaparse::string;
  16. using boost::mpl::equal_to;
  17. typedef string<'h','e','l','l','o'> hello;
  18. // test_update_first_char
  19. BOOST_MPL_ASSERT((
  20. equal_to<string<'x','e','l','l','o'>, update_c<hello, 0, 'x'>::type>
  21. ));
  22. // test_update_middle_char
  23. BOOST_MPL_ASSERT((
  24. equal_to<string<'h','e','x','l','o'>, update_c<hello, 2, 'x'>::type>
  25. ));
  26. // test_update_last_char
  27. BOOST_MPL_ASSERT((
  28. equal_to<string<'h','e','l','l','x'>, update_c<hello, 4, 'x'>::type>
  29. ));
  30. }
  31. #endif