test without the fixture
This commit is contained in:
parent
34d74375cc
commit
2d2ef07de7
|
@ -23,27 +23,17 @@
|
|||
*/
|
||||
|
||||
#include <gtest/gtest.h>
|
||||
|
||||
#include <responder.h>
|
||||
|
||||
class RDMdataTest
|
||||
: public ::testing::Test
|
||||
TEST(RDM, device_info)
|
||||
{
|
||||
protected:
|
||||
RDMdataTest()
|
||||
{
|
||||
RDM::Responder responder(RDM::UID(0x12345678, 0x1234));
|
||||
std::vector<uint8_t> rdm_data;
|
||||
|
||||
responder.deviceModelID = 0x4242;
|
||||
responder.deviceProductCategory = RDM::PRODUCT_CATEGORY_TEST;
|
||||
sender_token = responder.setSender([this](const std::vector<uint8_t> &r){rdm_data = r;});
|
||||
}
|
||||
RDM::Responder responder = RDM::Responder(RDM::UID(0x12345678, 0x1234));
|
||||
std::vector<uint8_t> rdm_data;
|
||||
std::shared_ptr<void> sender_token;
|
||||
};
|
||||
auto token = responder.setSender([&rdm_data](const std::vector<uint8_t> &r){rdm_data = r;});
|
||||
|
||||
|
||||
TEST_F(RDMdataTest, device_info) {
|
||||
rdm_data.clear();
|
||||
rdm_data.push_back(RDM::SC_RDM); // START code
|
||||
rdm_data.push_back(RDM::SC_SUB_MESSAGE); // sub-START code
|
||||
rdm_data.push_back(24); // message length
|
||||
|
|
|
@ -23,71 +23,60 @@
|
|||
*/
|
||||
|
||||
#include <gtest/gtest.h>
|
||||
#include <node.h>
|
||||
|
||||
#include "node.h"
|
||||
|
||||
class sACNdataTest
|
||||
: public ::testing::Test
|
||||
TEST(sACN, stream_in)
|
||||
{
|
||||
protected:
|
||||
sACNdataTest()
|
||||
{
|
||||
// Root Layer (See Section 5)
|
||||
// Preamble Size
|
||||
e131_data[1] = 0x10;
|
||||
// Post-amble Size
|
||||
// ACN Packet Identifier
|
||||
e131_data[4] = 0x41;
|
||||
e131_data[5] = 0x53;
|
||||
e131_data[6] = 0x43;
|
||||
e131_data[7] = 0x2d;
|
||||
e131_data[8] = 0x45;
|
||||
e131_data[9] = 0x31;
|
||||
e131_data[10] = 0x2e;
|
||||
e131_data[11] = 0x31;
|
||||
e131_data[12] = 0x37;
|
||||
// Flags and Length
|
||||
e131_data[16] = 0x72;
|
||||
e131_data[17] = 0x6e;
|
||||
// Vector
|
||||
e131_data[21] = 0x04; //!< VECTOR_ROOT_E131_DATA
|
||||
// CID
|
||||
// E1.31 Framing Layer (See Section 6)
|
||||
// Flags and Length
|
||||
e131_data[38] = 0x72;
|
||||
e131_data[39] = 0x58;
|
||||
// Vector
|
||||
e131_data[43] = 0x02; //!< VECTOR_E131_DATA_PACKET
|
||||
// Source Name
|
||||
// Priority
|
||||
e131_data[108] = 0x64; //!< priority 100
|
||||
// Synchronization Address
|
||||
// Sequence Number
|
||||
// Options
|
||||
// Universe
|
||||
// DMP Layer (See Section 7)
|
||||
// Flags and Length
|
||||
e131_data[115] = 0x72;
|
||||
e131_data[116] = 0x0b;
|
||||
// Vector
|
||||
e131_data[117] = 0x02; //!< VECTOR_DMP_SET_PROPERTY
|
||||
// Address Type & Data Type
|
||||
e131_data[118] = 0xa1;
|
||||
// First Property Address
|
||||
// Address Increment
|
||||
e131_data[122] = 0x01;
|
||||
// Property value count
|
||||
e131_data[123] = 0x02;
|
||||
e131_data[124] = 0x01;
|
||||
// Property values
|
||||
}
|
||||
|
||||
sACN::Node node;
|
||||
uint8_t e131_data[638] = {0}; //!< Table 4-1: E1.31 Data Packet
|
||||
};
|
||||
// Root Layer (See Section 5)
|
||||
// Preamble Size
|
||||
e131_data[1] = 0x10;
|
||||
// Post-amble Size
|
||||
// ACN Packet Identifier
|
||||
e131_data[4] = 0x41;
|
||||
e131_data[5] = 0x53;
|
||||
e131_data[6] = 0x43;
|
||||
e131_data[7] = 0x2d;
|
||||
e131_data[8] = 0x45;
|
||||
e131_data[9] = 0x31;
|
||||
e131_data[10] = 0x2e;
|
||||
e131_data[11] = 0x31;
|
||||
e131_data[12] = 0x37;
|
||||
// Flags and Length
|
||||
e131_data[16] = 0x72;
|
||||
e131_data[17] = 0x6e;
|
||||
// Vector
|
||||
e131_data[21] = 0x04; //!< VECTOR_ROOT_E131_DATA
|
||||
// CID
|
||||
// E1.31 Framing Layer (See Section 6)
|
||||
// Flags and Length
|
||||
e131_data[38] = 0x72;
|
||||
e131_data[39] = 0x58;
|
||||
// Vector
|
||||
e131_data[43] = 0x02; //!< VECTOR_E131_DATA_PACKET
|
||||
// Source Name
|
||||
// Priority
|
||||
e131_data[108] = 0x64; //!< priority 100
|
||||
// Synchronization Address
|
||||
// Sequence Number
|
||||
// Options
|
||||
// Universe
|
||||
// DMP Layer (See Section 7)
|
||||
// Flags and Length
|
||||
e131_data[115] = 0x72;
|
||||
e131_data[116] = 0x0b;
|
||||
// Vector
|
||||
e131_data[117] = 0x02; //!< VECTOR_DMP_SET_PROPERTY
|
||||
// Address Type & Data Type
|
||||
e131_data[118] = 0xa1;
|
||||
// First Property Address
|
||||
// Address Increment
|
||||
e131_data[122] = 0x01;
|
||||
// Property value count
|
||||
e131_data[123] = 0x02;
|
||||
e131_data[124] = 0x01;
|
||||
|
||||
|
||||
TEST_F(sACNdataTest, stream_in) {
|
||||
// random CID
|
||||
auto cid = UUID::uuid();
|
||||
cid.uuid4();
|
||||
|
|
Loading…
Reference in New Issue