From 96f092ef75a0b2209407d8faed5a11eae203c037 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Fri, 29 Jul 2022 14:30:58 +0200 Subject: [PATCH 1/7] type correction --- src/fsfw/util/ObjectId.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/fsfw/util/ObjectId.h b/src/fsfw/util/ObjectId.h index b51f63e69..5b1cf461c 100644 --- a/src/fsfw/util/ObjectId.h +++ b/src/fsfw/util/ObjectId.h @@ -50,7 +50,7 @@ struct std::hash { std::size_t operator()(ObjectId const& s) const noexcept { - return std::hash{}(s.id()); + return std::hash{}(s.id()); } }; From 8b4253bc46818852d4ea7913540366b69338452e Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Fri, 12 Aug 2022 13:02:30 +0200 Subject: [PATCH 2/7] update cmakelists.txt --- CMakeLists.txt | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index cfae2acb9..1f99086b4 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -118,6 +118,11 @@ option(FSFW_ADD_INTERNAL_TESTS "Add internal unit tests" ON) option(FSFW_ADD_UNITTESTS "Add regular unittests. Requires Catch2" OFF) option(FSFW_ADD_HAL "Add Hardware Abstraction Layer" ON) +if(UNIX) + option(FSFW_HAL_LINUX_ADD_PERIPHERAL_DRIVERS "Add Linux peripheral drivers" OFF) + option(FSFW_HAL_LINUX_ADD_LIBGPIOD "Attempt to add Linux GPIOD drivers" OFF) +endif() + # Optional sources option(FSFW_ADD_PUS "Compile with PUS sources" ON) option(FSFW_ADD_MONITORING "Compile with monitoring components" ON) @@ -183,7 +188,10 @@ if(FSFW_BUILD_TESTS) endif() endif() -message(STATUS "${MSG_PREFIX} Finding and/or providing ETL library") +message( + STATUS + "${MSG_PREFIX} Finding and/or providing etl library with version ${FSFW_ETL_LIB_MAJOR_VERSION}" +) # Check whether the user has already installed ETL first find_package(${FSFW_ETL_LIB_NAME} ${FSFW_ETL_LIB_MAJOR_VERSION} QUIET) @@ -191,7 +199,7 @@ find_package(${FSFW_ETL_LIB_NAME} ${FSFW_ETL_LIB_MAJOR_VERSION} QUIET) if(NOT ${FSFW_ETL_LIB_NAME}_FOUND) message( STATUS - "No ETL installation was found with find_package. Installing and providing " + "${MSG_PREFIX} No ETL installation was found with find_package. Installing and providing " "etl with FindPackage") include(FetchContent) From b28c26b288ca9e261a95d9564202336fb3c5cf5c Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Mon, 15 Aug 2022 10:49:00 +0200 Subject: [PATCH 3/7] group MGM data in local pool vectors --- CMakeLists.txt | 6 +++++ .../devicehandlers/MgmLIS3MDLHandler.cpp | 27 ++++++++----------- .../devicehandlers/MgmLIS3MDLHandler.h | 2 ++ .../devicehandlers/MgmRM3100Handler.cpp | 11 ++++---- .../devicehandlers/MgmRM3100Handler.h | 1 + .../devicedefinitions/MgmLIS3HandlerDefs.h | 14 ++++------ .../devicedefinitions/MgmRM3100HandlerDefs.h | 14 ++++------ 7 files changed, 35 insertions(+), 40 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index cfae2acb9..95c00f284 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -118,6 +118,12 @@ option(FSFW_ADD_INTERNAL_TESTS "Add internal unit tests" ON) option(FSFW_ADD_UNITTESTS "Add regular unittests. Requires Catch2" OFF) option(FSFW_ADD_HAL "Add Hardware Abstraction Layer" ON) +if(UNIX) + option(FSFW_HAL_LINUX_ADD_PERIPHERAL_DRIVERS "Add Linux peripheral drivers" + OFF) + option(FSFW_HAL_LINUX_ADD_LIBGPIOD "Attempt to add Linux GPIOD drivers" OFF) +endif() + # Optional sources option(FSFW_ADD_PUS "Compile with PUS sources" ON) option(FSFW_ADD_MONITORING "Compile with monitoring components" ON) diff --git a/src/fsfw_hal/devicehandlers/MgmLIS3MDLHandler.cpp b/src/fsfw_hal/devicehandlers/MgmLIS3MDLHandler.cpp index 644b488dd..5ddc32453 100644 --- a/src/fsfw_hal/devicehandlers/MgmLIS3MDLHandler.cpp +++ b/src/fsfw_hal/devicehandlers/MgmLIS3MDLHandler.cpp @@ -286,26 +286,22 @@ ReturnValue_t MgmLIS3MDLHandler::interpretDeviceReply(DeviceCommandId_t id, cons PoolReadGuard readHelper(&dataset); if (readHelper.getReadResult() == HasReturnvaluesIF::RETURN_OK) { + if (std::abs(mgmX) > absLimitX or std::abs(mgmY) > absLimitY or + std::abs(mgmZ) > absLimitZ) { + dataset.fieldStrengths.setValid(false); + } if (std::abs(mgmX) < absLimitX) { - dataset.fieldStrengthX = mgmX; - dataset.fieldStrengthX.setValid(true); - } else { - dataset.fieldStrengthX.setValid(false); + dataset.fieldStrengths[0] = mgmX; } if (std::abs(mgmY) < absLimitY) { - dataset.fieldStrengthY = mgmY; - dataset.fieldStrengthY.setValid(true); - } else { - dataset.fieldStrengthY.setValid(false); + dataset.fieldStrengths[1] = mgmY; } if (std::abs(mgmZ) < absLimitZ) { - dataset.fieldStrengthZ = mgmZ; - dataset.fieldStrengthZ.setValid(true); - } else { - dataset.fieldStrengthZ.setValid(false); + dataset.fieldStrengths[2] = mgmZ; } + dataset.fieldStrengths.setValid(true); } break; } @@ -468,10 +464,9 @@ void MgmLIS3MDLHandler::modeChanged(void) { internalState = InternalState::STATE ReturnValue_t MgmLIS3MDLHandler::initializeLocalDataPool(localpool::DataPool &localDataPoolMap, LocalDataPoolManager &poolManager) { - localDataPoolMap.emplace(MGMLIS3MDL::FIELD_STRENGTH_X, new PoolEntry({0.0})); - localDataPoolMap.emplace(MGMLIS3MDL::FIELD_STRENGTH_Y, new PoolEntry({0.0})); - localDataPoolMap.emplace(MGMLIS3MDL::FIELD_STRENGTH_Z, new PoolEntry({0.0})); - localDataPoolMap.emplace(MGMLIS3MDL::TEMPERATURE_CELCIUS, new PoolEntry({0.0})); + localDataPoolMap.emplace(MGMLIS3MDL::FIELD_STRENGTHS, &mgmXYZ); + localDataPoolMap.emplace(MGMLIS3MDL::TEMPERATURE_CELCIUS, &temperature); + poolManager.subscribeForPeriodicPacket(dataset.getSid(), false, 10.0, false); return HasReturnvaluesIF::RETURN_OK; } diff --git a/src/fsfw_hal/devicehandlers/MgmLIS3MDLHandler.h b/src/fsfw_hal/devicehandlers/MgmLIS3MDLHandler.h index 42bd5d4ce..3250a739e 100644 --- a/src/fsfw_hal/devicehandlers/MgmLIS3MDLHandler.h +++ b/src/fsfw_hal/devicehandlers/MgmLIS3MDLHandler.h @@ -103,6 +103,8 @@ class MgmLIS3MDLHandler : public DeviceHandlerBase { CommunicationStep communicationStep = CommunicationStep::DATA; bool commandExecuted = false; + PoolEntry mgmXYZ = PoolEntry(3); + PoolEntry temperature = PoolEntry(); /*------------------------------------------------------------------------*/ /* Device specific commands and variables */ /*------------------------------------------------------------------------*/ diff --git a/src/fsfw_hal/devicehandlers/MgmRM3100Handler.cpp b/src/fsfw_hal/devicehandlers/MgmRM3100Handler.cpp index f9929d638..c329f5a67 100644 --- a/src/fsfw_hal/devicehandlers/MgmRM3100Handler.cpp +++ b/src/fsfw_hal/devicehandlers/MgmRM3100Handler.cpp @@ -309,9 +309,8 @@ void MgmRM3100Handler::modeChanged(void) { internalState = InternalState::NONE; ReturnValue_t MgmRM3100Handler::initializeLocalDataPool(localpool::DataPool &localDataPoolMap, LocalDataPoolManager &poolManager) { - localDataPoolMap.emplace(RM3100::FIELD_STRENGTH_X, new PoolEntry({0.0})); - localDataPoolMap.emplace(RM3100::FIELD_STRENGTH_Y, new PoolEntry({0.0})); - localDataPoolMap.emplace(RM3100::FIELD_STRENGTH_Z, new PoolEntry({0.0})); + localDataPoolMap.emplace(RM3100::FIELD_STRENGTHS, &mgmXYZ); + poolManager.subscribeForPeriodicPacket(primaryDataset.getSid(), false, 10.0, false); return HasReturnvaluesIF::RETURN_OK; } @@ -354,9 +353,9 @@ ReturnValue_t MgmRM3100Handler::handleDataReadout(const uint8_t *packet) { // TODO: Sanity check on values? PoolReadGuard readGuard(&primaryDataset); if (readGuard.getReadResult() == HasReturnvaluesIF::RETURN_OK) { - primaryDataset.fieldStrengthX = fieldStrengthX; - primaryDataset.fieldStrengthY = fieldStrengthY; - primaryDataset.fieldStrengthZ = fieldStrengthZ; + primaryDataset.fieldStrengths[0] = fieldStrengthX; + primaryDataset.fieldStrengths[1] = fieldStrengthY; + primaryDataset.fieldStrengths[2] = fieldStrengthZ; primaryDataset.setValidity(true, true); } return RETURN_OK; diff --git a/src/fsfw_hal/devicehandlers/MgmRM3100Handler.h b/src/fsfw_hal/devicehandlers/MgmRM3100Handler.h index d1048cb6e..d45b24041 100644 --- a/src/fsfw_hal/devicehandlers/MgmRM3100Handler.h +++ b/src/fsfw_hal/devicehandlers/MgmRM3100Handler.h @@ -85,6 +85,7 @@ class MgmRM3100Handler : public DeviceHandlerBase { bool goToNormalModeAtStartup = false; uint32_t transitionDelay; + PoolEntry mgmXYZ = PoolEntry(3); ReturnValue_t handleCycleCountConfigCommand(DeviceCommandId_t deviceCommand, const uint8_t *commandData, size_t commandDataLen); diff --git a/src/fsfw_hal/devicehandlers/devicedefinitions/MgmLIS3HandlerDefs.h b/src/fsfw_hal/devicehandlers/devicedefinitions/MgmLIS3HandlerDefs.h index 3d78c5c9b..34237637e 100644 --- a/src/fsfw_hal/devicehandlers/devicedefinitions/MgmLIS3HandlerDefs.h +++ b/src/fsfw_hal/devicehandlers/devicedefinitions/MgmLIS3HandlerDefs.h @@ -139,12 +139,7 @@ static const uint8_t CTRL_REG5_DEFAULT = 0; static const uint32_t MGM_DATA_SET_ID = READ_CONFIG_AND_DATA; -enum MgmPoolIds : lp_id_t { - FIELD_STRENGTH_X, - FIELD_STRENGTH_Y, - FIELD_STRENGTH_Z, - TEMPERATURE_CELCIUS -}; +enum MgmPoolIds : lp_id_t { FIELD_STRENGTHS, TEMPERATURE_CELCIUS }; class MgmPrimaryDataset : public StaticLocalDataSet<4> { public: @@ -152,9 +147,10 @@ class MgmPrimaryDataset : public StaticLocalDataSet<4> { MgmPrimaryDataset(object_id_t mgmId) : StaticLocalDataSet(sid_t(mgmId, MGM_DATA_SET_ID)) {} - lp_var_t fieldStrengthX = lp_var_t(sid.objectId, FIELD_STRENGTH_X, this); - lp_var_t fieldStrengthY = lp_var_t(sid.objectId, FIELD_STRENGTH_Y, this); - lp_var_t fieldStrengthZ = lp_var_t(sid.objectId, FIELD_STRENGTH_Z, this); + /** + * Field strenghts in uT + */ + lp_vec_t fieldStrengths = lp_vec_t(sid.objectId, FIELD_STRENGTHS, this); lp_var_t temperature = lp_var_t(sid.objectId, TEMPERATURE_CELCIUS, this); }; diff --git a/src/fsfw_hal/devicehandlers/devicedefinitions/MgmRM3100HandlerDefs.h b/src/fsfw_hal/devicehandlers/devicedefinitions/MgmRM3100HandlerDefs.h index e3eaff227..a2aa8ab00 100644 --- a/src/fsfw_hal/devicehandlers/devicedefinitions/MgmRM3100HandlerDefs.h +++ b/src/fsfw_hal/devicehandlers/devicedefinitions/MgmRM3100HandlerDefs.h @@ -101,11 +101,7 @@ class CycleCountCommand : public SerialLinkedListAdapter { static constexpr uint32_t MGM_DATASET_ID = READ_DATA; -enum MgmPoolIds : lp_id_t { - FIELD_STRENGTH_X, - FIELD_STRENGTH_Y, - FIELD_STRENGTH_Z, -}; +enum MgmPoolIds : lp_id_t { FIELD_STRENGTHS }; class Rm3100PrimaryDataset : public StaticLocalDataSet<3> { public: @@ -113,10 +109,10 @@ class Rm3100PrimaryDataset : public StaticLocalDataSet<3> { Rm3100PrimaryDataset(object_id_t mgmId) : StaticLocalDataSet(sid_t(mgmId, MGM_DATASET_ID)) {} - // Field strengths in micro Tesla. - lp_var_t fieldStrengthX = lp_var_t(sid.objectId, FIELD_STRENGTH_X, this); - lp_var_t fieldStrengthY = lp_var_t(sid.objectId, FIELD_STRENGTH_Y, this); - lp_var_t fieldStrengthZ = lp_var_t(sid.objectId, FIELD_STRENGTH_Z, this); + /** + * Field strenghts in uT + */ + lp_vec_t fieldStrengths = lp_vec_t(sid.objectId, FIELD_STRENGTHS, this); }; } // namespace RM3100 From d3cabd8984a69febfcf53979cfc0320e628beb95 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Mon, 15 Aug 2022 11:26:29 +0200 Subject: [PATCH 4/7] afmt --- CMakeLists.txt | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 1f99086b4..5351aeb4b 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -119,8 +119,9 @@ option(FSFW_ADD_UNITTESTS "Add regular unittests. Requires Catch2" OFF) option(FSFW_ADD_HAL "Add Hardware Abstraction Layer" ON) if(UNIX) - option(FSFW_HAL_LINUX_ADD_PERIPHERAL_DRIVERS "Add Linux peripheral drivers" OFF) - option(FSFW_HAL_LINUX_ADD_LIBGPIOD "Attempt to add Linux GPIOD drivers" OFF) + option(FSFW_HAL_LINUX_ADD_PERIPHERAL_DRIVERS "Add Linux peripheral drivers" + OFF) + option(FSFW_HAL_LINUX_ADD_LIBGPIOD "Attempt to add Linux GPIOD drivers" OFF) endif() # Optional sources From deeeef553b118192d45a921d6d3a1a3b5881ebd7 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Mon, 15 Aug 2022 14:34:04 +0200 Subject: [PATCH 5/7] remove implicit machine endianness variants --- src/fsfw/serialize/SerializeIF.h | 26 ----------- unittests/serialize/testSerializeIF.cpp | 57 ------------------------- 2 files changed, 83 deletions(-) diff --git a/src/fsfw/serialize/SerializeIF.h b/src/fsfw/serialize/SerializeIF.h index 5e7a2fb91..f20bf21f4 100644 --- a/src/fsfw/serialize/SerializeIF.h +++ b/src/fsfw/serialize/SerializeIF.h @@ -68,13 +68,6 @@ class SerializeIF { size_t maxSize) const { return serialize(buffer, size, maxSize, SerializeIF::Endianness::NETWORK); } - /** - * If endianness is not explicitly specified, use machine endianness - */ - [[nodiscard]] virtual ReturnValue_t serialize(uint8_t **buffer, size_t *size, - size_t maxSize) const { - return serialize(buffer, size, maxSize, SerializeIF::Endianness::MACHINE); - } /** * Gets the size of a object if it would be serialized in a buffer @@ -110,12 +103,6 @@ class SerializeIF { virtual ReturnValue_t deSerializeBe(const uint8_t **buffer, size_t *size) { return deSerialize(buffer, size, SerializeIF::Endianness::NETWORK); } - /** - * If endianness is not explicitly specified, use machine endianness - */ - virtual ReturnValue_t deSerialize(const uint8_t **buffer, size_t *size) { - return deSerialize(buffer, size, SerializeIF::Endianness::MACHINE); - } /** * Helper method which can be used if serialization should be performed without any additional @@ -139,13 +126,6 @@ class SerializeIF { size_t maxSize) const { return serialize(buffer, serLen, maxSize, SerializeIF::Endianness::NETWORK); } - /** - * If endianness is not explicitly specified, use machine endianness - */ - [[nodiscard]] virtual ReturnValue_t serialize(uint8_t *buffer, size_t &serLen, - size_t maxSize) const { - return serialize(buffer, serLen, maxSize, SerializeIF::Endianness::MACHINE); - } /** * Helper methods which can be used if deserialization should be performed without any additional @@ -168,12 +148,6 @@ class SerializeIF { virtual ReturnValue_t deSerializeBe(const uint8_t *buffer, size_t &deserSize, size_t maxSize) { return deSerialize(buffer, deserSize, maxSize, SerializeIF::Endianness::NETWORK); } - /** - * If endianness is not explicitly specified, use machine endianness - */ - virtual ReturnValue_t deSerialize(const uint8_t *buffer, size_t &deserSize, size_t maxSize) { - return deSerialize(buffer, deserSize, maxSize, SerializeIF::Endianness::MACHINE); - } }; #endif /* FSFW_SERIALIZE_SERIALIZEIF_H_ */ diff --git a/unittests/serialize/testSerializeIF.cpp b/unittests/serialize/testSerializeIF.cpp index 5200f8b76..7aafe98fd 100644 --- a/unittests/serialize/testSerializeIF.cpp +++ b/unittests/serialize/testSerializeIF.cpp @@ -76,37 +76,6 @@ TEST_CASE("Serialize IF Serialize", "[serialize-if-ser]") { CHECK(buf[2] == 3); CHECK(serLen == 3); } - - SECTION("Machine Endian Implicit") { - REQUIRE(simpleSer.SerializeIF::serialize(&ptr, &len, buf.size()) == - HasReturnvaluesIF::RETURN_OK); - CHECK(buf[0] == 1); -#if BYTE_ORDER_SYSTEM == LITTLE_ENDIAN - CHECK(buf[1] == 3); - CHECK(buf[2] == 2); -#else - CHECK(buf[1] == 2); - CHECK(buf[2] == 3); -#endif - // Verify pointer arithmetic and size increment - CHECK(ptr == buf.data() + 3); - CHECK(len == 3); - } - - SECTION("Machine Endian Simple Implicit") { - size_t serLen = 0xff; - REQUIRE(simpleSer.SerializeIF::serialize(buf.data(), serLen, buf.size()) == - HasReturnvaluesIF::RETURN_OK); - CHECK(buf[0] == 1); -#if BYTE_ORDER_SYSTEM == LITTLE_ENDIAN - CHECK(buf[1] == 3); - CHECK(buf[2] == 2); -#else - CHECK(buf[1] == 2); - CHECK(buf[2] == 3); -#endif - CHECK(serLen == 3); - } } TEST_CASE("SerializeIF Deserialize", "[serialize-if-de]") { @@ -172,30 +141,4 @@ TEST_CASE("SerializeIF Deserialize", "[serialize-if-de]") { CHECK(simpleSer.getU16() == 1); CHECK(deserLen == 3); } - - SECTION("Machine Endian Implicit") { - REQUIRE(simpleSer.SerializeIF::deSerialize(&ptr, &len) == HasReturnvaluesIF::RETURN_OK); - CHECK(simpleSer.getU8() == 5); -#if BYTE_ORDER_SYSTEM == LITTLE_ENDIAN - CHECK(simpleSer.getU16() == 0x0100); -#else - CHECK(simpleSer.getU16() == 1); -#endif - // Verify pointer arithmetic and size increment - CHECK(ptr == buf.data() + 3); - CHECK(len == 0); - } - - SECTION("Machine Endian Simple Implicit") { - size_t deserLen = 0xff; - REQUIRE(simpleSer.SerializeIF::deSerialize(buf.data(), deserLen, buf.size()) == - HasReturnvaluesIF::RETURN_OK); - CHECK(simpleSer.getU8() == 5); -#if BYTE_ORDER_SYSTEM == LITTLE_ENDIAN - CHECK(simpleSer.getU16() == 0x0100); -#else - CHECK(simpleSer.getU16() == 1); -#endif - CHECK(deserLen == 3); - } } \ No newline at end of file From ca2efb60218b85414bc3857d1ce57a6f798f6c23 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Mon, 15 Aug 2022 15:02:05 +0200 Subject: [PATCH 6/7] remove object ID --- src/fsfw/util/ObjectId.h | 57 --------------------------------- unittests/util/CMakeLists.txt | 1 - unittests/util/testObjectId.cpp | 26 --------------- 3 files changed, 84 deletions(-) delete mode 100644 src/fsfw/util/ObjectId.h delete mode 100644 unittests/util/testObjectId.cpp diff --git a/src/fsfw/util/ObjectId.h b/src/fsfw/util/ObjectId.h deleted file mode 100644 index 5b1cf461c..000000000 --- a/src/fsfw/util/ObjectId.h +++ /dev/null @@ -1,57 +0,0 @@ -#ifndef FSFW_UTIL_OBJECTID_H -#define FSFW_UTIL_OBJECTID_H - -#include "fsfw/objectmanager.h" -#include "UnsignedByteField.h" - -#include - -class ObjectId: public UnsignedByteField { - public: - ObjectId(object_id_t id, const char* name): UnsignedByteField(id), name_(name) {} - - [[nodiscard]] const char* name() const { - return name_; - } - - [[nodiscard]] object_id_t id() const { - return getValue(); - } - - bool operator==(const ObjectId& other) const { - return id() == other.id(); - } - - bool operator!=(const ObjectId& other) const { - return id() != other.id(); - } - - bool operator<(const ObjectId& other) const { - return id() < other.id(); - } - - bool operator>(const ObjectId& other) const { - return id() > other.id(); - } - - bool operator>=(const ObjectId& other) const { - return id() >= other.id(); - } - - bool operator<=(const ObjectId& other) const { - return id() <= other.id(); - } - private: - const char* name_; -}; - -template<> -struct std::hash -{ - std::size_t operator()(ObjectId const& s) const noexcept - { - return std::hash{}(s.id()); - } -}; - -#endif // FSFW_UTIL_OBJECTID_H diff --git a/unittests/util/CMakeLists.txt b/unittests/util/CMakeLists.txt index b79b77dbd..d4caa4d57 100644 --- a/unittests/util/CMakeLists.txt +++ b/unittests/util/CMakeLists.txt @@ -1,4 +1,3 @@ target_sources(${FSFW_TEST_TGT} PRIVATE testUnsignedByteField.cpp - testObjectId.cpp ) diff --git a/unittests/util/testObjectId.cpp b/unittests/util/testObjectId.cpp deleted file mode 100644 index cead2c154..000000000 --- a/unittests/util/testObjectId.cpp +++ /dev/null @@ -1,26 +0,0 @@ -#include - -#include "fsfw/util/ObjectId.h" -#include - -TEST_CASE("Object Id", "[object-id]") { - auto objectId = ObjectId(10, "TEST_ID"); - std::map testMap; - - SECTION("State") { - CHECK(objectId.id() == 10); - CHECK(std::strcmp(objectId.name(), "TEST_ID") == 0); - } - - SECTION("ID as map key") { - auto insertPair = testMap.emplace(objectId, 10); - CHECK(insertPair.second); - auto iter = testMap.find(objectId); - CHECK(iter != testMap.end()); - CHECK(std::strcmp(iter->first.name(), "TEST_ID") == 0); - CHECK(iter->second == 10); - auto otherIdSameName = ObjectId(12, "TEST_ID"); - insertPair = testMap.emplace(otherIdSameName, 10); - CHECK(insertPair.second); - } -} \ No newline at end of file From 9d64b96e9a1375f920707a720cfd664f5937322e Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Mon, 15 Aug 2022 15:02:39 +0200 Subject: [PATCH 7/7] update changelog --- CHANGELOG.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index f83c5078f..bf50b683b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,10 @@ and this project adheres to [Semantic Versioning](http://semver.org/). # [unreleased] +## Added + +- Add new `UnsignedByteField` class + # [v5.0.0] 25.07.2022 ## Changes