]>
git.proxmox.com Git - ceph.git/blob - ceph/src/boost/libs/beast/test/beast/core/ostream.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/ostream.hpp>
13 #include <boost/beast/core/multi_buffer.hpp>
14 #include <boost/beast/unit_test/suite.hpp>
20 class ostream_test
: public beast::unit_test::suite
23 template<class ConstBufferSequence
>
26 to_string(ConstBufferSequence
const& bs
)
29 s
.reserve(buffer_size(bs
));
30 for(auto b
: beast::detail::buffers_range(bs
))
31 s
.append(reinterpret_cast<
32 char const*>(b
.data()), b
.size());
42 os
<< "Hello, world!\n";
44 BEAST_EXPECT(to_string(b
.data()) == "Hello, world!\n");
45 auto os2
= std::move(os
);
49 "0123456789abcdef" "0123456789abcdef" "0123456789abcdef" "0123456789abcdef"
50 "0123456789abcdef" "0123456789abcdef" "0123456789abcdef" "0123456789abcdef"
51 "0123456789abcdef" "0123456789abcdef" "0123456789abcdef" "0123456789abcdef"
52 "0123456789abcdef" "0123456789abcdef" "0123456789abcdef" "0123456789abcdef"
53 "0123456789abcdef" "0123456789abcdef" "0123456789abcdef" "0123456789abcdef"
54 "0123456789abcdef" "0123456789abcdef" "0123456789abcdef" "0123456789abcdef"
55 "0123456789abcdef" "0123456789abcdef" "0123456789abcdef" "0123456789abcdef"
56 "0123456789abcdef" "0123456789abcdef" "0123456789abcdef" "0123456789abcdef";
59 BEAST_EXPECT(to_string(b
.data()) == s
);
64 BEAST_DEFINE_TESTSUITE(beast
,core
,ostream
);