]>
git.proxmox.com Git - ceph.git/blob - ceph/src/boost/libs/beast/test/beast/_experimental/stream.cpp
2 // Copyright (c) 2016-2019 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/_experimental/test/stream.hpp>
13 #include <boost/beast/_experimental/unit_test/suite.hpp>
14 #include <boost/beast/_experimental/test/handler.hpp>
20 : public unit_test::suite
27 net::mutable_buffer m0
;
28 net::mutable_buffer
m1(buf
, sizeof(buf
));
42 auto t2
= connect(t1
);
46 auto t2
= connect(t1
);
54 ts
.async_read_some(m1
,
55 [](error_code
, std::size_t)
65 ts
.async_read_some(m1
,
67 net::error::operation_aborted
));
74 ts
.async_read_some(m1
,
76 net::error::operation_aborted
));
83 auto t2
= connect(t1
);
84 t1
.async_read_some(m1
,
93 auto t2
= connect(t1
);
94 t1
.async_read_some(m1
,
96 net::error::operation_aborted
));
107 std::shared_ptr
<test::stream
> ts_
;
110 operator()(error_code
, std::size_t)
116 net::mutable_buffer
m1(buf
, sizeof(buf
));
118 std::weak_ptr
<test::stream
> wp
;
123 auto sp
= std::make_shared
<test::stream
>(ioc
);
125 sp
->async_read_some(m1
, handler
{sp
});
129 BEAST_EXPECT(! wp
.lock());
133 testLifetimeViolation()
135 // This should assert
136 std::shared_ptr
<test::stream
> sp
;
139 sp
= std::make_shared
<test::stream
>(ioc
);
149 //testLifetimeViolation();
153 BEAST_DEFINE_TESTSUITE(beast
,test
,stream
);