some more fsfw objects and stubs for unittesting
This commit is contained in:
parent
f1249392cf
commit
587e9451ea
@ -1,6 +1,6 @@
|
|||||||
#include "ThermalController.h"
|
#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; }
|
ReturnValue_t ThermalController::perform() { return HasReturnvaluesIF::RETURN_FAILED; }
|
||||||
|
|
||||||
|
@ -7,7 +7,7 @@
|
|||||||
|
|
||||||
class ThermalController : public ExtendedControllerBase {
|
class ThermalController : public ExtendedControllerBase {
|
||||||
public:
|
public:
|
||||||
ThermalController(object_id_t objectId);
|
ThermalController(object_id_t objectId, object_id_t parentId);
|
||||||
|
|
||||||
ReturnValue_t perform();
|
ReturnValue_t perform();
|
||||||
|
|
||||||
|
@ -3,5 +3,6 @@ add_subdirectory(controller)
|
|||||||
|
|
||||||
target_sources(${UNITTEST_NAME} PRIVATE
|
target_sources(${UNITTEST_NAME} PRIVATE
|
||||||
main.cpp
|
main.cpp
|
||||||
|
initTests.cpp
|
||||||
printChar.cpp
|
printChar.cpp
|
||||||
)
|
)
|
@ -1,45 +1,43 @@
|
|||||||
|
#include <fsfw/health/HealthTable.h>
|
||||||
|
#include <fsfw/housekeeping/AcceptsHkPacketsIF.h>
|
||||||
|
#include <fsfw/internalerror/InternalErrorReporter.h>
|
||||||
|
#include <fsfw/objectmanager.h>
|
||||||
|
#include <fsfw/storagemanager/PoolManager.h>
|
||||||
|
#include <fsfw/timemanager/TimeStamper.h>
|
||||||
|
#include <mission/controller/ThermalController.h>
|
||||||
|
|
||||||
#include <catch2/catch_test_macros.hpp>
|
#include <catch2/catch_test_macros.hpp>
|
||||||
|
|
||||||
#include <mission/controller/ThermalController.h>
|
class HkDummy : public SystemObject, public AcceptsHkPacketsIF {
|
||||||
#include "fsfw/serviceinterface/ServiceInterfaceStream.h"
|
public:
|
||||||
|
HkDummy() : SystemObject(objects::PUS_SERVICE_3_HOUSEKEEPING) {}
|
||||||
|
|
||||||
/* This is configured for linux without CR */
|
virtual MessageQueueId_t getHkQueue() const { return MessageQueueIF::NO_QUEUE; }
|
||||||
#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 <fsfw/ipc/FwMessageTypes.h>
|
|
||||||
|
|
||||||
namespace messagetypes {
|
|
||||||
enum MESSAGE_TYPE {
|
|
||||||
MISSION_MESSAGE_TYPE_START = FW_MESSAGES_COUNT,
|
|
||||||
};
|
};
|
||||||
|
|
||||||
void clearMissionMessage(CommandMessage* message);
|
void factory(void* args) {
|
||||||
} // namespace messagetypes
|
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]") {
|
||||||
|
|
||||||
|
|
||||||
TEST_CASE( "Thermal Controller" , "[ThermalController]") {
|
|
||||||
bool test = true;
|
bool test = true;
|
||||||
REQUIRE( test == true);
|
REQUIRE(test == true);
|
||||||
|
|
||||||
ThermalController controller(123);
|
ThermalController controller(0x123, objects::NO_OBJECT);
|
||||||
|
|
||||||
REQUIRE(controller.perform() == HasReturnvaluesIF::RETURN_OK);
|
ObjectManager::instance()->setObjectFactoryFunction(factory, nullptr);
|
||||||
|
ObjectManager::instance()->initialize();
|
||||||
|
ObjectManager::instance()->printList();
|
||||||
|
|
||||||
|
REQUIRE(controller.performOperation(0) == HasReturnvaluesIF::RETURN_OK);
|
||||||
}
|
}
|
29
unittest/initTests.cpp
Normal file
29
unittest/initTests.cpp
Normal file
@ -0,0 +1,29 @@
|
|||||||
|
#include <fsfw/serviceinterface/ServiceInterfaceStream.h>
|
||||||
|
|
||||||
|
#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 <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) {
|
||||||
|
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user