apply auto-formatter

This commit is contained in:
Robin Müller 2022-08-22 15:02:16 +02:00
parent 7c59df3f1c
commit 8c8d1cfa84
No known key found for this signature in database
GPG Key ID: 71B58F8A3CDFA9AC
32 changed files with 98 additions and 147 deletions

View File

@ -12,9 +12,7 @@ namespace Factory {
void setStaticFrameworkObjectIds();
}
class CFDPHandler : public ExecutableObjectIF,
public AcceptsTelecommandsIF,
public SystemObject {
class CFDPHandler : public ExecutableObjectIF, public AcceptsTelecommandsIF, public SystemObject {
friend void(Factory::setStaticFrameworkObjectIds)();
public:

View File

@ -15,20 +15,16 @@ static constexpr uint8_t VERSION_BITS = 0b00100000;
static constexpr uint8_t CFDP_CLASS_ID = CLASS_ID::CFDP;
static constexpr ReturnValue_t INVALID_TLV_TYPE =
returnvalue::makeCode(CFDP_CLASS_ID, 1);
static constexpr ReturnValue_t INVALID_DIRECTIVE_FIELDS =
returnvalue::makeCode(CFDP_CLASS_ID, 2);
static constexpr ReturnValue_t INVALID_PDU_DATAFIELD_LEN =
returnvalue::makeCode(CFDP_CLASS_ID, 3);
static constexpr ReturnValue_t INVALID_TLV_TYPE = returnvalue::makeCode(CFDP_CLASS_ID, 1);
static constexpr ReturnValue_t INVALID_DIRECTIVE_FIELDS = returnvalue::makeCode(CFDP_CLASS_ID, 2);
static constexpr ReturnValue_t INVALID_PDU_DATAFIELD_LEN = returnvalue::makeCode(CFDP_CLASS_ID, 3);
static constexpr ReturnValue_t INVALID_ACK_DIRECTIVE_FIELDS =
returnvalue::makeCode(CFDP_CLASS_ID, 4);
//! Can not parse options. This can also occur because there are options
//! available but the user did not pass a valid options array
static constexpr ReturnValue_t METADATA_CANT_PARSE_OPTIONS =
returnvalue::makeCode(CFDP_CLASS_ID, 5);
static constexpr ReturnValue_t NAK_CANT_PARSE_OPTIONS =
returnvalue::makeCode(CFDP_CLASS_ID, 6);
static constexpr ReturnValue_t NAK_CANT_PARSE_OPTIONS = returnvalue::makeCode(CFDP_CLASS_ID, 6);
static constexpr ReturnValue_t FINISHED_CANT_PARSE_FS_RESPONSES =
returnvalue::makeCode(CFDP_CLASS_ID, 6);
static constexpr ReturnValue_t FILESTORE_REQUIRES_SECOND_FILE =

View File

@ -37,8 +37,8 @@ class Farm1StateOpen : public Farm1StateIF {
* change to Farm1StateLockout.
* @param frame The frame to handle.
* @param clcw Any changes to the CLCW shall be done with the help of this interface.
* @return If the Sequence Number is ok, it returns returnvalue::OK. Otherwise either #NS_POSITIVE_W,
* #NS_NEGATIVE_W or NS_LOCKOUT is returned.
* @return If the Sequence Number is ok, it returns returnvalue::OK. Otherwise either
* #NS_POSITIVE_W, #NS_NEGATIVE_W or NS_LOCKOUT is returned.
*/
ReturnValue_t handleADFrame(TcTransferFrame* frame, ClcwIF* clcw);
/**

View File

@ -102,7 +102,8 @@ class VirtualChannelReception : public VirtualChannelReceptionIF, public CCSDSRe
* Helper method to simplify adding a mapChannel during construction.
* @param mapId The mapId of the object to add.
* @param object Pointer to the MapPacketExtraction object itself.
* @return @c returnvalue::OK if the channel was successfully inserted, @c returnvalue::FAILED otherwise.
* @return @c returnvalue::OK if the channel was successfully inserted, @c returnvalue::FAILED
* otherwise.
*/
ReturnValue_t addMapChannel(uint8_t mapId, MapPacketExtractionIF* object);
/**

View File

@ -21,15 +21,15 @@ LocalDataPoolManager::LocalDataPoolManager(HasLocalDataPoolIF* owner, MessageQue
bool appendValidityBuffer)
: appendValidityBuffer(appendValidityBuffer) {
if (owner == nullptr) {
printWarningOrError(sif::OutputTypes::OUT_WARNING, "LocalDataPoolManager",
returnvalue::FAILED, "Invalid supplied owner");
printWarningOrError(sif::OutputTypes::OUT_WARNING, "LocalDataPoolManager", returnvalue::FAILED,
"Invalid supplied owner");
return;
}
this->owner = owner;
mutex = MutexFactory::instance()->createMutex();
if (mutex == nullptr) {
printWarningOrError(sif::OutputTypes::OUT_ERROR, "LocalDataPoolManager",
returnvalue::FAILED, "Could not create mutex");
printWarningOrError(sif::OutputTypes::OUT_ERROR, "LocalDataPoolManager", returnvalue::FAILED,
"Could not create mutex");
}
hkQueue = queueToUse;
@ -780,8 +780,7 @@ ReturnValue_t LocalDataPoolManager::generateSetStructurePacket(sid_t sid, bool i
ReturnValue_t result = ipcStore->getFreeElement(&storeId, expectedSize, &storePtr);
if (result != returnvalue::OK) {
printWarningOrError(sif::OutputTypes::OUT_ERROR, "generateSetStructurePacket",
returnvalue::FAILED,
"Could not get free element from IPC store.");
returnvalue::FAILED, "Could not get free element from IPC store.");
return result;
}
@ -794,8 +793,7 @@ ReturnValue_t LocalDataPoolManager::generateSetStructurePacket(sid_t sid, bool i
}
if (expectedSize != size) {
printWarningOrError(sif::OutputTypes::OUT_WARNING, "generateSetStructurePacket",
returnvalue::FAILED,
"Expected size is not equal to serialized size");
returnvalue::FAILED, "Expected size is not equal to serialized size");
}
// Send structure reporting reply.

View File

@ -45,8 +45,8 @@ DeviceHandlerBase::DeviceHandlerBase(object_id_t setObjectId, object_id_t device
cookieInfo.state = COOKIE_UNUSED;
cookieInfo.pendingCommand = deviceCommandMap.end();
if (comCookie == nullptr) {
printWarningOrError(sif::OutputTypes::OUT_ERROR, "DeviceHandlerBase",
returnvalue::FAILED, "Invalid cookie");
printWarningOrError(sif::OutputTypes::OUT_ERROR, "DeviceHandlerBase", returnvalue::FAILED,
"Invalid cookie");
}
if (this->fdirInstance == nullptr) {
this->fdirInstance = new DeviceHandlerFailureIsolation(setObjectId, defaultFdirParentId);
@ -634,8 +634,8 @@ void DeviceHandlerBase::replyToReply(const DeviceCommandId_t command, DeviceRepl
}
DeviceCommandInfo* info = &replyInfo.command->second;
if (info == nullptr) {
printWarningOrError(sif::OutputTypes::OUT_ERROR, "replyToReply",
returnvalue::FAILED, "Command pointer not found");
printWarningOrError(sif::OutputTypes::OUT_ERROR, "replyToReply", returnvalue::FAILED,
"Command pointer not found");
return;
}

View File

@ -9,8 +9,7 @@
#include "ConfirmsFailuresIF.h"
#include "FaultCounter.h"
class FailureIsolationBase : public ConfirmsFailuresIF,
public HasParametersIF {
class FailureIsolationBase : public ConfirmsFailuresIF, public HasParametersIF {
public:
static const uint8_t SUBSYSTEM_ID = SUBSYSTEM_ID::FDIR_1;
static const Event FDIR_CHANGED_STATE =

View File

@ -30,9 +30,7 @@ class HasMemoryIF {
* Sets the address of the memory, if possible.
* startAddress is a proposal for an address, or the base address if multiple addresses are set.
*/
virtual ReturnValue_t setAddress(uint32_t* startAddress) {
return returnvalue::FAILED;
}
virtual ReturnValue_t setAddress(uint32_t* startAddress) { return returnvalue::FAILED; }
static bool memAccessWasSuccessful(ReturnValue_t result) {
switch (result) {
case DO_IT_MYSELF:

View File

@ -50,8 +50,7 @@ ReturnValue_t TcpTmTcBridge::handleTm() {
TmTcMessage message;
ReturnValue_t status = returnvalue::OK;
for (ReturnValue_t result = tmTcReceptionQueue->receiveMessage(&message);
result == returnvalue::OK;
result = tmTcReceptionQueue->receiveMessage(&message)) {
result == returnvalue::OK; result = tmTcReceptionQueue->receiveMessage(&message)) {
status = storeDownlinkData(&message);
if (status != returnvalue::OK) {
break;

View File

@ -37,12 +37,9 @@ class Service11TelecommandScheduling final : public PusServiceBase {
public:
static constexpr uint8_t CLASS_ID = CLASS_ID::PUS_SERVICE_11;
static constexpr ReturnValue_t INVALID_TYPE_TIME_WINDOW =
returnvalue::makeCode(CLASS_ID, 1);
static constexpr ReturnValue_t TIMESHIFTING_NOT_POSSIBLE =
returnvalue::makeCode(CLASS_ID, 2);
static constexpr ReturnValue_t INVALID_RELATIVE_TIME =
returnvalue::makeCode(CLASS_ID, 3);
static constexpr ReturnValue_t INVALID_TYPE_TIME_WINDOW = returnvalue::makeCode(CLASS_ID, 1);
static constexpr ReturnValue_t TIMESHIFTING_NOT_POSSIBLE = returnvalue::makeCode(CLASS_ID, 2);
static constexpr ReturnValue_t INVALID_RELATIVE_TIME = returnvalue::makeCode(CLASS_ID, 3);
static constexpr uint8_t SUBSYSTEM_ID = SUBSYSTEM_ID::PUS_SERVICE_11;

View File

@ -12,8 +12,8 @@
typedef uint16_t ReturnValue_t;
namespace returnvalue {
static const ReturnValue_t OK = 0;
static const ReturnValue_t FAILED = 1;
static const ReturnValue_t OK = 0;
static const ReturnValue_t FAILED = 1;
/**
* It is discouraged to use the input parameters 0,0 and 0,1 as this
@ -22,11 +22,10 @@ namespace returnvalue {
* @param number
* @return
*/
static constexpr ReturnValue_t makeCode(
uint8_t classId, uint8_t number) {
static constexpr ReturnValue_t makeCode(uint8_t classId, uint8_t number) {
return (static_cast<ReturnValue_t>(classId) << 8) + number;
}
}
} // namespace returnvalue
#endif /* FSFW_RETURNVALUES_RETURNVALUE_H_ */

View File

@ -55,7 +55,9 @@ ReturnValue_t Subsystem::checkSequence(Mode_t sequence) {
return checkSequence(iter, getFallbackSequence(sequence));
}
bool Subsystem::existsModeSequence(Mode_t id) { return modeSequences.exists(id) == returnvalue::OK; }
bool Subsystem::existsModeSequence(Mode_t id) {
return modeSequences.exists(id) == returnvalue::OK;
}
bool Subsystem::existsModeTable(Mode_t id) { return modeTables.exists(id) == returnvalue::OK; }

View File

@ -43,4 +43,6 @@ void TcDistributor::print() {
#endif
}
ReturnValue_t TcDistributor::callbackAfterSending(ReturnValue_t queueStatus) { return returnvalue::OK; }
ReturnValue_t TcDistributor::callbackAfterSending(ReturnValue_t queueStatus) {
return returnvalue::OK;
}

View File

@ -4,6 +4,8 @@
TcPacketCheckCFDP::TcPacketCheckCFDP(uint16_t setApid) : apid(setApid) {}
ReturnValue_t TcPacketCheckCFDP::checkPacket(SpacePacketBase* currentPacket) { return returnvalue::OK; }
ReturnValue_t TcPacketCheckCFDP::checkPacket(SpacePacketBase* currentPacket) {
return returnvalue::OK;
}
uint16_t TcPacketCheckCFDP::getApid() const { return apid; }

View File

@ -291,8 +291,8 @@ ReturnValue_t Heater::getParameter(uint8_t domainId, uint8_t uniqueId,
void Heater::handleEventQueue() {
EventMessage event;
for (ReturnValue_t result = eventQueue->receiveMessage(&event);
result == returnvalue::OK; result = eventQueue->receiveMessage(&event)) {
for (ReturnValue_t result = eventQueue->receiveMessage(&event); result == returnvalue::OK;
result = eventQueue->receiveMessage(&event)) {
switch (event.getMessageId()) {
case EventMessage::EVENT_MESSAGE:
switch (event.getEvent()) {

View File

@ -234,7 +234,8 @@ void CommandingServiceBase::handleRequestQueue() {
address = message.getStorageId();
packet.setStoreAddress(address, &packet);
if ((packet.getSubService() == 0) or (isValidSubservice(packet.getSubService()) != returnvalue::OK)) {
if ((packet.getSubService() == 0) or
(isValidSubservice(packet.getSubService()) != returnvalue::OK)) {
rejectPacket(tc_verification::START_FAILURE, &packet, INVALID_SUBSERVICE);
continue;
}

View File

@ -133,8 +133,7 @@ ReturnValue_t TmTcBridge::handleTmQueue() {
size_t size = 0;
ReturnValue_t status = returnvalue::OK;
for (ReturnValue_t result = tmTcReceptionQueue->receiveMessage(&message);
result == returnvalue::OK;
result = tmTcReceptionQueue->receiveMessage(&message)) {
result == returnvalue::OK; result = tmTcReceptionQueue->receiveMessage(&message)) {
#if FSFW_VERBOSE_LEVEL >= 3
#if FSFW_CPP_OSTREAM_ENABLED == 1
sif::info << "Sent packet counter: " << static_cast<int>(packetSentCounter) << std::endl;

View File

@ -3,50 +3,45 @@
#include "fsfw/serialize.h"
template<typename T>
class UnsignedByteField: public SerializeIF {
template <typename T>
class UnsignedByteField : public SerializeIF {
public:
static_assert(std::is_unsigned<T>::value);
explicit UnsignedByteField(T value): value(value) {}
explicit UnsignedByteField(T value) : value(value) {}
[[nodiscard]] ReturnValue_t serialize(uint8_t **buffer, size_t *size, size_t maxSize,
Endianness streamEndianness) const override {
Endianness streamEndianness) const override {
return SerializeAdapter::serialize(&value, buffer, size, maxSize, streamEndianness);
}
ReturnValue_t deSerialize(const uint8_t **buffer, size_t *size,
Endianness streamEndianness) override {
Endianness streamEndianness) override {
return SerializeAdapter::deSerialize(&value, buffer, size, streamEndianness);
}
[[nodiscard]] size_t getSerializedSize() const override {
return sizeof(T);
}
[[nodiscard]] size_t getSerializedSize() const override { return sizeof(T); }
[[nodiscard]] T getValue() const {
return value;
}
[[nodiscard]] T getValue() const { return value; }
void setValue(T value_) { value = value_; }
void setValue(T value_) {
value = value_;
}
private:
T value;
};
class U32ByteField: public UnsignedByteField<uint32_t> {
class U32ByteField : public UnsignedByteField<uint32_t> {
public:
explicit U32ByteField(uint32_t value): UnsignedByteField<uint32_t>(value) {}
explicit U32ByteField(uint32_t value) : UnsignedByteField<uint32_t>(value) {}
};
class U16ByteField: public UnsignedByteField<uint16_t> {
class U16ByteField : public UnsignedByteField<uint16_t> {
public:
explicit U16ByteField(uint16_t value): UnsignedByteField<uint16_t>(value) {}
explicit U16ByteField(uint16_t value) : UnsignedByteField<uint16_t>(value) {}
};
class U8ByteField: public UnsignedByteField<uint8_t> {
class U8ByteField : public UnsignedByteField<uint8_t> {
public:
explicit U8ByteField(uint8_t value): UnsignedByteField<uint8_t>(value) {}
explicit U8ByteField(uint8_t value) : UnsignedByteField<uint8_t>(value) {}
};
#endif // FSFW_UTIL_UNSIGNEDBYTEFIELD_H

View File

@ -31,8 +31,7 @@ class CommandExecutor {
static constexpr uint8_t CLASS_ID = CLASS_ID::LINUX_OSAL;
//! [EXPORT] : [COMMENT] Execution of the current command has finished
static constexpr ReturnValue_t EXECUTION_FINISHED =
returnvalue::makeCode(CLASS_ID, 0);
static constexpr ReturnValue_t EXECUTION_FINISHED = returnvalue::makeCode(CLASS_ID, 0);
//! [EXPORT] : [COMMENT] Command is pending. This will also be returned if the user tries
//! to load another command but a command is still pending
@ -42,8 +41,7 @@ class CommandExecutor {
//! [EXPORT] : [COMMENT] Command execution failed
static constexpr ReturnValue_t COMMAND_ERROR = returnvalue::makeCode(CLASS_ID, 3);
//! [EXPORT] : [COMMENT]
static constexpr ReturnValue_t NO_COMMAND_LOADED_OR_PENDING =
returnvalue::makeCode(CLASS_ID, 4);
static constexpr ReturnValue_t NO_COMMAND_LOADED_OR_PENDING = returnvalue::makeCode(CLASS_ID, 4);
static constexpr ReturnValue_t PCLOSE_CALL_ERROR = returnvalue::makeCode(CLASS_ID, 6);
/**

View File

@ -19,18 +19,12 @@ class LinuxLibgpioIF : public GpioIF, public SystemObject {
public:
static const uint8_t gpioRetvalId = CLASS_ID::HAL_GPIO;
static constexpr ReturnValue_t UNKNOWN_GPIO_ID =
returnvalue::makeCode(gpioRetvalId, 1);
static constexpr ReturnValue_t DRIVE_GPIO_FAILURE =
returnvalue::makeCode(gpioRetvalId, 2);
static constexpr ReturnValue_t GPIO_TYPE_FAILURE =
returnvalue::makeCode(gpioRetvalId, 3);
static constexpr ReturnValue_t GPIO_INVALID_INSTANCE =
returnvalue::makeCode(gpioRetvalId, 4);
static constexpr ReturnValue_t GPIO_DUPLICATE_DETECTED =
returnvalue::makeCode(gpioRetvalId, 5);
static constexpr ReturnValue_t GPIO_INIT_FAILED =
returnvalue::makeCode(gpioRetvalId, 6);
static constexpr ReturnValue_t UNKNOWN_GPIO_ID = returnvalue::makeCode(gpioRetvalId, 1);
static constexpr ReturnValue_t DRIVE_GPIO_FAILURE = returnvalue::makeCode(gpioRetvalId, 2);
static constexpr ReturnValue_t GPIO_TYPE_FAILURE = returnvalue::makeCode(gpioRetvalId, 3);
static constexpr ReturnValue_t GPIO_INVALID_INSTANCE = returnvalue::makeCode(gpioRetvalId, 4);
static constexpr ReturnValue_t GPIO_DUPLICATE_DETECTED = returnvalue::makeCode(gpioRetvalId, 5);
static constexpr ReturnValue_t GPIO_INIT_FAILED = returnvalue::makeCode(gpioRetvalId, 6);
LinuxLibgpioIF(object_id_t objectId);
virtual ~LinuxLibgpioIF();

View File

@ -23,8 +23,7 @@ class SpiCookie;
class SpiComIF : public DeviceCommunicationIF, public SystemObject {
public:
static constexpr uint8_t spiRetvalId = CLASS_ID::HAL_SPI;
static constexpr ReturnValue_t OPENING_FILE_FAILED =
returnvalue::makeCode(spiRetvalId, 0);
static constexpr ReturnValue_t OPENING_FILE_FAILED = returnvalue::makeCode(spiRetvalId, 0);
/* Full duplex (ioctl) transfer failure */
static constexpr ReturnValue_t FULL_DUPLEX_TRANSFER_FAILED =
returnvalue::makeCode(spiRetvalId, 1);

View File

@ -22,12 +22,9 @@ class UartComIF : public DeviceCommunicationIF, public SystemObject {
public:
static constexpr uint8_t uartRetvalId = CLASS_ID::HAL_UART;
static constexpr ReturnValue_t UART_READ_FAILURE =
returnvalue::makeCode(uartRetvalId, 1);
static constexpr ReturnValue_t UART_READ_SIZE_MISSMATCH =
returnvalue::makeCode(uartRetvalId, 2);
static constexpr ReturnValue_t UART_RX_BUFFER_TOO_SMALL =
returnvalue::makeCode(uartRetvalId, 3);
static constexpr ReturnValue_t UART_READ_FAILURE = returnvalue::makeCode(uartRetvalId, 1);
static constexpr ReturnValue_t UART_READ_SIZE_MISSMATCH = returnvalue::makeCode(uartRetvalId, 2);
static constexpr ReturnValue_t UART_RX_BUFFER_TOO_SMALL = returnvalue::makeCode(uartRetvalId, 3);
UartComIF(object_id_t objectId);

View File

@ -10,8 +10,7 @@
namespace spi {
static constexpr uint8_t HAL_SPI_ID = CLASS_ID::HAL_SPI;
static constexpr ReturnValue_t HAL_TIMEOUT_RETVAL =
returnvalue::makeCode(HAL_SPI_ID, 0);
static constexpr ReturnValue_t HAL_TIMEOUT_RETVAL = returnvalue::makeCode(HAL_SPI_ID, 0);
static constexpr ReturnValue_t HAL_BUSY_RETVAL = returnvalue::makeCode(HAL_SPI_ID, 1);
static constexpr ReturnValue_t HAL_ERROR_RETVAL = returnvalue::makeCode(HAL_SPI_ID, 2);

View File

@ -57,8 +57,7 @@ TEST_CASE("Action Helper", "[ActionHelper]") {
step += 1;
CHECK(testMqMock.wasMessageSent());
CommandMessage testMessage;
REQUIRE(testMqMock.receiveMessage(&testMessage) ==
static_cast<uint32_t>(returnvalue::OK));
REQUIRE(testMqMock.receiveMessage(&testMessage) == static_cast<uint32_t>(returnvalue::OK));
REQUIRE(testMessage.getCommand() == static_cast<uint32_t>(ActionMessage::STEP_FAILED));
REQUIRE(testMessage.getParameter() == static_cast<uint32_t>(testActionId));
uint32_t parameter2 = ((uint32_t)step << 16) | (uint32_t)status;
@ -72,8 +71,7 @@ TEST_CASE("Action Helper", "[ActionHelper]") {
actionHelper.finish(false, testMqMock.getId(), testActionId, status);
CHECK(testMqMock.wasMessageSent());
CommandMessage testMessage;
REQUIRE(testMqMock.receiveMessage(&testMessage) ==
static_cast<uint32_t>(returnvalue::OK));
REQUIRE(testMqMock.receiveMessage(&testMessage) == static_cast<uint32_t>(returnvalue::OK));
REQUIRE(testMessage.getCommand() == static_cast<uint32_t>(ActionMessage::COMPLETION_FAILED));
REQUIRE(ActionMessage::getActionId(&testMessage) == testActionId);
REQUIRE(ActionMessage::getReturnCode(&testMessage) == static_cast<uint32_t>(status));
@ -89,8 +87,7 @@ TEST_CASE("Action Helper", "[ActionHelper]") {
REQUIRE(ipcStore->getData(toLongParamAddress).first ==
static_cast<uint32_t>(StorageManagerIF::DATA_DOES_NOT_EXIST));
CommandMessage testMessage;
REQUIRE(testMqMock.receiveMessage(&testMessage) ==
static_cast<uint32_t>(returnvalue::OK));
REQUIRE(testMqMock.receiveMessage(&testMessage) == static_cast<uint32_t>(returnvalue::OK));
REQUIRE(testMessage.getCommand() == static_cast<uint32_t>(ActionMessage::STEP_FAILED));
REQUIRE(ActionMessage::getReturnCode(&testMessage) == 0xAFFE);
REQUIRE(ActionMessage::getStep(&testMessage) == 0);
@ -102,8 +99,7 @@ TEST_CASE("Action Helper", "[ActionHelper]") {
CHECK(not testDhMock.executeActionCalled);
REQUIRE(actionHelper.handleActionMessage(&actionMessage) == returnvalue::OK);
CommandMessage testMessage;
REQUIRE(testMqMock.receiveMessage(&testMessage) ==
static_cast<uint32_t>(returnvalue::OK));
REQUIRE(testMqMock.receiveMessage(&testMessage) == static_cast<uint32_t>(returnvalue::OK));
REQUIRE(testMessage.getCommand() == static_cast<uint32_t>(ActionMessage::STEP_FAILED));
REQUIRE(ActionMessage::getReturnCode(&testMessage) ==
static_cast<uint32_t>(StorageManagerIF::ILLEGAL_STORAGE_ID));

View File

@ -80,8 +80,7 @@ TEST_CASE("CFDP TLV LV", "[CfdpTlvLv]") {
serPtr = rawBuf.data();
deserSize = 0;
REQUIRE(zeroLenField.serialize(&serPtr, &deserSize, rawBuf.size(),
SerializeIF::Endianness::NETWORK) ==
returnvalue::OK);
SerializeIF::Endianness::NETWORK) == returnvalue::OK);
REQUIRE(rawBuf[0] == TlvTypes::FAULT_HANDLER);
REQUIRE(rawBuf[1] == 0);
}
@ -110,8 +109,7 @@ TEST_CASE("CFDP TLV LV", "[CfdpTlvLv]") {
SerializeIF::Endianness::NETWORK);
REQUIRE(entityId == 0x0ff0);
REQUIRE(tlv.deSerialize(nullptr, nullptr, SerializeIF::Endianness::NETWORK) !=
returnvalue::OK);
REQUIRE(tlv.deSerialize(nullptr, nullptr, SerializeIF::Endianness::NETWORK) != returnvalue::OK);
deserPtr = rawBuf.data();
deserSize = 0;
REQUIRE(tlv.deSerialize(&deserPtr, &deserSize, SerializeIF::Endianness::NETWORK) ==
@ -126,8 +124,7 @@ TEST_CASE("CFDP TLV LV", "[CfdpTlvLv]") {
serPtr = rawBuf.data();
deserSize = 0;
REQUIRE(zeroLenField.serialize(&serPtr, &deserSize, rawBuf.size(),
SerializeIF::Endianness::NETWORK) ==
returnvalue::OK);
SerializeIF::Endianness::NETWORK) == returnvalue::OK);
deserPtr = rawBuf.data();
result = zeroLenField.deSerialize(&deserPtr, &deserSize, SerializeIF::Endianness::NETWORK);
REQUIRE(result == returnvalue::OK);

View File

@ -74,8 +74,7 @@ TEST_CASE("Array List", "[ArrayListTest]") {
SECTION("Const Iterator") {
ArrayList<TestClass>::Iterator it = complexList.begin();
for (auto i = 0; i < 10; i++) {
REQUIRE(complexList.insert(TestClass(i, i + 1)) ==
static_cast<int>(returnvalue::OK));
REQUIRE(complexList.insert(TestClass(i, i + 1)) == static_cast<int>(returnvalue::OK));
}
it++;
const TestClass* secondTest = it.value;

View File

@ -19,8 +19,7 @@ TEST_CASE("FixedMap Tests", "[TestFixedMap]") {
SECTION("Fill and erase") {
for (uint16_t i = 0; i < 30; i++) {
REQUIRE(map.insert(std::make_pair(i, i + 1)) ==
static_cast<int>(returnvalue::OK));
REQUIRE(map.insert(std::make_pair(i, i + 1)) == static_cast<int>(returnvalue::OK));
REQUIRE(map.exists(i) == static_cast<int>(returnvalue::OK));
REQUIRE(map.find(i)->second == i + 1);
REQUIRE(not map.empty());
@ -97,9 +96,9 @@ TEST_CASE("FixedMap Tests", "[TestFixedMap]") {
static_cast<int>(SerializeIF::BUFFER_TOO_SHORT));
loc_ptr = buffer;
size = 0;
REQUIRE(map.serialize(
&loc_ptr, &size, sizeof(uint32_t) + 2 * (sizeof(uint32_t) + sizeof(uint16_t)),
SerializeIF::Endianness::BIG) == static_cast<int>(returnvalue::OK));
REQUIRE(map.serialize(&loc_ptr, &size,
sizeof(uint32_t) + 2 * (sizeof(uint32_t) + sizeof(uint16_t)),
SerializeIF::Endianness::BIG) == static_cast<int>(returnvalue::OK));
REQUIRE(size == 16);
uint32_t internal_size = 0;

View File

@ -14,8 +14,7 @@ TEST_CASE("FixedOrderedMultimap Tests", "[TestFixedOrderedMultimap]") {
SECTION("Test insert, find, exists") {
for (uint16_t i = 0; i < 30; i++) {
REQUIRE(map.insert(std::make_pair(i, i + 1)) ==
static_cast<int>(returnvalue::OK));
REQUIRE(map.insert(std::make_pair(i, i + 1)) == static_cast<int>(returnvalue::OK));
REQUIRE(map.exists(i) == static_cast<int>(returnvalue::OK));
REQUIRE(map.find(i)->second == i + 1);
}
@ -188,23 +187,19 @@ TEST_CASE("FixedOrderedMultimap Non Trivial Type", "[TestFixedOrderedMultimapNon
SECTION("Test different insert variants") {
FixedOrderedMultimap<uint32_t, TestClass>::Iterator it = map.end();
REQUIRE(map.insert(36, TestClass(37, 36), &it) ==
static_cast<int>(returnvalue::OK));
REQUIRE(map.insert(36, TestClass(37, 36), &it) == static_cast<int>(returnvalue::OK));
REQUIRE(it->first == 36);
bool compare = it->second == TestClass(37, 36);
REQUIRE(compare);
REQUIRE(map.size() == 1);
REQUIRE(map.insert(37, TestClass(38, 37), nullptr) ==
static_cast<int>(returnvalue::OK));
REQUIRE(map.insert(37, TestClass(38, 37), nullptr) == static_cast<int>(returnvalue::OK));
compare = map.find(37)->second == TestClass(38, 37);
REQUIRE(compare);
REQUIRE(map.size() == 2);
REQUIRE(map.insert(37, TestClass(24, 37), nullptr) ==
static_cast<int>(returnvalue::OK));
REQUIRE(map.insert(37, TestClass(24, 37), nullptr) == static_cast<int>(returnvalue::OK));
compare = map.find(37)->second == TestClass(38, 37);
REQUIRE(compare);
REQUIRE(map.insert(0, TestClass(1, 0), nullptr) ==
static_cast<int>(returnvalue::OK));
REQUIRE(map.insert(0, TestClass(1, 0), nullptr) == static_cast<int>(returnvalue::OK));
compare = map.find(0)->second == TestClass(1, 0);
REQUIRE(compare);
REQUIRE(map.size() == 4);

View File

@ -113,8 +113,7 @@ TEST_CASE("Command Executor", "[cmd-exec]") {
REQUIRE(result == returnvalue::OK);
result = cmdExecutor.execute();
REQUIRE(result == returnvalue::OK);
while (result != CommandExecutor::EXECUTION_FINISHED and
result != returnvalue::FAILED) {
while (result != CommandExecutor::EXECUTION_FINISHED and result != returnvalue::FAILED) {
limitIdx++;
result = cmdExecutor.check(bytesHaveBeenRead);
REQUIRE(result != CommandExecutor::COMMAND_ERROR);

View File

@ -1,8 +1,8 @@
#ifndef FSFW_TESTS_SIMPLESERIALIZABLE_H
#define FSFW_TESTS_SIMPLESERIALIZABLE_H
#include "fsfw/serialize.h"
#include "fsfw/osal/Endiness.h"
#include "fsfw/serialize.h"
class SimpleSerializable : public SerializeIF {
public:

View File

@ -26,8 +26,7 @@ TEST_CASE("Serialize IF Serialize", "[serialize-if-ser]") {
SECTION("Little Endian Simple") {
size_t serLen = 0xff;
REQUIRE(simpleSer.SerializeIF::serialize(buf.data(), serLen, buf.size(),
SerializeIF::Endianness::LITTLE) ==
returnvalue::OK);
SerializeIF::Endianness::LITTLE) == returnvalue::OK);
CHECK(buf[0] == 1);
CHECK(buf[1] == 3);
CHECK(buf[2] == 2);
@ -59,8 +58,7 @@ TEST_CASE("Serialize IF Serialize", "[serialize-if-ser]") {
size_t serLen = 0xff;
SECTION("Explicit") {
REQUIRE(simpleSer.SerializeIF::serialize(buf.data(), serLen, buf.size(),
SerializeIF::Endianness::BIG) ==
returnvalue::OK);
SerializeIF::Endianness::BIG) == returnvalue::OK);
}
SECTION("Network 0") {
REQUIRE(simpleSer.SerializeIF::serialize(buf.data(), serLen, buf.size(),
@ -85,8 +83,7 @@ TEST_CASE("SerializeIF Deserialize", "[serialize-if-de]") {
size_t len = buf.size();
SECTION("Little Endian Normal") {
REQUIRE(simpleSer.deSerialize(&ptr, &len, SerializeIF::Endianness::LITTLE) ==
returnvalue::OK);
REQUIRE(simpleSer.deSerialize(&ptr, &len, SerializeIF::Endianness::LITTLE) == returnvalue::OK);
CHECK(simpleSer.getU8() == 5);
CHECK(simpleSer.getU16() == 0x0100);
CHECK(ptr == buf.data() + 3);
@ -95,9 +92,8 @@ TEST_CASE("SerializeIF Deserialize", "[serialize-if-de]") {
SECTION("Little Endian Simple") {
size_t deserLen = 0xff;
REQUIRE(
simpleSer.SerializeIF::deSerialize(ptr, deserLen, len, SerializeIF::Endianness::LITTLE) ==
returnvalue::OK);
REQUIRE(simpleSer.SerializeIF::deSerialize(ptr, deserLen, len,
SerializeIF::Endianness::LITTLE) == returnvalue::OK);
CHECK(simpleSer.getU8() == 5);
CHECK(simpleSer.getU16() == 0x0100);
CHECK(deserLen == 3);
@ -105,8 +101,7 @@ TEST_CASE("SerializeIF Deserialize", "[serialize-if-de]") {
SECTION("Big Endian Normal") {
SECTION("Explicit") {
REQUIRE(simpleSer.deSerialize(&ptr, &len, SerializeIF::Endianness::BIG) ==
returnvalue::OK);
REQUIRE(simpleSer.deSerialize(&ptr, &len, SerializeIF::Endianness::BIG) == returnvalue::OK);
}
SECTION("Network 0") {
REQUIRE(simpleSer.deSerialize(&ptr, &len, SerializeIF::Endianness::NETWORK) ==
@ -125,8 +120,7 @@ TEST_CASE("SerializeIF Deserialize", "[serialize-if-de]") {
size_t deserLen = 0xff;
SECTION("Explicit") {
REQUIRE(simpleSer.SerializeIF::deSerialize(buf.data(), deserLen, buf.size(),
SerializeIF::Endianness::BIG) ==
returnvalue::OK);
SerializeIF::Endianness::BIG) == returnvalue::OK);
}
SECTION("Network 0") {
REQUIRE(simpleSer.SerializeIF::deSerialize(buf.data(), deserLen, buf.size(),

View File

@ -1,10 +1,9 @@
#include <array>
#include <catch2/catch_test_macros.hpp>
#include "fsfw/util/UnsignedByteField.h"
#include <array>
TEST_CASE("Unsigned Byte Field", "[unsigned-byte-field]") {
auto testByteField = UnsignedByteField<uint32_t>(10);
auto u32ByteField = U32ByteField(10);