• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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/v1/impl/at_c.hpp>
7 #include <boost/metaparse/string.hpp>
8 
9 #include <boost/mpl/equal_to.hpp>
10 #include <boost/mpl/char.hpp>
11 #include <boost/mpl/assert.hpp>
12 
13 #include "test_case.hpp"
14 
BOOST_METAPARSE_TEST_CASE(at_c)15 BOOST_METAPARSE_TEST_CASE(at_c)
16 {
17   using boost::metaparse::v1::impl::at_c;
18   using boost::metaparse::string;
19 
20   using boost::mpl::equal_to;
21   using boost::mpl::char_;
22 
23   typedef string<'h','e','l','l','o'> hello;
24 
25   // test_first_char
26   BOOST_MPL_ASSERT((equal_to<char_<'h'>, at_c<hello, 0>::type>));
27 
28   // test_middle_char
29   BOOST_MPL_ASSERT((equal_to<char_<'l'>, at_c<hello, 2>::type>));
30 
31   // test_last_char
32   BOOST_MPL_ASSERT((equal_to<char_<'o'>, at_c<hello, 4>::type>));
33 }
34 
35 
36