eive-obsw/unittest/testEnvironment.cpp
2023-03-14 20:02:27 +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/CdsShortTimeStamper.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 CdsShortTimeStamper(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) {}