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 
6 #include <boost/metaparse/config.hpp>
7 #if BOOST_METAPARSE_STD < 2011
8 
9 #include <boost/metaparse/v1/cpp98/impl/update_c.hpp>
10 #include <boost/metaparse/string.hpp>
11 
12 #include <boost/mpl/equal_to.hpp>
13 #include <boost/mpl/assert.hpp>
14 
15 #include "test_case.hpp"
16 
BOOST_METAPARSE_TEST_CASE(update_c)17 BOOST_METAPARSE_TEST_CASE(update_c)
18 {
19   using boost::metaparse::v1::impl::update_c;
20   using boost::metaparse::string;
21 
22   using boost::mpl::equal_to;
23 
24   typedef string<'h','e','l','l','o'> hello;
25 
26   // test_update_first_char
27   BOOST_MPL_ASSERT((
28     equal_to<string<'x','e','l','l','o'>, update_c<hello, 0, 'x'>::type>
29   ));
30 
31   // test_update_middle_char
32   BOOST_MPL_ASSERT((
33     equal_to<string<'h','e','x','l','o'>, update_c<hello, 2, 'x'>::type>
34   ));
35 
36   // test_update_last_char
37   BOOST_MPL_ASSERT((
38     equal_to<string<'h','e','l','l','x'>, update_c<hello, 4, 'x'>::type>
39   ));
40 }
41 
42 #endif
43 
44