From 3708df242320cc0edd5b103504a2ce926df6f078 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Sat, 23 Jul 2022 11:15:55 +0200 Subject: [PATCH 1/2] small fix --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 949c9403..e59eb4c5 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -168,7 +168,7 @@ if(FSFW_BUILD_TESTS) configure_file(unittests/testcfg/TestsConfig.h.in tests/TestsConfig.h) project(${FSFW_TEST_TGT} CXX C) - add_executable(${FSFW_TEST_TGT} unittests/serialize/testSerializeIF.cpp) + add_executable(${FSFW_TEST_TGT}) if(IPO_SUPPORTED AND FSFW_ENABLE_IPO) set_property(TARGET ${FSFW_TEST_TGT} PROPERTY INTERPROCEDURAL_OPTIMIZATION TRUE) From 2a34c831b199ab747e2bbab6db4237602157d873 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Mon, 25 Jul 2022 11:33:12 +0200 Subject: [PATCH 2/2] use Be instead of Ne, which could be confused --- src/fsfw/serialize/SerializeIF.h | 16 ++++++++-------- unittests/serialize/testSerializeIF.cpp | 8 ++++---- 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/src/fsfw/serialize/SerializeIF.h b/src/fsfw/serialize/SerializeIF.h index 54a1f4e3..921d8a5e 100644 --- a/src/fsfw/serialize/SerializeIF.h +++ b/src/fsfw/serialize/SerializeIF.h @@ -62,9 +62,9 @@ class SerializeIF { virtual ReturnValue_t serialize(uint8_t **buffer, size_t *size, size_t maxSize, Endianness streamEndianness) const = 0; /** - * Forwards to regular @serialize call with network endianness + * Forwards to regular @serialize call with big (network) endianness */ - virtual ReturnValue_t serializeNe(uint8_t** buffer, size_t* size, size_t maxSize) { + virtual ReturnValue_t serializeBe(uint8_t** buffer, size_t* size, size_t maxSize) { return serialize(buffer, size, maxSize, SerializeIF::Endianness::NETWORK); } /** @@ -103,9 +103,9 @@ class SerializeIF { virtual ReturnValue_t deSerialize(const uint8_t **buffer, size_t *size, Endianness streamEndianness) = 0; /** - * Forwards to regular @deSerialize call with network endianness + * Forwards to regular @deSerialize call with big (network) endianness */ - virtual ReturnValue_t deSerializeNe(const uint8_t** buffer, size_t* size) { + virtual ReturnValue_t deSerializeBe(const uint8_t** buffer, size_t* size) { return deSerialize(buffer, size, SerializeIF::Endianness::NETWORK); } /** @@ -129,9 +129,9 @@ class SerializeIF { return serialize(&buffer, &tmpSize, maxSize, streamEndianness); } /** - * Forwards to regular @serialize call with network endianness + * Forwards to regular @serialize call with big (network) endianness */ - virtual ReturnValue_t serializeNe(uint8_t *buffer, size_t maxSize) const { + virtual ReturnValue_t serializeBe(uint8_t *buffer, size_t maxSize) const { return serialize(buffer, maxSize, SerializeIF::Endianness::NETWORK); } /** @@ -154,9 +154,9 @@ class SerializeIF { return deSerialize(&buffer, &maxSize, streamEndianness); } /** - * Forwards to regular @serialize call with network endianness + * Forwards to regular @serialize call with big (network) endianness */ - virtual ReturnValue_t deSerializeNe(const uint8_t *buffer, size_t maxSize) { + virtual ReturnValue_t deSerializeBe(const uint8_t *buffer, size_t maxSize) { return deSerialize(buffer, maxSize, SerializeIF::Endianness::NETWORK); } /** diff --git a/unittests/serialize/testSerializeIF.cpp b/unittests/serialize/testSerializeIF.cpp index 2cbe6132..694f6d7f 100644 --- a/unittests/serialize/testSerializeIF.cpp +++ b/unittests/serialize/testSerializeIF.cpp @@ -38,7 +38,7 @@ TEST_CASE("Serialize IF Serialize", "[serialize-if-ser]") { REQUIRE(simpleSer.serialize(&ptr, &len, buf.size(), SerializeIF::Endianness::NETWORK) == HasReturnvaluesIF::RETURN_OK); } SECTION("Network 1") { - REQUIRE(simpleSer.serializeNe(&ptr, &len, buf.size()) == HasReturnvaluesIF::RETURN_OK); + REQUIRE(simpleSer.serializeBe(&ptr, &len, buf.size()) == HasReturnvaluesIF::RETURN_OK); } CHECK(buf[0] == 1); @@ -58,7 +58,7 @@ TEST_CASE("Serialize IF Serialize", "[serialize-if-ser]") { REQUIRE(simpleSer.SerializeIF::serialize(buf.data(), buf.size(), SerializeIF::Endianness::NETWORK) == HasReturnvaluesIF::RETURN_OK); } SECTION("Network 1") { - REQUIRE(simpleSer.SerializeIF::serializeNe(buf.data(), buf.size()) == HasReturnvaluesIF::RETURN_OK); + REQUIRE(simpleSer.SerializeIF::serializeBe(buf.data(), buf.size()) == HasReturnvaluesIF::RETURN_OK); } CHECK(buf[0] == 1); CHECK(buf[1] == 2); @@ -123,7 +123,7 @@ TEST_CASE("SerializeIF Deserialize", "[serialize-if-de]") { REQUIRE(simpleSer.deSerialize(&ptr, &len, SerializeIF::Endianness::NETWORK) == HasReturnvaluesIF::RETURN_OK); } SECTION("Network 1") { - REQUIRE(simpleSer.SerializeIF::deSerializeNe(&ptr, &len) == HasReturnvaluesIF::RETURN_OK); + REQUIRE(simpleSer.SerializeIF::deSerializeBe(&ptr, &len) == HasReturnvaluesIF::RETURN_OK); } CHECK(simpleSer.getU8() == 5); CHECK(simpleSer.getU16() == 1); @@ -140,7 +140,7 @@ TEST_CASE("SerializeIF Deserialize", "[serialize-if-de]") { REQUIRE(simpleSer.SerializeIF::deSerialize(buf.data(), buf.size(), SerializeIF::Endianness::NETWORK) == HasReturnvaluesIF::RETURN_OK); } SECTION("Network 1") { - REQUIRE(simpleSer.SerializeIF::deSerializeNe(buf.data(), buf.size()) == HasReturnvaluesIF::RETURN_OK); + REQUIRE(simpleSer.SerializeIF::deSerializeBe(buf.data(), buf.size()) == HasReturnvaluesIF::RETURN_OK); } CHECK(simpleSer.getU8() == 5); CHECK(simpleSer.getU16() == 1);