working on thermal controller unit test.
Some checks failed
EIVE/eive-obsw/pipeline/head There was a failure building this commit

This commit is contained in:
2022-02-14 13:49:12 +01:00
parent 0f42790aa1
commit e95647c572
5 changed files with 111 additions and 17 deletions

View File

@ -1,13 +1,11 @@
#include <fsfw/events/EventManagerIF.h>
#include <fsfw/health/HealthTable.h>
#include <fsfw/housekeeping/AcceptsHkPacketsIF.h>
#include <fsfw/internalerror/InternalErrorReporter.h>
#include <fsfw/ipc/QueueFactory.h>
#include <fsfw/objectmanager.h>
#include <fsfw/storagemanager/PoolManager.h>
#include <fsfw/timemanager/TimeStamper.h>
#include <fsfw/events/EventManagerIF.h>
#include <mission/controller/ThermalController.h>
#include <catch2/catch_test_macros.hpp>
@ -34,14 +32,38 @@ void factory(void* args) {
}
TEST_CASE("Thermal Controller", "[ThermalController]") {
bool test = true;
REQUIRE(test == true);
const object_id_t THERMAL_CONTROLLER_ID = 0x123;
ThermalController controller(0x123, objects::NO_OBJECT);
ThermalController controller(THERMAL_CONTROLLER_ID, objects::NO_OBJECT);
ObjectManager::instance()->setObjectFactoryFunction(factory, nullptr);
ObjectManager::instance()->initialize();
ObjectManager::instance()->printList();
controller.initializeAfterTaskCreation();
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);
thermalControllerDefinitions::ComponentTemperatures componentTemperatures(THERMAL_CONTROLLER_ID);
componentTemperatures.read();
REQUIRE(componentTemperatures.rw == 0);
componentTemperatures.commit();
QueueFactory::instance()->deleteMessageQueue(commandQueue);
}