|
|
@ -58,15 +58,27 @@ BOOST_AUTO_TEST_CASE(move_constructor)
|
|
|
|
|
|
|
|
|
|
|
|
BOOST_AUTO_TEST_CASE(move_assignment)
|
|
|
|
BOOST_AUTO_TEST_CASE(move_assignment)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
const SOCKET s = CreateSocket();
|
|
|
|
const SOCKET s1 = CreateSocket();
|
|
|
|
Sock* sock1 = new Sock(s);
|
|
|
|
const SOCKET s2 = CreateSocket();
|
|
|
|
Sock* sock2 = new Sock(INVALID_SOCKET);
|
|
|
|
Sock* sock1 = new Sock(s1);
|
|
|
|
|
|
|
|
Sock* sock2 = new Sock(s2);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
BOOST_CHECK(!SocketIsClosed(s1));
|
|
|
|
|
|
|
|
BOOST_CHECK(!SocketIsClosed(s2));
|
|
|
|
|
|
|
|
|
|
|
|
*sock2 = std::move(*sock1);
|
|
|
|
*sock2 = std::move(*sock1);
|
|
|
|
|
|
|
|
BOOST_CHECK(!SocketIsClosed(s1));
|
|
|
|
|
|
|
|
BOOST_CHECK(SocketIsClosed(s2));
|
|
|
|
|
|
|
|
BOOST_CHECK(*sock2 == s1);
|
|
|
|
|
|
|
|
|
|
|
|
delete sock1;
|
|
|
|
delete sock1;
|
|
|
|
BOOST_CHECK(!SocketIsClosed(s));
|
|
|
|
BOOST_CHECK(!SocketIsClosed(s1));
|
|
|
|
BOOST_CHECK(*sock2 == s);
|
|
|
|
BOOST_CHECK(SocketIsClosed(s2));
|
|
|
|
|
|
|
|
BOOST_CHECK(*sock2 == s1);
|
|
|
|
|
|
|
|
|
|
|
|
delete sock2;
|
|
|
|
delete sock2;
|
|
|
|
BOOST_CHECK(SocketIsClosed(s));
|
|
|
|
BOOST_CHECK(SocketIsClosed(s1));
|
|
|
|
|
|
|
|
BOOST_CHECK(SocketIsClosed(s2));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
#ifndef WIN32 // Windows does not have socketpair(2).
|
|
|
|
#ifndef WIN32 // Windows does not have socketpair(2).
|
|
|
|