From 681738dcc63f3d2d92eb24476b0bc7908c3bb582 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Tue, 26 Jul 2022 19:08:12 +0200 Subject: [PATCH] PSB unittests complete --- unittests/CatchFactory.cpp | 5 ----- unittests/tmtcservices/testPsb.cpp | 25 +++++++++++++++++++++++-- 2 files changed, 23 insertions(+), 7 deletions(-) diff --git a/unittests/CatchFactory.cpp b/unittests/CatchFactory.cpp index d1d3ea1c..0d855cb3 100644 --- a/unittests/CatchFactory.cpp +++ b/unittests/CatchFactory.cpp @@ -34,11 +34,6 @@ void Factory::produceFrameworkObjects(void* args) { new HealthTable(objects::HEALTH_TABLE); new InternalErrorReporter(objects::INTERNAL_ERROR_REPORTER); - { - PoolManager::LocalPoolConfig poolCfg = {{100, 16}, {50, 32}, {25, 64}, {15, 128}, {5, 1024}}; - new PoolManager(objects::TC_STORE, poolCfg); - } - { PoolManager::LocalPoolConfig poolCfg = {{100, 16}, {50, 32}, {25, 64}, {15, 128}, {5, 1024}}; new PoolManager(objects::TM_STORE, poolCfg); diff --git a/unittests/tmtcservices/testPsb.cpp b/unittests/tmtcservices/testPsb.cpp index ea1991f0..e434607f 100644 --- a/unittests/tmtcservices/testPsb.cpp +++ b/unittests/tmtcservices/testPsb.cpp @@ -2,6 +2,7 @@ #include "fsfw/ipc/QueueFactory.h" #include "fsfw/storagemanager/LocalPool.h" +#include "fsfw/storagemanager/PoolManager.h" #include "mocks/AcceptsTmMock.h" #include "mocks/CdsShortTimestamperMock.h" #include "mocks/InternalErrorReporterMock.h" @@ -216,7 +217,27 @@ TEST_CASE("Pus Service Base", "[pus-service-base]") { REQUIRE(p.verifReporter == &otherReporter); } - SECTION("Auto Initialize TC Pool") {} + SECTION("Auto Initialize TC Pool") { + PoolManager tcStoreGlobal(objects::TC_STORE, cfg); + psbParams.tcPool = nullptr; + psbParams.objectId = 1; + auto psb2 = PsbMock(psbParams); + REQUIRE(psb2.initialize() == retval::OK); + auto& p = psb2.getParams(); + REQUIRE(p.tcPool == &tcStoreGlobal); + } - SECTION("Invalid Verification Reporter") {} + SECTION("Invalid Verification Reporter") { + psbParams.verifReporter = nullptr; + psbParams.objectId = 1; + auto psb2 = PsbMock(psbParams); + REQUIRE(psb2.initialize() == ObjectManagerIF::CHILD_INIT_FAILED); + } + + SECTION("Invalid TC Store") { + psbParams.tcPool = nullptr; + psbParams.objectId = 1; + auto psb2 = PsbMock(psbParams); + REQUIRE(psb2.initialize() == ObjectManagerIF::CHILD_INIT_FAILED); + } }