Update ArduinoJSON, esp-nimble-cpp, Arduino Core, ESP-IDF (#448)

* ArduinoJSON 7.1.0

* Update nimble and arduino core

* Update nuki_ble
This commit is contained in:
iranl
2024-08-11 11:20:31 +02:00
committed by GitHub
parent 4af90cbc79
commit 9d55c2173d
216 changed files with 6437 additions and 5705 deletions

View File

@@ -7,6 +7,8 @@
#include <ArduinoJson.h>
#include <catch.hpp>
#include "Literals.hpp"
static void check(const JsonArray array, const char* expected_data,
size_t expected_len) {
std::string expected(expected_data, expected_data + expected_len);
@@ -57,7 +59,6 @@ TEST_CASE("serialize MsgPack array") {
array.add(nil);
REQUIRE(array.size() == 65536);
check(array,
std::string("\xDD\x00\x01\x00\x00", 5) + std::string(65536, '\xc0'));
check(array, "\xDD\x00\x01\x00\x00"_s + std::string(65536, '\xc0'));
}
}

View File

@@ -6,6 +6,8 @@
#include <stdio.h>
#include <catch.hpp>
#include "Literals.hpp"
static void check(const JsonObject object, const char* expected_data,
size_t expected_len) {
std::string expected(expected_data, expected_data + expected_len);
@@ -44,7 +46,7 @@ TEST_CASE("serialize MsgPack object") {
SECTION("map 16") {
for (int i = 0; i < 16; ++i) {
char key[16];
sprintf(key, "i%X", i);
snprintf(key, sizeof(key), "i%X", i);
object[key] = i;
}
@@ -60,7 +62,7 @@ TEST_CASE("serialize MsgPack object") {
//
// for (int i = 0; i < 65536; ++i) {
// char kv[16];
// sprintf(kv, "%04x", i);
// snprintf(kv, sizeof(kv), "%04x", i);
// object[kv] = kv;
// expected += '\xA4';
// expected += kv;
@@ -77,7 +79,7 @@ TEST_CASE("serialize MsgPack object") {
}
SECTION("serialized(std::string)") {
object["hello"] = serialized(std::string("\xDB\x00\x01\x00\x00", 5));
object["hello"] = serialized("\xDB\x00\x01\x00\x00"_s);
check(object, "\x81\xA5hello\xDB\x00\x01\x00\x00");
}
}

View File

@@ -5,6 +5,8 @@
#include <ArduinoJson.h>
#include <catch.hpp>
#include "Literals.hpp"
template <typename T>
static void checkVariant(T value, const char* expected_data,
size_t expected_len) {
@@ -129,16 +131,15 @@ TEST_CASE("serialize MsgPack value") {
SECTION("str 16") {
std::string shortest(256, '?');
checkVariant(shortest.c_str(), std::string("\xDA\x01\x00", 3) + shortest);
checkVariant(shortest.c_str(), "\xDA\x01\x00"_s + shortest);
std::string longest(65535, '?');
checkVariant(longest.c_str(), std::string("\xDA\xFF\xFF", 3) + longest);
checkVariant(longest.c_str(), "\xDA\xFF\xFF"_s + longest);
}
SECTION("str 32") {
std::string shortest(65536, '?');
checkVariant(shortest.c_str(),
std::string("\xDB\x00\x01\x00\x00", 5) + shortest);
checkVariant(shortest.c_str(), "\xDB\x00\x01\x00\x00"_s + shortest);
}
SECTION("serialized(const char*)") {
@@ -146,6 +147,56 @@ TEST_CASE("serialize MsgPack value") {
checkVariant(serialized("\xDB\x00\x01\x00\x00", 5), "\xDB\x00\x01\x00\x00");
}
SECTION("bin 8") {
checkVariant(MsgPackBinary("?", 1), "\xC4\x01?");
}
SECTION("bin 16") {
auto str = std::string(256, '?');
checkVariant(MsgPackBinary(str.data(), str.size()), "\xC5\x01\x00"_s + str);
}
// bin 32 is tested in string_length_size_4.cpp
SECTION("fixext 1") {
checkVariant(MsgPackExtension(1, "\x02", 1), "\xD4\x01\x02");
}
SECTION("fixext 2") {
checkVariant(MsgPackExtension(1, "\x03\x04", 2), "\xD5\x01\x03\x04");
}
SECTION("fixext 4") {
checkVariant(MsgPackExtension(1, "\x05\x06\x07\x08", 4),
"\xD6\x01\x05\x06\x07\x08");
}
SECTION("fixext 8") {
checkVariant(MsgPackExtension(1, "????????", 8), "\xD7\x01????????");
}
SECTION("fixext 16") {
checkVariant(MsgPackExtension(1, "????????????????", 16),
"\xD8\x01????????????????");
}
SECTION("ext 8") {
checkVariant(MsgPackExtension(2, "???", 3), "\xC7\x03\x02???");
checkVariant(MsgPackExtension(2, "?????", 5), "\xC7\x05\x02?????");
checkVariant(MsgPackExtension(2, "???????", 7), "\xC7\x07\x02???????");
checkVariant(MsgPackExtension(2, "?????????", 9), "\xC7\x09\x02?????????");
checkVariant(MsgPackExtension(2, "???????????????", 15),
"\xC7\x0F\x02???????????????");
checkVariant(MsgPackExtension(2, "?????????????????", 17),
"\xC7\x11\x02?????????????????");
}
SECTION("ext 16") {
auto str = std::string(256, '?');
checkVariant(MsgPackExtension(2, str.data(), str.size()),
"\xC8\x01\x00\x02"_s + str);
}
SECTION("serialize round double as integer") { // Issue #1718
checkVariant(-32768.0, "\xD1\x80\x00");
checkVariant(-129.0, "\xD1\xFF\x7F");