net: remove now unnecessary Sock::Get()

`Sock::Get()` was used only in `sock.{cpp,h}`. Remove it and access
`Sock::m_socket` directly.

Unit tests that used `Get()` to test for equality still verify that the
behavior is correct by using the added `operator==()`.
This commit is contained in:
Vasil Dimov
2021-04-29 18:01:03 +02:00
parent 944b21b70a
commit 7829272f78
3 changed files with 23 additions and 22 deletions

View File

@@ -38,7 +38,7 @@ BOOST_AUTO_TEST_CASE(constructor_and_destructor)
{
const SOCKET s = CreateSocket();
Sock* sock = new Sock(s);
BOOST_CHECK_EQUAL(sock->Get(), s);
BOOST_CHECK(*sock == s);
BOOST_CHECK(!SocketIsClosed(s));
delete sock;
BOOST_CHECK(SocketIsClosed(s));
@@ -51,7 +51,7 @@ BOOST_AUTO_TEST_CASE(move_constructor)
Sock* sock2 = new Sock(std::move(*sock1));
delete sock1;
BOOST_CHECK(!SocketIsClosed(s));
BOOST_CHECK_EQUAL(sock2->Get(), s);
BOOST_CHECK(*sock2 == s);
delete sock2;
BOOST_CHECK(SocketIsClosed(s));
}
@@ -64,7 +64,7 @@ BOOST_AUTO_TEST_CASE(move_assignment)
*sock2 = std::move(*sock1);
delete sock1;
BOOST_CHECK(!SocketIsClosed(s));
BOOST_CHECK_EQUAL(sock2->Get(), s);
BOOST_CHECK(*sock2 == s);
delete sock2;
BOOST_CHECK(SocketIsClosed(s));
}