windows compiles, some unittests give exceptions
This commit is contained in:
@ -12,7 +12,7 @@ TEST_CASE("Serial Linked Packet", "[SerLinkPacket]") {
|
||||
std::array<uint8_t, 3> testArray{1, 2, 3};
|
||||
uint32_t tail = 96;
|
||||
size_t packetMaxSize = 256;
|
||||
uint8_t packet[packetMaxSize] = {};
|
||||
std::vector<uint8_t> packet(packetMaxSize);
|
||||
size_t packetLen = 0;
|
||||
|
||||
SECTION("Test Deserialization with Serial Buffer Adapter.") {
|
||||
@ -20,14 +20,14 @@ TEST_CASE("Serial Linked Packet", "[SerLinkPacket]") {
|
||||
// We generate a packet which store data big-endian by swapping some
|
||||
// values. (like coming from ground).
|
||||
header = EndianConverter::convertBigEndian(header);
|
||||
std::memcpy(packet, &header, sizeof(header));
|
||||
std::memcpy(packet.data(), &header, sizeof(header));
|
||||
packetLen += sizeof(header);
|
||||
|
||||
std::copy(testArray.data(), testArray.data() + testArray.size(), packet + packetLen);
|
||||
std::copy(testArray.data(), testArray.data() + testArray.size(), packet.data() + packetLen);
|
||||
packetLen += testArray.size();
|
||||
|
||||
tail = EndianConverter::convertBigEndian(tail);
|
||||
std::memcpy(packet + packetLen, &tail, sizeof(tail));
|
||||
std::memcpy(packet.data() + packetLen, &tail, sizeof(tail));
|
||||
packetLen += sizeof(tail);
|
||||
|
||||
// arrayprinter::print(packet, packetLen, OutputType::DEC);
|
||||
@ -35,8 +35,8 @@ TEST_CASE("Serial Linked Packet", "[SerLinkPacket]") {
|
||||
// This is the buffer which will be filled when testClass.deSerialize
|
||||
// is called.
|
||||
std::array<uint8_t, 3> bufferAdaptee = {};
|
||||
TestPacket testClass(packet, packetLen, bufferAdaptee.data(), bufferAdaptee.size());
|
||||
const uint8_t* readOnlyPointer = packet;
|
||||
TestPacket testClass(packet.data(), packetLen, bufferAdaptee.data(), bufferAdaptee.size());
|
||||
const uint8_t* readOnlyPointer = packet.data();
|
||||
// Deserialize big endian packet by setting bigEndian to true.
|
||||
ReturnValue_t result =
|
||||
testClass.deSerialize(&readOnlyPointer, &packetLen, SerializeIF::Endianness::BIG);
|
||||
@ -55,7 +55,7 @@ TEST_CASE("Serial Linked Packet", "[SerLinkPacket]") {
|
||||
// instead of doing it manually.
|
||||
TestPacket testClass(header, tail, testArray.data(), testArray.size());
|
||||
size_t serializedSize = 0;
|
||||
uint8_t* packetPointer = packet;
|
||||
uint8_t* packetPointer = packet.data();
|
||||
// serialize for ground: bigEndian = true.
|
||||
ReturnValue_t result = testClass.serialize(&packetPointer, &serializedSize, packetMaxSize,
|
||||
SerializeIF::Endianness::BIG);
|
||||
|
Reference in New Issue
Block a user