Пример #1
0
/**
 * Send a block of PDUs
 */
void TCPTransportTest::testSinglePDUBlock() {
  SendPDUBlock(__LINE__);

  m_ss->RunOnce(1, 0);
  m_loopback.CloseClient();
  m_ss->RunOnce(1, 0);
  OLA_ASSERT(m_stream_ok);
  OLA_ASSERT_EQ(3u, m_pdus_received);
}
Пример #2
0
/**
 * Send a block of PDUs
 */
void TCPTransportTest::testSinglePDUBlock() {
  SendPDUBlock(OLA_SOURCELINE());

  m_ss->RunOnce(TimeInterval(1, 0));
  m_loopback.CloseClient();
  m_ss->RunOnce(TimeInterval(1, 0));
  OLA_ASSERT(m_stream_ok);
  OLA_ASSERT_EQ(3u, m_pdus_received);
}
Пример #3
0
/**
 * Test a 0-length PDU block
 */
void TCPTransportTest::testZeroLengthPDUBlock() {
  SendEmptyPDUBLock(__LINE__);
  SendPDU(__LINE__);

  m_ss->RunOnce(1, 0);
  m_loopback.CloseClient();
  m_ss->RunOnce(1, 0);
  OLA_ASSERT(m_stream_ok);
  OLA_ASSERT_EQ(1u, m_pdus_received);
}
Пример #4
0
/**
 * Test a 0-length PDU block
 */
void TCPTransportTest::testZeroLengthPDUBlock() {
  SendEmptyPDUBLock(OLA_SOURCELINE());
  SendPDU(OLA_SOURCELINE());

  m_ss->RunOnce(TimeInterval(1, 0));
  m_loopback.CloseClient();
  m_ss->RunOnce(TimeInterval(1, 0));
  OLA_ASSERT(m_stream_ok);
  OLA_ASSERT_EQ(1u, m_pdus_received);
}
Пример #5
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);
}
Пример #6
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);
}