eive-obsw/unittest/controller/testThermalController.cpp
Robin Mueller 0bd20ac9fd
Some checks failed
EIVE/eive-obsw/pipeline/head Build started...
EIVE/eive-obsw/pipeline/pr-develop There was a failure building this commit
init acs test files
2022-05-10 17:49:10 +02:00

46 lines
1.5 KiB
C++

#include <fsfw/ipc/QueueFactory.h>
#include <mission/controller/ThermalController.h>
#include <catch2/catch_test_macros.hpp>
#include "../testEnvironment.h"
TEST_CASE("Thermal Controller", "[ThermalController]") {
const object_id_t THERMAL_CONTROLLER_ID = 0x123;
ThermalController controller(THERMAL_CONTROLLER_ID, objects::NO_OBJECT);
testEnvironment::initialize();
REQUIRE(controller.initializeAfterTaskCreation() == HasReturnvaluesIF::RETURN_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) == HasReturnvaluesIF::RETURN_OK);
REQUIRE(testEnvironment::eventManager->isEventInEventList(
THERMAL_CONTROLLER_ID, HasModesIF::MODE_INFO, ControllerBase::MODE_NORMAL,
HasModesIF::SUBMODE_NONE) == true);
thermalControllerDefinitions::ComponentTemperatures componentTemperatures(THERMAL_CONTROLLER_ID);
componentTemperatures.read();
REQUIRE(componentTemperatures.rw == 0);
componentTemperatures.commit();
QueueFactory::instance()->deleteMessageQueue(commandQueue);
}