]> git.proxmox.com Git - ceph.git/blob - ceph/src/boost/libs/metaparse/test/BOOST_METAPARSE_STRING.cpp
add subtree-ish sources for 12.0.3
[ceph.git] / ceph / src / boost / libs / metaparse / test / BOOST_METAPARSE_STRING.cpp
1 // Copyright Abel Sinkovics (abel@sinkovics.hu) 2016.
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 #define BOOST_METAPARSE_LIMIT_STRING_SIZE 4
7
8 #include <boost/type_traits/is_same.hpp>
9
10 #include "common.hpp"
11 #include "test_case.hpp"
12 #include "string_macros.hpp"
13
14 #include <boost/metaparse/string.hpp>
15
16 #ifndef BOOST_METAPARSE_V1_CONFIG_NO_BOOST_METAPARSE_STRING
17
18 using boost::metaparse::string;
19 using boost::is_same;
20
21 BOOST_METAPARSE_TEST_CASE(string_macro)
22 {
23 BOOST_MPL_ASSERT((
24 is_same<string<'a', 'b', 'c', 'd'>, BOOST_METAPARSE_STRING("abcd")>
25 ));
26 }
27
28 #undef BOOST_METAPARSE_LIMIT_STRING_SIZE
29 #define BOOST_METAPARSE_LIMIT_STRING_SIZE 8
30
31 BOOST_METAPARSE_TEST_CASE(string_macro_redefined_length_limit)
32 {
33 BOOST_MPL_ASSERT((
34 is_same<string<'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h'>,
35 BOOST_METAPARSE_STRING("abcdefgh")>
36 ));
37 }
38
39 #undef BOOST_METAPARSE_LIMIT_STRING_SIZE
40 #define BOOST_METAPARSE_LIMIT_STRING_SIZE 127
41
42 BOOST_METAPARSE_TEST_CASE(creating_long_string_with_macro)
43 {
44 BOOST_MPL_ASSERT((
45 is_same<
46 string<
47 BOOST_METAPARSE_TEST_CHARS_100,
48 BOOST_METAPARSE_TEST_CHARS_10,
49 BOOST_METAPARSE_TEST_CHARS_10,
50 '0', '1', '2', '3', '4', '5', '6'
51 >,
52 BOOST_METAPARSE_STRING(
53 BOOST_METAPARSE_TEST_STRING_100
54 BOOST_METAPARSE_TEST_STRING_10
55 BOOST_METAPARSE_TEST_STRING_10
56 "0123456"
57 )
58 >
59 ));
60 }
61
62 #endif
63