tests running again

This commit is contained in:
Robin Müller 2022-07-27 21:06:23 +02:00
parent 7e8afcc12f
commit 93acac02f5
No known key found for this signature in database
GPG Key ID: 71B58F8A3CDFA9AC
10 changed files with 35 additions and 19 deletions

View File

@ -52,11 +52,13 @@ ReturnValue_t Service1TelecommandVerification::sendVerificationReport(
uint8_t reportId = message->getReportId();
if (reportId == 0 or reportId > 8) {
#if FSFW_CPP_OSTREAM_ENABLED == 1
sif::error << "Service1TelecommandVerification::sendVerificationReport: Invalid report ID " <<
static_cast<int>(reportId) << " detected" << std::endl;
sif::error << "Service1TelecommandVerification::sendVerificationReport: Invalid report ID "
<< static_cast<int>(reportId) << " detected" << std::endl;
#else
sif::printError("Service1TelecommandVerification::sendVerificationReport: Invalid report ID "
"%d detected\n", reportId);
sif::printError(
"Service1TelecommandVerification::sendVerificationReport: Invalid report ID "
"%d detected\n",
reportId);
#endif
return HasReturnvaluesIF::RETURN_FAILED;
}

View File

@ -64,13 +64,13 @@ class SerializeIF {
/**
* Forwards to regular @serialize call with big (network) endianness
*/
virtual ReturnValue_t serializeBe(uint8_t **buffer, size_t *size, size_t maxSize) {
virtual ReturnValue_t serializeBe(uint8_t **buffer, size_t *size, size_t maxSize) const {
return serialize(buffer, size, maxSize, SerializeIF::Endianness::NETWORK);
}
/**
* If endianness is not explicitly specified, use machine endianness
*/
virtual ReturnValue_t serialize(uint8_t **buffer, size_t *size, size_t maxSize) {
virtual ReturnValue_t serialize(uint8_t **buffer, size_t *size, size_t maxSize) const {
return serialize(buffer, size, maxSize, SerializeIF::Endianness::MACHINE);
}

View File

@ -146,3 +146,11 @@ void PusTmCreator::setSubservice(uint8_t subservice) {
pusParams.secHeader.subservice = subservice;
}
bool PusTmCreator::crcCalculationEnabled() const { return calculateCrcOnSerialization; }
ReturnValue_t PusTmCreator::serialize(uint8_t** buffer, size_t* size, size_t maxSize) const {
return serialize(buffer, size, maxSize, SerializeIF::Endianness::NETWORK);
}
ReturnValue_t PusTmCreator::serialize(uint8_t* buffer, size_t maxSize) const {
return SerializeIF::serialize(buffer, maxSize, SerializeIF::Endianness::NETWORK);
}

View File

@ -72,6 +72,9 @@ class PusTmCreator : public SerializeIF, public PusTmIF, public CustomUserDataIF
uint8_t getScTimeRefStatus() override;
uint16_t getMessageTypeCounter() override;
uint16_t getDestId() override;
// Override these to use default big endianness
ReturnValue_t serialize(uint8_t** buffer, size_t* size, size_t maxSize) const override;
ReturnValue_t serialize(uint8_t* buffer, size_t maxSize) const override;
ReturnValue_t serialize(uint8_t** buffer, size_t* size, size_t maxSize,
Endianness streamEndianness) const override;
[[nodiscard]] size_t getSerializedSize() const override;

View File

@ -140,7 +140,8 @@ void PusServiceBase::setErrorReporter(InternalErrorReporterIF& errReporter_) {
psbParams.errReporter = &errReporter_;
}
ReturnValue_t PusServiceBase::initializeTmHelpers(TmSendHelper& tmSendHelper, TmStoreHelper& tmStoreHelper) {
ReturnValue_t PusServiceBase::initializeTmHelpers(TmSendHelper& tmSendHelper,
TmStoreHelper& tmStoreHelper) {
ReturnValue_t result = initializeTmSendHelper(tmSendHelper);
if (result != HasReturnvaluesIF::RETURN_OK) {
return result;

View File

@ -78,7 +78,6 @@ class CdsShortTimestamperMock : public TimeStamperIF, public TimeReaderIF {
ReturnValue_t readTimeStamp(const uint8_t *buffer, size_t maxSize) override {
return deSerialize(&buffer, &maxSize, SerializeIF::Endianness::NETWORK);
}
size_t getTimestampLen() override { return getSerializedSize(); }
timeval &getTime() override { return dummyTime; }
private:

View File

@ -24,7 +24,7 @@ TEST_CASE("CCSDS Low Level", "[ccsds-ll]") {
uint16_t packetIdRaw = 0x3ff;
ccsds::setPacketId(header, packetIdRaw);
ccsds::setApid(header, 0x1ff);
REQUIRE(ccsds::getPacketId(header) == 0x1ff);
REQUIRE(ccsds::getPacketId(header) == 0x3ff);
}
SECTION("Lowlevel Packet Length Test") {

View File

@ -44,7 +44,8 @@ TEST_CASE("PUS TM Creator", "[pus-tm-creator]") {
}
SECTION("Serialization") {
REQUIRE(creator.serialize(&dataPtr, &serLen, buf.size()) == HasReturnvaluesIF::RETURN_OK);
REQUIRE(creator.SerializeIF::serializeBe(&dataPtr, &serLen, buf.size()) ==
HasReturnvaluesIF::RETURN_OK);
REQUIRE(buf[0] == 0x08);
REQUIRE(buf[1] == 0xef);
// Unsegmented is the default
@ -105,7 +106,8 @@ TEST_CASE("PUS TM Creator", "[pus-tm-creator]") {
std::array<uint8_t, 3> data{1, 2, 3};
creator.setRawUserData(data.data(), data.size());
REQUIRE(creator.getFullPacketLen() == 25);
REQUIRE(creator.serialize(&dataPtr, &serLen, buf.size()) == HasReturnvaluesIF::RETURN_OK);
REQUIRE(creator.SerializeIF::serialize(&dataPtr, &serLen, buf.size()) ==
HasReturnvaluesIF::RETURN_OK);
REQUIRE(buf[20] == 1);
REQUIRE(buf[21] == 2);
REQUIRE(buf[22] == 3);
@ -139,7 +141,8 @@ TEST_CASE("PUS TM Creator", "[pus-tm-creator]") {
for (size_t maxSize = 0; maxSize < reqSize; maxSize++) {
dataPtr = buf.data();
serLen = 0;
REQUIRE(creator.serialize(&dataPtr, &serLen, maxSize) == SerializeIF::BUFFER_TOO_SHORT);
REQUIRE(creator.SerializeIF::serialize(&dataPtr, &serLen, maxSize) ==
SerializeIF::BUFFER_TOO_SHORT);
}
}
}

View File

@ -22,7 +22,7 @@ TEST_CASE("PUS TM Reader", "[pus-tm-reader]") {
bool deleteReader = false;
dataPtr = buf.data();
serLen = 0;
REQUIRE(creator.serialize(&dataPtr, &serLen, buf.size()) == HasReturnvaluesIF::RETURN_OK);
REQUIRE(creator.serializeBe(&dataPtr, &serLen, buf.size()) == HasReturnvaluesIF::RETURN_OK);
REQUIRE(not(*readerPtr));
REQUIRE(readerPtr->isNull());

View File

@ -57,7 +57,7 @@ TEST_CASE("TM Send Helper", "[tm-send-helper]") {
SECTION("Two Arg CTOR") {
TmSendHelper helper(msgQueue, errReporter);
REQUIRE(helper.getInternalErrorReporter() == &errReporter);
REQUIRE(helper.getDefaultDestination() == MessageQueueIF::NO_QUEUE);
REQUIRE(helper.getDefaultDestination() == 2);
REQUIRE(helper.getMsgQueue() == &msgQueue);
}
SECTION("Send") {