diff --git a/mission/controller/ThermalController.cpp b/mission/controller/ThermalController.cpp index f0acc5fa..04ab8682 100644 --- a/mission/controller/ThermalController.cpp +++ b/mission/controller/ThermalController.cpp @@ -1,6 +1,6 @@ #include "ThermalController.h" -ThermalController::ThermalController(object_id_t objectId) :ExtendedControllerBase(objectId, 0) {} +ThermalController::ThermalController(object_id_t objectId, object_id_t parentId) :ExtendedControllerBase(objectId, parentId) {} ReturnValue_t ThermalController::perform() { return HasReturnvaluesIF::RETURN_FAILED; } diff --git a/mission/controller/ThermalController.h b/mission/controller/ThermalController.h index 25c257b7..1faba29f 100644 --- a/mission/controller/ThermalController.h +++ b/mission/controller/ThermalController.h @@ -7,7 +7,7 @@ class ThermalController : public ExtendedControllerBase { public: - ThermalController(object_id_t objectId); + ThermalController(object_id_t objectId, object_id_t parentId); ReturnValue_t perform(); diff --git a/unittest/CMakeLists.txt b/unittest/CMakeLists.txt index c2b09393..6a0c55ed 100644 --- a/unittest/CMakeLists.txt +++ b/unittest/CMakeLists.txt @@ -3,5 +3,6 @@ add_subdirectory(controller) target_sources(${UNITTEST_NAME} PRIVATE main.cpp + initTests.cpp printChar.cpp ) \ No newline at end of file diff --git a/unittest/controller/testThermalController.cpp b/unittest/controller/testThermalController.cpp index fed27834..b3d74476 100644 --- a/unittest/controller/testThermalController.cpp +++ b/unittest/controller/testThermalController.cpp @@ -1,45 +1,43 @@ +#include +#include +#include +#include +#include +#include +#include + #include -#include -#include "fsfw/serviceinterface/ServiceInterfaceStream.h" +class HkDummy : public SystemObject, public AcceptsHkPacketsIF { + public: + HkDummy() : SystemObject(objects::PUS_SERVICE_3_HOUSEKEEPING) {} -/* This is configured for linux without CR */ -#ifdef PLATFORM_UNIX -ServiceInterfaceStream sif::debug("DEBUG"); -ServiceInterfaceStream sif::info("INFO"); -ServiceInterfaceStream sif::warning("WARNING"); -ServiceInterfaceStream sif::error("ERROR"); -#else -ServiceInterfaceStream sif::debug("DEBUG", true); -ServiceInterfaceStream sif::info("INFO", true); -ServiceInterfaceStream sif::warning("WARNING", true); -ServiceInterfaceStream sif::error("ERROR", true, false, true); -#endif - -#include - -namespace messagetypes { -enum MESSAGE_TYPE { - MISSION_MESSAGE_TYPE_START = FW_MESSAGES_COUNT, + virtual MessageQueueId_t getHkQueue() const { return MessageQueueIF::NO_QUEUE; } }; -void clearMissionMessage(CommandMessage* message); -} // namespace messagetypes +void factory(void* args) { + new HkDummy(); + new HealthTable(objects::HEALTH_TABLE); + new InternalErrorReporter(objects::INTERNAL_ERROR_REPORTER); + new TimeStamper(objects::TIME_STAMPER); -void messagetypes::clearMissionMessage(CommandMessage* message) { - + { + 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); + } } +TEST_CASE("Thermal Controller", "[ThermalController]") { + bool test = true; + REQUIRE(test == true); + ThermalController controller(0x123, objects::NO_OBJECT); + ObjectManager::instance()->setObjectFactoryFunction(factory, nullptr); + ObjectManager::instance()->initialize(); + ObjectManager::instance()->printList(); -TEST_CASE( "Thermal Controller" , "[ThermalController]") { - bool test = true; - REQUIRE( test == true); - - ThermalController controller(123); - - REQUIRE(controller.perform() == HasReturnvaluesIF::RETURN_OK); - + REQUIRE(controller.performOperation(0) == HasReturnvaluesIF::RETURN_OK); } \ No newline at end of file diff --git a/unittest/initTests.cpp b/unittest/initTests.cpp new file mode 100644 index 00000000..3821d893 --- /dev/null +++ b/unittest/initTests.cpp @@ -0,0 +1,29 @@ +#include + +#ifdef LINUX +ServiceInterfaceStream sif::debug("DEBUG"); +ServiceInterfaceStream sif::info("INFO"); +ServiceInterfaceStream sif::warning("WARNING"); +ServiceInterfaceStream sif::error("ERROR", false, false, 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 + +#include +#include + +namespace messagetypes { +enum MESSAGE_TYPE { + MISSION_MESSAGE_TYPE_START = FW_MESSAGES_COUNT, +}; + +void clearMissionMessage(CommandMessage* message); +} // namespace messagetypes + + +void messagetypes::clearMissionMessage(CommandMessage* message) { + +}