]>
git.proxmox.com Git - ceph.git/blob - ceph/src/boost/libs/beast/test/beast/core/string_param.cpp
2 // Copyright (c) 2016-2017 Vinnie Falco (vinnie dot falco at gmail dot com)
4 // Distributed under the Boost Software License, Version 1.0. (See accompanying
5 // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
7 // Official repository: https://github.com/boostorg/beast
10 // Test that header file is self-contained.
11 #include <boost/beast/core/string_param.hpp>
13 #include <boost/beast/unit_test/suite.hpp>
14 #include <boost/beast/core/detail/type_traits.hpp>
19 class string_param_test
: public unit_test::suite
25 check(string_param
const& v
, string_view s
)
27 BEAST_EXPECT(static_cast<string_view
>(v
) == s
);
36 repeater(std::size_t n
)
43 operator<<(std::ostream
& os
, repeater
const& v
)
45 return os
<< std::string(v
.n_
, '*');
52 // Make sure things convert correctly
53 check(std::string("hello"), "hello");
59 check(12345, "12345");
60 check({"a", "b"}, "ab");
61 check({1, 2, 3}, "123");
67 // exercise static_ostream for coverage
68 std::string
s(500, '*');
69 check(repeater
{500}, s
);
80 BEAST_DEFINE_TESTSUITE(beast
,core
,string_param
);