• 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/config.hpp>
7 
8 #if BOOST_METAPARSE_STD >= 2011
9 
10 #include <boost/metaparse/v1/cpp11/impl/concat.hpp>
11 #include <boost/metaparse/string.hpp>
12 
13 #include <boost/mpl/equal_to.hpp>
14 #include <boost/mpl/char.hpp>
15 #include <boost/mpl/assert.hpp>
16 
17 #include "test_case.hpp"
18 
BOOST_METAPARSE_TEST_CASE(concat)19 BOOST_METAPARSE_TEST_CASE(concat)
20 {
21   using boost::metaparse::v1::impl::concat;
22   using boost::metaparse::string;
23 
24   using boost::mpl::equal_to;
25 
26   typedef string<> empty;
27   typedef string<'h','e','l','l','o'> hello;
28 
29   // test_empty_empty
30   BOOST_MPL_ASSERT((equal_to<empty, concat<empty, empty>::type>));
31 
32   // test_empty_hello
33   BOOST_MPL_ASSERT((equal_to<hello, concat<empty, hello>::type>));
34 
35   // test_hello_empty
36   BOOST_MPL_ASSERT((equal_to<hello, concat<hello, empty>::type>));
37 
38   // test_hello_hello
39   BOOST_MPL_ASSERT((
40     equal_to<
41       string<'h','e','l','l','o','h','e','l','l','o'>,
42       concat<hello, hello>::type
43     >
44   ));
45 }
46 
47 #endif
48 
49