eive-obsw/unittest/testEnvironment.cpp

60 lines
1.9 KiB
C++
Raw Normal View History

2022-02-17 17:48:32 +01:00
#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>
2022-08-16 17:09:46 +02:00
#include <fsfw/timemanager/CdsShortTimeStamper.h>
2022-02-17 17:48:32 +01:00
#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);
2022-08-16 17:09:46 +02:00
new CdsShortTimeStamper(objects::TIME_STAMPER);
2022-02-17 17:48:32 +01:00
{
PoolManager::LocalPoolConfig poolCfg = {{300, 16}, {200, 32}, {150, 64}, {150, 128},
{100, 256}, {50, 512}, {50, 1024}, {10, 2048}};
2023-03-14 18:47:48 +01:00
new PoolManager(objects::IPC_STORE, poolCfg, true);
2022-02-17 17:48:32 +01:00
}
}
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) {}