remove implicit machine endianness variants
This commit is contained in:
parent
cc56b00df3
commit
deeeef553b
@ -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_ */
|
||||
|
@ -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);
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user