From 99aaf7068d1a53f4e849d6280d3b48aac03ceb6d Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Sat, 23 Jul 2022 10:05:57 +0200 Subject: [PATCH] some tests --- src/fsfw/serialize/SerializeIF.h | 4 ++-- unittests/tmtcpacket/testCcsds.cpp | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/fsfw/serialize/SerializeIF.h b/src/fsfw/serialize/SerializeIF.h index de5abaeb..ad8d3730 100644 --- a/src/fsfw/serialize/SerializeIF.h +++ b/src/fsfw/serialize/SerializeIF.h @@ -66,7 +66,7 @@ class SerializeIF { * Gets the size of a object if it would be serialized in a buffer * @return Size of serialized object */ - virtual size_t getSerializedSize() const = 0; + [[nodiscard]] virtual size_t getSerializedSize() const = 0; /** * @brief @@ -99,7 +99,7 @@ class SerializeIF { * @param streamEndianness * @return */ - virtual ReturnValue_t serialize(uint8_t* buffer, size_t maxSize, Endianness streamEndianness) { + virtual ReturnValue_t serialize(uint8_t* buffer, size_t maxSize, Endianness streamEndianness) const { size_t tmpSize = 0; return serialize(&buffer, &tmpSize, maxSize, streamEndianness); } diff --git a/unittests/tmtcpacket/testCcsds.cpp b/unittests/tmtcpacket/testCcsds.cpp index 28b255e5..a2679896 100644 --- a/unittests/tmtcpacket/testCcsds.cpp +++ b/unittests/tmtcpacket/testCcsds.cpp @@ -43,7 +43,7 @@ TEST_CASE("CCSDS Packet ID", "[ccsds-packet-id]") { packetId.secHeaderFlag = false; packetId.packetType = ccsds::PacketType::TM; REQUIRE(packetId.raw() == 0x1ff); - REQUIRE(packetId.serialize(&ptr, &serLen, buf.size(), SerializeIF::Endianness::NETWORK) == + REQUIRE(packetId.serialize(buf.data(), buf.size(), SerializeIF::Endianness::NETWORK) == HasReturnvaluesIF::RETURN_OK); REQUIRE(buf[0] == 0x1); REQUIRE(buf[1] == 0xff);