├── .gitattributes
├── Dual_MAX30102_Test
└── Dual_MAX30102_Test.ino
├── HEGduino_V0
├── BLE_API.h
├── HEGduino_V0.h
├── HEGduino_V0.ino
├── IIRfilter.h
├── WiFi_API.h
└── webDemo
│ ├── HEGwebAPI.h
│ ├── api.h
│ ├── connect.h
│ ├── help.h
│ ├── index.h
│ ├── initWebapp.h
│ ├── sc.h
│ ├── threeApp.h
│ ├── update.h
│ ├── webDemo.h
│ ├── webDemoCSS.h
│ └── ws.h
├── LICENSE
├── README.md
├── ambientresult.PNG
├── hegresult.PNG
├── libraries
├── ArduinoJson
│ ├── ArduinoJson.h
│ ├── CHANGELOG.md
│ ├── CMakeLists.txt
│ ├── CONTRIBUTING.md
│ ├── LICENSE.md
│ ├── README.md
│ ├── SUPPORT.md
│ ├── appveyor.yml
│ ├── banner.svg
│ ├── component.mk
│ ├── examples
│ │ ├── JsonConfigFile
│ │ │ └── JsonConfigFile.ino
│ │ ├── JsonFilterExample
│ │ │ └── JsonFilterExample.ino
│ │ ├── JsonGeneratorExample
│ │ │ └── JsonGeneratorExample.ino
│ │ ├── JsonHttpClient
│ │ │ └── JsonHttpClient.ino
│ │ ├── JsonParserExample
│ │ │ └── JsonParserExample.ino
│ │ ├── JsonServer
│ │ │ └── JsonServer.ino
│ │ ├── JsonUdpBeacon
│ │ │ └── JsonUdpBeacon.ino
│ │ ├── MsgPackParser
│ │ │ └── MsgPackParser.ino
│ │ ├── ProgmemExample
│ │ │ └── ProgmemExample.ino
│ │ └── StringExample
│ │ │ └── StringExample.ino
│ ├── extras
│ │ ├── ArduinoJsonConfig.cmake.in
│ │ ├── ci
│ │ │ ├── arduino.sh
│ │ │ ├── build.sh
│ │ │ ├── coverage.sh
│ │ │ ├── fuzz.sh
│ │ │ ├── platformio.sh
│ │ │ └── test.sh
│ │ ├── fuzzing
│ │ │ ├── CMakeLists.txt
│ │ │ ├── Makefile
│ │ │ ├── fuzzer_main.cpp
│ │ │ ├── json_fuzzer.cpp
│ │ │ ├── json_seed_corpus
│ │ │ │ ├── Comments.json
│ │ │ │ ├── EmptyArray.json
│ │ │ │ ├── EmptyObject.json
│ │ │ │ ├── ExcessiveNesting.json
│ │ │ │ ├── IntegerOverflow.json
│ │ │ │ ├── Numbers.json
│ │ │ │ ├── OpenWeatherMap.json
│ │ │ │ ├── Strings.json
│ │ │ │ └── WeatherUnderground.json
│ │ │ ├── msgpack_fuzzer.cpp
│ │ │ └── msgpack_seed_corpus
│ │ │ │ ├── array16
│ │ │ │ ├── array32
│ │ │ │ ├── false
│ │ │ │ ├── fixarray
│ │ │ │ ├── fixint_negative
│ │ │ │ ├── fixint_positive
│ │ │ │ ├── fixmap
│ │ │ │ ├── fixstr
│ │ │ │ ├── float32
│ │ │ │ ├── float64
│ │ │ │ ├── int16
│ │ │ │ ├── int32
│ │ │ │ ├── int64
│ │ │ │ ├── int8
│ │ │ │ ├── map16
│ │ │ │ ├── map32
│ │ │ │ ├── nil
│ │ │ │ ├── str16
│ │ │ │ ├── str32
│ │ │ │ ├── str8
│ │ │ │ ├── true
│ │ │ │ ├── uint16
│ │ │ │ ├── uint32
│ │ │ │ ├── uint64
│ │ │ │ └── uint8
│ │ ├── scripts
│ │ │ ├── build-arduino-package.sh
│ │ │ ├── build-single-header.sh
│ │ │ ├── create-build-envs.sh
│ │ │ ├── publish-particle-library.sh
│ │ │ ├── publish.sh
│ │ │ └── wandbox
│ │ │ │ ├── JsonGeneratorExample.cpp
│ │ │ │ ├── JsonParserExample.cpp
│ │ │ │ ├── MsgPackParserExample.cpp
│ │ │ │ └── publish.sh
│ │ └── tests
│ │ │ ├── CMakeLists.txt
│ │ │ ├── ElementProxy
│ │ │ ├── CMakeLists.txt
│ │ │ ├── add.cpp
│ │ │ ├── clear.cpp
│ │ │ ├── compare.cpp
│ │ │ ├── remove.cpp
│ │ │ ├── set.cpp
│ │ │ ├── size.cpp
│ │ │ └── subscript.cpp
│ │ │ ├── Helpers
│ │ │ ├── CustomReader.hpp
│ │ │ ├── Stream.h
│ │ │ ├── WString.h
│ │ │ └── progmem_emulation.hpp
│ │ │ ├── IntegrationTests
│ │ │ ├── CMakeLists.txt
│ │ │ ├── gbathree.cpp
│ │ │ ├── issue772.cpp
│ │ │ ├── openweathermap.cpp
│ │ │ └── round_trip.cpp
│ │ │ ├── JsonArray
│ │ │ ├── CMakeLists.txt
│ │ │ ├── add.cpp
│ │ │ ├── copyArray.cpp
│ │ │ ├── createNested.cpp
│ │ │ ├── equals.cpp
│ │ │ ├── get.cpp
│ │ │ ├── isNull.cpp
│ │ │ ├── iterator.cpp
│ │ │ ├── memoryUsage.cpp
│ │ │ ├── nesting.cpp
│ │ │ ├── remove.cpp
│ │ │ ├── size.cpp
│ │ │ ├── std_string.cpp
│ │ │ ├── subscript.cpp
│ │ │ └── undefined.cpp
│ │ │ ├── JsonDeserializer
│ │ │ ├── CMakeLists.txt
│ │ │ ├── DeserializationError.cpp
│ │ │ ├── array.cpp
│ │ │ ├── array_static.cpp
│ │ │ ├── filter.cpp
│ │ │ ├── incomplete_input.cpp
│ │ │ ├── input_types.cpp
│ │ │ ├── invalid_input.cpp
│ │ │ ├── misc.cpp
│ │ │ ├── nestingLimit.cpp
│ │ │ ├── number.cpp
│ │ │ ├── object.cpp
│ │ │ ├── object_static.cpp
│ │ │ └── string.cpp
│ │ │ ├── JsonDocument
│ │ │ ├── BasicJsonDocument.cpp
│ │ │ ├── CMakeLists.txt
│ │ │ ├── DynamicJsonDocument.cpp
│ │ │ ├── StaticJsonDocument.cpp
│ │ │ ├── add.cpp
│ │ │ ├── compare.cpp
│ │ │ ├── containsKey.cpp
│ │ │ ├── createNested.cpp
│ │ │ ├── isNull.cpp
│ │ │ ├── nesting.cpp
│ │ │ ├── remove.cpp
│ │ │ ├── shrinkToFit.cpp
│ │ │ ├── size.cpp
│ │ │ └── subscript.cpp
│ │ │ ├── JsonObject
│ │ │ ├── CMakeLists.txt
│ │ │ ├── containsKey.cpp
│ │ │ ├── copy.cpp
│ │ │ ├── createNestedArray.cpp
│ │ │ ├── createNestedObject.cpp
│ │ │ ├── equals.cpp
│ │ │ ├── invalid.cpp
│ │ │ ├── isNull.cpp
│ │ │ ├── iterator.cpp
│ │ │ ├── memoryUsage.cpp
│ │ │ ├── nesting.cpp
│ │ │ ├── remove.cpp
│ │ │ ├── size.cpp
│ │ │ ├── std_string.cpp
│ │ │ └── subscript.cpp
│ │ │ ├── JsonSerializer
│ │ │ ├── CMakeLists.txt
│ │ │ ├── CustomWriter.cpp
│ │ │ ├── JsonArray.cpp
│ │ │ ├── JsonArrayPretty.cpp
│ │ │ ├── JsonObject.cpp
│ │ │ ├── JsonObjectPretty.cpp
│ │ │ ├── JsonVariant.cpp
│ │ │ ├── misc.cpp
│ │ │ ├── std_stream.cpp
│ │ │ └── std_string.cpp
│ │ │ ├── JsonVariant
│ │ │ ├── CMakeLists.txt
│ │ │ ├── add.cpp
│ │ │ ├── as.cpp
│ │ │ ├── clear.cpp
│ │ │ ├── compare.cpp
│ │ │ ├── containsKey.cpp
│ │ │ ├── copy.cpp
│ │ │ ├── createNested.cpp
│ │ │ ├── is.cpp
│ │ │ ├── isnull.cpp
│ │ │ ├── memoryUsage.cpp
│ │ │ ├── misc.cpp
│ │ │ ├── nesting.cpp
│ │ │ ├── or.cpp
│ │ │ ├── overflow.cpp
│ │ │ ├── remove.cpp
│ │ │ ├── set.cpp
│ │ │ ├── subscript.cpp
│ │ │ ├── types.cpp
│ │ │ └── undefined.cpp
│ │ │ ├── MemberProxy
│ │ │ ├── CMakeLists.txt
│ │ │ ├── add.cpp
│ │ │ ├── clear.cpp
│ │ │ ├── compare.cpp
│ │ │ ├── containsKey.cpp
│ │ │ ├── remove.cpp
│ │ │ ├── set.cpp
│ │ │ ├── size.cpp
│ │ │ └── subscript.cpp
│ │ │ ├── MemoryPool
│ │ │ ├── CMakeLists.txt
│ │ │ ├── StringBuilder.cpp
│ │ │ ├── allocString.cpp
│ │ │ ├── allocVariant.cpp
│ │ │ ├── clear.cpp
│ │ │ └── size.cpp
│ │ │ ├── Misc
│ │ │ ├── CMakeLists.txt
│ │ │ ├── FloatParts.cpp
│ │ │ ├── Issue1189.cpp
│ │ │ ├── Issue978.cpp
│ │ │ ├── Readers.cpp
│ │ │ ├── StringAdapters.cpp
│ │ │ ├── StringWriter.cpp
│ │ │ ├── TypeTraits.cpp
│ │ │ ├── Utf16.cpp
│ │ │ ├── Utf8.cpp
│ │ │ ├── conflicts.cpp
│ │ │ ├── custom_string.hpp
│ │ │ ├── unsigned_char.cpp
│ │ │ ├── version.cpp
│ │ │ └── weird_strcmp.hpp
│ │ │ ├── MixedConfiguration
│ │ │ ├── CMakeLists.txt
│ │ │ ├── cpp11.cpp
│ │ │ ├── decode_unicode_0.cpp
│ │ │ ├── decode_unicode_1.cpp
│ │ │ ├── enable_alignment_0.cpp
│ │ │ ├── enable_alignment_1.cpp
│ │ │ ├── enable_comments_0.cpp
│ │ │ ├── enable_comments_1.cpp
│ │ │ ├── enable_infinity_0.cpp
│ │ │ ├── enable_infinity_1.cpp
│ │ │ ├── enable_nan_0.cpp
│ │ │ ├── enable_nan_1.cpp
│ │ │ ├── enable_progmem_1.cpp
│ │ │ ├── use_double_0.cpp
│ │ │ ├── use_double_1.cpp
│ │ │ ├── use_long_long_0.cpp
│ │ │ └── use_long_long_1.cpp
│ │ │ ├── MsgPackDeserializer
│ │ │ ├── CMakeLists.txt
│ │ │ ├── deserializeArray.cpp
│ │ │ ├── deserializeObject.cpp
│ │ │ ├── deserializeStaticVariant.cpp
│ │ │ ├── deserializeVariant.cpp
│ │ │ ├── doubleToFloat.cpp
│ │ │ ├── incompleteInput.cpp
│ │ │ ├── input_types.cpp
│ │ │ ├── nestingLimit.cpp
│ │ │ └── notSupported.cpp
│ │ │ ├── MsgPackSerializer
│ │ │ ├── CMakeLists.txt
│ │ │ ├── destination_types.cpp
│ │ │ ├── measure.cpp
│ │ │ ├── misc.cpp
│ │ │ ├── serializeArray.cpp
│ │ │ ├── serializeObject.cpp
│ │ │ └── serializeVariant.cpp
│ │ │ ├── Numbers
│ │ │ ├── CMakeLists.txt
│ │ │ ├── parseFloat.cpp
│ │ │ ├── parseInteger.cpp
│ │ │ └── parseNumber.cpp
│ │ │ ├── TextFormatter
│ │ │ ├── CMakeLists.txt
│ │ │ ├── writeFloat.cpp
│ │ │ └── writeString.cpp
│ │ │ └── catch
│ │ │ ├── CMakeLists.txt
│ │ │ ├── catch.cpp
│ │ │ └── catch.hpp
│ ├── keywords.txt
│ ├── library.json
│ ├── library.properties
│ └── src
│ │ ├── ArduinoJson.h
│ │ ├── ArduinoJson.hpp
│ │ ├── ArduinoJson
│ │ ├── Array
│ │ │ ├── ArrayFunctions.hpp
│ │ │ ├── ArrayImpl.hpp
│ │ │ ├── ArrayIterator.hpp
│ │ │ ├── ArrayRef.hpp
│ │ │ ├── ArrayShortcuts.hpp
│ │ │ ├── ElementProxy.hpp
│ │ │ └── Utilities.hpp
│ │ ├── Collection
│ │ │ ├── CollectionData.hpp
│ │ │ └── CollectionImpl.hpp
│ │ ├── Configuration.hpp
│ │ ├── Deserialization
│ │ │ ├── DeserializationError.hpp
│ │ │ ├── Filter.hpp
│ │ │ ├── NestingLimit.hpp
│ │ │ ├── Reader.hpp
│ │ │ ├── Readers
│ │ │ │ ├── ArduinoStreamReader.hpp
│ │ │ │ ├── ArduinoStringReader.hpp
│ │ │ │ ├── FlashReader.hpp
│ │ │ │ ├── IteratorReader.hpp
│ │ │ │ ├── RamReader.hpp
│ │ │ │ └── StdStreamReader.hpp
│ │ │ └── deserialize.hpp
│ │ ├── Document
│ │ │ ├── BasicJsonDocument.hpp
│ │ │ ├── DynamicJsonDocument.hpp
│ │ │ ├── JsonDocument.hpp
│ │ │ └── StaticJsonDocument.hpp
│ │ ├── Json
│ │ │ ├── EscapeSequence.hpp
│ │ │ ├── JsonDeserializer.hpp
│ │ │ ├── JsonSerializer.hpp
│ │ │ ├── Latch.hpp
│ │ │ ├── PrettyJsonSerializer.hpp
│ │ │ ├── TextFormatter.hpp
│ │ │ ├── Utf16.hpp
│ │ │ └── Utf8.hpp
│ │ ├── Memory
│ │ │ ├── Alignment.hpp
│ │ │ ├── MemoryPool.hpp
│ │ │ ├── StringBuilder.hpp
│ │ │ └── StringSlot.hpp
│ │ ├── Misc
│ │ │ ├── SerializedValue.hpp
│ │ │ └── Visitable.hpp
│ │ ├── MsgPack
│ │ │ ├── MsgPackDeserializer.hpp
│ │ │ ├── MsgPackSerializer.hpp
│ │ │ ├── endianess.hpp
│ │ │ └── ieee754.hpp
│ │ ├── Namespace.hpp
│ │ ├── Numbers
│ │ │ ├── Float.hpp
│ │ │ ├── FloatParts.hpp
│ │ │ ├── FloatTraits.hpp
│ │ │ ├── Integer.hpp
│ │ │ ├── convertNumber.hpp
│ │ │ ├── parseFloat.hpp
│ │ │ ├── parseInteger.hpp
│ │ │ └── parseNumber.hpp
│ │ ├── Object
│ │ │ ├── MemberProxy.hpp
│ │ │ ├── ObjectFunctions.hpp
│ │ │ ├── ObjectImpl.hpp
│ │ │ ├── ObjectIterator.hpp
│ │ │ ├── ObjectRef.hpp
│ │ │ ├── ObjectShortcuts.hpp
│ │ │ └── Pair.hpp
│ │ ├── Operators
│ │ │ ├── VariantComparisons.hpp
│ │ │ ├── VariantOperators.hpp
│ │ │ ├── VariantOr.hpp
│ │ │ └── VariantShortcuts.hpp
│ │ ├── Polyfills
│ │ │ ├── alias_cast.hpp
│ │ │ ├── assert.hpp
│ │ │ ├── attributes.hpp
│ │ │ ├── ctype.hpp
│ │ │ ├── gsl
│ │ │ │ └── not_null.hpp
│ │ │ ├── limits.hpp
│ │ │ ├── math.hpp
│ │ │ ├── mpl
│ │ │ │ └── max.hpp
│ │ │ ├── pgmspace.hpp
│ │ │ ├── safe_strcmp.hpp
│ │ │ ├── type_traits.hpp
│ │ │ ├── type_traits
│ │ │ │ ├── conditional.hpp
│ │ │ │ ├── declval.hpp
│ │ │ │ ├── enable_if.hpp
│ │ │ │ ├── integral_constant.hpp
│ │ │ │ ├── is_array.hpp
│ │ │ │ ├── is_base_of.hpp
│ │ │ │ ├── is_class.hpp
│ │ │ │ ├── is_const.hpp
│ │ │ │ ├── is_convertible.hpp
│ │ │ │ ├── is_enum.hpp
│ │ │ │ ├── is_floating_point.hpp
│ │ │ │ ├── is_integral.hpp
│ │ │ │ ├── is_same.hpp
│ │ │ │ ├── is_signed.hpp
│ │ │ │ ├── is_unsigned.hpp
│ │ │ │ ├── make_unsigned.hpp
│ │ │ │ ├── remove_const.hpp
│ │ │ │ ├── remove_reference.hpp
│ │ │ │ └── type_identity.hpp
│ │ │ └── utility.hpp
│ │ ├── Serialization
│ │ │ ├── Writer.hpp
│ │ │ ├── Writers
│ │ │ │ ├── ArduinoStringWriter.hpp
│ │ │ │ ├── DummyWriter.hpp
│ │ │ │ ├── PrintWriter.hpp
│ │ │ │ ├── StaticStringWriter.hpp
│ │ │ │ ├── StdStreamWriter.hpp
│ │ │ │ └── StdStringWriter.hpp
│ │ │ ├── measure.hpp
│ │ │ └── serialize.hpp
│ │ ├── StringStorage
│ │ │ ├── StringCopier.hpp
│ │ │ ├── StringMover.hpp
│ │ │ └── StringStorage.hpp
│ │ ├── Strings
│ │ │ ├── ArduinoStringAdapter.hpp
│ │ │ ├── ConstRamStringAdapter.hpp
│ │ │ ├── FlashStringAdapter.hpp
│ │ │ ├── IsString.hpp
│ │ │ ├── IsWriteableString.hpp
│ │ │ ├── RamStringAdapter.hpp
│ │ │ ├── SizedFlashStringAdapter.hpp
│ │ │ ├── SizedRamStringAdapter.hpp
│ │ │ ├── StlStringAdapter.hpp
│ │ │ ├── StoragePolicy.hpp
│ │ │ ├── String.hpp
│ │ │ └── StringAdapters.hpp
│ │ ├── Variant
│ │ │ ├── SlotFunctions.hpp
│ │ │ ├── VariantAs.hpp
│ │ │ ├── VariantAsImpl.hpp
│ │ │ ├── VariantContent.hpp
│ │ │ ├── VariantData.hpp
│ │ │ ├── VariantFunctions.hpp
│ │ │ ├── VariantImpl.hpp
│ │ │ ├── VariantRef.hpp
│ │ │ ├── VariantSlot.hpp
│ │ │ └── VariantTo.hpp
│ │ ├── compatibility.hpp
│ │ └── version.hpp
│ │ └── CMakeLists.txt
├── AsyncTCP-master
│ ├── .github
│ │ ├── scripts
│ │ │ ├── install-arduino-core-esp32.sh
│ │ │ ├── install-arduino-ide.sh
│ │ │ ├── install-platformio.sh
│ │ │ └── on-push.sh
│ │ ├── stale.yml
│ │ └── workflows
│ │ │ └── push.yml
│ ├── .gitignore
│ ├── .travis.yml
│ ├── CMakeLists.txt
│ ├── Kconfig.projbuild
│ ├── LICENSE
│ ├── README.md
│ ├── component.mk
│ ├── library.json
│ ├── library.properties
│ └── src
│ │ ├── AsyncTCP.cpp
│ │ └── AsyncTCP.h
├── CircularBuffer
│ ├── CircularBuffer.h
│ ├── CircularBuffer.tpp
│ ├── LICENSE
│ ├── README.md
│ ├── examples
│ │ ├── CircularBuffer
│ │ │ └── CircularBuffer.ino
│ │ ├── EventLogging
│ │ │ └── EventLogging.ino
│ │ ├── Interrupts
│ │ │ └── Interrupts.ino
│ │ ├── Object
│ │ │ ├── Object.ino
│ │ │ └── Record.h
│ │ ├── Queue
│ │ │ └── Queue.ino
│ │ ├── Stack
│ │ │ └── Stack.ino
│ │ ├── Struct
│ │ │ └── Struct.ino
│ │ └── Test
│ │ │ └── Test.ino
│ ├── keywords.txt
│ └── library.properties
├── ESPAsyncWebServer-master
│ ├── .github
│ │ ├── scripts
│ │ │ ├── install-arduino-core-esp32.sh
│ │ │ ├── install-arduino-core-esp8266.sh
│ │ │ ├── install-arduino-ide.sh
│ │ │ ├── install-platformio.sh
│ │ │ └── on-push.sh
│ │ ├── stale.yml
│ │ └── workflows
│ │ │ └── push.yml
│ ├── .gitignore
│ ├── .travis.yml
│ ├── CMakeLists.txt
│ ├── README.md
│ ├── _config.yml
│ ├── component.mk
│ ├── examples
│ │ ├── CaptivePortal
│ │ │ └── CaptivePortal.ino
│ │ ├── ESP_AsyncFSBrowser
│ │ │ ├── ESP_AsyncFSBrowser.ino
│ │ │ └── data
│ │ │ │ ├── .exclude.files
│ │ │ │ ├── ace.js.gz
│ │ │ │ ├── ext-searchbox.js.gz
│ │ │ │ ├── favicon.ico
│ │ │ │ ├── index.htm
│ │ │ │ ├── mode-css.js.gz
│ │ │ │ ├── mode-html.js.gz
│ │ │ │ ├── mode-javascript.js.gz
│ │ │ │ └── worker-html.js.gz
│ │ ├── regex_patterns
│ │ │ ├── .test.build_flags
│ │ │ └── regex_patterns.ino
│ │ └── simple_server
│ │ │ └── simple_server.ino
│ ├── keywords.txt
│ ├── library.json
│ ├── library.properties
│ └── src
│ │ ├── AsyncEventSource.cpp
│ │ ├── AsyncEventSource.h
│ │ ├── AsyncJson.h
│ │ ├── AsyncWebSocket.cpp
│ │ ├── AsyncWebSocket.h
│ │ ├── AsyncWebSynchronization.h
│ │ ├── ESPAsyncWebServer.h
│ │ ├── SPIFFSEditor.cpp
│ │ ├── SPIFFSEditor.h
│ │ ├── StringArray.h
│ │ ├── WebAuthentication.cpp
│ │ ├── WebAuthentication.h
│ │ ├── WebHandlerImpl.h
│ │ ├── WebHandlers.cpp
│ │ ├── WebRequest.cpp
│ │ ├── WebResponseImpl.h
│ │ ├── WebResponses.cpp
│ │ ├── WebServer.cpp
│ │ └── edit.htm
└── SparkFun_MAX3010x_Pulse_and_Proximity_Sensor_Library
│ ├── LICENSE.md
│ ├── README.md
│ ├── examples
│ ├── Example1_Basic_Readings
│ │ └── Example1_Basic_Readings.ino
│ ├── Example2_Presence_Sensing
│ │ └── Example2_Presence_Sensing.ino
│ ├── Example3_Temperature_Sense
│ │ └── Example3_Temperature_Sense.ino
│ ├── Example4_HeartBeat_Plotter
│ │ └── Example4_HeartBeat_Plotter.ino
│ ├── Example5_HeartRate
│ │ ├── Example5_HeartRate.ino
│ │ └── License.ino
│ ├── Example6_FIFO_Readings
│ │ └── Example6_FIFO_Readings.ino
│ ├── Example7_Basic_Readings_Interrupts
│ │ └── Example7_Basic_Readings_Interrupts.ino
│ ├── Example8_SPO2
│ │ ├── Example8_SPO2.ino
│ │ └── License.ino
│ └── Example9_RateTesting
│ │ └── Example9_RateTesting.ino
│ ├── extras
│ ├── HeartBeat.jpg
│ └── HeartBeat1.jpg
│ ├── keywords.txt
│ ├── library.properties
│ └── src
│ ├── MAX30105.cpp
│ ├── MAX30105.h
│ ├── heartRate.cpp
│ ├── heartRate.h
│ ├── spo2_algorithm.cpp
│ └── spo2_algorithm.h
├── outofsync.PNG
├── ppg2_1600.PNG
├── ppg2results.png
└── wiring.jpg
/.gitattributes:
--------------------------------------------------------------------------------
1 | # Auto detect text files and perform LF normalization
2 | * text=auto
3 |
--------------------------------------------------------------------------------
/HEGduino_V0/webDemo/api.h:
--------------------------------------------------------------------------------
1 | const char api[] PROGMEM = R"=====(
2 |
3 |
4 |
5 |
6 |
7 | )=====";
--------------------------------------------------------------------------------
/HEGduino_V0/webDemo/webDemo.h:
--------------------------------------------------------------------------------
1 | const char event_page[] PROGMEM = R"=====(
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 | HEG Interface
10 |
13 |
14 |
15 |
16 |
17 |
18 |
19 | )=====";
20 |
--------------------------------------------------------------------------------
/ambientresult.PNG:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/joshbrew/HEGduino_V0/58c232c436a18e4c70886616d500de1482cec2e7/ambientresult.PNG
--------------------------------------------------------------------------------
/hegresult.PNG:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/joshbrew/HEGduino_V0/58c232c436a18e4c70886616d500de1482cec2e7/hegresult.PNG
--------------------------------------------------------------------------------
/libraries/ArduinoJson/ArduinoJson.h:
--------------------------------------------------------------------------------
1 | // ArduinoJson - arduinojson.org
2 | // Copyright Benoit Blanchon 2014-2020
3 | // MIT License
4 |
5 | #include "src/ArduinoJson.h"
6 |
--------------------------------------------------------------------------------
/libraries/ArduinoJson/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | # ArduinoJson - arduinojson.org
2 | # Copyright Benoit Blanchon 2014-2020
3 | # MIT License
4 |
5 | cmake_minimum_required(VERSION 3.0)
6 | project(ArduinoJson)
7 |
8 | set(CMAKE_SKIP_INSTALL_ALL_DEPENDENCY true)
9 |
10 | enable_testing()
11 |
12 | add_definitions(-DARDUINOJSON_DEBUG=1)
13 |
14 | if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
15 | if(CMAKE_CXX_COMPILER_VERSION VERSION_GREATER 4.8)
16 | add_compile_options(-g -Og)
17 | else()
18 | add_compile_options(-g -O0)
19 | endif()
20 | endif()
21 |
22 | if(CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
23 | if(CMAKE_CXX_COMPILER_VERSION VERSION_GREATER 4.0)
24 | add_compile_options(-g -Og)
25 | else()
26 | add_compile_options(-g -O0)
27 | endif()
28 | endif()
29 |
30 | if(CMAKE_CXX_COMPILER_ID STREQUAL "AppleClang")
31 | if(CMAKE_CXX_COMPILER_VERSION VERSION_GREATER 9.0)
32 | add_compile_options(-g -Og)
33 | else()
34 | add_compile_options(-g -O0)
35 | endif()
36 | endif()
37 |
38 | if(${COVERAGE})
39 | set(CMAKE_CXX_FLAGS "-fprofile-arcs -ftest-coverage")
40 | endif()
41 |
42 | add_subdirectory(src)
43 | add_subdirectory(extras/tests)
44 | add_subdirectory(extras/fuzzing)
45 |
--------------------------------------------------------------------------------
/libraries/ArduinoJson/CONTRIBUTING.md:
--------------------------------------------------------------------------------
1 | # Contribution to ArduinoJson
2 |
3 | First, thank you for taking the time to contribute to this project.
4 |
5 | You can submit changes via GitHub Pull Requests.
6 |
7 | Please:
8 |
9 | 1. Unit test every change in behavior
10 | 2. Use clang-format in "file" mode to format the code
11 | 3. Consider using the Continuous Integration (Travis and AppVeyor)
12 |
--------------------------------------------------------------------------------
/libraries/ArduinoJson/LICENSE.md:
--------------------------------------------------------------------------------
1 | The MIT License (MIT)
2 | ---------------------
3 |
4 | Copyright © 2014-2020 Benoit BLANCHON
5 |
6 | Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
7 |
8 | The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
9 |
10 | THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
11 |
--------------------------------------------------------------------------------
/libraries/ArduinoJson/SUPPORT.md:
--------------------------------------------------------------------------------
1 | # ArduinoJson Support
2 |
3 | First off, thank you very much for using ArduinoJson.
4 |
5 | We'll be very happy to help you, but first please read the following.
6 |
7 | ## Before asking for help
8 |
9 | 1. Read the [FAQ](https://arduinojson.org/faq/?utm_source=github&utm_medium=support)
10 | 2. Search in the [API Reference](https://arduinojson.org/api/?utm_source=github&utm_medium=support)
11 |
12 | If you did not find the answer, please create a [new issue on GitHub](https://github.com/bblanchon/ArduinoJson/issues/new).
13 |
14 | It is OK to add a comment to a currently opened issue, but please avoid adding comments to a closed issue.
15 |
16 | ## Before hitting the Submit button
17 |
18 | Please provide all the relevant information:
19 |
20 | * Good title
21 | * Short description of the problem
22 | * Target platform
23 | * Compiler model and version
24 | * [MVCE](https://stackoverflow.com/help/mcve)
25 | * Compiler output
26 |
27 | Good questions get fast answers!
28 |
--------------------------------------------------------------------------------
/libraries/ArduinoJson/appveyor.yml:
--------------------------------------------------------------------------------
1 | version: 6.15.1.{build}
2 | environment:
3 | matrix:
4 | - APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2019
5 | CMAKE_GENERATOR: Visual Studio 16 2019
6 | - APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2017
7 | CMAKE_GENERATOR: Visual Studio 15 2017
8 | - APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2015
9 | CMAKE_GENERATOR: Visual Studio 14 2015
10 | - APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2013
11 | CMAKE_GENERATOR: Visual Studio 12 2013
12 | - CMAKE_GENERATOR: Visual Studio 11 2012
13 | - CMAKE_GENERATOR: Visual Studio 10 2010
14 | - CMAKE_GENERATOR: MinGW Makefiles
15 | configuration: Debug
16 | before_build:
17 | - set PATH=C:\MinGW\bin;%PATH:C:\Program Files\Git\usr\bin;=% # Workaround for CMake not wanting sh.exe on PATH for MinGW
18 | - cmake -DCMAKE_BUILD_TYPE=%CONFIGURATION% -G "%CMAKE_GENERATOR%" .
19 | build_script:
20 | - cmake --build . --config %CONFIGURATION%
21 | test_script:
22 | - ctest -C %CONFIGURATION% --output-on-failure .
23 |
--------------------------------------------------------------------------------
/libraries/ArduinoJson/component.mk:
--------------------------------------------------------------------------------
1 | COMPONENT_ADD_INCLUDEDIRS := src
2 |
--------------------------------------------------------------------------------
/libraries/ArduinoJson/extras/ArduinoJsonConfig.cmake.in:
--------------------------------------------------------------------------------
1 | @PACKAGE_INIT@
2 |
3 | include("${CMAKE_CURRENT_LIST_DIR}/@PROJECT_NAME@Targets.cmake")
4 | check_required_components("@PROJECT_NAME@")
5 |
--------------------------------------------------------------------------------
/libraries/ArduinoJson/extras/ci/arduino.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash -eux
2 |
3 | /sbin/start-stop-daemon --start --quiet --pidfile /tmp/custom_xvfb_1.pid --make-pidfile --background --exec /usr/bin/Xvfb -- :1 -ac -screen 0 1280x1024x16
4 | sleep 3
5 | export DISPLAY=:1.0
6 |
7 | mkdir -p /tmp/arduino
8 | curl -sS http://downloads.arduino.cc/arduino-$VERSION-linux64.tar.xz | tar xJ -C /tmp/arduino --strip 1 ||
9 | curl -sS http://downloads.arduino.cc/arduino-$VERSION-linux64.tgz | tar xz -C /tmp/arduino --strip 1
10 | export PATH=$PATH:/tmp/arduino/
11 |
12 | if [[ "$BOARD" =~ "arduino:samd:" ]]; then
13 | arduino --install-boards arduino:samd
14 | fi
15 |
16 | ln -s $PWD /tmp/arduino/libraries/ArduinoJson
17 |
18 | for EXAMPLE in $PWD/examples/*/*.ino; do
19 | arduino --verify --board $BOARD $EXAMPLE
20 | done
21 |
--------------------------------------------------------------------------------
/libraries/ArduinoJson/extras/ci/build.sh:
--------------------------------------------------------------------------------
1 | #!/bin/sh -ex
2 |
3 | export CC="$_CC"
4 | export CXX="$_CXX"
5 |
6 | if [ -n "$SANITIZE" ]; then
7 | export CXXFLAGS="-fsanitize=$SANITIZE"
8 | BUILD_TYPE="Debug"
9 | else
10 | BUILD_TYPE="Release"
11 | fi
12 |
13 | cmake -DCMAKE_BUILD_TYPE=$BUILD_TYPE .
14 | cmake --build .
15 |
--------------------------------------------------------------------------------
/libraries/ArduinoJson/extras/ci/coverage.sh:
--------------------------------------------------------------------------------
1 | #!/bin/sh -eux
2 |
3 | cmake -DCOVERAGE=true .
4 | make
5 | make test
6 |
7 | pip install --user cpp-coveralls 'requests[security]'
8 | pwd
9 | coveralls --include 'src' --gcov-options '\-lp'
10 |
--------------------------------------------------------------------------------
/libraries/ArduinoJson/extras/ci/fuzz.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash -eux
2 |
3 | ROOT_DIR=$(dirname $0)/../../
4 | INCLUDE_DIR=${ROOT_DIR}/src/
5 | FUZZING_DIR=${ROOT_DIR}/extras/fuzzing/
6 | CXXFLAGS="-g -fprofile-instr-generate -fcoverage-mapping -fsanitize=address,undefined,fuzzer -fno-sanitize-recover=all"
7 |
8 | fuzz() {
9 | NAME="$1"
10 | FUZZER="${NAME}_fuzzer"
11 | FUZZER_CPP="${FUZZING_DIR}/${NAME}_fuzzer.cpp"
12 | CORPUS_DIR="${FUZZING_DIR}/${NAME}_corpus"
13 | SEED_CORPUS_DIR="${FUZZING_DIR}/${NAME}_seed_corpus"
14 |
15 | clang++-${CLANG} ${CXXFLAGS} -o ${FUZZER} -I$INCLUDE_DIR ${FUZZER_CPP}
16 |
17 | export ASAN_OPTIONS="detect_leaks=0"
18 | export LLVM_PROFILE_FILE="${FUZZER}.profraw"
19 | ./${FUZZER} "$CORPUS_DIR" "$SEED_CORPUS_DIR" -max_total_time=30 -timeout=1
20 |
21 | llvm-profdata-${CLANG} merge -sparse ${LLVM_PROFILE_FILE} -o ${FUZZER}.profdata
22 | llvm-cov-${CLANG} report ./${FUZZER} -instr-profile=${FUZZER}.profdata
23 | }
24 |
25 | fuzz json
26 | fuzz msgpack
27 |
--------------------------------------------------------------------------------
/libraries/ArduinoJson/extras/ci/platformio.sh:
--------------------------------------------------------------------------------
1 | #!/bin/sh -eux
2 |
3 | pip install --user platformio
4 |
5 | case $BOARD in
6 | uno)
7 | platformio lib install 868 # SD library
8 | platformio lib install 872 # Ethernet library
9 | ;;
10 | esp01)
11 | platformio lib uninstall 161 || true
12 | platformio lib uninstall 868 || true
13 | platformio lib uninstall 872 || true
14 | ;;
15 | esac
16 |
17 | for EXAMPLE in $PWD/examples/*/*.ino;
18 | do
19 | platformio ci $EXAMPLE -l '.' -b $BOARD
20 | done
21 |
--------------------------------------------------------------------------------
/libraries/ArduinoJson/extras/ci/test.sh:
--------------------------------------------------------------------------------
1 | #!/bin/sh -ex
2 |
3 | "$(dirname "$0")/build.sh"
4 | ctest --output-on-failure .
5 |
--------------------------------------------------------------------------------
/libraries/ArduinoJson/extras/fuzzing/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | # ArduinoJson - arduinojson.org
2 | # Copyright Benoit Blanchon 2014-2020
3 | # MIT License
4 |
5 | if(MSVC)
6 | add_compile_options(-D_CRT_SECURE_NO_WARNINGS)
7 | endif()
8 |
9 | add_executable(msgpack_fuzzer
10 | msgpack_fuzzer.cpp
11 | fuzzer_main.cpp
12 | )
13 | target_link_libraries(msgpack_fuzzer
14 | ArduinoJson
15 | )
16 |
17 | add_executable(json_fuzzer
18 | json_fuzzer.cpp
19 | fuzzer_main.cpp
20 | )
21 | target_link_libraries(json_fuzzer
22 | ArduinoJson
23 | )
24 |
--------------------------------------------------------------------------------
/libraries/ArduinoJson/extras/fuzzing/Makefile:
--------------------------------------------------------------------------------
1 | # CAUTION: this file is invoked by https://github.com/google/oss-fuzz
2 |
3 | CXXFLAGS += -I../../src -DARDUINOJSON_DEBUG=1
4 |
5 | all: \
6 | $(OUT)/json_fuzzer \
7 | $(OUT)/json_fuzzer_seed_corpus.zip \
8 | $(OUT)/json_fuzzer.options \
9 | $(OUT)/msgpack_fuzzer \
10 | $(OUT)/msgpack_fuzzer_seed_corpus.zip \
11 | $(OUT)/msgpack_fuzzer.options
12 |
13 | $(OUT)/%_fuzzer: %_fuzzer.cpp $(shell find ../../src -type f)
14 | $(CXX) $(CXXFLAGS) $< -o$@ $(LIB_FUZZING_ENGINE)
15 |
16 | $(OUT)/%_fuzzer_seed_corpus.zip: %_seed_corpus/*
17 | zip -j $@ $?
18 |
19 | $(OUT)/%_fuzzer.options:
20 | @echo "[libfuzzer]" > $@
21 | @echo "max_len = 256" >> $@
22 | @echo "timeout = 10" >> $@
23 |
--------------------------------------------------------------------------------
/libraries/ArduinoJson/extras/fuzzing/fuzzer_main.cpp:
--------------------------------------------------------------------------------
1 | // ArduinoJson - arduinojson.org
2 | // Copyright Benoit Blanchon 2014-2020
3 | // MIT License
4 |
5 | // This file is NOT use by Google's OSS fuzz
6 | // I only use it to reproduce the bugs found
7 |
8 | #include // size_t
9 | #include // fopen et al.
10 | #include // exit
11 | #include
12 | #include
13 |
14 | extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size);
15 |
16 | std::vector read(const char* path) {
17 | FILE* f = fopen(path, "rb");
18 | if (!f) {
19 | std::cerr << "Failed to open " << path << std::endl;
20 | exit(1);
21 | }
22 |
23 | fseek(f, 0, SEEK_END);
24 | size_t size = ftell(f);
25 | fseek(f, 0, SEEK_SET);
26 |
27 | std::vector buffer(size);
28 | if (fread(buffer.data(), 1, size, f) != size) {
29 | fclose(f);
30 | std::cerr << "Failed to read " << path << std::endl;
31 | exit(1);
32 | }
33 |
34 | fclose(f);
35 | return buffer;
36 | }
37 |
38 | int main(int argc, const char* argv[]) {
39 | if (argc < 2) {
40 | std::cerr << "Usage: msgpack_fuzzer files" << std::endl;
41 | return 1;
42 | }
43 |
44 | for (int i = 1; i < argc; i++) {
45 | std::cout << "Loading " << argv[i] << std::endl;
46 | std::vector buffer = read(argv[i]);
47 | LLVMFuzzerTestOneInput(buffer.data(), buffer.size());
48 | }
49 | return 0;
50 | }
51 |
--------------------------------------------------------------------------------
/libraries/ArduinoJson/extras/fuzzing/json_fuzzer.cpp:
--------------------------------------------------------------------------------
1 | #include
2 |
3 | extern "C" int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) {
4 | DynamicJsonDocument doc(4096);
5 | DeserializationError error = deserializeJson(doc, data, size);
6 | if (!error) {
7 | std::string json;
8 | serializeJson(doc, json);
9 | }
10 | return 0;
11 | }
12 |
--------------------------------------------------------------------------------
/libraries/ArduinoJson/extras/fuzzing/json_seed_corpus/Comments.json:
--------------------------------------------------------------------------------
1 | //comment
2 | /*comment*/
3 | [ //comment
4 | /*comment*/"comment"/*comment*/,//comment
5 | /*comment*/{//comment
6 | /* comment*/"key"//comment
7 | : //comment
8 | "value"//comment
9 | }/*comment*/
10 | ]//comment
--------------------------------------------------------------------------------
/libraries/ArduinoJson/extras/fuzzing/json_seed_corpus/EmptyArray.json:
--------------------------------------------------------------------------------
1 | []
--------------------------------------------------------------------------------
/libraries/ArduinoJson/extras/fuzzing/json_seed_corpus/EmptyObject.json:
--------------------------------------------------------------------------------
1 | {}
--------------------------------------------------------------------------------
/libraries/ArduinoJson/extras/fuzzing/json_seed_corpus/ExcessiveNesting.json:
--------------------------------------------------------------------------------
1 | [1,[2,[3,[4,[5,[6,[7,[8,[9,[10,[11,[12,[13,[14,[15,[16,[17,[18,[19,[20,[21,[22,[23,[24,[25,[26,[27,[28,[29,[30,[31,[32,[33,[34,[35,[36,[37,[38,[39,[40,[41,[42,[43,[44,[45,[46,[47,[48,[49,[50,[51,[52,[53,[54,[55,[56,[57,[58,[59,[60,[61,[62,[63,[64,[65,[66,[67,[68,[69,[70,[71,[72,[73,[74,[75,[76,[77,[78,[79,[80,[81,[82,[83,[84,[85,[86,[87,[88,[89,[90,[91,[92,[93,[94,[95,[96,[97,[98,[99,[100,[101,[102,[103,[104,[105,[106,[107,[108,[109,[110,[111,[112,[113,[114,[115,[116,[117,[118,[119,[120]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]
--------------------------------------------------------------------------------
/libraries/ArduinoJson/extras/fuzzing/json_seed_corpus/IntegerOverflow.json:
--------------------------------------------------------------------------------
1 | 9720730739393920739
2 |
--------------------------------------------------------------------------------
/libraries/ArduinoJson/extras/fuzzing/json_seed_corpus/Numbers.json:
--------------------------------------------------------------------------------
1 | [
2 | 123,
3 | -123,
4 | 123.456,
5 | -123.456,
6 | 12e34,
7 | 12e-34,
8 | 12e+34,
9 | 12E34,
10 | 12E-34,
11 | 12E+34,
12 | 12.34e56,
13 | 12.34e-56,
14 | 12.34e+56,
15 | 12.34E56,
16 | 12.34E-56,
17 | 12.34E+56,
18 | NaN,
19 | -NaN,
20 | +NaN,
21 | Infinity,
22 | +Infinity,
23 | -Infinity
24 | ]
--------------------------------------------------------------------------------
/libraries/ArduinoJson/extras/fuzzing/json_seed_corpus/OpenWeatherMap.json:
--------------------------------------------------------------------------------
1 | {
2 | "coord": {
3 | "lon": -0.13,
4 | "lat": 51.51
5 | },
6 | "weather": [
7 | {
8 | "id": 301,
9 | "main": "Drizzle",
10 | "description": "drizzle",
11 | "icon": "09n"
12 | },
13 | {
14 | "id": 701,
15 | "main": "Mist",
16 | "description": "mist",
17 | "icon": "50n"
18 | },
19 | {
20 | "id": 741,
21 | "main": "Fog",
22 | "description": "fog",
23 | "icon": "50n"
24 | }
25 | ],
26 | "base": "stations",
27 | "main": {
28 | "temp": 281.87,
29 | "pressure": 1032,
30 | "humidity": 100,
31 | "temp_min": 281.15,
32 | "temp_max": 283.15
33 | },
34 | "visibility": 2900,
35 | "wind": {
36 | "speed": 1.5
37 | },
38 | "clouds": {
39 | "all": 90
40 | },
41 | "dt": 1483820400,
42 | "sys": {
43 | "type": 1,
44 | "id": 5091,
45 | "message": 0.0226,
46 | "country": "GB",
47 | "sunrise": 1483776245,
48 | "sunset": 1483805443
49 | },
50 | "id": 2643743,
51 | "name": "London",
52 | "cod": 200
53 | }
54 |
--------------------------------------------------------------------------------
/libraries/ArduinoJson/extras/fuzzing/json_seed_corpus/Strings.json:
--------------------------------------------------------------------------------
1 | [
2 | "hello",
3 | 'hello',
4 | hello,
5 | {"hello":"world"},
6 | {'hello':'world'},
7 | {hello:world}
8 | ]
--------------------------------------------------------------------------------
/libraries/ArduinoJson/extras/fuzzing/msgpack_fuzzer.cpp:
--------------------------------------------------------------------------------
1 | #include
2 |
3 | extern "C" int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) {
4 | DynamicJsonDocument doc(4096);
5 | DeserializationError error = deserializeMsgPack(doc, data, size);
6 | if (!error) {
7 | std::string json;
8 | serializeMsgPack(doc, json);
9 | }
10 | return 0;
11 | }
12 |
--------------------------------------------------------------------------------
/libraries/ArduinoJson/extras/fuzzing/msgpack_seed_corpus/array16:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/joshbrew/HEGduino_V0/58c232c436a18e4c70886616d500de1482cec2e7/libraries/ArduinoJson/extras/fuzzing/msgpack_seed_corpus/array16
--------------------------------------------------------------------------------
/libraries/ArduinoJson/extras/fuzzing/msgpack_seed_corpus/array32:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/joshbrew/HEGduino_V0/58c232c436a18e4c70886616d500de1482cec2e7/libraries/ArduinoJson/extras/fuzzing/msgpack_seed_corpus/array32
--------------------------------------------------------------------------------
/libraries/ArduinoJson/extras/fuzzing/msgpack_seed_corpus/false:
--------------------------------------------------------------------------------
1 | �
--------------------------------------------------------------------------------
/libraries/ArduinoJson/extras/fuzzing/msgpack_seed_corpus/fixarray:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/joshbrew/HEGduino_V0/58c232c436a18e4c70886616d500de1482cec2e7/libraries/ArduinoJson/extras/fuzzing/msgpack_seed_corpus/fixarray
--------------------------------------------------------------------------------
/libraries/ArduinoJson/extras/fuzzing/msgpack_seed_corpus/fixint_negative:
--------------------------------------------------------------------------------
1 | �
--------------------------------------------------------------------------------
/libraries/ArduinoJson/extras/fuzzing/msgpack_seed_corpus/fixint_positive:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/libraries/ArduinoJson/extras/fuzzing/msgpack_seed_corpus/fixmap:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/joshbrew/HEGduino_V0/58c232c436a18e4c70886616d500de1482cec2e7/libraries/ArduinoJson/extras/fuzzing/msgpack_seed_corpus/fixmap
--------------------------------------------------------------------------------
/libraries/ArduinoJson/extras/fuzzing/msgpack_seed_corpus/fixstr:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/joshbrew/HEGduino_V0/58c232c436a18e4c70886616d500de1482cec2e7/libraries/ArduinoJson/extras/fuzzing/msgpack_seed_corpus/fixstr
--------------------------------------------------------------------------------
/libraries/ArduinoJson/extras/fuzzing/msgpack_seed_corpus/float32:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/joshbrew/HEGduino_V0/58c232c436a18e4c70886616d500de1482cec2e7/libraries/ArduinoJson/extras/fuzzing/msgpack_seed_corpus/float32
--------------------------------------------------------------------------------
/libraries/ArduinoJson/extras/fuzzing/msgpack_seed_corpus/float64:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/joshbrew/HEGduino_V0/58c232c436a18e4c70886616d500de1482cec2e7/libraries/ArduinoJson/extras/fuzzing/msgpack_seed_corpus/float64
--------------------------------------------------------------------------------
/libraries/ArduinoJson/extras/fuzzing/msgpack_seed_corpus/int16:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/joshbrew/HEGduino_V0/58c232c436a18e4c70886616d500de1482cec2e7/libraries/ArduinoJson/extras/fuzzing/msgpack_seed_corpus/int16
--------------------------------------------------------------------------------
/libraries/ArduinoJson/extras/fuzzing/msgpack_seed_corpus/int32:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/joshbrew/HEGduino_V0/58c232c436a18e4c70886616d500de1482cec2e7/libraries/ArduinoJson/extras/fuzzing/msgpack_seed_corpus/int32
--------------------------------------------------------------------------------
/libraries/ArduinoJson/extras/fuzzing/msgpack_seed_corpus/int64:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/joshbrew/HEGduino_V0/58c232c436a18e4c70886616d500de1482cec2e7/libraries/ArduinoJson/extras/fuzzing/msgpack_seed_corpus/int64
--------------------------------------------------------------------------------
/libraries/ArduinoJson/extras/fuzzing/msgpack_seed_corpus/int8:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/joshbrew/HEGduino_V0/58c232c436a18e4c70886616d500de1482cec2e7/libraries/ArduinoJson/extras/fuzzing/msgpack_seed_corpus/int8
--------------------------------------------------------------------------------
/libraries/ArduinoJson/extras/fuzzing/msgpack_seed_corpus/map16:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/joshbrew/HEGduino_V0/58c232c436a18e4c70886616d500de1482cec2e7/libraries/ArduinoJson/extras/fuzzing/msgpack_seed_corpus/map16
--------------------------------------------------------------------------------
/libraries/ArduinoJson/extras/fuzzing/msgpack_seed_corpus/map32:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/joshbrew/HEGduino_V0/58c232c436a18e4c70886616d500de1482cec2e7/libraries/ArduinoJson/extras/fuzzing/msgpack_seed_corpus/map32
--------------------------------------------------------------------------------
/libraries/ArduinoJson/extras/fuzzing/msgpack_seed_corpus/nil:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/joshbrew/HEGduino_V0/58c232c436a18e4c70886616d500de1482cec2e7/libraries/ArduinoJson/extras/fuzzing/msgpack_seed_corpus/nil
--------------------------------------------------------------------------------
/libraries/ArduinoJson/extras/fuzzing/msgpack_seed_corpus/str16:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/joshbrew/HEGduino_V0/58c232c436a18e4c70886616d500de1482cec2e7/libraries/ArduinoJson/extras/fuzzing/msgpack_seed_corpus/str16
--------------------------------------------------------------------------------
/libraries/ArduinoJson/extras/fuzzing/msgpack_seed_corpus/str32:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/joshbrew/HEGduino_V0/58c232c436a18e4c70886616d500de1482cec2e7/libraries/ArduinoJson/extras/fuzzing/msgpack_seed_corpus/str32
--------------------------------------------------------------------------------
/libraries/ArduinoJson/extras/fuzzing/msgpack_seed_corpus/str8:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/joshbrew/HEGduino_V0/58c232c436a18e4c70886616d500de1482cec2e7/libraries/ArduinoJson/extras/fuzzing/msgpack_seed_corpus/str8
--------------------------------------------------------------------------------
/libraries/ArduinoJson/extras/fuzzing/msgpack_seed_corpus/true:
--------------------------------------------------------------------------------
1 | �
--------------------------------------------------------------------------------
/libraries/ArduinoJson/extras/fuzzing/msgpack_seed_corpus/uint16:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/joshbrew/HEGduino_V0/58c232c436a18e4c70886616d500de1482cec2e7/libraries/ArduinoJson/extras/fuzzing/msgpack_seed_corpus/uint16
--------------------------------------------------------------------------------
/libraries/ArduinoJson/extras/fuzzing/msgpack_seed_corpus/uint32:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/joshbrew/HEGduino_V0/58c232c436a18e4c70886616d500de1482cec2e7/libraries/ArduinoJson/extras/fuzzing/msgpack_seed_corpus/uint32
--------------------------------------------------------------------------------
/libraries/ArduinoJson/extras/fuzzing/msgpack_seed_corpus/uint64:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/joshbrew/HEGduino_V0/58c232c436a18e4c70886616d500de1482cec2e7/libraries/ArduinoJson/extras/fuzzing/msgpack_seed_corpus/uint64
--------------------------------------------------------------------------------
/libraries/ArduinoJson/extras/fuzzing/msgpack_seed_corpus/uint8:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/joshbrew/HEGduino_V0/58c232c436a18e4c70886616d500de1482cec2e7/libraries/ArduinoJson/extras/fuzzing/msgpack_seed_corpus/uint8
--------------------------------------------------------------------------------
/libraries/ArduinoJson/extras/scripts/build-arduino-package.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 | TAG=$(git describe)
4 | OUTPUT="ArduinoJson-$TAG.zip"
5 |
6 | cd $(dirname $0)/../../..
7 |
8 | # remove existing file
9 | rm -f $OUTPUT
10 |
11 | # create zip
12 | 7z a $OUTPUT \
13 | ArduinoJson/CHANGELOG.md \
14 | ArduinoJson/examples \
15 | ArduinoJson/src \
16 | ArduinoJson/keywords.txt \
17 | ArduinoJson/library.properties \
18 | ArduinoJson/LICENSE.md \
19 | ArduinoJson/README.md \
20 | ArduinoJson/ArduinoJson.h
21 |
--------------------------------------------------------------------------------
/libraries/ArduinoJson/extras/scripts/create-build-envs.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 | export PATH="$PATH:/Applications/CMake.app/Contents/bin/"
4 |
5 | cd $(dirname $0)/../..
6 | ROOT=$(pwd)
7 |
8 | mkdir "build"
9 | cd build
10 | BUILD=$(pwd)
11 |
12 | build-env()
13 | {
14 | cd $BUILD
15 | mkdir "$1"
16 | cd "$1"
17 | cmake "$ROOT" -G "$2"
18 | }
19 |
20 | if [[ $(uname) == MINGW* ]]
21 | then
22 | build-env "Make" "MinGW Makefiles"
23 | build-env "SublimeText" "Sublime Text 2 - Ninja"
24 | build-env "VisualStudio" "Visual Studio 14 2015"
25 | else
26 | build-env "SublimeText" "Sublime Text 2 - Ninja"
27 | build-env "Make" "Unix Makefiles"
28 | build-env "Xcode" "Xcode"
29 | fi
30 |
--------------------------------------------------------------------------------
/libraries/ArduinoJson/extras/scripts/publish-particle-library.sh:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env bash
2 |
3 | set -eu
4 |
5 | SOURCE_DIR="$(dirname "$0")/../.."
6 | WORK_DIR=$(mktemp -d)
7 | trap 'rm -rf "$WORK_DIR"' EXIT
8 |
9 | cp "$SOURCE_DIR/README.md" "$WORK_DIR/README.md"
10 | cp "$SOURCE_DIR/CHANGELOG.md" "$WORK_DIR/CHANGELOG.md"
11 | cp "$SOURCE_DIR/library.properties" "$WORK_DIR/library.properties"
12 | cp "$SOURCE_DIR/LICENSE.md" "$WORK_DIR/LICENSE.txt"
13 | cp -r "$SOURCE_DIR/src" "$WORK_DIR/"
14 | cp -r "$SOURCE_DIR/examples" "$WORK_DIR/"
15 |
16 | cd "$WORK_DIR"
17 | particle library upload
18 | particle library publish
19 |
--------------------------------------------------------------------------------
/libraries/ArduinoJson/extras/scripts/wandbox/publish.sh:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env bash
2 |
3 | set -eu
4 |
5 | ARDUINOJSON_H="$1"
6 |
7 | read_string() {
8 | jq --slurp --raw-input '.' "$1"
9 | }
10 |
11 | compile() {
12 | FILE_PATH="$(dirname $0)/$1.cpp"
13 | cat >parameters.json <
6 | #include
7 |
8 | using namespace ARDUINOJSON_NAMESPACE;
9 |
10 | TEST_CASE("ElementProxy::add()") {
11 | DynamicJsonDocument doc(4096);
12 | doc.addElement();
13 | ElementProxy ep = doc[0];
14 |
15 | SECTION("add(int)") {
16 | ep.add(42);
17 |
18 | REQUIRE(doc.as() == "[[42]]");
19 | }
20 |
21 | SECTION("add(const char*)") {
22 | ep.add("world");
23 |
24 | REQUIRE(doc.as() == "[[\"world\"]]");
25 | }
26 |
27 | SECTION("set(char[])") {
28 | char s[] = "world";
29 | ep.add(s);
30 | strcpy(s, "!!!!!");
31 |
32 | REQUIRE(doc.as() == "[[\"world\"]]");
33 | }
34 | }
35 |
--------------------------------------------------------------------------------
/libraries/ArduinoJson/extras/tests/ElementProxy/clear.cpp:
--------------------------------------------------------------------------------
1 | // ArduinoJson - arduinojson.org
2 | // Copyright Benoit Blanchon 2014-2020
3 | // MIT License
4 |
5 | #include
6 | #include
7 |
8 | using namespace ARDUINOJSON_NAMESPACE;
9 |
10 | TEST_CASE("ElementProxy::clear()") {
11 | DynamicJsonDocument doc(4096);
12 | doc.addElement();
13 | ElementProxy ep = doc[0];
14 |
15 | SECTION("size goes back to zero") {
16 | ep.add(42);
17 | ep.clear();
18 |
19 | REQUIRE(ep.size() == 0);
20 | }
21 |
22 | SECTION("isNull() return true") {
23 | ep.add("hello");
24 | ep.clear();
25 |
26 | REQUIRE(ep.isNull() == true);
27 | }
28 | }
29 |
--------------------------------------------------------------------------------
/libraries/ArduinoJson/extras/tests/ElementProxy/compare.cpp:
--------------------------------------------------------------------------------
1 | // ArduinoJson - arduinojson.org
2 | // Copyright Benoit Blanchon 2014-2020
3 | // MIT License
4 |
5 | #include
6 | #include
7 |
8 | using namespace ARDUINOJSON_NAMESPACE;
9 |
10 | TEST_CASE("ElementProxy::operator==()") {
11 | DynamicJsonDocument doc(4096);
12 |
13 | SECTION("same value") {
14 | doc.add(1);
15 | doc.add(1);
16 |
17 | REQUIRE(doc[0] == doc[1]);
18 | REQUIRE_FALSE(doc[0] != doc[1]);
19 | }
20 |
21 | SECTION("different values") {
22 | doc.add(1);
23 | doc.add(2);
24 |
25 | REQUIRE_FALSE(doc[0] == doc[1]);
26 | REQUIRE(doc[0] != doc[1]);
27 | }
28 | }
29 |
--------------------------------------------------------------------------------
/libraries/ArduinoJson/extras/tests/ElementProxy/remove.cpp:
--------------------------------------------------------------------------------
1 | // ArduinoJson - arduinojson.org
2 | // Copyright Benoit Blanchon 2014-2020
3 | // MIT License
4 |
5 | #include
6 | #include
7 |
8 | using namespace ARDUINOJSON_NAMESPACE;
9 |
10 | TEST_CASE("ElementProxy::remove()") {
11 | DynamicJsonDocument doc(4096);
12 | doc.addElement();
13 | ElementProxy ep = doc[0];
14 |
15 | SECTION("remove(int)") {
16 | ep.add(1);
17 | ep.add(2);
18 | ep.add(3);
19 |
20 | ep.remove(1);
21 |
22 | REQUIRE(ep.as() == "[1,3]");
23 | }
24 |
25 | SECTION("remove(const char *)") {
26 | ep["a"] = 1;
27 | ep["b"] = 2;
28 |
29 | ep.remove("a");
30 |
31 | REQUIRE(ep.as() == "{\"b\":2}");
32 | }
33 |
34 | SECTION("remove(std::string)") {
35 | ep["a"] = 1;
36 | ep["b"] = 2;
37 |
38 | ep.remove(std::string("b"));
39 |
40 | REQUIRE(ep.as() == "{\"a\":1}");
41 | }
42 |
43 | #ifdef HAS_VARIABLE_LENGTH_ARRAY
44 | SECTION("remove(vla)") {
45 | ep["a"] = 1;
46 | ep["b"] = 2;
47 |
48 | int i = 4;
49 | char vla[i];
50 | strcpy(vla, "b");
51 | ep.remove(vla);
52 |
53 | REQUIRE(ep.as() == "{\"a\":1}");
54 | }
55 | #endif
56 | }
57 |
--------------------------------------------------------------------------------
/libraries/ArduinoJson/extras/tests/ElementProxy/set.cpp:
--------------------------------------------------------------------------------
1 | // ArduinoJson - arduinojson.org
2 | // Copyright Benoit Blanchon 2014-2020
3 | // MIT License
4 |
5 | #include
6 | #include
7 |
8 | using namespace ARDUINOJSON_NAMESPACE;
9 |
10 | TEST_CASE("ElementProxy::set()") {
11 | DynamicJsonDocument doc(4096);
12 | ElementProxy ep = doc[0];
13 |
14 | SECTION("set(int)") {
15 | ep.set(42);
16 |
17 | REQUIRE(doc.as() == "[42]");
18 | }
19 |
20 | SECTION("set(const char*)") {
21 | ep.set("world");
22 |
23 | REQUIRE(doc.as() == "[\"world\"]");
24 | }
25 |
26 | SECTION("set(char[])") {
27 | char s[] = "world";
28 | ep.set(s);
29 | strcpy(s, "!!!!!");
30 |
31 | REQUIRE(doc.as() == "[\"world\"]");
32 | }
33 | }
34 |
--------------------------------------------------------------------------------
/libraries/ArduinoJson/extras/tests/ElementProxy/size.cpp:
--------------------------------------------------------------------------------
1 | // ArduinoJson - arduinojson.org
2 | // Copyright Benoit Blanchon 2014-2020
3 | // MIT License
4 |
5 | #include
6 | #include
7 |
8 | using namespace ARDUINOJSON_NAMESPACE;
9 |
10 | TEST_CASE("ElementProxy::size()") {
11 | DynamicJsonDocument doc(4096);
12 | doc.addElement();
13 | ElementProxy ep = doc[0];
14 |
15 | SECTION("returns 0") {
16 | REQUIRE(ep.size() == 0);
17 | }
18 |
19 | SECTION("as an array, returns 2") {
20 | ep.add(1);
21 | ep.add(2);
22 | REQUIRE(ep.size() == 2);
23 | }
24 |
25 | SECTION("as an object, returns 2") {
26 | ep["a"] = 1;
27 | ep["b"] = 2;
28 | REQUIRE(ep.size() == 2);
29 | }
30 | }
31 |
--------------------------------------------------------------------------------
/libraries/ArduinoJson/extras/tests/ElementProxy/subscript.cpp:
--------------------------------------------------------------------------------
1 | // ArduinoJson - arduinojson.org
2 | // Copyright Benoit Blanchon 2014-2020
3 | // MIT License
4 |
5 | #include
6 | #include
7 |
8 | using namespace ARDUINOJSON_NAMESPACE;
9 |
10 | TEST_CASE("MemberProxy::operator[]") {
11 | DynamicJsonDocument doc(4096);
12 | ElementProxy ep = doc[1];
13 |
14 | SECTION("set member") {
15 | ep["world"] = 42;
16 |
17 | REQUIRE(doc.as() == "[null,{\"world\":42}]");
18 | }
19 |
20 | SECTION("set element") {
21 | ep[2] = 42;
22 |
23 | REQUIRE(doc.as() == "[null,[null,null,42]]");
24 | }
25 | }
26 |
--------------------------------------------------------------------------------
/libraries/ArduinoJson/extras/tests/Helpers/CustomReader.hpp:
--------------------------------------------------------------------------------
1 | // ArduinoJson - arduinojson.org
2 | // Copyright Benoit Blanchon 2014-2020
3 | // MIT License
4 |
5 | #pragma once
6 |
7 | #include
8 |
9 | class CustomReader {
10 | std::stringstream _stream;
11 |
12 | public:
13 | CustomReader(const char* input) : _stream(input) {}
14 |
15 | int read() {
16 | return _stream.get();
17 | }
18 |
19 | size_t readBytes(char* buffer, size_t length) {
20 | _stream.read(buffer, static_cast(length));
21 | return static_cast(_stream.gcount());
22 | }
23 |
24 | private:
25 | CustomReader(const CustomReader&);
26 | };
27 |
--------------------------------------------------------------------------------
/libraries/ArduinoJson/extras/tests/Helpers/Stream.h:
--------------------------------------------------------------------------------
1 | // ArduinoJson - arduinojson.org
2 | // Copyright Benoit Blanchon 2014-2020
3 | // MIT License
4 |
5 | #pragma once
6 |
7 | // Reproduces Arduino's Stream class
8 | class Stream // : public Print
9 | {
10 | public:
11 | virtual ~Stream() {}
12 | virtual int read() = 0;
13 | virtual size_t readBytes(char *buffer, size_t length) = 0;
14 | };
15 |
--------------------------------------------------------------------------------
/libraries/ArduinoJson/extras/tests/Helpers/WString.h:
--------------------------------------------------------------------------------
1 | // ArduinoJson - arduinojson.org
2 | // Copyright Benoit Blanchon 2014-2020
3 | // MIT License
4 |
5 | #pragma once
6 |
7 | #include
8 |
9 | // Reproduces Arduino's String class
10 | class String {
11 | public:
12 | String& operator+=(const char* rhs) {
13 | _str += rhs;
14 | return *this;
15 | }
16 |
17 | size_t length() const {
18 | return _str.size();
19 | }
20 |
21 | const char* c_str() const {
22 | return _str.c_str();
23 | }
24 |
25 | bool operator==(const char* s) const {
26 | return _str == s;
27 | }
28 |
29 | friend std::ostream& operator<<(std::ostream& lhs, const ::String& rhs) {
30 | lhs << rhs._str;
31 | return lhs;
32 | }
33 |
34 | private:
35 | std::string _str;
36 | };
37 |
38 | class StringSumHelper;
39 |
40 | inline bool operator==(const std::string& lhs, const ::String& rhs) {
41 | return lhs == rhs.c_str();
42 | }
43 |
--------------------------------------------------------------------------------
/libraries/ArduinoJson/extras/tests/Helpers/progmem_emulation.hpp:
--------------------------------------------------------------------------------
1 | // ArduinoJson - arduinojson.org
2 | // Copyright Benoit Blanchon 2014-2020
3 | // MIT License
4 |
5 | #include // uint8_t
6 | #include // strcmp, strlen...
7 |
8 | class __FlashStringHelper;
9 |
10 | inline const void* convertPtrToFlash(const void* s) {
11 | return reinterpret_cast(s) + 42;
12 | }
13 |
14 | inline const void* convertFlashToPtr(const void* s) {
15 | return reinterpret_cast(s) - 42;
16 | }
17 |
18 | #define F(X) reinterpret_cast(convertPtrToFlash(X))
19 | #define FC(X) reinterpret_cast(convertPtrToFlash(X))
20 |
21 | inline uint8_t pgm_read_byte(const void* p) {
22 | return *reinterpret_cast(convertFlashToPtr(p));
23 | }
24 |
--------------------------------------------------------------------------------
/libraries/ArduinoJson/extras/tests/IntegrationTests/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | # ArduinoJson - arduinojson.org
2 | # Copyright Benoit Blanchon 2014-2020
3 | # MIT License
4 |
5 | add_executable(IntegrationTests
6 | gbathree.cpp
7 | issue772.cpp
8 | round_trip.cpp
9 | openweathermap.cpp
10 | )
11 |
12 | if(CMAKE_CXX_COMPILER_ID MATCHES "GNU")
13 | target_compile_options(IntegrationTests
14 | PUBLIC
15 | -fsingle-precision-constant # issue 544
16 | )
17 | endif()
18 |
19 | target_link_libraries(IntegrationTests
20 | ArduinoJson
21 | catch
22 | )
23 |
24 | add_test(IntegrationTests IntegrationTests)
25 |
--------------------------------------------------------------------------------
/libraries/ArduinoJson/extras/tests/IntegrationTests/issue772.cpp:
--------------------------------------------------------------------------------
1 | // ArduinoJson - arduinojson.org
2 | // Copyright Benoit Blanchon 2014-2020
3 | // MIT License
4 |
5 | #include
6 | #include
7 |
8 | // https://github.com/bblanchon/ArduinoJson/issues/772
9 |
10 | TEST_CASE("Issue772") {
11 | DynamicJsonDocument doc1(4096);
12 | DynamicJsonDocument doc2(4096);
13 | DeserializationError err;
14 | std::string data =
15 | "{\"state\":{\"reported\":{\"timestamp\":\"2018-07-02T09:40:12Z\","
16 | "\"mac\":\"2C3AE84FC076\",\"firmwareVersion\":\"v0.2.7-5-gf4d4d78\","
17 | "\"visibleLight\":261,\"infraRed\":255,\"ultraViolet\":0.02,"
18 | "\"Temperature\":26.63,\"Pressure\":101145.7,\"Humidity\":54.79883,"
19 | "\"Vbat\":4.171261,\"soilMoisture\":0,\"ActB\":0}}}";
20 | err = deserializeJson(doc1, data);
21 | REQUIRE(err == DeserializationError::Ok);
22 |
23 | data = "";
24 | serializeMsgPack(doc1, data);
25 | err = deserializeMsgPack(doc2, data);
26 |
27 | REQUIRE(err == DeserializationError::Ok);
28 | }
29 |
--------------------------------------------------------------------------------
/libraries/ArduinoJson/extras/tests/JsonArray/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | # ArduinoJson - arduinojson.org
2 | # Copyright Benoit Blanchon 2014-2020
3 | # MIT License
4 |
5 | add_executable(JsonArrayTests
6 | add.cpp
7 | copyArray.cpp
8 | createNested.cpp
9 | equals.cpp
10 | get.cpp
11 | isNull.cpp
12 | iterator.cpp
13 | memoryUsage.cpp
14 | nesting.cpp
15 | remove.cpp
16 | size.cpp
17 | std_string.cpp
18 | subscript.cpp
19 | undefined.cpp
20 | )
21 |
22 | target_link_libraries(JsonArrayTests
23 | ArduinoJson
24 | catch
25 | )
26 |
27 | add_test(JsonArray JsonArrayTests)
28 |
--------------------------------------------------------------------------------
/libraries/ArduinoJson/extras/tests/JsonArray/createNested.cpp:
--------------------------------------------------------------------------------
1 | // ArduinoJson - arduinojson.org
2 | // Copyright Benoit Blanchon 2014-2020
3 | // MIT License
4 |
5 | #include
6 | #include
7 |
8 | TEST_CASE("JsonArray basics") {
9 | DynamicJsonDocument doc(4096);
10 | JsonArray array = doc.to();
11 |
12 | SECTION("CreateNestedArray") {
13 | JsonArray arr = array.createNestedArray();
14 | REQUIRE(arr == array[0].as());
15 | }
16 |
17 | SECTION("CreateNestedObject") {
18 | JsonObject obj = array.createNestedObject();
19 | REQUIRE(obj == array[0].as());
20 | }
21 | }
22 |
--------------------------------------------------------------------------------
/libraries/ArduinoJson/extras/tests/JsonArray/get.cpp:
--------------------------------------------------------------------------------
1 | // ArduinoJson - arduinojson.org
2 | // Copyright Benoit Blanchon 2014-2020
3 | // MIT License
4 |
5 | #include
6 | #include
7 |
8 | TEST_CASE("JsonArray::get()") {
9 | DynamicJsonDocument doc(4096);
10 | deserializeJson(doc, "[1,2,3]");
11 | JsonArray array = doc.as();
12 |
13 | SECTION("Overflow") {
14 | REQUIRE(array.getElement(3).isNull());
15 | }
16 | }
17 |
--------------------------------------------------------------------------------
/libraries/ArduinoJson/extras/tests/JsonArray/iterator.cpp:
--------------------------------------------------------------------------------
1 | // ArduinoJson - arduinojson.org
2 | // Copyright Benoit Blanchon 2014-2020
3 | // MIT License
4 |
5 | #include
6 | #include
7 |
8 | template
9 | static void run_iterator_test() {
10 | StaticJsonDocument doc;
11 | JsonArray tmp = doc.to();
12 | tmp.add(12);
13 | tmp.add(34);
14 |
15 | TArray array = tmp;
16 | typename TArray::iterator it = array.begin();
17 | typename TArray::iterator end = array.end();
18 |
19 | REQUIRE(end != it);
20 | REQUIRE(12 == it->template as());
21 | REQUIRE(12 == static_cast(*it));
22 | ++it;
23 | REQUIRE(end != it);
24 | REQUIRE(34 == it->template as());
25 | REQUIRE(34 == static_cast(*it));
26 | ++it;
27 | REQUIRE(end == it);
28 | }
29 |
30 | TEST_CASE("JsonArray::begin()/end()") {
31 | SECTION("Non null JsonArray") {
32 | run_iterator_test();
33 | }
34 |
35 | SECTION("Null JsonArray") {
36 | JsonArray array;
37 |
38 | REQUIRE(array.begin() == array.end());
39 | }
40 | }
41 |
42 | TEST_CASE("JsonArrayConst::begin()/end()") {
43 | SECTION("Non null JsonArrayConst") {
44 | run_iterator_test();
45 | }
46 |
47 | SECTION("Null JsonArrayConst") {
48 | JsonArrayConst array;
49 |
50 | REQUIRE(array.begin() == array.end());
51 | }
52 | }
53 |
--------------------------------------------------------------------------------
/libraries/ArduinoJson/extras/tests/JsonArray/memoryUsage.cpp:
--------------------------------------------------------------------------------
1 | // ArduinoJson - arduinojson.org
2 | // Copyright Benoit Blanchon 2014-2020
3 | // MIT License
4 |
5 | #include
6 | #include
7 |
8 | TEST_CASE("JsonArray::memoryUsage()") {
9 | DynamicJsonDocument doc(4096);
10 | JsonArray arr = doc.to();
11 |
12 | SECTION("return 0 if uninitialized") {
13 | JsonArray unitialized;
14 | REQUIRE(unitialized.memoryUsage() == 0);
15 | }
16 |
17 | SECTION("JSON_ARRAY_SIZE(0) if empty") {
18 | REQUIRE(arr.memoryUsage() == JSON_ARRAY_SIZE(0));
19 | }
20 |
21 | SECTION("JSON_ARRAY_SIZE(1) after add") {
22 | arr.add("hello");
23 | REQUIRE(arr.memoryUsage() == JSON_ARRAY_SIZE(1));
24 | }
25 |
26 | SECTION("includes the size of the string") {
27 | arr.add(std::string("hello"));
28 | REQUIRE(arr.memoryUsage() == JSON_ARRAY_SIZE(1) + 6);
29 | }
30 |
31 | SECTION("includes the size of the nested array") {
32 | JsonArray nested = arr.createNestedArray();
33 | nested.add(42);
34 | REQUIRE(arr.memoryUsage() == 2 * JSON_ARRAY_SIZE(1));
35 | }
36 |
37 | SECTION("includes the size of the nested arrect") {
38 | JsonObject nested = arr.createNestedObject();
39 | nested["hello"] = "world";
40 | REQUIRE(arr.memoryUsage() == JSON_OBJECT_SIZE(1) + JSON_ARRAY_SIZE(1));
41 | }
42 | }
43 |
--------------------------------------------------------------------------------
/libraries/ArduinoJson/extras/tests/JsonArray/nesting.cpp:
--------------------------------------------------------------------------------
1 | // ArduinoJson - arduinojson.org
2 | // Copyright Benoit Blanchon 2014-2020
3 | // MIT License
4 |
5 | #include
6 | #include
7 |
8 | TEST_CASE("JsonArray::nesting()") {
9 | DynamicJsonDocument doc(4096);
10 | JsonArray arr = doc.to();
11 |
12 | SECTION("return 0 if uninitialized") {
13 | JsonArray unitialized;
14 | REQUIRE(unitialized.nesting() == 0);
15 | }
16 |
17 | SECTION("returns 1 for empty array") {
18 | REQUIRE(arr.nesting() == 1);
19 | }
20 |
21 | SECTION("returns 1 for flat array") {
22 | arr.add("hello");
23 | REQUIRE(arr.nesting() == 1);
24 | }
25 |
26 | SECTION("returns 2 with nested array") {
27 | arr.createNestedArray();
28 | REQUIRE(arr.nesting() == 2);
29 | }
30 |
31 | SECTION("returns 2 with nested object") {
32 | arr.createNestedObject();
33 | REQUIRE(arr.nesting() == 2);
34 | }
35 | }
36 |
--------------------------------------------------------------------------------
/libraries/ArduinoJson/extras/tests/JsonArray/size.cpp:
--------------------------------------------------------------------------------
1 | // ArduinoJson - arduinojson.org
2 | // Copyright Benoit Blanchon 2014-2020
3 | // MIT License
4 |
5 | #include
6 | #include
7 |
8 | TEST_CASE("JsonArray::size()") {
9 | DynamicJsonDocument doc(4096);
10 | JsonArray array = doc.to();
11 |
12 | SECTION("returns 0 is empty") {
13 | REQUIRE(0U == array.size());
14 | }
15 |
16 | SECTION("increases after add()") {
17 | array.add("hello");
18 | REQUIRE(1U == array.size());
19 |
20 | array.add("world");
21 | REQUIRE(2U == array.size());
22 | }
23 |
24 | SECTION("remains the same after replacing an element") {
25 | array.add("hello");
26 | REQUIRE(1U == array.size());
27 |
28 | array[0] = "hello";
29 | REQUIRE(1U == array.size());
30 | }
31 | }
32 |
--------------------------------------------------------------------------------
/libraries/ArduinoJson/extras/tests/JsonArray/std_string.cpp:
--------------------------------------------------------------------------------
1 | // ArduinoJson - arduinojson.org
2 | // Copyright Benoit Blanchon 2014-2020
3 | // MIT License
4 |
5 | #include
6 | #include
7 |
8 | static void eraseString(std::string &str) {
9 | char *p = const_cast(str.c_str());
10 | while (*p) *p++ = '*';
11 | }
12 |
13 | TEST_CASE("std::string") {
14 | DynamicJsonDocument doc(4096);
15 | JsonArray array = doc.to();
16 |
17 | SECTION("add()") {
18 | std::string value("hello");
19 | array.add(value);
20 | eraseString(value);
21 | REQUIRE(std::string("hello") == array[0]);
22 | }
23 |
24 | SECTION("operator[]") {
25 | std::string value("world");
26 | array.add("hello");
27 | array[0] = value;
28 | eraseString(value);
29 | REQUIRE(std::string("world") == array[0]);
30 | }
31 | }
32 |
--------------------------------------------------------------------------------
/libraries/ArduinoJson/extras/tests/JsonArray/undefined.cpp:
--------------------------------------------------------------------------------
1 | // ArduinoJson - arduinojson.org
2 | // Copyright Benoit Blanchon 2014-2020
3 | // MIT License
4 |
5 | #include
6 | #include
7 |
8 | using namespace Catch::Matchers;
9 |
10 | TEST_CASE("Undefined JsonArray") {
11 | JsonArray array;
12 |
13 | SECTION("SubscriptFails") {
14 | REQUIRE(array[0].isNull());
15 | }
16 |
17 | SECTION("AddFails") {
18 | array.add(1);
19 | REQUIRE(0 == array.size());
20 | }
21 |
22 | SECTION("CreateNestedArrayFails") {
23 | REQUIRE(array.createNestedArray().isNull());
24 | }
25 |
26 | SECTION("CreateNestedObjectFails") {
27 | REQUIRE(array.createNestedObject().isNull());
28 | }
29 |
30 | SECTION("PrintToWritesBrackets") {
31 | char buffer[32];
32 | serializeJson(array, buffer, sizeof(buffer));
33 | REQUIRE_THAT(buffer, Equals("null"));
34 | }
35 | }
36 |
--------------------------------------------------------------------------------
/libraries/ArduinoJson/extras/tests/JsonDeserializer/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | # ArduinoJson - arduinojson.org
2 | # Copyright Benoit Blanchon 2014-2020
3 | # MIT License
4 |
5 | add_executable(JsonDeserializerTests
6 | array.cpp
7 | array_static.cpp
8 | DeserializationError.cpp
9 | filter.cpp
10 | incomplete_input.cpp
11 | input_types.cpp
12 | invalid_input.cpp
13 | misc.cpp
14 | nestingLimit.cpp
15 | number.cpp
16 | object.cpp
17 | object_static.cpp
18 | string.cpp
19 | )
20 |
21 | target_link_libraries(JsonDeserializerTests
22 | ArduinoJson
23 | catch
24 | )
25 |
26 | set_target_properties(JsonDeserializerTests PROPERTIES UNITY_BUILD OFF)
27 |
28 | add_test(JsonDeserializer JsonDeserializerTests)
29 |
--------------------------------------------------------------------------------
/libraries/ArduinoJson/extras/tests/JsonDeserializer/incomplete_input.cpp:
--------------------------------------------------------------------------------
1 | // ArduinoJson - arduinojson.org
2 | // Copyright Benoit Blanchon 2014-2020
3 | // MIT License
4 |
5 | #define ARDUINOJSON_DECODE_UNICODE 1
6 | #include
7 | #include
8 |
9 | TEST_CASE("Truncated JSON input") {
10 | const char* testCases[] = {"\"hello", "\'hello", "'\\u", "'\\u00", "'\\u000",
11 | // false
12 | "f", "fa", "fal", "fals",
13 | // true
14 | "t", "tr", "tru",
15 | // null
16 | "n", "nu", "nul",
17 | // object
18 | "{", "{a", "{a:", "{a:1", "{a:1,", "{a:1,"};
19 | const size_t testCount = sizeof(testCases) / sizeof(testCases[0]);
20 |
21 | DynamicJsonDocument doc(4096);
22 |
23 | for (size_t i = 0; i < testCount; i++) {
24 | const char* input = testCases[i];
25 | CAPTURE(input);
26 | REQUIRE(deserializeJson(doc, input) ==
27 | DeserializationError::IncompleteInput);
28 | }
29 | }
30 |
--------------------------------------------------------------------------------
/libraries/ArduinoJson/extras/tests/JsonDocument/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | # ArduinoJson - arduinojson.org
2 | # Copyright Benoit Blanchon 2014-2020
3 | # MIT License
4 |
5 | add_executable(JsonDocumentTests
6 | add.cpp
7 | BasicJsonDocument.cpp
8 | compare.cpp
9 | containsKey.cpp
10 | createNested.cpp
11 | DynamicJsonDocument.cpp
12 | isNull.cpp
13 | nesting.cpp
14 | remove.cpp
15 | shrinkToFit.cpp
16 | size.cpp
17 | StaticJsonDocument.cpp
18 | subscript.cpp
19 | )
20 |
21 | target_link_libraries(JsonDocumentTests
22 | ArduinoJson
23 | catch
24 | )
25 |
26 | add_test(JsonDocument JsonDocumentTests)
27 |
--------------------------------------------------------------------------------
/libraries/ArduinoJson/extras/tests/JsonDocument/add.cpp:
--------------------------------------------------------------------------------
1 | // ArduinoJson - arduinojson.org
2 | // Copyright Benoit Blanchon 2014-2020
3 | // MIT License
4 |
5 | #include
6 | #include
7 |
8 | TEST_CASE("JsonDocument::add()") {
9 | DynamicJsonDocument doc(4096);
10 |
11 | SECTION("integer") {
12 | doc.add(42);
13 |
14 | REQUIRE(doc.as() == "[42]");
15 | }
16 |
17 | SECTION("const char*") {
18 | doc.add("hello");
19 |
20 | REQUIRE(doc.as() == "[\"hello\"]");
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/libraries/ArduinoJson/extras/tests/JsonDocument/containsKey.cpp:
--------------------------------------------------------------------------------
1 | // ArduinoJson - arduinojson.org
2 | // Copyright Benoit Blanchon 2014-2020
3 | // MIT License
4 |
5 | #include
6 | #include
7 |
8 | TEST_CASE("JsonDocument::containsKey()") {
9 | DynamicJsonDocument doc(4096);
10 |
11 | SECTION("returns true on object") {
12 | doc["hello"] = "world";
13 |
14 | REQUIRE(doc.containsKey("hello") == true);
15 | }
16 |
17 | SECTION("returns true when value is null") {
18 | doc["hello"] = static_cast(0);
19 |
20 | REQUIRE(doc.containsKey("hello") == true);
21 | }
22 |
23 | SECTION("returns true when key is a std::string") {
24 | doc["hello"] = "world";
25 |
26 | REQUIRE(doc.containsKey(std::string("hello")) == true);
27 | }
28 |
29 | SECTION("returns false on object") {
30 | doc["world"] = "hello";
31 |
32 | REQUIRE(doc.containsKey("hello") == false);
33 | }
34 |
35 | SECTION("returns false on array") {
36 | doc.add("hello");
37 |
38 | REQUIRE(doc.containsKey("hello") == false);
39 | }
40 |
41 | SECTION("returns false on null") {
42 | REQUIRE(doc.containsKey("hello") == false);
43 | }
44 | }
45 |
--------------------------------------------------------------------------------
/libraries/ArduinoJson/extras/tests/JsonDocument/isNull.cpp:
--------------------------------------------------------------------------------
1 | // ArduinoJson - arduinojson.org
2 | // Copyright Benoit Blanchon 2014-2020
3 | // MIT License
4 |
5 | #include
6 | #include
7 |
8 | TEST_CASE("JsonDocument::isNull()") {
9 | DynamicJsonDocument doc(4096);
10 |
11 | SECTION("returns true if uninitialized") {
12 | REQUIRE(doc.isNull() == true);
13 | }
14 |
15 | SECTION("returns false after to()") {
16 | doc.to();
17 | REQUIRE(doc.isNull() == false);
18 | }
19 |
20 | SECTION("returns false after to()") {
21 | doc.to();
22 | REQUIRE(doc.isNull() == false);
23 | }
24 |
25 | SECTION("returns true after to()") {
26 | REQUIRE(doc.isNull() == true);
27 | }
28 |
29 | SECTION("returns false after set()") {
30 | doc.to().set(42);
31 | REQUIRE(doc.isNull() == false);
32 | }
33 |
34 | SECTION("returns true after clear()") {
35 | doc.to();
36 | doc.clear();
37 | REQUIRE(doc.isNull() == true);
38 | }
39 | }
40 |
--------------------------------------------------------------------------------
/libraries/ArduinoJson/extras/tests/JsonDocument/nesting.cpp:
--------------------------------------------------------------------------------
1 | // ArduinoJson - arduinojson.org
2 | // Copyright Benoit Blanchon 2014-2020
3 | // MIT License
4 |
5 | #include
6 | #include
7 |
8 | TEST_CASE("JsonDocument::nesting()") {
9 | DynamicJsonDocument doc(4096);
10 |
11 | SECTION("return 0 if uninitialized") {
12 | REQUIRE(doc.nesting() == 0);
13 | }
14 |
15 | SECTION("returns 0 for string") {
16 | JsonVariant var = doc.to();
17 | var.set("hello");
18 | REQUIRE(doc.nesting() == 0);
19 | }
20 |
21 | SECTION("returns 1 for empty object") {
22 | doc.to();
23 | REQUIRE(doc.nesting() == 1);
24 | }
25 |
26 | SECTION("returns 1 for empty array") {
27 | doc.to();
28 | REQUIRE(doc.nesting() == 1);
29 | }
30 | }
31 |
--------------------------------------------------------------------------------
/libraries/ArduinoJson/extras/tests/JsonDocument/remove.cpp:
--------------------------------------------------------------------------------
1 | // ArduinoJson - arduinojson.org
2 | // Copyright Benoit Blanchon 2014-2020
3 | // MIT License
4 |
5 | #include
6 | #include
7 |
8 | TEST_CASE("JsonDocument::remove()") {
9 | DynamicJsonDocument doc(4096);
10 |
11 | SECTION("remove(int)") {
12 | doc.add(1);
13 | doc.add(2);
14 | doc.add(3);
15 |
16 | doc.remove(1);
17 |
18 | REQUIRE(doc.as() == "[1,3]");
19 | }
20 |
21 | SECTION("remove(const char *)") {
22 | doc["a"] = 1;
23 | doc["b"] = 2;
24 |
25 | doc.remove("a");
26 |
27 | REQUIRE(doc.as() == "{\"b\":2}");
28 | }
29 |
30 | SECTION("remove(std::string)") {
31 | doc["a"] = 1;
32 | doc["b"] = 2;
33 |
34 | doc.remove(std::string("b"));
35 |
36 | REQUIRE(doc.as() == "{\"a\":1}");
37 | }
38 |
39 | #ifdef HAS_VARIABLE_LENGTH_ARRAY
40 | SECTION("remove(vla)") {
41 | doc["a"] = 1;
42 | doc["b"] = 2;
43 |
44 | int i = 4;
45 | char vla[i];
46 | strcpy(vla, "b");
47 | doc.remove(vla);
48 |
49 | REQUIRE(doc.as() == "{\"a\":1}");
50 | }
51 | #endif
52 | }
53 |
--------------------------------------------------------------------------------
/libraries/ArduinoJson/extras/tests/JsonDocument/size.cpp:
--------------------------------------------------------------------------------
1 | // ArduinoJson - arduinojson.org
2 | // Copyright Benoit Blanchon 2014-2020
3 | // MIT License
4 |
5 | #include
6 | #include
7 |
8 | TEST_CASE("JsonDocument::size()") {
9 | DynamicJsonDocument doc(4096);
10 |
11 | SECTION("returns 0") {
12 | REQUIRE(doc.size() == 0);
13 | }
14 |
15 | SECTION("as an array, return 2") {
16 | doc.add(1);
17 | doc.add(2);
18 |
19 | REQUIRE(doc.size() == 2);
20 | }
21 |
22 | SECTION("as an object, return 2") {
23 | doc["a"] = 1;
24 | doc["b"] = 2;
25 |
26 | REQUIRE(doc.size() == 2);
27 | }
28 | }
29 |
--------------------------------------------------------------------------------
/libraries/ArduinoJson/extras/tests/JsonObject/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | # ArduinoJson - arduinojson.org
2 | # Copyright Benoit Blanchon 2014-2020
3 | # MIT License
4 |
5 | add_executable(JsonObjectTests
6 | containsKey.cpp
7 | copy.cpp
8 | createNestedArray.cpp
9 | createNestedObject.cpp
10 | equals.cpp
11 | invalid.cpp
12 | isNull.cpp
13 | iterator.cpp
14 | memoryUsage.cpp
15 | nesting.cpp
16 | remove.cpp
17 | size.cpp
18 | std_string.cpp
19 | subscript.cpp
20 | )
21 |
22 | target_link_libraries(JsonObjectTests
23 | ArduinoJson
24 | catch
25 | )
26 |
27 | add_test(JsonObject JsonObjectTests)
28 |
--------------------------------------------------------------------------------
/libraries/ArduinoJson/extras/tests/JsonObject/containsKey.cpp:
--------------------------------------------------------------------------------
1 | // ArduinoJson - arduinojson.org
2 | // Copyright Benoit Blanchon 2014-2020
3 | // MIT License
4 |
5 | #include
6 | #include
7 |
8 | TEST_CASE("JsonObject::containsKey()") {
9 | DynamicJsonDocument doc(4096);
10 | JsonObject obj = doc.to();
11 | obj["hello"] = 42;
12 |
13 | SECTION("returns true only if key is present") {
14 | REQUIRE(false == obj.containsKey("world"));
15 | REQUIRE(true == obj.containsKey("hello"));
16 | }
17 |
18 | SECTION("works with JsonObjectConst") {
19 | JsonObjectConst cobj = obj;
20 | REQUIRE(false == cobj.containsKey("world"));
21 | REQUIRE(true == cobj.containsKey("hello"));
22 | }
23 |
24 | SECTION("returns false after remove()") {
25 | obj.remove("hello");
26 |
27 | REQUIRE(false == obj.containsKey("hello"));
28 | }
29 |
30 | #ifdef HAS_VARIABLE_LENGTH_ARRAY
31 | SECTION("key is a VLA") {
32 | int i = 16;
33 | char vla[i];
34 | strcpy(vla, "hello");
35 |
36 | REQUIRE(true == obj.containsKey(vla));
37 | }
38 | #endif
39 | }
40 |
--------------------------------------------------------------------------------
/libraries/ArduinoJson/extras/tests/JsonObject/createNestedArray.cpp:
--------------------------------------------------------------------------------
1 | // ArduinoJson - arduinojson.org
2 | // Copyright Benoit Blanchon 2014-2020
3 | // MIT License
4 |
5 | #include
6 | #include
7 |
8 | TEST_CASE("JsonObject::createNestedArray()") {
9 | DynamicJsonDocument doc(4096);
10 | JsonObject obj = doc.to();
11 |
12 | SECTION("key is a const char*") {
13 | JsonArray arr = obj.createNestedArray("hello");
14 | REQUIRE(arr.isNull() == false);
15 | }
16 |
17 | #ifdef HAS_VARIABLE_LENGTH_ARRAY
18 | SECTION("key is a VLA") {
19 | int i = 16;
20 | char vla[i];
21 | strcpy(vla, "hello");
22 |
23 | JsonArray arr = obj.createNestedArray(vla);
24 | REQUIRE(arr.isNull() == false);
25 | }
26 | #endif
27 | }
28 |
--------------------------------------------------------------------------------
/libraries/ArduinoJson/extras/tests/JsonObject/createNestedObject.cpp:
--------------------------------------------------------------------------------
1 | // ArduinoJson - arduinojson.org
2 | // Copyright Benoit Blanchon 2014-2020
3 | // MIT License
4 |
5 | #include
6 | #include
7 |
8 | TEST_CASE("JsonObject::createNestedObject()") {
9 | DynamicJsonDocument doc(4096);
10 | JsonObject obj = doc.to();
11 |
12 | SECTION("key is a const char*") {
13 | obj.createNestedObject("hello");
14 | }
15 |
16 | #ifdef HAS_VARIABLE_LENGTH_ARRAY
17 | SECTION("key is a VLA") {
18 | int i = 16;
19 | char vla[i];
20 | strcpy(vla, "hello");
21 |
22 | obj.createNestedObject(vla);
23 | }
24 | #endif
25 | }
26 |
--------------------------------------------------------------------------------
/libraries/ArduinoJson/extras/tests/JsonObject/invalid.cpp:
--------------------------------------------------------------------------------
1 | // ArduinoJson - arduinojson.org
2 | // Copyright Benoit Blanchon 2014-2020
3 | // MIT License
4 |
5 | #include
6 | #include
7 |
8 | using namespace Catch::Matchers;
9 |
10 | TEST_CASE("JsonObject::invalid()") {
11 | JsonObject obj;
12 |
13 | SECTION("SubscriptFails") {
14 | REQUIRE(obj["key"].isNull());
15 | }
16 |
17 | SECTION("AddFails") {
18 | obj["hello"] = "world";
19 | REQUIRE(0 == obj.size());
20 | }
21 |
22 | SECTION("CreateNestedArrayFails") {
23 | REQUIRE(obj.createNestedArray("hello").isNull());
24 | }
25 |
26 | SECTION("CreateNestedObjectFails") {
27 | REQUIRE(obj.createNestedObject("world").isNull());
28 | }
29 |
30 | SECTION("serialize to 'null'") {
31 | char buffer[32];
32 | serializeJson(obj, buffer, sizeof(buffer));
33 | REQUIRE_THAT(buffer, Equals("null"));
34 | }
35 | }
36 |
--------------------------------------------------------------------------------
/libraries/ArduinoJson/extras/tests/JsonObject/memoryUsage.cpp:
--------------------------------------------------------------------------------
1 | // ArduinoJson - arduinojson.org
2 | // Copyright Benoit Blanchon 2014-2020
3 | // MIT License
4 |
5 | #include
6 | #include
7 | #include
8 |
9 | TEST_CASE("JsonObject::memoryUsage()") {
10 | DynamicJsonDocument doc(4096);
11 | JsonObject obj = doc.to();
12 |
13 | SECTION("return 0 if uninitialized") {
14 | JsonObject unitialized;
15 | REQUIRE(unitialized.memoryUsage() == 0);
16 | }
17 |
18 | SECTION("JSON_OBJECT_SIZE(0) for empty object") {
19 | REQUIRE(obj.memoryUsage() == JSON_OBJECT_SIZE(0));
20 | }
21 |
22 | SECTION("JSON_OBJECT_SIZE(1) after add") {
23 | obj["hello"] = 42;
24 | REQUIRE(obj.memoryUsage() == JSON_OBJECT_SIZE(1));
25 | }
26 |
27 | SECTION("includes the size of the key") {
28 | obj[std::string("hello")] = 42;
29 | REQUIRE(obj.memoryUsage() == JSON_OBJECT_SIZE(1) + 6);
30 | }
31 |
32 | SECTION("includes the size of the nested array") {
33 | JsonArray nested = obj.createNestedArray("nested");
34 | nested.add(42);
35 | REQUIRE(obj.memoryUsage() == JSON_OBJECT_SIZE(1) + JSON_ARRAY_SIZE(1));
36 | }
37 |
38 | SECTION("includes the size of the nested object") {
39 | JsonObject nested = obj.createNestedObject("nested");
40 | nested["hello"] = "world";
41 | REQUIRE(obj.memoryUsage() == 2 * JSON_OBJECT_SIZE(1));
42 | }
43 | }
44 |
--------------------------------------------------------------------------------
/libraries/ArduinoJson/extras/tests/JsonObject/nesting.cpp:
--------------------------------------------------------------------------------
1 | // ArduinoJson - arduinojson.org
2 | // Copyright Benoit Blanchon 2014-2020
3 | // MIT License
4 |
5 | #include
6 | #include
7 |
8 | TEST_CASE("JsonObject::nesting()") {
9 | DynamicJsonDocument doc(4096);
10 | JsonObject obj = doc.to();
11 |
12 | SECTION("return 0 if uninitialized") {
13 | JsonObject unitialized;
14 | REQUIRE(unitialized.nesting() == 0);
15 | }
16 |
17 | SECTION("returns 1 for empty object") {
18 | REQUIRE(obj.nesting() == 1);
19 | }
20 |
21 | SECTION("returns 1 for flat object") {
22 | obj["hello"] = "world";
23 | REQUIRE(obj.nesting() == 1);
24 | }
25 |
26 | SECTION("returns 2 with nested array") {
27 | obj.createNestedArray("nested");
28 | REQUIRE(obj.nesting() == 2);
29 | }
30 |
31 | SECTION("returns 2 with nested object") {
32 | obj.createNestedObject("nested");
33 | REQUIRE(obj.nesting() == 2);
34 | }
35 | }
36 |
--------------------------------------------------------------------------------
/libraries/ArduinoJson/extras/tests/JsonObject/size.cpp:
--------------------------------------------------------------------------------
1 | // ArduinoJson - arduinojson.org
2 | // Copyright Benoit Blanchon 2014-2020
3 | // MIT License
4 |
5 | #include
6 | #include
7 | #include
8 |
9 | TEST_CASE("JsonObject::size()") {
10 | DynamicJsonDocument doc(4096);
11 | JsonObject obj = doc.to();
12 |
13 | SECTION("initial size is zero") {
14 | REQUIRE(0 == obj.size());
15 | }
16 |
17 | SECTION("increases when values are added") {
18 | obj["hello"] = 42;
19 | REQUIRE(1 == obj.size());
20 | }
21 |
22 | SECTION("decreases when values are removed") {
23 | obj["hello"] = 42;
24 | obj.remove("hello");
25 | REQUIRE(0 == obj.size());
26 | }
27 |
28 | SECTION("doesn't increase when the same key is added twice") {
29 | obj["hello"] = 1;
30 | obj["hello"] = 2;
31 | REQUIRE(1 == obj.size());
32 | }
33 |
34 | SECTION("doesn't decrease when another key is removed") {
35 | obj["hello"] = 1;
36 | obj.remove("world");
37 | REQUIRE(1 == obj.size());
38 | }
39 | }
40 |
--------------------------------------------------------------------------------
/libraries/ArduinoJson/extras/tests/JsonSerializer/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | # ArduinoJson - arduinojson.org
2 | # Copyright Benoit Blanchon 2014-2020
3 | # MIT License
4 |
5 | add_executable(JsonSerializerTests
6 | CustomWriter.cpp
7 | JsonArray.cpp
8 | JsonArrayPretty.cpp
9 | JsonObject.cpp
10 | JsonObjectPretty.cpp
11 | JsonVariant.cpp
12 | misc.cpp
13 | std_stream.cpp
14 | std_string.cpp
15 | )
16 |
17 | target_link_libraries(JsonSerializerTests
18 | ArduinoJson
19 | catch
20 | )
21 |
22 | add_test(JsonSerializer JsonSerializerTests)
23 |
--------------------------------------------------------------------------------
/libraries/ArduinoJson/extras/tests/JsonSerializer/CustomWriter.cpp:
--------------------------------------------------------------------------------
1 | // ArduinoJson - arduinojson.org
2 | // Copyright Benoit Blanchon 2014-2020
3 | // MIT License
4 |
5 | #include
6 | #include
7 |
8 | class CustomWriter {
9 | public:
10 | CustomWriter() {}
11 |
12 | size_t write(uint8_t c) {
13 | _str.append(1, static_cast(c));
14 | return 1;
15 | }
16 |
17 | size_t write(const uint8_t *s, size_t n) {
18 | _str.append(reinterpret_cast(s), n);
19 | return n;
20 | }
21 |
22 | const std::string &str() const {
23 | return _str;
24 | }
25 |
26 | private:
27 | CustomWriter(const CustomWriter &); // non-copiable
28 | CustomWriter &operator=(const CustomWriter &);
29 |
30 | std::string _str;
31 | };
32 |
33 | TEST_CASE("CustomWriter") {
34 | DynamicJsonDocument doc(4096);
35 | JsonArray array = doc.to();
36 | array.add(4);
37 | array.add(2);
38 |
39 | SECTION("serializeJson()") {
40 | CustomWriter writer;
41 | serializeJson(array, writer);
42 |
43 | REQUIRE("[4,2]" == writer.str());
44 | }
45 |
46 | SECTION("serializeJsonPretty") {
47 | CustomWriter writer;
48 | serializeJsonPretty(array, writer);
49 |
50 | REQUIRE("[\r\n 4,\r\n 2\r\n]" == writer.str());
51 | }
52 | }
53 |
--------------------------------------------------------------------------------
/libraries/ArduinoJson/extras/tests/JsonSerializer/misc.cpp:
--------------------------------------------------------------------------------
1 | #include
2 | #include
3 | #include
4 |
5 | TEST_CASE("serializeJson(MemberProxy)") {
6 | DynamicJsonDocument doc(4096);
7 | deserializeJson(doc, "{\"hello\":42}");
8 | JsonObject obj = doc.as();
9 | std::string result;
10 |
11 | serializeJson(obj["hello"], result);
12 |
13 | REQUIRE(result == "42");
14 | }
15 |
16 | TEST_CASE("serializeJson(ElementProxy)") {
17 | DynamicJsonDocument doc(4096);
18 | deserializeJson(doc, "[42]");
19 | JsonArray arr = doc.as();
20 | std::string result;
21 |
22 | serializeJson(arr[0], result);
23 |
24 | REQUIRE(result == "42");
25 | }
26 |
27 | TEST_CASE("serializeJson(JsonVariantSubscript)") {
28 | DynamicJsonDocument doc(4096);
29 | deserializeJson(doc, "[42]");
30 | JsonVariant var = doc.as();
31 | std::string result;
32 |
33 | serializeJson(var[0], result);
34 |
35 | REQUIRE(result == "42");
36 | }
37 |
--------------------------------------------------------------------------------
/libraries/ArduinoJson/extras/tests/JsonSerializer/std_string.cpp:
--------------------------------------------------------------------------------
1 | // ArduinoJson - arduinojson.org
2 | // Copyright Benoit Blanchon 2014-2020
3 | // MIT License
4 |
5 | #include
6 | #include
7 |
8 | TEST_CASE("serialize JsonArray to std::string") {
9 | DynamicJsonDocument doc(4096);
10 | JsonArray array = doc.to();
11 | array.add(4);
12 | array.add(2);
13 |
14 | SECTION("serializeJson()") {
15 | std::string json;
16 | serializeJson(array, json);
17 |
18 | REQUIRE("[4,2]" == json);
19 | }
20 |
21 | SECTION("serializeJsonPretty") {
22 | std::string json;
23 | serializeJsonPretty(array, json);
24 |
25 | REQUIRE("[\r\n 4,\r\n 2\r\n]" == json);
26 | }
27 | }
28 |
29 | TEST_CASE("serialize JsonObject to std::string") {
30 | DynamicJsonDocument doc(4096);
31 | JsonObject obj = doc.to();
32 | obj["key"] = "value";
33 |
34 | SECTION("object") {
35 | std::string json;
36 | serializeJson(doc, json);
37 |
38 | REQUIRE("{\"key\":\"value\"}" == json);
39 | }
40 |
41 | SECTION("serializeJsonPretty") {
42 | std::string json;
43 | serializeJsonPretty(doc, json);
44 |
45 | REQUIRE("{\r\n \"key\": \"value\"\r\n}" == json);
46 | }
47 | }
48 |
--------------------------------------------------------------------------------
/libraries/ArduinoJson/extras/tests/JsonVariant/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | # ArduinoJson - arduinojson.org
2 | # Copyright Benoit Blanchon 2014-2020
3 | # MIT License
4 |
5 | add_executable(JsonVariantTests
6 | add.cpp
7 | as.cpp
8 | clear.cpp
9 | compare.cpp
10 | containsKey.cpp
11 | copy.cpp
12 | createNested.cpp
13 | is.cpp
14 | isnull.cpp
15 | memoryUsage.cpp
16 | misc.cpp
17 | nesting.cpp
18 | or.cpp
19 | overflow.cpp
20 | remove.cpp
21 | set.cpp
22 | subscript.cpp
23 | types.cpp
24 | undefined.cpp
25 | )
26 |
27 | target_link_libraries(JsonVariantTests
28 | ArduinoJson
29 | catch
30 | )
31 |
32 | add_test(JsonVariant JsonVariantTests)
33 |
--------------------------------------------------------------------------------
/libraries/ArduinoJson/extras/tests/JsonVariant/add.cpp:
--------------------------------------------------------------------------------
1 | // ArduinoJson - arduinojson.org
2 | // Copyright Benoit Blanchon 2014-2020
3 | // MIT License
4 |
5 | #include
6 | #include
7 | #include
8 |
9 | TEST_CASE("JsonVariant::add()") {
10 | DynamicJsonDocument doc(4096);
11 | JsonVariant var = doc.to();
12 |
13 | SECTION("integer") {
14 | var.add(42);
15 |
16 | REQUIRE(var.as() == "[42]");
17 | }
18 |
19 | SECTION("const char*") {
20 | var.add("hello");
21 |
22 | REQUIRE(var.as() == "[\"hello\"]");
23 | }
24 |
25 | SECTION("std::string") {
26 | var.add(std::string("hello"));
27 |
28 | REQUIRE(var.as() == "[\"hello\"]");
29 | }
30 | }
31 |
--------------------------------------------------------------------------------
/libraries/ArduinoJson/extras/tests/JsonVariant/clear.cpp:
--------------------------------------------------------------------------------
1 | // ArduinoJson - arduinojson.org
2 | // Copyright Benoit Blanchon 2014-2020
3 | // MIT License
4 |
5 | #include
6 | #include
7 | #include
8 |
9 | TEST_CASE("JsonVariant::clear()") {
10 | DynamicJsonDocument doc(4096);
11 | JsonVariant var = doc.to();
12 |
13 | SECTION("size goes back to zero") {
14 | var.add(42);
15 | var.clear();
16 |
17 | REQUIRE(var.size() == 0);
18 | }
19 |
20 | SECTION("isNull() return true") {
21 | var.add("hello");
22 | var.clear();
23 |
24 | REQUIRE(var.isNull() == true);
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/libraries/ArduinoJson/extras/tests/JsonVariant/containsKey.cpp:
--------------------------------------------------------------------------------
1 | // ArduinoJson - arduinojson.org
2 | // Copyright Benoit Blanchon 2014-2020
3 | // MIT License
4 |
5 | #include
6 | #include
7 | #include
8 |
9 | static const char* null = 0;
10 |
11 | TEST_CASE("JsonVariant::containsKey()") {
12 | DynamicJsonDocument doc(4096);
13 | JsonVariant var = doc.to();
14 |
15 | SECTION("containsKey(const char*) returns true") {
16 | var["hello"] = "world";
17 |
18 | REQUIRE(var.containsKey("hello") == true);
19 | REQUIRE(var.containsKey("world") == false);
20 | }
21 |
22 | SECTION("containsKey(std::string) returns true") {
23 | var["hello"] = "world";
24 |
25 | REQUIRE(var.containsKey(std::string("hello")) == true);
26 | REQUIRE(var.containsKey(std::string("world")) == false);
27 | }
28 | }
29 |
30 | TEST_CASE("JsonVariantConst::containsKey()") {
31 | DynamicJsonDocument doc(4096);
32 | doc["hello"] = "world";
33 | JsonVariantConst cvar = doc.as();
34 |
35 | SECTION("containsKey(const char*) returns true") {
36 | REQUIRE(cvar.containsKey("hello") == true);
37 | REQUIRE(cvar.containsKey("world") == false);
38 | }
39 |
40 | SECTION("containsKey(std::string) returns true") {
41 | REQUIRE(cvar.containsKey(std::string("hello")) == true);
42 | REQUIRE(cvar.containsKey(std::string("world")) == false);
43 | }
44 | }
45 |
--------------------------------------------------------------------------------
/libraries/ArduinoJson/extras/tests/JsonVariant/memoryUsage.cpp:
--------------------------------------------------------------------------------
1 | // ArduinoJson - arduinojson.org
2 | // Copyright Benoit Blanchon 2014-2020
3 | // MIT License
4 |
5 | #include
6 | #include
7 | #include
8 |
9 | TEST_CASE("JsonVariant::memoryUsage()") {
10 | DynamicJsonDocument doc(4096);
11 | JsonVariant var = doc.to();
12 |
13 | SECTION("returns 0 if uninitialized") {
14 | JsonVariant unitialized;
15 | REQUIRE(unitialized.memoryUsage() == 0);
16 | }
17 |
18 | SECTION("returns size of object") {
19 | JsonObject obj = var.to();
20 | obj["hello"] = 42;
21 | REQUIRE(var.memoryUsage() == JSON_OBJECT_SIZE(1));
22 | }
23 |
24 | SECTION("returns size of array") {
25 | JsonArray arr = var.to();
26 | arr.add(42);
27 | REQUIRE(var.memoryUsage() == JSON_ARRAY_SIZE(1));
28 | }
29 |
30 | SECTION("returns size of owned string") {
31 | var.set(std::string("hello"));
32 | REQUIRE(var.memoryUsage() == 6);
33 | }
34 |
35 | SECTION("returns size of owned raw") {
36 | var.set(serialized(std::string("hello")));
37 | REQUIRE(var.memoryUsage() == 5);
38 | }
39 | }
40 |
--------------------------------------------------------------------------------
/libraries/ArduinoJson/extras/tests/JsonVariant/misc.cpp:
--------------------------------------------------------------------------------
1 | // ArduinoJson - arduinojson.org
2 | // Copyright Benoit Blanchon 2014-2020
3 | // MIT License
4 |
5 | #include
6 | #include
7 |
8 | TEST_CASE("JsonVariant from JsonArray") {
9 | SECTION("JsonArray is null") {
10 | JsonArray arr;
11 | JsonVariant v = arr;
12 | REQUIRE(v.isNull() == true);
13 | }
14 |
15 | SECTION("JsonArray is not null") {
16 | DynamicJsonDocument doc(4096);
17 | JsonArray arr = doc.to();
18 | arr.add(12);
19 | arr.add(34);
20 |
21 | JsonVariant v = arr;
22 |
23 | REQUIRE(v.is() == true);
24 | REQUIRE(v.size() == 2);
25 | REQUIRE(v[0] == 12);
26 | REQUIRE(v[1] == 34);
27 | }
28 | }
29 |
30 | TEST_CASE("JsonVariant from JsonObject") {
31 | SECTION("JsonObject is null") {
32 | JsonObject obj;
33 | JsonVariant v = obj;
34 | REQUIRE(v.isNull() == true);
35 | }
36 |
37 | SECTION("JsonObject is not null") {
38 | DynamicJsonDocument doc(4096);
39 | JsonObject obj = doc.to();
40 | obj["a"] = 12;
41 | obj["b"] = 34;
42 |
43 | JsonVariant v = obj;
44 |
45 | REQUIRE(v.is() == true);
46 | REQUIRE(v.size() == 2);
47 | REQUIRE(v["a"] == 12);
48 | REQUIRE(v["b"] == 34);
49 | }
50 | }
51 |
--------------------------------------------------------------------------------
/libraries/ArduinoJson/extras/tests/JsonVariant/nesting.cpp:
--------------------------------------------------------------------------------
1 | // ArduinoJson - arduinojson.org
2 | // Copyright Benoit Blanchon 2014-2020
3 | // MIT License
4 |
5 | #include
6 | #include
7 |
8 | TEST_CASE("JsonVariant::nesting()") {
9 | DynamicJsonDocument doc(4096);
10 | JsonVariant var = doc.to();
11 |
12 | SECTION("return 0 if uninitialized") {
13 | JsonVariant unitialized;
14 | REQUIRE(unitialized.nesting() == 0);
15 | }
16 |
17 | SECTION("returns 0 for string") {
18 | var.set("hello");
19 | REQUIRE(var.nesting() == 0);
20 | }
21 |
22 | SECTION("returns 1 for empty object") {
23 | var.to();
24 | REQUIRE(var.nesting() == 1);
25 | }
26 |
27 | SECTION("returns 1 for empty array") {
28 | var.to();
29 | REQUIRE(var.nesting() == 1);
30 | }
31 | }
32 |
--------------------------------------------------------------------------------
/libraries/ArduinoJson/extras/tests/JsonVariant/remove.cpp:
--------------------------------------------------------------------------------
1 | // ArduinoJson - arduinojson.org
2 | // Copyright Benoit Blanchon 2014-2020
3 | // MIT License
4 |
5 | #include
6 | #include
7 | #include
8 |
9 | static const char* null = 0;
10 |
11 | TEST_CASE("JsonVariant::remove()") {
12 | DynamicJsonDocument doc(4096);
13 | JsonVariant var = doc.to();
14 |
15 | SECTION("remove(int)") {
16 | var.add(1);
17 | var.add(2);
18 | var.add(3);
19 |
20 | var.remove(1);
21 |
22 | REQUIRE(var.as() == "[1,3]");
23 | }
24 |
25 | SECTION("remove(const char *)") {
26 | var["a"] = 1;
27 | var["b"] = 2;
28 |
29 | var.remove("a");
30 |
31 | REQUIRE(var.as() == "{\"b\":2}");
32 | }
33 |
34 | SECTION("remove(std::string)") {
35 | var["a"] = 1;
36 | var["b"] = 2;
37 |
38 | var.remove(std::string("b"));
39 |
40 | REQUIRE(var.as() == "{\"a\":1}");
41 | }
42 | }
43 |
--------------------------------------------------------------------------------
/libraries/ArduinoJson/extras/tests/MemberProxy/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | # ArduinoJson - arduinojson.org
2 | # Copyright Benoit Blanchon 2014-2020
3 | # MIT License
4 |
5 | add_executable(MemberProxyTests
6 | add.cpp
7 | clear.cpp
8 | compare.cpp
9 | containsKey.cpp
10 | remove.cpp
11 | set.cpp
12 | size.cpp
13 | subscript.cpp
14 | )
15 |
16 | target_link_libraries(MemberProxyTests
17 | ArduinoJson
18 | catch
19 | )
20 |
21 | add_test(MemberProxy MemberProxyTests)
22 |
--------------------------------------------------------------------------------
/libraries/ArduinoJson/extras/tests/MemberProxy/add.cpp:
--------------------------------------------------------------------------------
1 | // ArduinoJson - arduinojson.org
2 | // Copyright Benoit Blanchon 2014-2020
3 | // MIT License
4 |
5 | #include
6 | #include
7 |
8 | using namespace ARDUINOJSON_NAMESPACE;
9 |
10 | TEST_CASE("MemberProxy::add()") {
11 | DynamicJsonDocument doc(4096);
12 | MemberProxy mp = doc["hello"];
13 |
14 | SECTION("add(int)") {
15 | mp.add(42);
16 |
17 | REQUIRE(doc.as() == "{\"hello\":[42]}");
18 | }
19 |
20 | SECTION("add(const char*)") {
21 | mp.add("world");
22 |
23 | REQUIRE(doc.as() == "{\"hello\":[\"world\"]}");
24 | }
25 | }
26 |
--------------------------------------------------------------------------------
/libraries/ArduinoJson/extras/tests/MemberProxy/clear.cpp:
--------------------------------------------------------------------------------
1 | // ArduinoJson - arduinojson.org
2 | // Copyright Benoit Blanchon 2014-2020
3 | // MIT License
4 |
5 | #include
6 | #include
7 |
8 | using namespace ARDUINOJSON_NAMESPACE;
9 |
10 | TEST_CASE("MemberProxy::clear()") {
11 | DynamicJsonDocument doc(4096);
12 | MemberProxy mp = doc["hello"];
13 |
14 | SECTION("size goes back to zero") {
15 | mp.add(42);
16 | mp.clear();
17 |
18 | REQUIRE(mp.size() == 0);
19 | }
20 |
21 | SECTION("isNull() return true") {
22 | mp.add("hello");
23 | mp.clear();
24 |
25 | REQUIRE(mp.isNull() == true);
26 | }
27 | }
28 |
--------------------------------------------------------------------------------
/libraries/ArduinoJson/extras/tests/MemberProxy/compare.cpp:
--------------------------------------------------------------------------------
1 | // ArduinoJson - arduinojson.org
2 | // Copyright Benoit Blanchon 2014-2020
3 | // MIT License
4 |
5 | #include
6 | #include
7 |
8 | using namespace ARDUINOJSON_NAMESPACE;
9 |
10 | TEST_CASE("MemberProxy::operator==()") {
11 | DynamicJsonDocument doc(4096);
12 |
13 | SECTION("same values") {
14 | doc["key1"] = "value";
15 | doc["key2"] = "value";
16 | REQUIRE(doc["key1"] == doc["key2"]);
17 | REQUIRE_FALSE(doc["key1"] != doc["key2"]);
18 | }
19 |
20 | SECTION("different values") {
21 | doc["key1"] = "value1";
22 | doc["key2"] = "value2";
23 | REQUIRE_FALSE(doc["key1"] == doc["key2"]);
24 | REQUIRE(doc["key1"] != doc["key2"]);
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/libraries/ArduinoJson/extras/tests/MemberProxy/containsKey.cpp:
--------------------------------------------------------------------------------
1 | // ArduinoJson - arduinojson.org
2 | // Copyright Benoit Blanchon 2014-2020
3 | // MIT License
4 |
5 | #include
6 | #include
7 |
8 | using namespace ARDUINOJSON_NAMESPACE;
9 |
10 | TEST_CASE("MemberProxy::containsKey()") {
11 | DynamicJsonDocument doc(4096);
12 | MemberProxy mp = doc["hello"];
13 |
14 | SECTION("containsKey(const char*)") {
15 | mp["key"] = "value";
16 |
17 | REQUIRE(mp.containsKey("key") == true);
18 | REQUIRE(mp.containsKey("key") == true);
19 | }
20 |
21 | SECTION("containsKey(std::string)") {
22 | mp["key"] = "value";
23 |
24 | REQUIRE(mp.containsKey(std::string("key")) == true);
25 | REQUIRE(mp.containsKey(std::string("key")) == true);
26 | }
27 | }
28 |
--------------------------------------------------------------------------------
/libraries/ArduinoJson/extras/tests/MemberProxy/remove.cpp:
--------------------------------------------------------------------------------
1 | // ArduinoJson - arduinojson.org
2 | // Copyright Benoit Blanchon 2014-2020
3 | // MIT License
4 |
5 | #include
6 | #include
7 |
8 | using namespace ARDUINOJSON_NAMESPACE;
9 |
10 | TEST_CASE("MemberProxy::remove()") {
11 | DynamicJsonDocument doc(4096);
12 | MemberProxy mp = doc["hello"];
13 |
14 | SECTION("remove(int)") {
15 | mp.add(1);
16 | mp.add(2);
17 | mp.add(3);
18 |
19 | mp.remove(1);
20 |
21 | REQUIRE(mp.as() == "[1,3]");
22 | }
23 |
24 | SECTION("remove(const char *)") {
25 | mp["a"] = 1;
26 | mp["b"] = 2;
27 |
28 | mp.remove("a");
29 |
30 | REQUIRE(mp.as() == "{\"b\":2}");
31 | }
32 |
33 | SECTION("remove(std::string)") {
34 | mp["a"] = 1;
35 | mp["b"] = 2;
36 |
37 | mp.remove(std::string("b"));
38 |
39 | REQUIRE(mp.as() == "{\"a\":1}");
40 | }
41 |
42 | #ifdef HAS_VARIABLE_LENGTH_ARRAY
43 | SECTION("remove(vla)") {
44 | mp["a"] = 1;
45 | mp["b"] = 2;
46 |
47 | int i = 4;
48 | char vla[i];
49 | strcpy(vla, "b");
50 | mp.remove(vla);
51 |
52 | REQUIRE(mp.as() == "{\"a\":1}");
53 | }
54 | #endif
55 | }
56 |
--------------------------------------------------------------------------------
/libraries/ArduinoJson/extras/tests/MemberProxy/set.cpp:
--------------------------------------------------------------------------------
1 | // ArduinoJson - arduinojson.org
2 | // Copyright Benoit Blanchon 2014-2020
3 | // MIT License
4 |
5 | #include
6 | #include
7 |
8 | using namespace ARDUINOJSON_NAMESPACE;
9 |
10 | TEST_CASE("MemberProxy::set()") {
11 | DynamicJsonDocument doc(4096);
12 | MemberProxy mp = doc["hello"];
13 |
14 | SECTION("set(int)") {
15 | mp.set(42);
16 |
17 | REQUIRE(doc.as() == "{\"hello\":42}");
18 | }
19 |
20 | SECTION("set(const char*)") {
21 | mp.set("world");
22 |
23 | REQUIRE(doc.as() == "{\"hello\":\"world\"}");
24 | }
25 |
26 | SECTION("set(char[])") { // issue #1191
27 | char s[] = "world";
28 | mp.set(s);
29 | strcpy(s, "!!!!!");
30 |
31 | REQUIRE(doc.as() == "{\"hello\":\"world\"}");
32 | }
33 | }
34 |
--------------------------------------------------------------------------------
/libraries/ArduinoJson/extras/tests/MemberProxy/size.cpp:
--------------------------------------------------------------------------------
1 | // ArduinoJson - arduinojson.org
2 | // Copyright Benoit Blanchon 2014-2020
3 | // MIT License
4 |
5 | #include
6 | #include
7 |
8 | using namespace ARDUINOJSON_NAMESPACE;
9 |
10 | TEST_CASE("MemberProxy::size()") {
11 | DynamicJsonDocument doc(4096);
12 | MemberProxy mp = doc["hello"];
13 |
14 | SECTION("returns 0") {
15 | REQUIRE(mp.size() == 0);
16 | }
17 |
18 | SECTION("as an array, return 2") {
19 | mp.add(1);
20 | mp.add(2);
21 |
22 | REQUIRE(mp.size() == 2);
23 | }
24 |
25 | SECTION("as an object, return 2") {
26 | mp["a"] = 1;
27 | mp["b"] = 2;
28 |
29 | REQUIRE(mp.size() == 2);
30 | }
31 | }
32 |
--------------------------------------------------------------------------------
/libraries/ArduinoJson/extras/tests/MemberProxy/subscript.cpp:
--------------------------------------------------------------------------------
1 | // ArduinoJson - arduinojson.org
2 | // Copyright Benoit Blanchon 2014-2020
3 | // MIT License
4 |
5 | #include
6 | #include
7 |
8 | using namespace ARDUINOJSON_NAMESPACE;
9 |
10 | TEST_CASE("MemberProxy::operator[]") {
11 | DynamicJsonDocument doc(4096);
12 | MemberProxy mp = doc["hello"];
13 |
14 | SECTION("set member") {
15 | mp["world"] = 42;
16 |
17 | REQUIRE(doc.as() == "{\"hello\":{\"world\":42}}");
18 | }
19 |
20 | SECTION("set element") {
21 | mp[2] = 42;
22 |
23 | REQUIRE(doc.as() == "{\"hello\":[null,null,42]}");
24 | }
25 | }
26 |
--------------------------------------------------------------------------------
/libraries/ArduinoJson/extras/tests/MemoryPool/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | # ArduinoJson - arduinojson.org
2 | # Copyright Benoit Blanchon 2014-2020
3 | # MIT License
4 |
5 | add_executable(MemoryPoolTests
6 | allocVariant.cpp
7 | allocString.cpp
8 | clear.cpp
9 | size.cpp
10 | StringBuilder.cpp
11 | )
12 |
13 | target_link_libraries(MemoryPoolTests
14 | ArduinoJson
15 | catch
16 | )
17 |
18 | add_test(MemoryPool MemoryPoolTests)
19 |
--------------------------------------------------------------------------------
/libraries/ArduinoJson/extras/tests/MemoryPool/StringBuilder.cpp:
--------------------------------------------------------------------------------
1 | // ArduinoJson - arduinojson.org
2 | // Copyright Benoit Blanchon 2014-2020
3 | // MIT License
4 |
5 | #include
6 | #include
7 | #include
8 |
9 | using namespace ARDUINOJSON_NAMESPACE;
10 |
11 | TEST_CASE("StringBuilder") {
12 | char buffer[4096];
13 |
14 | SECTION("Works when buffer is big enough") {
15 | MemoryPool pool(buffer, addPadding(JSON_STRING_SIZE(6)));
16 |
17 | StringBuilder str(&pool);
18 | str.append("hello");
19 |
20 | REQUIRE(str.complete() == std::string("hello"));
21 | }
22 |
23 | SECTION("Returns null when too small") {
24 | MemoryPool pool(buffer, sizeof(void*));
25 |
26 | StringBuilder str(&pool);
27 | str.append("hello world!");
28 |
29 | REQUIRE(str.complete() == 0);
30 | }
31 |
32 | SECTION("Increases size of memory pool") {
33 | MemoryPool pool(buffer, addPadding(JSON_STRING_SIZE(6)));
34 |
35 | StringBuilder str(&pool);
36 | str.append('h');
37 | str.complete();
38 |
39 | REQUIRE(JSON_STRING_SIZE(2) == pool.size());
40 | }
41 | }
42 |
--------------------------------------------------------------------------------
/libraries/ArduinoJson/extras/tests/MemoryPool/allocVariant.cpp:
--------------------------------------------------------------------------------
1 | // ArduinoJson - arduinojson.org
2 | // Copyright Benoit Blanchon 2014-2020
3 | // MIT License
4 |
5 | #include
6 | #include
7 |
8 | using namespace ARDUINOJSON_NAMESPACE;
9 |
10 | TEST_CASE("MemoryPool::allocVariant()") {
11 | char buffer[4096];
12 |
13 | SECTION("Returns different pointer") {
14 | MemoryPool pool(buffer, sizeof(buffer));
15 |
16 | VariantSlot* s1 = pool.allocVariant();
17 | REQUIRE(s1 != 0);
18 | VariantSlot* s2 = pool.allocVariant();
19 | REQUIRE(s2 != 0);
20 |
21 | REQUIRE(s1 != s2);
22 | }
23 |
24 | SECTION("Returns aligned pointers") {
25 | MemoryPool pool(buffer, sizeof(buffer));
26 |
27 | REQUIRE(isAligned(pool.allocVariant()));
28 | REQUIRE(isAligned(pool.allocVariant()));
29 | }
30 |
31 | SECTION("Returns zero if capacity is 0") {
32 | MemoryPool pool(buffer, 0);
33 |
34 | REQUIRE(pool.allocVariant() == 0);
35 | }
36 |
37 | SECTION("Returns zero if buffer is null") {
38 | MemoryPool pool(0, sizeof(buffer));
39 |
40 | REQUIRE(pool.allocVariant() == 0);
41 | }
42 |
43 | SECTION("Returns zero if capacity is insufficient") {
44 | MemoryPool pool(buffer, sizeof(VariantSlot));
45 |
46 | pool.allocVariant();
47 |
48 | REQUIRE(pool.allocVariant() == 0);
49 | }
50 | }
51 |
--------------------------------------------------------------------------------
/libraries/ArduinoJson/extras/tests/MemoryPool/clear.cpp:
--------------------------------------------------------------------------------
1 | // ArduinoJson - arduinojson.org
2 | // Copyright Benoit Blanchon 2014-2020
3 | // MIT License
4 |
5 | #include
6 | #include
7 |
8 | using namespace ARDUINOJSON_NAMESPACE;
9 |
10 | static const size_t poolCapacity = 512;
11 |
12 | TEST_CASE("MemoryPool::clear()") {
13 | char buffer[poolCapacity];
14 | MemoryPool pool(buffer, sizeof(buffer));
15 |
16 | SECTION("Discards allocated variants") {
17 | pool.allocVariant();
18 |
19 | pool.clear();
20 | REQUIRE(pool.size() == 0);
21 | }
22 |
23 | SECTION("Discards allocated strings") {
24 | pool.allocFrozenString(10);
25 | REQUIRE(pool.size() > 0);
26 |
27 | pool.clear();
28 |
29 | REQUIRE(pool.size() == 0);
30 | }
31 | }
32 |
--------------------------------------------------------------------------------
/libraries/ArduinoJson/extras/tests/Misc/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | # ArduinoJson - arduinojson.org
2 | # Copyright Benoit Blanchon 2014-2020
3 | # MIT License
4 |
5 | add_executable(MiscTests
6 | conflicts.cpp
7 | FloatParts.cpp
8 | Readers.cpp
9 | StringAdapters.cpp
10 | StringWriter.cpp
11 | TypeTraits.cpp
12 | unsigned_char.cpp
13 | Utf8.cpp
14 | Utf16.cpp
15 | version.cpp
16 | )
17 |
18 | target_link_libraries(MiscTests
19 | ArduinoJson
20 | catch
21 | )
22 |
23 | set_target_properties(MiscTests PROPERTIES UNITY_BUILD OFF)
24 |
25 | add_test(Misc MiscTests)
26 |
27 | macro(build_should_fail target)
28 | set_target_properties(${target}
29 | PROPERTIES
30 | EXCLUDE_FROM_ALL TRUE
31 | EXCLUDE_FROM_DEFAULT_BUILD TRUE
32 | )
33 | add_test(
34 | NAME
35 | ${target}
36 | COMMAND
37 | ${CMAKE_COMMAND} --build . --target ${target} --config $
38 | WORKING_DIRECTORY
39 | ${CMAKE_BINARY_DIR}
40 | )
41 | set_tests_properties(${target}
42 |
43 |
44 |
45 | PROPERTIES
46 | WILL_FAIL TRUE)
47 | endmacro()
48 |
49 |
50 | add_executable(Issue978
51 | Issue978.cpp
52 | )
53 | build_should_fail(Issue978)
54 |
55 | add_executable(Issue1189
56 | Issue1189.cpp
57 | )
58 | build_should_fail(Issue1189)
59 |
--------------------------------------------------------------------------------
/libraries/ArduinoJson/extras/tests/Misc/FloatParts.cpp:
--------------------------------------------------------------------------------
1 | // ArduinoJson - arduinojson.org
2 | // Copyright Benoit Blanchon 2014-2020
3 | // MIT License
4 |
5 | #include
6 | #include
7 |
8 | using namespace ARDUINOJSON_NAMESPACE;
9 |
10 | TEST_CASE("FloatParts") {
11 | SECTION("1.7976931348623157E+308") {
12 | FloatParts parts(1.7976931348623157E+308);
13 | REQUIRE(parts.integral == 1);
14 | REQUIRE(parts.decimal == 797693135);
15 | REQUIRE(parts.decimalPlaces == 9);
16 | REQUIRE(parts.exponent == 308);
17 | }
18 |
19 | SECTION("4.94065645841247e-324") {
20 | FloatParts parts(4.94065645841247e-324);
21 | REQUIRE(parts.integral == 4);
22 | REQUIRE(parts.decimal == 940656458);
23 | REQUIRE(parts.decimalPlaces == 9);
24 | REQUIRE(parts.exponent == -324);
25 | }
26 | }
27 |
28 | TEST_CASE("FloatParts") {
29 | SECTION("3.4E+38") {
30 | FloatParts parts(3.4E+38f);
31 | REQUIRE(parts.integral == 3);
32 | REQUIRE(parts.decimal == 4);
33 | REQUIRE(parts.decimalPlaces == 1);
34 | REQUIRE(parts.exponent == 38);
35 | }
36 |
37 | SECTION("1.17549435e−38") {
38 | FloatParts parts(1.17549435e-38f);
39 | REQUIRE(parts.integral == 1);
40 | REQUIRE(parts.decimal == 175494);
41 | REQUIRE(parts.decimalPlaces == 6);
42 | REQUIRE(parts.exponent == -38);
43 | }
44 | }
45 |
--------------------------------------------------------------------------------
/libraries/ArduinoJson/extras/tests/Misc/Issue1189.cpp:
--------------------------------------------------------------------------------
1 | // ArduinoJson - arduinojson.org
2 | // Copyright Benoit Blanchon 2014-2020
3 | // MIT License
4 |
5 | #include
6 |
7 | // a function should not be able to get a JsonDocument by value
8 | void f(JsonDocument) {}
9 |
10 | int main() {
11 | DynamicJsonDocument doc(1024);
12 | f(doc);
13 | }
14 |
--------------------------------------------------------------------------------
/libraries/ArduinoJson/extras/tests/Misc/Issue978.cpp:
--------------------------------------------------------------------------------
1 | // ArduinoJson - arduinojson.org
2 | // Copyright Benoit Blanchon 2014-2020
3 | // MIT License
4 |
5 | #include
6 |
7 | struct Stream {};
8 |
9 | int main() {
10 | Stream* stream = 0;
11 | DynamicJsonDocument doc(1024);
12 | deserializeJson(doc, stream);
13 | }
14 |
--------------------------------------------------------------------------------
/libraries/ArduinoJson/extras/tests/Misc/Utf8.cpp:
--------------------------------------------------------------------------------
1 | // ArduinoJson - arduinojson.org
2 | // Copyright Benoit Blanchon 2014-2020
3 | // MIT License
4 |
5 | #include
6 | #include
7 |
8 | #include
9 |
10 | using namespace ARDUINOJSON_NAMESPACE;
11 |
12 | static void testCodepoint(uint32_t codepoint, std::string expected) {
13 | char buffer[4096];
14 | MemoryPool pool(buffer, 4096);
15 | StringBuilder str(&pool);
16 |
17 | CAPTURE(codepoint);
18 | Utf8::encodeCodepoint(codepoint, str);
19 |
20 | REQUIRE(str.complete() == expected);
21 | }
22 |
23 | TEST_CASE("Utf8::encodeCodepoint()") {
24 | SECTION("U+0000") {
25 | testCodepoint(0x0000, "");
26 | }
27 |
28 | SECTION("U+0001") {
29 | testCodepoint(0x0001, "\x01");
30 | }
31 |
32 | SECTION("U+007F") {
33 | testCodepoint(0x007F, "\x7f");
34 | }
35 |
36 | SECTION("U+0080") {
37 | testCodepoint(0x0080, "\xc2\x80");
38 | }
39 |
40 | SECTION("U+07FF") {
41 | testCodepoint(0x07FF, "\xdf\xbf");
42 | }
43 |
44 | SECTION("U+0800") {
45 | testCodepoint(0x0800, "\xe0\xa0\x80");
46 | }
47 |
48 | SECTION("U+FFFF") {
49 | testCodepoint(0xFFFF, "\xef\xbf\xbf");
50 | }
51 |
52 | SECTION("U+10000") {
53 | testCodepoint(0x10000, "\xf0\x90\x80\x80");
54 | }
55 |
56 | SECTION("U+10FFFF") {
57 | testCodepoint(0x10FFFF, "\xf4\x8f\xbf\xbf");
58 | }
59 | }
60 |
--------------------------------------------------------------------------------
/libraries/ArduinoJson/extras/tests/Misc/conflicts.cpp:
--------------------------------------------------------------------------------
1 | // ArduinoJson - arduinojson.org
2 | // Copyright Benoit Blanchon 2014-2020
3 | // MIT License
4 |
5 | // Include any header that might use the conflicting macros
6 | #include
7 | #include