mirror of
https://github.com/eledio-devices/thirdparty-ArduinoJson.git
synced 2025-11-01 00:38:27 +01:00
MessagePack: serialize round floats as integers (fixes #1718)
This commit is contained in:
@@ -144,4 +144,18 @@ TEST_CASE("serialize MsgPack value") {
|
||||
checkVariant(serialized("\xDA\xFF\xFF"), "\xDA\xFF\xFF");
|
||||
checkVariant(serialized("\xDB\x00\x01\x00\x00", 5), "\xDB\x00\x01\x00\x00");
|
||||
}
|
||||
|
||||
SECTION("serialize round double as integer") { // Issue #1718
|
||||
checkVariant(-32768.0, "\xD1\x80\x00");
|
||||
checkVariant(-129.0, "\xD1\xFF\x7F");
|
||||
checkVariant(-128.0, "\xD0\x80");
|
||||
checkVariant(-33.0, "\xD0\xDF");
|
||||
checkVariant(-32.0, "\xE0");
|
||||
checkVariant(-1.0, "\xFF");
|
||||
checkVariant(0.0, "\x00");
|
||||
checkVariant(127.0, "\x7F");
|
||||
checkVariant(128.0, "\xCC\x80");
|
||||
checkVariant(255.0, "\xCC\xFF");
|
||||
checkVariant(256.0, "\xCD\x01\x00");
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user