| 92 | } |
| 93 | |
| 94 | void 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 |
nothing calls this directly
no test coverage detected