Compare commits

...

52 Commits

Author SHA1 Message Date
1b8107094f Set version to 6.13.0 2019-11-01 10:32:45 +01:00
8721ac88b1 Reorganized writer classes 2019-10-31 19:27:23 +01:00
6da6f921cd Fixed dangling reference in MemberProxy and ElementProxy (fixes #1120) 2019-10-30 19:09:21 +01:00
ef63757b1a Fixed deserializer that stopped reading at the first 0xFF (closes #1118) 2019-10-29 14:17:11 +01:00
3a169df0a5 Added support for custom reader classes 2019-10-25 11:39:04 +02:00
d4f819f1f0 Added detection of Atmel AVR8/GNU C Compiler (fixes #1112) 2019-10-18 22:10:35 +02:00
16fe3c0acc Improved deserializeMsgPack() speed by reading several bytes at once 2019-10-14 12:02:26 +02:00
fd8f4eb3a6 Moved msgpack.org.md to github.com/bblanchon/ArduinoJson-msgpack.org 2019-10-11 09:07:25 +02:00
b261eca865 esp-idf make system 2019-10-07 09:00:31 +02:00
a37480eec9 Fixed deserializeJson() when input contains duplicate keys (fixes #1095) 2019-09-27 10:07:29 +02:00
713aaa3d68 Added msgpack.org.md
https://github.com/msgpack/website/blob/master/README.md#how-to-list-up-your-project-on-msgpackorg
2019-09-26 09:52:50 +02:00
7d1d0c4e67 Added conversion from JsonArray/JsonObject to bool 2019-09-24 09:38:00 +02:00
4ad05dbaef Replaced GitHub stars badge 2019-09-19 09:28:57 +02:00
38371aae62 Added OSS-Fuzz badge 2019-09-19 09:28:49 +02:00
498a2e4c1e Added support for custom writer classes (closes #1088) 2019-09-13 14:10:21 +02:00
2078871f36 Added missing #include <ArduinoJson/Namespace.hpp> 2019-09-13 12:09:07 +02:00
140525b7a0 Fix deployment scripts 2019-09-05 09:36:18 +02:00
1a81d46a97 Set version to 6.12.0 2019-09-05 09:31:06 +02:00
4c4c4688a9 Fix src/ path in Makefile 2019-09-04 09:13:09 +02:00
b47ac27ac6 Moved ancillary files to extras/ (fixes #1011) 2019-09-03 15:11:05 +02:00
ed18e77655 Changed as<bool>() to return true for any non-null value (closes #1005) 2019-08-29 08:56:34 +02:00
fcbec6eb6d Use absolute instead of relative includes (fixes #1072) 2019-08-26 11:57:57 +02:00
f5c25823bc Set version to 6.11.5 2019-08-23 08:40:10 +02:00
f00dfd7bfe Added fallbacks strlen_P, strncmp_P, strcmp_P and memcpy_P (fixes #1073) 2019-08-21 15:25:54 +02:00
dcca4214f5 Set version to 6.11.4 2019-08-12 15:10:56 +02:00
1e9cc285bb Added support for basic_string<char, traits, allocator> (closes #1045) 2019-08-12 14:21:45 +02:00
b9c4a0c5f6 Include Arduino.h if ARDUINO is defined (closes #1071) 2019-08-11 13:04:12 +02:00
0d339300f9 Added tests for Flash strings (closes #1070) 2019-08-11 11:39:21 +02:00
63d7d87080 Fixed example JsonConfigFile.ino for ESP8266 2019-08-10 14:17:23 +02:00
2ee655f9ba Fix clang installation on Travis 2019-08-10 12:22:17 +02:00
61a4195ed4 Added measureJson() to the ArduinoJson namespace (fixes #1069) 2019-08-10 11:15:11 +02:00
a6f029ded0 Set version to 6.11.3 2019-07-22 08:59:54 +02:00
b54de58e6b Fixed comparison of JsonVariant with mixed strings (closes #1051) 2019-07-19 12:15:16 +02:00
795e37278f Added operators == and != for MemberProxy 2019-07-19 10:27:03 +02:00
7ce1039d7c Added operators == and != for MemberProxy 2019-07-19 10:23:06 +02:00
aba42faf69 Added operators == and != for JsonDocument 2019-07-19 10:23:06 +02:00
815326d42e Set version to 6.11.2 2019-07-08 08:44:27 +02:00
7d40a541c9 Fix invalid conversion error on Particle Argon (closes #1035) 2019-07-01 09:07:16 +02:00
2507ee2e56 Fixed assignment of JsonDocument to JsonVariant (issue #1023) 2019-06-25 08:56:14 +02:00
a0a451195b Set version to 6.11.1 2019-06-21 08:49:02 +02:00
ce247a5637 Fixed serialized() not working with Flash strings (fixes #1030) 2019-06-21 08:46:32 +02:00
59f9c9747f Add sponsor button on GitHub 2019-06-04 09:14:37 +02:00
fec088e3ed Set version to 6.11.0 2019-05-26 21:11:40 +02:00
4980ee8fb9 Fixed unexpected HTTP/1.0 (closes #944) 2019-05-26 21:07:01 +02:00
2ed77d2cc3 Added support for nullptr (closes #998) 2019-05-26 11:31:51 +02:00
630107ae8a Removed implicit conversion in comparison operators (issue #998) 2019-05-23 21:54:42 +02:00
4eb8074358 Set ARDUINOJSON_ENABLE_NAN and ARDUINOJSON_ENABLE_INFINITY to 0 2019-05-19 17:46:20 +02:00
80a02cd90d Added ARDUINOJSON_ENABLE_INFINITY to enable Infinity in JSON 2019-05-19 15:48:27 +02:00
7427888e05 Added ARDUINOJSON_ENABLE_NAN to enable NaN in JSON (closes #973) 2019-05-18 12:15:36 +02:00
90c1d549a8 Made deserializeJson() more picky about trailing characters (closes #980) 2019-05-16 20:41:07 +02:00
2af003e4e2 Fixed deserializeJson() silently accepting a Stream* (issue #978) 2019-05-09 08:33:09 +02:00
eaf55e174b Fixed invalid result from operator| (closes #981) 2019-05-07 08:12:18 +02:00
361 changed files with 2872 additions and 1071 deletions

1
.github/FUNDING.yml vendored Normal file
View File

@ -0,0 +1 @@
custom: https://arduinojson.org/book/

6
.gitignore vendored
View File

@ -6,7 +6,7 @@
/sftp-config.json
.tags
.tags_sorted_by_file
/fuzzing/*_fuzzer
/fuzzing/*_fuzzer.options
/fuzzing/*_fuzzer_seed_corpus.zip
/extras/fuzzing/*_fuzzer
/extras/fuzzing/*_fuzzer.options
/extras/fuzzing/*_fuzzer_seed_corpus.zip
.vs/

View File

@ -84,12 +84,12 @@ matrix:
env: SCRIPT=test _CC=clang-4.0 _CXX=clang++-4.0
- addons:
apt:
sources: ['ubuntu-toolchain-r-test','llvm-toolchain-trusty-5.0']
sources: ['ubuntu-toolchain-r-test']
packages: ['clang-5.0']
env: SCRIPT=test _CC=clang-5.0 _CXX=clang++-5.0
- addons:
apt:
sources: ['ubuntu-toolchain-r-test','llvm-toolchain-trusty-6.0']
sources: ['ubuntu-toolchain-r-test']
packages: ['clang-6.0']
env: SCRIPT=test _CC=clang-6.0 _CXX=clang++-6.0
- addons:
@ -121,12 +121,12 @@ matrix:
- env: SCRIPT=platformio BOARD=esp01
- addons:
apt:
sources: ['ubuntu-toolchain-r-test','llvm-toolchain-trusty-6.0']
sources: ['ubuntu-toolchain-r-test']
packages: ['clang-6.0','llvm-6.0']
env: SCRIPT=fuzz CLANG=6.0
cache:
directories:
- "~/.platformio"
- "fuzzing/json_corpus"
- "fuzzing/msgpack_corpus"
script: scripts/travis/$SCRIPT.sh
- "extras/fuzzing/json_corpus"
- "extras/fuzzing/msgpack_corpus"
script: extras/ci/$SCRIPT.sh

View File

@ -1,6 +1,108 @@
ArduinoJson: change log
=======================
v6.13.0 (2019-11-01)
-------
* Added support for custom writer/reader classes (issue #1088)
* Added conversion from `JsonArray` and `JsonObject` to `bool`, to be consistent with `JsonVariant`
* Fixed `deserializeJson()` when input contains duplicate keys (issue #1095)
* Improved `deserializeMsgPack()` speed by reading several bytes at once
* Added detection of Atmel AVR8/GNU C Compiler (issue #1112)
* Fixed deserializer that stopped reading at the first `0xFF` (PR #1118 by @mikee47)
* Fixed dangling reference in copies of `MemberProxy` and `ElementProxy` (issue #1120)
v6.12.0 (2019-09-05)
-------
* Use absolute instead of relative includes (issue #1072)
* Changed `JsonVariant::as<bool>()` to return `true` for any non-null value (issue #1005)
* Moved ancillary files to `extras/` (issue #1011)
v6.11.5 (2019-08-23)
-------
* Added fallback implementations of `strlen_P()`, `strncmp_P()`, `strcmp_P()`, and `memcpy_P()` (issue #1073)
v6.11.4 (2019-08-12)
-------
* Added `measureJson()` to the `ArduinoJson` namespace (PR #1069 by @nomis)
* Added support for `basic_string<char, traits, allocator>` (issue #1045)
* Fixed example `JsonConfigFile.ino` for ESP8266
* Include `Arduino.h` if `ARDUINO` is defined (PR #1071 by @nomis)
v6.11.3 (2019-07-22)
-------
* Added operators `==` and `!=` for `JsonDocument`, `ElementProxy`, and `MemberProxy`
* Fixed comparison of `JsonVariant` when one contains a linked string and the other contains an owned string (issue #1051)
v6.11.2 (2019-07-08)
-------
* Fixed assignment of `JsonDocument` to `JsonVariant` (issue #1023)
* Fix invalid conversion error on Particle Argon (issue #1035)
v6.11.1 (2019-06-21)
-------
* Fixed `serialized()` not working with Flash strings (issue #1030)
v6.11.0 (2019-05-26)
-------
* Fixed `deserializeJson()` silently accepting a `Stream*` (issue #978)
* Fixed invalid result from `operator|` (issue #981)
* Made `deserializeJson()` more picky about trailing characters (issue #980)
* Added `ARDUINOJSON_ENABLE_NAN` (default=0) to enable NaN in JSON (issue #973)
* Added `ARDUINOJSON_ENABLE_INFINITY` (default=0) to enable Infinity in JSON
* Removed implicit conversion in comparison operators (issue #998)
* Added lexicographical comparison for `JsonVariant`
* Added support for `nullptr` (issue #998)
> ### BREAKING CHANGES
>
> #### NaN and Infinity
>
> The JSON specification allows neither NaN not Infinity, but previous
> versions of ArduinoJson supported it. Now, ArduinoJson behaves like most
> other libraries: a NaN or and Infinity in the `JsonDocument`, becomes
> a `null` in the output JSON. Also, `deserializeJson()` returns
> `InvalidInput` if the JSON document contains NaN or Infinity.
>
> This version still supports NaN and Infinity in JSON documents, but
> it's disabled by default to be compatible with other JSON parsers.
> If you need the old behavior back, define `ARDUINOJSON_ENABLE_NAN` and
> `ARDUINOJSON_ENABLE_INFINITY` to `1`;:
>
> ```c++
> #define ARDUINOJSON_ENABLE_NAN 1
> #define ARDUINOJSON_ENABLE_INFINITY 1
> #include <ArduinoJson.h>
> ```
>
> #### The "or" operator
>
> This version slightly changes the behavior of the | operator when the
> variant contains a float and the user requests an integer.
>
> Older versions returned the floating point value truncated.
> Now, it returns the default value.
>
> ```c++
> // suppose variant contains 1.2
> int value = variant | 3;
>
> // old behavior:
> value == 1
>
> // new behavior
> value == 3
> ```
>
> If you need the old behavior, you must add `if (variant.is<float>())`.
v6.10.1 (2019-04-23)
-------

View File

@ -17,6 +17,5 @@ if(${COVERAGE})
endif()
include_directories(${CMAKE_CURRENT_LIST_DIR}/src)
add_subdirectory(third-party/catch)
add_subdirectory(test)
add_subdirectory(fuzzing)
add_subdirectory(extras/tests)
add_subdirectory(extras/fuzzing)

View File

@ -2,11 +2,12 @@
---
[![arduino-library-badge](https://www.ardu-badge.com/badge/ArduinoJson.svg?version=6.10.1)](https://www.ardu-badge.com/ArduinoJson/6.10.1)
[![arduino-library-badge](https://www.ardu-badge.com/badge/ArduinoJson.svg?version=6.13.0)](https://www.ardu-badge.com/ArduinoJson/6.13.0)
[![Build Status](https://ci.appveyor.com/api/projects/status/m7s53wav1l0abssg/branch/6.x?svg=true)](https://ci.appveyor.com/project/bblanchon/arduinojson/branch/6.x)
[![Build Status](https://travis-ci.org/bblanchon/ArduinoJson.svg?branch=6.x)](https://travis-ci.org/bblanchon/ArduinoJson)
[![Fuzzing Status](https://oss-fuzz-build-logs.storage.googleapis.com/badges/arduinojson.svg)](https://bugs.chromium.org/p/oss-fuzz/issues/list?sort=-opened&can=1&q=proj:arduinojson)
[![Coverage Status](https://coveralls.io/repos/github/bblanchon/ArduinoJson/badge.svg?branch=6.x)](https://coveralls.io/github/bblanchon/ArduinoJson?branch=6.x)
[![Star this project](http://githubbadges.com/star.svg?user=bblanchon&repo=ArduinoJson&style=flat&color=fff&background=007ec6)](https://github.com/bblanchon/ArduinoJson)
[![GitHub stars](https://img.shields.io/github/stars/bblanchon/ArduinoJson?style=flat)](https://github.com/bblanchon/ArduinoJson/stargazers)
ArduinoJson is a C++ JSON library for Arduino and IoT (Internet Of Things).

View File

@ -1,4 +1,4 @@
version: 6.10.1.{build}
version: 6.13.0.{build}
environment:
matrix:
- APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2017
@ -17,4 +17,4 @@ before_build:
build_script:
- cmake --build . --config %CONFIGURATION%
test_script:
- ctest --output-on-failure .
- ctest -C %CONFIGURATION% --output-on-failure .

1
component.mk Normal file
View File

@ -0,0 +1 @@
COMPONENT_ADD_INCLUDEDIRS := src

View File

@ -11,6 +11,12 @@
// "port": 2731
// }
//
// To run this program, you need an SD card connected to the SPI bus as follows:
// * MOSI <-> pin 11
// * MISO <-> pin 12
// * CLK <-> pin 13
// * CS <-> pin 4
//
// https://arduinojson.org/v6/example/config/
#include <ArduinoJson.h>
@ -111,7 +117,8 @@ void setup() {
while (!Serial) continue;
// Initialize SD library
while (!SD.begin()) {
const int chipSelect = 4;
while (!SD.begin(chipSelect)) {
Serial.println(F("Failed to initialize SD library"));
delay(1000);
}

View File

@ -59,7 +59,8 @@ void setup() {
// Check HTTP status
char status[32] = {0};
client.readBytesUntil('\r', status, sizeof(status));
if (strcmp(status, "HTTP/1.1 200 OK") != 0) {
// It should be "HTTP/1.0 200 OK" or "HTTP/1.1 200 OK"
if (strcmp(status + 9, "200 OK") != 0) {
Serial.print(F("Unexpected response: "));
Serial.println(status);
return;

View File

@ -5,4 +5,5 @@ make
make test
pip install --user cpp-coveralls 'requests[security]'
coveralls --exclude third-party --gcov-options '\-lp'; fi
pwd
coveralls --include 'src' --gcov-options '\-lp'

View File

@ -2,7 +2,7 @@
ROOT_DIR=$(dirname $0)/../../
INCLUDE_DIR=${ROOT_DIR}/src/
FUZZING_DIR=${ROOT_DIR}/fuzzing/
FUZZING_DIR=${ROOT_DIR}/extras/fuzzing/
CXXFLAGS="-g -fprofile-instr-generate -fcoverage-mapping -fsanitize=address,undefined,fuzzer -fno-sanitize-recover=all"
fuzz() {

View File

@ -2,8 +2,6 @@
pip install --user platformio
rm -r test
case $BOARD in
uno)
platformio lib install 868 # SD library

View File

@ -1,6 +1,6 @@
# CAUTION: this file is invoked by https://github.com/google/oss-fuzz
CXXFLAGS += -I../src -DARDUINOJSON_DEBUG
CXXFLAGS += -I../../src -DARDUINOJSON_DEBUG
all: \
$(OUT)/json_fuzzer \
@ -10,7 +10,7 @@ all: \
$(OUT)/msgpack_fuzzer_seed_corpus.zip \
$(OUT)/msgpack_fuzzer.options
$(OUT)/%_fuzzer: %_fuzzer.cpp $(shell find ../src -type f)
$(OUT)/%_fuzzer: %_fuzzer.cpp $(shell find ../../src -type f)
$(CXX) $(CXXFLAGS) $< -o$@ $(LIB_FUZZING_ENGINE)
$(OUT)/%_fuzzer_seed_corpus.zip: %_seed_corpus/*

View File

@ -3,7 +3,7 @@
TAG=$(git describe)
OUTPUT="ArduinoJson-$TAG.zip"
cd $(dirname $0)/../..
cd $(dirname $0)/../../..
# remove existing file
rm -f $OUTPUT

View File

@ -0,0 +1,81 @@
#!/bin/bash
set -e
TAG=$(git describe)
RE_RELATIVE_INCLUDE='^#include[[:space:]]*"(.*)"'
RE_ABSOLUTE_INCLUDE='^#include[[:space:]]*<(ArduinoJson/.*)>'
RE_SYSTEM_INCLUDE='^#include[[:space:]]*<(.*)>'
RE_EMPTY='^(#pragma[[:space:]]+once)?[[:space:]]*(//.*)?$'
SRC_DIRECTORY="$(realpath "$(dirname $0)/../../src")"
declare -A INCLUDED
process()
{
local PARENT=$1
local FOLDER=$(dirname $1)
local SHOW_COMMENT=$2
while IFS= read -r LINE; do
if [[ $LINE =~ $RE_ABSOLUTE_INCLUDE ]]; then
local CHILD=${BASH_REMATCH[1]}
local CHILD_PATH
CHILD_PATH=$(realpath "$SRC_DIRECTORY/$CHILD")
echo "$PARENT -> $CHILD" >&2
if [[ ! ${INCLUDED[$CHILD_PATH]} ]]; then
INCLUDED[$CHILD_PATH]=true
process "$CHILD" false
fi
elif [[ $LINE =~ $RE_RELATIVE_INCLUDE ]]; then
local CHILD=${BASH_REMATCH[1]}
pushd "$FOLDER" > /dev/null
local CHILD_PATH
CHILD_PATH=$(realpath "$CHILD")
echo "$PARENT -> $CHILD" >&2
if [[ ! ${INCLUDED[$CHILD_PATH]} ]]; then
INCLUDED[$CHILD_PATH]=true
process "$CHILD" false
fi
popd > /dev/null
elif [[ $LINE =~ $RE_SYSTEM_INCLUDE ]]; then
local CHILD=${BASH_REMATCH[1]}
echo "$PARENT -> <$CHILD>" >&2
if [[ ! ${INCLUDED[$CHILD]} ]]; then
echo "#include <$CHILD>"
INCLUDED[$CHILD]=true
fi
elif [[ "${SHOW_COMMENT}" = "true" ]] ; then
echo "$LINE"
elif [[ ! $LINE =~ $RE_EMPTY ]]; then
echo "$LINE"
fi
done < $PARENT
}
simplify_namespaces() {
perl -p0i -e 's|\} // namespace ARDUINOJSON_NAMESPACE\r?\nnamespace ARDUINOJSON_NAMESPACE \{\r?\n||igs' "$1"
}
cd $(dirname $0)/../..
INCLUDED=()
process src/ArduinoJson.h true > ../ArduinoJson-$TAG.h
simplify_namespaces ../ArduinoJson-$TAG.h
g++ -x c++ -c -o ../smoketest.o - <<END
#include "../ArduinoJson-$TAG.h"
int main() {
StaticJsonDocument<300> doc;
deserializeJson(doc, "{}");
}
END
INCLUDED=()
process src/ArduinoJson.hpp true > ../ArduinoJson-$TAG.hpp
simplify_namespaces ../ArduinoJson-$TAG.hpp
g++ -x c++ -c -o ../smoketest.o - <<END
#include "../ArduinoJson-$TAG.hpp"
int main() {
ArduinoJson::StaticJsonDocument<300> doc;
ArduinoJson::deserializeJson(doc, "{}");
}
END

View File

@ -2,7 +2,7 @@
export PATH="$PATH:/Applications/CMake.app/Contents/bin/"
cd $(dirname $0)/..
cd $(dirname $0)/../..
ROOT=$(pwd)
mkdir "build"

View File

@ -2,7 +2,7 @@
set -eu
SOURCE_DIR="$(dirname "$0")/.."
SOURCE_DIR="$(dirname "$0")/../.."
WORK_DIR=$(mktemp -d)
trap 'rm -rf "$WORK_DIR"' EXIT

8
scripts/publish.sh → extras/scripts/publish.sh Normal file → Executable file
View File

@ -2,7 +2,7 @@
set -eu
cd "$(dirname "$0")/.."
cd "$(dirname "$0")/../.."
VERSION="$1"
DATE=$(date +%F)
@ -56,6 +56,6 @@ commit_new_version
add_tag
push
scripts/build-arduino-package.sh
scripts/build-single-header.sh
scripts/wandbox/publish.sh "../ArduinoJson-$TAG.h"
extras/scripts/build-arduino-package.sh
extras/scripts/build-single-header.sh
extras/scripts/wandbox/publish.sh "../ArduinoJson-$TAG.h"

View File

View File

@ -2,6 +2,8 @@
# Copyright Benoit Blanchon 2014-2019
# MIT License
add_subdirectory(catch)
if(CMAKE_CXX_COMPILER_ID MATCHES "(GNU|Clang)")
add_compile_options(
-pedantic
@ -70,6 +72,7 @@ if(MSVC)
)
endif()
include_directories(Helpers)
add_subdirectory(ElementProxy)
add_subdirectory(IntegrationTests)
add_subdirectory(JsonArray)

View File

@ -5,6 +5,7 @@
add_executable(ElementProxyTests
add.cpp
clear.cpp
compare.cpp
remove.cpp
set.cpp
size.cpp

View File

@ -0,0 +1,28 @@
// ArduinoJson - arduinojson.org
// Copyright Benoit Blanchon 2014-2019
// MIT License
#include <ArduinoJson.h>
#include <catch.hpp>
using namespace ARDUINOJSON_NAMESPACE;
TEST_CASE("ElementProxy::operator==()") {
DynamicJsonDocument doc(4096);
SECTION("same value") {
doc.add(1);
doc.add(1);
REQUIRE(doc[0] == doc[1]);
REQUIRE_FALSE(doc[0] != doc[1]);
}
SECTION("different values") {
doc.add(1);
doc.add(2);
REQUIRE_FALSE(doc[0] == doc[1]);
REQUIRE(doc[0] != doc[1]);
}
}

View File

@ -0,0 +1,26 @@
// ArduinoJson - arduinojson.org
// Copyright Benoit Blanchon 2014-2019
// MIT License
#pragma once
#include <sstream>
class CustomReader {
std::stringstream _stream;
public:
CustomReader(const char* input) : _stream(input) {}
int read() {
return _stream.get();
}
size_t readBytes(char* buffer, size_t length) {
_stream.read(buffer, static_cast<std::streamsize>(length));
return static_cast<size_t>(_stream.gcount());
}
private:
CustomReader(const CustomReader&);
};

View File

@ -0,0 +1,14 @@
// ArduinoJson - arduinojson.org
// Copyright Benoit Blanchon 2014-2019
// MIT License
#pragma once
// Reproduces Arduino's Stream class
class Stream // : public Print
{
public:
virtual ~Stream() {}
virtual int read() = 0;
virtual size_t readBytes(char *buffer, size_t length) = 0;
};

View File

@ -0,0 +1,58 @@
// ArduinoJson - arduinojson.org
// Copyright Benoit Blanchon 2014-2019
// MIT License
#include <ArduinoJson.h>
#include <catch.hpp>
TEST_CASE("JsonArray::isNull()") {
SECTION("returns true") {
JsonArray arr;
REQUIRE(arr.isNull() == true);
}
SECTION("returns false") {
DynamicJsonDocument doc(4096);
JsonArray arr = doc.to<JsonArray>();
REQUIRE(arr.isNull() == false);
}
}
TEST_CASE("JsonArrayConst::isNull()") {
SECTION("returns true") {
JsonArrayConst arr;
REQUIRE(arr.isNull() == true);
}
SECTION("returns false") {
DynamicJsonDocument doc(4096);
JsonArrayConst arr = doc.to<JsonArray>();
REQUIRE(arr.isNull() == false);
}
}
TEST_CASE("JsonArray::operator bool()") {
SECTION("returns false") {
JsonArray arr;
REQUIRE(static_cast<bool>(arr) == false);
}
SECTION("returns true") {
DynamicJsonDocument doc(4096);
JsonArray arr = doc.to<JsonArray>();
REQUIRE(static_cast<bool>(arr) == true);
}
}
TEST_CASE("JsonArrayConst::operator bool()") {
SECTION("returns false") {
JsonArrayConst arr;
REQUIRE(static_cast<bool>(arr) == false);
}
SECTION("returns true") {
DynamicJsonDocument doc(4096);
JsonArrayConst arr = doc.to<JsonArray>();
REQUIRE(static_cast<bool>(arr) == true);
}
}

Some files were not shown because too many files have changed in this diff Show More