use Be instead of Ne, which could be confused
This commit is contained in:
parent
3708df2423
commit
2a34c831b1
@ -62,9 +62,9 @@ class SerializeIF {
|
|||||||
virtual ReturnValue_t serialize(uint8_t **buffer, size_t *size, size_t maxSize,
|
virtual ReturnValue_t serialize(uint8_t **buffer, size_t *size, size_t maxSize,
|
||||||
Endianness streamEndianness) const = 0;
|
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);
|
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,
|
virtual ReturnValue_t deSerialize(const uint8_t **buffer, size_t *size,
|
||||||
Endianness streamEndianness) = 0;
|
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);
|
return deSerialize(buffer, size, SerializeIF::Endianness::NETWORK);
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
@ -129,9 +129,9 @@ class SerializeIF {
|
|||||||
return serialize(&buffer, &tmpSize, maxSize, streamEndianness);
|
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);
|
return serialize(buffer, maxSize, SerializeIF::Endianness::NETWORK);
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
@ -154,9 +154,9 @@ class SerializeIF {
|
|||||||
return deSerialize(&buffer, &maxSize, streamEndianness);
|
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);
|
return deSerialize(buffer, maxSize, SerializeIF::Endianness::NETWORK);
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
|
@ -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);
|
REQUIRE(simpleSer.serialize(&ptr, &len, buf.size(), SerializeIF::Endianness::NETWORK) == HasReturnvaluesIF::RETURN_OK);
|
||||||
}
|
}
|
||||||
SECTION("Network 1") {
|
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);
|
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);
|
REQUIRE(simpleSer.SerializeIF::serialize(buf.data(), buf.size(), SerializeIF::Endianness::NETWORK) == HasReturnvaluesIF::RETURN_OK);
|
||||||
}
|
}
|
||||||
SECTION("Network 1") {
|
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[0] == 1);
|
||||||
CHECK(buf[1] == 2);
|
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);
|
REQUIRE(simpleSer.deSerialize(&ptr, &len, SerializeIF::Endianness::NETWORK) == HasReturnvaluesIF::RETURN_OK);
|
||||||
}
|
}
|
||||||
SECTION("Network 1") {
|
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.getU8() == 5);
|
||||||
CHECK(simpleSer.getU16() == 1);
|
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);
|
REQUIRE(simpleSer.SerializeIF::deSerialize(buf.data(), buf.size(), SerializeIF::Endianness::NETWORK) == HasReturnvaluesIF::RETURN_OK);
|
||||||
}
|
}
|
||||||
SECTION("Network 1") {
|
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.getU8() == 5);
|
||||||
CHECK(simpleSer.getU16() == 1);
|
CHECK(simpleSer.getU16() == 1);
|
||||||
|
Loading…
Reference in New Issue
Block a user