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

Function test

test/serial_port.cpp:51–159  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

49};
50
51void test()
52{
53#if defined(BOOST_ASIO_HAS_SERIAL_PORT)
54 using namespace boost::asio;
55
56 try
57 {
58 io_context ioc;
59 const io_context::executor_type ioc_ex = ioc.get_executor();
60 char mutable_char_buffer[128] = "";
61 const char const_char_buffer[128] = "";
62 serial_port::baud_rate serial_port_option;
63 archetypes::lazy_handler lazy;
64 boost::system::error_code ec;
65
66 // basic_serial_port constructors.
67
68 serial_port port1(ioc);
69 serial_port port2(ioc, "null");
70 serial_port::native_handle_type native_port1 = port1.native_handle();
71#if defined(BOOST_ASIO_MSVC) && (_MSC_VER < 1910)
72 // Skip this on older MSVC due to mysterious ambiguous overload errors.
73#else
74 serial_port port3(ioc, native_port1);
75#endif
76
77 serial_port port4(ioc_ex);
78 serial_port port5(ioc_ex, "null");
79 serial_port::native_handle_type native_port2 = port1.native_handle();
80 serial_port port6(ioc_ex, native_port2);
81
82 serial_port port7(std::move(port6));
83
84 basic_serial_port<io_context::executor_type> port8(ioc);
85 serial_port port9(std::move(port8));
86
87 // basic_serial_port operators.
88
89 port1 = serial_port(ioc);
90 port1 = std::move(port2);
91 port1 = std::move(port8);
92
93 // I/O object functions.
94
95 serial_port::executor_type ex = port1.get_executor();
96 (void)ex;
97
98 // basic_serial_port functions.
99
100 serial_port::lowest_layer_type& lowest_layer = port1.lowest_layer();
101 (void)lowest_layer;
102
103 const serial_port& port10 = port1;
104 const serial_port::lowest_layer_type& lowest_layer2 = port10.lowest_layer();
105 (void)lowest_layer2;
106
107 port1.open("null");
108 port1.open("null", ec);

Callers

nothing calls this directly

Calls 15

bufferFunction · 0.85
write_some_handlerClass · 0.70
read_some_handlerClass · 0.70
get_executorMethod · 0.45
native_handleMethod · 0.45
openMethod · 0.45
assignMethod · 0.45
is_openMethod · 0.45
closeMethod · 0.45
cancelMethod · 0.45
set_optionMethod · 0.45
get_optionMethod · 0.45

Tested by

no test coverage detected