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

Function use_future_1_test

test/use_future.cpp:94–165  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

92}
93
94void use_future_1_test()
95{
96 using boost::asio::use_future;
97 using namespace archetypes;
98
99 std::future<int> f;
100
101 f = async_op_1(use_future);
102 try
103 {
104 int i = f.get();
105 BOOST_ASIO_CHECK(i == 42);
106 }
107 catch (...)
108 {
109 BOOST_ASIO_CHECK(false);
110 }
111
112 f = async_op_ec_1(true, use_future);
113 try
114 {
115 int i = f.get();
116 BOOST_ASIO_CHECK(i == 42);
117 }
118 catch (...)
119 {
120 BOOST_ASIO_CHECK(false);
121 }
122
123 f = async_op_ec_1(false, use_future);
124 try
125 {
126 int i = f.get();
127 BOOST_ASIO_CHECK(false);
128 (void)i;
129 }
130 catch (boost::system::system_error& e)
131 {
132 BOOST_ASIO_CHECK(e.code() == boost::asio::error::operation_aborted);
133 }
134 catch (...)
135 {
136 BOOST_ASIO_CHECK(false);
137 }
138
139 f = async_op_ex_1(true, use_future);
140 try
141 {
142 int i = f.get();
143 BOOST_ASIO_CHECK(i == 42);
144 }
145 catch (...)
146 {
147 BOOST_ASIO_CHECK(false);
148 }
149
150 f = async_op_ex_1(false, use_future);
151 try

Callers

nothing calls this directly

Calls 6

async_op_1Function · 0.85
async_op_ec_1Function · 0.85
async_op_ex_1Function · 0.85
stringFunction · 0.85
codeMethod · 0.80
getMethod · 0.45

Tested by

no test coverage detected