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

Function any_executor_swap_test

test/execution/any_executor.cpp:1036–1108  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1034}
1035
1036void any_executor_swap_test()
1037{
1038 typedef execution::any_executor<> ex_no_props_t;
1039
1040 typedef execution::any_executor<
1041 execution::blocking_t
1042 > ex_one_prop_t;
1043
1044 typedef execution::any_executor<
1045 execution::blocking_t,
1046 execution::occupancy_t
1047 > ex_two_props_t;
1048
1049 thread_pool pool1(1);
1050 thread_pool pool2(1);
1051
1052 ex_no_props_t ex_no_props_1(pool1.executor());
1053 ex_no_props_t ex_no_props_2(pool2.executor());
1054
1055 ex_no_props_t ex_no_props_3(ex_no_props_1);
1056 ex_no_props_t ex_no_props_4(ex_no_props_2);
1057
1058 BOOST_ASIO_CHECK(ex_no_props_3 == ex_no_props_1);
1059 BOOST_ASIO_CHECK(ex_no_props_4 == ex_no_props_2);
1060
1061 ex_no_props_3.swap(ex_no_props_4);
1062
1063 BOOST_ASIO_CHECK(ex_no_props_3 == ex_no_props_2);
1064 BOOST_ASIO_CHECK(ex_no_props_4 == ex_no_props_1);
1065
1066 execution::swap(ex_no_props_3, ex_no_props_4);
1067
1068 BOOST_ASIO_CHECK(ex_no_props_3 == ex_no_props_1);
1069 BOOST_ASIO_CHECK(ex_no_props_4 == ex_no_props_2);
1070
1071 ex_one_prop_t ex_one_prop_1(pool1.executor());
1072 ex_one_prop_t ex_one_prop_2(pool2.executor());
1073
1074 ex_one_prop_t ex_one_prop_3(ex_one_prop_1);
1075 ex_one_prop_t ex_one_prop_4(ex_one_prop_2);
1076
1077 BOOST_ASIO_CHECK(ex_one_prop_3 == ex_one_prop_1);
1078 BOOST_ASIO_CHECK(ex_one_prop_4 == ex_one_prop_2);
1079
1080 ex_one_prop_3.swap(ex_one_prop_4);
1081
1082 BOOST_ASIO_CHECK(ex_one_prop_3 == ex_one_prop_2);
1083 BOOST_ASIO_CHECK(ex_one_prop_4 == ex_one_prop_1);
1084
1085 execution::swap(ex_one_prop_3, ex_one_prop_4);
1086
1087 BOOST_ASIO_CHECK(ex_one_prop_3 == ex_one_prop_1);
1088 BOOST_ASIO_CHECK(ex_one_prop_4 == ex_one_prop_2);
1089
1090 ex_two_props_t ex_two_props_1(pool1.executor());
1091 ex_two_props_t ex_two_props_2(pool2.executor());
1092
1093 ex_two_props_t ex_two_props_3(ex_two_props_1);

Callers

nothing calls this directly

Calls 3

swapFunction · 0.85
executorMethod · 0.45
swapMethod · 0.45

Tested by

no test coverage detected