clean up a few tests
This commit is contained in:
parent
df690b9628
commit
60ea9a9a7c
@ -7,7 +7,8 @@ cmake_fmt="cmake-format"
|
||||
file_selectors="-iname CMakeLists.txt"
|
||||
if command -v ${cmake_fmt} &> /dev/null; then
|
||||
${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
|
||||
echo "No ${cmake_fmt} tool found, not formatting CMake files"
|
||||
fi
|
||||
|
@ -42,17 +42,17 @@ enum ChecksumType {
|
||||
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 {
|
||||
NO_RECORD_BOUNDARIES_PRESERVATION = 0,
|
||||
RECORD_BOUNDARIES_PRESERVATION = 1
|
||||
NO_RECORD_BOUNDARIES_PRESERVATION = false,
|
||||
RECORD_BOUNDARIES_PRESERVATION = true
|
||||
};
|
||||
|
||||
enum WidthInBytes : uint8_t {
|
||||
@ -106,7 +106,7 @@ enum FinishedFileStatus {
|
||||
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 {
|
||||
FILESTORE_REQUEST = 0x00,
|
||||
|
@ -1,12 +1,14 @@
|
||||
#include "PduConfig.h"
|
||||
|
||||
PduConfig::PduConfig(cfdp::TransmissionModes mode, cfdp::TransactionSeqNum seqNum,
|
||||
cfdp::EntityId sourceId, cfdp::EntityId destId, bool crcFlag, bool largeFile,
|
||||
#include <utility>
|
||||
|
||||
PduConfig::PduConfig(cfdp::EntityId sourceId, cfdp::EntityId destId, cfdp::TransmissionModes mode,
|
||||
cfdp::TransactionSeqNum seqNum, bool crcFlag, bool largeFile,
|
||||
cfdp::Direction direction)
|
||||
: mode(mode),
|
||||
seqNum(seqNum),
|
||||
sourceId(sourceId),
|
||||
destId(destId),
|
||||
seqNum(std::move(seqNum)),
|
||||
sourceId(std::move(sourceId)),
|
||||
destId(std::move(destId)),
|
||||
crcFlag(crcFlag),
|
||||
largeFile(largeFile),
|
||||
direction(direction) {}
|
||||
|
@ -21,8 +21,8 @@ struct TransactionSeqNum : public VarLenField {
|
||||
|
||||
class PduConfig {
|
||||
public:
|
||||
PduConfig(cfdp::TransmissionModes mode, cfdp::TransactionSeqNum seqNum, cfdp::EntityId sourceId,
|
||||
cfdp::EntityId destId, bool crcFlag = false, bool largeFile = false,
|
||||
PduConfig(cfdp::EntityId sourceId, cfdp::EntityId destId, cfdp::TransmissionModes mode,
|
||||
cfdp::TransactionSeqNum seqNum, bool crcFlag = false, bool largeFile = false,
|
||||
cfdp::Direction direction = cfdp::Direction::TOWARDS_RECEIVER);
|
||||
cfdp::TransmissionModes mode;
|
||||
cfdp::TransactionSeqNum seqNum;
|
||||
|
@ -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();
|
||||
}
|
||||
|
@ -4,9 +4,9 @@
|
||||
#include <cstddef>
|
||||
#include <cstdint>
|
||||
|
||||
#include "../definitions.h"
|
||||
#include "fsfw/cfdp/definitions.h"
|
||||
#include "fsfw/serialize/SerializeIF.h"
|
||||
|
||||
#include "fsfw/util/UnsignedByteField.h"
|
||||
namespace cfdp {
|
||||
|
||||
class VarLenField : public SerializeIF {
|
||||
@ -19,6 +19,8 @@ class VarLenField : public SerializeIF {
|
||||
};
|
||||
|
||||
VarLenField();
|
||||
template <typename T>
|
||||
explicit VarLenField(UnsignedByteField<T> byteField);
|
||||
VarLenField(cfdp::WidthInBytes width, 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,
|
||||
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,
|
||||
Endianness streamEndianness);
|
||||
|
||||
cfdp::WidthInBytes getWidth() const;
|
||||
size_t getValue() const;
|
||||
[[nodiscard]] cfdp::WidthInBytes getWidth() const;
|
||||
[[nodiscard]] size_t getValue() const;
|
||||
|
||||
private:
|
||||
ReturnValue_t deSerialize(const uint8_t **buffer, size_t *size,
|
||||
|
@ -1,14 +1,7 @@
|
||||
target_sources(${FSFW_TEST_TGT} PRIVATE
|
||||
CatchDefinitions.cpp
|
||||
CatchFactory.cpp
|
||||
printChar.cpp
|
||||
testVersion.cpp
|
||||
)
|
||||
target_sources(${FSFW_TEST_TGT} PRIVATE CatchDefinitions.cpp CatchFactory.cpp
|
||||
printChar.cpp testVersion.cpp)
|
||||
|
||||
target_sources(${FSFW_TEST_TGT} PRIVATE
|
||||
CatchRunner.cpp
|
||||
CatchSetup.cpp
|
||||
)
|
||||
target_sources(${FSFW_TEST_TGT} PRIVATE CatchRunner.cpp CatchSetup.cpp)
|
||||
|
||||
add_subdirectory(testcfg)
|
||||
add_subdirectory(mocks)
|
||||
|
@ -1,3 +1 @@
|
||||
target_sources(${FSFW_TEST_TGT} PRIVATE
|
||||
TestActionHelper.cpp
|
||||
)
|
||||
target_sources(${FSFW_TEST_TGT} PRIVATE TestActionHelper.cpp)
|
||||
|
@ -1,12 +1,13 @@
|
||||
target_sources(${FSFW_TEST_TGT} PRIVATE
|
||||
testCfdp.cpp
|
||||
testTlvsLvs.cpp
|
||||
testAckPdu.cpp
|
||||
testEofPdu.cpp
|
||||
testNakPdu.cpp
|
||||
testFinishedPdu.cpp
|
||||
testPromptPdu.cpp
|
||||
testKeepAlivePdu.cpp
|
||||
testMetadataPdu.cpp
|
||||
testFileData.cpp
|
||||
)
|
||||
target_sources(
|
||||
${FSFW_TEST_TGT}
|
||||
PRIVATE testCfdp.cpp
|
||||
testTlvsLvs.cpp
|
||||
testAckPdu.cpp
|
||||
testEofPdu.cpp
|
||||
testNakPdu.cpp
|
||||
testFinishedPdu.cpp
|
||||
testPromptPdu.cpp
|
||||
testKeepAlivePdu.cpp
|
||||
testMetadataPdu.cpp
|
||||
testFileData.cpp
|
||||
testCfdpHeader.cpp)
|
||||
|
@ -7,7 +7,7 @@
|
||||
|
||||
TEST_CASE("ACK PDU", "[AckPdu]") {
|
||||
using namespace cfdp;
|
||||
ReturnValue_t result = HasReturnvaluesIF::RETURN_OK;
|
||||
ReturnValue_t result;
|
||||
std::array<uint8_t, 256> buf = {};
|
||||
uint8_t* bufptr = buf.data();
|
||||
size_t maxsz = buf.size();
|
||||
@ -15,7 +15,7 @@ TEST_CASE("ACK PDU", "[AckPdu]") {
|
||||
auto seqNum = TransactionSeqNum(WidthInBytes::TWO_BYTES, 15);
|
||||
auto sourceId = EntityId(WidthInBytes::TWO_BYTES, 1);
|
||||
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,
|
||||
AckTransactionStatus::ACTIVE);
|
||||
auto ackSerializer = AckPduSerializer(ackInfo, pduConf);
|
||||
@ -23,10 +23,10 @@ TEST_CASE("ACK PDU", "[AckPdu]") {
|
||||
REQUIRE(result == HasReturnvaluesIF::RETURN_OK);
|
||||
|
||||
SECTION("Serialize") {
|
||||
REQUIRE(buf.data()[sz - 3] == cfdp::FileDirectives::ACK);
|
||||
REQUIRE((buf.data()[sz - 2] >> 4) == FileDirectives::EOF_DIRECTIVE);
|
||||
REQUIRE((buf.data()[sz - 2] & 0x0f) == 0);
|
||||
REQUIRE(buf.data()[sz - 1] == AckTransactionStatus::ACTIVE);
|
||||
REQUIRE(buf[sz - 3] == cfdp::FileDirectives::ACK);
|
||||
REQUIRE((buf[sz - 2] >> 4) == FileDirectives::EOF_DIRECTIVE);
|
||||
REQUIRE((buf[sz - 2] & 0x0f) == 0);
|
||||
REQUIRE(buf[sz - 1] == AckTransactionStatus::ACTIVE);
|
||||
ackInfo.setAckedDirective(FileDirectives::FINISH);
|
||||
ackInfo.setAckedConditionCode(ConditionCode::FILESTORE_REJECTION);
|
||||
ackInfo.setTransactionStatus(AckTransactionStatus::TERMINATED);
|
||||
@ -35,11 +35,11 @@ TEST_CASE("ACK PDU", "[AckPdu]") {
|
||||
sz = 0;
|
||||
result = ackSerializer2.serialize(&bufptr, &sz, maxsz, SerializeIF::Endianness::NETWORK);
|
||||
REQUIRE(result == HasReturnvaluesIF::RETURN_OK);
|
||||
REQUIRE(buf.data()[sz - 3] == cfdp::FileDirectives::ACK);
|
||||
REQUIRE((buf.data()[sz - 2] >> 4) == FileDirectives::FINISH);
|
||||
REQUIRE((buf.data()[sz - 2] & 0x0f) == 0b0001);
|
||||
REQUIRE((buf.data()[sz - 1] >> 4) == ConditionCode::FILESTORE_REJECTION);
|
||||
REQUIRE((buf.data()[sz - 1] & 0b11) == AckTransactionStatus::TERMINATED);
|
||||
REQUIRE(buf[sz - 3] == cfdp::FileDirectives::ACK);
|
||||
REQUIRE((buf[sz - 2] >> 4) == FileDirectives::FINISH);
|
||||
REQUIRE((buf[sz - 2] & 0x0f) == 0b0001);
|
||||
REQUIRE((buf[sz - 1] >> 4) == ConditionCode::FILESTORE_REJECTION);
|
||||
REQUIRE((buf[sz - 1] & 0b11) == AckTransactionStatus::TERMINATED);
|
||||
|
||||
bufptr = buf.data();
|
||||
sz = 0;
|
||||
@ -56,14 +56,14 @@ TEST_CASE("ACK PDU", "[AckPdu]") {
|
||||
}
|
||||
|
||||
SECTION("Deserialize") {
|
||||
AckInfo ackInfo;
|
||||
auto reader = AckPduDeserializer(buf.data(), sz, ackInfo);
|
||||
AckInfo ackInfo2;
|
||||
auto reader = AckPduDeserializer(buf.data(), sz, ackInfo2);
|
||||
result = reader.parseData();
|
||||
REQUIRE(result == HasReturnvaluesIF::RETURN_OK);
|
||||
REQUIRE(ackInfo.getAckedDirective() == FileDirectives::EOF_DIRECTIVE);
|
||||
REQUIRE(ackInfo.getAckedConditionCode() == ConditionCode::NO_ERROR);
|
||||
REQUIRE(ackInfo.getDirectiveSubtypeCode() == 0);
|
||||
REQUIRE(ackInfo.getTransactionStatus() == AckTransactionStatus::ACTIVE);
|
||||
REQUIRE(ackInfo2.getAckedDirective() == FileDirectives::EOF_DIRECTIVE);
|
||||
REQUIRE(ackInfo2.getAckedConditionCode() == ConditionCode::NO_ERROR);
|
||||
REQUIRE(ackInfo2.getDirectiveSubtypeCode() == 0);
|
||||
REQUIRE(ackInfo2.getTransactionStatus() == AckTransactionStatus::ACTIVE);
|
||||
|
||||
AckInfo newInfo = AckInfo(FileDirectives::FINISH, ConditionCode::FILESTORE_REJECTION,
|
||||
AckTransactionStatus::TERMINATED);
|
||||
@ -73,13 +73,13 @@ TEST_CASE("ACK PDU", "[AckPdu]") {
|
||||
result = ackSerializer2.serialize(&bufptr, &sz, maxsz, SerializeIF::Endianness::NETWORK);
|
||||
REQUIRE(result == HasReturnvaluesIF::RETURN_OK);
|
||||
|
||||
auto reader2 = AckPduDeserializer(buf.data(), sz, ackInfo);
|
||||
auto reader2 = AckPduDeserializer(buf.data(), sz, ackInfo2);
|
||||
result = reader2.parseData();
|
||||
REQUIRE(result == HasReturnvaluesIF::RETURN_OK);
|
||||
REQUIRE(ackInfo.getAckedDirective() == FileDirectives::FINISH);
|
||||
REQUIRE(ackInfo.getAckedConditionCode() == ConditionCode::FILESTORE_REJECTION);
|
||||
REQUIRE(ackInfo.getDirectiveSubtypeCode() == 0b0001);
|
||||
REQUIRE(ackInfo.getTransactionStatus() == AckTransactionStatus::TERMINATED);
|
||||
REQUIRE(ackInfo2.getAckedDirective() == FileDirectives::FINISH);
|
||||
REQUIRE(ackInfo2.getAckedConditionCode() == ConditionCode::FILESTORE_REJECTION);
|
||||
REQUIRE(ackInfo2.getDirectiveSubtypeCode() == 0b0001);
|
||||
REQUIRE(ackInfo2.getTransactionStatus() == AckTransactionStatus::TERMINATED);
|
||||
|
||||
uint8_t prevVal = buf[sz - 2];
|
||||
buf[sz - 2] = FileDirectives::INVALID_DIRECTIVE << 4;
|
||||
@ -93,7 +93,7 @@ TEST_CASE("ACK PDU", "[AckPdu]") {
|
||||
result = reader2.parseData();
|
||||
REQUIRE(result == cfdp::INVALID_DIRECTIVE_FIELDS);
|
||||
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();
|
||||
REQUIRE(result == SerializeIF::STREAM_TOO_SHORT);
|
||||
}
|
||||
|
@ -13,13 +13,13 @@
|
||||
|
||||
TEST_CASE("CFDP Base", "[CfdpBase]") {
|
||||
using namespace cfdp;
|
||||
std::array<uint8_t, 32> serBuf;
|
||||
std::array<uint8_t, 32> serBuf{};
|
||||
ReturnValue_t result = HasReturnvaluesIF::RETURN_OK;
|
||||
cfdp::TransactionSeqNum seqNum = TransactionSeqNum(cfdp::WidthInBytes::ONE_BYTE, 2);
|
||||
cfdp::EntityId sourceId = EntityId(cfdp::WidthInBytes::ONE_BYTE, 0);
|
||||
cfdp::EntityId destId = EntityId(cfdp::WidthInBytes::ONE_BYTE, 1);
|
||||
PduConfig pduConf =
|
||||
PduConfig(cfdp::TransmissionModes::ACKNOWLEDGED, seqNum, sourceId, destId, false);
|
||||
PduConfig(sourceId, destId, cfdp::TransmissionModes::ACKNOWLEDGED, seqNum, false);
|
||||
uint8_t* serTarget = serBuf.data();
|
||||
const uint8_t* deserTarget = serTarget;
|
||||
size_t serSize = 0;
|
||||
@ -79,8 +79,7 @@ TEST_CASE("CFDP Base", "[CfdpBase]") {
|
||||
REQUIRE(serBuf[6] == 1);
|
||||
|
||||
for (uint8_t idx = 0; idx < 7; idx++) {
|
||||
ReturnValue_t result =
|
||||
headerSerializer.serialize(&serTarget, &serSize, idx, SerializeIF::Endianness::BIG);
|
||||
result = headerSerializer.serialize(&serTarget, &serSize, idx, SerializeIF::Endianness::BIG);
|
||||
REQUIRE(result == static_cast<int>(SerializeIF::BUFFER_TOO_SHORT));
|
||||
}
|
||||
|
||||
@ -123,8 +122,7 @@ TEST_CASE("CFDP Base", "[CfdpBase]") {
|
||||
SerializeIF::Endianness::BIG);
|
||||
|
||||
for (uint8_t idx = 0; idx < 14; idx++) {
|
||||
ReturnValue_t result =
|
||||
headerSerializer.serialize(&serTarget, &serSize, idx, SerializeIF::Endianness::BIG);
|
||||
result = headerSerializer.serialize(&serTarget, &serSize, idx, SerializeIF::Endianness::BIG);
|
||||
REQUIRE(result == static_cast<int>(SerializeIF::BUFFER_TOO_SHORT));
|
||||
}
|
||||
REQUIRE(headerSerializer.getCrcFlag() == true);
|
||||
@ -144,11 +142,11 @@ TEST_CASE("CFDP Base", "[CfdpBase]") {
|
||||
SerializeIF::Endianness::NETWORK);
|
||||
REQUIRE(deSerSize == 4);
|
||||
REQUIRE(entityId == 0xff00ff00);
|
||||
uint16_t seqNum = 0;
|
||||
SerializeAdapter::deSerialize(&seqNum, serBuf.data() + 8, &deSerSize,
|
||||
uint16_t seqNumRaw = 0;
|
||||
SerializeAdapter::deSerialize(&seqNumRaw, serBuf.data() + 8, &deSerSize,
|
||||
SerializeIF::Endianness::NETWORK);
|
||||
REQUIRE(deSerSize == 2);
|
||||
REQUIRE(seqNum == 0x0fff);
|
||||
REQUIRE(seqNumRaw == 0x0fff);
|
||||
SerializeAdapter::deSerialize(&entityId, serBuf.data() + 10, &deSerSize,
|
||||
SerializeIF::Endianness::NETWORK);
|
||||
REQUIRE(deSerSize == 4);
|
||||
@ -195,8 +193,8 @@ TEST_CASE("CFDP Base", "[CfdpBase]") {
|
||||
// We unittested the serializer before, so we can use it now to generate valid raw CFDP
|
||||
// data
|
||||
auto headerSerializer = HeaderSerializer(pduConf, cfdp::PduType::FILE_DIRECTIVE, 0);
|
||||
ReturnValue_t result = headerSerializer.serialize(&serTarget, &serSize, serBuf.size(),
|
||||
SerializeIF::Endianness::BIG);
|
||||
result = headerSerializer.serialize(&serTarget, &serSize, serBuf.size(),
|
||||
SerializeIF::Endianness::BIG);
|
||||
REQUIRE(result == result::OK);
|
||||
REQUIRE(serBuf[1] == 0);
|
||||
REQUIRE(serBuf[2] == 0);
|
||||
@ -272,7 +270,7 @@ TEST_CASE("CFDP Base", "[CfdpBase]") {
|
||||
|
||||
size_t deSerSize = headerDeser.getWholePduSize();
|
||||
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();
|
||||
REQUIRE(result == result::OK);
|
||||
|
||||
@ -356,8 +354,7 @@ TEST_CASE("CFDP Base", "[CfdpBase]") {
|
||||
cfdp::FileSize fss;
|
||||
REQUIRE(fss.getSize() == 0);
|
||||
fss.setFileSize(0x20, false);
|
||||
ReturnValue_t result =
|
||||
fss.serialize(&buffer, &size, fssBuf.size(), SerializeIF::Endianness::MACHINE);
|
||||
result = fss.serialize(&buffer, &size, fssBuf.size(), SerializeIF::Endianness::MACHINE);
|
||||
REQUIRE(result == HasReturnvaluesIF::RETURN_OK);
|
||||
uint32_t fileSize = 0;
|
||||
result = SerializeAdapter::deSerialize(&fileSize, fssBuf.data(), nullptr,
|
||||
|
3
unittests/cfdp/testCfdpHeader.cpp
Normal file
3
unittests/cfdp/testCfdpHeader.cpp
Normal file
@ -0,0 +1,3 @@
|
||||
//
|
||||
// Created by rmueller on 8/3/22.
|
||||
//
|
@ -20,7 +20,7 @@ TEST_CASE("EOF PDU", "[EofPdu]") {
|
||||
TransactionSeqNum seqNum(WidthInBytes::TWO_BYTES, 15);
|
||||
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);
|
||||
SECTION("Serialize") {
|
||||
|
@ -17,7 +17,7 @@ TEST_CASE("File Data PDU", "[FileDataPdu]") {
|
||||
EntityId destId(WidthInBytes::TWO_BYTES, 2);
|
||||
TransactionSeqNum seqNum(WidthInBytes::TWO_BYTES, 15);
|
||||
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++) {
|
||||
fileBuffer[idx] = idx;
|
||||
|
@ -14,7 +14,7 @@ TEST_CASE("Finished PDU", "[FinishedPdu]") {
|
||||
EntityId destId(WidthInBytes::TWO_BYTES, 2);
|
||||
TransactionSeqNum seqNum(WidthInBytes::TWO_BYTES, 15);
|
||||
EntityId sourceId(WidthInBytes::TWO_BYTES, 1);
|
||||
PduConfig pduConf(TransmissionModes::ACKNOWLEDGED, seqNum, sourceId, destId);
|
||||
PduConfig pduConf(sourceId, destId, TransmissionModes::ACKNOWLEDGED, seqNum);
|
||||
|
||||
cfdp::Lv emptyFsMsg;
|
||||
FinishedInfo info(cfdp::ConditionCode::INACTIVITY_DETECTED,
|
||||
|
@ -14,7 +14,7 @@ TEST_CASE("Keep Alive PDU", "[KeepAlivePdu]") {
|
||||
EntityId destId(WidthInBytes::TWO_BYTES, 2);
|
||||
TransactionSeqNum seqNum(WidthInBytes::TWO_BYTES, 15);
|
||||
EntityId sourceId(WidthInBytes::TWO_BYTES, 1);
|
||||
PduConfig pduConf(TransmissionModes::ACKNOWLEDGED, seqNum, sourceId, destId);
|
||||
PduConfig pduConf(sourceId, destId, TransmissionModes::ACKNOWLEDGED, seqNum);
|
||||
|
||||
FileSize progress(0x50);
|
||||
|
||||
|
@ -17,7 +17,7 @@ TEST_CASE("Metadata PDU", "[MetadataPdu]") {
|
||||
EntityId destId(WidthInBytes::TWO_BYTES, 2);
|
||||
TransactionSeqNum seqNum(WidthInBytes::TWO_BYTES, 15);
|
||||
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";
|
||||
cfdp::Lv sourceFileName(reinterpret_cast<const uint8_t*>(firstFileName.data()),
|
||||
|
@ -15,7 +15,7 @@ TEST_CASE("NAK PDU", "[NakPdu]") {
|
||||
EntityId destId(WidthInBytes::TWO_BYTES, 2);
|
||||
TransactionSeqNum seqNum(WidthInBytes::TWO_BYTES, 15);
|
||||
EntityId sourceId(WidthInBytes::TWO_BYTES, 1);
|
||||
PduConfig pduConf(TransmissionModes::ACKNOWLEDGED, seqNum, sourceId, destId);
|
||||
PduConfig pduConf(sourceId, destId, TransmissionModes::ACKNOWLEDGED, seqNum);
|
||||
|
||||
FileSize startOfScope(50);
|
||||
FileSize endOfScope(1050);
|
||||
|
@ -14,7 +14,7 @@ TEST_CASE("Prompt PDU", "[PromptPdu]") {
|
||||
EntityId destId(WidthInBytes::TWO_BYTES, 2);
|
||||
TransactionSeqNum seqNum(WidthInBytes::TWO_BYTES, 15);
|
||||
EntityId sourceId(WidthInBytes::TWO_BYTES, 1);
|
||||
PduConfig pduConf(TransmissionModes::ACKNOWLEDGED, seqNum, sourceId, destId);
|
||||
PduConfig pduConf(sourceId, destId, TransmissionModes::ACKNOWLEDGED, seqNum);
|
||||
|
||||
SECTION("Serialize") {
|
||||
PromptPduSerializer serializer(pduConf, cfdp::PromptResponseRequired::PROMPT_KEEP_ALIVE);
|
||||
@ -24,7 +24,7 @@ TEST_CASE("Prompt PDU", "[PromptPdu]") {
|
||||
REQUIRE(sz == 12);
|
||||
REQUIRE(serializer.getPduDataFieldLen() == 2);
|
||||
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++) {
|
||||
uint8_t* buffer = rawBuf.data();
|
||||
|
@ -1,10 +1,10 @@
|
||||
target_sources(${FSFW_TEST_TGT} PRIVATE
|
||||
RingBufferTest.cpp
|
||||
TestArrayList.cpp
|
||||
TestDynamicFifo.cpp
|
||||
TestFifo.cpp
|
||||
TestFixedArrayList.cpp
|
||||
TestFixedMap.cpp
|
||||
TestFixedOrderedMultimap.cpp
|
||||
TestPlacementFactory.cpp
|
||||
)
|
||||
target_sources(
|
||||
${FSFW_TEST_TGT}
|
||||
PRIVATE RingBufferTest.cpp
|
||||
TestArrayList.cpp
|
||||
TestDynamicFifo.cpp
|
||||
TestFifo.cpp
|
||||
TestFixedArrayList.cpp
|
||||
TestFixedMap.cpp
|
||||
TestFixedOrderedMultimap.cpp
|
||||
TestPlacementFactory.cpp)
|
||||
|
@ -1,6 +1,3 @@
|
||||
target_sources(${FSFW_TEST_TGT} PRIVATE
|
||||
testLocalPoolVariable.cpp
|
||||
testLocalPoolVector.cpp
|
||||
testDataSet.cpp
|
||||
testLocalPoolManager.cpp
|
||||
)
|
||||
target_sources(
|
||||
${FSFW_TEST_TGT} PRIVATE testLocalPoolVariable.cpp testLocalPoolVector.cpp
|
||||
testDataSet.cpp testLocalPoolManager.cpp)
|
||||
|
@ -1,4 +1,2 @@
|
||||
target_sources(${FSFW_TEST_TGT} PRIVATE
|
||||
DeviceHandlerCommander.cpp
|
||||
TestDeviceHandlerBase.cpp
|
||||
)
|
||||
target_sources(${FSFW_TEST_TGT} PRIVATE DeviceHandlerCommander.cpp
|
||||
TestDeviceHandlerBase.cpp)
|
||||
|
@ -1,7 +1,3 @@
|
||||
target_sources(${FSFW_TEST_TGT} PRIVATE
|
||||
testDleEncoder.cpp
|
||||
testOpDivider.cpp
|
||||
testBitutil.cpp
|
||||
testCRC.cpp
|
||||
testTimevalOperations.cpp
|
||||
)
|
||||
target_sources(
|
||||
${FSFW_TEST_TGT} PRIVATE testDleEncoder.cpp testOpDivider.cpp testBitutil.cpp
|
||||
testCRC.cpp testTimevalOperations.cpp)
|
||||
|
@ -1,3 +1 @@
|
||||
target_sources(${FSFW_TEST_TGT} PRIVATE
|
||||
testCommandExecutor.cpp
|
||||
)
|
||||
target_sources(${FSFW_TEST_TGT} PRIVATE testCommandExecutor.cpp)
|
||||
|
@ -1,3 +1 @@
|
||||
target_sources(${FSFW_TEST_TGT} PRIVATE
|
||||
TestInternalErrorReporter.cpp
|
||||
)
|
||||
target_sources(${FSFW_TEST_TGT} PRIVATE TestInternalErrorReporter.cpp)
|
||||
|
@ -1,16 +1,16 @@
|
||||
target_sources(${FSFW_TEST_TGT} PRIVATE
|
||||
PowerSwitcherMock.cpp
|
||||
DeviceHandlerMock.cpp
|
||||
DeviceFdirMock.cpp
|
||||
CookieIFMock.cpp
|
||||
ComIFMock.cpp
|
||||
MessageQueueMock.cpp
|
||||
InternalErrorReporterMock.cpp
|
||||
LocalPoolOwnerBase.cpp
|
||||
PusVerificationReporterMock.cpp
|
||||
PusServiceBaseMock.cpp
|
||||
AcceptsTmMock.cpp
|
||||
PusDistributorMock.cpp
|
||||
CcsdsCheckerMock.cpp
|
||||
AcceptsTcMock.cpp
|
||||
)
|
||||
target_sources(
|
||||
${FSFW_TEST_TGT}
|
||||
PRIVATE PowerSwitcherMock.cpp
|
||||
DeviceHandlerMock.cpp
|
||||
DeviceFdirMock.cpp
|
||||
CookieIFMock.cpp
|
||||
ComIFMock.cpp
|
||||
MessageQueueMock.cpp
|
||||
InternalErrorReporterMock.cpp
|
||||
LocalPoolOwnerBase.cpp
|
||||
PusVerificationReporterMock.cpp
|
||||
PusServiceBaseMock.cpp
|
||||
AcceptsTmMock.cpp
|
||||
PusDistributorMock.cpp
|
||||
CcsdsCheckerMock.cpp
|
||||
AcceptsTcMock.cpp)
|
||||
|
@ -1,5 +1,2 @@
|
||||
target_sources(${FSFW_TEST_TGT} PRIVATE
|
||||
testMq.cpp
|
||||
TestSemaphore.cpp
|
||||
TestClock.cpp
|
||||
)
|
||||
target_sources(${FSFW_TEST_TGT} PRIVATE testMq.cpp TestSemaphore.cpp
|
||||
TestClock.cpp)
|
||||
|
@ -1,3 +1 @@
|
||||
target_sources(${FSFW_TEST_TGT} PRIVATE
|
||||
testPowerSwitcher.cpp
|
||||
)
|
||||
target_sources(${FSFW_TEST_TGT} PRIVATE testPowerSwitcher.cpp)
|
||||
|
@ -1,6 +1,3 @@
|
||||
target_sources(${FSFW_TEST_TGT} PRIVATE
|
||||
testSerialBufferAdapter.cpp
|
||||
testSerializeAdapter.cpp
|
||||
testSerialLinkedPacket.cpp
|
||||
testSerializeIF.cpp
|
||||
)
|
||||
target_sources(
|
||||
${FSFW_TEST_TGT} PRIVATE testSerialBufferAdapter.cpp testSerializeAdapter.cpp
|
||||
testSerialLinkedPacket.cpp testSerializeIF.cpp)
|
||||
|
@ -1,4 +1 @@
|
||||
target_sources(${FSFW_TEST_TGT} PRIVATE
|
||||
testAccessor.cpp
|
||||
testPool.cpp
|
||||
)
|
||||
target_sources(${FSFW_TEST_TGT} PRIVATE testAccessor.cpp testPool.cpp)
|
||||
|
@ -1,3 +1 @@
|
||||
target_sources(${FSFW_TEST_TGT} PRIVATE
|
||||
testCcsdsDistributor.cpp
|
||||
)
|
||||
target_sources(${FSFW_TEST_TGT} PRIVATE testCcsdsDistributor.cpp)
|
||||
|
@ -1,23 +1,16 @@
|
||||
target_sources(${FSFW_TEST_TGT} PRIVATE
|
||||
ipc/MissionMessageTypes.cpp
|
||||
pollingsequence/PollingSequenceFactory.cpp
|
||||
)
|
||||
target_sources(
|
||||
${FSFW_TEST_TGT} PRIVATE ipc/MissionMessageTypes.cpp
|
||||
pollingsequence/PollingSequenceFactory.cpp)
|
||||
|
||||
# Add include paths for the executable
|
||||
target_include_directories(${FSFW_TEST_TGT} PRIVATE
|
||||
${CMAKE_CURRENT_SOURCE_DIR}
|
||||
)
|
||||
target_include_directories(${FSFW_TEST_TGT} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR})
|
||||
|
||||
# If a special translation file for object IDs exists, compile it.
|
||||
if(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/objects/translateObjects.cpp")
|
||||
target_sources(${FSFW_TEST_TGT} PRIVATE
|
||||
objects/translateObjects.cpp
|
||||
)
|
||||
target_sources(${FSFW_TEST_TGT} PRIVATE objects/translateObjects.cpp)
|
||||
endif()
|
||||
|
||||
# If a special translation file for events exists, compile it.
|
||||
if(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/objects/translateObjects.cpp")
|
||||
target_sources(${FSFW_TEST_TGT} PRIVATE
|
||||
events/translateEvents.cpp
|
||||
)
|
||||
endif()
|
||||
target_sources(${FSFW_TEST_TGT} PRIVATE events/translateEvents.cpp)
|
||||
endif()
|
||||
|
@ -1,4 +1 @@
|
||||
target_sources(${FSFW_TEST_TGT} PRIVATE
|
||||
TestCountdown.cpp
|
||||
TestCCSDSTime.cpp
|
||||
)
|
||||
target_sources(${FSFW_TEST_TGT} PRIVATE TestCountdown.cpp TestCCSDSTime.cpp)
|
||||
|
@ -1,10 +1,10 @@
|
||||
target_sources(${FSFW_TEST_TGT} PRIVATE
|
||||
testCcsdsCreator.cpp
|
||||
testCcsdsReader.cpp
|
||||
testPusTcCreator.cpp
|
||||
testPusTcReader.cpp
|
||||
testPusTmCreator.cpp
|
||||
testPusTmReader.cpp
|
||||
testCcsds.cpp
|
||||
testZcTmWriter.cpp
|
||||
)
|
||||
target_sources(
|
||||
${FSFW_TEST_TGT}
|
||||
PRIVATE testCcsdsCreator.cpp
|
||||
testCcsdsReader.cpp
|
||||
testPusTcCreator.cpp
|
||||
testPusTcReader.cpp
|
||||
testPusTmCreator.cpp
|
||||
testPusTmReader.cpp
|
||||
testCcsds.cpp
|
||||
testZcTmWriter.cpp)
|
||||
|
@ -1,6 +1,2 @@
|
||||
target_sources(${FSFW_TEST_TGT} PRIVATE
|
||||
testStoreHelper.cpp
|
||||
testSendHelper.cpp
|
||||
testStoreAndSendHelper.cpp
|
||||
testPsb.cpp
|
||||
)
|
||||
target_sources(${FSFW_TEST_TGT} PRIVATE testStoreHelper.cpp testSendHelper.cpp
|
||||
testStoreAndSendHelper.cpp testPsb.cpp)
|
||||
|
@ -1,4 +1,2 @@
|
||||
target_sources(${FSFW_TEST_TGT} PRIVATE
|
||||
testUnsignedByteField.cpp
|
||||
testObjectId.cpp
|
||||
)
|
||||
target_sources(${FSFW_TEST_TGT} PRIVATE testUnsignedByteField.cpp
|
||||
testObjectId.cpp)
|
||||
|
Loading…
Reference in New Issue
Block a user