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

Function error_code_disposition_test

test/disposition.cpp:31–69  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

29}
30
31void error_code_disposition_test()
32{
33 using boost::asio::no_error;
34
35 boost::system::error_code ec1;
36
37 BOOST_ASIO_CHECK(ec1 == no_error);
38 BOOST_ASIO_CHECK(no_error == ec1);
39 BOOST_ASIO_CHECK(!(ec1 != no_error));
40 BOOST_ASIO_CHECK(!(no_error != ec1));
41
42 std::exception_ptr ep1 = boost::asio::to_exception_ptr(ec1);
43 BOOST_ASIO_CHECK(ep1 == nullptr);
44
45 boost::system::error_code ec2 = boost::asio::error::eof;
46
47 BOOST_ASIO_CHECK(!(ec2 == no_error));
48 BOOST_ASIO_CHECK(!(no_error == ec2));
49 BOOST_ASIO_CHECK(ec2 != no_error);
50 BOOST_ASIO_CHECK(no_error != ec2);
51
52#if !defined(BOOST_ASIO_NO_EXCEPTIONS)
53 bool caught;
54 try
55 {
56 boost::asio::throw_exception(ec2);
57 caught = false;
58 }
59 catch (const boost::system::system_error& ex)
60 {
61 caught = true;
62 BOOST_ASIO_CHECK(ex.code() == boost::asio::error::eof);
63 }
64 BOOST_ASIO_CHECK(caught);
65#endif // !defined(BOOST_ASIO_NO_EXCEPTIONS)
66
67 std::exception_ptr ep2 = boost::asio::to_exception_ptr(ec2);
68 BOOST_ASIO_CHECK(ep2 != nullptr);
69}
70
71void exception_ptr_disposition_test()
72{

Callers

nothing calls this directly

Calls 3

to_exception_ptrFunction · 0.85
codeMethod · 0.80
throw_exceptionFunction · 0.70

Tested by

no test coverage detected