MCPcopy Create free account
hub / github.com/boostorg/asio / test

Function test

test/windows/stream_handle.cpp:41–145  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

39}
40
41void test()
42{
43#if defined(BOOST_ASIO_HAS_WINDOWS_STREAM_HANDLE)
44 using namespace boost::asio;
45 namespace win = boost::asio::windows;
46
47 try
48 {
49 io_context ioc;
50 const io_context::executor_type ioc_ex = ioc.get_executor();
51 char mutable_char_buffer[128] = "";
52 const char const_char_buffer[128] = "";
53 archetypes::lazy_handler lazy;
54 boost::system::error_code ec;
55
56 // basic_stream_handle constructors.
57
58 win::stream_handle handle1(ioc);
59 HANDLE native_handle1 = INVALID_HANDLE_VALUE;
60#if defined(BOOST_ASIO_MSVC) && (_MSC_VER < 1910)
61 // Skip this on older MSVC due to mysterious ambiguous overload errors.
62#else
63 win::stream_handle handle2(ioc, native_handle1);
64#endif
65
66 win::stream_handle handle3(ioc_ex);
67 HANDLE native_handle2 = INVALID_HANDLE_VALUE;
68 win::stream_handle handle4(ioc_ex, native_handle2);
69
70 win::stream_handle handle5(std::move(handle4));
71
72 win::basic_stream_handle<io_context::executor_type> handle6(ioc);
73 win::stream_handle handle7(std::move(handle6));
74
75 // basic_stream_handle operators.
76
77 handle1 = win::stream_handle(ioc);
78 handle1 = std::move(handle4);
79 handle1 = std::move(handle6);
80
81 // I/O object functions.
82
83 windows::stream_handle::executor_type ex = handle1.get_executor();
84 (void)ex;
85
86 // basic_overlapped_handle functions.
87
88 win::stream_handle::lowest_layer_type& lowest_layer
89 = handle1.lowest_layer();
90 (void)lowest_layer;
91
92 const win::stream_handle& handle8 = handle1;
93 const win::stream_handle::lowest_layer_type& lowest_layer2
94 = handle8.lowest_layer();
95 (void)lowest_layer2;
96
97 HANDLE native_handle3 = INVALID_HANDLE_VALUE;
98 handle1.assign(native_handle3);

Callers

nothing calls this directly

Calls 12

bufferFunction · 0.85
get_executorMethod · 0.45
assignMethod · 0.45
is_openMethod · 0.45
closeMethod · 0.45
releaseMethod · 0.45
native_handleMethod · 0.45
cancelMethod · 0.45
write_someMethod · 0.45
async_write_someMethod · 0.45
read_someMethod · 0.45
async_read_someMethod · 0.45

Tested by

no test coverage detected