]>
Commit | Line | Data |
---|---|---|
7c673cae FG |
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/split_at_c.hpp> | |
7 | #include <boost/metaparse/string.hpp> | |
8 | ||
9 | #include <boost/mpl/pair.hpp> | |
10 | #include <boost/mpl/assert.hpp> | |
11 | ||
12 | #include <boost/type_traits/is_same.hpp> | |
13 | ||
14 | #include "test_case.hpp" | |
15 | ||
16 | BOOST_METAPARSE_TEST_CASE(split_at_c) | |
17 | { | |
18 | using boost::metaparse::v1::impl::split_at_c; | |
19 | using boost::metaparse::string; | |
20 | ||
21 | using boost::mpl::pair; | |
22 | ||
23 | using boost::is_same; | |
24 | ||
25 | typedef string<> empty; | |
26 | typedef string<'h','e','l','l','o'> hello; | |
27 | ||
28 | // test_split_in_the_middle | |
29 | BOOST_MPL_ASSERT(( | |
30 | is_same< | |
31 | pair<string<'h','e','l'>, string<'l','o'> >, | |
32 | split_at_c<3, hello>::type | |
33 | > | |
34 | )); | |
35 | ||
36 | // test_split_at_the_beginning | |
37 | BOOST_MPL_ASSERT((is_same<pair<empty, hello>, split_at_c<0, hello>::type>)); | |
38 | ||
39 | // test_split_at_the_end | |
40 | BOOST_MPL_ASSERT((is_same<pair<hello, empty>, split_at_c<5, hello>::type>)); | |
41 | } | |
42 | ||
43 |