/** * Confirm the state & failed attempts matches what we expected */ void AdvancedTCPConnectorTest::ConfirmState( unsigned int line, const AdvancedTCPConnector &connector, const IPV4SocketAddress &endpoint, AdvancedTCPConnector::ConnectionState expected_state, unsigned int expected_attempts) { std::ostringstream str; str << "Line " << line; AdvancedTCPConnector::ConnectionState state; unsigned int failed_attempts; OLA_ASSERT_TRUE_MSG( connector.GetEndpointState(endpoint, &state, &failed_attempts), str.str()); OLA_ASSERT_EQ_MSG(expected_state, state, str.str()); OLA_ASSERT_EQ_MSG(expected_attempts, failed_attempts, str.str()); }
/** * Confirm the state & failed attempts matches what we expected */ void AdvancedTCPConnectorTest::ConfirmState( const ola::testing::SourceLine &source_line, const AdvancedTCPConnector &connector, const IPV4SocketAddress &endpoint, AdvancedTCPConnector::ConnectionState expected_state, unsigned int expected_attempts) { AdvancedTCPConnector::ConnectionState state; unsigned int failed_attempts; ola::testing::_FailIf( source_line, !connector.GetEndpointState(endpoint, &state, &failed_attempts), "Incorrect endpoint state"); ola::testing::_AssertEquals(source_line, expected_state, state, "States differ"); ola::testing::_AssertEquals(source_line, expected_attempts, failed_attempts, "Attempts differ"); }
/** * Confirm the state & failed attempts matches what we expected */ void AdvancedTCPConnectorTest::ConfirmState( unsigned int line, AdvancedTCPConnector &connector, const IPV4Address &ip_address, uint16_t port, AdvancedTCPConnector::ConnectionState expected_state, unsigned int expected_attempts) { std::stringstream str; str << "Line " << line; AdvancedTCPConnector::ConnectionState state; unsigned int failed_attempts; CPPUNIT_ASSERT_MESSAGE( str.str(), connector.GetEndpointState( ip_address, port, &state, &failed_attempts)); CPPUNIT_ASSERT_EQUAL_MESSAGE(str.str(), expected_state, state); CPPUNIT_ASSERT_EQUAL_MESSAGE(str.str(), expected_attempts, failed_attempts); }