From 0e7c5a931b2ef394acab0d7435e69a7498163cd5 Mon Sep 17 00:00:00 2001 From: Ulrich Mohr Date: Thu, 12 Jan 2023 14:14:58 +0100 Subject: [PATCH] auto format --- .../events/eventmatching/EventMatchTree.cpp | 4 +- src/fsfw/globalfunctions/matching/MatchTree.h | 4 +- src/fsfw/health/HealthTable.cpp | 3 +- src/fsfw/objectmanager/ObjectManager.h | 2 +- unittests/osal/TestSemaphore.cpp | 61 ++++++++----------- 5 files changed, 31 insertions(+), 43 deletions(-) diff --git a/src/fsfw/events/eventmatching/EventMatchTree.cpp b/src/fsfw/events/eventmatching/EventMatchTree.cpp index 6d7f20122..cd3da6a2f 100644 --- a/src/fsfw/events/eventmatching/EventMatchTree.cpp +++ b/src/fsfw/events/eventmatching/EventMatchTree.cpp @@ -4,10 +4,8 @@ #include "fsfw/events/eventmatching/ReporterRangeMatcher.h" #include "fsfw/events/eventmatching/SeverityRangeMatcher.h" - EventMatchTree::EventMatchTree(StorageManagerIF* storageBackend, bool invertedMatch) - : MatchTree(end(), 1), factory(storageBackend), invertedMatch(invertedMatch) { - } + : MatchTree(end(), 1), factory(storageBackend), invertedMatch(invertedMatch) {} EventMatchTree::~EventMatchTree() {} diff --git a/src/fsfw/globalfunctions/matching/MatchTree.h b/src/fsfw/globalfunctions/matching/MatchTree.h index 19ccd8a49..69f660d30 100644 --- a/src/fsfw/globalfunctions/matching/MatchTree.h +++ b/src/fsfw/globalfunctions/matching/MatchTree.h @@ -24,9 +24,7 @@ class MatchTree : public SerializeableMatcherIF, public BinaryTree>(root.element), maxDepth(maxDepth) {} MatchTree() : BinaryTree>(), maxDepth(-1) {} - virtual ~MatchTree() { - clear(); - } + virtual ~MatchTree() { clear(); } virtual bool match(T number) override { return matchesTree(number); } bool matchesTree(T number) { iterator iter = this->begin(); diff --git a/src/fsfw/health/HealthTable.cpp b/src/fsfw/health/HealthTable.cpp index becac4d70..3fcf7f77e 100644 --- a/src/fsfw/health/HealthTable.cpp +++ b/src/fsfw/health/HealthTable.cpp @@ -14,8 +14,7 @@ void HealthTable::setMutexTimeout(MutexIF::TimeoutType timeoutType, uint32_t tim this->mutexTimeoutMs = timeoutMs; } -HealthTable::~HealthTable() { - MutexFactory::instance()->deleteMutex(mutex); } +HealthTable::~HealthTable() { MutexFactory::instance()->deleteMutex(mutex); } ReturnValue_t HealthTable::registerObject(object_id_t object, HasHealthIF::HealthState initilialState) { diff --git a/src/fsfw/objectmanager/ObjectManager.h b/src/fsfw/objectmanager/ObjectManager.h index 017fe6755..355f5d0a4 100644 --- a/src/fsfw/objectmanager/ObjectManager.h +++ b/src/fsfw/objectmanager/ObjectManager.h @@ -32,7 +32,7 @@ class ObjectManager : public ObjectManagerIF { /** * Deletes the single instance of ObjectManager - */ + */ static void clear(); void setObjectFactoryFunction(produce_function_t prodFunc, void* args); diff --git a/unittests/osal/TestSemaphore.cpp b/unittests/osal/TestSemaphore.cpp index bfbb49479..1d8758b18 100644 --- a/unittests/osal/TestSemaphore.cpp +++ b/unittests/osal/TestSemaphore.cpp @@ -1,45 +1,38 @@ -#include - +#include #include #include -#include +#include -//binary semaphores currently only supported on linux +// binary semaphores currently only supported on linux #ifdef FSFW_OSAL_LINUX -TEST_CASE("Binary Semaphore Test" , "[BinSemaphore]") { - //perform set-up here - SemaphoreIF* binSemaph = SemaphoreFactory::instance()-> - createBinarySemaphore(); - REQUIRE(binSemaph != nullptr); - SECTION("Simple Test") { - // set-up is run for each section - REQUIRE(binSemaph->getSemaphoreCounter() == 1); - REQUIRE(binSemaph->release() == - static_cast(SemaphoreIF::SEMAPHORE_NOT_OWNED)); - REQUIRE(binSemaph->acquire(SemaphoreIF::POLLING) == - returnvalue::OK); - { - // not precise enough on linux.. should use clock instead.. - //Stopwatch stopwatch(false); - //REQUIRE(binSemaph->acquire(SemaphoreIF::TimeoutType::WAITING, 5) == - // SemaphoreIF::SEMAPHORE_TIMEOUT); - //dur_millis_t time = stopwatch.stop(); - //CHECK(time == 5); - } - REQUIRE(binSemaph->getSemaphoreCounter() == 0); - REQUIRE(binSemaph->release() == returnvalue::OK); - } - SemaphoreFactory::instance()->deleteSemaphore(binSemaph); - // perform tear-down here +TEST_CASE("Binary Semaphore Test", "[BinSemaphore]") { + // perform set-up here + SemaphoreIF* binSemaph = SemaphoreFactory::instance()->createBinarySemaphore(); + REQUIRE(binSemaph != nullptr); + SECTION("Simple Test") { + // set-up is run for each section + REQUIRE(binSemaph->getSemaphoreCounter() == 1); + REQUIRE(binSemaph->release() == static_cast(SemaphoreIF::SEMAPHORE_NOT_OWNED)); + REQUIRE(binSemaph->acquire(SemaphoreIF::POLLING) == returnvalue::OK); + { + // not precise enough on linux.. should use clock instead.. + // Stopwatch stopwatch(false); + // REQUIRE(binSemaph->acquire(SemaphoreIF::TimeoutType::WAITING, 5) == + // SemaphoreIF::SEMAPHORE_TIMEOUT); + // dur_millis_t time = stopwatch.stop(); + // CHECK(time == 5); + } + REQUIRE(binSemaph->getSemaphoreCounter() == 0); + REQUIRE(binSemaph->release() == returnvalue::OK); + } + SemaphoreFactory::instance()->deleteSemaphore(binSemaph); + // perform tear-down here } - -TEST_CASE("Counting Semaphore Test" , "[CountingSemaph]") { - SECTION("Simple Test") { - - } +TEST_CASE("Counting Semaphore Test", "[CountingSemaph]") { + SECTION("Simple Test") {} } #endif \ No newline at end of file