windows unittests succeed
This commit is contained in:
parent
c66fab90f9
commit
9589d702dd
@ -3,7 +3,7 @@
|
|||||||
#include "fsfw/serialize/SerializeAdapter.h"
|
#include "fsfw/serialize/SerializeAdapter.h"
|
||||||
#include "fsfw/serviceinterface.h"
|
#include "fsfw/serviceinterface.h"
|
||||||
|
|
||||||
cfdp::VarLenField::VarLenField(cfdp::WidthInBytes width, size_t value) : VarLenField() {
|
cfdp::VarLenField::VarLenField(cfdp::WidthInBytes width, uint64_t value) : VarLenField() {
|
||||||
ReturnValue_t result = this->setValue(width, value);
|
ReturnValue_t result = this->setValue(width, value);
|
||||||
if (result != returnvalue::OK) {
|
if (result != returnvalue::OK) {
|
||||||
#if FSFW_DISABLE_PRINTOUT == 0
|
#if FSFW_DISABLE_PRINTOUT == 0
|
||||||
@ -20,7 +20,7 @@ cfdp::VarLenField::VarLenField() : width(cfdp::WidthInBytes::ONE_BYTE) { value.o
|
|||||||
|
|
||||||
cfdp::WidthInBytes cfdp::VarLenField::getWidth() const { return width; }
|
cfdp::WidthInBytes cfdp::VarLenField::getWidth() const { return width; }
|
||||||
|
|
||||||
ReturnValue_t cfdp::VarLenField::setValue(cfdp::WidthInBytes widthInBytes, size_t value_) {
|
ReturnValue_t cfdp::VarLenField::setValue(cfdp::WidthInBytes widthInBytes, uint64_t value_) {
|
||||||
switch (widthInBytes) {
|
switch (widthInBytes) {
|
||||||
case (cfdp::WidthInBytes::ONE_BYTE): {
|
case (cfdp::WidthInBytes::ONE_BYTE): {
|
||||||
if (value_ > UINT8_MAX) {
|
if (value_ > UINT8_MAX) {
|
||||||
@ -51,7 +51,7 @@ ReturnValue_t cfdp::VarLenField::setValue(cfdp::WidthInBytes widthInBytes, size_
|
|||||||
return returnvalue::OK;
|
return returnvalue::OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
size_t cfdp::VarLenField::getValue() const {
|
uint64_t cfdp::VarLenField::getValue() const {
|
||||||
switch (width) {
|
switch (width) {
|
||||||
case (cfdp::WidthInBytes::ONE_BYTE): {
|
case (cfdp::WidthInBytes::ONE_BYTE): {
|
||||||
return value.oneByte;
|
return value.oneByte;
|
||||||
|
@ -25,13 +25,13 @@ class VarLenField : public SerializeIF {
|
|||||||
template <typename T>
|
template <typename T>
|
||||||
explicit VarLenField(UnsignedByteField<T> byteField);
|
explicit VarLenField(UnsignedByteField<T> byteField);
|
||||||
|
|
||||||
VarLenField(cfdp::WidthInBytes width, size_t value);
|
VarLenField(cfdp::WidthInBytes width, uint64_t value);
|
||||||
|
|
||||||
bool operator==(const VarLenField &other) const;
|
bool operator==(const VarLenField &other) const;
|
||||||
bool operator!=(const VarLenField &other) const;
|
bool operator!=(const VarLenField &other) const;
|
||||||
bool operator<(const VarLenField &other) const;
|
bool operator<(const VarLenField &other) const;
|
||||||
|
|
||||||
ReturnValue_t setValue(cfdp::WidthInBytes, size_t value);
|
ReturnValue_t setValue(cfdp::WidthInBytes, uint64_t value);
|
||||||
|
|
||||||
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;
|
||||||
@ -42,7 +42,7 @@ class VarLenField : public SerializeIF {
|
|||||||
Endianness streamEndianness);
|
Endianness streamEndianness);
|
||||||
|
|
||||||
[[nodiscard]] cfdp::WidthInBytes getWidth() const;
|
[[nodiscard]] cfdp::WidthInBytes getWidth() const;
|
||||||
[[nodiscard]] size_t getValue() const;
|
[[nodiscard]] uint64_t getValue() const;
|
||||||
|
|
||||||
#if FSFW_CPP_OSTREAM_ENABLED == 1
|
#if FSFW_CPP_OSTREAM_ENABLED == 1
|
||||||
friend std::ostream &operator<<(std::ostream &os, const VarLenField &id) {
|
friend std::ostream &operator<<(std::ostream &os, const VarLenField &id) {
|
||||||
|
@ -42,6 +42,6 @@ size_t EofInfo::getSerializedSize(bool fssLarge) {
|
|||||||
return size;
|
return size;
|
||||||
}
|
}
|
||||||
|
|
||||||
ReturnValue_t EofInfo::setFileSize(size_t fileSize, bool isLarge) {
|
ReturnValue_t EofInfo::setFileSize(uint64_t fileSize, bool isLarge) {
|
||||||
return this->fileSize.setFileSize(fileSize, isLarge);
|
return this->fileSize.setFileSize(fileSize, isLarge);
|
||||||
}
|
}
|
||||||
|
@ -21,7 +21,7 @@ struct EofInfo {
|
|||||||
void setChecksum(uint32_t checksum);
|
void setChecksum(uint32_t checksum);
|
||||||
void setConditionCode(cfdp::ConditionCode conditionCode);
|
void setConditionCode(cfdp::ConditionCode conditionCode);
|
||||||
void setFaultLoc(EntityIdTlv* faultLoc);
|
void setFaultLoc(EntityIdTlv* faultLoc);
|
||||||
ReturnValue_t setFileSize(size_t size, bool isLarge);
|
ReturnValue_t setFileSize(uint64_t size, bool isLarge);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
cfdp::ConditionCode conditionCode;
|
cfdp::ConditionCode conditionCode;
|
||||||
|
@ -109,7 +109,7 @@ ReturnValue_t LocalPool::deleteData(uint8_t* ptr, size_t size, store_address_t*
|
|||||||
ReturnValue_t result = ILLEGAL_ADDRESS;
|
ReturnValue_t result = ILLEGAL_ADDRESS;
|
||||||
for (uint16_t n = 0; n < NUMBER_OF_SUBPOOLS; n++) {
|
for (uint16_t n = 0; n < NUMBER_OF_SUBPOOLS; n++) {
|
||||||
// Not sure if new allocates all stores in order. so better be careful.
|
// Not sure if new allocates all stores in order. so better be careful.
|
||||||
if ((store[n].data() <= ptr) and (&store[n][numberOfElements[n] * elementSizes[n]] > ptr)) {
|
if ((store[n].data() <= ptr) and (&store[n][numberOfElements[n] * elementSizes[n] - 1] >= ptr)) {
|
||||||
localId.poolIndex = n;
|
localId.poolIndex = n;
|
||||||
uint32_t deltaAddress = ptr - store[n].data();
|
uint32_t deltaAddress = ptr - store[n].data();
|
||||||
// Getting any data from the right "block" is ok.
|
// Getting any data from the right "block" is ok.
|
||||||
|
@ -42,7 +42,9 @@ TEST_CASE("EOF PDU", "[cfdp][pdu]") {
|
|||||||
REQUIRE(sz == 20);
|
REQUIRE(sz == 20);
|
||||||
|
|
||||||
eofInfo.setConditionCode(cfdp::ConditionCode::FILESTORE_REJECTION);
|
eofInfo.setConditionCode(cfdp::ConditionCode::FILESTORE_REJECTION);
|
||||||
eofInfo.setFileSize(0x10ffffff10, true);
|
uint64_t value = 0x13ffffffff;
|
||||||
|
size_t vlaue1 = value;
|
||||||
|
eofInfo.setFileSize(0x13fffefd10, true);
|
||||||
pduConf.largeFile = true;
|
pduConf.largeFile = true;
|
||||||
// Should serialize with fault location now
|
// Should serialize with fault location now
|
||||||
auto serializeWithFaultLocation = EofPduCreator(pduConf, eofInfo);
|
auto serializeWithFaultLocation = EofPduCreator(pduConf, eofInfo);
|
||||||
@ -57,7 +59,7 @@ TEST_CASE("EOF PDU", "[cfdp][pdu]") {
|
|||||||
uint64_t fileSizeLarge = 0;
|
uint64_t fileSizeLarge = 0;
|
||||||
result = SerializeAdapter::deSerialize(&fileSizeLarge, buf.data() + 16, nullptr,
|
result = SerializeAdapter::deSerialize(&fileSizeLarge, buf.data() + 16, nullptr,
|
||||||
SerializeIF::Endianness::NETWORK);
|
SerializeIF::Endianness::NETWORK);
|
||||||
REQUIRE(fileSizeLarge == 0x10ffffff10);
|
REQUIRE(fileSizeLarge == 0x13fffefd10);
|
||||||
REQUIRE(buf[sz - 4] == cfdp::TlvType::ENTITY_ID);
|
REQUIRE(buf[sz - 4] == cfdp::TlvType::ENTITY_ID);
|
||||||
// width of entity ID is 2
|
// width of entity ID is 2
|
||||||
REQUIRE(buf[sz - 3] == 2);
|
REQUIRE(buf[sz - 3] == 2);
|
||||||
|
@ -40,7 +40,6 @@ TEST_CASE("PlacementFactory Tests", "[containers]") {
|
|||||||
REQUIRE(storagePool.getFreeElement(&address, sizeof(uint64_t), &ptr) ==
|
REQUIRE(storagePool.getFreeElement(&address, sizeof(uint64_t), &ptr) ==
|
||||||
static_cast<int>(returnvalue::OK));
|
static_cast<int>(returnvalue::OK));
|
||||||
REQUIRE(storagePool.deleteData(address) == static_cast<int>(returnvalue::OK));
|
REQUIRE(storagePool.deleteData(address) == static_cast<int>(returnvalue::OK));
|
||||||
|
|
||||||
// Check that PlacementFactory checks for nullptr
|
// Check that PlacementFactory checks for nullptr
|
||||||
ptr = nullptr;
|
ptr = nullptr;
|
||||||
REQUIRE(factory.destroy(ptr) == static_cast<int>(returnvalue::FAILED));
|
REQUIRE(factory.destroy(ptr) == static_cast<int>(returnvalue::FAILED));
|
||||||
|
@ -221,9 +221,12 @@ TEST_CASE("Host Filesystem", "[hal][host]") {
|
|||||||
SECTION("Remove recursively") {
|
SECTION("Remove recursively") {
|
||||||
fs::create_directory(dir0.string().c_str());
|
fs::create_directory(dir0.string().c_str());
|
||||||
ofstream of(fileInDir0);
|
ofstream of(fileInDir0);
|
||||||
|
of.close();
|
||||||
CHECK(fs::is_directory(dir0));
|
CHECK(fs::is_directory(dir0));
|
||||||
CHECK(fs::is_regular_file(fileInDir0));
|
CHECK(fs::is_regular_file(fileInDir0));
|
||||||
REQUIRE(hostFs.removeDirectory(FilesystemParams(dir0.string().c_str()), true) ==
|
// See note at the top
|
||||||
|
std::string dir0_string = dir0.string();
|
||||||
|
REQUIRE(hostFs.removeDirectory(FilesystemParams(dir0_string.c_str()), true) ==
|
||||||
returnvalue::OK);
|
returnvalue::OK);
|
||||||
CHECK(not fs::is_directory(dir0));
|
CHECK(not fs::is_directory(dir0));
|
||||||
CHECK(not fs::is_regular_file(fileInDir0));
|
CHECK(not fs::is_regular_file(fileInDir0));
|
||||||
|
Loading…
x
Reference in New Issue
Block a user