Robin Mueller
f932c4c2c5
Some checks failed
EIVE/eive-obsw/pipeline/head There was a failure building this commit
55 lines
1.9 KiB
C++
55 lines
1.9 KiB
C++
#include <dummies/SusDummy.h>
|
|
#include <fsfw/ipc/QueueFactory.h>
|
|
#include <fsfw/tasks/PeriodicTaskIF.h>
|
|
#include <fsfw/tasks/TaskFactory.h>
|
|
#include <mission/controller/ThermalController.h>
|
|
|
|
#include <catch2/catch_test_macros.hpp>
|
|
|
|
#include "../../dummies/TemperatureSensorInserter.h"
|
|
#include "../testEnvironment.h"
|
|
|
|
TEST_CASE("Thermal Controller", "[ThermalController]") {
|
|
const object_id_t THERMAL_CONTROLLER_ID = 0x123;
|
|
|
|
new TemperatureSensorInserter(objects::THERMAL_TEMP_INSERTER);
|
|
// TODO: Create dummy heater handler
|
|
// new HeaterHandler()
|
|
new SusDummy();
|
|
|
|
// testEnvironment::initialize();
|
|
|
|
ThermalController controller(THERMAL_CONTROLLER_ID);
|
|
ReturnValue_t result = controller.initialize();
|
|
REQUIRE(result == returnvalue::OK);
|
|
|
|
PeriodicTaskIF* thermalTask = TaskFactory::instance()->createPeriodicTask(
|
|
"THERMAL_CTL_TASK", 40, PeriodicTaskIF::MINIMUM_STACK_SIZE, 1.0, nullptr);
|
|
result = thermalTask->addComponent(THERMAL_CONTROLLER_ID);
|
|
REQUIRE(result == returnvalue::OK);
|
|
|
|
REQUIRE(controller.initializeAfterTaskCreation() == returnvalue::OK);
|
|
|
|
testEnvironment::eventManager->clearEventList();
|
|
|
|
MessageQueueId_t controllerQueue = controller.getCommandQueue();
|
|
|
|
CommandMessage modeMessage;
|
|
|
|
ModeMessage::setModeMessage(&modeMessage, ModeMessage::CMD_MODE_COMMAND,
|
|
ControllerBase::MODE_NORMAL, HasModesIF::SUBMODE_NONE);
|
|
|
|
MessageQueueIF* commandQueue =
|
|
QueueFactory::instance()->createMessageQueue(5, MessageQueueMessage::MAX_MESSAGE_SIZE);
|
|
|
|
commandQueue->sendMessage(controllerQueue, &modeMessage);
|
|
|
|
REQUIRE(controller.performOperation(0) == returnvalue::OK);
|
|
|
|
REQUIRE(testEnvironment::eventManager->isEventInEventList(
|
|
THERMAL_CONTROLLER_ID, HasModesIF::MODE_INFO, ControllerBase::MODE_NORMAL,
|
|
HasModesIF::SUBMODE_NONE) == true);
|
|
|
|
QueueFactory::instance()->deleteMessageQueue(commandQueue);
|
|
}
|