text
stringlengths
1
24.5M
// ArduinoJson - https://arduinojson.org // Copyright © 2014-2025, Benoit BLANCHON // MIT License #include <ArduinoJson.h> #include <catch.hpp> #include "Allocators.hpp" #include "Literals.hpp" using namespace ArduinoJson::detail; enum ErrorCode { ERROR_01 = 1, ERROR_10 = 10 }; TEST_CASE("JsonVariant::set() when ...
// ArduinoJson - https://arduinojson.org // Copyright © 2014-2025, Benoit BLANCHON // MIT License #include <ArduinoJson.h> #include <catch.hpp> TEST_CASE("JsonVariant::size()") { JsonDocument doc; JsonVariant variant = doc.to<JsonVariant>(); SECTION("unbound reference") { JsonVariant unbound; CHECK(u...
// ArduinoJson - https://arduinojson.org // Copyright © 2014-2025, Benoit BLANCHON // MIT License #include <ArduinoJson.h> #include <stdint.h> #include <catch.hpp> #include <array> #include <string> #include <vector> namespace ArduinoJson { template <typename T> struct Converter<std::vector<T>> { static void toJs...
// ArduinoJson - https://arduinojson.org // Copyright © 2014-2025, Benoit BLANCHON // MIT License #include <ArduinoJson.h> #include <catch.hpp> #include "Literals.hpp" TEST_CASE("JsonVariant::operator[]") { JsonDocument doc; JsonVariant var = doc.to<JsonVariant>(); SECTION("The JsonVariant is null") { RE...
// ArduinoJson - https://arduinojson.org // Copyright © 2014-2025, Benoit BLANCHON // MIT License #include <ArduinoJson.h> #include <stdint.h> #include <catch.hpp> #include <limits> #include "Allocators.hpp" #include "Literals.hpp" template <typename T> void checkReference(T& expected) { JsonVariant variant = exp...
// ArduinoJson - https://arduinojson.org // Copyright © 2014-2025, Benoit BLANCHON // MIT License #include <ArduinoJson.h> #include <catch.hpp> #include "Literals.hpp" TEST_CASE("Unbound JsonVariant") { JsonVariant variant; SECTION("as<T>()") { CHECK(variant.as<bool>() == false); CHECK(variant.as<int>(...
// ArduinoJson - https://arduinojson.org // Copyright © 2014-2025, Benoit BLANCHON // MIT License #include <ArduinoJson.h> #include <stdint.h> #include <catch.hpp> #include "Literals.hpp" TEST_CASE("JsonVariantConst::as<T>()") { JsonDocument doc; JsonVariantConst var = doc.to<JsonVariant>(); doc.set("hello")...
// ArduinoJson - https://arduinojson.org // Copyright © 2014-2025, Benoit BLANCHON // MIT License #include <ArduinoJson.h> #include <catch.hpp> enum MYENUM2 { ONE = 1, TWO = 2 }; TEST_CASE("JsonVariantConst::is<T>()") { JsonDocument doc; JsonVariantConst var = doc.to<JsonVariant>(); SECTION("unbound") { ...
// ArduinoJson - https://arduinojson.org // Copyright © 2014-2025, Benoit BLANCHON // MIT License #include <ArduinoJson.h> #include <catch.hpp> TEST_CASE("JsonVariantConst::isNull()") { JsonDocument doc; JsonVariantConst variant = doc.to<JsonVariant>(); SECTION("returns true when undefined") { REQUIRE(var...
// ArduinoJson - https://arduinojson.org // Copyright © 2014-2025, Benoit BLANCHON // MIT License #include <ArduinoJson.h> #include <catch.hpp> TEST_CASE("JsonVariantConst::nesting()") { JsonDocument doc; JsonVariantConst var = doc.to<JsonVariant>(); SECTION("return 0 if unbound") { JsonVariantConst unbou...
// ArduinoJson - https://arduinojson.org // Copyright © 2014-2025, Benoit BLANCHON // MIT License #include <ArduinoJson.h> #include <catch.hpp> TEST_CASE("JsonVariantConst::size()") { JsonDocument doc; JsonVariantConst variant = doc.to<JsonVariant>(); SECTION("unbound reference") { JsonVariantConst unboun...
// ArduinoJson - https://arduinojson.org // Copyright © 2014-2025, Benoit BLANCHON // MIT License #include <ArduinoJson.h> #include <catch.hpp> #include "Literals.hpp" TEST_CASE("JsonVariantConst::operator[]") { JsonDocument doc; JsonVariantConst var = doc.to<JsonVariant>(); SECTION("null") { REQUIRE(0 =...
// ArduinoJson - https://arduinojson.org // Copyright © 2014-2025, Benoit BLANCHON // MIT License #include <ArduinoJson/Numbers/arithmeticCompare.hpp> #include <catch.hpp> using namespace ArduinoJson::detail; TEST_CASE("arithmeticCompare()") { SECTION("int vs uint8_t") { CHECK(arithmeticCompare<int, uint8_t>(...
// ArduinoJson - https://arduinojson.org // Copyright © 2014-2025, Benoit BLANCHON // MIT License // Include any header that might use the conflicting macros #include <cmath> #include <iostream> #include <string> // All cores #define bit() #define constrain() #define DEFAULT #define DISABLED #define HIGH #define INP...
// ArduinoJson - https://arduinojson.org // Copyright © 2014-2025, Benoit BLANCHON // MIT License #pragma once #include <string> struct custom_char_traits : std::char_traits<char> {}; using custom_string = std::basic_string<char, custom_char_traits>;
// ArduinoJson - https://arduinojson.org // Copyright © 2014-2025, Benoit BLANCHON // MIT License // we expect ArduinoJson.h to include <string> #define ARDUINOJSON_ENABLE_STD_STRING 1 // but we don't want it to included accidentally #undef ARDUINO #define ARDUINOJSON_ENABLE_STD_STREAM 0 #define ARDUINOJSON_ENABLE_S...
// ArduinoJson - https://arduinojson.org // Copyright © 2014-2025, Benoit BLANCHON // MIT License #include <ArduinoJson.h> #include <catch.hpp> template <typename T> class Nullable { public: Nullable() : value_{} {} Nullable(T value) : value_{value} {} operator T() const { return value_; } operator ...
// ArduinoJson - https://arduinojson.org // Copyright © 2014-2025, Benoit BLANCHON // MIT License #include <ArduinoJson.h> #include <catch.hpp> struct CCLASS { static const char mszKey[]; }; TEST_CASE("Issue #2166") { JsonDocument doc; doc[CCLASS::mszKey] = 12; REQUIRE(doc.as<std::string>() == "{\"test3\":1...
// ArduinoJson - https://arduinojson.org // Copyright © 2014-2025, Benoit BLANCHON // MIT License #define true 0x1 #define false 0x0 #include <ArduinoJson.h> #include <catch.hpp> TEST_CASE("Issue #2181") { JsonDocument doc; doc["hello"] = "world"; REQUIRE(doc.as<std::string>() == "{\"hello\":\"world\"}"); }
// ArduinoJson - https://arduinojson.org // Copyright © 2014-2025, Benoit BLANCHON // MIT License #include <ArduinoJson.h> #include <catch.hpp> #include <sstream> TEST_CASE("JsonString") { SECTION("Default constructor creates a null JsonString") { JsonString s; CHECK(s.isNull() == true); CHECK(s.c_st...
// ArduinoJson - https://arduinojson.org // Copyright © 2014-2025, Benoit BLANCHON // MIT License #define ARDUINO 1 #define ARDUINOJSON_ENABLE_PROGMEM 0 #define ARDUINOJSON_ENABLE_ARDUINO_STRING 0 #define ARDUINOJSON_ENABLE_ARDUINO_STREAM 0 #define ARDUINOJSON_ENABLE_ARDUINO_PRINT 0 #include <ArduinoJson.h> #include...
// ArduinoJson - https://arduinojson.org // Copyright © 2014-2025, Benoit BLANCHON // MIT License #include <Arduino.h> #include <catch.hpp> #define ARDUINOJSON_ENABLE_ARDUINO_STREAM 1 #include <ArduinoJson.h> #include "Allocators.hpp" using ArduinoJson::detail::sizeofArray; struct PrintOneCharacterAtATime { sta...
// ArduinoJson - https://arduinojson.org // Copyright © 2014-2025, Benoit BLANCHON // MIT License #include <Arduino.h> #include <ArduinoJson.hpp> #include <catch.hpp> #include <sstream> using namespace ArduinoJson::detail; TEST_CASE("Reader<std::istringstream>") { SECTION("read()") { std::istringstream src("...
// ArduinoJson - https://arduinojson.org // Copyright © 2014-2025, Benoit BLANCHON // MIT License #include <Arduino.h> #include <ArduinoJson/Strings/IsString.hpp> #include <ArduinoJson/Strings/JsonString.hpp> #include <ArduinoJson/Strings/StringAdapters.hpp> #include <catch.hpp> #include "custom_string.hpp" #inclu...
// ArduinoJson - https://arduinojson.org // Copyright © 2014-2025, Benoit BLANCHON // MIT License #include <Arduino.h> #define ARDUINOJSON_STRING_BUFFER_SIZE 5 #include <ArduinoJson.h> #include <catch.hpp> #include "Literals.hpp" #include "custom_string.hpp" using namespace ArduinoJson::detail; template <typenam...
// ArduinoJson - https://arduinojson.org // Copyright © 2014-2025, Benoit BLANCHON // MIT License #include <ArduinoJson.h> #include <catch.hpp> #include <sstream> using namespace ArduinoJson::detail; class EmptyClass {}; enum EmptyEnum {}; TEST_CASE("Polyfills/type_traits") { SECTION("is_base_of") { REQUIRE...
// ArduinoJson - https://arduinojson.org // Copyright © 2014-2025, Benoit BLANCHON // MIT License #include <ArduinoJson.h> #include <catch.hpp> #include "Literals.hpp" #if defined(__clang__) # define CONFLICTS_WITH_BUILTIN_OPERATOR #endif TEST_CASE("unsigned char[]") { SECTION("deserializeJson()") { unsigne...
// ArduinoJson - https://arduinojson.org // Copyright © 2014-2025, Benoit BLANCHON // MIT License #include <ArduinoJson/Json/Utf16.hpp> #include <catch.hpp> using namespace ArduinoJson::detail; static void testUtf16Codepoint(uint16_t codeunit, uint32_t expectedCodepoint) { Utf16::Codepoint cp; REQUIRE(cp.append...
// ArduinoJson - https://arduinojson.org // Copyright © 2014-2025, Benoit BLANCHON // MIT License #include <ArduinoJson.h> #include <catch.hpp> #include <string> using namespace ArduinoJson::detail; static void testCodepoint(uint32_t codepoint, std::string expected) { ResourceManager resources; StringBuilder s...
// ArduinoJson - https://arduinojson.org // Copyright © 2014-2025, Benoit BLANCHON // MIT License #include <ArduinoJson/version.hpp> #include <catch.hpp> #include <sstream> using Catch::Matchers::StartsWith; TEST_CASE("ARDUINOJSON_VERSION") { std::stringstream version; version << ARDUINOJSON_VERSION_MAJOR << "...
// ArduinoJson - https://arduinojson.org // Copyright © 2014-2025, Benoit BLANCHON // MIT License #include <ArduinoJson/Namespace.hpp> #include <string.h> // strcmp, strncmp // Issue #1198: strcmp() implementation that returns a value larger than 8-bit ARDUINOJSON_BEGIN_PRIVATE_NAMESPACE int strcmp(const char* a...
#define ARDUINOJSON_DECODE_UNICODE 0 #include <ArduinoJson.h> #include <catch.hpp> TEST_CASE("ARDUINOJSON_DECODE_UNICODE == 0") { JsonDocument doc; DeserializationError err = deserializeJson(doc, "\"\\uD834\\uDD1E\""); REQUIRE(err == DeserializationError::Ok); REQUIRE(doc.as<std::string>() == "\\uD834\\uDD1E...
#define ARDUINOJSON_DECODE_UNICODE 1 #include <ArduinoJson.h> #include <catch.hpp> TEST_CASE("ARDUINOJSON_DECODE_UNICODE == 1") { JsonDocument doc; DeserializationError err = deserializeJson(doc, "\"\\uD834\\uDD1E\""); REQUIRE(err == DeserializationError::Ok); }
#define ARDUINOJSON_VERSION_NAMESPACE NoAlignment #define ARDUINOJSON_ENABLE_ALIGNMENT 0 #include <ArduinoJson.h> #include <ArduinoJson/Memory/Alignment.hpp> #include <catch.hpp> TEST_CASE("ARDUINOJSON_ENABLE_ALIGNMENT == 0") { using namespace ArduinoJson::detail; const size_t N = sizeof(void*); SECTION("isA...
#define ARDUINOJSON_ENABLE_ALIGNMENT 1 #include <ArduinoJson.h> #include <ArduinoJson/Memory/Alignment.hpp> #include <catch.hpp> TEST_CASE("ARDUINOJSON_ENABLE_ALIGNMENT == 1") { using namespace ArduinoJson::detail; const size_t N = sizeof(void*); SECTION("isAligned()") { CHECK(isAligned(0) == true); ...
// ArduinoJson - https://arduinojson.org // Copyright © 2014-2025, Benoit BLANCHON // MIT License #define ARDUINOJSON_ENABLE_COMMENTS 0 #include <ArduinoJson.h> #include <catch.hpp> TEST_CASE("Comments should produce InvalidInput") { JsonDocument doc; const char* testCases[] = { "/*COMMENT*/ [\"hello\"]...
// ArduinoJson - https://arduinojson.org // Copyright © 2014-2025, Benoit BLANCHON // MIT License #define ARDUINOJSON_ENABLE_COMMENTS 1 #include <ArduinoJson.h> #include <catch.hpp> TEST_CASE("Comments in arrays") { JsonDocument doc; SECTION("Block comments") { SECTION("Before opening bracket") { Des...
#define ARDUINOJSON_ENABLE_INFINITY 0 #include <ArduinoJson.h> #include <catch.hpp> #include <limits> static void assertParseFails(const char* json) { JsonDocument doc; DeserializationError err = deserializeJson(doc, json); REQUIRE(err == DeserializationError::InvalidInput); } static void assertJsonEquals(con...
#define ARDUINOJSON_ENABLE_INFINITY 1 #include <ArduinoJson.h> #include <catch.hpp> #include <limits> namespace my { using ArduinoJson::detail::isinf; } // namespace my TEST_CASE("ARDUINOJSON_ENABLE_INFINITY == 1") { JsonDocument doc; SECTION("serializeJson()") { doc.add(std::numeric_limits<double>::infini...
#define ARDUINOJSON_ENABLE_NAN 0 #include <ArduinoJson.h> #include <catch.hpp> #include <limits> TEST_CASE("ARDUINOJSON_ENABLE_NAN == 0") { JsonDocument doc; JsonObject root = doc.to<JsonObject>(); SECTION("serializeJson()") { root["X"] = std::numeric_limits<double>::signaling_NaN(); std::string json;...
#define ARDUINOJSON_ENABLE_NAN 1 #include <ArduinoJson.h> #include <catch.hpp> #include <limits> namespace my { using ArduinoJson::detail::isnan; } // namespace my TEST_CASE("ARDUINOJSON_ENABLE_NAN == 1") { JsonDocument doc; JsonObject root = doc.to<JsonObject>(); SECTION("serializeJson()") { root["X"] =...
// ArduinoJson - https://arduinojson.org // Copyright © 2014-2025, Benoit BLANCHON // MIT License #define ARDUINOJSON_ENABLE_PROGMEM 1 #include <ArduinoJson.h> #include <catch.hpp> TEST_CASE("Flash strings") { JsonDocument doc; SECTION("deserializeJson()") { DeserializationError err = deserializeJson(doc, ...
// ArduinoJson - https://arduinojson.org // Copyright © 2014-2025, Benoit BLANCHON // MIT License #define ARDUINO #define memcpy_P(dest, src, n) memcpy((dest), (src), (n)) #include <ArduinoJson.h> #include <catch.hpp> TEST_CASE("Issue1707") { JsonDocument doc; DeserializationError err = deserializeJson(doc, F...
#define ARDUINOJSON_STRING_LENGTH_SIZE 1 #include <ArduinoJson.h> #include <catch.hpp> #include <string> #include "Literals.hpp" TEST_CASE("ARDUINOJSON_STRING_LENGTH_SIZE == 1") { JsonDocument doc; SECTION("set(std::string)") { SECTION("returns true if len <= 255") { auto result = doc.set(std::string(...
#define ARDUINOJSON_STRING_LENGTH_SIZE 2 #include <ArduinoJson.h> #include <catch.hpp> #include <string> #include "Literals.hpp" TEST_CASE("ARDUINOJSON_STRING_LENGTH_SIZE == 2") { JsonDocument doc; SECTION("set(std::string)") { SECTION("returns true if len <= 65535") { auto result = doc.set(std::strin...
#define ARDUINOJSON_STRING_LENGTH_SIZE 4 #include <ArduinoJson.h> #include <catch.hpp> #include <string> #include "Literals.hpp" TEST_CASE("ARDUINOJSON_STRING_LENGTH_SIZE == 4") { JsonDocument doc; SECTION("set(std::string)") { SECTION("returns true if string length >= 65536") { auto result = doc.set(...
#define ARDUINOJSON_USE_DOUBLE 0 #include <ArduinoJson.h> #include <catch.hpp> namespace my { using ArduinoJson::detail::isinf; } // namespace my void checkFloat(const char* input, float expected) { using ArduinoJson::detail::NumberType; using ArduinoJson::detail::parseNumber; CAPTURE(input); auto result = ...
#define ARDUINOJSON_USE_DOUBLE 1 #include <ArduinoJson.h> #include <catch.hpp> TEST_CASE("ARDUINOJSON_USE_DOUBLE == 1") { JsonDocument doc; JsonObject root = doc.to<JsonObject>(); root["pi"] = 3.14; root["e"] = 2.72; std::string json; serializeJson(doc, json); REQUIRE(json == "{\"pi\":3.14,\"e\":2.72...
#define ARDUINOJSON_USE_LONG_LONG 0 #include <ArduinoJson.h> #include <catch.hpp> #include "Literals.hpp" TEST_CASE("ARDUINOJSON_USE_LONG_LONG == 0") { JsonDocument doc; SECTION("smoke test") { doc["A"] = 42; doc["B"] = 84; std::string json; serializeJson(doc, json); REQUIRE(json == "{\"A\...
#define ARDUINOJSON_USE_LONG_LONG 1 #include <ArduinoJson.h> #include <catch.hpp> TEST_CASE("ARDUINOJSON_USE_LONG_LONG == 1") { JsonDocument doc; JsonObject root = doc.to<JsonObject>(); root["A"] = 123456789123456789; root["B"] = 987654321987654321; std::string json; serializeJson(doc, json); REQUIRE...
// ArduinoJson - https://arduinojson.org // Copyright © 2014-2025, Benoit BLANCHON // MIT License #include <ArduinoJson.h> #include <catch.hpp> #include "Allocators.hpp" TEST_CASE("deserialize MsgPack array") { SpyingAllocator spy; JsonDocument doc(&spy); SECTION("fixarray") { SECTION("empty") { co...
// ArduinoJson - https://arduinojson.org // Copyright © 2014-2025, Benoit BLANCHON // MIT License #include <ArduinoJson.h> #include <catch.hpp> TEST_CASE("deserialize MsgPack object") { JsonDocument doc; SECTION("fixmap") { SECTION("empty") { const char* input = "\x80"; DeserializationError err...
// ArduinoJson - https://arduinojson.org // Copyright © 2014-2025, Benoit BLANCHON // MIT License #include <ArduinoJson.h> #include <catch.hpp> #include "Allocators.hpp" #include "Literals.hpp" template <typename T> static void checkValue(const char* input, T expected) { JsonDocument doc; DeserializationError ...
// ArduinoJson - https://arduinojson.org // Copyright © 2014-2025, Benoit BLANCHON // MIT License #include <ArduinoJson.h> #include <catch.hpp> #include <string> #include "Allocators.hpp" #include "Literals.hpp" using ArduinoJson::detail::sizeofArray; using ArduinoJson::detail::sizeofObject; TEST_CASE("deserializ...
// ArduinoJson - https://arduinojson.org // Copyright © 2014-2025, Benoit BLANCHON // MIT License #include <ArduinoJson.h> #include <catch.hpp> using namespace ArduinoJson::detail; template <typename T> static void check(const char* input, T expected) { T actual; uint8_t* f = reinterpret_cast<uint8_t*>(&actual)...
// ArduinoJson - https://arduinojson.org // Copyright © 2014-2025, Benoit BLANCHON // MIT License #include <ArduinoJson.h> #include <catch.hpp> #include <sstream> #include "Allocators.hpp" TEST_CASE("deserializeMsgPack() returns InvalidInput") { JsonDocument doc; SECTION("integer as key") { auto err = des...
// ArduinoJson - https://arduinojson.org // Copyright © 2014-2025, Benoit BLANCHON // MIT License #include <ArduinoJson.h> #include <catch.hpp> #include <sstream> #include "Allocators.hpp" #include "Literals.hpp" using namespace ArduinoJson::detail; TEST_CASE("deserializeMsgPack() filter") { SpyingAllocator spy...
// ArduinoJson - https://arduinojson.org // Copyright © 2014-2025, Benoit BLANCHON // MIT License #include <ArduinoJson.h> #include <catch.hpp> #include "CustomReader.hpp" #include "Literals.hpp" using ArduinoJson::detail::sizeofObject; TEST_CASE("deserializeMsgPack(const std::string&)") { JsonDocument doc; S...
// ArduinoJson - https://arduinojson.org // Copyright © 2014-2025, Benoit BLANCHON // MIT License #include <ArduinoJson.h> #include <catch.hpp> #include <sstream> #define SHOULD_WORK(expression) REQUIRE(DeserializationError::Ok == expression); #define SHOULD_FAIL(expression) \ REQUIRE(DeserializationError::TooDee...
// ArduinoJson - https://arduinojson.org // Copyright © 2014-2025, Benoit BLANCHON // MIT License #include <ArduinoJson.h> #include <catch.hpp> TEST_CASE("serialize MsgPack to various destination types") { JsonDocument doc; JsonObject object = doc.to<JsonObject>(); object["hello"] = "world"; const char* expe...
// ArduinoJson - https://arduinojson.org // Copyright © 2014-2025, Benoit BLANCHON // MIT License #include <ArduinoJson.h> #include <catch.hpp> TEST_CASE("measureMsgPack()") { JsonDocument doc; JsonObject object = doc.to<JsonObject>(); object["hello"] = "world"; REQUIRE(measureMsgPack(doc) == 13); }
#include <ArduinoJson.h> #include <catch.hpp> #include <limits> template <typename T> void check(T value, const std::string& expected) { JsonDocument doc; doc.to<JsonVariant>().set(value); char buffer[256] = ""; size_t returnValue = serializeMsgPack(doc, buffer, sizeof(buffer)); REQUIRE(expected == buffer); ...
// ArduinoJson - https://arduinojson.org // Copyright © 2014-2025, Benoit BLANCHON // MIT License #define ARDUINOJSON_SLOT_ID_SIZE 4 // required to reach 65536 elements #include <ArduinoJson.h> #include <catch.hpp> #include "Literals.hpp" static void check(const JsonArray array, const char* expected_data, ...
// ArduinoJson - https://arduinojson.org // Copyright © 2014-2025, Benoit BLANCHON // MIT License #include <ArduinoJson.h> #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 expe...
// ArduinoJson - https://arduinojson.org // Copyright © 2014-2025, Benoit BLANCHON // MIT License #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) { JsonDocument do...
// ArduinoJson - https://arduinojson.org // Copyright © 2014-2025, Benoit BLANCHON // MIT License #include <stdint.h> #include <ArduinoJson.hpp> #include <catch.hpp> using namespace ArduinoJson::detail; TEST_CASE("canConvertNumber<TOut, TIn>()") { SECTION("int8_t -> int8_t") { CHECK(canConvertNumber<int8_t, i...
// ArduinoJson - https://arduinojson.org // Copyright © 2014-2025, Benoit BLANCHON // MIT License #include <ArduinoJson/Numbers/FloatParts.hpp> #include <catch.hpp> using namespace ArduinoJson::detail; TEST_CASE("decomposeFloat()") { SECTION("1.7976931348623157E+308") { auto parts = decomposeFloat(1.797693134...
// ArduinoJson - https://arduinojson.org // Copyright © 2014-2025, Benoit BLANCHON // MIT License #define ARDUINOJSON_USE_DOUBLE 1 #define ARDUINOJSON_ENABLE_NAN 1 #define ARDUINOJSON_ENABLE_INFINITY 1 #include <ArduinoJson.hpp> #include <catch.hpp> using namespace ArduinoJson::detail; void checkDouble(const char*...
// ArduinoJson - https://arduinojson.org // Copyright © 2014-2025, Benoit BLANCHON // MIT License #define ARDUINOJSON_ENABLE_NAN 1 #define ARDUINOJSON_ENABLE_INFINITY 1 #include <ArduinoJson.hpp> #include <catch.hpp> using namespace ArduinoJson::detail; void checkFloat(const char* input, float expected) { CAPTUR...
// ArduinoJson - https://arduinojson.org // Copyright © 2014-2025, Benoit BLANCHON // MIT License #include <stdint.h> #include <ArduinoJson.hpp> #include <catch.hpp> using namespace ArduinoJson::detail; template <typename T> void checkInteger(const char* input, T expected) { CAPTURE(input); T actual = parseNumb...
// ArduinoJson - https://arduinojson.org // Copyright © 2014-2025, Benoit BLANCHON // MIT License #include <ArduinoJson.hpp> #include <catch.hpp> using namespace ArduinoJson; using namespace ArduinoJson::detail; TEST_CASE("Test unsigned integer overflow") { Number first, second; // Avoids MSVC warning C4127 (c...
// ArduinoJson - https://arduinojson.org // Copyright © 2014-2025, Benoit BLANCHON // MIT License #include <ArduinoJson.hpp> #include <catch.hpp> #include <ArduinoJson/Memory/Alignment.hpp> #include "Allocators.hpp" using namespace ArduinoJson::detail; TEST_CASE("ResourceManager::allocVariant()") { SECTION("Ret...
// ArduinoJson - https://arduinojson.org // Copyright © 2014-2025, Benoit BLANCHON // MIT License #include <ArduinoJson/Memory/ResourceManager.hpp> #include <ArduinoJson/Strings/StringAdapters.hpp> #include <catch.hpp> using namespace ArduinoJson::detail; TEST_CASE("ResourceManager::clear()") { ResourceManager r...
// ArduinoJson - https://arduinojson.org // Copyright © 2014-2025, Benoit BLANCHON // MIT License #include <ArduinoJson/Memory/ResourceManager.hpp> #include <ArduinoJson/Strings/StringAdapters.hpp> #include <catch.hpp> #include "Allocators.hpp" using namespace ArduinoJson::detail; static StringNode* saveString(Res...
// ArduinoJson - https://arduinojson.org // Copyright © 2014-2025, Benoit BLANCHON // MIT License #include <ArduinoJson/Memory/ResourceManager.hpp> #include <catch.hpp> #include "Allocators.hpp" using namespace ArduinoJson::detail; TEST_CASE("ResourceManager::shrinkToFit()") { SpyingAllocator spyingAllocator; ...
// ArduinoJson - https://arduinojson.org // Copyright © 2014-2025, Benoit BLANCHON // MIT License #include <ArduinoJson/Memory/ResourceManager.hpp> #include <catch.hpp> #include "Allocators.hpp" using namespace ArduinoJson::detail; TEST_CASE("ResourceManager::size()") { TimebombAllocator timebomb(0); Resource...
// ArduinoJson - https://arduinojson.org // Copyright © 2014-2025, Benoit BLANCHON // MIT License #include <ArduinoJson/Memory/StringBuffer.hpp> #include <ArduinoJson/Variant/VariantImpl.hpp> #include <catch.hpp> #include "Allocators.hpp" #include "Literals.hpp" using namespace ArduinoJson::detail; TEST_CASE("Stri...
// ArduinoJson - https://arduinojson.org // Copyright © 2014-2025, Benoit BLANCHON // MIT License #include <ArduinoJson/Memory/StringBuilder.hpp> #include <ArduinoJson/Variant/VariantImpl.hpp> #include <catch.hpp> #include "Allocators.hpp" using namespace ArduinoJson; using namespace ArduinoJson::detail; TEST_CASE...
// ArduinoJson - https://arduinojson.org // Copyright © 2014-2025, Benoit BLANCHON // MIT License #include <ArduinoJson/Memory/Alignment.hpp> #include <ArduinoJson/Memory/ResourceManager.hpp> #include <catch.hpp> #include "Allocators.hpp" using namespace ArduinoJson::detail; static void fullPreallocatedPools(Reso...
// ArduinoJson - https://arduinojson.org // Copyright © 2014-2025, Benoit BLANCHON // MIT License #include <catch.hpp> #include <limits> #include <string> #define ARDUINOJSON_ENABLE_NAN 1 #define ARDUINOJSON_ENABLE_INFINITY 1 #include <ArduinoJson/Json/TextFormatter.hpp> #include <ArduinoJson/Serialization/Writer.hp...
// ArduinoJson - https://arduinojson.org // Copyright © 2014-2025, Benoit BLANCHON // MIT License #include <catch.hpp> #include <limits> #include <string> #include <ArduinoJson/Json/TextFormatter.hpp> #include <ArduinoJson/Serialization/Writer.hpp> using namespace ArduinoJson::detail; template <typename T> void ch...
// ArduinoJson - https://arduinojson.org // Copyright © 2014-2025, Benoit BLANCHON // MIT License #include <catch.hpp> #include <ArduinoJson/Json/TextFormatter.hpp> #include <ArduinoJson/Serialization/Writers/StaticStringWriter.hpp> using namespace ArduinoJson::detail; void check(const char* input, std::string exp...
// ArduinoJson - https://arduinojson.org // Copyright © 2014-2025, Benoit BLANCHON // MIT License #pragma once #ifdef __cplusplus # include "ArduinoJson.hpp" using namespace ArduinoJson; #else #error ArduinoJson requires a C++ compiler, please change file extension to .cc or .cpp #endif
// ArduinoJson - https://arduinojson.org // Copyright © 2014-2025, Benoit BLANCHON // MIT License #pragma once #if __cplusplus < 201103L && (!defined(_MSC_VER) || _MSC_VER < 1910) # error ArduinoJson requires C++11 or newer. Configure your compiler for C++11 or downgrade ArduinoJson to 6.20. #endif #include "Ardui...
// ArduinoJson - https://arduinojson.org // Copyright © 2014-2025, Benoit BLANCHON // MIT License // // clang-format off #include <ArduinoJson/Namespace.hpp> #ifdef ARDUINOJSON_SLOT_OFFSET_SIZE #error ARDUINOJSON_SLOT_OFFSET_SIZE has been removed, use ARDUINOJSON_SLOT_ID_SIZE instead #endif #ifdef ARDUINOJSON_ENABL...
// ArduinoJson - https://arduinojson.org // Copyright © 2014-2025, Benoit BLANCHON // MIT License #pragma once // Support std::istream and std::ostream // https://arduinojson.org/v7/config/enable_std_stream/ #ifndef ARDUINOJSON_ENABLE_STD_STREAM # ifdef __has_include # if __has_include(<istream>) && \ __has_...
// ArduinoJson - https://arduinojson.org // Copyright © 2014-2025, Benoit BLANCHON // MIT License #pragma once #include <ArduinoJson/Configuration.hpp> #include <ArduinoJson/Polyfills/preprocessor.hpp> #include <ArduinoJson/version.hpp> #ifndef ARDUINOJSON_VERSION_NAMESPACE # define ARDUINOJSON_VERSION_NAMESPACE ...
// ArduinoJson - https://arduinojson.org // Copyright © 2014-2025, Benoit BLANCHON // MIT License #pragma once #define ARDUINOJSON_VERSION "7.4.2" #define ARDUINOJSON_VERSION_MAJOR 7 #define ARDUINOJSON_VERSION_MINOR 4 #define ARDUINOJSON_VERSION_REVISION 2 #define ARDUINOJSON_VERSION_MACRO V742
// ArduinoJson - https://arduinojson.org // Copyright © 2014-2025, Benoit BLANCHON // MIT License #pragma once #include <ArduinoJson/Variant/VariantCompare.hpp> #include <ArduinoJson/Variant/VariantImpl.hpp> ARDUINOJSON_BEGIN_PRIVATE_NAMESPACE inline VariantImpl::iterator VariantImpl::at(size_t index) const { if...
// ArduinoJson - https://arduinojson.org // Copyright © 2014-2025, Benoit BLANCHON // MIT License #pragma once #include <ArduinoJson/Variant/VariantRefBase.hpp> ARDUINOJSON_BEGIN_PRIVATE_NAMESPACE // A proxy class to get or set an element of an array. // https://arduinojson.org/v7/api/jsonarray/subscript/ template...
// ArduinoJson - https://arduinojson.org // Copyright © 2014-2025, Benoit BLANCHON // MIT License #pragma once #include <ArduinoJson/Array/ElementProxy.hpp> #include <ArduinoJson/Array/JsonArrayConst.hpp> ARDUINOJSON_BEGIN_PUBLIC_NAMESPACE class JsonObject; // A reference to an array in a JsonDocument // https://...
// ArduinoJson - https://arduinojson.org // Copyright © 2014-2025, Benoit BLANCHON // MIT License #pragma once #include <ArduinoJson/Array/JsonArrayIterator.hpp> #include <ArduinoJson/Variant/VariantAttorney.hpp> #include <ArduinoJson/Variant/VariantData.hpp> ARDUINOJSON_BEGIN_PUBLIC_NAMESPACE class JsonObject; /...
// ArduinoJson - https://arduinojson.org // Copyright © 2014-2025, Benoit BLANCHON // MIT License #pragma once #include <ArduinoJson/Variant/JsonVariant.hpp> ARDUINOJSON_BEGIN_PUBLIC_NAMESPACE template <typename T> class Ptr { public: Ptr(T value) : value_(value) {} T* operator->() { return &value_; } ...
// ArduinoJson - https://arduinojson.org // Copyright © 2014-2025, Benoit BLANCHON // MIT License #pragma once #include <ArduinoJson/Array/JsonArray.hpp> #include <ArduinoJson/Document/JsonDocument.hpp> ARDUINOJSON_BEGIN_PUBLIC_NAMESPACE // Copies a value to a JsonVariant. // This is a degenerated form of copyArra...
// ArduinoJson - https://arduinojson.org // Copyright © 2014-2025, Benoit BLANCHON // MIT License #pragma once #include <ArduinoJson/Variant/VariantImpl.hpp> ARDUINOJSON_BEGIN_PRIVATE_NAMESPACE inline void CollectionIterator::move(const ResourceManager* resources) { ARDUINOJSON_ASSERT(slot_); auto nextId = slo...
// ArduinoJson - https://arduinojson.org // Copyright © 2014-2025, Benoit BLANCHON // MIT License #pragma once #include <ArduinoJson/Namespace.hpp> #include <ArduinoJson/Polyfills/assert.hpp> #include <stddef.h> // size_t ARDUINOJSON_BEGIN_PRIVATE_NAMESPACE struct VariantData; class ResourceManager; class Colle...
// ArduinoJson - https://arduinojson.org // Copyright © 2014-2025, Benoit BLANCHON // MIT License #pragma once #include <ArduinoJson/Namespace.hpp> #include <ArduinoJson/Polyfills/pgmspace_generic.hpp> #include <ArduinoJson/Polyfills/preprocessor.hpp> #if ARDUINOJSON_ENABLE_STD_STREAM # include <ostream> #endif A...
// ArduinoJson - https://arduinojson.org // Copyright © 2014-2025, Benoit BLANCHON // MIT License #pragma once #include <ArduinoJson/Deserialization/Filter.hpp> #include <ArduinoJson/Deserialization/NestingLimit.hpp> ARDUINOJSON_BEGIN_PRIVATE_NAMESPACE template <typename TFilter> struct DeserializationOptions { ...
// ArduinoJson - https://arduinojson.org // Copyright © 2014-2025, Benoit BLANCHON // MIT License #pragma once #include <ArduinoJson/Deserialization/DeserializationError.hpp> #include <ArduinoJson/Deserialization/DeserializationOptions.hpp> #include <ArduinoJson/Deserialization/Reader.hpp> #include <ArduinoJson/Poly...
// ArduinoJson - https://arduinojson.org // Copyright © 2014-2025, Benoit BLANCHON // MIT License #pragma once #include <ArduinoJson/Variant/JsonVariant.hpp> #include <ArduinoJson/Variant/VariantAttorney.hpp> ARDUINOJSON_BEGIN_PUBLIC_NAMESPACE namespace DeserializationOption { class Filter { public: #if ARDUINOJS...