continue fixing tests

This commit is contained in:
2024-11-07 13:18:47 +01:00
parent 8ef93705eb
commit 639b210666
14 changed files with 90 additions and 67 deletions

View File

@ -31,10 +31,25 @@ SharedPool *TestPoolOwner::getOptionalSharedPool() { return &sharedPool; }
ReturnValue_t TestPoolOwner::serializeHkDataset(structure_id_t structureId, uint8_t *buf,
size_t maxSize) {
return returnvalue::OK;
size_t dummy = 0;
if (structureId == testSid0) {
return set0.serialize(buf, dummy, maxSize, SerializeIF::Endianness::NETWORK);
}
if (structureId == testSid1) {
return set1.serialize(buf, dummy, maxSize, SerializeIF::Endianness::NETWORK);
}
if (structureId == testSid2) {
return set2.serialize(buf, dummy, maxSize, SerializeIF::Endianness::NETWORK);
}
return returnvalue::FAILED;
}
ReturnValue_t TestPoolOwner::specifyHkDatasets(std::vector<hk::SetSpecification> &setList) {
// For the first set, we explicitely associate a set with an ID ourselves.
setList.emplace_back(testSid0, set0.getSerializedSize(), 50);
// For the other sets, we can use getter functions of the same structure.
setList.emplace_back(set1.getStructureId(), set1.getSerializedSize(), 50);
setList.emplace_back(set2.getStructureId(), set2.getSerializedSize(), 50);
return returnvalue::OK;
}

View File

@ -32,16 +32,17 @@ class TestPoolOwner : public SystemObject, public hk::GeneratesPeriodicHkIF {
return dynamic_cast<MessageQueueMock&>(queue);
}
ReturnValue_t subscribePeriodicHk(bool enableReporting) {
return hkHelper.enablePeriodicPacket(lpool::testSid0, 50);
ReturnValue_t enablePeriodicHk(dp::structure_id_t structureId, dur_millis_t frequencyMs) {
return hkHelper.enablePeriodicPacket(structureId, frequencyMs);
}
ReturnValue_t reset();
hk::PeriodicHelper hkHelper;
SharedPool sharedPool;
LocalPoolTestDataSet set1;
StaticTestDataSet set2;
Dataset set0;
StaticTestDataset set1;
TestDataset set2;
private:
PoolEntry<uint8_t> u8PoolEntry = PoolEntry<uint8_t>({0});

View File

@ -3,6 +3,8 @@
#include <fsfw/datapool.h>
#include <fsfw/ipc/QueueFactory.h>
#include <fsfw/objectmanager/SystemObject.h>
#include <fsfw/serialize/SerializableList.h>
#include <fsfw/serialize/SerializableListElement.h>
#include "fsfw/datapool/PoolEntry.h"
#include "mock/MessageQueueMock.h"
@ -11,6 +13,7 @@
namespace lpool {
using namespace dp;
using namespace serialize;
static constexpr id_t uint8VarId = 0;
static constexpr id_t floatVarId = 1;
@ -23,9 +26,9 @@ static constexpr uint32_t testSetId1 = 1;
static constexpr uint32_t testSetId2 = 2;
static constexpr uint8_t dataSetMaxVariables = 10;
static const auto testSid0 = structure_id_t(objects::TEST_LOCAL_POOL_OWNER_BASE, testSetId0);
static const auto testSid1 = structure_id_t(objects::TEST_LOCAL_POOL_OWNER_BASE, testSetId1);
static const auto testSid2 = structure_id_t(objects::TEST_LOCAL_POOL_OWNER_BASE, testSetId2);
static constexpr auto testSid0 = structure_id_t(objects::TEST_LOCAL_POOL_OWNER_BASE, testSetId0);
static constexpr auto testSid1 = structure_id_t(objects::TEST_LOCAL_POOL_OWNER_BASE, testSetId1);
static constexpr auto testSid2 = structure_id_t(objects::TEST_LOCAL_POOL_OWNER_BASE, testSetId2);
static const g_id_t uint8VarGpid = g_id_t(objects::TEST_LOCAL_POOL_OWNER_BASE, uint8VarId);
static const g_id_t floatVarGpid = g_id_t(objects::TEST_LOCAL_POOL_OWNER_BASE, floatVarId);
@ -33,11 +36,18 @@ static const g_id_t uint32Gpid = g_id_t(objects::TEST_LOCAL_POOL_OWNER_BASE, uin
static const g_id_t uint16Vec3Gpid = g_id_t(objects::TEST_LOCAL_POOL_OWNER_BASE, uint16Vec3Id);
static const g_id_t uint64Vec2Id = g_id_t(objects::TEST_LOCAL_POOL_OWNER_BASE, int64Vec2Id);
class StaticTestDataSet : public StaticSharedSet<3> {
class Dataset : public List {
public:
StaticTestDataSet() : StaticSharedSet(lpool::testSid1) {}
LE<uint8_t> u8Element{*this};
LE<uint16_t> u16Element{*this};
LAE<float, 3> floatVec{*this};
};
StaticTestDataSet(SharedPool& sharedPool, uint32_t setId) : StaticSharedSet(sharedPool, setId) {}
class StaticTestDataset : public StaticSharedSet<3> {
public:
StaticTestDataset() : StaticSharedSet(lpool::testSid1) {}
StaticTestDataset(SharedPool& sharedPool, uint32_t setId) : StaticSharedSet(sharedPool, setId) {}
u8_t localPoolVarUint8{lpool::uint8VarGpid, this};
f32_t localPoolVarFloat{lpool::floatVarGpid, this};
@ -46,11 +56,11 @@ class StaticTestDataSet : public StaticSharedSet<3> {
private:
};
class LocalPoolTestDataSet : public SharedSet {
class TestDataset : public SharedSet {
public:
LocalPoolTestDataSet() : SharedSet(lpool::testSid2, lpool::dataSetMaxVariables) {}
TestDataset() : SharedSet(lpool::testSid2, lpool::dataSetMaxVariables) {}
LocalPoolTestDataSet(SharedPool& sharedPool, uint32_t setId)
TestDataset(SharedPool& sharedPool, uint32_t setId)
: SharedSet(sharedPool, setId, lpool::dataSetMaxVariables) {}
u8_t localPoolVarUint8{lpool::uint8VarGpid, this};