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

Function prefer_only_executor_query_test

test/execution/prefer_only.cpp:272–447  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

270} // namespace boost
271
272void prefer_only_executor_query_test()
273{
274 typedef execution::any_executor<
275 execution::blocking_t,
276 execution::prefer_only<execution::blocking_t::possibly_t>,
277 execution::prefer_only<execution::blocking_t::never_t>
278 > executor_type;
279
280 executor_type ex1 = possibly_blocking_executor();
281
282 BOOST_ASIO_CHECK(
283 boost::asio::query(ex1, execution::blocking)
284 == execution::blocking.possibly);
285
286 BOOST_ASIO_CHECK(
287 boost::asio::query(ex1, execution::blocking.possibly)
288 == execution::blocking.possibly);
289
290 BOOST_ASIO_CHECK(
291 boost::asio::query(ex1, execution::blocking.never)
292 == execution::blocking.possibly);
293
294 executor_type ex2 = boost::asio::prefer(ex1, execution::blocking.possibly);
295
296 BOOST_ASIO_CHECK(
297 boost::asio::query(ex2, execution::blocking)
298 == execution::blocking.possibly);
299
300 BOOST_ASIO_CHECK(
301 boost::asio::query(ex2, execution::blocking.possibly)
302 == execution::blocking.possibly);
303
304 BOOST_ASIO_CHECK(
305 boost::asio::query(ex2, execution::blocking.never)
306 == execution::blocking.possibly);
307
308 executor_type ex3 = boost::asio::prefer(ex1, execution::blocking.never);
309
310 BOOST_ASIO_CHECK(
311 boost::asio::query(ex3, execution::blocking)
312 == execution::blocking.possibly);
313
314 BOOST_ASIO_CHECK(
315 boost::asio::query(ex3, execution::blocking.possibly)
316 == execution::blocking.possibly);
317
318 BOOST_ASIO_CHECK(
319 boost::asio::query(ex3, execution::blocking.never)
320 == execution::blocking.possibly);
321
322 executor_type ex4 = never_blocking_executor();
323
324 BOOST_ASIO_CHECK(
325 boost::asio::query(ex4, execution::blocking)
326 == execution::blocking.never);
327
328 BOOST_ASIO_CHECK(
329 boost::asio::query(ex4, execution::blocking.possibly)

Callers

nothing calls this directly

Calls 5

queryFunction · 0.50
preferFunction · 0.50

Tested by

no test coverage detected