| 31 | |
| 32 | template<typename Buffer> |
| 33 | void testBuffer() |
| 34 | { |
| 35 | net::io_context ioc; |
| 36 | net::readable_pipe rp{ioc}; |
| 37 | net::writable_pipe wp{ioc}; |
| 38 | net::connect_pipe(rp, wp); |
| 39 | |
| 40 | const char msg[] = "Hello, world!\n"; |
| 41 | |
| 42 | net::async_write(wp, net::buffer(msg), asio::detached); |
| 43 | |
| 44 | Buffer buf; |
| 45 | |
| 46 | net::async_read_until(rp, ref(buf), '\n', asio::detached); |
| 47 | ioc.run(); |
| 48 | // writable, not commited yet! |
| 49 | std::string cmp; |
| 50 | cmp.resize(sizeof(msg) -1); |
| 51 | const auto n = net::buffer_copy(net::buffer(cmp), buf.data()); |
| 52 | BEAST_EXPECT(n >= std::strlen(msg)); |
| 53 | cmp.resize(13); |
| 54 | BEAST_EXPECT(cmp == "Hello, world!"); |
| 55 | |
| 56 | |
| 57 | buf = Buffer(); |
| 58 | test_dynamic_buffer_ref(ref(buf)); |
| 59 | } |
| 60 | |
| 61 | void |
| 62 | run() override |
nothing calls this directly
no test coverage detected