clean up a few tests

This commit is contained in:
Robin Müller 2022-08-03 13:15:49 +02:00
parent df690b9628
commit 60ea9a9a7c
No known key found for this signature in database
GPG Key ID: 11D4952C8CCEF814
36 changed files with 160 additions and 198 deletions

View File

@ -8,6 +8,7 @@ file_selectors="-iname CMakeLists.txt"
if command -v ${cmake_fmt} &> /dev/null; then if command -v ${cmake_fmt} &> /dev/null; then
${cmake_fmt} -i CMakeLists.txt ${cmake_fmt} -i CMakeLists.txt
find ./src ${file_selectors} | xargs ${cmake_fmt} -i find ./src ${file_selectors} | xargs ${cmake_fmt} -i
find ./unittests ${file_selectors} | xargs ${cmake_fmt} -i
else else
echo "No ${cmake_fmt} tool found, not formatting CMake files" echo "No ${cmake_fmt} tool found, not formatting CMake files"
fi fi

View File

@ -42,17 +42,17 @@ enum ChecksumType {
NULL_CHECKSUM = 15 NULL_CHECKSUM = 15
}; };
enum PduType : bool { FILE_DIRECTIVE = 0, FILE_DATA = 1 }; enum PduType : uint8_t { FILE_DIRECTIVE = 0, FILE_DATA = 1 };
enum TransmissionModes : bool { ACKNOWLEDGED = 0, UNACKNOWLEDGED = 1 }; enum TransmissionModes : uint8_t { ACKNOWLEDGED = 0, UNACKNOWLEDGED = 1 };
enum SegmentMetadataFlag : bool { NOT_PRESENT = 0, PRESENT = 1 }; enum SegmentMetadataFlag : bool { NOT_PRESENT = false, PRESENT = true };
enum Direction : bool { TOWARDS_RECEIVER = 0, TOWARDS_SENDER = 1 }; enum Direction : uint8_t { TOWARDS_RECEIVER = 0, TOWARDS_SENDER = 1 };
enum SegmentationControl : bool { enum SegmentationControl : bool {
NO_RECORD_BOUNDARIES_PRESERVATION = 0, NO_RECORD_BOUNDARIES_PRESERVATION = false,
RECORD_BOUNDARIES_PRESERVATION = 1 RECORD_BOUNDARIES_PRESERVATION = true
}; };
enum WidthInBytes : uint8_t { enum WidthInBytes : uint8_t {
@ -106,7 +106,7 @@ enum FinishedFileStatus {
FILE_STATUS_UNREPORTED = 3 FILE_STATUS_UNREPORTED = 3
}; };
enum PromptResponseRequired : bool { PROMPT_NAK = 0, PROMPT_KEEP_ALIVE = 1 }; enum PromptResponseRequired : uint8_t { PROMPT_NAK = 0, PROMPT_KEEP_ALIVE = 1 };
enum TlvTypes : uint8_t { enum TlvTypes : uint8_t {
FILESTORE_REQUEST = 0x00, FILESTORE_REQUEST = 0x00,

View File

@ -1,12 +1,14 @@
#include "PduConfig.h" #include "PduConfig.h"
PduConfig::PduConfig(cfdp::TransmissionModes mode, cfdp::TransactionSeqNum seqNum, #include <utility>
cfdp::EntityId sourceId, cfdp::EntityId destId, bool crcFlag, bool largeFile,
PduConfig::PduConfig(cfdp::EntityId sourceId, cfdp::EntityId destId, cfdp::TransmissionModes mode,
cfdp::TransactionSeqNum seqNum, bool crcFlag, bool largeFile,
cfdp::Direction direction) cfdp::Direction direction)
: mode(mode), : mode(mode),
seqNum(seqNum), seqNum(std::move(seqNum)),
sourceId(sourceId), sourceId(std::move(sourceId)),
destId(destId), destId(std::move(destId)),
crcFlag(crcFlag), crcFlag(crcFlag),
largeFile(largeFile), largeFile(largeFile),
direction(direction) {} direction(direction) {}

View File

@ -21,8 +21,8 @@ struct TransactionSeqNum : public VarLenField {
class PduConfig { class PduConfig {
public: public:
PduConfig(cfdp::TransmissionModes mode, cfdp::TransactionSeqNum seqNum, cfdp::EntityId sourceId, PduConfig(cfdp::EntityId sourceId, cfdp::EntityId destId, cfdp::TransmissionModes mode,
cfdp::EntityId destId, bool crcFlag = false, bool largeFile = false, cfdp::TransactionSeqNum seqNum, bool crcFlag = false, bool largeFile = false,
cfdp::Direction direction = cfdp::Direction::TOWARDS_RECEIVER); cfdp::Direction direction = cfdp::Direction::TOWARDS_RECEIVER);
cfdp::TransmissionModes mode; cfdp::TransmissionModes mode;
cfdp::TransactionSeqNum seqNum; cfdp::TransactionSeqNum seqNum;

View File

@ -118,3 +118,10 @@ ReturnValue_t cfdp::VarLenField::deSerialize(const uint8_t **buffer, size_t *siz
} }
} }
} }
template <typename T>
cfdp::VarLenField::VarLenField(UnsignedByteField<T> byteField)
: width(static_cast<WidthInBytes>(sizeof(T))) {
static_assert((sizeof(T) % 2) == 0);
value = byteField.getValue();
}

View File

@ -4,9 +4,9 @@
#include <cstddef> #include <cstddef>
#include <cstdint> #include <cstdint>
#include "../definitions.h" #include "fsfw/cfdp/definitions.h"
#include "fsfw/serialize/SerializeIF.h" #include "fsfw/serialize/SerializeIF.h"
#include "fsfw/util/UnsignedByteField.h"
namespace cfdp { namespace cfdp {
class VarLenField : public SerializeIF { class VarLenField : public SerializeIF {
@ -19,6 +19,8 @@ class VarLenField : public SerializeIF {
}; };
VarLenField(); VarLenField();
template <typename T>
explicit VarLenField(UnsignedByteField<T> byteField);
VarLenField(cfdp::WidthInBytes width, size_t value); VarLenField(cfdp::WidthInBytes width, size_t value);
ReturnValue_t setValue(cfdp::WidthInBytes, size_t value); ReturnValue_t setValue(cfdp::WidthInBytes, size_t value);
@ -26,13 +28,13 @@ class VarLenField : public SerializeIF {
ReturnValue_t serialize(uint8_t **buffer, size_t *size, size_t maxSize, ReturnValue_t serialize(uint8_t **buffer, size_t *size, size_t maxSize,
Endianness streamEndianness) const override; Endianness streamEndianness) const override;
size_t getSerializedSize() const override; [[nodiscard]] size_t getSerializedSize() const override;
ReturnValue_t deSerialize(cfdp::WidthInBytes width, const uint8_t **buffer, size_t *size, ReturnValue_t deSerialize(cfdp::WidthInBytes width, const uint8_t **buffer, size_t *size,
Endianness streamEndianness); Endianness streamEndianness);
cfdp::WidthInBytes getWidth() const; [[nodiscard]] cfdp::WidthInBytes getWidth() const;
size_t getValue() const; [[nodiscard]] size_t getValue() const;
private: private:
ReturnValue_t deSerialize(const uint8_t **buffer, size_t *size, ReturnValue_t deSerialize(const uint8_t **buffer, size_t *size,

View File

@ -1,14 +1,7 @@
target_sources(${FSFW_TEST_TGT} PRIVATE target_sources(${FSFW_TEST_TGT} PRIVATE CatchDefinitions.cpp CatchFactory.cpp
CatchDefinitions.cpp printChar.cpp testVersion.cpp)
CatchFactory.cpp
printChar.cpp
testVersion.cpp
)
target_sources(${FSFW_TEST_TGT} PRIVATE target_sources(${FSFW_TEST_TGT} PRIVATE CatchRunner.cpp CatchSetup.cpp)
CatchRunner.cpp
CatchSetup.cpp
)
add_subdirectory(testcfg) add_subdirectory(testcfg)
add_subdirectory(mocks) add_subdirectory(mocks)

View File

@ -1,3 +1 @@
target_sources(${FSFW_TEST_TGT} PRIVATE target_sources(${FSFW_TEST_TGT} PRIVATE TestActionHelper.cpp)
TestActionHelper.cpp
)

View File

@ -1,5 +1,6 @@
target_sources(${FSFW_TEST_TGT} PRIVATE target_sources(
testCfdp.cpp ${FSFW_TEST_TGT}
PRIVATE testCfdp.cpp
testTlvsLvs.cpp testTlvsLvs.cpp
testAckPdu.cpp testAckPdu.cpp
testEofPdu.cpp testEofPdu.cpp
@ -9,4 +10,4 @@ target_sources(${FSFW_TEST_TGT} PRIVATE
testKeepAlivePdu.cpp testKeepAlivePdu.cpp
testMetadataPdu.cpp testMetadataPdu.cpp
testFileData.cpp testFileData.cpp
) testCfdpHeader.cpp)

View File

@ -7,7 +7,7 @@
TEST_CASE("ACK PDU", "[AckPdu]") { TEST_CASE("ACK PDU", "[AckPdu]") {
using namespace cfdp; using namespace cfdp;
ReturnValue_t result = HasReturnvaluesIF::RETURN_OK; ReturnValue_t result;
std::array<uint8_t, 256> buf = {}; std::array<uint8_t, 256> buf = {};
uint8_t* bufptr = buf.data(); uint8_t* bufptr = buf.data();
size_t maxsz = buf.size(); size_t maxsz = buf.size();
@ -15,7 +15,7 @@ TEST_CASE("ACK PDU", "[AckPdu]") {
auto seqNum = TransactionSeqNum(WidthInBytes::TWO_BYTES, 15); auto seqNum = TransactionSeqNum(WidthInBytes::TWO_BYTES, 15);
auto sourceId = EntityId(WidthInBytes::TWO_BYTES, 1); auto sourceId = EntityId(WidthInBytes::TWO_BYTES, 1);
auto destId = EntityId(WidthInBytes::TWO_BYTES, 2); auto destId = EntityId(WidthInBytes::TWO_BYTES, 2);
auto pduConf = PduConfig(TransmissionModes::ACKNOWLEDGED, seqNum, sourceId, destId); auto pduConf = PduConfig(sourceId, destId, TransmissionModes::ACKNOWLEDGED, seqNum);
AckInfo ackInfo(FileDirectives::EOF_DIRECTIVE, ConditionCode::NO_ERROR, AckInfo ackInfo(FileDirectives::EOF_DIRECTIVE, ConditionCode::NO_ERROR,
AckTransactionStatus::ACTIVE); AckTransactionStatus::ACTIVE);
auto ackSerializer = AckPduSerializer(ackInfo, pduConf); auto ackSerializer = AckPduSerializer(ackInfo, pduConf);
@ -23,10 +23,10 @@ TEST_CASE("ACK PDU", "[AckPdu]") {
REQUIRE(result == HasReturnvaluesIF::RETURN_OK); REQUIRE(result == HasReturnvaluesIF::RETURN_OK);
SECTION("Serialize") { SECTION("Serialize") {
REQUIRE(buf.data()[sz - 3] == cfdp::FileDirectives::ACK); REQUIRE(buf[sz - 3] == cfdp::FileDirectives::ACK);
REQUIRE((buf.data()[sz - 2] >> 4) == FileDirectives::EOF_DIRECTIVE); REQUIRE((buf[sz - 2] >> 4) == FileDirectives::EOF_DIRECTIVE);
REQUIRE((buf.data()[sz - 2] & 0x0f) == 0); REQUIRE((buf[sz - 2] & 0x0f) == 0);
REQUIRE(buf.data()[sz - 1] == AckTransactionStatus::ACTIVE); REQUIRE(buf[sz - 1] == AckTransactionStatus::ACTIVE);
ackInfo.setAckedDirective(FileDirectives::FINISH); ackInfo.setAckedDirective(FileDirectives::FINISH);
ackInfo.setAckedConditionCode(ConditionCode::FILESTORE_REJECTION); ackInfo.setAckedConditionCode(ConditionCode::FILESTORE_REJECTION);
ackInfo.setTransactionStatus(AckTransactionStatus::TERMINATED); ackInfo.setTransactionStatus(AckTransactionStatus::TERMINATED);
@ -35,11 +35,11 @@ TEST_CASE("ACK PDU", "[AckPdu]") {
sz = 0; sz = 0;
result = ackSerializer2.serialize(&bufptr, &sz, maxsz, SerializeIF::Endianness::NETWORK); result = ackSerializer2.serialize(&bufptr, &sz, maxsz, SerializeIF::Endianness::NETWORK);
REQUIRE(result == HasReturnvaluesIF::RETURN_OK); REQUIRE(result == HasReturnvaluesIF::RETURN_OK);
REQUIRE(buf.data()[sz - 3] == cfdp::FileDirectives::ACK); REQUIRE(buf[sz - 3] == cfdp::FileDirectives::ACK);
REQUIRE((buf.data()[sz - 2] >> 4) == FileDirectives::FINISH); REQUIRE((buf[sz - 2] >> 4) == FileDirectives::FINISH);
REQUIRE((buf.data()[sz - 2] & 0x0f) == 0b0001); REQUIRE((buf[sz - 2] & 0x0f) == 0b0001);
REQUIRE((buf.data()[sz - 1] >> 4) == ConditionCode::FILESTORE_REJECTION); REQUIRE((buf[sz - 1] >> 4) == ConditionCode::FILESTORE_REJECTION);
REQUIRE((buf.data()[sz - 1] & 0b11) == AckTransactionStatus::TERMINATED); REQUIRE((buf[sz - 1] & 0b11) == AckTransactionStatus::TERMINATED);
bufptr = buf.data(); bufptr = buf.data();
sz = 0; sz = 0;
@ -56,14 +56,14 @@ TEST_CASE("ACK PDU", "[AckPdu]") {
} }
SECTION("Deserialize") { SECTION("Deserialize") {
AckInfo ackInfo; AckInfo ackInfo2;
auto reader = AckPduDeserializer(buf.data(), sz, ackInfo); auto reader = AckPduDeserializer(buf.data(), sz, ackInfo2);
result = reader.parseData(); result = reader.parseData();
REQUIRE(result == HasReturnvaluesIF::RETURN_OK); REQUIRE(result == HasReturnvaluesIF::RETURN_OK);
REQUIRE(ackInfo.getAckedDirective() == FileDirectives::EOF_DIRECTIVE); REQUIRE(ackInfo2.getAckedDirective() == FileDirectives::EOF_DIRECTIVE);
REQUIRE(ackInfo.getAckedConditionCode() == ConditionCode::NO_ERROR); REQUIRE(ackInfo2.getAckedConditionCode() == ConditionCode::NO_ERROR);
REQUIRE(ackInfo.getDirectiveSubtypeCode() == 0); REQUIRE(ackInfo2.getDirectiveSubtypeCode() == 0);
REQUIRE(ackInfo.getTransactionStatus() == AckTransactionStatus::ACTIVE); REQUIRE(ackInfo2.getTransactionStatus() == AckTransactionStatus::ACTIVE);
AckInfo newInfo = AckInfo(FileDirectives::FINISH, ConditionCode::FILESTORE_REJECTION, AckInfo newInfo = AckInfo(FileDirectives::FINISH, ConditionCode::FILESTORE_REJECTION,
AckTransactionStatus::TERMINATED); AckTransactionStatus::TERMINATED);
@ -73,13 +73,13 @@ TEST_CASE("ACK PDU", "[AckPdu]") {
result = ackSerializer2.serialize(&bufptr, &sz, maxsz, SerializeIF::Endianness::NETWORK); result = ackSerializer2.serialize(&bufptr, &sz, maxsz, SerializeIF::Endianness::NETWORK);
REQUIRE(result == HasReturnvaluesIF::RETURN_OK); REQUIRE(result == HasReturnvaluesIF::RETURN_OK);
auto reader2 = AckPduDeserializer(buf.data(), sz, ackInfo); auto reader2 = AckPduDeserializer(buf.data(), sz, ackInfo2);
result = reader2.parseData(); result = reader2.parseData();
REQUIRE(result == HasReturnvaluesIF::RETURN_OK); REQUIRE(result == HasReturnvaluesIF::RETURN_OK);
REQUIRE(ackInfo.getAckedDirective() == FileDirectives::FINISH); REQUIRE(ackInfo2.getAckedDirective() == FileDirectives::FINISH);
REQUIRE(ackInfo.getAckedConditionCode() == ConditionCode::FILESTORE_REJECTION); REQUIRE(ackInfo2.getAckedConditionCode() == ConditionCode::FILESTORE_REJECTION);
REQUIRE(ackInfo.getDirectiveSubtypeCode() == 0b0001); REQUIRE(ackInfo2.getDirectiveSubtypeCode() == 0b0001);
REQUIRE(ackInfo.getTransactionStatus() == AckTransactionStatus::TERMINATED); REQUIRE(ackInfo2.getTransactionStatus() == AckTransactionStatus::TERMINATED);
uint8_t prevVal = buf[sz - 2]; uint8_t prevVal = buf[sz - 2];
buf[sz - 2] = FileDirectives::INVALID_DIRECTIVE << 4; buf[sz - 2] = FileDirectives::INVALID_DIRECTIVE << 4;
@ -93,7 +93,7 @@ TEST_CASE("ACK PDU", "[AckPdu]") {
result = reader2.parseData(); result = reader2.parseData();
REQUIRE(result == cfdp::INVALID_DIRECTIVE_FIELDS); REQUIRE(result == cfdp::INVALID_DIRECTIVE_FIELDS);
buf[sz - 3] = cfdp::FileDirectives::ACK; buf[sz - 3] = cfdp::FileDirectives::ACK;
auto maxSizeTooSmall = AckPduDeserializer(buf.data(), sz - 2, ackInfo); auto maxSizeTooSmall = AckPduDeserializer(buf.data(), sz - 2, ackInfo2);
result = maxSizeTooSmall.parseData(); result = maxSizeTooSmall.parseData();
REQUIRE(result == SerializeIF::STREAM_TOO_SHORT); REQUIRE(result == SerializeIF::STREAM_TOO_SHORT);
} }

View File

@ -13,13 +13,13 @@
TEST_CASE("CFDP Base", "[CfdpBase]") { TEST_CASE("CFDP Base", "[CfdpBase]") {
using namespace cfdp; using namespace cfdp;
std::array<uint8_t, 32> serBuf; std::array<uint8_t, 32> serBuf{};
ReturnValue_t result = HasReturnvaluesIF::RETURN_OK; ReturnValue_t result = HasReturnvaluesIF::RETURN_OK;
cfdp::TransactionSeqNum seqNum = TransactionSeqNum(cfdp::WidthInBytes::ONE_BYTE, 2); cfdp::TransactionSeqNum seqNum = TransactionSeqNum(cfdp::WidthInBytes::ONE_BYTE, 2);
cfdp::EntityId sourceId = EntityId(cfdp::WidthInBytes::ONE_BYTE, 0); cfdp::EntityId sourceId = EntityId(cfdp::WidthInBytes::ONE_BYTE, 0);
cfdp::EntityId destId = EntityId(cfdp::WidthInBytes::ONE_BYTE, 1); cfdp::EntityId destId = EntityId(cfdp::WidthInBytes::ONE_BYTE, 1);
PduConfig pduConf = PduConfig pduConf =
PduConfig(cfdp::TransmissionModes::ACKNOWLEDGED, seqNum, sourceId, destId, false); PduConfig(sourceId, destId, cfdp::TransmissionModes::ACKNOWLEDGED, seqNum, false);
uint8_t* serTarget = serBuf.data(); uint8_t* serTarget = serBuf.data();
const uint8_t* deserTarget = serTarget; const uint8_t* deserTarget = serTarget;
size_t serSize = 0; size_t serSize = 0;
@ -79,8 +79,7 @@ TEST_CASE("CFDP Base", "[CfdpBase]") {
REQUIRE(serBuf[6] == 1); REQUIRE(serBuf[6] == 1);
for (uint8_t idx = 0; idx < 7; idx++) { for (uint8_t idx = 0; idx < 7; idx++) {
ReturnValue_t result = result = headerSerializer.serialize(&serTarget, &serSize, idx, SerializeIF::Endianness::BIG);
headerSerializer.serialize(&serTarget, &serSize, idx, SerializeIF::Endianness::BIG);
REQUIRE(result == static_cast<int>(SerializeIF::BUFFER_TOO_SHORT)); REQUIRE(result == static_cast<int>(SerializeIF::BUFFER_TOO_SHORT));
} }
@ -123,8 +122,7 @@ TEST_CASE("CFDP Base", "[CfdpBase]") {
SerializeIF::Endianness::BIG); SerializeIF::Endianness::BIG);
for (uint8_t idx = 0; idx < 14; idx++) { for (uint8_t idx = 0; idx < 14; idx++) {
ReturnValue_t result = result = headerSerializer.serialize(&serTarget, &serSize, idx, SerializeIF::Endianness::BIG);
headerSerializer.serialize(&serTarget, &serSize, idx, SerializeIF::Endianness::BIG);
REQUIRE(result == static_cast<int>(SerializeIF::BUFFER_TOO_SHORT)); REQUIRE(result == static_cast<int>(SerializeIF::BUFFER_TOO_SHORT));
} }
REQUIRE(headerSerializer.getCrcFlag() == true); REQUIRE(headerSerializer.getCrcFlag() == true);
@ -144,11 +142,11 @@ TEST_CASE("CFDP Base", "[CfdpBase]") {
SerializeIF::Endianness::NETWORK); SerializeIF::Endianness::NETWORK);
REQUIRE(deSerSize == 4); REQUIRE(deSerSize == 4);
REQUIRE(entityId == 0xff00ff00); REQUIRE(entityId == 0xff00ff00);
uint16_t seqNum = 0; uint16_t seqNumRaw = 0;
SerializeAdapter::deSerialize(&seqNum, serBuf.data() + 8, &deSerSize, SerializeAdapter::deSerialize(&seqNumRaw, serBuf.data() + 8, &deSerSize,
SerializeIF::Endianness::NETWORK); SerializeIF::Endianness::NETWORK);
REQUIRE(deSerSize == 2); REQUIRE(deSerSize == 2);
REQUIRE(seqNum == 0x0fff); REQUIRE(seqNumRaw == 0x0fff);
SerializeAdapter::deSerialize(&entityId, serBuf.data() + 10, &deSerSize, SerializeAdapter::deSerialize(&entityId, serBuf.data() + 10, &deSerSize,
SerializeIF::Endianness::NETWORK); SerializeIF::Endianness::NETWORK);
REQUIRE(deSerSize == 4); REQUIRE(deSerSize == 4);
@ -195,7 +193,7 @@ TEST_CASE("CFDP Base", "[CfdpBase]") {
// We unittested the serializer before, so we can use it now to generate valid raw CFDP // We unittested the serializer before, so we can use it now to generate valid raw CFDP
// data // data
auto headerSerializer = HeaderSerializer(pduConf, cfdp::PduType::FILE_DIRECTIVE, 0); auto headerSerializer = HeaderSerializer(pduConf, cfdp::PduType::FILE_DIRECTIVE, 0);
ReturnValue_t result = headerSerializer.serialize(&serTarget, &serSize, serBuf.size(), result = headerSerializer.serialize(&serTarget, &serSize, serBuf.size(),
SerializeIF::Endianness::BIG); SerializeIF::Endianness::BIG);
REQUIRE(result == result::OK); REQUIRE(result == result::OK);
REQUIRE(serBuf[1] == 0); REQUIRE(serBuf[1] == 0);
@ -272,7 +270,7 @@ TEST_CASE("CFDP Base", "[CfdpBase]") {
size_t deSerSize = headerDeser.getWholePduSize(); size_t deSerSize = headerDeser.getWholePduSize();
serTarget = serBuf.data(); serTarget = serBuf.data();
const uint8_t** serTargetConst = const_cast<const uint8_t**>(&serTarget); const auto** serTargetConst = const_cast<const uint8_t**>(&serTarget);
result = headerDeser.parseData(); result = headerDeser.parseData();
REQUIRE(result == result::OK); REQUIRE(result == result::OK);
@ -356,8 +354,7 @@ TEST_CASE("CFDP Base", "[CfdpBase]") {
cfdp::FileSize fss; cfdp::FileSize fss;
REQUIRE(fss.getSize() == 0); REQUIRE(fss.getSize() == 0);
fss.setFileSize(0x20, false); fss.setFileSize(0x20, false);
ReturnValue_t result = result = fss.serialize(&buffer, &size, fssBuf.size(), SerializeIF::Endianness::MACHINE);
fss.serialize(&buffer, &size, fssBuf.size(), SerializeIF::Endianness::MACHINE);
REQUIRE(result == HasReturnvaluesIF::RETURN_OK); REQUIRE(result == HasReturnvaluesIF::RETURN_OK);
uint32_t fileSize = 0; uint32_t fileSize = 0;
result = SerializeAdapter::deSerialize(&fileSize, fssBuf.data(), nullptr, result = SerializeAdapter::deSerialize(&fileSize, fssBuf.data(), nullptr,

View File

@ -0,0 +1,3 @@
//
// Created by rmueller on 8/3/22.
//

View File

@ -20,7 +20,7 @@ TEST_CASE("EOF PDU", "[EofPdu]") {
TransactionSeqNum seqNum(WidthInBytes::TWO_BYTES, 15); TransactionSeqNum seqNum(WidthInBytes::TWO_BYTES, 15);
EntityId sourceId(WidthInBytes::TWO_BYTES, 1); EntityId sourceId(WidthInBytes::TWO_BYTES, 1);
PduConfig pduConf(TransmissionModes::ACKNOWLEDGED, seqNum, sourceId, destId); PduConfig pduConf(sourceId, destId, TransmissionModes::ACKNOWLEDGED, seqNum);
auto eofSerializer = EofPduSerializer(pduConf, eofInfo); auto eofSerializer = EofPduSerializer(pduConf, eofInfo);
SECTION("Serialize") { SECTION("Serialize") {

View File

@ -17,7 +17,7 @@ TEST_CASE("File Data PDU", "[FileDataPdu]") {
EntityId destId(WidthInBytes::TWO_BYTES, 2); EntityId destId(WidthInBytes::TWO_BYTES, 2);
TransactionSeqNum seqNum(WidthInBytes::TWO_BYTES, 15); TransactionSeqNum seqNum(WidthInBytes::TWO_BYTES, 15);
EntityId sourceId(WidthInBytes::TWO_BYTES, 1); EntityId sourceId(WidthInBytes::TWO_BYTES, 1);
PduConfig pduConf(TransmissionModes::ACKNOWLEDGED, seqNum, sourceId, destId); PduConfig pduConf(sourceId, destId, TransmissionModes::ACKNOWLEDGED, seqNum);
for (uint8_t idx = 0; idx < 10; idx++) { for (uint8_t idx = 0; idx < 10; idx++) {
fileBuffer[idx] = idx; fileBuffer[idx] = idx;

View File

@ -14,7 +14,7 @@ TEST_CASE("Finished PDU", "[FinishedPdu]") {
EntityId destId(WidthInBytes::TWO_BYTES, 2); EntityId destId(WidthInBytes::TWO_BYTES, 2);
TransactionSeqNum seqNum(WidthInBytes::TWO_BYTES, 15); TransactionSeqNum seqNum(WidthInBytes::TWO_BYTES, 15);
EntityId sourceId(WidthInBytes::TWO_BYTES, 1); EntityId sourceId(WidthInBytes::TWO_BYTES, 1);
PduConfig pduConf(TransmissionModes::ACKNOWLEDGED, seqNum, sourceId, destId); PduConfig pduConf(sourceId, destId, TransmissionModes::ACKNOWLEDGED, seqNum);
cfdp::Lv emptyFsMsg; cfdp::Lv emptyFsMsg;
FinishedInfo info(cfdp::ConditionCode::INACTIVITY_DETECTED, FinishedInfo info(cfdp::ConditionCode::INACTIVITY_DETECTED,

View File

@ -14,7 +14,7 @@ TEST_CASE("Keep Alive PDU", "[KeepAlivePdu]") {
EntityId destId(WidthInBytes::TWO_BYTES, 2); EntityId destId(WidthInBytes::TWO_BYTES, 2);
TransactionSeqNum seqNum(WidthInBytes::TWO_BYTES, 15); TransactionSeqNum seqNum(WidthInBytes::TWO_BYTES, 15);
EntityId sourceId(WidthInBytes::TWO_BYTES, 1); EntityId sourceId(WidthInBytes::TWO_BYTES, 1);
PduConfig pduConf(TransmissionModes::ACKNOWLEDGED, seqNum, sourceId, destId); PduConfig pduConf(sourceId, destId, TransmissionModes::ACKNOWLEDGED, seqNum);
FileSize progress(0x50); FileSize progress(0x50);

View File

@ -17,7 +17,7 @@ TEST_CASE("Metadata PDU", "[MetadataPdu]") {
EntityId destId(WidthInBytes::TWO_BYTES, 2); EntityId destId(WidthInBytes::TWO_BYTES, 2);
TransactionSeqNum seqNum(WidthInBytes::TWO_BYTES, 15); TransactionSeqNum seqNum(WidthInBytes::TWO_BYTES, 15);
EntityId sourceId(WidthInBytes::TWO_BYTES, 1); EntityId sourceId(WidthInBytes::TWO_BYTES, 1);
PduConfig pduConf(TransmissionModes::ACKNOWLEDGED, seqNum, sourceId, destId); PduConfig pduConf(sourceId, destId, TransmissionModes::ACKNOWLEDGED, seqNum);
std::string firstFileName = "hello.txt"; std::string firstFileName = "hello.txt";
cfdp::Lv sourceFileName(reinterpret_cast<const uint8_t*>(firstFileName.data()), cfdp::Lv sourceFileName(reinterpret_cast<const uint8_t*>(firstFileName.data()),

View File

@ -15,7 +15,7 @@ TEST_CASE("NAK PDU", "[NakPdu]") {
EntityId destId(WidthInBytes::TWO_BYTES, 2); EntityId destId(WidthInBytes::TWO_BYTES, 2);
TransactionSeqNum seqNum(WidthInBytes::TWO_BYTES, 15); TransactionSeqNum seqNum(WidthInBytes::TWO_BYTES, 15);
EntityId sourceId(WidthInBytes::TWO_BYTES, 1); EntityId sourceId(WidthInBytes::TWO_BYTES, 1);
PduConfig pduConf(TransmissionModes::ACKNOWLEDGED, seqNum, sourceId, destId); PduConfig pduConf(sourceId, destId, TransmissionModes::ACKNOWLEDGED, seqNum);
FileSize startOfScope(50); FileSize startOfScope(50);
FileSize endOfScope(1050); FileSize endOfScope(1050);

View File

@ -14,7 +14,7 @@ TEST_CASE("Prompt PDU", "[PromptPdu]") {
EntityId destId(WidthInBytes::TWO_BYTES, 2); EntityId destId(WidthInBytes::TWO_BYTES, 2);
TransactionSeqNum seqNum(WidthInBytes::TWO_BYTES, 15); TransactionSeqNum seqNum(WidthInBytes::TWO_BYTES, 15);
EntityId sourceId(WidthInBytes::TWO_BYTES, 1); EntityId sourceId(WidthInBytes::TWO_BYTES, 1);
PduConfig pduConf(TransmissionModes::ACKNOWLEDGED, seqNum, sourceId, destId); PduConfig pduConf(sourceId, destId, TransmissionModes::ACKNOWLEDGED, seqNum);
SECTION("Serialize") { SECTION("Serialize") {
PromptPduSerializer serializer(pduConf, cfdp::PromptResponseRequired::PROMPT_KEEP_ALIVE); PromptPduSerializer serializer(pduConf, cfdp::PromptResponseRequired::PROMPT_KEEP_ALIVE);
@ -24,7 +24,7 @@ TEST_CASE("Prompt PDU", "[PromptPdu]") {
REQUIRE(sz == 12); REQUIRE(sz == 12);
REQUIRE(serializer.getPduDataFieldLen() == 2); REQUIRE(serializer.getPduDataFieldLen() == 2);
REQUIRE(rawBuf[10] == FileDirectives::PROMPT); REQUIRE(rawBuf[10] == FileDirectives::PROMPT);
REQUIRE((rawBuf[sz - 1] >> 7) & 0x01 == cfdp::PromptResponseRequired::PROMPT_KEEP_ALIVE); REQUIRE(((rawBuf[sz - 1] >> 7) & 0x01) == cfdp::PromptResponseRequired::PROMPT_KEEP_ALIVE);
for (size_t invalidMaxSz = 0; invalidMaxSz < sz; invalidMaxSz++) { for (size_t invalidMaxSz = 0; invalidMaxSz < sz; invalidMaxSz++) {
uint8_t* buffer = rawBuf.data(); uint8_t* buffer = rawBuf.data();

View File

@ -1,10 +1,10 @@
target_sources(${FSFW_TEST_TGT} PRIVATE target_sources(
RingBufferTest.cpp ${FSFW_TEST_TGT}
PRIVATE RingBufferTest.cpp
TestArrayList.cpp TestArrayList.cpp
TestDynamicFifo.cpp TestDynamicFifo.cpp
TestFifo.cpp TestFifo.cpp
TestFixedArrayList.cpp TestFixedArrayList.cpp
TestFixedMap.cpp TestFixedMap.cpp
TestFixedOrderedMultimap.cpp TestFixedOrderedMultimap.cpp
TestPlacementFactory.cpp TestPlacementFactory.cpp)
)

View File

@ -1,6 +1,3 @@
target_sources(${FSFW_TEST_TGT} PRIVATE target_sources(
testLocalPoolVariable.cpp ${FSFW_TEST_TGT} PRIVATE testLocalPoolVariable.cpp testLocalPoolVector.cpp
testLocalPoolVector.cpp testDataSet.cpp testLocalPoolManager.cpp)
testDataSet.cpp
testLocalPoolManager.cpp
)

View File

@ -1,4 +1,2 @@
target_sources(${FSFW_TEST_TGT} PRIVATE target_sources(${FSFW_TEST_TGT} PRIVATE DeviceHandlerCommander.cpp
DeviceHandlerCommander.cpp TestDeviceHandlerBase.cpp)
TestDeviceHandlerBase.cpp
)

View File

@ -1,7 +1,3 @@
target_sources(${FSFW_TEST_TGT} PRIVATE target_sources(
testDleEncoder.cpp ${FSFW_TEST_TGT} PRIVATE testDleEncoder.cpp testOpDivider.cpp testBitutil.cpp
testOpDivider.cpp testCRC.cpp testTimevalOperations.cpp)
testBitutil.cpp
testCRC.cpp
testTimevalOperations.cpp
)

View File

@ -1,3 +1 @@
target_sources(${FSFW_TEST_TGT} PRIVATE target_sources(${FSFW_TEST_TGT} PRIVATE testCommandExecutor.cpp)
testCommandExecutor.cpp
)

View File

@ -1,3 +1 @@
target_sources(${FSFW_TEST_TGT} PRIVATE target_sources(${FSFW_TEST_TGT} PRIVATE TestInternalErrorReporter.cpp)
TestInternalErrorReporter.cpp
)

View File

@ -1,5 +1,6 @@
target_sources(${FSFW_TEST_TGT} PRIVATE target_sources(
PowerSwitcherMock.cpp ${FSFW_TEST_TGT}
PRIVATE PowerSwitcherMock.cpp
DeviceHandlerMock.cpp DeviceHandlerMock.cpp
DeviceFdirMock.cpp DeviceFdirMock.cpp
CookieIFMock.cpp CookieIFMock.cpp
@ -12,5 +13,4 @@ target_sources(${FSFW_TEST_TGT} PRIVATE
AcceptsTmMock.cpp AcceptsTmMock.cpp
PusDistributorMock.cpp PusDistributorMock.cpp
CcsdsCheckerMock.cpp CcsdsCheckerMock.cpp
AcceptsTcMock.cpp AcceptsTcMock.cpp)
)

View File

@ -1,5 +1,2 @@
target_sources(${FSFW_TEST_TGT} PRIVATE target_sources(${FSFW_TEST_TGT} PRIVATE testMq.cpp TestSemaphore.cpp
testMq.cpp TestClock.cpp)
TestSemaphore.cpp
TestClock.cpp
)

View File

@ -1,3 +1 @@
target_sources(${FSFW_TEST_TGT} PRIVATE target_sources(${FSFW_TEST_TGT} PRIVATE testPowerSwitcher.cpp)
testPowerSwitcher.cpp
)

View File

@ -1,6 +1,3 @@
target_sources(${FSFW_TEST_TGT} PRIVATE target_sources(
testSerialBufferAdapter.cpp ${FSFW_TEST_TGT} PRIVATE testSerialBufferAdapter.cpp testSerializeAdapter.cpp
testSerializeAdapter.cpp testSerialLinkedPacket.cpp testSerializeIF.cpp)
testSerialLinkedPacket.cpp
testSerializeIF.cpp
)

View File

@ -1,4 +1 @@
target_sources(${FSFW_TEST_TGT} PRIVATE target_sources(${FSFW_TEST_TGT} PRIVATE testAccessor.cpp testPool.cpp)
testAccessor.cpp
testPool.cpp
)

View File

@ -1,3 +1 @@
target_sources(${FSFW_TEST_TGT} PRIVATE target_sources(${FSFW_TEST_TGT} PRIVATE testCcsdsDistributor.cpp)
testCcsdsDistributor.cpp
)

View File

@ -1,23 +1,16 @@
target_sources(${FSFW_TEST_TGT} PRIVATE target_sources(
ipc/MissionMessageTypes.cpp ${FSFW_TEST_TGT} PRIVATE ipc/MissionMessageTypes.cpp
pollingsequence/PollingSequenceFactory.cpp pollingsequence/PollingSequenceFactory.cpp)
)
# Add include paths for the executable # Add include paths for the executable
target_include_directories(${FSFW_TEST_TGT} PRIVATE target_include_directories(${FSFW_TEST_TGT} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR})
${CMAKE_CURRENT_SOURCE_DIR}
)
# If a special translation file for object IDs exists, compile it. # If a special translation file for object IDs exists, compile it.
if(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/objects/translateObjects.cpp") if(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/objects/translateObjects.cpp")
target_sources(${FSFW_TEST_TGT} PRIVATE target_sources(${FSFW_TEST_TGT} PRIVATE objects/translateObjects.cpp)
objects/translateObjects.cpp
)
endif() endif()
# If a special translation file for events exists, compile it. # If a special translation file for events exists, compile it.
if(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/objects/translateObjects.cpp") if(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/objects/translateObjects.cpp")
target_sources(${FSFW_TEST_TGT} PRIVATE target_sources(${FSFW_TEST_TGT} PRIVATE events/translateEvents.cpp)
events/translateEvents.cpp
)
endif() endif()

View File

@ -1,4 +1 @@
target_sources(${FSFW_TEST_TGT} PRIVATE target_sources(${FSFW_TEST_TGT} PRIVATE TestCountdown.cpp TestCCSDSTime.cpp)
TestCountdown.cpp
TestCCSDSTime.cpp
)

View File

@ -1,10 +1,10 @@
target_sources(${FSFW_TEST_TGT} PRIVATE target_sources(
testCcsdsCreator.cpp ${FSFW_TEST_TGT}
PRIVATE testCcsdsCreator.cpp
testCcsdsReader.cpp testCcsdsReader.cpp
testPusTcCreator.cpp testPusTcCreator.cpp
testPusTcReader.cpp testPusTcReader.cpp
testPusTmCreator.cpp testPusTmCreator.cpp
testPusTmReader.cpp testPusTmReader.cpp
testCcsds.cpp testCcsds.cpp
testZcTmWriter.cpp testZcTmWriter.cpp)
)

View File

@ -1,6 +1,2 @@
target_sources(${FSFW_TEST_TGT} PRIVATE target_sources(${FSFW_TEST_TGT} PRIVATE testStoreHelper.cpp testSendHelper.cpp
testStoreHelper.cpp testStoreAndSendHelper.cpp testPsb.cpp)
testSendHelper.cpp
testStoreAndSendHelper.cpp
testPsb.cpp
)

View File

@ -1,4 +1,2 @@
target_sources(${FSFW_TEST_TGT} PRIVATE target_sources(${FSFW_TEST_TGT} PRIVATE testUnsignedByteField.cpp
testUnsignedByteField.cpp testObjectId.cpp)
testObjectId.cpp
)