Permalink
Browse files

Use OLA_ASSERT_EQ more where possible

  • Loading branch information...
peternewman committed Aug 17, 2018
1 parent b0cd317 commit 7e12b815282556b6dbd592444b148d081d5a4c80
@@ -399,7 +399,7 @@ uint16_t AdvancedTCPConnectorTest::ReservePort() {
void AdvancedTCPConnectorTest::AcceptedConnection(TCPSocket *new_socket) {
OLA_ASSERT_NOT_NULL(new_socket);
GenericSocketAddress address = new_socket->GetPeerAddress();
OLA_ASSERT_TRUE(address.Family() == AF_INET);
OLA_ASSERT_EQ(address.Family(), static_cast<uint16_t>(AF_INET));
OLA_INFO << "Connection from " << address;

// terminate the ss when this connection is closed
@@ -415,7 +415,7 @@ void AdvancedTCPConnectorTest::OnConnect(TCPSocket *socket) {
OLA_ASSERT_NOT_NULL(socket);

GenericSocketAddress address = socket->GetPeerAddress();
OLA_ASSERT_TRUE(address.Family() == AF_INET);
OLA_ASSERT_EQ(address.Family(), static_cast<uint16_t>(AF_INET));
OLA_ASSERT_EQ(m_localhost, address.V4Addr().Host());

m_connected_socket = socket;
@@ -343,7 +343,7 @@ void SocketTest::ReceiveSendAndClose(ConnectedDescriptor *socket) {
void SocketTest::NewConnectionSend(TCPSocket *new_socket) {
OLA_ASSERT_TRUE(new_socket);
GenericSocketAddress address = new_socket->GetPeerAddress();
OLA_ASSERT_TRUE(address.Family() == AF_INET);
OLA_ASSERT_EQ(address.Family(), static_cast<uint16_t>(AF_INET));
OLA_INFO << "Connection from " << address;
ssize_t bytes_sent = new_socket->Send(
static_cast<const uint8_t*>(test_cstring),
@@ -361,7 +361,7 @@ void SocketTest::NewConnectionSend(TCPSocket *new_socket) {
void SocketTest::NewConnectionSendAndClose(TCPSocket *new_socket) {
OLA_ASSERT_NOT_NULL(new_socket);
GenericSocketAddress address = new_socket->GetPeerAddress();
OLA_ASSERT_TRUE(address.Family() == AF_INET);
OLA_ASSERT_EQ(address.Family(), static_cast<uint16_t>(AF_INET));
OLA_INFO << "Connection from " << address;
ssize_t bytes_sent = new_socket->Send(
static_cast<const uint8_t*>(test_cstring),
@@ -279,7 +279,7 @@ void TCPConnectorTest::testEarlyDestruction() {
void TCPConnectorTest::AcceptedConnection(TCPSocket *new_socket) {
OLA_ASSERT_NOT_NULL(new_socket);
GenericSocketAddress address = new_socket->GetPeerAddress();
OLA_ASSERT_TRUE(address.Family() == AF_INET);
OLA_ASSERT_EQ(address.Family(), static_cast<uint16_t>(AF_INET));
OLA_INFO << "Connection from " << address;

// terminate the ss when this connection is closed
@@ -168,7 +168,7 @@ inline void _FailIf(const SourceLine &source_line,
ola::testing::ASSERT_DATA_EQUALS(OLA_SOURCELINE(), \
(expected.GetRaw()), (expected.Size()), \
(actual.GetRaw()), (actual.Size())); \
OLA_ASSERT_TRUE(expected == actual)
OLA_ASSERT_EQ(expected, actual)

#define OLA_ASSERT_NULL(value) \
CPPUNIT_NS::Asserter::failIf( \

0 comments on commit 7e12b81

Please sign in to comment.