]> git.proxmox.com Git - ceph.git/blob - ceph/src/boost/libs/metaparse/test/remove_trailing_no_chars.cpp
add subtree-ish sources for 12.0.3
[ceph.git] / ceph / src / boost / libs / metaparse / test / remove_trailing_no_chars.cpp
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/remove_trailing_no_chars.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
15 BOOST_METAPARSE_TEST_CASE(remove_trailing_no_chars)
16 {
17 using boost::metaparse::v1::impl::remove_trailing_no_chars;
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_hello
26 BOOST_MPL_ASSERT((equal_to<hello, remove_trailing_no_chars<hello>::type>));
27
28 // test_twice
29 BOOST_MPL_ASSERT((
30 equal_to<
31 hello,
32 remove_trailing_no_chars<remove_trailing_no_chars<hello>::type>::type
33 >
34 ));
35
36 // test_hello_with_no_chars
37 BOOST_MPL_ASSERT((
38 equal_to<
39 hello,
40 remove_trailing_no_chars<
41 string<'h','e','l','l','o', BOOST_NO_CHAR, BOOST_NO_CHAR>
42 >::type
43 >
44 ));
45
46 // test_empty
47 BOOST_MPL_ASSERT((
48 equal_to<string<>, remove_trailing_no_chars<string<> >::type>
49 ));
50
51 // test_empty_with_no_chars
52 BOOST_MPL_ASSERT((
53 equal_to<
54 string<>,
55 remove_trailing_no_chars<string<BOOST_NO_CHAR, BOOST_NO_CHAR> >::type
56 >
57 ));
58 }
59
60