eive-obsw/unittest/testEnvironment.cpp
Ulrich Mohr bcac56a65c
Some checks failed
EIVE/eive-obsw/pipeline/head There was a failure building this commit
reworked test setup
2022-02-17 17:48:32 +01:00

60 lines
1.9 KiB
C++

#include "testEnvironment.h"
#include <fsfw/events/EventManager.h>
#include <fsfw/health/HealthTable.h>
#include <fsfw/housekeeping/AcceptsHkPacketsIF.h>
#include <fsfw/internalerror/InternalErrorReporter.h>
#include <fsfw/objectmanager/ObjectManager.h>
#include <fsfw/serviceinterface/ServiceInterfaceStream.h>
#include <fsfw/storagemanager/PoolManager.h>
#include <fsfw/timemanager/TimeStamper.h>
#ifdef LINUX
ServiceInterfaceStream sif::debug("DEBUG ");
ServiceInterfaceStream sif::info("INFO ");
ServiceInterfaceStream sif::warning("WARNING");
ServiceInterfaceStream sif::error("ERROR ", false, true, true);
#else
ServiceInterfaceStream sif::debug("DEBUG", true);
ServiceInterfaceStream sif::info("INFO", true);
ServiceInterfaceStream sif::warning("WARNING", true);
ServiceInterfaceStream sif::error("ERROR", true, false, true);
#endif
namespace testEnvironment {
void factory(void* args) {
new HouseKeepingMock();
eventManager = new EventManagerMock();
new HealthTable(objects::HEALTH_TABLE);
new InternalErrorReporter(objects::INTERNAL_ERROR_REPORTER);
new TimeStamper(objects::TIME_STAMPER);
{
PoolManager::LocalPoolConfig poolCfg = {{300, 16}, {200, 32}, {150, 64}, {150, 128},
{100, 256}, {50, 512}, {50, 1024}, {10, 2048}};
new PoolManager(objects::IPC_STORE, poolCfg);
}
}
void setup() { ObjectManager::instance()->setObjectFactoryFunction(factory, nullptr); }
void initialize() { ObjectManager::instance()->initialize(); }
} // namespace testEnvironment
EventManagerMock* testEnvironment::eventManager = nullptr;
#include <fsfw/ipc/CommandMessage.h>
#include <fsfw/ipc/FwMessageTypes.h>
namespace messagetypes {
enum MESSAGE_TYPE {
MISSION_MESSAGE_TYPE_START = FW_MESSAGES_COUNT,
};
void clearMissionMessage(CommandMessage* message);
} // namespace messagetypes
void messagetypes::clearMissionMessage(CommandMessage* message) {}