Example #1
0
void TCPTransportTest::SendPacket(const ola::testing::SourceLine &source_line,
                                  IOStack *packet) {
  IOQueue output;
  packet->MoveToIOQueue(&output);
  ola::testing::_FailIf(
      source_line,
      !m_loopback.Send(&output),
      "Loopback send failed");
}
Example #2
0
/**
 * Test a short preamble.
 */
void TCPTransportTest::testShortPreamble() {
  uint8_t bogus_data[] = {
    1, 2, 3, 4,
    1, 2, 3, 4};
  m_loopback.Send(bogus_data, sizeof(bogus_data));

  m_ss->RunOnce(1, 0);
  m_loopback.CloseClient();
  m_ss->RunOnce(1, 0);
  OLA_ASSERT(m_stream_ok);
  OLA_ASSERT_EQ(0u, m_pdus_received);
}
Example #3
0
/**
 * Test bogus data, this should show up as an invalid stream
 */
void TCPTransportTest::testBadPreamble() {
  uint8_t bogus_data[] = {
    1, 2, 3, 4,
    5, 0, 1, 0,
    0, 4, 5, 6,
    7, 8, 9, 0,
    1, 2, 3, 4};
  m_loopback.Send(bogus_data, sizeof(bogus_data));

  m_ss->RunOnce(TimeInterval(1, 0));
  m_loopback.CloseClient();
  m_ss->RunOnce(TimeInterval(1, 0));
  OLA_ASSERT_FALSE(m_stream_ok);
  OLA_ASSERT_EQ(0u, m_pdus_received);
}
Example #4
0
void TCPTransportTest::SendPacket(const string &message, IOStack *packet) {
  IOQueue output;
  packet->MoveToIOQueue(&output);
  OLA_ASSERT_TRUE_MSG(m_loopback.Send(&output), message);
}