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

Function exception_ptr_disposition_test

test/disposition.cpp:71–110  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

69}
70
71void exception_ptr_disposition_test()
72{
73 using boost::asio::no_error;
74
75 std::exception_ptr ep1;
76
77 BOOST_ASIO_CHECK(ep1 == no_error);
78 BOOST_ASIO_CHECK(no_error == ep1);
79 BOOST_ASIO_CHECK(!(ep1 != no_error));
80 BOOST_ASIO_CHECK(!(no_error != ep1));
81
82 std::exception_ptr ep2 = boost::asio::to_exception_ptr(ep1);
83 BOOST_ASIO_CHECK(ep1 == nullptr);
84
85 std::exception_ptr ep3 = std::make_exception_ptr(
86 boost::system::system_error(boost::asio::error::eof));
87
88 BOOST_ASIO_CHECK(!(ep3 == no_error));
89 BOOST_ASIO_CHECK(!(no_error == ep3));
90 BOOST_ASIO_CHECK(ep3 != no_error);
91 BOOST_ASIO_CHECK(no_error != ep3);
92
93#if !defined(BOOST_ASIO_NO_EXCEPTIONS)
94 bool caught;
95 try
96 {
97 boost::asio::throw_exception(ep3);
98 caught = false;
99 }
100 catch (const boost::system::system_error& ex)
101 {
102 caught = true;
103 BOOST_ASIO_CHECK(ex.code() == boost::asio::error::eof);
104 }
105 BOOST_ASIO_CHECK(caught);
106#endif // !defined(BOOST_ASIO_NO_EXCEPTIONS)
107
108 std::exception_ptr ep4 = boost::asio::to_exception_ptr(ep3);
109 BOOST_ASIO_CHECK(ep4 != nullptr);
110}
111
112BOOST_ASIO_TEST_SUITE
113(

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