fsfw/unittests/mock/poolDefinitions.h

73 lines
2.5 KiB
C
Raw Normal View History

2024-11-07 12:26:00 +01:00
#pragma once
#include <fsfw/datapool.h>
#include <fsfw/ipc/QueueFactory.h>
#include <fsfw/objectmanager/SystemObject.h>
2024-11-07 13:18:47 +01:00
#include <fsfw/serialize/SerializableList.h>
#include <fsfw/serialize/SerializableListElement.h>
2024-11-07 12:26:00 +01:00
#include "fsfw/datapool/PoolEntry.h"
#include "mock/MessageQueueMock.h"
#include "tests/TestsConfig.h"
namespace lpool {
using namespace dp;
2024-11-07 13:18:47 +01:00
using namespace serialize;
2024-11-07 12:26:00 +01:00
static constexpr id_t uint8VarId = 0;
static constexpr id_t floatVarId = 1;
static constexpr id_t uint32VarId = 2;
static constexpr id_t uint16Vec3Id = 3;
static constexpr id_t int64Vec2Id = 4;
static constexpr uint32_t testSetId0 = 0;
static constexpr uint32_t testSetId1 = 1;
static constexpr uint32_t testSetId2 = 2;
static constexpr uint8_t dataSetMaxVariables = 10;
2024-11-07 13:18:47 +01:00
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);
2024-11-07 12:26:00 +01:00
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);
static const g_id_t uint32Gpid = g_id_t(objects::TEST_LOCAL_POOL_OWNER_BASE, uint32VarId);
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);
2024-11-07 13:18:47 +01:00
class Dataset : public List {
2024-11-07 12:26:00 +01:00
public:
2024-11-07 13:18:47 +01:00
LE<uint8_t> u8Element{*this};
LE<uint16_t> u16Element{*this};
LAE<float, 3> floatVec{*this};
};
class StaticTestDataset : public StaticSharedSet<3> {
public:
StaticTestDataset() : StaticSharedSet(lpool::testSid1) {}
2024-11-07 12:26:00 +01:00
2024-11-07 13:18:47 +01:00
StaticTestDataset(SharedPool& sharedPool, uint32_t setId) : StaticSharedSet(sharedPool, setId) {}
2024-11-07 12:26:00 +01:00
u8_t localPoolVarUint8{lpool::uint8VarGpid, this};
f32_t localPoolVarFloat{lpool::floatVarGpid, this};
vec_t<uint16_t, 3> localPoolUint16Vec{lpool::uint16Vec3Gpid, this};
private:
};
2024-11-07 13:18:47 +01:00
class TestDataset : public SharedSet {
2024-11-07 12:26:00 +01:00
public:
2024-11-07 13:18:47 +01:00
TestDataset() : SharedSet(lpool::testSid2, lpool::dataSetMaxVariables) {}
2024-11-07 12:26:00 +01:00
2024-11-07 13:18:47 +01:00
TestDataset(SharedPool& sharedPool, uint32_t setId)
2024-11-07 12:26:00 +01:00
: SharedSet(sharedPool, setId, lpool::dataSetMaxVariables) {}
u8_t localPoolVarUint8{lpool::uint8VarGpid, this};
f32_t localPoolVarFloat{lpool::floatVarGpid, this};
vec_t<uint16_t, 3> localPoolUint16Vec{lpool::uint16Vec3Gpid, this};
private:
};
} // namespace lpool