From 72bc5d4d609fc5222955068e3a51195b7839dd59 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Thu, 28 Jul 2022 12:52:20 +0200 Subject: [PATCH] add tm zc test --- unittests/tmtcpacket/CMakeLists.txt | 1 + unittests/tmtcpacket/testZcTmWriter.cpp | 23 +++++++++++++++++++++++ 2 files changed, 24 insertions(+) create mode 100644 unittests/tmtcpacket/testZcTmWriter.cpp diff --git a/unittests/tmtcpacket/CMakeLists.txt b/unittests/tmtcpacket/CMakeLists.txt index dd0100a6..5b53328f 100644 --- a/unittests/tmtcpacket/CMakeLists.txt +++ b/unittests/tmtcpacket/CMakeLists.txt @@ -6,4 +6,5 @@ target_sources(${FSFW_TEST_TGT} PRIVATE testPusTmCreator.cpp testPusTmReader.cpp testCcsds.cpp + testZcTmWriter.cpp ) diff --git a/unittests/tmtcpacket/testZcTmWriter.cpp b/unittests/tmtcpacket/testZcTmWriter.cpp new file mode 100644 index 00000000..366697d1 --- /dev/null +++ b/unittests/tmtcpacket/testZcTmWriter.cpp @@ -0,0 +1,23 @@ +#include + +#include "fsfw/tmtcpacket/pus/tm.h" +#include "fsfw/tmtcpacket/pus/tm/PusTmZcWriter.h" +#include "mocks/CdsShortTimestamperMock.h" + +TEST_CASE("TM ZC Helper", "[tm-zc-helper]") { + auto packetId = PacketId(ccsds::PacketType::TC, true, 0xef); + auto spParams = + SpacePacketParams(packetId, PacketSeqCtrl(ccsds::SequenceFlags::UNSEGMENTED, 22), 0x00); + auto timeStamper = CdsShortTimestamperMock(); + auto pusTmParams = PusTmParams(17, 2, &timeStamper); + timeStamper.valueToStamp = {1, 2, 3, 4, 5, 6, 7}; + PusTmCreator creator(spParams, pusTmParams); + std::array buf{}; + uint8_t* dataPtr = buf.data(); + size_t serLen = 0; + + SECTION("Basic") { + REQUIRE(creator.serialize(dataPtr, serLen, buf.size()) == result::OK); + PusTmZeroCopyWriter() + } +} \ No newline at end of file