[
  {
    "path": ".clang-format",
    "content": "# http://clang.llvm.org/docs/ClangFormatStyleOptions.html\n\nBasedOnStyle: Google\nStandard: c++11\nAllowShortFunctionsOnASingleLine: Empty\nIncludeBlocks: Preserve\nIndentPPDirectives: AfterHash\nDerivePointerAlignment: false\n\n# Always break after if to get accurate coverage\nAllowShortIfStatementsOnASingleLine: false\nAllowShortLoopsOnASingleLine: false\n"
  },
  {
    "path": ".devcontainer/clang10/devcontainer.json",
    "content": "{\n\t\"name\": \"Clang 10\",\n\t\"image\": \"conanio/clang10\",\n\t\"runArgs\": [\n\t\t\"--name=ArduinoJson-clang10\"\n\t],\n\t\"customizations\": {\n\t\t\"vscode\": {\n\t\t\t\"extensions\": [\n\t\t\t\t\"ms-vscode.cmake-tools\"\n\t\t\t],\n\t\t\t\"settings\": {\n\t\t\t\t\"cmake.generator\": \"Unix Makefiles\",\n\t\t\t\t\"cmake.buildDirectory\": \"/tmp/build\"\n\t\t\t}\n\t\t}\n\t}\n}\n"
  },
  {
    "path": ".devcontainer/clang11/devcontainer.json",
    "content": "{\n\t\"name\": \"Clang 11\",\n\t\"image\": \"conanio/clang11\",\n\t\"runArgs\": [\n\t\t\"--name=ArduinoJson-clang11\"\n\t],\n\t\"customizations\": {\n\t\t\"vscode\": {\n\t\t\t\"extensions\": [\n\t\t\t\t\"ms-vscode.cmake-tools\"\n\t\t\t],\n\t\t\t\"settings\": {\n\t\t\t\t\"cmake.generator\": \"Unix Makefiles\",\n\t\t\t\t\"cmake.buildDirectory\": \"/tmp/build\"\n\t\t\t}\n\t\t}\n\t}\n}\n"
  },
  {
    "path": ".devcontainer/clang13/Dockerfile",
    "content": "FROM ubuntu:22.04\n\nRUN apt-get update\nRUN apt-get install -y cmake git clang-13 libc++-13-dev libc++abi-13-dev\nENV CC=clang-13 CXX=clang++-13\n"
  },
  {
    "path": ".devcontainer/clang13/devcontainer.json",
    "content": "{\n\t\"name\": \"Clang 13\",\n\t\"build\": {\n\t\t\"dockerfile\": \"Dockerfile\"\n\t},\n\t\"runArgs\": [\n\t\t\"--name=ArduinoJson-clang13\"\n\t],\n\t\"customizations\": {\n\t\t\"vscode\": {\n\t\t\t\"extensions\": [\n\t\t\t\t\"ms-vscode.cmake-tools\"\n\t\t\t],\n\t\t\t\"settings\": {\n\t\t\t\t\"cmake.generator\": \"Unix Makefiles\",\n\t\t\t\t\"cmake.buildDirectory\": \"/tmp/build\"\n\t\t\t}\n\t\t}\n\t}\n}\n"
  },
  {
    "path": ".devcontainer/clang14/Dockerfile",
    "content": "FROM ubuntu:22.04\n\nRUN apt-get update\nRUN apt-get install -y cmake git clang-14 libc++-14-dev libc++abi-14-dev\nENV CC=clang-14 CXX=clang++-14\n"
  },
  {
    "path": ".devcontainer/clang14/devcontainer.json",
    "content": "{\n\t\"name\": \"Clang 14\",\n\t\"build\": {\n\t\t\"dockerfile\": \"Dockerfile\"\n\t},\n\t\"runArgs\": [\n\t\t\"--name=ArduinoJson-clang14\"\n\t],\n\t\"customizations\": {\n\t\t\"vscode\": {\n\t\t\t\"extensions\": [\n\t\t\t\t\"ms-vscode.cmake-tools\"\n\t\t\t],\n\t\t\t\"settings\": {\n\t\t\t\t\"cmake.generator\": \"Unix Makefiles\",\n\t\t\t\t\"cmake.buildDirectory\": \"/tmp/build\"\n\t\t\t}\n\t\t}\n\t}\n}\n"
  },
  {
    "path": ".devcontainer/clang15/Dockerfile",
    "content": "FROM ubuntu:22.04\n\nRUN apt-get update\nRUN apt-get install -y cmake git clang-15 libc++-15-dev libc++abi-15-dev\nENV CC=clang-15 CXX=clang++-15\n"
  },
  {
    "path": ".devcontainer/clang15/devcontainer.json",
    "content": "{\n\t\"name\": \"Clang 15\",\n\t\"build\": {\n\t\t\"dockerfile\": \"Dockerfile\"\n\t},\n\t\"runArgs\": [\n\t\t\"--name=ArduinoJson-clang15\"\n\t],\n\t\"customizations\": {\n\t\t\"vscode\": {\n\t\t\t\"extensions\": [\n\t\t\t\t\"ms-vscode.cmake-tools\"\n\t\t\t],\n\t\t\t\"settings\": {\n\t\t\t\t\"cmake.generator\": \"Unix Makefiles\",\n\t\t\t\t\"cmake.buildDirectory\": \"/tmp/build\"\n\t\t\t}\n\t\t}\n\t}\n}\n"
  },
  {
    "path": ".devcontainer/clang16/Dockerfile",
    "content": "FROM ubuntu:22.04\n\nRUN apt-get update\nRUN apt-get install -y cmake git clang-16 libc++-16-dev libc++abi-16-dev\nENV CC=clang-16 CXX=clang++-16\n"
  },
  {
    "path": ".devcontainer/clang16/devcontainer.json",
    "content": "{\n\t\"name\": \"Clang 16\",\n\t\"build\": {\n\t\t\"dockerfile\": \"Dockerfile\"\n\t},\n\t\"runArgs\": [\n\t\t\"--name=ArduinoJson-clang16\"\n\t],\n\t\"customizations\": {\n\t\t\"vscode\": {\n\t\t\t\"extensions\": [\n\t\t\t\t\"ms-vscode.cmake-tools\"\n\t\t\t],\n\t\t\t\"settings\": {\n\t\t\t\t\"cmake.generator\": \"Unix Makefiles\",\n\t\t\t\t\"cmake.buildDirectory\": \"/tmp/build\"\n\t\t\t}\n\t\t}\n\t}\n}\n"
  },
  {
    "path": ".devcontainer/clang17/Dockerfile",
    "content": "FROM ubuntu:24.04\n\nRUN apt-get update\nRUN apt-get install -y cmake git clang-17 libc++-17-dev libc++abi-17-dev\nENV CC=clang-17 CXX=clang++-17\n"
  },
  {
    "path": ".devcontainer/clang17/devcontainer.json",
    "content": "{\n\t\"name\": \"Clang 17\",\n\t\"build\": {\n\t\t\"dockerfile\": \"Dockerfile\"\n\t},\n\t\"runArgs\": [\n\t\t\"--name=ArduinoJson-clang17\"\n\t],\n\t\"customizations\": {\n\t\t\"vscode\": {\n\t\t\t\"extensions\": [\n\t\t\t\t\"ms-vscode.cmake-tools\"\n\t\t\t],\n\t\t\t\"settings\": {\n\t\t\t\t\"cmake.generator\": \"Unix Makefiles\",\n\t\t\t\t\"cmake.buildDirectory\": \"/tmp/build\"\n\t\t\t}\n\t\t}\n\t}\n}\n"
  },
  {
    "path": ".devcontainer/clang5/devcontainer.json",
    "content": "{\n\t\"name\": \"Clang 5\",\n\t\"image\": \"conanio/clang50\",\n\t\"runArgs\": [\n\t\t\"--name=ArduinoJson-clang5\"\n\t],\n\t\"customizations\": {\n\t\t\"vscode\": {\n\t\t\t\"extensions\": [\n\t\t\t\t\"ms-vscode.cmake-tools\"\n\t\t\t],\n\t\t\t\"settings\": {\n\t\t\t\t\"cmake.generator\": \"Unix Makefiles\",\n\t\t\t\t\"cmake.buildDirectory\": \"/tmp/build\"\n\t\t\t}\n\t\t}\n\t}\n}\n"
  },
  {
    "path": ".devcontainer/clang6/devcontainer.json",
    "content": "{\n\t\"name\": \"Clang 6\",\n\t\"image\": \"conanio/clang60\",\n\t\"runArgs\": [\n\t\t\"--name=ArduinoJson-clang6\"\n\t],\n\t\"customizations\": {\n\t\t\"vscode\": {\n\t\t\t\"extensions\": [\n\t\t\t\t\"ms-vscode.cmake-tools\"\n\t\t\t],\n\t\t\t\"settings\": {\n\t\t\t\t\"cmake.generator\": \"Unix Makefiles\",\n\t\t\t\t\"cmake.buildDirectory\": \"/tmp/build\"\n\t\t\t}\n\t\t}\n\t}\n}\n"
  },
  {
    "path": ".devcontainer/clang7/devcontainer.json",
    "content": "{\n\t\"name\": \"Clang 7\",\n\t\"image\": \"conanio/clang7\",\n\t\"runArgs\": [\n\t\t\"--name=ArduinoJson-clang7\"\n\t],\n\t\"customizations\": {\n\t\t\"vscode\": {\n\t\t\t\"extensions\": [\n\t\t\t\t\"ms-vscode.cmake-tools\"\n\t\t\t],\n\t\t\t\"settings\": {\n\t\t\t\t\"cmake.generator\": \"Unix Makefiles\",\n\t\t\t\t\"cmake.buildDirectory\": \"/tmp/build\"\n\t\t\t}\n\t\t}\n\t}\n}\n"
  },
  {
    "path": ".devcontainer/clang8/devcontainer.json",
    "content": "{\n\t\"name\": \"Clang 8\",\n\t\"image\": \"conanio/clang8\",\n\t\"runArgs\": [\n\t\t\"--name=ArduinoJson-clang8\"\n\t],\n\t\"customizations\": {\n\t\t\"vscode\": {\n\t\t\t\"extensions\": [\n\t\t\t\t\"ms-vscode.cmake-tools\"\n\t\t\t],\n\t\t\t\"settings\": {\n\t\t\t\t\"cmake.generator\": \"Unix Makefiles\",\n\t\t\t\t\"cmake.buildDirectory\": \"/tmp/build\"\n\t\t\t}\n\t\t}\n\t}\n}\n"
  },
  {
    "path": ".devcontainer/clang9/devcontainer.json",
    "content": "{\n\t\"name\": \"Clang 9\",\n\t\"image\": \"conanio/clang9\",\n\t\"runArgs\": [\n\t\t\"--name=ArduinoJson-clang9\"\n\t],\n\t\"customizations\": {\n\t\t\"vscode\": {\n\t\t\t\"extensions\": [\n\t\t\t\t\"ms-vscode.cmake-tools\"\n\t\t\t],\n\t\t\t\"settings\": {\n\t\t\t\t\"cmake.generator\": \"Unix Makefiles\",\n\t\t\t\t\"cmake.buildDirectory\": \"/tmp/build\"\n\t\t\t}\n\t\t}\n\t}\n}\n"
  },
  {
    "path": ".devcontainer/gcc10/devcontainer.json",
    "content": "{\n\t\"name\": \"GCC 10\",\n\t\"image\": \"conanio/gcc10\",\n\t\"runArgs\": [\n\t\t\"--name=ArduinoJson-gcc10\"\n\t],\n\t\"customizations\": {\n\t\t\"vscode\": {\n\t\t\t\"extensions\": [\n\t\t\t\t\"ms-vscode.cmake-tools\"\n\t\t\t],\n\t\t\t\"settings\": {\n\t\t\t\t\"cmake.generator\": \"Unix Makefiles\",\n\t\t\t\t\"cmake.buildDirectory\": \"/tmp/build\"\n\t\t\t}\n\t\t}\n\t}\n}\n"
  },
  {
    "path": ".devcontainer/gcc11/devcontainer.json",
    "content": "{\n\t\"name\": \"GCC 11\",\n\t\"image\": \"conanio/gcc11\",\n\t\"runArgs\": [\n\t\t\"--name=ArduinoJson-gcc11\"\n\t],\n\t\"customizations\": {\n\t\t\"vscode\": {\n\t\t\t\"extensions\": [\n\t\t\t\t\"ms-vscode.cmake-tools\"\n\t\t\t],\n\t\t\t\"settings\": {\n\t\t\t\t\"cmake.generator\": \"Unix Makefiles\",\n\t\t\t\t\"cmake.buildDirectory\": \"/tmp/build\"\n\t\t\t}\n\t\t}\n\t}\n}\n"
  },
  {
    "path": ".devcontainer/gcc12/Dockerfile",
    "content": "FROM ubuntu:22.04\n\nRUN apt-get update\nRUN apt-get install -y cmake git g++-12\n"
  },
  {
    "path": ".devcontainer/gcc12/devcontainer.json",
    "content": "{\n\t\"name\": \"GCC 12\",\n\t\"build\": {\n\t\t\"dockerfile\": \"Dockerfile\",\n\t},\n\t\"runArgs\": [\n\t\t\"--name=ArduinoJson-gcc12\"\n\t],\n\t\"customizations\": {\n\t\t\"vscode\": {\n\t\t\t\"extensions\": [\n\t\t\t\t\"ms-vscode.cmake-tools\"\n\t\t\t],\n\t\t\t\"settings\": {\n\t\t\t\t\"cmake.generator\": \"Unix Makefiles\",\n\t\t\t\t\"cmake.buildDirectory\": \"/tmp/build\"\n\t\t\t}\n\t\t}\n\t}\n}\n"
  },
  {
    "path": ".devcontainer/gcc48/devcontainer.json",
    "content": "{\n\t\"name\": \"GCC 4.8\",\n\t\"image\": \"conanio/gcc48\",\n\t\"runArgs\": [\n\t\t\"--name=ArduinoJson-gcc48\"\n\t],\n\t\"customizations\": {\n\t\t\"vscode\": {\n\t\t\t\"extensions\": [\n\t\t\t\t\"ms-vscode.cmake-tools\",\n\t\t\t\t\"josetr.cmake-language-support-vscode\",\n\t\t\t\t\"ms-vscode.cpptools\"\n\t\t\t],\n\t\t\t\"settings\": {\n\t\t\t\t\"cmake.generator\": \"Unix Makefiles\",\n\t\t\t\t\"cmake.buildDirectory\": \"/tmp/build\"\n\t\t\t}\n\t\t}\n\t}\n}\n"
  },
  {
    "path": ".devcontainer/gcc5/devcontainer.json",
    "content": "{\n\t\"name\": \"GCC 5\",\n\t\"image\": \"conanio/gcc5\",\n\t\"runArgs\": [\n\t\t\"--name=ArduinoJson-gcc5\"\n\t],\n\t\"customizations\": {\n\t\t\"vscode\": {\n\t\t\t\"extensions\": [\n\t\t\t\t\"ms-vscode.cmake-tools\"\n\t\t\t],\n\t\t\t\"settings\": {\n\t\t\t\t\"cmake.generator\": \"Unix Makefiles\",\n\t\t\t\t\"cmake.buildDirectory\": \"/tmp/build\"\n\t\t\t}\n\t\t}\n\t}\n}\n"
  },
  {
    "path": ".devcontainer/gcc6/devcontainer.json",
    "content": "{\n\t\"name\": \"GCC 6\",\n\t\"image\": \"conanio/gcc6\",\n\t\"runArgs\": [\n\t\t\"--name=ArduinoJson-gcc6\"\n\t],\n\t\"customizations\": {\n\t\t\"vscode\": {\n\t\t\t\"extensions\": [\n\t\t\t\t\"ms-vscode.cmake-tools\"\n\t\t\t],\n\t\t\t\"settings\": {\n\t\t\t\t\"cmake.generator\": \"Unix Makefiles\",\n\t\t\t\t\"cmake.buildDirectory\": \"/tmp/build\"\n\t\t\t}\n\t\t}\n\t}\n}\n"
  },
  {
    "path": ".devcontainer/gcc7/devcontainer.json",
    "content": "{\n\t\"name\": \"GCC 7\",\n\t\"image\": \"conanio/gcc7\",\n\t\"runArgs\": [\n\t\t\"--name=ArduinoJson-gcc7\"\n\t],\n\t\"customizations\": {\n\t\t\"vscode\": {\n\t\t\t\"extensions\": [\n\t\t\t\t\"ms-vscode.cmake-tools\"\n\t\t\t],\n\t\t\t\"settings\": {\n\t\t\t\t\"cmake.generator\": \"Unix Makefiles\",\n\t\t\t\t\"cmake.buildDirectory\": \"/tmp/build\"\n\t\t\t}\n\t\t}\n\t}\n}\n"
  },
  {
    "path": ".devcontainer/gcc8/devcontainer.json",
    "content": "{\n\t\"name\": \"GCC 8\",\n\t\"image\": \"conanio/gcc8\",\n\t\"runArgs\": [\n\t\t\"--name=ArduinoJson-gcc8\"\n\t],\n\t\"customizations\": {\n\t\t\"vscode\": {\n\t\t\t\"extensions\": [\n\t\t\t\t\"ms-vscode.cmake-tools\"\n\t\t\t],\n\t\t\t\"settings\": {\n\t\t\t\t\"cmake.generator\": \"Unix Makefiles\",\n\t\t\t\t\"cmake.buildDirectory\": \"/tmp/build\"\n\t\t\t}\n\t\t}\n\t}\n}\n"
  },
  {
    "path": ".devcontainer/gcc9/devcontainer.json",
    "content": "{\n\t\"name\": \"GCC 9\",\n\t\"image\": \"conanio/gcc9\",\n\t\"runArgs\": [\n\t\t\"--name=ArduinoJson-gcc9\"\n\t],\n\t\"customizations\": {\n\t\t\"vscode\": {\n\t\t\t\"extensions\": [\n\t\t\t\t\"ms-vscode.cmake-tools\"\n\t\t\t],\n\t\t\t\"settings\": {\n\t\t\t\t\"cmake.generator\": \"Unix Makefiles\",\n\t\t\t\t\"cmake.buildDirectory\": \"/tmp/build\"\n\t\t\t}\n\t\t}\n\t}\n}\n"
  },
  {
    "path": ".gitattributes",
    "content": "* text=auto\n*.sh text eol=lf\n"
  },
  {
    "path": ".github/FUNDING.yml",
    "content": "github: bblanchon\ncustom:\n  - https://arduinojson.org/book/\n  - https://donate.benoitblanchon.fr/\n"
  },
  {
    "path": ".github/ISSUE_TEMPLATE/bug_report.md",
    "content": "---\nname: 🐛 Bug report\nabout: Report a bug in ArduinoJson\ntitle: ''\nlabels: 'bug'\nassignees: ''\n---\n\n<!-- ⚠️ IMPORTANT ⚠️\nBefore opening a bug report, please use the ArduinoJson Troubleshooter as it may find a solution to your issue; if not, please include the  Troubleshooter's report in the description.\n-->\n\n**Describe the bug**  \nA clear and concise description of what the bug is.\n\n**Troubleshooter report**  \nHere is the report generated by the [ArduinoJson Troubleshooter](https://arduinojson.org/v7/troubleshooter/):  \n[Paste the report here]\n\n**Environment**  \nHere is the environment that I used:\n* Microcontroller: [e.g. ESP8266]\n* Core/runtime: [e.g. ESP8266 core for Arduino v3.0.2]\n* IDE: [e.g. Arduino IDE 1.8.16]\n\n**Reproduction**  \nHere is a small snippet that reproduces the issue.\n\n```c++\nJsonDocument doc;\n\nDeserializationError error = deserializeJson(doc, \"{\\\"hello\\\":\\\"world\\\"}\");\n\n[insert repro code here]\n```\n\n**Compiler output**    \nIf relevant, include the complete compiler output (i.e. not just the line that contains the error.)\n\n\n**Program output**  \nIf relevant, include the repro program output.\n\nExpected output:\n\n```\n[insert expected output here]\n```\n\nActual output:\n\n```\n[insert actual output here]\n```\n"
  },
  {
    "path": ".github/ISSUE_TEMPLATE/config.yml",
    "content": "blank_issues_enabled: true\ncontact_links:\n  - name: 👨‍🏫 ArduinoJson Assistant\n    url: https://arduinojson.org/v7/assistant/\n    about: An online tool that computes memory requirements and generates scaffolding code for your project.\n  - name: 👨‍⚕️ ArduinoJson Troubleshooter\n    url: https://arduinojson.org/v7/troubleshooter/\n    about: An online tool that helps you diagnose the most common issues with ArduinoJson.\n"
  },
  {
    "path": ".github/ISSUE_TEMPLATE/feature_request.md",
    "content": "---\nname: 💡 Feature request\nabout: Suggest an idea for ArduinoJson\ntitle: ''\nlabels: enhancement\nassignees: ''\n---\n\n**Is your feature request related to a problem? Please describe.**  \nA clear and concise description of what the problem is. Ex. I'm always frustrated when [...]\n\n**Describe the solution you'd like**  \nA clear and concise description of what you want to happen.\n\n**Describe alternatives you've considered**  \nA clear and concise description of any alternative solutions or features you've considered.\n\n**Additional context**  \nAdd any other context or screenshots about the feature request here.\n"
  },
  {
    "path": ".github/ISSUE_TEMPLATE/help.md",
    "content": "---\nname: 😭 Help!\nabout: Ask for help\ntitle: ''\nlabels: 'question'\nassignees: ''\n---\n\n<!-- ⚠️ IMPORTANT ⚠️\nBefore asking for help, please use the ArduinoJson Troubleshooter as it may find a solution to your issue; if not, please include the  Troubleshooter's report in the description.\n-->\n\n**Describe the issue**  \nA clear and concise description of what you're trying to do.\nYou don't need to explain every aspect of your project: focus on the problem you're having.\n\n**Troubleshooter report**  \nHere is the report generated by the [ArduinoJson Troubleshooter](https://arduinojson.org/v7/troubleshooter/):  \n[Paste the report here]\n\n**Environment**  \nHere is the environment that I'm using':\n* Microconroller: [e.g. ESP8266]\n* Core/runtime: [e.g. ESP8266 core for Arduino v3.0.2]\n* IDE: [e.g. Arduino IDE 1.8.16]\n\n**Reproduction**  \nHere is a small snippet that demonstrate the problem.\n\n```c++\nJsonDocument doc;\n\nDeserializationError error = deserializeJson(doc, \"{\\\"hello\\\":\\\"world\\\"}\");\n\n// insert code here\n```\n\n**Program output**  \nIf relevant, include the program output.\n\nExpected output:\n\n```\n[insert expected output here]\n```\n\nActual output:\n\n```\n[insert actual output here]\n```\n"
  },
  {
    "path": ".github/workflows/ci.yml",
    "content": "name: Continuous Integration\n\non: [push, pull_request]\n\nconcurrency:\n  group: ${{ github.workflow }}-${{ github.ref }}\n  cancel-in-progress: true\n\njobs:\n  lint:\n    name: Lint\n    runs-on: ubuntu-22.04\n    steps:\n      - name: Install\n        run: sudo apt-get install -y clang-format\n      - name: Checkout\n        uses: actions/checkout@v4\n      - name: Symlinks\n        run: find * -type l -printf \"::error::%p is a symlink. This is forbidden by the Arduino Library Specification.\" -exec false {} +\n      - name: Clang-format\n        run: |\n          find src/ extras/ -name '*.[ch]pp' | xargs clang-format -i --verbose --style=file\n          git diff --exit-code\n      - name: Check URLs\n        run: |\n          grep -hREo \"(http|https)://[a-zA-Z0-9./?=_%:-]*\" src/ | sort -u | while read -r URL\n          do\n            STATUS=$(curl -s -o /dev/null -I -w \"%{http_code}\" \"$URL\")\n            [ \"$STATUS\" -ge 400 ] && echo \"::warning title=HTTP $STATUS::$URL returned $STATUS\"\n          done || true\n\n  gcc:\n    name: GCC\n    needs: lint\n    runs-on: ubuntu-22.04\n    strategy:\n      fail-fast: false\n      matrix:\n        include:\n          - gcc: \"4.8\"\n          - gcc: \"5\"\n          - gcc: \"6\"\n          - gcc: \"7\"\n            cxxflags: -fsanitize=leak -fno-sanitize-recover=all\n          - gcc: \"8\"\n            cxxflags: -fsanitize=undefined -fno-sanitize-recover=all\n          - gcc: \"9\"\n            cxxflags: -fsanitize=address -fno-sanitize-recover=all\n          - gcc: \"10\"\n            cxxflags: -funsigned-char # Issue #1715\n          - gcc: \"11\"\n          - gcc: \"12\"\n    steps:\n      - name: Workaround for actions/runner-images#9491\n        run: sudo sysctl vm.mmap_rnd_bits=28\n\n      - name: Install\n        run: |\n          sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 40976EAF437D05B5 3B4FE6ACC0B21F32\n          sudo add-apt-repository -yn 'deb http://archive.ubuntu.com/ubuntu/ xenial main universe'\n          sudo add-apt-repository -yn 'deb http://archive.ubuntu.com/ubuntu/ bionic main universe'\n          sudo add-apt-repository -yn 'deb http://archive.ubuntu.com/ubuntu/ focal main universe'\n          sudo apt-get update\n          sudo apt-get install -y gcc-${{ matrix.gcc }} g++-${{ matrix.gcc }}\n        timeout-minutes: 5\n\n      - name: Checkout\n        uses: actions/checkout@v4\n        timeout-minutes: 1\n\n      - name: Configure\n        run: cmake -DCMAKE_BUILD_TYPE=Debug .\n        env:\n          CC: gcc-${{ matrix.gcc }}\n          CXX: g++-${{ matrix.gcc }}\n          CXXFLAGS: ${{ matrix.cxxflags }}\n        timeout-minutes: 1\n\n      - name: Build\n        run: cmake --build .\n        timeout-minutes: 10\n\n      - name: Test\n        run: ctest --output-on-failure -C Debug .\n        env:\n          UBSAN_OPTIONS: print_stacktrace=1\n        timeout-minutes: 2\n\n  clang:\n    name: Clang\n    needs: lint\n    strategy:\n      fail-fast: false\n      matrix:\n        include:\n          - clang: \"7\"\n            runner: ubuntu-22.04\n            archive: focal\n          - clang: \"8\"\n            cxxflags: -fsanitize=leak -fno-sanitize-recover=all\n            runner: ubuntu-22.04\n            archive: focal\n          - clang: \"9\"\n            cxxflags: -fsanitize=undefined -fno-sanitize-recover=all\n            runner: ubuntu-22.04\n            archive: focal\n          - clang: \"10\"\n            cxxflags: -fsanitize=address -fno-sanitize-recover=all\n            runner: ubuntu-22.04\n            archive: focal\n          - clang: \"11\"\n            runner: ubuntu-22.04\n          - clang: \"12\"\n            runner: ubuntu-22.04\n          - clang: \"13\"\n            runner: ubuntu-22.04\n          - clang: 14\n          - clang: 15\n          - clang: 16\n          - clang: 17\n          - clang: 18\n          - clang: 19\n    runs-on: ${{ matrix.runner || 'ubuntu-latest' }}\n    steps:\n      - name: Add archive repositories\n        if: matrix.archive\n        run: |\n          sudo gpg --keyserver keyserver.ubuntu.com --recv-keys 3B4FE6ACC0B21F32\n          sudo gpg --export 3B4FE6ACC0B21F32 | sudo tee /etc/apt/trusted.gpg.d/ubuntu-keyring.gpg > /dev/null\n          sudo add-apt-repository -yn 'deb http://archive.ubuntu.com/ubuntu/ ${{ matrix.archive }} main'\n          sudo add-apt-repository -yn 'deb http://archive.ubuntu.com/ubuntu/ ${{ matrix.archive }} universe'\n      - name: Install Clang ${{ matrix.clang }}\n        run: |\n          sudo apt-get update\n          sudo apt-get install -y clang-${{ matrix.clang }}\n      - name: Install libc++ ${{ matrix.clang }}\n        run: sudo apt-get install -y libc++-${{ matrix.clang }}-dev libc++abi-${{ matrix.clang }}-dev\n      - name: Install libunwind ${{ matrix.clang }}\n        if: matrix.clang == 12 # dependency is missing in Ubuntu 22.04\n        run: sudo apt-get install -y libunwind-${{ matrix.clang }}-dev\n      - name: Checkout\n        uses: actions/checkout@v4\n      - name: Configure\n        run: cmake -DCMAKE_BUILD_TYPE=Debug .\n        env:\n          CC: clang-${{ matrix.clang }}\n          CXX: clang++-${{ matrix.clang }}\n          CXXFLAGS: >-\n            ${{ matrix.cxxflags }}\n            ${{ matrix.clang < 11 && '-I/usr/lib/llvm-10/include/c++/v1/' || '' }}\n      - name: Build\n        run: cmake --build .\n      - name: Test\n        run: ctest --output-on-failure -C Debug .\n        env:\n          UBSAN_OPTIONS: print_stacktrace=1\n\n  conf_test:\n    name: Test configuration on Linux\n    needs: [gcc, clang]\n    runs-on: ubuntu-22.04\n    steps:\n      - name: Install\n        run: |\n          sudo apt-get update\n          sudo apt-get install -y g++-multilib gcc-avr avr-libc\n      - name: Checkout\n        uses: actions/checkout@v4\n      - name: AVR\n        run: avr-g++ -std=c++11 -Isrc extras/conf_test/avr.cpp\n      - name: GCC 32-bit\n        run: g++ -std=c++11 -m32 -Isrc extras/conf_test/x86.cpp\n      - name: GCC 64-bit\n        run: g++ -std=c++11 -m64 -Isrc extras/conf_test/x64.cpp\n      - name: Clang 32-bit\n        run: clang++ -std=c++11 -m32 -Isrc extras/conf_test/x86.cpp\n      - name: Clang 64-bit\n        run: clang++ -std=c++11 -m64 -Isrc extras/conf_test/x64.cpp\n\n  conf_test_windows:\n    name: Test configuration on Windows\n    runs-on: windows-2022\n    needs: [gcc, clang]\n    steps:\n      - name: Checkout\n        uses: actions/checkout@v4\n      - name: 32-bit\n        run: |\n          call \"C:\\Program Files\\Microsoft Visual Studio\\2022\\Enterprise\\VC\\Auxiliary\\Build\\vcvars32.bat\"\n          cl /Isrc extras/conf_test/x86.cpp\n        shell: cmd\n      - name: 64-bit\n        run: |\n          call \"C:\\Program Files\\Microsoft Visual Studio\\2022\\Enterprise\\VC\\Auxiliary\\Build\\vcvars64.bat\"\n          cl /Isrc extras/conf_test/x64.cpp\n        shell: cmd\n\n  xcode:\n    name: XCode\n    needs: clang\n    runs-on: macos-26\n    strategy:\n      fail-fast: false\n      matrix:\n        include:\n          - xcode: \"26.0\"\n          - xcode: \"26.1\"\n          - xcode: \"26.2\"\n          - xcode: \"26.3\"\n    steps:\n      - name: Checkout\n        uses: actions/checkout@v4\n      - name: Select XCode version\n        run: sudo xcode-select --switch /Applications/Xcode_${{ matrix.xcode }}.app\n      - name: Configure\n        run: cmake -DCMAKE_BUILD_TYPE=Debug .\n      - name: Build\n        run: cmake --build .\n      - name: Test\n        run: ctest --output-on-failure -C Debug .\n\n  # DISABLED: Running on AppVeyor instead because it supports older versions of the compiler\n  # msvc:\n  #   name: Visual Studio\n  #   strategy:\n  #     fail-fast: false\n  #     matrix:\n  #       include:\n  #         - os: windows-2016\n  #         - os: windows-2019\n  #   runs-on: ${{ matrix.os }}\n  #   steps:\n  #     - name: Checkout\n  #       uses: actions/checkout@v4\n  #     - name: Configure\n  #       run: cmake -DCMAKE_BUILD_TYPE=Debug .\n  #     - name: Build\n  #       run: cmake --build .\n  #     - name: Test\n  #       run: ctest --output-on-failure -C Debug .\n\n  arduino:\n    name: Arduino\n    needs: gcc\n    strategy:\n      fail-fast: false\n      matrix:\n        include:\n          - core: arduino:avr\n            board: arduino:avr:uno\n          - core: arduino:samd\n            board: arduino:samd:mkr1000\n    runs-on: ubuntu-22.04\n    steps:\n      - name: Checkout\n        uses: actions/checkout@v4\n      - name: Install arduino-cli\n        run: curl -fsSL https://raw.githubusercontent.com/arduino/arduino-cli/master/install.sh | BINDIR=/usr/local/bin sh\n      - name: Install core\n        run: arduino-cli core install ${{ matrix.core }}\n      - name: Install libraries\n        run: arduino-cli lib install SD Ethernet\n      - name: Build JsonConfigFile\n        run: arduino-cli compile --library . --warnings all -b ${{ matrix.board }} \"examples/JsonConfigFile/JsonConfigFile.ino\"\n      - name: Build JsonFilterExample\n        run: arduino-cli compile --library . --warnings all -b ${{ matrix.board }} \"examples/JsonFilterExample/JsonFilterExample.ino\"\n      - name: Build JsonGeneratorExample\n        run: arduino-cli compile --library . --warnings all -b ${{ matrix.board }} \"examples/JsonGeneratorExample/JsonGeneratorExample.ino\"\n      - name: Build JsonHttpClient\n        run: arduino-cli compile --library . --warnings all -b ${{ matrix.board }} \"examples/JsonHttpClient/JsonHttpClient.ino\"\n      - name: Build JsonParserExample\n        run: arduino-cli compile --library . --warnings all -b ${{ matrix.board }} \"examples/JsonParserExample/JsonParserExample.ino\"\n      - name: Build JsonServer\n        run: arduino-cli compile --library . --warnings all -b ${{ matrix.board }} \"examples/JsonServer/JsonServer.ino\"\n      - name: Build JsonUdpBeacon\n        run: arduino-cli compile --library . --warnings all -b ${{ matrix.board }} \"examples/JsonUdpBeacon/JsonUdpBeacon.ino\"\n      - name: Build MsgPackParser\n        run: arduino-cli compile --library . --warnings all -b ${{ matrix.board }} \"examples/MsgPackParser/MsgPackParser.ino\"\n      - name: Build ProgmemExample\n        run: arduino-cli compile --library . --warnings all -b ${{ matrix.board }} \"examples/ProgmemExample/ProgmemExample.ino\"\n      - name: Build StringExample\n        run: arduino-cli compile --library . --warnings all -b ${{ matrix.board }} \"examples/StringExample/StringExample.ino\"\n\n  platformio:\n    name: PlatformIO\n    needs: gcc\n    runs-on: ubuntu-latest\n    strategy:\n      fail-fast: false\n      matrix:\n        include:\n          - platform: atmelavr\n            board: leonardo\n            libraries:\n              - SD\n              - Ethernet\n            conf_test: avr\n          - platform: espressif8266\n            board: huzzah\n            conf_test: esp8266\n          - platform: espressif32\n            board: esp32dev\n            libraries:\n              - Ethernet\n            conf_test: esp8266\n          - platform: atmelsam\n            board: mkr1000USB\n            libraries:\n              - SD\n              - Ethernet\n            conf_test: esp8266\n          - platform: teensy\n            board: teensy31\n            conf_test: esp8266\n          - platform: ststm32\n            board: adafruit_feather_f405\n            libraries:\n              - SD\n              - Ethernet\n            conf_test: esp8266\n          - platform: nordicnrf52\n            board: adafruit_feather_nrf52840\n            libraries:\n              - SD\n              - Ethernet\n            conf_test: esp8266\n    steps:\n      - name: Checkout\n        uses: actions/checkout@v4\n      - name: Set up cache for pip\n        uses: actions/cache@v4\n        with:\n          path: ~/.cache/pip\n          key: ${{ runner.os }}-pip\n      - name: Set up Python 3.x\n        uses: actions/setup-python@v5\n        with:\n          python-version: \"3.x\"\n      - name: Install PlatformIO\n        run: pip install platformio\n      - name: Install adafruit-nrfutil\n        if: ${{ matrix.platform == 'nordicnrf52' }}\n        run: pip install adafruit-nrfutil\n      - name: Include Adafruit_TinyUSB.h # https://github.com/adafruit/Adafruit_nRF52_Arduino/issues/653\n        if: ${{ matrix.platform == 'nordicnrf52' }}\n        run: find examples/ -name '*.ino' -exec sed -i 's/\\(#include <ArduinoJson.h>\\)/\\1\\n#include <Adafruit_TinyUSB.h>/' {} +\n      - name: Set up cache for platformio\n        uses: actions/cache@v4\n        with:\n          path: ~/.platformio\n          key: ${{ runner.os }}-platformio-${{ matrix.platform }}\n      - name: Install platform \"${{ matrix.platform }}\"\n        run: platformio platform install ${{ matrix.platform }}\n      - name: Install libraries\n        if: ${{ matrix.libraries }}\n        run: platformio lib install arduino-libraries/${{ join(matrix.libraries, ' arduino-libraries/') }}\n      - name: Test configuration\n        run: platformio ci \"extras/conf_test/${{ matrix.conf_test }}.cpp\" -l '.' -b ${{ matrix.board }}\n        if: ${{ matrix.conf_test }}\n      - name: Build JsonConfigFile\n        run: platformio ci \"examples/JsonConfigFile/JsonConfigFile.ino\" -l '.' -b ${{ matrix.board }}\n      - name: Build JsonFilterExample\n        run: platformio ci \"examples/JsonFilterExample/JsonFilterExample.ino\" -l '.' -b ${{ matrix.board }}\n      - name: Build JsonGeneratorExample\n        run: platformio ci \"examples/JsonGeneratorExample/JsonGeneratorExample.ino\" -l '.' -b ${{ matrix.board }}\n      - name: Build JsonHttpClient\n        run: platformio ci \"examples/JsonHttpClient/JsonHttpClient.ino\" -l '.' -b ${{ matrix.board }}\n      - name: Build JsonParserExample\n        run: platformio ci \"examples/JsonParserExample/JsonParserExample.ino\" -l '.' -b ${{ matrix.board }}\n      - name: Build JsonServer\n        if: ${{ matrix.platform != 'espressif32' }}\n        run: platformio ci \"examples/JsonServer/JsonServer.ino\" -l '.' -b ${{ matrix.board }}\n      - name: Build JsonUdpBeacon\n        run: platformio ci \"examples/JsonUdpBeacon/JsonUdpBeacon.ino\" -l '.' -b ${{ matrix.board }}\n      - name: Build MsgPackParser\n        run: platformio ci \"examples/MsgPackParser/MsgPackParser.ino\" -l '.' -b ${{ matrix.board }}\n      - name: Build ProgmemExample\n        run: platformio ci \"examples/ProgmemExample/ProgmemExample.ino\" -l '.' -b ${{ matrix.board }}\n      - name: Build StringExample\n        run: platformio ci \"examples/StringExample/StringExample.ino\" -l '.' -b ${{ matrix.board }}\n      - name: PlatformIO prune\n        if: ${{ always() }}\n        run: platformio system prune -f\n\n  particle:\n    name: Particle\n    needs: gcc\n    runs-on: ubuntu-latest\n    if: github.event_name == 'push'\n    strategy:\n      fail-fast: false\n      matrix:\n        include:\n          - board: argon\n    steps:\n      - name: Checkout\n        uses: actions/checkout@v4\n      - name: Install Particle CLI\n        run: |\n          bash <( curl -sL https://particle.io/install-cli )\n          echo \"$HOME/bin\" >> $GITHUB_PATH\n      - name: Login to Particle\n        run: particle login -t \"${{ secrets.PARTICLE_TOKEN }}\"\n      - name: Compile\n        run: extras/ci/particle.sh ${{ matrix.board }}\n\n  arm:\n    name: GCC for ARM processor\n    needs: gcc\n    runs-on: ubuntu-22.04\n    steps:\n      - name: Install\n        run: |\n          sudo apt-get update\n          sudo apt-get install -y g++-arm-linux-gnueabihf\n      - name: Checkout\n        uses: actions/checkout@v4\n      - name: Configure\n        run: cmake .\n        env:\n          CC: arm-linux-gnueabihf-gcc\n          CXX: arm-linux-gnueabihf-g++\n      - name: Build\n        run: cmake --build .\n\n  coverage:\n    needs: gcc\n    name: Coverage\n    runs-on: ubuntu-22.04\n    steps:\n      - name: Install\n        run: sudo apt-get install -y lcov ninja-build\n      - name: Checkout\n        uses: actions/checkout@v4\n      - name: Configure\n        run: cmake -G Ninja -DCOVERAGE=true .\n      - name: Build\n        run: ninja\n      - name: Test\n        run: ctest --output-on-failure -LE 'WillFail|Fuzzing' -T test\n      - name: lcov --capture\n        run: lcov --capture --no-external --directory . --output-file coverage.info\n      - name: lcov --remove\n        run: lcov --remove coverage.info \"$(pwd)/extras/*\" --output-file coverage_filtered.info\n      - name: genhtml\n        run: mkdir coverage && genhtml coverage_filtered.info -o coverage -t ArduinoJson\n      - name: Upload HTML report\n        uses: actions/upload-artifact@v4\n        with:\n          name: Coverage report\n          path: coverage\n      - name: Upload to Coveralls\n        uses: coverallsapp/github-action@v2\n        with:\n          github-token: ${{ secrets.GITHUB_TOKEN }}\n          path-to-lcov: coverage_filtered.info\n\n  valgrind:\n    needs: gcc\n    name: Valgrind\n    runs-on: ubuntu-22.04\n    steps:\n      - name: Install\n        run: |\n          sudo apt-get update\n          sudo apt-get install -y valgrind ninja-build\n      - name: Checkout\n        uses: actions/checkout@v4\n      - name: Configure\n        run: cmake -G Ninja -D MEMORYCHECK_COMMAND_OPTIONS=\"--error-exitcode=1 --leak-check=full\"  .\n      - name: Build\n        run: ninja\n      - name: Memcheck\n        run: ctest --output-on-failure -LE WillFail -T memcheck\n        id: memcheck\n      - name: MemoryChecker.*.log\n        run: cat Testing/Temporary/MemoryChecker.*.log > $GITHUB_STEP_SUMMARY\n        if: failure()\n\n  clang-tidy:\n    needs: clang\n    name: Clang-Tidy\n    runs-on: ubuntu-latest\n    steps:\n      - name: Install\n        run: sudo apt-get install -y clang-tidy libc++-dev libc++abi-dev\n      - name: Checkout\n        uses: actions/checkout@v4\n      - name: Configure\n        run: cmake -G Ninja -DCMAKE_CXX_CLANG_TIDY=\"clang-tidy;--warnings-as-errors=*\" -DCMAKE_BUILD_TYPE=Debug .\n        env:\n          CC: clang\n          CXX: clang++\n      - name: Check\n        run: cmake --build . -- -k 0\n\n  amalgamate:\n    needs: gcc\n    name: Amalgamate ArduinoJson.h\n    runs-on: ubuntu-22.04\n    steps:\n      - name: Checkout\n        uses: actions/checkout@v4\n      - name: Setup\n        run: |\n          if [[ $GITHUB_REF == refs/tags/* ]]; then\n            VERSION=${GITHUB_REF#refs/tags/}\n          else\n            VERSION=${GITHUB_SHA::7}\n          fi\n          echo \"ARDUINOJSON_H=ArduinoJson-$VERSION.h\" >> $GITHUB_ENV\n          echo \"ARDUINOJSON_HPP=ArduinoJson-$VERSION.hpp\" >> $GITHUB_ENV\n      - name: Amalgamate ArduinoJson.h\n        run: extras/scripts/build-single-header.sh \"src/ArduinoJson.h\" \"$ARDUINOJSON_H\"\n      - name: Amalgamate ArduinoJson.hpp\n        run: extras/scripts/build-single-header.sh \"src/ArduinoJson.hpp\" \"$ARDUINOJSON_HPP\"\n      - name: Upload artifact\n        uses: actions/upload-artifact@v4\n        with:\n          name: Single headers\n          path: |\n            ${{ env.ARDUINOJSON_H }}\n            ${{ env.ARDUINOJSON_HPP }}\n      - name: Smoke test ArduinoJson.h\n        run: |\n          g++ -x c++ - <<END\n          #include \"$ARDUINOJSON_H\"\n          int main() {\n            JsonDocument doc;\n            deserializeJson(doc, \"{}\");\n          }\n          END\n      - name: Smoke test ArduinoJson.hpp\n        run: |\n          g++ -x c++ - <<END\n          #include \"$ARDUINOJSON_HPP\"\n          int main() {\n            ArduinoJson::JsonDocument doc;\n            deserializeJson(doc, \"{}\");\n          }\n          END\n\n  esp-idf:\n    needs: gcc\n    name: ESP-IDF\n    runs-on: ubuntu-latest\n    steps:\n      - name: Setup cache\n        uses: actions/cache@v4\n        with:\n          path: ~/.espressif\n          key: ${{ runner.os }}-esp-idf\n      - name: Checkout ArduinoJson\n        uses: actions/checkout@v4\n      - name: Checkout ESP-IDF\n        uses: actions/checkout@v4\n        with:\n          repository: espressif/esp-idf\n          path: esp-idf\n          submodules: true\n      - name: Install ESP-IDF\n        run: ./esp-idf/install.sh\n      - name: Add component\n        # NOTE: we cannot commit the symlink because the Arduino Library Specification forbids it.\n        run: |\n          mkdir -p extras/ci/espidf/components\n          ln -s $PWD extras/ci/espidf/components/ArduinoJson\n      - name: Build example\n        run: |\n          source esp-idf/export.sh\n          cd extras/ci/espidf\n          idf.py build\n\n  codeql:\n    name: CodeQL\n    runs-on: ubuntu-22.04\n    needs: gcc\n\n    permissions:\n      actions: read\n      contents: read\n      security-events: write\n\n    steps:\n      - name: Checkout repository\n        uses: actions/checkout@v4\n\n      - name: Initialize CodeQL\n        uses: github/codeql-action/init@v3\n        with:\n          languages: cpp\n\n      - name: Build\n        run: |\n          cmake -DCMAKE_BUILD_TYPE=Debug .\n          cmake --build .\n\n      - name: Perform CodeQL Analysis\n        uses: github/codeql-action/analyze@v3\n        with:\n          category: \"/language:cpp\"\n"
  },
  {
    "path": ".github/workflows/lock.yml",
    "content": "name: Lock Threads\n\non:\n  schedule:\n    - cron: '0 0 * * *'\n\njobs:\n  lock:\n    runs-on: ubuntu-latest\n    steps:\n      - uses: dessant/lock-threads@v5\n        with:\n          github-token: ${{ github.token }}\n          issue-inactive-days: 30\n"
  },
  {
    "path": ".github/workflows/release.yml",
    "content": "name: Release\n\non:\n  push:\n    tags:\n      - v*.*.*\n\njobs:\n  release:\n    name: Create release\n    runs-on: ubuntu-22.04\n    steps:\n      - name: Set variables\n        id: init\n        run: |\n          echo \"tag=${GITHUB_REF#refs/tags/}\" >> $GITHUB_OUTPUT\n          echo \"version=${GITHUB_REF#refs/tags/v}\" >> $GITHUB_OUTPUT\n      - name: Checkout\n        uses: actions/checkout@v4\n      - name: Write release body\n        id: body\n        run: |\n          FILENAME=RELEASE.md\n          tee $FILENAME <<END\n          ## Changes\n\n          $(extras/scripts/extract_changes.awk CHANGELOG.md)\n\n          [View version history](https://github.com/bblanchon/ArduinoJson/blob/${{ steps.init.outputs.tag }}/CHANGELOG.md)\n          END\n          echo \"filename=$FILENAME\" >> $GITHUB_OUTPUT\n      - name: Amalgamate ArduinoJson.h\n        id: amalgamate_h\n        run: |\n          FILENAME=ArduinoJson-${{ steps.init.outputs.tag }}.h\n          extras/scripts/build-single-header.sh src/ArduinoJson.h \"$FILENAME\"\n          echo \"filename=$FILENAME\" >> $GITHUB_OUTPUT\n      - name: Amalgamate ArduinoJson.hpp\n        id: amalgamate_hpp\n        run: |\n          FILENAME=ArduinoJson-${{ steps.init.outputs.tag }}.hpp\n          extras/scripts/build-single-header.sh src/ArduinoJson.hpp \"$FILENAME\"\n          echo \"filename=$FILENAME\" >> $GITHUB_OUTPUT\n      - name: Create release\n        uses: ncipollo/release-action@v1\n        with:\n          bodyFile: ${{ steps.body.outputs.filename }}\n          name: ArduinoJson ${{ steps.init.outputs.version }}\n          artifacts: ${{ steps.amalgamate_h.outputs.filename }},${{ steps.amalgamate_hpp.outputs.filename }}\n          token: ${{ secrets.GITHUB_TOKEN }}\n\n  idf:\n    name: IDF Component Registry\n    runs-on: ubuntu-latest\n    steps:\n      - name: Checkout\n        uses: actions/checkout@v4\n      - name: Upload component to the component registry\n        uses: espressif/upload-components-ci-action@v1\n        with:\n          name: ArduinoJson\n          namespace: bblanchon\n          api_token: ${{ secrets.IDF_COMPONENT_API_TOKEN }}\n\n  particle:\n    name: Particle\n    runs-on: ubuntu-latest\n    steps:\n      - name: Install\n        run: npm install -g particle-cli\n      - name: Checkout\n        uses: actions/checkout@v4\n      - name: Login\n        run: particle login --token ${{ secrets.PARTICLE_TOKEN }}\n      - name: Publish\n        run: bash -eux extras/scripts/publish-particle-library.sh\n\n  platformio:\n    name: PlatformIO\n    runs-on: ubuntu-latest\n    steps:\n      - name: Set up Python 3.x\n        uses: actions/setup-python@v5\n        with:\n          python-version: \"3.x\"\n      - name: Install PlatformIO\n        run: pip install platformio\n      - name: Checkout\n        uses: actions/checkout@v4\n      - name: Publish\n        run: pio pkg publish --no-interactive --no-notify\n        env:\n          PLATFORMIO_AUTH_TOKEN: ${{ secrets.PLATFORMIO_AUTH_TOKEN }}\n"
  },
  {
    "path": ".gitignore",
    "content": ".DS_Store\n/.idea\n/build\n/bin\n/lib\n/sftp-config.json\n.tags\n.tags_sorted_by_file\n/extras/fuzzing/*_fuzzer\n/extras/fuzzing/*_fuzzer.options\n/extras/fuzzing/*_fuzzer_seed_corpus.zip\n.vs/\n/out/\n\n# Used by CI for Particle\n/src/*.ino\n/project.properties\n\n# Used by IDF\n/dist/\n"
  },
  {
    "path": ".mbedignore",
    "content": ".devcontainer/\n.github/\nexamples/\nextras/\n"
  },
  {
    "path": ".prettierignore",
    "content": "*.md\n"
  },
  {
    "path": ".vscode/settings.json",
    "content": "{\n  \"C_Cpp.default.configurationProvider\": \"ms-vscode.cmake-tools\",\n  \"git.inputValidationLength\": 80,\n  \"git.inputValidationSubjectLength\": 72,\n  \"files.insertFinalNewline\": true,\n  \"files.trimFinalNewlines\": true,\n  \"search.exclude\": {\n    \"/extras/tests/catch/*\": true\n  },\n  \"C_Cpp.default.includePath\": [\n    \"/src\"\n  ],\n  \"[cmake]\": {\n    \"editor.detectIndentation\": false,\n    \"editor.insertSpaces\": false,\n  }\n}\n"
  },
  {
    "path": "ArduinoJson.h",
    "content": "// ArduinoJson - https://arduinojson.org\n// Copyright © 2014-2025, Benoit BLANCHON\n// MIT License\n\n#include \"src/ArduinoJson.h\"\n"
  },
  {
    "path": "CHANGELOG.md",
    "content": "ArduinoJson: change log\r\n=======================\r\n\r\nHEAD\r\n----\r\n\r\n* Don't store string literals by pointer anymore (issue #2189)\r\n  Version 7.3 introduced a new way to detect string literals, but it fails in some edge cases.\r\n  I could not find a way to fix it, so I chose to remove the optimization rather than keep it broken.\r\n* Replace the \"extension slots\" mechanism with a memory pool dedicated to 8-byte values.\r\n\r\n> ### BREAKING CHANGES\r\n>\r\n> #### `JsonString` constructor's boolean parameter\r\n>\r\n> Since version 7.3, you could pass a boolean to `JsonString`'s constructor to force the string to be stored by pointer.\r\n> This optimization has been removed, and you'll get a deprecation warning if you use it.\r\n> To fix the issue, you must remove the boolean argument from the constructor, or better yet, remove `JsonString` altogether.\r\n>\r\n> ```diff\r\n>   char name[] = \"ArduinoJson\";\r\n> - doc[\"name\"] = JsonString(name, true);\r\n> + doc[\"name\"] = name;\r\n> ```\r\n>\r\n> #### NUL characters in string literals\r\n> \r\n> Since version 7.3, ArduinoJson has supported NUL characters (`\\0`) in string literals.\r\n> This feature has been removed as part of the storage policy change.\r\n>\r\n> If you do need to include NULs in your string, you must use a `JsonString` instead:\r\n>\r\n> ```diff\r\n> - doc[\"strings\"] = \"hello\\0world\"\r\n> + doc[\"strings\"] = JsonString(\"hello\\0world\", 11)\r\n> ```\r\n\r\nv7.4.3 (2026-03-02)\r\n------\r\n\r\n* Fix a buffer overrun in `as<T>()` when `T` is a numeric type and\r\n  the variant contains a string representing a floating point number\r\n  with a large number of digits (issue #2220)\r\n\r\nv7.4.2 (2025-06-20)\r\n------\r\n\r\n* Fix truncated strings on Arduino Due (issue #2181)\r\n\r\nv7.4.1 (2025-04-11)\r\n------\r\n\r\n* Fix crash with tiny Flash strings (issue #2170)\r\n\r\nv7.4.0 (2025-04-09)\r\n------\r\n\r\n* Optimize storage of tiny strings (up to 3 characters)\r\n* Fix support for `const char[]` (issue #2166)\r\n\r\nv7.3.1 (2025-02-27)\r\n------\r\n\r\n* Fix conversion from static string to number\r\n* Slightly reduce code size\r\n\r\nv7.3.0 (2024-12-29)\r\n------\r\n\r\n* Fix support for NUL characters in `deserializeJson()`\r\n* Make `ElementProxy` and `MemberProxy` non-copyable\r\n* Change string copy policy: only string literal are stored by pointer\r\n* `JsonString` is now stored by copy, unless specified otherwise\r\n* Replace undocumented `JsonString::Ownership` with `bool`\r\n* Rename undocumented `JsonString::isLinked()` to `isStatic()`\r\n* Move public facing SFINAEs to template declarations\r\n\r\n> ### BREAKING CHANGES\r\n>\r\n> In previous versions, `MemberProxy` (the class returned by `operator[]`) could lead to dangling pointers when used with a temporary string.\r\n> To prevent this issue, `MemberProxy` and `ElementProxy` are now non-copyable.\r\n>\r\n> Your code is likely to be affected if you use `auto` to store the result of `operator[]`. For example, the following line won't compile anymore:\r\n>\r\n> ```cpp\r\n> auto value = doc[\"key\"];\r\n> ```\r\n>\r\n> To fix the issue, you must append either `.as<T>()` or `.to<T>()`, depending on the situation.\r\n>\r\n> For example, if you are extracting values from a JSON document, you should update like this:\r\n>\r\n> ```diff\r\n> - auto config = doc[\"config\"];\r\n> + auto config = doc[\"config\"].as<JsonObject>();\r\n> const char* name = config[\"name\"];\r\n> ```\r\n>\r\n> However, if you are building a JSON document, you should update like this:\r\n>\r\n> ```diff\r\n> - auto config = doc[\"config\"];\r\n> + auto config = doc[\"config\"].to<JsonObject>();\r\n> config[\"name\"] = \"ArduinoJson\";\r\n> ```\r\n\r\nv7.2.1 (2024-11-15)\r\n------\r\n\r\n* Forbid `deserializeJson(JsonArray|JsonObject, ...)` (issue #2135)\r\n* Fix VLA support in `JsonDocument::set()`\r\n* Fix `operator[](variant)` ignoring NUL characters\r\n\r\nv7.2.0 (2024-09-18)\r\n------\r\n\r\n* Store object members with two slots: one for the key and one for the value\r\n* Store 64-bit numbers (`double` and `long long`) in an additional slot\r\n* Reduce the slot size (see table below)\r\n* Improve message when user forgets third arg of `serializeJson()` et al.\r\n* Set `ARDUINOJSON_USE_DOUBLE` to `0` by default on 8-bit architectures\r\n* Deprecate `containsKey()` in favor of `doc[\"key\"].is<T>()`\r\n* Add support for escape sequence `\\'` (issue #2124)\r\n\r\n| Architecture | before   | after    |\r\n|--------------|----------|----------|\r\n| 8-bit        | 8 bytes  | 6 bytes  |\r\n| 32-bit       | 16 bytes | 8 bytes  |\r\n| 64-bit       | 24 bytes | 16 bytes |\r\n\r\n> ### BREAKING CHANGES\r\n>\r\n> After being on the death row for years, the `containsKey()` method has finally been deprecated.\r\n> You should replace `doc.containsKey(\"key\")` with `doc[\"key\"].is<T>()`, which not only checks that the key exists but also that the value is of the expected type.\r\n>\r\n> ```cpp\r\n> // Before\r\n> if (doc.containsKey(\"value\")) {\r\n>   int value = doc[\"value\"];\r\n>   // ...\r\n> }\r\n>\r\n> // After\r\n> if (doc[\"value\"].is<int>()) {\r\n>   int value = doc[\"value\"];\r\n>   // ...\r\n> }\r\n> ```\r\n\r\nv7.1.0 (2024-06-27)\r\n------\r\n\r\n* Add `ARDUINOJSON_STRING_LENGTH_SIZE` to the namespace name\r\n* Add support for MsgPack binary (PR #2078 by @Sanae6)\r\n* Add support for MsgPack extension\r\n* Make string support even more generic (PR #2084 by @d-a-v)\r\n* Optimize `deserializeMsgPack()`\r\n* Allow using a `JsonVariant` as a key or index (issue #2080)\r\n  Note: works only for reading, not for writing\r\n* Support `ElementProxy` and `MemberProxy` in `JsonDocument`'s constructor\r\n* Don't add partial objects when allocation fails (issue #2081)\r\n* Read MsgPack's 64-bit integers even if `ARDUINOJSON_USE_LONG_LONG` is `0`\r\n  (they are set to `null` if they don't fit in a `long`)\r\n\r\nv7.0.4 (2024-03-12)\r\n------\r\n\r\n* Make `JSON_STRING_SIZE(N)` return `N+1` to fix third-party code (issue #2054)\r\n\r\nv7.0.3 (2024-02-05)\r\n------\r\n\r\n* Improve error messages when using `char` or `char*` (issue #2043)\r\n* Reduce stack consumption (issue #2046)\r\n* Fix compatibility with GCC 4.8 (issue #2045)\r\n\r\nv7.0.2 (2024-01-19)\r\n------\r\n\r\n* Fix assertion `poolIndex < count_` after `JsonDocument::clear()` (issue #2034)\r\n\r\nv7.0.1 (2024-01-10)\r\n------\r\n\r\n* Fix \"no matching function\" with `JsonObjectConst::operator[]` (issue #2019)\r\n* Remove unused files in the PlatformIO package\r\n* Fix `volatile bool` serialized as `1` or `0` instead of `true` or `false` (issue #2029)\r\n\r\nv7.0.0 (2024-01-03)\r\n------\r\n\r\n* Remove `BasicJsonDocument`\r\n* Remove `StaticJsonDocument`\r\n* Add abstract `Allocator` class\r\n* Merge `DynamicJsonDocument` with `JsonDocument`\r\n* Remove `JSON_ARRAY_SIZE()`, `JSON_OBJECT_SIZE()`, and `JSON_STRING_SIZE()`\r\n* Remove `ARDUINOJSON_ENABLE_STRING_DEDUPLICATION` (string deduplication cannot be disabled anymore)\r\n* Remove `JsonDocument::capacity()`\r\n* Store the strings in the heap\r\n* Reference-count shared strings\r\n* Always store `serialized(\"string\")` by copy (#1915)\r\n* Remove the zero-copy mode of `deserializeJson()` and `deserializeMsgPack()`\r\n* Fix double lookup in `to<JsonVariant>()`\r\n* Fix double call to `size()` in `serializeMsgPack()`\r\n* Include `ARDUINOJSON_SLOT_OFFSET_SIZE` in the namespace name\r\n* Remove `JsonVariant::shallowCopy()`\r\n* `JsonDocument`'s capacity grows as needed, no need to pass it to the constructor anymore\r\n* `JsonDocument`'s allocator is not monotonic anymore, removed values get recycled\r\n* Show a link to the documentation when user passes an unsupported input type\r\n* Remove `JsonDocument::memoryUsage()`\r\n* Remove `JsonDocument::garbageCollect()`\r\n* Add `deserializeJson(JsonVariant, ...)` and `deserializeMsgPack(JsonVariant, ...)` (#1226)\r\n* Call `shrinkToFit()` in `deserializeJson()` and `deserializeMsgPack()`\r\n* `serializeJson()` and `serializeMsgPack()` replace the content of `std::string` and `String` instead of appending to it\r\n* Replace `add()` with `add<T>()` (`add(T)` is still supported)\r\n* Remove `createNestedArray()` and `createNestedObject()` (use `to<JsonArray>()` and `to<JsonObject>()` instead)\r\n\r\n> ### BREAKING CHANGES\r\n>\r\n> As every major release, ArduinoJson 7 introduces several breaking changes.\r\n> I added some stubs so that most existing programs should compile, but I highty recommend you upgrade your code.\r\n>\r\n> #### `JsonDocument`\r\n> \r\n> In ArduinoJson 6, you could allocate the memory pool on the stack (with `StaticJsonDocument`) or in the heap (with `DynamicJsonDocument`).  \r\n> In ArduinoJson 7, the memory pool is always allocated in the heap, so `StaticJsonDocument` and `DynamicJsonDocument` have been merged into `JsonDocument`.\r\n>\r\n> In ArduinoJson 6, `JsonDocument` had a fixed capacity; in ArduinoJson 7, it has an elastic capacity that grows as needed.\r\n> Therefore, you don't need to specify the capacity anymore, so the macros `JSON_ARRAY_SIZE()`, `JSON_OBJECT_SIZE()`, and `JSON_STRING_SIZE()` have been removed.\r\n>\r\n> ```c++\r\n> // ArduinoJson 6\r\n> StaticJsonDocument<256> doc;\r\n> // or\r\n> DynamicJsonDocument doc(256);\r\n> \r\n> // ArduinoJson 7\r\n> JsonDocument doc;\r\n> ```\r\n>\r\n> In ArduinoJson 7, `JsonDocument` reuses released memory, so `garbageCollect()` has been removed.  \r\n> `shrinkToFit()` is still available and releases the over-allocated memory.\r\n>\r\n> Due to a change in the implementation, it's not possible to store a pointer to a variant from another `JsonDocument`, so `shallowCopy()` has been removed.\r\n> \r\n> In ArduinoJson 6, the meaning of `memoryUsage()` was clear: it returned the number of bytes used in the memory pool.  \r\n> In ArduinoJson 7, the meaning of `memoryUsage()` would be ambiguous, so it has been removed.\r\n>\r\n> #### Custom allocators\r\n>\r\n> In ArduinoJson 6, you could specify a custom allocator class as a template parameter of `BasicJsonDocument`.  \r\n> In ArduinoJson 7, you must inherit from `ArduinoJson::Allocator` and pass a pointer to an instance of your class to the constructor of `JsonDocument`.\r\n>\r\n> ```c++\r\n> // ArduinoJson 6\r\n> class MyAllocator {\r\n>   // ...\r\n> };\r\n> BasicJsonDocument<MyAllocator> doc(256);\r\n>\r\n> // ArduinoJson 7\r\n> class MyAllocator : public ArduinoJson::Allocator {\r\n>   // ...\r\n> };\r\n> MyAllocator myAllocator;\r\n> JsonDocument doc(&myAllocator);\r\n> ```\r\n>\r\n> #### `createNestedArray()` and `createNestedObject()`\r\n>\r\n> In ArduinoJson 6, you could create a nested array or object with `createNestedArray()` and `createNestedObject()`.  \r\n> In ArduinoJson 7, you must use `add<T>()` or `to<T>()` instead.\r\n>\r\n> For example, to create `[[],{}]`, you would write:\r\n>\r\n> ```c++\r\n> // ArduinoJson 6\r\n> arr.createNestedArray();\r\n> arr.createNestedObject();\r\n>\r\n> // ArduinoJson 7\r\n> arr.add<JsonArray>();\r\n> arr.add<JsonObject>();\r\n> ```\r\n>\r\n> And to create `{\"array\":[],\"object\":{}}`, you would write:\r\n>\r\n> ```c++\r\n> // ArduinoJson 6\r\n> obj.createNestedArray(\"array\");\r\n> obj.createNestedObject(\"object\");\r\n>\r\n> // ArduinoJson 7\r\n> obj[\"array\"].to<JsonArray>();\r\n> obj[\"object\"].to<JsonObject>();\r\n> ```\r\n"
  },
  {
    "path": "CMakeLists.txt",
    "content": "# ArduinoJson - https://arduinojson.org\n# Copyright © 2014-2025, Benoit BLANCHON\n# MIT License\n\ncmake_minimum_required(VERSION 3.15)\n\nif(ESP_PLATFORM)\n\t# Build ArduinoJson as an ESP-IDF component\n\tidf_component_register(INCLUDE_DIRS src)\n\treturn()\nendif()\n\nproject(ArduinoJson VERSION 7.4.2)\n\nif(CMAKE_PROJECT_NAME STREQUAL PROJECT_NAME)\n\tinclude(CTest)\nendif()\n\nadd_subdirectory(src)\n\nif(CMAKE_PROJECT_NAME STREQUAL PROJECT_NAME AND BUILD_TESTING)\n\tinclude(extras/CompileOptions.cmake)\n\tadd_subdirectory(extras/tests)\n\tadd_subdirectory(extras/fuzzing)\nendif()\n"
  },
  {
    "path": "CONTRIBUTING.md",
    "content": "# Contribution to ArduinoJson\n\nFirst, thank you for taking the time to contribute to this project.\n\nYou can submit changes via GitHub Pull Requests.\n\nPlease:\n\n1. Update the test suite for any change of behavior\n2. Use clang-format in \"file\" mode to format the code\n"
  },
  {
    "path": "LICENSE.txt",
    "content": "The MIT License (MIT)\n---------------------\n\nCopyright © 2014-2025, Benoit BLANCHON\n\nPermission 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:\n\nThe above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.\n\nTHE 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.\n"
  },
  {
    "path": "README.md",
    "content": "<p align=\"center\">\r\n  <a href=\"https://arduinojson.org/\"><img alt=\"ArduinoJson\" src=\"https://arduinojson.org/images/logo.svg\" width=\"200\" /></a>\r\n</p>\r\n\r\n---\r\n\r\n[![GitHub Workflow Status](https://img.shields.io/github/actions/workflow/status/bblanchon/ArduinoJson/ci.yml?branch=7.x&logo=github)](https://github.com/bblanchon/ArduinoJson/actions?query=workflow%3A%22Continuous+Integration%22+branch%3A7.x)\r\n[![Continuous Integration](https://ci.appveyor.com/api/projects/status/m7s53wav1l0abssg/branch/7.x?svg=true)](https://ci.appveyor.com/project/bblanchon/arduinojson/branch/7.x)\r\n[![Fuzzing Status](https://oss-fuzz-build-logs.storage.googleapis.com/badges/arduinojson.svg)](https://bugs.chromium.org/p/oss-fuzz/issues/list?sort=-opened&can=1&q=proj:arduinojson)\r\n[![Coveralls branch](https://img.shields.io/coveralls/github/bblanchon/ArduinoJson/7.x?logo=coveralls)](https://coveralls.io/github/bblanchon/ArduinoJson?branch=7.x)  \r\n[![GitHub stars](https://img.shields.io/github/stars/bblanchon/ArduinoJson?style=flat&logo=github&color=orange)](https://github.com/bblanchon/ArduinoJson/stargazers)\r\n[![GitHub Sponsors](https://img.shields.io/github/sponsors/bblanchon?logo=github&color=orange)](https://github.com/sponsors/bblanchon)\r\n\r\nArduinoJson is a C++ JSON library for Arduino and IoT (Internet Of Things).\r\n\r\n## Features\r\n\r\n* [JSON deserialization](https://arduinojson.org/v7/api/json/deserializejson/)\r\n    * [Optionally decodes UTF-16 escape sequences to UTF-8](https://arduinojson.org/v7/api/config/decode_unicode/)\r\n    * [Optionally supports comments in the input](https://arduinojson.org/v7/api/config/enable_comments/)\r\n    * [Optionally filters the input to keep only desired values](https://arduinojson.org/v7/api/json/deserializejson/#filtering)\r\n    * Supports single quotes as a string delimiter\r\n    * Compatible with [NDJSON](http://ndjson.org/) and [JSON Lines](https://jsonlines.org/)\r\n* [JSON serialization](https://arduinojson.org/v7/api/json/serializejson/)\r\n    * [Can write to a buffer or a stream](https://arduinojson.org/v7/api/json/serializejson/)\r\n    * [Optionally indents the document (prettified JSON)](https://arduinojson.org/v7/api/json/serializejsonpretty/)\r\n* [MessagePack serialization](https://arduinojson.org/v7/api/msgpack/serializemsgpack/)\r\n* [MessagePack deserialization](https://arduinojson.org/v7/api/msgpack/deserializemsgpack/)\r\n* Efficient\r\n    * [Twice smaller than the \"official\" Arduino_JSON library](https://arduinojson.org/2019/11/19/arduinojson-vs-arduino_json/)\r\n    * [Almost 10% faster than the \"official\" Arduino_JSON library](https://arduinojson.org/2019/11/19/arduinojson-vs-arduino_json/)\r\n    * [Consumes roughly 10% less RAM than the \"official\" Arduino_JSON library](https://arduinojson.org/2019/11/19/arduinojson-vs-arduino_json/)\r\n    * [Deduplicates strings](https://arduinojson.org/news/2020/08/01/version-6-16-0/)\r\n* Versatile\r\n    * Supports [custom allocators (to use external RAM chip, for example)](https://arduinojson.org/v7/how-to/use-external-ram-on-esp32/)\r\n    * Supports [`String`](https://arduinojson.org/v7/api/config/enable_arduino_string/), [`std::string`](https://arduinojson.org/v7/api/config/enable_std_string/), and [`std::string_view`](https://arduinojson.org/v7/api/config/enable_string_view/)\r\n    * Supports [`Stream`](https://arduinojson.org/v7/api/config/enable_arduino_stream/) and [`std::istream`/`std::ostream`](https://arduinojson.org/v7/api/config/enable_std_stream/)\r\n    * Supports [Flash strings](https://arduinojson.org/v7/api/config/enable_progmem/)\r\n    * Supports [custom readers](https://arduinojson.org/v7/api/json/deserializejson/#custom-reader) and [custom writers](https://arduinojson.org/v7/api/json/serializejson/#custom-writer)\r\n    * Supports [custom converters](https://arduinojson.org/news/2021/05/04/version-6-18-0/)\r\n* Portable\r\n    * Usable on any C++ project (not limited to Arduino)\r\n    * Compatible with C++11, C++14 and C++17\r\n    * Support for C++98/C++03 available on [ArduinoJson 6.20.x](https://github.com/bblanchon/ArduinoJson/tree/6.20.x)\r\n    * Zero warnings with `-Wall -Wextra -pedantic` and `/W4`\r\n    * [Header-only library](https://en.wikipedia.org/wiki/Header-only)\r\n    * Works with virtually any board\r\n        * Arduino boards: [Uno](https://amzn.to/38aL2ik), [Due](https://amzn.to/36YkWi2), [Micro](https://amzn.to/35WkdwG), [Nano](https://amzn.to/2QTvwRX), [Mega](https://amzn.to/36XWhuf), [Yun](https://amzn.to/30odURc), [Leonardo](https://amzn.to/36XWjlR)...\r\n        * Espressif chips: [ESP8266](https://amzn.to/36YluV8), [ESP32](https://amzn.to/2G4pRCB)\r\n        * Lolin (WeMos) boards: [D1 mini](https://amzn.to/2QUpz7q), [D1 Mini Pro](https://amzn.to/36UsGSs)...\r\n        * Teensy boards: [4.0](https://amzn.to/30ljXGq), [3.2](https://amzn.to/2FT0EuC), [2.0](https://amzn.to/2QXUMXj)\r\n        * Particle boards: [Argon](https://amzn.to/2FQHa9X), [Boron](https://amzn.to/36WgLUd), [Electron](https://amzn.to/30vEc4k), [Photon](https://amzn.to/387F9Cd)...\r\n        * Texas Instruments boards: [MSP430](https://amzn.to/30nJWgg)...\r\n        * Soft cores: [Nios II](https://en.wikipedia.org/wiki/Nios_II)...\r\n    * Tested on all major development environments\r\n        * [Arduino IDE](https://www.arduino.cc/en/Main/Software)\r\n        * [Atmel Studio](http://www.atmel.com/microsite/atmel-studio/)\r\n        * [Atollic TrueSTUDIO](https://atollic.com/truestudio/)\r\n        * [Energia](http://energia.nu/)\r\n        * [IAR Embedded Workbench](https://www.iar.com/iar-embedded-workbench/)\r\n        * [Keil uVision](http://www.keil.com/)\r\n        * [MPLAB X IDE](http://www.microchip.com/mplab/mplab-x-ide)\r\n        * [Particle](https://www.particle.io/)\r\n        * [PlatformIO](http://platformio.org/)\r\n        * [Sloeber plugin for Eclipse](https://eclipse.baeyens.it/)\r\n        * [Visual Micro](http://www.visualmicro.com/)\r\n        * [Visual Studio](https://www.visualstudio.com/)\r\n    * [Even works with online compilers like wandbox.org](https://wandbox.org/permlink/RlZSKy17DjJ6HcdN)\r\n    * [CMake friendly](https://arduinojson.org/v7/how-to/use-arduinojson-with-cmake/)\r\n* Well designed\r\n    * [Elegant API](http://arduinojson.org/v7/example/)\r\n    * [Thread-safe](https://en.wikipedia.org/wiki/Thread_safety)\r\n    * Self-contained (no external dependency)\r\n    * `const` friendly\r\n    * [`for` friendly](https://arduinojson.org/v7/api/jsonobject/begin_end/)\r\n    * [TMP friendly](https://en.wikipedia.org/wiki/Template_metaprogramming)\r\n    * Handles [integer overflows](https://arduinojson.org/v7/api/jsonvariant/as/#integer-overflows)\r\n* Well tested\r\n    * [Unit test coverage close to 100%](https://coveralls.io/github/bblanchon/ArduinoJson?branch=7.x)\r\n    * Continuously tested on\r\n        * [Visual Studio 2017, 2019, 2022](https://ci.appveyor.com/project/bblanchon/arduinojson/branch/7.x)\r\n        * [GCC 4.8, 5, 6, 7, 8, 9, 10, 11, 12](https://github.com/bblanchon/ArduinoJson/actions?query=workflow%3A%22Continuous+Integration%22)\r\n        * [Clang 7 to 19](https://github.com/bblanchon/ArduinoJson/actions?query=workflow%3A%22Continuous+Integration%22)\r\n    * [Continuously fuzzed with Google OSS Fuzz](https://bugs.chromium.org/p/oss-fuzz/issues/list?sort=-opened&can=1&q=proj:arduinojson)\r\n    * Passes all default checks of [clang-tidy](https://releases.llvm.org/10.0.0/tools/clang/tools/extra/docs/clang-tidy/)\r\n* Well documented\r\n    * [Tutorials](https://arduinojson.org/v7/doc/deserialization/)\r\n    * [Examples](https://arduinojson.org/v7/example/)\r\n    * [How-tos](https://arduinojson.org/v7/example/)\r\n    * [FAQ](https://arduinojson.org/v7/faq/)\r\n    * [Troubleshooter](https://arduinojson.org/v7/troubleshooter/)\r\n    * [Book](https://arduinojson.org/book/)\r\n    * [Changelog](CHANGELOG.md)\r\n\r\n## Quickstart\r\n\r\n### Deserialization\r\n\r\nHere is a program that parses a JSON document with ArduinoJson.\r\n\r\n```c++\r\nconst char* json = \"{\\\"sensor\\\":\\\"gps\\\",\\\"time\\\":1351824120,\\\"data\\\":[48.756080,2.302038]}\";\r\n\r\nJsonDocument doc;\r\ndeserializeJson(doc, json);\r\n\r\nconst char* sensor = doc[\"sensor\"];\r\nlong time          = doc[\"time\"];\r\ndouble latitude    = doc[\"data\"][0];\r\ndouble longitude   = doc[\"data\"][1];\r\n```\r\n\r\nSee the [tutorial on arduinojson.org](https://arduinojson.org/v7/doc/deserialization/)\r\n\r\n### Serialization\r\n\r\nHere is a program that generates a JSON document with ArduinoJson:\r\n\r\n```c++\r\nJsonDocument doc;\r\n\r\ndoc[\"sensor\"] = \"gps\";\r\ndoc[\"time\"]   = 1351824120;\r\ndoc[\"data\"][0] = 48.756080;\r\ndoc[\"data\"][1] = 2.302038;\r\n\r\nserializeJson(doc, Serial);\r\n// This prints:\r\n// {\"sensor\":\"gps\",\"time\":1351824120,\"data\":[48.756080,2.302038]}\r\n```\r\n\r\nSee the [tutorial on arduinojson.org](https://arduinojson.org/v7/doc/serialization/)\r\n\r\n## Sponsors\r\n\r\nArduinoJson is thankful to its sponsors. Please give them a visit; they deserve it!\r\n\r\n<p>\r\n  <a href=\"https://github.com/1technophile\" rel=\"sponsored\">\r\n    <img alt=\"1technophile\" src=\"https://avatars.githubusercontent.com/u/12672732?s=40&v=4\">\r\n  </a>\r\n  <a href=\"https://github.com/LArkema\" rel=\"sponsored\">\r\n    <img alt=\"LArkema\" src=\"https://avatars.githubusercontent.com/u/38381313?s=40&v=4\">\r\n  </a>\r\n</p>\r\n\r\nIf you run a commercial project that embeds ArduinoJson, think about [sponsoring the library's development](https://github.com/sponsors/bblanchon): it ensures the code that your products rely on stays actively maintained. It can also give your project some exposure to the makers' community.\r\n\r\nIf you are an individual user and want to support the development (or give a sign of appreciation), consider purchasing the book [Mastering ArduinoJson](https://arduinojson.org/book/)&nbsp;❤, or simply [cast a star](https://github.com/bblanchon/ArduinoJson/stargazers)&nbsp;⭐.\r\n"
  },
  {
    "path": "SUPPORT.md",
    "content": "# ArduinoJson Support\n\nFirst off, thank you very much for using ArduinoJson.\n\nWe'll be very happy to help you, but first please read the following.\n\n## Before asking for help\n\n1. Read the [FAQ](https://arduinojson.org/faq/?utm_source=github&utm_medium=support)\n2. Search in the [API Reference](https://arduinojson.org/api/?utm_source=github&utm_medium=support)\n\nIf you did not find the answer, please create a [new issue on GitHub](https://github.com/bblanchon/ArduinoJson/issues/new).\n\nIt is OK to add a comment to a currently opened issue, but please avoid adding comments to a closed issue.\n\n## Before hitting the Submit button\n\nPlease provide all the relevant information:\n\n* Good title\n* Short description of the problem\n* Target platform\n* Compiler model and version\n* [MVCE](https://stackoverflow.com/help/mcve)\n* Compiler output\n\nGood questions get fast answers!\n"
  },
  {
    "path": "appveyor.yml",
    "content": "version: 7.4.2.{build}\nenvironment:\n  matrix:\n    - APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2022\n      CMAKE_GENERATOR: Visual Studio 17 2022\n    - APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2019\n      CMAKE_GENERATOR: Visual Studio 16 2019\n    - APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2017\n      CMAKE_GENERATOR: Visual Studio 15 2017\n    - CMAKE_GENERATOR: Ninja\n      MINGW32: i686-6.3.0-posix-dwarf-rt_v5-rev1 # MinGW-w64 6.3.0 i686\n    - CMAKE_GENERATOR: Ninja\n      MINGW64: x86_64-6.3.0-posix-seh-rt_v5-rev1 # MinGW-w64 6.3.0 x86_64\n    - CMAKE_GENERATOR: Ninja\n      MINGW64: x86_64-7.3.0-posix-seh-rt_v5-rev0 # MinGW-w64 7.3.0 x86_64\n    - CMAKE_GENERATOR: Ninja\n      MINGW64: x86_64-8.1.0-posix-seh-rt_v6-rev0 # MinGW-w64 8.1.0 x86_64\nconfiguration: Debug\nbefore_build:\n  - set PATH=%PATH:C:\\Program Files\\Git\\usr\\bin;=% # Workaround for CMake not wanting sh.exe on PATH for MinGW\n  - if defined MINGW set PATH=C:\\%MINGW%\\bin;%PATH%\n  - if defined MINGW32 set PATH=C:\\mingw-w64\\%MINGW32%\\mingw32\\bin;%PATH%\n  - if defined MINGW64 set PATH=C:\\mingw-w64\\%MINGW64%\\mingw64\\bin;%PATH%\n  - cmake -DCMAKE_BUILD_TYPE=%CONFIGURATION% -G \"%CMAKE_GENERATOR%\" .\nbuild_script:\n  - cmake --build . --config %CONFIGURATION%\ntest_script:\n  - ctest -C %CONFIGURATION% --output-on-failure .\n"
  },
  {
    "path": "component.mk",
    "content": "COMPONENT_ADD_INCLUDEDIRS := src\n"
  },
  {
    "path": "examples/JsonConfigFile/JsonConfigFile.ino",
    "content": "// ArduinoJson - https://arduinojson.org\n// Copyright © 2014-2025, Benoit BLANCHON\n// MIT License\n//\n// This example shows how to store your project configuration in a file.\n// It uses the SD library but can be easily modified for any other file-system.\n//\n// The file contains a JSON document with the following content:\n// {\n//   \"hostname\": \"examples.com\",\n//   \"port\": 2731\n// }\n//\n// To run this program, you need an SD card connected to the SPI bus as follows:\n// * MOSI <-> pin 11\n// * MISO <-> pin 12\n// * CLK  <-> pin 13\n// * CS   <-> pin 4\n//\n// https://arduinojson.org/v7/example/config/\n\n#include <ArduinoJson.h>\n#include <SD.h>\n#include <SPI.h>\n\n// Our configuration structure.\nstruct Config {\n  char hostname[64];\n  int port;\n};\n\nconst char* filename = \"/config.txt\";  // <- SD library uses 8.3 filenames\nConfig config;                         // <- global configuration object\n\n// Loads the configuration from a file\nvoid loadConfiguration(const char* filename, Config& config) {\n  // Open file for reading\n  File file = SD.open(filename);\n\n  // Allocate a temporary JsonDocument\n  JsonDocument doc;\n\n  // Deserialize the JSON document\n  DeserializationError error = deserializeJson(doc, file);\n  if (error)\n    Serial.println(F(\"Failed to read file, using default configuration\"));\n\n  // Copy values from the JsonDocument to the Config\n  config.port = doc[\"port\"] | 2731;\n  strlcpy(config.hostname,                  // <- destination\n          doc[\"hostname\"] | \"example.com\",  // <- source\n          sizeof(config.hostname));         // <- destination's capacity\n\n  // Close the file (Curiously, File's destructor doesn't close the file)\n  file.close();\n}\n\n// Saves the configuration to a file\nvoid saveConfiguration(const char* filename, const Config& config) {\n  // Delete existing file, otherwise the configuration is appended to the file\n  SD.remove(filename);\n\n  // Open file for writing\n  File file = SD.open(filename, FILE_WRITE);\n  if (!file) {\n    Serial.println(F(\"Failed to create file\"));\n    return;\n  }\n\n  // Allocate a temporary JsonDocument\n  JsonDocument doc;\n\n  // Set the values in the document\n  doc[\"hostname\"] = config.hostname;\n  doc[\"port\"] = config.port;\n\n  // Serialize JSON to file\n  if (serializeJson(doc, file) == 0) {\n    Serial.println(F(\"Failed to write to file\"));\n  }\n\n  // Close the file\n  file.close();\n}\n\n// Prints the content of a file to the Serial\nvoid printFile(const char* filename) {\n  // Open file for reading\n  File file = SD.open(filename);\n  if (!file) {\n    Serial.println(F(\"Failed to read file\"));\n    return;\n  }\n\n  // Extract each characters by one by one\n  while (file.available()) {\n    Serial.print((char)file.read());\n  }\n  Serial.println();\n\n  // Close the file\n  file.close();\n}\n\nvoid setup() {\n  // Initialize serial port\n  Serial.begin(9600);\n  while (!Serial)\n    continue;\n\n  // Initialize SD library\n  const int chipSelect = 4;\n  while (!SD.begin(chipSelect)) {\n    Serial.println(F(\"Failed to initialize SD library\"));\n    delay(1000);\n  }\n\n  // Should load default config if run for the first time\n  Serial.println(F(\"Loading configuration...\"));\n  loadConfiguration(filename, config);\n\n  // Create configuration file\n  Serial.println(F(\"Saving configuration...\"));\n  saveConfiguration(filename, config);\n\n  // Dump config file\n  Serial.println(F(\"Print config file...\"));\n  printFile(filename);\n}\n\nvoid loop() {\n  // not used in this example\n}\n\n// Performance issue?\n// ------------------\n//\n// File is an unbuffered stream, which is not optimal for ArduinoJson.\n// See: https://arduinojson.org/v7/how-to/improve-speed/\n\n// See also\n// --------\n//\n// https://arduinojson.org/ contains the documentation for all the functions\n// used above. It also includes an FAQ that will help you solve any\n// serialization or deserialization problem.\n//\n// The book \"Mastering ArduinoJson\" contains a case study of a project that has\n// a complex configuration with nested members.\n// Contrary to this example, the project in the book uses the SPIFFS filesystem.\n// Learn more at https://arduinojson.org/book/\n// Use the coupon code TWENTY for a 20% discount ❤❤❤❤❤\n"
  },
  {
    "path": "examples/JsonFilterExample/JsonFilterExample.ino",
    "content": "// ArduinoJson - https://arduinojson.org\n// Copyright © 2014-2025, Benoit BLANCHON\n// MIT License\n//\n// This example shows how to use DeserializationOption::Filter\n//\n// https://arduinojson.org/v7/example/filter/\n\n#include <ArduinoJson.h>\n\nvoid setup() {\n  // Initialize serial port\n  Serial.begin(9600);\n  while (!Serial)\n    continue;\n\n  // The huge input: an extract from OpenWeatherMap response\n  auto input_json = F(\n      \"{\\\"cod\\\":\\\"200\\\",\\\"message\\\":0,\\\"list\\\":[{\\\"dt\\\":1581498000,\\\"main\\\":{\"\n      \"\\\"temp\\\":3.23,\\\"feels_like\\\":-3.63,\\\"temp_min\\\":3.23,\\\"temp_max\\\":4.62,\"\n      \"\\\"pressure\\\":1014,\\\"sea_level\\\":1014,\\\"grnd_level\\\":1010,\\\"humidity\\\":\"\n      \"58,\\\"temp_kf\\\":-1.39},\\\"weather\\\":[{\\\"id\\\":800,\\\"main\\\":\\\"Clear\\\",\"\n      \"\\\"description\\\":\\\"clear \"\n      \"sky\\\",\\\"icon\\\":\\\"01d\\\"}],\\\"clouds\\\":{\\\"all\\\":0},\\\"wind\\\":{\\\"speed\\\":6.\"\n      \"19,\\\"deg\\\":266},\\\"sys\\\":{\\\"pod\\\":\\\"d\\\"},\\\"dt_txt\\\":\\\"2020-02-12 \"\n      \"09:00:00\\\"},{\\\"dt\\\":1581508800,\\\"main\\\":{\\\"temp\\\":6.09,\\\"feels_like\\\":-\"\n      \"1.07,\\\"temp_min\\\":6.09,\\\"temp_max\\\":7.13,\\\"pressure\\\":1015,\\\"sea_\"\n      \"level\\\":1015,\\\"grnd_level\\\":1011,\\\"humidity\\\":48,\\\"temp_kf\\\":-1.04},\"\n      \"\\\"weather\\\":[{\\\"id\\\":800,\\\"main\\\":\\\"Clear\\\",\\\"description\\\":\\\"clear \"\n      \"sky\\\",\\\"icon\\\":\\\"01d\\\"}],\\\"clouds\\\":{\\\"all\\\":9},\\\"wind\\\":{\\\"speed\\\":6.\"\n      \"64,\\\"deg\\\":268},\\\"sys\\\":{\\\"pod\\\":\\\"d\\\"},\\\"dt_txt\\\":\\\"2020-02-12 \"\n      \"12:00:00\\\"}],\\\"city\\\":{\\\"id\\\":2643743,\\\"name\\\":\\\"London\\\",\\\"coord\\\":{\"\n      \"\\\"lat\\\":51.5085,\\\"lon\\\":-0.1257},\\\"country\\\":\\\"GB\\\",\\\"population\\\":\"\n      \"1000000,\\\"timezone\\\":0,\\\"sunrise\\\":1581492085,\\\"sunset\\\":1581527294}}\");\n\n  // The filter: it contains \"true\" for each value we want to keep\n  JsonDocument filter;\n  filter[\"list\"][0][\"dt\"] = true;\n  filter[\"list\"][0][\"main\"][\"temp\"] = true;\n\n  // Deserialize the document\n  JsonDocument doc;\n  deserializeJson(doc, input_json, DeserializationOption::Filter(filter));\n\n  // Print the result\n  serializeJsonPretty(doc, Serial);\n}\n\nvoid loop() {\n  // not used in this example\n}\n\n// See also\n// --------\n//\n// https://arduinojson.org/ contains the documentation for all the functions\n// used above. It also includes an FAQ that will help you solve any\n// deserialization problem.\n//\n// The book \"Mastering ArduinoJson\" contains a tutorial on deserialization.\n// It begins with a simple example, like the one above, and then adds more\n// features like deserializing directly from a file or an HTTP request.\n// Learn more at https://arduinojson.org/book/\n// Use the coupon code TWENTY for a 20% discount ❤❤❤❤❤\n"
  },
  {
    "path": "examples/JsonGeneratorExample/JsonGeneratorExample.ino",
    "content": "// ArduinoJson - https://arduinojson.org\r\n// Copyright © 2014-2025, Benoit BLANCHON\r\n// MIT License\r\n//\r\n// This example shows how to generate a JSON document with ArduinoJson.\r\n//\r\n// https://arduinojson.org/v7/example/generator/\r\n\r\n#include <ArduinoJson.h>\r\n\r\nvoid setup() {\r\n  // Initialize Serial port\r\n  Serial.begin(9600);\r\n  while (!Serial)\r\n    continue;\r\n\r\n  // Allocate the JSON document\r\n  JsonDocument doc;\r\n\r\n  // Add values in the document\r\n  doc[\"sensor\"] = \"gps\";\r\n  doc[\"time\"] = 1351824120;\r\n\r\n  // Add an array\r\n  JsonArray data = doc[\"data\"].to<JsonArray>();\r\n  data.add(48.756080);\r\n  data.add(2.302038);\r\n\r\n  // Generate the minified JSON and send it to the Serial port\r\n  serializeJson(doc, Serial);\r\n  // The above line prints:\r\n  // {\"sensor\":\"gps\",\"time\":1351824120,\"data\":[48.756080,2.302038]}\r\n\r\n  // Start a new line\r\n  Serial.println();\r\n\r\n  // Generate the prettified JSON and send it to the Serial port\r\n  serializeJsonPretty(doc, Serial);\r\n  // The above line prints:\r\n  // {\r\n  //   \"sensor\": \"gps\",\r\n  //   \"time\": 1351824120,\r\n  //   \"data\": [\r\n  //     48.756080,\r\n  //     2.302038\r\n  //   ]\r\n  // }\r\n}\r\n\r\nvoid loop() {\r\n  // not used in this example\r\n}\r\n\r\n// See also\r\n// --------\r\n//\r\n// https://arduinojson.org/ contains the documentation for all the functions\r\n// used above. It also includes an FAQ that will help you solve any\r\n// serialization problem.\r\n//\r\n// The book \"Mastering ArduinoJson\" contains a tutorial on serialization.\r\n// It begins with a simple example, like the one above, and then adds more\r\n// features like serializing directly to a file or an HTTP request.\r\n// Learn more at https://arduinojson.org/book/\r\n// Use the coupon code TWENTY for a 20% discount ❤❤❤❤❤\r\n"
  },
  {
    "path": "examples/JsonHttpClient/JsonHttpClient.ino",
    "content": "// ArduinoJson - https://arduinojson.org\n// Copyright © 2014-2025, Benoit BLANCHON\n// MIT License\n//\n// This example shows how to parse a JSON document in an HTTP response.\n// It uses the Ethernet library, but can be easily adapted for Wifi.\n//\n// It performs a GET resquest on https://arduinojson.org/example.json\n// Here is the expected response:\n// {\n//   \"sensor\": \"gps\",\n//   \"time\": 1351824120,\n//   \"data\": [\n//     48.756080,\n//     2.302038\n//   ]\n// }\n//\n// https://arduinojson.org/v7/example/http-client/\n\n#include <ArduinoJson.h>\n#include <Ethernet.h>\n#include <SPI.h>\n\nvoid setup() {\n  // Initialize Serial port\n  Serial.begin(9600);\n  while (!Serial)\n    continue;\n\n  // Initialize Ethernet library\n  byte mac[] = {0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED};\n  if (!Ethernet.begin(mac)) {\n    Serial.println(F(\"Failed to configure Ethernet\"));\n    return;\n  }\n  delay(1000);\n\n  Serial.println(F(\"Connecting...\"));\n\n  // Connect to HTTP server\n  EthernetClient client;\n  client.setTimeout(10000);\n  if (!client.connect(\"arduinojson.org\", 80)) {\n    Serial.println(F(\"Connection failed\"));\n    return;\n  }\n\n  Serial.println(F(\"Connected!\"));\n\n  // Send HTTP request\n  client.println(F(\"GET /example.json HTTP/1.0\"));\n  client.println(F(\"Host: arduinojson.org\"));\n  client.println(F(\"Connection: close\"));\n  if (client.println() == 0) {\n    Serial.println(F(\"Failed to send request\"));\n    client.stop();\n    return;\n  }\n\n  // Check HTTP status\n  char status[32] = {0};\n  client.readBytesUntil('\\r', status, sizeof(status));\n  // It should be \"HTTP/1.0 200 OK\" or \"HTTP/1.1 200 OK\"\n  if (strcmp(status + 9, \"200 OK\") != 0) {\n    Serial.print(F(\"Unexpected response: \"));\n    Serial.println(status);\n    client.stop();\n    return;\n  }\n\n  // Skip HTTP headers\n  char endOfHeaders[] = \"\\r\\n\\r\\n\";\n  if (!client.find(endOfHeaders)) {\n    Serial.println(F(\"Invalid response\"));\n    client.stop();\n    return;\n  }\n\n  // Allocate the JSON document\n  JsonDocument doc;\n\n  // Parse JSON object\n  DeserializationError error = deserializeJson(doc, client);\n  if (error) {\n    Serial.print(F(\"deserializeJson() failed: \"));\n    Serial.println(error.f_str());\n    client.stop();\n    return;\n  }\n\n  // Extract values\n  Serial.println(F(\"Response:\"));\n  Serial.println(doc[\"sensor\"].as<const char*>());\n  Serial.println(doc[\"time\"].as<long>());\n  Serial.println(doc[\"data\"][0].as<float>(), 6);\n  Serial.println(doc[\"data\"][1].as<float>(), 6);\n\n  // Disconnect\n  client.stop();\n}\n\nvoid loop() {\n  // not used in this example\n}\n\n// Performance issue?\n// ------------------\n//\n// EthernetClient is an unbuffered stream, which is not optimal for ArduinoJson.\n// See: https://arduinojson.org/v7/how-to/improve-speed/\n\n// See also\n// --------\n//\n// https://arduinojson.org/ contains the documentation for all the functions\n// used above. It also includes an FAQ that will help you solve any\n// serialization  problem.\n//\n// The book \"Mastering ArduinoJson\" contains a tutorial on deserialization\n// showing how to parse the response from GitHub's API. In the last chapter,\n// it shows how to parse the huge documents from OpenWeatherMap\n// and Reddit.\n// Learn more at https://arduinojson.org/book/\n// Use the coupon code TWENTY for a 20% discount ❤❤❤❤❤\n"
  },
  {
    "path": "examples/JsonParserExample/JsonParserExample.ino",
    "content": "// ArduinoJson - https://arduinojson.org\r\n// Copyright © 2014-2025, Benoit BLANCHON\r\n// MIT License\r\n//\r\n// This example shows how to deserialize a JSON document with ArduinoJson.\r\n//\r\n// https://arduinojson.org/v7/example/parser/\r\n\r\n#include <ArduinoJson.h>\r\n\r\nvoid setup() {\r\n  // Initialize serial port\r\n  Serial.begin(9600);\r\n  while (!Serial)\r\n    continue;\r\n\r\n  // Allocate the JSON document\r\n  JsonDocument doc;\r\n\r\n  // JSON input string.\r\n  const char* json =\r\n      \"{\\\"sensor\\\":\\\"gps\\\",\\\"time\\\":1351824120,\\\"data\\\":[48.756080,2.302038]}\";\r\n\r\n  // Deserialize the JSON document\r\n  DeserializationError error = deserializeJson(doc, json);\r\n\r\n  // Test if parsing succeeds\r\n  if (error) {\r\n    Serial.print(F(\"deserializeJson() failed: \"));\r\n    Serial.println(error.f_str());\r\n    return;\r\n  }\r\n\r\n  // Fetch the values\r\n  //\r\n  // Most of the time, you can rely on the implicit casts.\r\n  // In other case, you can do doc[\"time\"].as<long>();\r\n  const char* sensor = doc[\"sensor\"];\r\n  long time = doc[\"time\"];\r\n  double latitude = doc[\"data\"][0];\r\n  double longitude = doc[\"data\"][1];\r\n\r\n  // Print the values\r\n  Serial.println(sensor);\r\n  Serial.println(time);\r\n  Serial.println(latitude, 6);\r\n  Serial.println(longitude, 6);\r\n}\r\n\r\nvoid loop() {\r\n  // not used in this example\r\n}\r\n\r\n// See also\r\n// --------\r\n//\r\n// https://arduinojson.org/ contains the documentation for all the functions\r\n// used above. It also includes an FAQ that will help you solve any\r\n// deserialization problem.\r\n//\r\n// The book \"Mastering ArduinoJson\" contains a tutorial on deserialization.\r\n// It begins with a simple example, like the one above, and then adds more\r\n// features like deserializing directly from a file or an HTTP request.\r\n// Learn more at https://arduinojson.org/book/\r\n// Use the coupon code TWENTY for a 20% discount ❤❤❤❤❤\r\n"
  },
  {
    "path": "examples/JsonServer/JsonServer.ino",
    "content": "// ArduinoJson - https://arduinojson.org\n// Copyright © 2014-2025, Benoit BLANCHON\n// MIT License\n//\n// This example shows how to implement an HTTP server that sends a JSON document\n// in the response.\n// It uses the Ethernet library but can be easily adapted for Wifi.\n//\n// The JSON document contains the values of the analog and digital pins.\n// It looks like that:\n// {\n//   \"analog\": [0, 76, 123, 158, 192, 205],\n//   \"digital\": [1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0]\n// }\n//\n// https://arduinojson.org/v7/example/http-server/\n\n#include <ArduinoJson.h>\n#include <Ethernet.h>\n#include <SPI.h>\n\nbyte mac[] = {0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED};\nEthernetServer server(80);\n\nvoid setup() {\n  // Initialize serial port\n  Serial.begin(9600);\n  while (!Serial)\n    continue;\n\n  // Initialize Ethernet libary\n  if (!Ethernet.begin(mac)) {\n    Serial.println(F(\"Failed to initialize Ethernet library\"));\n    return;\n  }\n\n  // Start to listen\n  server.begin();\n\n  Serial.println(F(\"Server is ready.\"));\n  Serial.print(F(\"Please connect to http://\"));\n  Serial.println(Ethernet.localIP());\n}\n\nvoid loop() {\n  // Wait for an incomming connection\n  EthernetClient client = server.available();\n\n  // Do we have a client?\n  if (!client)\n    return;\n\n  Serial.println(F(\"New client\"));\n\n  // Read the request (we ignore the content in this example)\n  while (client.available())\n    client.read();\n\n  // Allocate a temporary JsonDocument\n  JsonDocument doc;\n\n  // Create the \"analog\" array\n  JsonArray analogValues = doc[\"analog\"].to<JsonArray>();\n  for (int pin = 0; pin < 6; pin++) {\n    // Read the analog input\n    int value = analogRead(pin);\n\n    // Add the value at the end of the array\n    analogValues.add(value);\n  }\n\n  // Create the \"digital\" array\n  JsonArray digitalValues = doc[\"digital\"].to<JsonArray>();\n  for (int pin = 0; pin < 14; pin++) {\n    // Read the digital input\n    int value = digitalRead(pin);\n\n    // Add the value at the end of the array\n    digitalValues.add(value);\n  }\n\n  Serial.print(F(\"Sending: \"));\n  serializeJson(doc, Serial);\n  Serial.println();\n\n  // Write response headers\n  client.println(F(\"HTTP/1.0 200 OK\"));\n  client.println(F(\"Content-Type: application/json\"));\n  client.println(F(\"Connection: close\"));\n  client.print(F(\"Content-Length: \"));\n  client.println(measureJsonPretty(doc));\n  client.println();\n\n  // Write JSON document\n  serializeJsonPretty(doc, client);\n\n  // Disconnect\n  client.stop();\n}\n\n// Performance issue?\n// ------------------\n//\n// EthernetClient is an unbuffered stream, which is not optimal for ArduinoJson.\n// See: https://arduinojson.org/v7/how-to/improve-speed/\n\n// See also\n// --------\n//\n// https://arduinojson.org/ contains the documentation for all the functions\n// used above. It also includes an FAQ that will help you solve any\n// serialization problem.\n//\n// The book \"Mastering ArduinoJson\" contains a tutorial on serialization.\n// It begins with a simple example, then adds more features like serializing\n// directly to a file or an HTTP client.\n// Learn more at https://arduinojson.org/book/\n// Use the coupon code TWENTY for a 20% discount ❤❤❤❤❤\n"
  },
  {
    "path": "examples/JsonUdpBeacon/JsonUdpBeacon.ino",
    "content": "// ArduinoJson - https://arduinojson.org\n// Copyright © 2014-2025, Benoit BLANCHON\n// MIT License\n//\n// This example shows how to send a JSON document to a UDP socket.\n// At regular interval, it sends a UDP packet that contains the status of\n// analog and digital pins.\n// It looks like that:\n// {\n//   \"analog\": [0, 76, 123, 158, 192, 205],\n//   \"digital\": [1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0]\n// }\n//\n// If you want to test this program, you need to be able to receive the UDP\n// packets.\n// For example, you can run netcat on your computer\n// $ ncat -ulp 8888\n// See https://nmap.org/ncat/\n//\n// https://arduinojson.org/v7/example/udp-beacon/\n\n#include <ArduinoJson.h>\n#include <Ethernet.h>\n#include <SPI.h>\n\nbyte mac[] = {0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED};\nIPAddress remoteIp(192, 168, 0, 108);  // <- EDIT!!!!\nunsigned short remotePort = 8888;\nunsigned short localPort = 8888;\nEthernetUDP udp;\n\nvoid setup() {\n  // Initialize serial port\n  Serial.begin(9600);\n  while (!Serial)\n    continue;\n\n  // Initialize Ethernet libary\n  if (!Ethernet.begin(mac)) {\n    Serial.println(F(\"Failed to initialize Ethernet library\"));\n    return;\n  }\n\n  // Enable UDP\n  udp.begin(localPort);\n}\n\nvoid loop() {\n  // Allocate a temporary JsonDocument\n  JsonDocument doc;\n\n  // Create the \"analog\" array\n  JsonArray analogValues = doc[\"analog\"].to<JsonArray>();\n  for (int pin = 0; pin < 6; pin++) {\n    // Read the analog input\n    int value = analogRead(pin);\n\n    // Add the value at the end of the array\n    analogValues.add(value);\n  }\n\n  // Create the \"digital\" array\n  JsonArray digitalValues = doc[\"digital\"].to<JsonArray>();\n  for (int pin = 0; pin < 14; pin++) {\n    // Read the digital input\n    int value = digitalRead(pin);\n\n    // Add the value at the end of the array\n    digitalValues.add(value);\n  }\n\n  // Log\n  Serial.print(F(\"Sending to \"));\n  Serial.print(remoteIp);\n  Serial.print(F(\" on port \"));\n  Serial.println(remotePort);\n  serializeJson(doc, Serial);\n\n  // Send UDP packet\n  udp.beginPacket(remoteIp, remotePort);\n  serializeJson(doc, udp);\n  udp.println();\n  udp.endPacket();\n\n  // Wait\n  delay(10000);\n}\n\n// Performance issue?\n// ------------------\n//\n// EthernetUDP is an unbuffered stream, which is not optimal for ArduinoJson.\n// See: https://arduinojson.org/v7/how-to/improve-speed/\n\n// See also\n// --------\n//\n// https://arduinojson.org/ contains the documentation for all the functions\n// used above. It also includes an FAQ that will help you solve any\n// serialization problem.\n//\n// The book \"Mastering ArduinoJson\" contains a tutorial on serialization.\n// It begins with a simple example, then adds more features like serializing\n// directly to a file or any stream.\n// Learn more at https://arduinojson.org/book/\n// Use the coupon code TWENTY for a 20% discount ❤❤❤❤❤\n"
  },
  {
    "path": "examples/MsgPackParser/MsgPackParser.ino",
    "content": "// ArduinoJson - https://arduinojson.org\n// Copyright © 2014-2025, Benoit BLANCHON\n// MIT License\n//\n// This example shows how to deserialize a MessagePack document with\n// ArduinoJson.\n//\n// https://arduinojson.org/v7/example/msgpack-parser/\n\n#include <ArduinoJson.h>\n\nvoid setup() {\n  // Initialize serial port\n  Serial.begin(9600);\n  while (!Serial)\n    continue;\n\n  // Allocate the JSON document\n  JsonDocument doc;\n\n  // The MessagePack input string\n  uint8_t input[] = {131, 166, 115, 101, 110, 115, 111, 114, 163, 103, 112, 115,\n                     164, 116, 105, 109, 101, 206, 80,  147, 50,  248, 164, 100,\n                     97,  116, 97,  146, 203, 64,  72,  96,  199, 58,  188, 148,\n                     112, 203, 64,  2,   106, 146, 230, 33,  49,  169};\n  // This MessagePack document contains:\n  // {\n  //   \"sensor\": \"gps\",\n  //   \"time\": 1351824120,\n  //   \"data\": [48.75608, 2.302038]\n  // }\n\n  // Parse the input\n  DeserializationError error = deserializeMsgPack(doc, input);\n\n  // Test if parsing succeeded\n  if (error) {\n    Serial.print(\"deserializeMsgPack() failed: \");\n    Serial.println(error.f_str());\n    return;\n  }\n\n  // Fetch the values\n  //\n  // Most of the time, you can rely on the implicit casts.\n  // In other case, you can do doc[\"time\"].as<long>();\n  const char* sensor = doc[\"sensor\"];\n  long time = doc[\"time\"];\n  double latitude = doc[\"data\"][0];\n  double longitude = doc[\"data\"][1];\n\n  // Print the values\n  Serial.println(sensor);\n  Serial.println(time);\n  Serial.println(latitude, 6);\n  Serial.println(longitude, 6);\n}\n\nvoid loop() {\n  // not used in this example\n}\n"
  },
  {
    "path": "examples/ProgmemExample/ProgmemExample.ino",
    "content": "// ArduinoJson - https://arduinojson.org\n// Copyright © 2014-2025, Benoit BLANCHON\n// MIT License\n//\n// This example shows the different ways you can use Flash strings with\n// ArduinoJson.\n//\n// Use Flash strings sparingly, because ArduinoJson duplicates them in the\n// JsonDocument. Prefer plain old char*, as they are more efficient in term of\n// code size, speed, and memory usage.\n//\n// https://arduinojson.org/v7/example/progmem/\n\n#include <ArduinoJson.h>\n\nvoid setup() {\n  JsonDocument doc;\n\n  // You can use a Flash String as your JSON input.\n  // WARNING: the strings in the input will be duplicated in the JsonDocument.\n  deserializeJson(doc, F(\"{\\\"sensor\\\":\\\"gps\\\",\\\"time\\\":1351824120,\"\n                         \"\\\"data\\\":[48.756080,2.302038]}\"));\n\n  // You can use a Flash String as a key to get a member from JsonDocument\n  // No duplication is done.\n  long time = doc[F(\"time\")];\n\n  // You can use a Flash String as a key to set a member of a JsonDocument\n  // WARNING: the content of the Flash String will be duplicated in the\n  // JsonDocument.\n  doc[F(\"time\")] = time;\n\n  // You can set a Flash String as the content of a JsonVariant\n  // WARNING: the content of the Flash String will be duplicated in the\n  // JsonDocument.\n  doc[\"sensor\"] = F(\"gps\");\n\n  // It works with serialized() too:\n  doc[\"sensor\"] = serialized(F(\"\\\"gps\\\"\"));\n  doc[\"sensor\"] = serialized(F(\"\\xA3gps\"), 3);\n\n  // You can compare the content of a JsonVariant to a Flash String\n  if (doc[\"sensor\"] == F(\"gps\")) {\n    // ...\n  }\n}\n\nvoid loop() {\n  // not used in this example\n}\n\n// See also\n// --------\n//\n// https://arduinojson.org/ contains the documentation for all the functions\n// used above. It also includes an FAQ that will help you solve any memory\n// problem.\n//\n// The book \"Mastering ArduinoJson\" contains a quick C++ course that explains\n// how your microcontroller stores strings in memory. It also tells why you\n// should not abuse Flash strings with ArduinoJson.\n// Learn more at https://arduinojson.org/book/\n// Use the coupon code TWENTY for a 20% discount ❤❤❤❤❤\n"
  },
  {
    "path": "examples/StringExample/StringExample.ino",
    "content": "// ArduinoJson - https://arduinojson.org\n// Copyright © 2014-2025, Benoit BLANCHON\n// MIT License\n//\n// This example shows the different ways you can use String with ArduinoJson.\n//\n// Use String objects sparingly, because ArduinoJson duplicates them in the\n// JsonDocument. Prefer plain old char[], as they are more efficient in term of\n// code size, speed, and memory usage.\n//\n// https://arduinojson.org/v7/example/string/\n\n#include <ArduinoJson.h>\n\nvoid setup() {\n  JsonDocument doc;\n\n  // You can use a String as your JSON input.\n  // WARNING: the string in the input  will be duplicated in the JsonDocument.\n  String input =\n      \"{\\\"sensor\\\":\\\"gps\\\",\\\"time\\\":1351824120,\\\"data\\\":[48.756080,2.302038]}\";\n  deserializeJson(doc, input);\n\n  // You can use a String as a key to get a member from JsonDocument\n  // No duplication is done.\n  long time = doc[String(\"time\")];\n\n  // You can use a String as a key to set a member of a JsonDocument\n  // WARNING: the content of the String will be duplicated in the JsonDocument.\n  doc[String(\"time\")] = time;\n\n  // You can get the content of a JsonVariant as a String\n  // No duplication is done, at least not in the JsonDocument.\n  String sensor = doc[\"sensor\"];\n\n  // Unfortunately, the following doesn't work (issue #118):\n  // sensor = doc[\"sensor\"]; // <-  error \"ambiguous overload for 'operator='\"\n  // As a workaround, you need to replace by:\n  sensor = doc[\"sensor\"].as<String>();\n\n  // You can set a String as the content of a JsonVariant\n  // WARNING: the content of the String will be duplicated in the JsonDocument.\n  doc[\"sensor\"] = sensor;\n\n  // It works with serialized() too:\n  doc[\"sensor\"] = serialized(sensor);\n\n  // You can also concatenate strings\n  // WARNING: the content of the String will be duplicated in the JsonDocument.\n  doc[String(\"sen\") + \"sor\"] = String(\"gp\") + \"s\";\n\n  // You can compare the content of a JsonObject with a String\n  if (doc[\"sensor\"] == sensor) {\n    // ...\n  }\n\n  // Lastly, you can print the resulting JSON to a String\n  String output;\n  serializeJson(doc, output);\n}\n\nvoid loop() {\n  // not used in this example\n}\n\n// See also\n// --------\n//\n// https://arduinojson.org/ contains the documentation for all the functions\n// used above. It also includes an FAQ that will help you solve any problem.\n//\n// The book \"Mastering ArduinoJson\" contains a quick C++ course that explains\n// how your microcontroller stores strings in memory. On several occasions, it\n// shows how you can avoid String in your program.\n// Learn more at https://arduinojson.org/book/\n// Use the coupon code TWENTY for a 20% discount ❤❤❤❤❤\n"
  },
  {
    "path": "extras/ArduinoJsonConfig.cmake.in",
    "content": "@PACKAGE_INIT@\n\ninclude(\"${CMAKE_CURRENT_LIST_DIR}/@PROJECT_NAME@Targets.cmake\")\ncheck_required_components(\"@PROJECT_NAME@\")\n"
  },
  {
    "path": "extras/CompileOptions.cmake",
    "content": "if(NOT DEFINED COVERAGE)\n\tset(COVERAGE OFF)\nendif()\n\nif(CMAKE_CXX_COMPILER_ID MATCHES \"(GNU|Clang)\")\n\tadd_compile_options(\n\t\t-pedantic\n\t\t-Wall\n\t\t-Wcast-align\n\t\t-Wcast-qual\n\t\t-Wconversion\n\t\t-Wctor-dtor-privacy\n\t\t-Wdisabled-optimization\n\t\t-Werror\n\t\t-Wextra\n\t\t-Wformat=2\n\t\t-Winit-self\n\t\t-Wmissing-include-dirs\n\t\t-Wnon-virtual-dtor\n\t\t-Wold-style-cast\n\t\t-Woverloaded-virtual\n\t\t-Wparentheses\n\t\t-Wredundant-decls\n\t\t-Wshadow\n\t\t-Wsign-conversion\n\t\t-Wsign-promo\n\t\t-Wstrict-aliasing\n\t\t-Wundef\n\t)\n\n\tif(${COVERAGE})\n\t\tset(CMAKE_CXX_FLAGS \"-fprofile-arcs -ftest-coverage\")\n\tendif()\nendif()\n\nif(CMAKE_CXX_COMPILER_ID STREQUAL \"GNU\")\n\tif((CMAKE_CXX_COMPILER_VERSION VERSION_GREATER 4.9) AND(NOT ${COVERAGE}))\n\t\tadd_compile_options(-g -Og)\n\telse() # GCC 4.8\n\t\tadd_compile_options(\n\t\t\t-g\n\t\t\t-O0 # GCC 4.8 doesn't support -Og\n\t\t\t-Wno-shadow  # allow the same name for a function parameter and a member functions\n\t\t\t-Wp,-w  # Disable preprocessing warnings (see below)\n\t\t)\n\t\t# GCC 4.8 doesn't support __has_include, so we need to help him\n\t\tadd_definitions(\n\t\t\t-DARDUINOJSON_ENABLE_STD_STRING=1\n\t\t\t-DARDUINOJSON_ENABLE_STD_STREAM=1\n\t\t)\n\tendif()\n\n\tadd_compile_options(\n\t\t-Wstrict-null-sentinel\n\t\t-Wno-vla # Allow VLA in tests\n\t)\n\tadd_definitions(-DHAS_VARIABLE_LENGTH_ARRAY)\n\n\tif(CMAKE_CXX_COMPILER_VERSION VERSION_GREATER 4.5)\n\t\tadd_compile_options(-Wlogical-op) # the flag exists in 4.4 but is buggy\n\tendif()\n\n\tif(CMAKE_CXX_COMPILER_VERSION VERSION_GREATER 4.6)\n\t\tadd_compile_options(-Wnoexcept)\n\tendif()\nendif()\n\nif(CMAKE_CXX_COMPILER_ID MATCHES \"Clang\")\n\tadd_compile_options(\n\t\t-Wc++11-compat\n\t\t-Wdeprecated-register\n\t\t-Wno-vla-extension # Allow VLA in tests\n\t)\n\tadd_definitions(\n\t\t-DHAS_VARIABLE_LENGTH_ARRAY\n\t\t-DSUBSCRIPT_CONFLICTS_WITH_BUILTIN_OPERATOR\n\t)\nendif()\n\nif(CMAKE_CXX_COMPILER_ID STREQUAL \"Clang\")\n\tadd_compile_options(-stdlib=libc++)\n\tlink_libraries(c++ m)\n\n\tif((CMAKE_CXX_COMPILER_VERSION VERSION_GREATER 4.0) AND(NOT ${COVERAGE}))\n\t\tadd_compile_options(-g -Og)\n\telse()\n\t\tadd_compile_options(-g -O0)\n\tendif()\nendif()\n\nif(CMAKE_CXX_COMPILER_ID STREQUAL \"AppleClang\")\n\tif((CMAKE_CXX_COMPILER_VERSION VERSION_GREATER 9.0) AND(NOT ${COVERAGE}))\n\t\tadd_compile_options(-g -Og)\n\telse()\n\t\tadd_compile_options(-g -O0)\n\tendif()\nendif()\n\nif(MSVC)\n\tadd_definitions(-D_CRT_SECURE_NO_WARNINGS)\n\tadd_compile_options(\n\t\t/W4 # Set warning level\n\t\t/WX # Treats all compiler warnings as errors.\n\t\t/Zc:__cplusplus # Enable updated __cplusplus macro\n\t)\nendif()\n\nif(MINGW)\n\t# Static link on MinGW to avoid linking with the wrong DLLs when multiple\n\t# versions are installed.\n\tadd_link_options(-static)\nendif()\n"
  },
  {
    "path": "extras/ci/espidf/CMakeLists.txt",
    "content": "# ArduinoJson - https://arduinojson.org\n# Copyright © 2014-2025, Benoit BLANCHON\n# MIT License\n\ncmake_minimum_required(VERSION 3.5)\n\ninclude($ENV{IDF_PATH}/tools/cmake/project.cmake)\nproject(example)\n"
  },
  {
    "path": "extras/ci/espidf/main/CMakeLists.txt",
    "content": "# ArduinoJson - https://arduinojson.org\n# Copyright © 2014-2025, Benoit BLANCHON\n# MIT License\n\nidf_component_register(\n\tSRCS \"main.cpp\"\n\tINCLUDE_DIRS \"\"\n)\n"
  },
  {
    "path": "extras/ci/espidf/main/component.mk",
    "content": "#\n# \"main\" pseudo-component makefile.\n#\n# (Uses default behaviour of compiling all source files in directory, adding 'include' to include path.)\n"
  },
  {
    "path": "extras/ci/espidf/main/main.cpp",
    "content": "// ArduinoJson - https://arduinojson.org\n// Copyright © 2014-2025, Benoit BLANCHON\n// MIT License\n\n#include <ArduinoJson.h>\n\nextern \"C\" void app_main() {\n  char buffer[256];\n  JsonDocument doc;\n\n  doc[\"hello\"] = \"world\";\n  serializeJson(doc, buffer);\n  deserializeJson(doc, buffer);\n  serializeMsgPack(doc, buffer);\n  deserializeMsgPack(doc, buffer);\n}\n"
  },
  {
    "path": "extras/ci/particle.sh",
    "content": "#!/bin/sh -ex\n\nBOARD=$1\n\ncd \"$(dirname \"$0\")/../../\"\n\ncp extras/particle/src/smocktest.ino src/\ncp extras/particle/project.properties ./\n\nparticle compile \"$BOARD\"\n"
  },
  {
    "path": "extras/conf_test/avr.cpp",
    "content": "#include <ArduinoJson.h>\n\nstatic_assert(ARDUINOJSON_ENABLE_PROGMEM == 1, \"ARDUINOJSON_ENABLE_PROGMEM\");\n\nstatic_assert(ARDUINOJSON_USE_LONG_LONG == 0, \"ARDUINOJSON_USE_LONG_LONG\");\n\nstatic_assert(ARDUINOJSON_SLOT_ID_SIZE == 1, \"ARDUINOJSON_SLOT_ID_SIZE\");\n\nstatic_assert(ARDUINOJSON_POOL_CAPACITY == 16, \"ARDUINOJSON_POOL_CAPACITY\");\n\nstatic_assert(ARDUINOJSON_LITTLE_ENDIAN == 1, \"ARDUINOJSON_LITTLE_ENDIAN\");\n\nstatic_assert(ARDUINOJSON_USE_DOUBLE == 0, \"ARDUINOJSON_USE_DOUBLE\");\n\nstatic_assert(sizeof(ArduinoJson::detail::VariantData) == 6, \"slot size\");\n\nvoid setup() {}\nvoid loop() {}\n"
  },
  {
    "path": "extras/conf_test/esp8266.cpp",
    "content": "#include <ArduinoJson.h>\n\nstatic_assert(ARDUINOJSON_USE_LONG_LONG == 1, \"ARDUINOJSON_USE_LONG_LONG\");\n\nstatic_assert(ARDUINOJSON_SLOT_ID_SIZE == 2, \"ARDUINOJSON_SLOT_ID_SIZE\");\n\nstatic_assert(ARDUINOJSON_POOL_CAPACITY == 128, \"ARDUINOJSON_POOL_CAPACITY\");\n\nstatic_assert(ARDUINOJSON_LITTLE_ENDIAN == 1, \"ARDUINOJSON_LITTLE_ENDIAN\");\n\nstatic_assert(ARDUINOJSON_USE_DOUBLE == 1, \"ARDUINOJSON_USE_DOUBLE\");\n\nstatic_assert(sizeof(ArduinoJson::detail::VariantData) == 8, \"slot size\");\n\nvoid setup() {}\nvoid loop() {}\n"
  },
  {
    "path": "extras/conf_test/x64.cpp",
    "content": "#include <ArduinoJson.h>\n\nstatic_assert(ARDUINOJSON_USE_LONG_LONG == 1, \"ARDUINOJSON_USE_LONG_LONG\");\n\nstatic_assert(ARDUINOJSON_SLOT_ID_SIZE == 4, \"ARDUINOJSON_SLOT_ID_SIZE\");\n\nstatic_assert(ARDUINOJSON_POOL_CAPACITY == 256, \"ARDUINOJSON_POOL_CAPACITY\");\n\nstatic_assert(ARDUINOJSON_LITTLE_ENDIAN == 1, \"ARDUINOJSON_LITTLE_ENDIAN\");\n\nstatic_assert(ARDUINOJSON_USE_DOUBLE == 1, \"ARDUINOJSON_USE_DOUBLE\");\n\nstatic_assert(sizeof(ArduinoJson::detail::VariantData) == 16, \"slot size\");\n\nint main() {}\n"
  },
  {
    "path": "extras/conf_test/x86.cpp",
    "content": "#include <ArduinoJson.h>\n\nstatic_assert(ARDUINOJSON_USE_LONG_LONG == 1, \"ARDUINOJSON_USE_LONG_LONG\");\n\nstatic_assert(ARDUINOJSON_SLOT_ID_SIZE == 2, \"ARDUINOJSON_SLOT_ID_SIZE\");\n\nstatic_assert(ARDUINOJSON_POOL_CAPACITY == 128, \"ARDUINOJSON_POOL_CAPACITY\");\n\nstatic_assert(ARDUINOJSON_LITTLE_ENDIAN == 1, \"ARDUINOJSON_LITTLE_ENDIAN\");\n\nstatic_assert(ARDUINOJSON_USE_DOUBLE == 1, \"ARDUINOJSON_USE_DOUBLE\");\n\nstatic_assert(sizeof(ArduinoJson::detail::VariantData) == 8, \"slot size\");\n\nint main() {}\n"
  },
  {
    "path": "extras/fuzzing/CMakeLists.txt",
    "content": "# ArduinoJson - https://arduinojson.org\n# Copyright © 2014-2025, Benoit BLANCHON\n# MIT License\n\nset(CMAKE_CXX_STANDARD 11)\nset(CMAKE_CXX_STANDARD_REQUIRED ON)\n\nif(MSVC)\n\tadd_compile_options(-D_CRT_SECURE_NO_WARNINGS)\nendif()\n\nfunction(add_fuzzer name)\n\tset(FUZZER \"${name}_fuzzer\")\n\tset(REPRODUCER \"${FUZZER}_reproducer\")\n\tset(CORPUS_DIR \"${CMAKE_CURRENT_SOURCE_DIR}/${name}_corpus\")\n\tset(SEED_CORPUS_DIR \"${CMAKE_CURRENT_SOURCE_DIR}/${name}_seed_corpus\")\n\n\tadd_executable(\"${FUZZER}\"\n\t\t\"${name}_fuzzer.cpp\"\n\t)\n\ttarget_link_libraries(\"${FUZZER}\"\n\t\tArduinoJson\n\t)\n\tset_target_properties(\"${FUZZER}\"\n\t\tPROPERTIES\n\t\t\tCOMPILE_FLAGS \"-fprofile-instr-generate -fcoverage-mapping -fsanitize=fuzzer -fno-sanitize-recover=all\"\n\t\t\tLINK_FLAGS \"-fprofile-instr-generate -fcoverage-mapping -fsanitize=fuzzer -fno-sanitize-recover=all\"\n\t)\n\n\tadd_test(\n\t\tNAME \"${FUZZER}\"\n\t\tCOMMAND \"${FUZZER}\" \"${CORPUS_DIR}\" \"${SEED_CORPUS_DIR}\" -max_total_time=5 -timeout=1\n\t)\n\tset_tests_properties(\"${FUZZER}\"\n\t\tPROPERTIES\n\t\tLABELS \"Fuzzing\"\n\t)\n\n\tadd_executable(\"${REPRODUCER}\"\n\t\t\"${name}_fuzzer.cpp\"\n\t\treproducer.cpp\n\t)\n\ttarget_link_libraries(\"${REPRODUCER}\"\n\t\tArduinoJson\n\t)\nendfunction()\n\n# Needs Clang 6+ to compile\nif(CMAKE_CXX_COMPILER_ID STREQUAL \"Clang\" AND CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 6)\n\tif(DEFINED ENV{GITHUB_ACTIONS} AND CMAKE_CXX_COMPILER_VERSION MATCHES \"^11\\\\.\")\n\t\t# Clang 11 fails on GitHub Actions with the following error:\n\t\t# > ERROR: UndefinedBehaviorSanitizer failed to allocate 0x0 (0) bytes of SetAlternateSignalStack (error code: 22)\n\t\t# > Sanitizer CHECK failed: /build/llvm-toolchain-11-mnvtwk/llvm-toolchain-11-11.1.0/compiler-rt/lib/sanitizer_common/sanitizer_common.cpp:54 ((0 && \"unable to mmap\")) != (0) (0, 0)\n\t\tmessage(WARNING \"Fuzzing is disabled on GitHub Actions to workaround a bug in Clang 11\")\n\t\treturn()\n\tendif()\n\n\tadd_fuzzer(json)\n\tadd_fuzzer(msgpack)\n\tadd_fuzzer(number)\nendif()\n"
  },
  {
    "path": "extras/fuzzing/Makefile",
    "content": "# CAUTION: this file is invoked by https://github.com/google/oss-fuzz\n\nCXXFLAGS += -I../../src -DARDUINOJSON_DEBUG=1 -std=c++11\n\nall: \\\n\t$(OUT)/json_fuzzer \\\n\t$(OUT)/json_fuzzer_seed_corpus.zip \\\n\t$(OUT)/json_fuzzer.options \\\n\t$(OUT)/msgpack_fuzzer \\\n\t$(OUT)/msgpack_fuzzer_seed_corpus.zip \\\n\t$(OUT)/msgpack_fuzzer.options \\\n\t$(OUT)/number_fuzzer \\\n\t$(OUT)/number_fuzzer_seed_corpus.zip \\\n\t$(OUT)/number_fuzzer.options\n\n$(OUT)/%_fuzzer: %_fuzzer.cpp $(shell find ../../src -type f)\n\t$(CXX) $(CXXFLAGS) $< -o$@ $(LIB_FUZZING_ENGINE)\n\n$(OUT)/%_fuzzer_seed_corpus.zip: %_seed_corpus/*\n\tzip -j $@ $?\n\n$(OUT)/%_fuzzer.options:\n\t@echo \"[libfuzzer]\" > $@\n\t@echo \"max_len = 4096\" >> $@\n\t@echo \"timeout = 10\" >> $@\n"
  },
  {
    "path": "extras/fuzzing/json_corpus/.gitignore",
    "content": "*\n!.gitignore\n"
  },
  {
    "path": "extras/fuzzing/json_fuzzer.cpp",
    "content": "#include <ArduinoJson.h>\n\nextern \"C\" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) {\n  JsonDocument doc;\n  DeserializationError error = deserializeJson(doc, data, size);\n  if (!error) {\n    std::string json;\n    serializeJson(doc, json);\n  }\n  return 0;\n}\n"
  },
  {
    "path": "extras/fuzzing/json_seed_corpus/Comments.json",
    "content": "//comment\n/*comment*/\n[ //comment\n/*comment*/\"comment\"/*comment*/,//comment\n/*comment*/{//comment\n/* comment*/\"key\"//comment\n: //comment\n\"value\"//comment\n}/*comment*/\n]//comment"
  },
  {
    "path": "extras/fuzzing/json_seed_corpus/EmptyArray.json",
    "content": "[]"
  },
  {
    "path": "extras/fuzzing/json_seed_corpus/EmptyObject.json",
    "content": "{}"
  },
  {
    "path": "extras/fuzzing/json_seed_corpus/ExcessiveNesting.json",
    "content": "[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]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]"
  },
  {
    "path": "extras/fuzzing/json_seed_corpus/IntegerOverflow.json",
    "content": "9720730739393920739\n"
  },
  {
    "path": "extras/fuzzing/json_seed_corpus/Numbers.json",
    "content": "[\n  123,\n  -123,\n  123.456,\n  -123.456,\n  12e34,\n  12e-34,\n  12e+34,\n  12E34,\n  12E-34,\n  12E+34,\n  12.34e56,\n  12.34e-56,\n  12.34e+56,\n  12.34E56,\n  12.34E-56,\n  12.34E+56,\n  NaN,\n  -NaN,\n  +NaN,\n  Infinity,\n  +Infinity,\n  -Infinity\n]"
  },
  {
    "path": "extras/fuzzing/json_seed_corpus/OpenWeatherMap.json",
    "content": "{\n  \"coord\": {\n    \"lon\": -0.13,\n    \"lat\": 51.51\n  },\n  \"weather\": [\n    {\n      \"id\": 301,\n      \"main\": \"Drizzle\",\n      \"description\": \"drizzle\",\n      \"icon\": \"09n\"\n    },\n    {\n      \"id\": 701,\n      \"main\": \"Mist\",\n      \"description\": \"mist\",\n      \"icon\": \"50n\"\n    },\n    {\n      \"id\": 741,\n      \"main\": \"Fog\",\n      \"description\": \"fog\",\n      \"icon\": \"50n\"\n    }\n  ],\n  \"base\": \"stations\",\n  \"main\": {\n    \"temp\": 281.87,\n    \"pressure\": 1032,\n    \"humidity\": 100,\n    \"temp_min\": 281.15,\n    \"temp_max\": 283.15\n  },\n  \"visibility\": 2900,\n  \"wind\": {\n    \"speed\": 1.5\n  },\n  \"clouds\": {\n    \"all\": 90\n  },\n  \"dt\": 1483820400,\n  \"sys\": {\n    \"type\": 1,\n    \"id\": 5091,\n    \"message\": 0.0226,\n    \"country\": \"GB\",\n    \"sunrise\": 1483776245,\n    \"sunset\": 1483805443\n  },\n  \"id\": 2643743,\n  \"name\": \"London\",\n  \"cod\": 200\n}\n"
  },
  {
    "path": "extras/fuzzing/json_seed_corpus/Strings.json",
    "content": "[\n  \"hello\",\n  'hello',\n  hello,\n  {\"hello\":\"world\"},\n  {'hello':'world'},\n  {hello:world}\n]"
  },
  {
    "path": "extras/fuzzing/json_seed_corpus/WeatherUnderground.json",
    "content": "{\n  \"response\": {\n    \"version\": \"0.1\",\n    \"termsofService\": \"http://www.wunderground.com/weather/api/d/terms.html\",\n    \"features\": {\n      \"conditions\": 1\n    }\n  },\n  \"current_observation\": {\n    \"image\": {\n      \"url\": \"http://icons-ak.wxug.com/graphics/wu2/logo_130x80.png\",\n      \"title\": \"Weather Underground\",\n      \"link\": \"http://www.wunderground.com\"\n    },\n    \"display_location\": {\n      \"full\": \"San Francisco, CA\",\n      \"city\": \"San Francisco\",\n      \"state\": \"CA\",\n      \"state_name\": \"California\",\n      \"country\": \"US\",\n      \"country_iso3166\": \"US\",\n      \"zip\": \"94101\",\n      \"latitude\": \"37.77500916\",\n      \"longitude\": \"-122.41825867\",\n      \"elevation\": \"47.00000000\"\n    },\n    \"observation_location\": {\n      \"full\": \"SOMA - Near Van Ness, San Francisco, California\",\n      \"city\": \"SOMA - Near Van Ness, San Francisco\",\n      \"state\": \"California\",\n      \"country\": \"US\",\n      \"country_iso3166\": \"US\",\n      \"latitude\": \"37.773285\",\n      \"longitude\": \"-122.417725\",\n      \"elevation\": \"49 ft\"\n    },\n    \"estimated\": {},\n    \"station_id\": \"KCASANFR58\",\n    \"observation_time\": \"Last Updated on June 27, 5:27 PM PDT\",\n    \"observation_time_rfc822\": \"Wed, 27 Jun 2012 17:27:13 -0700\",\n    \"observation_epoch\": \"1340843233\",\n    \"local_time_rfc822\": \"Wed, 27 Jun 2012 17:27:14 -0700\",\n    \"local_epoch\": \"1340843234\",\n    \"local_tz_short\": \"PDT\",\n    \"local_tz_long\": \"America/Los_Angeles\",\n    \"local_tz_offset\": \"-0700\",\n    \"weather\": \"Partly Cloudy\",\n    \"temperature_string\": \"66.3 F (19.1 C)\",\n    \"temp_f\": 66.3,\n    \"temp_c\": 19.1,\n    \"relative_humidity\": \"65%\",\n    \"wind_string\": \"From the NNW at 22.0 MPH Gusting to 28.0 MPH\",\n    \"wind_dir\": \"NNW\",\n    \"wind_degrees\": 346,\n    \"wind_mph\": 22,\n    \"wind_gust_mph\": \"28.0\",\n    \"wind_kph\": 35.4,\n    \"wind_gust_kph\": \"45.1\",\n    \"pressure_mb\": \"1013\",\n    \"pressure_in\": \"29.93\",\n    \"pressure_trend\": \"+\",\n    \"dewpoint_string\": \"54 F (12 C)\",\n    \"dewpoint_f\": 54,\n    \"dewpoint_c\": 12,\n    \"heat_index_string\": \"NA\",\n    \"heat_index_f\": \"NA\",\n    \"heat_index_c\": \"NA\",\n    \"windchill_string\": \"NA\",\n    \"windchill_f\": \"NA\",\n    \"windchill_c\": \"NA\",\n    \"feelslike_string\": \"66.3 F (19.1 C)\",\n    \"feelslike_f\": \"66.3\",\n    \"feelslike_c\": \"19.1\",\n    \"visibility_mi\": \"10.0\",\n    \"visibility_km\": \"16.1\",\n    \"solarradiation\": \"\",\n    \"UV\": \"5\",\n    \"precip_1hr_string\": \"0.00 in ( 0 mm)\",\n    \"precip_1hr_in\": \"0.00\",\n    \"precip_1hr_metric\": \" 0\",\n    \"precip_today_string\": \"0.00 in (0 mm)\",\n    \"precip_today_in\": \"0.00\",\n    \"precip_today_metric\": \"0\",\n    \"icon\": \"partlycloudy\",\n    \"icon_url\": \"http://icons-ak.wxug.com/i/c/k/partlycloudy.gif\",\n    \"forecast_url\": \"http://www.wunderground.com/US/CA/San_Francisco.html\",\n    \"history_url\": \"http://www.wunderground.com/history/airport/KCASANFR58/2012/6/27/DailyHistory.html\",\n    \"ob_url\": \"http://www.wunderground.com/cgi-bin/findweather/getForecast?query=37.773285,-122.417725\"\n  }\n}\n"
  },
  {
    "path": "extras/fuzzing/msgpack_corpus/.gitignore",
    "content": "*\n!.gitignore\n"
  },
  {
    "path": "extras/fuzzing/msgpack_fuzzer.cpp",
    "content": "#include <ArduinoJson.h>\n\nextern \"C\" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) {\n  JsonDocument doc;\n  DeserializationError error = deserializeMsgPack(doc, data, size);\n  if (!error) {\n    std::string json;\n    serializeMsgPack(doc, json);\n  }\n  return 0;\n}\n"
  },
  {
    "path": "extras/fuzzing/msgpack_seed_corpus/false",
    "content": ""
  },
  {
    "path": "extras/fuzzing/msgpack_seed_corpus/fixarray",
    "content": "helloworld"
  },
  {
    "path": "extras/fuzzing/msgpack_seed_corpus/fixint_negative",
    "content": ""
  },
  {
    "path": "extras/fuzzing/msgpack_seed_corpus/fixint_positive",
    "content": ""
  },
  {
    "path": "extras/fuzzing/msgpack_seed_corpus/fixmap",
    "content": "one\u0001two\u0002"
  },
  {
    "path": "extras/fuzzing/msgpack_seed_corpus/fixstr",
    "content": "hello world"
  },
  {
    "path": "extras/fuzzing/msgpack_seed_corpus/float32",
    "content": "@H"
  },
  {
    "path": "extras/fuzzing/msgpack_seed_corpus/float64",
    "content": "@\t!\u0012o"
  },
  {
    "path": "extras/fuzzing/msgpack_seed_corpus/int16",
    "content": ""
  },
  {
    "path": "extras/fuzzing/msgpack_seed_corpus/int32",
    "content": "Ҷi."
  },
  {
    "path": "extras/fuzzing/msgpack_seed_corpus/int64",
    "content": "\u00124Vx"
  },
  {
    "path": "extras/fuzzing/msgpack_seed_corpus/int8",
    "content": ""
  },
  {
    "path": "extras/fuzzing/msgpack_seed_corpus/nil",
    "content": ""
  },
  {
    "path": "extras/fuzzing/msgpack_seed_corpus/str8",
    "content": "\u0005hello"
  },
  {
    "path": "extras/fuzzing/msgpack_seed_corpus/true",
    "content": ""
  },
  {
    "path": "extras/fuzzing/msgpack_seed_corpus/uint16",
    "content": "09"
  },
  {
    "path": "extras/fuzzing/msgpack_seed_corpus/uint32",
    "content": "\u00124Vx"
  },
  {
    "path": "extras/fuzzing/msgpack_seed_corpus/uint64",
    "content": "\u00124Vx"
  },
  {
    "path": "extras/fuzzing/msgpack_seed_corpus/uint8",
    "content": ""
  },
  {
    "path": "extras/fuzzing/number_corpus/.gitignore",
    "content": "*\n!.gitignore\n"
  },
  {
    "path": "extras/fuzzing/number_fuzzer.cpp",
    "content": "#include <ArduinoJson.h>\n\nextern \"C\" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) {\n  // Make a copy to ensure the input is null-terminated\n  std::string str(reinterpret_cast<const char*>(data), size);\n\n  ArduinoJson::detail::parseNumber(str.c_str());\n\n  return 0;\n}\n"
  },
  {
    "path": "extras/fuzzing/number_seed_corpus/decimal_half",
    "content": "0.5\n"
  },
  {
    "path": "extras/fuzzing/number_seed_corpus/decimal_one_and_half",
    "content": "1.5\n"
  },
  {
    "path": "extras/fuzzing/number_seed_corpus/infinity",
    "content": "infinity\n"
  },
  {
    "path": "extras/fuzzing/number_seed_corpus/issue2220-1",
    "content": "1000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000\n"
  },
  {
    "path": "extras/fuzzing/number_seed_corpus/issue2220-2",
    "content": "0.00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001\n"
  },
  {
    "path": "extras/fuzzing/number_seed_corpus/large_decimal",
    "content": "999999.999999\n"
  },
  {
    "path": "extras/fuzzing/number_seed_corpus/large_integer",
    "content": "9876543210\n"
  },
  {
    "path": "extras/fuzzing/number_seed_corpus/leading_zeros",
    "content": "0.00001\n"
  },
  {
    "path": "extras/fuzzing/number_seed_corpus/nan",
    "content": "nan\n"
  },
  {
    "path": "extras/fuzzing/number_seed_corpus/negative_decimal",
    "content": "-123.456\n"
  },
  {
    "path": "extras/fuzzing/number_seed_corpus/negative_one",
    "content": "-1\n"
  },
  {
    "path": "extras/fuzzing/number_seed_corpus/negative_scientific",
    "content": "-2.5e-3\n"
  },
  {
    "path": "extras/fuzzing/number_seed_corpus/negative_scientific_large_exp",
    "content": "-1.23456e+20\n"
  },
  {
    "path": "extras/fuzzing/number_seed_corpus/negative_zero",
    "content": "-0\n"
  },
  {
    "path": "extras/fuzzing/number_seed_corpus/one",
    "content": "1\n"
  },
  {
    "path": "extras/fuzzing/number_seed_corpus/pi_approximation",
    "content": "3.14159265359\n"
  },
  {
    "path": "extras/fuzzing/number_seed_corpus/scientific_e10",
    "content": "1e10\n"
  },
  {
    "path": "extras/fuzzing/number_seed_corpus/scientific_e_minus",
    "content": "1.5e-10\n"
  },
  {
    "path": "extras/fuzzing/number_seed_corpus/scientific_e_plus",
    "content": "1.23e+5\n"
  },
  {
    "path": "extras/fuzzing/number_seed_corpus/small_decimal",
    "content": "0.001\n"
  },
  {
    "path": "extras/fuzzing/number_seed_corpus/small_integer",
    "content": "42\n"
  },
  {
    "path": "extras/fuzzing/number_seed_corpus/trailing_zeros",
    "content": "1000000\n"
  },
  {
    "path": "extras/fuzzing/number_seed_corpus/very_small_positive",
    "content": "0.0000001\n"
  },
  {
    "path": "extras/fuzzing/number_seed_corpus/zero",
    "content": "0\n"
  },
  {
    "path": "extras/fuzzing/reproducer.cpp",
    "content": "// ArduinoJson - https://arduinojson.org\n// Copyright © 2014-2025, Benoit BLANCHON\n// MIT License\n\n// This file is NOT use by Google's OSS fuzz\n// I only use it to reproduce the bugs found\n\n#include <stdint.h>  // size_t\n#include <stdio.h>   // fopen et al.\n#include <stdlib.h>  // exit\n#include <iostream>\n#include <vector>\n\nextern \"C\" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size);\n\nstd::vector<uint8_t> read(const char* path) {\n  FILE* f = fopen(path, \"rb\");\n  if (!f) {\n    std::cerr << \"Failed to open \" << path << std::endl;\n    exit(1);\n  }\n\n  fseek(f, 0, SEEK_END);\n  size_t size = static_cast<size_t>(ftell(f));\n  fseek(f, 0, SEEK_SET);\n\n  std::vector<uint8_t> buffer(size);\n  if (fread(buffer.data(), 1, size, f) != size) {\n    fclose(f);\n    std::cerr << \"Failed to read \" << path << std::endl;\n    exit(1);\n  }\n\n  fclose(f);\n  return buffer;\n}\n\nint main(int argc, const char* argv[]) {\n  if (argc < 2) {\n    std::cerr << \"Usage: msgpack_fuzzer files\" << std::endl;\n    return 1;\n  }\n\n  for (int i = 1; i < argc; i++) {\n    std::cout << \"Loading \" << argv[i] << std::endl;\n    std::vector<uint8_t> buffer = read(argv[i]);\n    LLVMFuzzerTestOneInput(buffer.data(), buffer.size());\n  }\n  return 0;\n}\n"
  },
  {
    "path": "extras/particle/project.properties",
    "content": "name=ArduinoJsonCI\n"
  },
  {
    "path": "extras/particle/src/smocktest.ino",
    "content": "#include \"ArduinoJson.h\"\n\nvoid setup() {}\n\nvoid loop() {}\n"
  },
  {
    "path": "extras/scripts/build-single-header.sh",
    "content": "#!/bin/bash\n\nset -e\n\nRE_RELATIVE_INCLUDE='^#[[:space:]]*include[[:space:]]*\"(.*)\"'\nRE_ABSOLUTE_INCLUDE='^#[[:space:]]*include[[:space:]]*<(ArduinoJson/.*)>'\nRE_SYSTEM_INCLUDE='^#[[:space:]]*include[[:space:]]*<(.*)>'\nRE_EMPTY='^(#[[:space:]]*pragma[[:space:]]+once)?[[:space:]]*(//.*)?$'\nSRC_DIRECTORY=\"$(realpath \"$(dirname $0)/../../src\")\"\n\n\ndeclare -A INCLUDED\n\nprocess()\n{\n\tlocal PARENT=$1\n\tlocal FOLDER=$(dirname $1)\n\tlocal SHOW_COMMENT=$2\n\twhile IFS= read -r LINE; do\n\t\tif [[ $LINE =~ $RE_ABSOLUTE_INCLUDE ]]; then\n\t\t\tlocal CHILD=${BASH_REMATCH[1]}\n\t\t\tlocal CHILD_PATH\n\t\t\tCHILD_PATH=$(realpath \"$SRC_DIRECTORY/$CHILD\")\n\t\t\techo \"$PARENT -> $CHILD\" >&2\n\t\t\tif [[ ! ${INCLUDED[$CHILD_PATH]} ]]; then\n\t\t\t\tINCLUDED[$CHILD_PATH]=true\n\t\t\t\tprocess \"$CHILD\" false\n\t\t\tfi\n\t\telif [[ $LINE =~ $RE_RELATIVE_INCLUDE ]]; then\n\t\t\tlocal CHILD=${BASH_REMATCH[1]}\n\t\t\tpushd \"$FOLDER\" > /dev/null\n\t\t\tlocal CHILD_PATH\n\t\t\tCHILD_PATH=$(realpath \"$CHILD\")\n\t\t\techo \"$PARENT -> $CHILD\" >&2\n\t\t\tif [[ ! ${INCLUDED[$CHILD_PATH]} ]]; then\n\t\t\t\tINCLUDED[$CHILD_PATH]=true\n\t\t\t\tprocess \"$CHILD\" false\n\t\t\tfi\n\t\t\tpopd > /dev/null\n\t\telif [[ $LINE =~ $RE_SYSTEM_INCLUDE ]]; then\n\t\t\tlocal CHILD=${BASH_REMATCH[1]}\n\t\t\techo \"$PARENT -> <$CHILD>\" >&2\n\t\t\tif [[ ! ${INCLUDED[$CHILD]} ]]; then\n\t\t\t\techo \"#include <$CHILD>\"\n\t\t\t\tINCLUDED[$CHILD]=true\n\t\t\tfi\n\t\telif [[ \"${SHOW_COMMENT}\" = \"true\" ]] ; then\n\t\t\techo \"$LINE\"\n\t\telif [[ ! $LINE =~ $RE_EMPTY ]]; then\n\t\t\techo \"$LINE\"\n\t\tfi\n\tdone < $PARENT\n}\n\nsimplify_namespaces() {\n\tperl -p0i -e 's|ARDUINOJSON_END_PUBLIC_NAMESPACE\\r?\\nARDUINOJSON_BEGIN_PUBLIC_NAMESPACE\\r?\\n||igs' \"$1\"\n\tperl -p0i -e 's|ARDUINOJSON_END_PRIVATE_NAMESPACE\\r?\\nARDUINOJSON_BEGIN_PRIVATE_NAMESPACE\\r?\\n||igs' \"$1\"\n\trm -f \"$1.bak\"\n}\n\nINCLUDED=()\nINPUT=$1\nOUTPUT=$2\nprocess \"$INPUT\" true > \"$OUTPUT\"\nsimplify_namespaces \"$OUTPUT\"\n"
  },
  {
    "path": "extras/scripts/extract_changes.awk",
    "content": "#!/usr/bin/awk -f\n\n# Start echoing after the first list item\n/\\* / {\n    STARTED=1\n    EMPTY_LINE=0\n}\n\n# Remember if we have seen an empty line\n/^[[:space:]]*$/ {\n    EMPTY_LINE=1\n}\n\n# Exit when seeing a new version number\n/^v[[:digit:]]/ {\n    if (STARTED) exit\n}\n\n# Print if the line is not empty\n# and restore the empty line we have skipped\n!/^[[:space:]]*$/ {\n    if (STARTED) {\n        if (EMPTY_LINE) {\n            print \"\"\n            EMPTY_LINE=0\n        }\n        print\n    }\n}\n"
  },
  {
    "path": "extras/scripts/get-release-page.sh",
    "content": "#!/bin/bash\n\nset -eu\n\nVERSION=\"$1\"\nCHANGELOG=\"$2\"\nARDUINOJSON_H=\"$3\"\n\ncat << END\n---\nbranch: v7\nversion: $VERSION\ndate: '$(date +'%Y-%m-%d')'\n$(extras/scripts/wandbox/publish.sh \"$ARDUINOJSON_H\")\n---\n\n$(extras/scripts/extract_changes.awk \"$CHANGELOG\")\nEND\n"
  },
  {
    "path": "extras/scripts/publish-particle-library.sh",
    "content": "#!/usr/bin/env bash\n\nset -eu\n\nSOURCE_DIR=\"$(dirname \"$0\")/../..\"\nWORK_DIR=$(mktemp -d)\ntrap 'rm -rf \"$WORK_DIR\"' EXIT\n\ncp \"$SOURCE_DIR/README.md\" \"$WORK_DIR/README.md\"\ncp \"$SOURCE_DIR/CHANGELOG.md\" \"$WORK_DIR/CHANGELOG.md\"\ncp \"$SOURCE_DIR/library.properties\" \"$WORK_DIR/library.properties\"\ncp \"$SOURCE_DIR/LICENSE.txt\" \"$WORK_DIR/LICENSE.txt\"\ncp -r \"$SOURCE_DIR/src\" \"$WORK_DIR/\"\ncp -r \"$SOURCE_DIR/examples\" \"$WORK_DIR/\"\n\ncd \"$WORK_DIR\"\nparticle library upload\nparticle library publish\n"
  },
  {
    "path": "extras/scripts/publish.sh",
    "content": "#!/usr/bin/env bash\n\nset -eu\n\nwhich awk sed jq curl perl >/dev/null\n\ncd \"$(dirname \"$0\")/../..\"\n\nif ! git diff --quiet --exit-code; then\n\techo \"Repository contains uncommitted changes\"\n\texit\nfi\n\nVERSION=\"$1\"\nDATE=$(date +%F)\nTAG=\"v$VERSION\"\nVERSION_REGEX='[0-9]+\\.[0-9]+\\.[0-9]+(-[a-z0-9]+)?'\nSTARS=$(curl -s https://api.github.com/repos/bblanchon/ArduinoJson | jq '.stargazers_count')\n\nupdate_version_in_source () {\n\tIFS=\".-\" read MAJOR MINOR REVISION EXTRA < <(echo \"$VERSION\")\n\tUNDERLINE=$(printf -- '-%.0s' $(seq 1 ${#TAG}))\n\n\tsed -i~ -bE \"1,20{s/$VERSION_REGEX/$VERSION/g}\" README.md\n\trm README.md~\n\n\tsed -i~ -bE \"4s/HEAD/$TAG ($DATE)/; 5s/-+/$UNDERLINE/\" CHANGELOG.md\n\trm CHANGELOG.md~\n\n\tsed -i~ -bE \"s/(project\\\\s*\\\\(ArduinoJson\\\\s+VERSION\\\\s+).*?\\\\)/\\\\1$MAJOR.$MINOR.$REVISION)/\" CMakeLists.txt\n\trm CMakeLists.txt~\n\n\tsed -i~ -bE \\\n\t\t-e \"s/\\\"version\\\":.*$/\\\"version\\\": \\\"$VERSION\\\",/\" \\\n\t\t-e \"s/[0-9]+ stars/$STARS stars/\" \\\n\t\tlibrary.json\n\trm library.json~\n\n\tsed -i~ -bE \\\n\t\t-e \"s/version=.*$/version=$VERSION/\" \\\n\t\t-e \"s/[0-9]+ stars/$STARS stars/\" \\\n\t\tlibrary.properties\n\trm library.properties~\n\n\tsed -i~ -bE \"s/version: .*$/version: $VERSION.{build}/\" appveyor.yml\n\trm appveyor.yml~\n\n\tsed -i~ -bE \\\n\t\t-e \"s/^version: .*$/version: \\\"$VERSION\\\"/\" \\\n\t\t-e \"s/[0-9]+ stars/$STARS stars/\" \\\n\t\tidf_component.yml\n\trm idf_component.yml~\n\n\tsed -i~ -bE \\\n\t\t-e \"s/ARDUINOJSON_VERSION .*$/ARDUINOJSON_VERSION \\\"$VERSION\\\"/\" \\\n\t\t-e \"s/ARDUINOJSON_VERSION_MAJOR .*$/ARDUINOJSON_VERSION_MAJOR $MAJOR/\" \\\n\t\t-e \"s/ARDUINOJSON_VERSION_MINOR .*$/ARDUINOJSON_VERSION_MINOR $MINOR/\" \\\n\t\t-e \"s/ARDUINOJSON_VERSION_REVISION .*$/ARDUINOJSON_VERSION_REVISION $REVISION/\" \\\n\t\t-e \"s/ARDUINOJSON_VERSION_MACRO .*$/ARDUINOJSON_VERSION_MACRO V$MAJOR$MINOR$REVISION/\" \\\n\t\tsrc/ArduinoJson/version.hpp\n\trm src/ArduinoJson/version.hpp*~\n}\n\ncommit_new_version () {\n\tgit add src/ArduinoJson/version.hpp README.md CHANGELOG.md library.json library.properties appveyor.yml CMakeLists.txt idf_component.yml\n\tgit commit -m \"Set version to $VERSION\"\n}\n\nadd_tag () {\n\tCHANGES=$(awk '/\\* /{ FOUND=1; print; next } { if (FOUND) exit}' CHANGELOG.md)\n\tgit tag -m \"ArduinoJson $VERSION\"$'\\n'\"$CHANGES\" \"$TAG\"\n}\n\npush () {\n\tgit push --follow-tags\n}\n\nupdate_version_in_source\ncommit_new_version\nadd_tag\npush\n\nextras/scripts/build-single-header.sh \"src/ArduinoJson.h\" \"../ArduinoJson-$TAG.h\"\nextras/scripts/build-single-header.sh \"src/ArduinoJson.hpp\" \"../ArduinoJson-$TAG.hpp\"\nextras/scripts/get-release-page.sh \"$VERSION\" \"CHANGELOG.md\" \"../ArduinoJson-$TAG.h\" > \"../ArduinoJson-$TAG.md\"\n\necho \"You can now copy ../ArduinoJson-$TAG.md into arduinojson.org/collections/_versions/$VERSION.md\"\n"
  },
  {
    "path": "extras/scripts/wandbox/JsonGeneratorExample.cpp",
    "content": "// ArduinoJson - https://arduinojson.org\n// Copyright © 2014-2025, Benoit BLANCHON\n// MIT License\n//\n// This example shows how to generate a JSON document with ArduinoJson.\n\n#include <iostream>\n#include \"ArduinoJson.h\"\n\nint main() {\n  // Allocate the JSON document\n  JsonDocument doc;\n\n  // Add values in the document.\n  doc[\"sensor\"] = \"gps\";\n  doc[\"time\"] = 1351824120;\n\n  // Add an array\n  JsonArray data = doc[\"data\"].to<JsonArray>();\n  data.add(48.756080);\n  data.add(2.302038);\n\n  // Generate the minified JSON and send it to STDOUT\n  serializeJson(doc, std::cout);\n  // The above line prints:\n  // {\"sensor\":\"gps\",\"time\":1351824120,\"data\":[48.756080,2.302038]}\n\n  // Start a new line\n  std::cout << std::endl;\n\n  // Generate the prettified JSON and send it to STDOUT\n  serializeJsonPretty(doc, std::cout);\n  // The above line prints:\n  // {\n  //   \"sensor\": \"gps\",\n  //   \"time\": 1351824120,\n  //   \"data\": [\n  //     48.756080,\n  //     2.302038\n  //   ]\n  // }\n}\n"
  },
  {
    "path": "extras/scripts/wandbox/JsonParserExample.cpp",
    "content": "// ArduinoJson - https://arduinojson.org\n// Copyright © 2014-2025, Benoit BLANCHON\n// MIT License\n//\n// This example shows how to deserialize a JSON document with ArduinoJson.\n\n#include <iostream>\n#include \"ArduinoJson.h\"\n\nint main() {\n  // Allocate the JSON document\n  JsonDocument doc;\n\n  // JSON input string\n  const char* json =\n      \"{\\\"sensor\\\":\\\"gps\\\",\\\"time\\\":1351824120,\\\"data\\\":[48.756080,2.302038]}\";\n\n  // Deserialize the JSON document\n  DeserializationError error = deserializeJson(doc, json);\n\n  // Test if parsing succeeds\n  if (error) {\n    std::cerr << \"deserializeJson() failed: \" << error.c_str() << std::endl;\n    return 1;\n  }\n\n  // Fetch the values\n  //\n  // Most of the time, you can rely on the implicit casts.\n  // In other case, you can do doc[\"time\"].as<long>();\n  const char* sensor = doc[\"sensor\"];\n  long time = doc[\"time\"];\n  double latitude = doc[\"data\"][0];\n  double longitude = doc[\"data\"][1];\n\n  // Print the values\n  std::cout << sensor << std::endl;\n  std::cout << time << std::endl;\n  std::cout << latitude << std::endl;\n  std::cout << longitude << std::endl;\n\n  return 0;\n}\n"
  },
  {
    "path": "extras/scripts/wandbox/MsgPackParserExample.cpp",
    "content": "// ArduinoJson - https://arduinojson.org\n// Copyright © 2014-2025, Benoit BLANCHON\n// MIT License\n//\n// This example shows how to generate a JSON document with ArduinoJson.\n\n#include <iostream>\n#include \"ArduinoJson.h\"\n\nint main() {\n  // Allocate the JSON document\n  JsonDocument doc;\n\n  // The MessagePack input string\n  uint8_t input[] = {131, 166, 115, 101, 110, 115, 111, 114, 163, 103, 112, 115,\n                     164, 116, 105, 109, 101, 206, 80,  147, 50,  248, 164, 100,\n                     97,  116, 97,  146, 203, 64,  72,  96,  199, 58,  188, 148,\n                     112, 203, 64,  2,   106, 146, 230, 33,  49,  169};\n  // This MessagePack document contains:\n  // {\n  //   \"sensor\": \"gps\",\n  //   \"time\": 1351824120,\n  //   \"data\": [48.75608, 2.302038]\n  // }\n\n  // Parse the input\n  DeserializationError error = deserializeMsgPack(doc, input);\n\n  // Test if parsing succeeds\n  if (error) {\n    std::cerr << \"deserializeMsgPack() failed: \" << error.c_str() << std::endl;\n    return 1;\n  }\n\n  // Fetch the values\n  //\n  // Most of the time, you can rely on the implicit casts.\n  // In other case, you can do doc[\"time\"].as<long>();\n  const char* sensor = doc[\"sensor\"];\n  long time = doc[\"time\"];\n  double latitude = doc[\"data\"][0];\n  double longitude = doc[\"data\"][1];\n\n  // Print the values\n  std::cout << sensor << std::endl;\n  std::cout << time << std::endl;\n  std::cout << latitude << std::endl;\n  std::cout << longitude << std::endl;\n\n  return 0;\n}\n"
  },
  {
    "path": "extras/scripts/wandbox/publish.sh",
    "content": "#!/usr/bin/env bash\n\nset -eu\n\nARDUINOJSON_H=\"$1\"\n\nread_string() {\n\tjq --slurp --raw-input '.' \"$1\"\n}\n\ncompile() {\n\tFILE_PATH=\"$(dirname $0)/$1.cpp\"\n\tcat >parameters.json <<END\n{\n  \"code\":$(read_string \"$FILE_PATH\"),\n  \"codes\": [{\"file\":\"ArduinoJson.h\",\"code\":$(read_string \"$ARDUINOJSON_H\")}],\n  \"options\": \"warning,c++11\",\n  \"compiler\": \"gcc-head\",\n  \"save\": true\n}\nEND\n\tURL=$(curl -sS -H \"Content-type: application/json\" -d @parameters.json  https://wandbox.org/api/compile.json | jq --raw-output .url)\n\trm parameters.json\n\t[ -n \"$URL\" ] && echo \"$1: $URL\"\n}\n\ncompile \"JsonGeneratorExample\"\ncompile \"JsonParserExample\"\ncompile \"MsgPackParserExample\"\n"
  },
  {
    "path": "extras/tests/.clang-tidy",
    "content": "Checks:              '-clang-analyzer-security.insecureAPI.*'\n"
  },
  {
    "path": "extras/tests/CMakeLists.txt",
    "content": "# ArduinoJson - https://arduinojson.org\n# Copyright © 2014-2025, Benoit BLANCHON\n# MIT License\n\nset(CMAKE_CXX_STANDARD 11)\nset(CMAKE_CXX_STANDARD_REQUIRED ON)\n\nlink_libraries(ArduinoJson)\n\n# Failing builds should only link with ArduinoJson, not catch\nadd_subdirectory(FailingBuilds)\n\nadd_subdirectory(catch)\nlink_libraries(catch)\n\ninclude_directories(Helpers)\nadd_subdirectory(Cpp17)\nadd_subdirectory(Cpp20)\nadd_subdirectory(Deprecated)\nadd_subdirectory(IntegrationTests)\nadd_subdirectory(JsonArray)\nadd_subdirectory(JsonArrayConst)\nadd_subdirectory(JsonDeserializer)\nadd_subdirectory(JsonDocument)\nadd_subdirectory(JsonObject)\nadd_subdirectory(JsonObjectConst)\nadd_subdirectory(JsonSerializer)\nadd_subdirectory(JsonVariant)\nadd_subdirectory(JsonVariantConst)\nadd_subdirectory(ResourceManager)\nadd_subdirectory(Misc)\nadd_subdirectory(MixedConfiguration)\nadd_subdirectory(MsgPackDeserializer)\nadd_subdirectory(MsgPackSerializer)\nadd_subdirectory(Numbers)\nadd_subdirectory(TextFormatter)\n"
  },
  {
    "path": "extras/tests/Cpp17/CMakeLists.txt",
    "content": "# ArduinoJson - https://arduinojson.org\n# Copyright © 2014-2025, Benoit BLANCHON\n# MIT License\n\nif(MSVC_VERSION LESS 1910)\n\treturn()\nendif()\n\nif(CMAKE_CXX_COMPILER_ID MATCHES \"Clang\" AND CMAKE_CXX_COMPILER_VERSION VERSION_LESS 5)\n\treturn()\nendif()\n\nif(CMAKE_CXX_COMPILER_ID STREQUAL \"GNU\" AND CMAKE_CXX_COMPILER_VERSION VERSION_LESS 7)\n\treturn()\nendif()\n\nset(CMAKE_CXX_STANDARD 17)\nset(CMAKE_CXX_STANDARD_REQUIRED ON)\n\nadd_executable(Cpp17Tests\n\tstring_view.cpp\n)\n\nadd_test(Cpp17 Cpp17Tests)\n\nset_tests_properties(Cpp17\n\tPROPERTIES\n\t\tLABELS \"Catch\"\n)\n"
  },
  {
    "path": "extras/tests/Cpp17/string_view.cpp",
    "content": "// ArduinoJson - https://arduinojson.org\n// Copyright © 2014-2025, Benoit BLANCHON\n// MIT License\n\n// we expect ArduinoJson.h to include <string_view>\n// but we don't want it to included accidentally\n#undef ARDUINO\n#define ARDUINOJSON_ENABLE_STD_STREAM 0\n#define ARDUINOJSON_ENABLE_STD_STRING 0\n\n#include <ArduinoJson.h>\n#include <catch.hpp>\n\n#include \"Allocators.hpp\"\n#include \"Literals.hpp\"\n\n#if !ARDUINOJSON_ENABLE_STRING_VIEW\n#  error ARDUINOJSON_ENABLE_STRING_VIEW must be set to 1\n#endif\n\nusing ArduinoJson::detail::sizeofArray;\n\nTEST_CASE(\"string_view\") {\n  SpyingAllocator spy;\n  JsonDocument doc(&spy);\n  JsonVariant variant = doc.to<JsonVariant>();\n\n  SECTION(\"deserializeJson()\") {\n    auto err = deserializeJson(doc, std::string_view(\"123\", 2));\n    REQUIRE(err == DeserializationError::Ok);\n    REQUIRE(doc.as<int>() == 12);\n  }\n\n  SECTION(\"JsonDocument::set()\") {\n    doc.set(std::string_view(\"123\", 2));\n    REQUIRE(doc.as<std::string_view>() == \"12\");\n  }\n\n  SECTION(\"JsonDocument::operator[]() const\") {\n    doc[\"ab\"] = \"Yes\";\n    doc[\"abc\"] = \"No\";\n    REQUIRE(doc[std::string_view(\"abc\", 2)] == \"Yes\");\n  }\n\n  SECTION(\"JsonDocument::operator[]()\") {\n    doc[std::string_view(\"abc\", 2)] = \"Yes\";\n    REQUIRE(doc[\"ab\"] == \"Yes\");\n  }\n\n  SECTION(\"JsonVariant::operator==()\") {\n    variant.set(\"A\");\n    REQUIRE(variant == std::string_view(\"AX\", 1));\n    REQUIRE_FALSE(variant == std::string_view(\"BX\", 1));\n  }\n\n  SECTION(\"JsonVariant::operator>()\") {\n    variant.set(\"B\");\n    REQUIRE(variant > std::string_view(\"AX\", 1));\n    REQUIRE_FALSE(variant > std::string_view(\"CX\", 1));\n  }\n\n  SECTION(\"JsonVariant::operator<()\") {\n    variant.set(\"B\");\n    REQUIRE(variant < std::string_view(\"CX\", 1));\n    REQUIRE_FALSE(variant < std::string_view(\"AX\", 1));\n  }\n\n  SECTION(\"String deduplication\") {\n    doc.add(std::string_view(\"example one\", 7));\n    doc.add(std::string_view(\"example two\", 7));\n    doc.add(std::string_view(\"example\\0tree\", 12));\n    doc.add(std::string_view(\"example\\0tree and a half\", 12));\n\n    REQUIRE(spy.log() == AllocatorLog{\n                             Allocate(sizeofPool()),\n                             Allocate(sizeofString(\"example\")),\n                             Allocate(sizeofString(\"example tree\")),\n                         });\n  }\n\n  SECTION(\"as<std::string_view>()\") {\n    doc[\"s\"] = \"Hello World\";\n    doc[\"i\"] = 42;\n    REQUIRE(doc[\"s\"].as<std::string_view>() == std::string_view(\"Hello World\"));\n    REQUIRE(doc[\"i\"].as<std::string_view>() == std::string_view());\n  }\n\n  SECTION(\"is<std::string_view>()\") {\n    doc[\"s\"] = \"Hello World\";\n    doc[\"i\"] = 42;\n    REQUIRE(doc[\"s\"].is<std::string_view>() == true);\n    REQUIRE(doc[\"i\"].is<std::string_view>() == false);\n  }\n\n  SECTION(\"String containing NUL\") {\n    doc.set(\"hello\\0world\"_s);\n    REQUIRE(doc.as<std::string_view>().size() == 11);\n    REQUIRE(doc.as<std::string_view>() == std::string_view(\"hello\\0world\", 11));\n  }\n}\n\nusing ArduinoJson::detail::adaptString;\n\nTEST_CASE(\"StringViewAdapter\") {\n  std::string_view str(\"bravoXXX\", 5);\n  auto adapter = adaptString(str);\n\n  CHECK(stringCompare(adapter, adaptString(\"alpha\", 5)) > 0);\n  CHECK(stringCompare(adapter, adaptString(\"bravo\", 5)) == 0);\n  CHECK(stringCompare(adapter, adaptString(\"charlie\", 7)) < 0);\n\n  CHECK(adapter.size() == 5);\n}\n"
  },
  {
    "path": "extras/tests/Cpp20/CMakeLists.txt",
    "content": "# ArduinoJson - https://arduinojson.org\n# Copyright © 2014-2025, Benoit BLANCHON\n# MIT License\n\nif(MSVC_VERSION LESS 1910)\n\treturn()\nendif()\n\nif(CMAKE_CXX_COMPILER_ID MATCHES \"Clang\" AND CMAKE_CXX_COMPILER_VERSION VERSION_LESS 10)\n\treturn()\nendif()\n\nif(CMAKE_CXX_COMPILER_ID STREQUAL \"GNU\" AND CMAKE_CXX_COMPILER_VERSION VERSION_LESS 10)\n\treturn()\nendif()\n\nset(CMAKE_CXX_STANDARD 20)\nset(CMAKE_CXX_STANDARD_REQUIRED ON)\n\nadd_executable(Cpp20Tests\n\tsmoke_test.cpp\n)\n\nadd_test(Cpp20 Cpp20Tests)\n\nset_tests_properties(Cpp20\n\tPROPERTIES\n\t\tLABELS \"Catch\"\n)\n"
  },
  {
    "path": "extras/tests/Cpp20/smoke_test.cpp",
    "content": "#include <ArduinoJson.h>\n\n#include <catch.hpp>\n#include <string>\n\nTEST_CASE(\"C++20 smoke test\") {\n  JsonDocument doc;\n\n  deserializeJson(doc, \"{\\\"hello\\\":\\\"world\\\"}\");\n  REQUIRE(doc[\"hello\"] == \"world\");\n\n  std::string json;\n  serializeJson(doc, json);\n  REQUIRE(json == \"{\\\"hello\\\":\\\"world\\\"}\");\n}\n"
  },
  {
    "path": "extras/tests/Deprecated/BasicJsonDocument.cpp",
    "content": "// ArduinoJson - https://arduinojson.org\n// Copyright © 2014-2025, Benoit BLANCHON\n// MIT License\n\n#include <ArduinoJson.h>\n#include <catch.hpp>\n\n#include <string>\n\nusing ArduinoJson::detail::is_base_of;\n\nstatic std::string allocatorLog;\n\nstruct CustomAllocator {\n  CustomAllocator() {\n    allocatorLog = \"\";\n  }\n\n  void* allocate(size_t n) {\n    allocatorLog += \"A\";\n    return malloc(n);\n  }\n\n  void deallocate(void* p) {\n    free(p);\n    allocatorLog += \"D\";\n  }\n\n  void* reallocate(void* p, size_t n) {\n    allocatorLog += \"R\";\n    return realloc(p, n);\n  }\n};\n\nTEST_CASE(\"BasicJsonDocument\") {\n  allocatorLog.clear();\n\n  SECTION(\"is a JsonDocument\") {\n    REQUIRE(\n        is_base_of<JsonDocument, BasicJsonDocument<CustomAllocator>>::value ==\n        true);\n  }\n\n  SECTION(\"deserialize / serialize\") {\n    BasicJsonDocument<CustomAllocator> doc(256);\n    deserializeJson(doc, \"{\\\"hello\\\":\\\"world\\\"}\");\n    REQUIRE(doc.as<std::string>() == \"{\\\"hello\\\":\\\"world\\\"}\");\n    doc.clear();\n    REQUIRE(allocatorLog == \"AARARDDD\");\n  }\n\n  SECTION(\"copy\") {\n    BasicJsonDocument<CustomAllocator> doc(256);\n    doc[\"hello\"] = \"world\";\n    auto copy = doc;\n    REQUIRE(copy.as<std::string>() == \"{\\\"hello\\\":\\\"world\\\"}\");\n    REQUIRE(allocatorLog == \"AAAAAA\");\n  }\n\n  SECTION(\"capacity\") {\n    BasicJsonDocument<CustomAllocator> doc(256);\n    REQUIRE(doc.capacity() == 256);\n  }\n\n  SECTION(\"garbageCollect()\") {\n    BasicJsonDocument<CustomAllocator> doc(256);\n    doc.garbageCollect();\n  }\n}\n"
  },
  {
    "path": "extras/tests/Deprecated/CMakeLists.txt",
    "content": "# ArduinoJson - https://arduinojson.org\n# Copyright © 2014-2025, Benoit BLANCHON\n# MIT License\n\nif(CMAKE_CXX_COMPILER_ID MATCHES \"(GNU|Clang)\")\n\tadd_compile_options(\n\t\t-w\n\t)\nendif()\n\nif(MSVC)\n\tadd_compile_options(\n\t\t/wd4996\n\t)\nendif()\n\nadd_executable(DeprecatedTests\n\tadd.cpp\n\tBasicJsonDocument.cpp\n\tcontainsKey.cpp\n\tcreateNestedArray.cpp\n\tcreateNestedObject.cpp\n\tDynamicJsonDocument.cpp\n\tmacros.cpp\n\tmemoryUsage.cpp\n\tshallowCopy.cpp\n\tStaticJsonDocument.cpp\n)\n\nadd_test(Deprecated DeprecatedTests)\n\nset_tests_properties(Deprecated\n\tPROPERTIES\n\tLABELS \"Catch\"\n)\n"
  },
  {
    "path": "extras/tests/Deprecated/DynamicJsonDocument.cpp",
    "content": "// ArduinoJson - https://arduinojson.org\n// Copyright © 2014-2025, Benoit BLANCHON\n// MIT License\n\n#include <ArduinoJson.h>\n#include <catch.hpp>\n\nusing ArduinoJson::detail::is_base_of;\n\nTEST_CASE(\"DynamicJsonDocument\") {\n  SECTION(\"is a JsonDocument\") {\n    REQUIRE(is_base_of<JsonDocument, DynamicJsonDocument>::value == true);\n  }\n\n  SECTION(\"deserialize / serialize\") {\n    DynamicJsonDocument doc(256);\n    deserializeJson(doc, \"{\\\"hello\\\":\\\"world\\\"}\");\n    REQUIRE(doc.as<std::string>() == \"{\\\"hello\\\":\\\"world\\\"}\");\n  }\n\n  SECTION(\"copy\") {\n    DynamicJsonDocument doc(256);\n    doc[\"hello\"] = \"world\";\n    auto copy = doc;\n    REQUIRE(copy.as<std::string>() == \"{\\\"hello\\\":\\\"world\\\"}\");\n  }\n\n  SECTION(\"capacity\") {\n    DynamicJsonDocument doc(256);\n    REQUIRE(doc.capacity() == 256);\n  }\n\n  SECTION(\"garbageCollect()\") {\n    DynamicJsonDocument doc(256);\n    doc.garbageCollect();\n  }\n}\n"
  },
  {
    "path": "extras/tests/Deprecated/StaticJsonDocument.cpp",
    "content": "// ArduinoJson - https://arduinojson.org\n// Copyright © 2014-2025, Benoit BLANCHON\n// MIT License\n\n#include <ArduinoJson.h>\n#include <catch.hpp>\n\nusing ArduinoJson::detail::is_base_of;\n\nTEST_CASE(\"StaticJsonDocument\") {\n  SECTION(\"is a JsonDocument\") {\n    REQUIRE(is_base_of<JsonDocument, StaticJsonDocument<256>>::value == true);\n  }\n\n  SECTION(\"deserialize / serialize\") {\n    StaticJsonDocument<256> doc;\n    deserializeJson(doc, \"{\\\"hello\\\":\\\"world\\\"}\");\n    REQUIRE(doc.as<std::string>() == \"{\\\"hello\\\":\\\"world\\\"}\");\n  }\n\n  SECTION(\"copy\") {\n    StaticJsonDocument<256> doc;\n    doc[\"hello\"] = \"world\";\n    auto copy = doc;\n    REQUIRE(copy.as<std::string>() == \"{\\\"hello\\\":\\\"world\\\"}\");\n  }\n\n  SECTION(\"capacity\") {\n    StaticJsonDocument<256> doc;\n    REQUIRE(doc.capacity() == 256);\n  }\n}\n"
  },
  {
    "path": "extras/tests/Deprecated/add.cpp",
    "content": "// ArduinoJson - https://arduinojson.org\n// Copyright © 2014-2025, Benoit BLANCHON\n// MIT License\n\n#include <ArduinoJson.h>\n#include <catch.hpp>\n\nTEST_CASE(\"JsonArray::add()\") {\n  JsonDocument doc;\n  JsonArray array = doc.to<JsonArray>();\n  array.add().set(42);\n  REQUIRE(doc.as<std::string>() == \"[42]\");\n}\n\nTEST_CASE(\"JsonDocument::add()\") {\n  JsonDocument doc;\n  doc.add().set(42);\n  REQUIRE(doc.as<std::string>() == \"[42]\");\n}\n\nTEST_CASE(\"ElementProxy::add()\") {\n  JsonDocument doc;\n  doc[0].add().set(42);\n  REQUIRE(doc.as<std::string>() == \"[[42]]\");\n}\n\nTEST_CASE(\"MemberProxy::add()\") {\n  JsonDocument doc;\n  doc[\"x\"].add().set(42);\n  REQUIRE(doc.as<std::string>() == \"{\\\"x\\\":[42]}\");\n}\n\nTEST_CASE(\"JsonVariant::add()\") {\n  JsonDocument doc;\n  JsonVariant v = doc.add();\n  v.add().set(42);\n  REQUIRE(doc.as<std::string>() == \"[[42]]\");\n}\n"
  },
  {
    "path": "extras/tests/Deprecated/containsKey.cpp",
    "content": "// ArduinoJson - https://arduinojson.org\n// Copyright © 2014-2025, Benoit BLANCHON\n// MIT License\n\n#include <ArduinoJson.h>\n#include <catch.hpp>\n\n#include \"Literals.hpp\"\n\nTEST_CASE(\"JsonDocument::containsKey()\") {\n  JsonDocument doc;\n\n  SECTION(\"returns true on object\") {\n    doc[\"hello\"] = \"world\";\n\n    REQUIRE(doc.containsKey(\"hello\") == true);\n  }\n\n  SECTION(\"returns true when value is null\") {\n    doc[\"hello\"] = static_cast<const char*>(0);\n\n    REQUIRE(doc.containsKey(\"hello\") == true);\n  }\n\n  SECTION(\"returns true when key is a std::string\") {\n    doc[\"hello\"] = \"world\";\n\n    REQUIRE(doc.containsKey(\"hello\"_s) == true);\n  }\n\n  SECTION(\"returns false  on object\") {\n    doc[\"world\"] = \"hello\";\n\n    REQUIRE(doc.containsKey(\"hello\") == false);\n  }\n\n  SECTION(\"returns false on array\") {\n    doc.add(\"hello\");\n\n    REQUIRE(doc.containsKey(\"hello\") == false);\n  }\n\n  SECTION(\"returns false on null\") {\n    REQUIRE(doc.containsKey(\"hello\") == false);\n  }\n\n  SECTION(\"supports JsonVariant\") {\n    doc[\"hello\"] = \"world\";\n    doc[\"key\"] = \"hello\";\n\n    REQUIRE(doc.containsKey(doc[\"key\"]) == true);\n    REQUIRE(doc.containsKey(doc[\"foo\"]) == false);\n  }\n\n#ifdef HAS_VARIABLE_LENGTH_ARRAY\n  SECTION(\"supports VLAs\") {\n    size_t i = 16;\n    char vla[i];\n    strcpy(vla, \"hello\");\n\n    doc[\"hello\"] = \"world\";\n\n    REQUIRE(doc.containsKey(vla) == true);\n  }\n#endif\n}\n\nTEST_CASE(\"MemberProxy::containsKey()\") {\n  JsonDocument doc;\n  const auto& mp = doc[\"hello\"];\n\n  SECTION(\"containsKey(const char*)\") {\n    mp[\"key\"] = \"value\";\n\n    REQUIRE(mp.containsKey(\"key\") == true);\n    REQUIRE(mp.containsKey(\"key\") == true);\n  }\n\n  SECTION(\"containsKey(std::string)\") {\n    mp[\"key\"] = \"value\";\n\n    REQUIRE(mp.containsKey(\"key\"_s) == true);\n    REQUIRE(mp.containsKey(\"key\"_s) == true);\n  }\n\n#ifdef HAS_VARIABLE_LENGTH_ARRAY\n  SECTION(\"supports VLAs\") {\n    size_t i = 16;\n    char vla[i];\n    strcpy(vla, \"hello\");\n\n    mp[\"hello\"] = \"world\";\n\n    REQUIRE(mp.containsKey(vla) == true);\n  }\n#endif\n}\n\nTEST_CASE(\"JsonObject::containsKey()\") {\n  JsonDocument doc;\n  JsonObject obj = doc.to<JsonObject>();\n  obj[\"hello\"] = 42;\n\n  SECTION(\"returns true only if key is present\") {\n    REQUIRE(false == obj.containsKey(\"world\"));\n    REQUIRE(true == obj.containsKey(\"hello\"));\n  }\n\n  SECTION(\"returns false after remove()\") {\n    obj.remove(\"hello\");\n\n    REQUIRE(false == obj.containsKey(\"hello\"));\n  }\n\n#ifdef HAS_VARIABLE_LENGTH_ARRAY\n  SECTION(\"key is a VLA\") {\n    size_t i = 16;\n    char vla[i];\n    strcpy(vla, \"hello\");\n\n    REQUIRE(true == obj.containsKey(vla));\n  }\n#endif\n\n  SECTION(\"key is a JsonVariant\") {\n    doc[\"key\"] = \"hello\";\n    REQUIRE(true == obj.containsKey(obj[\"key\"]));\n    REQUIRE(false == obj.containsKey(obj[\"hello\"]));\n  }\n\n  SECTION(\"std::string\") {\n    REQUIRE(true == obj.containsKey(\"hello\"_s));\n  }\n\n  SECTION(\"unsigned char[]\") {\n    unsigned char key[] = \"hello\";\n    REQUIRE(true == obj.containsKey(key));\n  }\n}\n\nTEST_CASE(\"JsonObjectConst::containsKey()\") {\n  JsonDocument doc;\n  doc[\"hello\"] = 42;\n  auto obj = doc.as<JsonObjectConst>();\n\n  SECTION(\"supports const char*\") {\n    REQUIRE(false == obj.containsKey(\"world\"));\n    REQUIRE(true == obj.containsKey(\"hello\"));\n  }\n\n  SECTION(\"supports std::string\") {\n    REQUIRE(false == obj.containsKey(\"world\"_s));\n    REQUIRE(true == obj.containsKey(\"hello\"_s));\n  }\n\n#ifdef HAS_VARIABLE_LENGTH_ARRAY\n  SECTION(\"supports VLA\") {\n    size_t i = 16;\n    char vla[i];\n    strcpy(vla, \"hello\");\n\n    REQUIRE(true == obj.containsKey(vla));\n  }\n#endif\n\n  SECTION(\"supports JsonVariant\") {\n    doc[\"key\"] = \"hello\";\n    REQUIRE(true == obj.containsKey(obj[\"key\"]));\n    REQUIRE(false == obj.containsKey(obj[\"hello\"]));\n  }\n}\n\nTEST_CASE(\"JsonVariant::containsKey()\") {\n  JsonDocument doc;\n  JsonVariant var = doc.to<JsonVariant>();\n\n  SECTION(\"returns false is unbound\") {\n    CHECK_FALSE(JsonVariant().containsKey(\"hello\"));\n  }\n\n  SECTION(\"containsKey(const char*)\") {\n    var[\"hello\"] = \"world\";\n\n    REQUIRE(var.containsKey(\"hello\") == true);\n    REQUIRE(var.containsKey(\"world\") == false);\n  }\n\n  SECTION(\"containsKey(std::string)\") {\n    var[\"hello\"] = \"world\";\n\n    REQUIRE(var.containsKey(\"hello\"_s) == true);\n    REQUIRE(var.containsKey(\"world\"_s) == false);\n  }\n\n  SECTION(\"containsKey(JsonVariant)\") {\n    var[\"hello\"] = \"world\";\n    var[\"key\"] = \"hello\";\n\n    REQUIRE(var.containsKey(doc[\"key\"]) == true);\n    REQUIRE(var.containsKey(doc[\"foo\"]) == false);\n  }\n\n#ifdef HAS_VARIABLE_LENGTH_ARRAY\n  SECTION(\"supports VLAs\") {\n    size_t i = 16;\n    char vla[i];\n    strcpy(vla, \"hello\");\n\n    var[\"hello\"] = \"world\";\n\n    REQUIRE(var.containsKey(vla) == true);\n  }\n#endif\n}\n\nTEST_CASE(\"JsonVariantConst::containsKey()\") {\n  JsonDocument doc;\n  doc[\"hello\"] = \"world\";\n  JsonVariantConst var = doc.as<JsonVariant>();\n\n  SECTION(\"support const char*\") {\n    REQUIRE(var.containsKey(\"hello\") == true);\n    REQUIRE(var.containsKey(\"world\") == false);\n  }\n\n  SECTION(\"support std::string\") {\n    REQUIRE(var.containsKey(\"hello\"_s) == true);\n    REQUIRE(var.containsKey(\"world\"_s) == false);\n  }\n\n#ifdef HAS_VARIABLE_LENGTH_ARRAY\n  SECTION(\"supports VLA\") {\n    size_t i = 16;\n    char vla[i];\n    strcpy(vla, \"hello\");\n\n    REQUIRE(true == var.containsKey(vla));\n  }\n#endif\n\n  SECTION(\"support JsonVariant\") {\n    doc[\"key\"] = \"hello\";\n    REQUIRE(var.containsKey(var[\"key\"]) == true);\n    REQUIRE(var.containsKey(var[\"foo\"]) == false);\n  }\n}\n"
  },
  {
    "path": "extras/tests/Deprecated/createNestedArray.cpp",
    "content": "// ArduinoJson - https://arduinojson.org\n// Copyright © 2014-2025, Benoit BLANCHON\n// MIT License\n\n#include <ArduinoJson.h>\n#include <catch.hpp>\n\n#include <string>\n\n#include \"Literals.hpp\"\n\nTEST_CASE(\"JsonDocument::createNestedArray()\") {\n  JsonDocument doc;\n\n  SECTION(\"createNestedArray()\") {\n    JsonArray array = doc.createNestedArray();\n    array.add(42);\n    REQUIRE(doc.as<std::string>() == \"[[42]]\");\n  }\n\n  SECTION(\"createNestedArray(const char*)\") {\n    JsonArray array = doc.createNestedArray(\"key\");\n    array.add(42);\n    REQUIRE(doc.as<std::string>() == \"{\\\"key\\\":[42]}\");\n  }\n\n  SECTION(\"createNestedArray(std::string)\") {\n    JsonArray array = doc.createNestedArray(\"key\"_s);\n    array.add(42);\n    REQUIRE(doc.as<std::string>() == \"{\\\"key\\\":[42]}\");\n  }\n\n#ifdef HAS_VARIABLE_LENGTH_ARRAY\n  SECTION(\"createNestedArray(VLA)\") {\n    size_t i = 16;\n    char vla[i];\n    strcpy(vla, \"key\");\n    JsonArray array = doc.createNestedArray(vla);\n    array.add(42);\n    REQUIRE(doc.as<std::string>() == \"{\\\"key\\\":[42]}\");\n  }\n#endif\n}\n\nTEST_CASE(\"JsonArray::createNestedArray()\") {\n  JsonDocument doc;\n  JsonArray array = doc.to<JsonArray>();\n  JsonArray nestedArray = array.createNestedArray();\n  nestedArray.add(42);\n  REQUIRE(doc.as<std::string>() == \"[[42]]\");\n}\n\nTEST_CASE(\"JsonObject::createNestedArray()\") {\n  JsonDocument doc;\n  JsonObject object = doc.to<JsonObject>();\n\n  SECTION(\"createNestedArray(const char*)\") {\n    JsonArray array = object.createNestedArray(\"key\");\n    array.add(42);\n    REQUIRE(doc.as<std::string>() == \"{\\\"key\\\":[42]}\");\n  }\n\n  SECTION(\"createNestedArray(std::string)\") {\n    JsonArray array = object.createNestedArray(\"key\"_s);\n    array.add(42);\n    REQUIRE(doc.as<std::string>() == \"{\\\"key\\\":[42]}\");\n  }\n\n#ifdef HAS_VARIABLE_LENGTH_ARRAY\n  SECTION(\"createNestedArray(VLA)\") {\n    size_t i = 16;\n    char vla[i];\n    strcpy(vla, \"key\");\n    JsonArray array = object.createNestedArray(vla);\n    array.add(42);\n    REQUIRE(doc.as<std::string>() == \"{\\\"key\\\":[42]}\");\n  }\n#endif\n}\n\nTEST_CASE(\"JsonVariant::createNestedArray()\") {\n  JsonDocument doc;\n  JsonVariant variant = doc.to<JsonVariant>();\n\n  SECTION(\"createNestedArray()\") {\n    JsonArray array = variant.createNestedArray();\n    array.add(42);\n    REQUIRE(doc.as<std::string>() == \"[[42]]\");\n  }\n\n  SECTION(\"createNestedArray(const char*)\") {\n    JsonArray array = variant.createNestedArray(\"key\");\n    array.add(42);\n    REQUIRE(doc.as<std::string>() == \"{\\\"key\\\":[42]}\");\n  }\n\n  SECTION(\"createNestedArray(std::string)\") {\n    JsonArray array = variant.createNestedArray(\"key\"_s);\n    array.add(42);\n    REQUIRE(doc.as<std::string>() == \"{\\\"key\\\":[42]}\");\n  }\n\n#ifdef HAS_VARIABLE_LENGTH_ARRAY\n  SECTION(\"createNestedArray(VLA)\") {\n    size_t i = 16;\n    char vla[i];\n    strcpy(vla, \"key\");\n    JsonArray array = variant.createNestedArray(vla);\n    array.add(42);\n    REQUIRE(doc.as<std::string>() == \"{\\\"key\\\":[42]}\");\n  }\n#endif\n}\n"
  },
  {
    "path": "extras/tests/Deprecated/createNestedObject.cpp",
    "content": "// ArduinoJson - https://arduinojson.org\n// Copyright © 2014-2025, Benoit BLANCHON\n// MIT License\n\n#include <ArduinoJson.h>\n#include <catch.hpp>\n\n#include <string>\n\n#include \"Literals.hpp\"\n\nTEST_CASE(\"JsonDocument::createNestedObject()\") {\n  JsonDocument doc;\n\n  SECTION(\"createNestedObject()\") {\n    JsonObject object = doc.createNestedObject();\n    object[\"hello\"] = \"world\";\n    REQUIRE(doc.as<std::string>() == \"[{\\\"hello\\\":\\\"world\\\"}]\");\n  }\n\n  SECTION(\"createNestedObject(const char*)\") {\n    JsonObject object = doc.createNestedObject(\"key\");\n    object[\"hello\"] = \"world\";\n    REQUIRE(doc.as<std::string>() == \"{\\\"key\\\":{\\\"hello\\\":\\\"world\\\"}}\");\n  }\n\n  SECTION(\"createNestedObject(std::string)\") {\n    JsonObject object = doc.createNestedObject(\"key\"_s);\n    object[\"hello\"] = \"world\";\n    REQUIRE(doc.as<std::string>() == \"{\\\"key\\\":{\\\"hello\\\":\\\"world\\\"}}\");\n  }\n\n#ifdef HAS_VARIABLE_LENGTH_ARRAY\n  SECTION(\"createNestedObject(VLA)\") {\n    size_t i = 16;\n    char vla[i];\n    strcpy(vla, \"key\");\n    JsonObject object = doc.createNestedObject(vla);\n    object[\"hello\"] = \"world\";\n    REQUIRE(doc.as<std::string>() == \"{\\\"key\\\":{\\\"hello\\\":\\\"world\\\"}}\");\n  }\n#endif\n}\n\nTEST_CASE(\"JsonArray::createNestedObject()\") {\n  JsonDocument doc;\n  JsonArray array = doc.to<JsonArray>();\n  JsonObject object = array.createNestedObject();\n  object[\"hello\"] = \"world\";\n  REQUIRE(doc.as<std::string>() == \"[{\\\"hello\\\":\\\"world\\\"}]\");\n}\n\nTEST_CASE(\"JsonObject::createNestedObject()\") {\n  JsonDocument doc;\n  JsonObject object = doc.to<JsonObject>();\n\n  SECTION(\"createNestedObject(const char*)\") {\n    JsonObject nestedObject = object.createNestedObject(\"key\");\n    nestedObject[\"hello\"] = \"world\";\n    REQUIRE(doc.as<std::string>() == \"{\\\"key\\\":{\\\"hello\\\":\\\"world\\\"}}\");\n  }\n\n  SECTION(\"createNestedObject(std::string)\") {\n    JsonObject nestedObject = object.createNestedObject(\"key\"_s);\n    nestedObject[\"hello\"] = \"world\";\n    REQUIRE(doc.as<std::string>() == \"{\\\"key\\\":{\\\"hello\\\":\\\"world\\\"}}\");\n  }\n\n#ifdef HAS_VARIABLE_LENGTH_ARRAY\n  SECTION(\"createNestedObject(VLA)\") {\n    size_t i = 16;\n    char vla[i];\n    strcpy(vla, \"key\");\n    JsonObject nestedObject = object.createNestedObject(vla);\n    nestedObject[\"hello\"] = \"world\";\n    REQUIRE(doc.as<std::string>() == \"{\\\"key\\\":{\\\"hello\\\":\\\"world\\\"}}\");\n  }\n#endif\n}\n\nTEST_CASE(\"JsonVariant::createNestedObject()\") {\n  JsonDocument doc;\n  JsonVariant variant = doc.to<JsonVariant>();\n\n  SECTION(\"createNestedObject()\") {\n    JsonObject object = variant.createNestedObject();\n    object[\"hello\"] = \"world\";\n    REQUIRE(doc.as<std::string>() == \"[{\\\"hello\\\":\\\"world\\\"}]\");\n  }\n\n  SECTION(\"createNestedObject(const char*)\") {\n    JsonObject object = variant.createNestedObject(\"key\");\n    object[\"hello\"] = \"world\";\n    REQUIRE(doc.as<std::string>() == \"{\\\"key\\\":{\\\"hello\\\":\\\"world\\\"}}\");\n  }\n\n  SECTION(\"createNestedObject(std::string)\") {\n    JsonObject object = variant.createNestedObject(\"key\"_s);\n    object[\"hello\"] = \"world\";\n    REQUIRE(doc.as<std::string>() == \"{\\\"key\\\":{\\\"hello\\\":\\\"world\\\"}}\");\n  }\n\n#ifdef HAS_VARIABLE_LENGTH_ARRAY\n  SECTION(\"createNestedObject(VLA)\") {\n    size_t i = 16;\n    char vla[i];\n    strcpy(vla, \"key\");\n    JsonObject object = variant.createNestedObject(vla);\n    object[\"hello\"] = \"world\";\n    REQUIRE(doc.as<std::string>() == \"{\\\"key\\\":{\\\"hello\\\":\\\"world\\\"}}\");\n  }\n#endif\n}\n"
  },
  {
    "path": "extras/tests/Deprecated/macros.cpp",
    "content": "// ArduinoJson - https://arduinojson.org\n// Copyright © 2014-2025, Benoit BLANCHON\n// MIT License\n\n#include <ArduinoJson.h>\n#include <catch.hpp>\n\nTEST_CASE(\"JSON_ARRAY_SIZE\") {\n  REQUIRE(JSON_ARRAY_SIZE(10) == ArduinoJson::detail::sizeofArray(10));\n}\n\nTEST_CASE(\"JSON_OBJECT_SIZE\") {\n  REQUIRE(JSON_OBJECT_SIZE(10) == ArduinoJson::detail::sizeofObject(10));\n}\n\nTEST_CASE(\"JSON_STRING_SIZE\") {\n  REQUIRE(JSON_STRING_SIZE(10) == 11);  // issue #2054\n}\n"
  },
  {
    "path": "extras/tests/Deprecated/memoryUsage.cpp",
    "content": "// ArduinoJson - https://arduinojson.org\n// Copyright © 2014-2025, Benoit BLANCHON\n// MIT License\n\n#include <ArduinoJson.h>\n#include <catch.hpp>\n\nTEST_CASE(\"JsonArray::memoryUsage()\") {\n  JsonArray array;\n  REQUIRE(array.memoryUsage() == 0);\n}\n\nTEST_CASE(\"JsonArrayConst::memoryUsage()\") {\n  JsonArrayConst array;\n  REQUIRE(array.memoryUsage() == 0);\n}\n\nTEST_CASE(\"JsonDocument::memoryUsage()\") {\n  JsonDocument doc;\n  REQUIRE(doc.memoryUsage() == 0);\n}\n\nTEST_CASE(\"JsonObject::memoryUsage()\") {\n  JsonObject array;\n  REQUIRE(array.memoryUsage() == 0);\n}\n\nTEST_CASE(\"JsonObjectConst::memoryUsage()\") {\n  JsonObjectConst array;\n  REQUIRE(array.memoryUsage() == 0);\n}\n\nTEST_CASE(\"JsonVariant::memoryUsage()\") {\n  JsonVariant doc;\n  REQUIRE(doc.memoryUsage() == 0);\n}\n\nTEST_CASE(\"JsonVariantConst::memoryUsage()\") {\n  JsonVariantConst doc;\n  REQUIRE(doc.memoryUsage() == 0);\n}\n\nTEST_CASE(\"ElementProxy::memoryUsage()\") {\n  JsonDocument doc;\n  REQUIRE(doc[0].memoryUsage() == 0);\n}\n\nTEST_CASE(\"MemberProxy::memoryUsage()\") {\n  JsonDocument doc;\n  REQUIRE(doc[\"hello\"].memoryUsage() == 0);\n}\n"
  },
  {
    "path": "extras/tests/Deprecated/shallowCopy.cpp",
    "content": "// ArduinoJson - https://arduinojson.org\n// Copyright © 2014-2025, Benoit BLANCHON\n// MIT License\n\n#include <ArduinoJson.h>\n#include <catch.hpp>\n\nTEST_CASE(\"shallowCopy()\") {\n  JsonDocument doc1, doc2;\n  doc1[\"b\"] = \"c\";\n  doc2[\"a\"].shallowCopy(doc1);\n\n  REQUIRE(doc2.as<std::string>() == \"{\\\"a\\\":{\\\"b\\\":\\\"c\\\"}}\");\n}\n"
  },
  {
    "path": "extras/tests/FailingBuilds/CMakeLists.txt",
    "content": "# ArduinoJson - https://arduinojson.org\n# Copyright © 2014-2025, Benoit BLANCHON\n# MIT License\n\nmacro(add_failing_build source_file)\n\tget_filename_component(target ${source_file} NAME_WE)\n\n\tadd_executable(${target} ${source_file})\n\n\tset_target_properties(${target}\n\t\tPROPERTIES\n\t\t\tEXCLUDE_FROM_ALL TRUE\n\t\t\tEXCLUDE_FROM_DEFAULT_BUILD TRUE\n\t)\n\tadd_test(\n\t\tNAME ${target}\n\t\t\tCOMMAND ${CMAKE_COMMAND} --build . --target ${target} --config $<CONFIGURATION>\n\t\t\tWORKING_DIRECTORY ${CMAKE_BINARY_DIR}\n\t)\n\tset_tests_properties(${target}\n\t\tPROPERTIES\n\t\t\tWILL_FAIL TRUE\n\t\t\tLABELS \"WillFail\"\n\t)\nendmacro()\n\nadd_failing_build(Issue978.cpp)\nadd_failing_build(read_long_long.cpp)\nadd_failing_build(write_long_long.cpp)\nadd_failing_build(variant_as_char.cpp)\nadd_failing_build(assign_char.cpp)\nadd_failing_build(deserialize_object.cpp)\n"
  },
  {
    "path": "extras/tests/FailingBuilds/Issue978.cpp",
    "content": "// ArduinoJson - https://arduinojson.org\n// Copyright © 2014-2025, Benoit BLANCHON\n// MIT License\n\n#include <ArduinoJson.h>\n\nstruct Stream {};\n\nint main() {\n  Stream* stream = 0;\n  JsonDocument doc;\n  deserializeJson(doc, stream);\n}\n"
  },
  {
    "path": "extras/tests/FailingBuilds/assign_char.cpp",
    "content": "// ArduinoJson - https://arduinojson.org\n// Copyright © 2014-2025, Benoit BLANCHON\n// MIT License\n\n#include <ArduinoJson.h>\n\n// See issue #1498\n\nint main() {\n  JsonDocument doc;\n  doc[\"dummy\"] = 'A';\n}\n"
  },
  {
    "path": "extras/tests/FailingBuilds/deserialize_object.cpp",
    "content": "// ArduinoJson - https://arduinojson.org\n// Copyright © 2014-2025, Benoit BLANCHON\n// MIT License\n\n#include <ArduinoJson.h>\n\n// See issue #2135\n\nint main() {\n  JsonObject obj;\n  deserializeJson(obj, \"\");\n}\n"
  },
  {
    "path": "extras/tests/FailingBuilds/read_long_long.cpp",
    "content": "// ArduinoJson - https://arduinojson.org\n// Copyright © 2014-2025, Benoit BLANCHON\n// MIT License\n\n#define ARDUINOJSON_USE_LONG_LONG 0\n#include <ArduinoJson.h>\n\n#if defined(__SIZEOF_LONG__) && __SIZEOF_LONG__ >= 8\n#  error This test requires sizeof(long) < 8\n#endif\n\nARDUINOJSON_ASSERT_INTEGER_TYPE_IS_SUPPORTED(long long)\nint main() {\n  JsonDocument doc;\n  doc[\"dummy\"].as<long long>();\n}\n"
  },
  {
    "path": "extras/tests/FailingBuilds/variant_as_char.cpp",
    "content": "// ArduinoJson - https://arduinojson.org\n// Copyright © 2014-2025, Benoit BLANCHON\n// MIT License\n\n#include <ArduinoJson.h>\n\n// See issue #1498\n\nint main() {\n  JsonDocument doc;\n  doc[\"dummy\"].as<char>();\n}\n"
  },
  {
    "path": "extras/tests/FailingBuilds/write_long_long.cpp",
    "content": "// ArduinoJson - https://arduinojson.org\n// Copyright © 2014-2025, Benoit BLANCHON\n// MIT License\n\n#define ARDUINOJSON_USE_LONG_LONG 0\n#include <ArduinoJson.h>\n\n#if defined(__SIZEOF_LONG__) && __SIZEOF_LONG__ >= 8\n#  error This test requires sizeof(long) < 8\n#endif\n\nint main() {\n  JsonDocument doc;\n  doc[\"dummy\"] = static_cast<long long>(42);\n}\n"
  },
  {
    "path": "extras/tests/Helpers/Allocators.hpp",
    "content": "// ArduinoJson - https://arduinojson.org\n// Copyright © 2014-2025, Benoit BLANCHON\n// MIT License\n\n#pragma once\n\n#include <ArduinoJson/Memory/Allocator.hpp>\n#include <ArduinoJson/Memory/MemoryPool.hpp>\n#include <ArduinoJson/Memory/StringBuilder.hpp>\n\n#include <sstream>\n\nnamespace {\n\nstruct FailingAllocator : ArduinoJson::Allocator {\n  static FailingAllocator* instance() {\n    static FailingAllocator allocator;\n    return &allocator;\n  }\n\n private:\n  FailingAllocator() = default;\n  ~FailingAllocator() = default;\n\n  void* allocate(size_t) override {\n    return nullptr;\n  }\n\n  void deallocate(void*) override {}\n\n  void* reallocate(void*, size_t) override {\n    return nullptr;\n  }\n};\n\nclass AllocatorLogEntry {\n public:\n  AllocatorLogEntry(std::string s, size_t n = 1) : str_(s), count_(n) {}\n\n  const std::string& str() const {\n    return str_;\n  }\n\n  size_t count() const {\n    return count_;\n  }\n\n  AllocatorLogEntry operator*(size_t n) const {\n    return AllocatorLogEntry(str_, n);\n  }\n\n private:\n  std::string str_;\n  size_t count_;\n};\n\ninline AllocatorLogEntry Allocate(size_t s) {\n  char buffer[32];\n  snprintf(buffer, sizeof(buffer), \"allocate(%zu)\", s);\n  return AllocatorLogEntry(buffer);\n}\n\ninline AllocatorLogEntry AllocateFail(size_t s) {\n  char buffer[32];\n  snprintf(buffer, sizeof(buffer), \"allocate(%zu) -> nullptr\", s);\n  return AllocatorLogEntry(buffer);\n}\n\ninline AllocatorLogEntry Reallocate(size_t s1, size_t s2) {\n  char buffer[32];\n  snprintf(buffer, sizeof(buffer), \"reallocate(%zu, %zu)\", s1, s2);\n  return AllocatorLogEntry(buffer);\n}\n\ninline AllocatorLogEntry ReallocateFail(size_t s1, size_t s2) {\n  char buffer[32];\n  snprintf(buffer, sizeof(buffer), \"reallocate(%zu, %zu) -> nullptr\", s1, s2);\n  return AllocatorLogEntry(buffer);\n}\n\ninline AllocatorLogEntry Deallocate(size_t s) {\n  char buffer[32];\n  snprintf(buffer, sizeof(buffer), \"deallocate(%zu)\", s);\n  return AllocatorLogEntry(buffer);\n}\n\nclass AllocatorLog {\n public:\n  AllocatorLog() = default;\n  AllocatorLog(std::initializer_list<AllocatorLogEntry> list) {\n    for (auto& entry : list)\n      append(entry);\n  }\n\n  void clear() {\n    log_.str(\"\");\n  }\n\n  void append(const AllocatorLogEntry& entry) {\n    for (size_t i = 0; i < entry.count(); i++)\n      log_ << entry.str() << \"\\n\";\n  }\n\n  std::string str() const {\n    auto s = log_.str();\n    if (s.empty())\n      return \"(empty)\";\n    s.pop_back();  // remove the trailing '\\n'\n    return s;\n  }\n\n  bool operator==(const AllocatorLog& other) const {\n    return str() == other.str();\n  }\n\n  friend std::ostream& operator<<(std::ostream& os, const AllocatorLog& log) {\n    os << log.str();\n    return os;\n  }\n\n private:\n  std::ostringstream log_;\n};\n\nclass SpyingAllocator : public ArduinoJson::Allocator {\n public:\n  SpyingAllocator(\n      Allocator* upstream = ArduinoJson::detail::DefaultAllocator::instance())\n      : upstream_(upstream) {}\n  virtual ~SpyingAllocator() {}\n\n  size_t allocatedBytes() const {\n    return allocatedBytes_;\n  }\n\n  void* allocate(size_t n) override {\n    auto block = reinterpret_cast<AllocatedBlock*>(\n        upstream_->allocate(sizeof(AllocatedBlock) + n - 1));\n    if (block) {\n      log_.append(Allocate(n));\n      allocatedBytes_ += n;\n      block->size = n;\n      return block->payload;\n    } else {\n      log_.append(AllocateFail(n));\n      return nullptr;\n    }\n  }\n\n  void deallocate(void* p) override {\n    auto block = AllocatedBlock::fromPayload(p);\n    allocatedBytes_ -= block->size;\n    log_.append(Deallocate(block ? block->size : 0));\n    upstream_->deallocate(block);\n  }\n\n  void* reallocate(void* p, size_t n) override {\n    auto block = AllocatedBlock::fromPayload(p);\n    auto oldSize = block ? block->size : 0;\n    block = reinterpret_cast<AllocatedBlock*>(\n        upstream_->reallocate(block, sizeof(AllocatedBlock) + n - 1));\n    if (block) {\n      log_.append(Reallocate(oldSize, n));\n      block->size = n;\n      allocatedBytes_ += n - oldSize;\n      return block->payload;\n    } else {\n      log_.append(ReallocateFail(oldSize, n));\n      return nullptr;\n    }\n  }\n\n  void clearLog() {\n    log_.clear();\n  }\n\n  const AllocatorLog& log() const {\n    return log_;\n  }\n\n private:\n  struct AllocatedBlock {\n    size_t size;\n    char payload[1];\n\n    static AllocatedBlock* fromPayload(void* p) {\n      if (!p)\n        return nullptr;\n      return reinterpret_cast<AllocatedBlock*>(\n          // Cast to void* to silence \"cast increases required alignment of\n          // target type [-Werror=cast-align]\"\n          reinterpret_cast<void*>(reinterpret_cast<char*>(p) -\n                                  offsetof(AllocatedBlock, payload)));\n    }\n  };\n\n  AllocatorLog log_;\n  Allocator* upstream_;\n  size_t allocatedBytes_ = 0;\n};\n\nclass KillswitchAllocator : public ArduinoJson::Allocator {\n public:\n  KillswitchAllocator(\n      Allocator* upstream = ArduinoJson::detail::DefaultAllocator::instance())\n      : working_(true), upstream_(upstream) {}\n  virtual ~KillswitchAllocator() {}\n\n  void* allocate(size_t n) override {\n    return working_ ? upstream_->allocate(n) : 0;\n  }\n\n  void deallocate(void* p) override {\n    upstream_->deallocate(p);\n  }\n\n  void* reallocate(void* ptr, size_t n) override {\n    return working_ ? upstream_->reallocate(ptr, n) : 0;\n  }\n\n  // Turn the killswitch on, so all allocation fail\n  void on() {\n    working_ = false;\n  }\n\n private:\n  bool working_;\n  Allocator* upstream_;\n};\n\nclass TimebombAllocator : public ArduinoJson::Allocator {\n public:\n  TimebombAllocator(\n      size_t initialCountdown,\n      Allocator* upstream = ArduinoJson::detail::DefaultAllocator::instance())\n      : countdown_(initialCountdown), upstream_(upstream) {}\n  virtual ~TimebombAllocator() {}\n\n  void* allocate(size_t n) override {\n    if (!countdown_)\n      return nullptr;\n    countdown_--;\n    return upstream_->allocate(n);\n  }\n\n  void deallocate(void* p) override {\n    upstream_->deallocate(p);\n  }\n\n  void* reallocate(void* ptr, size_t n) override {\n    if (!countdown_)\n      return nullptr;\n    countdown_--;\n    return upstream_->reallocate(ptr, n);\n  }\n\n  void setCountdown(size_t value) {\n    countdown_ = value;\n  }\n\n private:\n  size_t countdown_ = 0;\n  Allocator* upstream_;\n};\n}  // namespace\n\ninline size_t sizeofPoolList(size_t n = ARDUINOJSON_INITIAL_POOL_COUNT) {\n  using namespace ArduinoJson::detail;\n  return sizeof(MemoryPool<VariantData>) * n;\n}\n\ntemplate <typename T = ArduinoJson::detail::VariantData>\ninline size_t sizeofPool(\n    ArduinoJson::detail::SlotCount n = ARDUINOJSON_POOL_CAPACITY) {\n  return ArduinoJson::detail::MemoryPool<T>::slotsToBytes(n);\n}\n\ninline size_t sizeofStringBuffer(size_t iteration = 1) {\n  // returns 31, 63, 127, 255, etc.\n  auto capacity = ArduinoJson::detail::StringBuilder::initialCapacity;\n  for (size_t i = 1; i < iteration; i++)\n    capacity = capacity * 2 + 1;\n  return ArduinoJson::detail::sizeofString(capacity);\n}\n\ninline size_t sizeofString(const char* s) {\n  return ArduinoJson::detail::sizeofString(strlen(s));\n}\n"
  },
  {
    "path": "extras/tests/Helpers/Arduino.h",
    "content": "// ArduinoJson - https://arduinojson.org\n// Copyright © 2014-2025, Benoit BLANCHON\n// MIT License\n\n#pragma once\n\n#include \"api/Print.h\"\n#include \"api/Stream.h\"\n#include \"api/String.h\"\n#include \"avr/pgmspace.h\"\n\n#define ARDUINO\n#define ARDUINO_H_INCLUDED 1\n"
  },
  {
    "path": "extras/tests/Helpers/CustomReader.hpp",
    "content": "// ArduinoJson - https://arduinojson.org\n// Copyright © 2014-2025, Benoit BLANCHON\n// MIT License\n\n#pragma once\n\n#include <sstream>\n\nclass CustomReader {\n  std::stringstream stream_;\n\n public:\n  CustomReader(const char* input) : stream_(input) {}\n  CustomReader(const CustomReader&) = delete;\n\n  int read() {\n    return stream_.get();\n  }\n\n  size_t readBytes(char* buffer, size_t length) {\n    stream_.read(buffer, static_cast<std::streamsize>(length));\n    return static_cast<size_t>(stream_.gcount());\n  }\n};\n"
  },
  {
    "path": "extras/tests/Helpers/Literals.hpp",
    "content": "// ArduinoJson - https://arduinojson.org\n// Copyright © 2014-2025, Benoit BLANCHON\n// MIT License\n\n#pragma once\n\n#include <string>\n\n// the space before _s is required by GCC 4.8\ninline std::string operator\"\" _s(const char* str, size_t len) {\n  return std::string(str, len);\n}\n"
  },
  {
    "path": "extras/tests/Helpers/api/Print.h",
    "content": "// ArduinoJson - https://arduinojson.org\n// Copyright © 2014-2025, Benoit BLANCHON\n// MIT License\n\n#pragma once\n\n#include <stdint.h>\n#include <stdlib.h>\n#include <string.h>\n\nclass Print {\n public:\n  virtual ~Print() {}\n\n  virtual size_t write(uint8_t) = 0;\n  virtual size_t write(const uint8_t* buffer, size_t size) = 0;\n\n  size_t write(const char* str) {\n    if (!str)\n      return 0;\n    return write(reinterpret_cast<const uint8_t*>(str), strlen(str));\n  }\n\n  size_t write(const char* buffer, size_t size) {\n    return write(reinterpret_cast<const uint8_t*>(buffer), size);\n  }\n};\n\nclass Printable {\n public:\n  virtual ~Printable() {}\n  virtual size_t printTo(Print& p) const = 0;\n};\n"
  },
  {
    "path": "extras/tests/Helpers/api/Stream.h",
    "content": "// ArduinoJson - https://arduinojson.org\n// Copyright © 2014-2025, Benoit BLANCHON\n// MIT License\n\n#pragma once\n\n// Reproduces Arduino's Stream class\nclass Stream  // : public Print\n{\n public:\n  virtual ~Stream() {}\n  virtual int read() = 0;\n  virtual size_t readBytes(char* buffer, size_t length) = 0;\n};\n"
  },
  {
    "path": "extras/tests/Helpers/api/String.h",
    "content": "// ArduinoJson - https://arduinojson.org\n// Copyright © 2014-2025, Benoit BLANCHON\n// MIT License\n\n#pragma once\n\n#include <string>\n\n// Reproduces Arduino's String class\nclass String {\n public:\n  String() = default;\n  String(const char* s) {\n    if (s)\n      str_.assign(s);\n  }\n\n  void limitCapacityTo(size_t maxCapacity) {\n    maxCapacity_ = maxCapacity;\n  }\n\n  unsigned char concat(const char* s) {\n    return concat(s, strlen(s));\n  }\n\n  size_t length() const {\n    return str_.size();\n  }\n\n  const char* c_str() const {\n    return str_.c_str();\n  }\n\n  bool operator==(const char* s) const {\n    return str_ == s;\n  }\n\n  String& operator=(const char* s) {\n    if (s)\n      str_.assign(s);\n    else\n      str_.clear();\n    return *this;\n  }\n\n  char operator[](unsigned int index) const {\n    if (index >= str_.size())\n      return 0;\n    return str_[index];\n  }\n\n  friend std::ostream& operator<<(std::ostream& lhs, const ::String& rhs) {\n    lhs << rhs.str_;\n    return lhs;\n  }\n\n protected:\n  // This function is protected in most Arduino cores\n  unsigned char concat(const char* s, size_t n) {\n    if (str_.size() + n > maxCapacity_)\n      return 0;\n    str_.append(s, n);\n    return 1;\n  }\n\n private:\n  std::string str_;\n  size_t maxCapacity_ = 1024;\n};\n\nclass StringSumHelper : public ::String {};\n\ninline bool operator==(const std::string& lhs, const ::String& rhs) {\n  return lhs == rhs.c_str();\n}\n"
  },
  {
    "path": "extras/tests/Helpers/avr/pgmspace.h",
    "content": "// ArduinoJson - https://arduinojson.org\n// Copyright © 2014-2025, Benoit BLANCHON\n// MIT License\n\n#pragma once\n\n#include <stdint.h>  // uint8_t\n\n#define PROGMEM\n\nclass __FlashStringHelper;\n\ninline const void* convertPtrToFlash(const void* s) {\n  return reinterpret_cast<const char*>(s) + 42;\n}\n\ninline const void* convertFlashToPtr(const void* s) {\n  return reinterpret_cast<const char*>(s) - 42;\n}\n\n#define PSTR(X) reinterpret_cast<const char*>(convertPtrToFlash(X))\n#define F(X) reinterpret_cast<const __FlashStringHelper*>(PSTR(X))\n\ninline uint8_t pgm_read_byte(const void* p) {\n  return *reinterpret_cast<const uint8_t*>(convertFlashToPtr(p));\n}\n\n#define ARDUINOJSON_DEFINE_PROGMEM_ARRAY(type, name, ...)                \\\n  static type const ARDUINOJSON_CONCAT2(name, _progmem)[] = __VA_ARGS__; \\\n  static type const* name = reinterpret_cast<type const*>(               \\\n      convertPtrToFlash(ARDUINOJSON_CONCAT2(name, _progmem)));\n"
  },
  {
    "path": "extras/tests/IntegrationTests/CMakeLists.txt",
    "content": "# ArduinoJson - https://arduinojson.org\n# Copyright © 2014-2025, Benoit BLANCHON\n# MIT License\n\nadd_executable(IntegrationTests\n\tgbathree.cpp\n\tissue772.cpp\n\tround_trip.cpp\n\topenweathermap.cpp\n)\n\nif(CMAKE_CXX_COMPILER_ID MATCHES \"GNU\" AND CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 6)\n\ttarget_compile_options(IntegrationTests\n\t\tPUBLIC\n\t\t\t-fsingle-precision-constant # issue 544\n\t)\nendif()\n\nadd_test(IntegrationTests IntegrationTests)\n\nset_tests_properties(IntegrationTests\n\tPROPERTIES\n\t\tLABELS \"Catch\"\n)\n"
  },
  {
    "path": "extras/tests/IntegrationTests/gbathree.cpp",
    "content": "// ArduinoJson - https://arduinojson.org\n// Copyright © 2014-2025, Benoit BLANCHON\n// MIT License\n\n#include <ArduinoJson.h>\n#include <catch.hpp>\n\nTEST_CASE(\"Gbathree\") {\n  JsonDocument doc;\n\n  DeserializationError error = deserializeJson(\n      doc,\n      \"{\\\"protocol_name\\\":\\\"fluorescence\\\",\\\"repeats\\\":1,\\\"wait\\\":0,\"\n      \"\\\"averages\\\":1,\\\"measurements\\\":3,\\\"meas2_light\\\":15,\\\"meas1_\"\n      \"baseline\\\":0,\\\"act_light\\\":20,\\\"pulsesize\\\":25,\\\"pulsedistance\\\":\"\n      \"10000,\\\"actintensity1\\\":50,\\\"actintensity2\\\":255,\\\"measintensity\\\":\"\n      \"255,\\\"calintensity\\\":255,\\\"pulses\\\":[50,50,50],\\\"act\\\":[2,1,2,2],\"\n      \"\\\"red\\\":[2,2,2,2],\\\"detectors\\\":[[34,34,34,34],[34,34,34,34],[34,\"\n      \"34,34,34],[34,34,34,34]],\\\"alta\\\":[2,2,2,2],\\\"altb\\\":[2,2,2,2],\"\n      \"\\\"measlights\\\":[[15,15,15,15],[15,15,15,15],[15,15,15,15],[15,15,\"\n      \"15,15]],\\\"measlights2\\\":[[15,15,15,15],[15,15,15,15],[15,15,15,15],\"\n      \"[15,15,15,15]],\\\"altc\\\":[2,2,2,2],\\\"altd\\\":[2,2,2,2]}\");\n  JsonObject root = doc.as<JsonObject>();\n\n  SECTION(\"Success\") {\n    REQUIRE(error == DeserializationError::Ok);\n  }\n\n  SECTION(\"ProtocolName\") {\n    REQUIRE(\"fluorescence\" == root[\"protocol_name\"]);\n  }\n\n  SECTION(\"Repeats\") {\n    REQUIRE(1 == root[\"repeats\"]);\n  }\n\n  SECTION(\"Wait\") {\n    REQUIRE(0 == root[\"wait\"]);\n  }\n\n  SECTION(\"Measurements\") {\n    REQUIRE(3 == root[\"measurements\"]);\n  }\n\n  SECTION(\"Meas2_Light\") {\n    REQUIRE(15 == root[\"meas2_light\"]);\n  }\n\n  SECTION(\"Meas1_Baseline\") {\n    REQUIRE(0 == root[\"meas1_baseline\"]);\n  }\n\n  SECTION(\"Act_Light\") {\n    REQUIRE(20 == root[\"act_light\"]);\n  }\n\n  SECTION(\"Pulsesize\") {\n    REQUIRE(25 == root[\"pulsesize\"]);\n  }\n\n  SECTION(\"Pulsedistance\") {\n    REQUIRE(10000 == root[\"pulsedistance\"]);\n  }\n\n  SECTION(\"Actintensity1\") {\n    REQUIRE(50 == root[\"actintensity1\"]);\n  }\n\n  SECTION(\"Actintensity2\") {\n    REQUIRE(255 == root[\"actintensity2\"]);\n  }\n\n  SECTION(\"Measintensity\") {\n    REQUIRE(255 == root[\"measintensity\"]);\n  }\n\n  SECTION(\"Calintensity\") {\n    REQUIRE(255 == root[\"calintensity\"]);\n  }\n\n  SECTION(\"Pulses\") {\n    // \"pulses\":[50,50,50]\n\n    JsonArray array = root[\"pulses\"];\n    REQUIRE(array.isNull() == false);\n\n    REQUIRE(3 == array.size());\n\n    for (size_t i = 0; i < 3; i++) {\n      REQUIRE(50 == array[i]);\n    }\n  }\n\n  SECTION(\"Act\") {\n    // \"act\":[2,1,2,2]\n\n    JsonArray array = root[\"act\"];\n    REQUIRE(array.isNull() == false);\n\n    REQUIRE(4 == array.size());\n    REQUIRE(2 == array[0]);\n    REQUIRE(1 == array[1]);\n    REQUIRE(2 == array[2]);\n    REQUIRE(2 == array[3]);\n  }\n\n  SECTION(\"Detectors\") {\n    // \"detectors\":[[34,34,34,34],[34,34,34,34],[34,34,34,34],[34,34,34,34]]\n\n    JsonArray array = root[\"detectors\"];\n    REQUIRE(array.isNull() == false);\n    REQUIRE(4 == array.size());\n\n    for (size_t i = 0; i < 4; i++) {\n      JsonArray nestedArray = array[i];\n      REQUIRE(4 == nestedArray.size());\n\n      for (size_t j = 0; j < 4; j++) {\n        REQUIRE(34 == nestedArray[j]);\n      }\n    }\n  }\n\n  SECTION(\"Alta\") {\n    // alta:[2,2,2,2]\n\n    JsonArray array = root[\"alta\"];\n    REQUIRE(array.isNull() == false);\n\n    REQUIRE(4 == array.size());\n\n    for (size_t i = 0; i < 4; i++) {\n      REQUIRE(2 == array[i]);\n    }\n  }\n\n  SECTION(\"Altb\") {\n    // altb:[2,2,2,2]\n\n    JsonArray array = root[\"altb\"];\n    REQUIRE(array.isNull() == false);\n\n    REQUIRE(4 == array.size());\n\n    for (size_t i = 0; i < 4; i++) {\n      REQUIRE(2 == array[i]);\n    }\n  }\n\n  SECTION(\"Measlights\") {\n    // \"measlights\":[[15,15,15,15],[15,15,15,15],[15,15,15,15],[15,15,15,15]]\n\n    JsonArray array = root[\"measlights\"];\n    REQUIRE(array.isNull() == false);\n    REQUIRE(4 == array.size());\n\n    for (size_t i = 0; i < 4; i++) {\n      JsonArray nestedArray = array[i];\n\n      REQUIRE(4 == nestedArray.size());\n\n      for (size_t j = 0; j < 4; j++) {\n        REQUIRE(15 == nestedArray[j]);\n      }\n    }\n  }\n\n  SECTION(\"Measlights2\") {\n    // \"measlights2\":[[15,15,15,15],[15,15,15,15],[15,15,15,15],[15,15,15,15]]\n\n    JsonArray array = root[\"measlights2\"];\n    REQUIRE(array.isNull() == false);\n    REQUIRE(4 == array.size());\n\n    for (size_t i = 0; i < 4; i++) {\n      JsonArray nestedArray = array[i];\n      REQUIRE(4 == nestedArray.size());\n\n      for (size_t j = 0; j < 4; j++) {\n        REQUIRE(15 == nestedArray[j]);\n      }\n    }\n  }\n\n  SECTION(\"Altc\") {\n    // altc:[2,2,2,2]\n\n    JsonArray array = root[\"altc\"];\n    REQUIRE(array.isNull() == false);\n\n    REQUIRE(4 == array.size());\n\n    for (size_t i = 0; i < 4; i++) {\n      REQUIRE(2 == array[i]);\n    }\n  }\n\n  SECTION(\"Altd\") {\n    // altd:[2,2,2,2]\n\n    JsonArray array = root[\"altd\"];\n    REQUIRE(array.isNull() == false);\n\n    REQUIRE(4 == array.size());\n\n    for (size_t i = 0; i < 4; i++) {\n      REQUIRE(2 == array[i]);\n    }\n  }\n}\n"
  },
  {
    "path": "extras/tests/IntegrationTests/issue772.cpp",
    "content": "// ArduinoJson - https://arduinojson.org\n// Copyright © 2014-2025, Benoit BLANCHON\n// MIT License\n\n#include <ArduinoJson.h>\n#include <catch.hpp>\n\n// https://github.com/bblanchon/ArduinoJson/issues/772\n\nTEST_CASE(\"Issue772\") {\n  JsonDocument doc1;\n  JsonDocument doc2;\n  DeserializationError err;\n  std::string data =\n      \"{\\\"state\\\":{\\\"reported\\\":{\\\"timestamp\\\":\\\"2018-07-02T09:40:12Z\\\",\"\n      \"\\\"mac\\\":\\\"2C3AE84FC076\\\",\\\"firmwareVersion\\\":\\\"v0.2.7-5-gf4d4d78\\\",\"\n      \"\\\"visibleLight\\\":261,\\\"infraRed\\\":255,\\\"ultraViolet\\\":0.02,\"\n      \"\\\"Temperature\\\":26.63,\\\"Pressure\\\":101145.7,\\\"Humidity\\\":54.79883,\"\n      \"\\\"Vbat\\\":4.171261,\\\"soilMoisture\\\":0,\\\"ActB\\\":0}}}\";\n  err = deserializeJson(doc1, data);\n  REQUIRE(err == DeserializationError::Ok);\n\n  data = \"\";\n  serializeMsgPack(doc1, data);\n  err = deserializeMsgPack(doc2, data);\n\n  REQUIRE(err == DeserializationError::Ok);\n}\n"
  },
  {
    "path": "extras/tests/IntegrationTests/openweathermap.cpp",
    "content": "// ArduinoJson - https://arduinojson.org\n// Copyright © 2014-2025, Benoit BLANCHON\n// MIT License\n\n#include <ArduinoJson.h>\n#include <catch.hpp>\n\nTEST_CASE(\"OpenWeatherMap\") {\n  // clang-format off\n  const char* input_json = \"{\\\"cod\\\":\\\"200\\\",\\\"message\\\":0,\\\"cnt\\\":40,\\\"list\\\":[{\\\"dt\\\":1581498000,\\\"main\\\":{\\\"temp\\\":3.23,\\\"feels_like\\\":-3.63,\\\"temp_min\\\":3.23,\\\"temp_max\\\":4.62,\\\"pressure\\\":1014,\\\"sea_level\\\":1014,\\\"grnd_level\\\":1010,\\\"humidity\\\":58,\\\"temp_kf\\\":-1.39},\\\"weather\\\":[{\\\"id\\\":800,\\\"main\\\":\\\"Clear\\\",\\\"description\\\":\\\"clear sky\\\",\\\"icon\\\":\\\"01d\\\"}],\\\"clouds\\\":{\\\"all\\\":0},\\\"wind\\\":{\\\"speed\\\":6.19,\\\"deg\\\":266},\\\"sys\\\":{\\\"pod\\\":\\\"d\\\"},\\\"dt_txt\\\":\\\"2020-02-12 09:00:00\\\"},{\\\"dt\\\":1581508800,\\\"main\\\":{\\\"temp\\\":6.09,\\\"feels_like\\\":-1.07,\\\"temp_min\\\":6.09,\\\"temp_max\\\":7.13,\\\"pressure\\\":1015,\\\"sea_level\\\":1015,\\\"grnd_level\\\":1011,\\\"humidity\\\":48,\\\"temp_kf\\\":-1.04},\\\"weather\\\":[{\\\"id\\\":800,\\\"main\\\":\\\"Clear\\\",\\\"description\\\":\\\"clear sky\\\",\\\"icon\\\":\\\"01d\\\"}],\\\"clouds\\\":{\\\"all\\\":9},\\\"wind\\\":{\\\"speed\\\":6.64,\\\"deg\\\":268},\\\"sys\\\":{\\\"pod\\\":\\\"d\\\"},\\\"dt_txt\\\":\\\"2020-02-12 12:00:00\\\"},{\\\"dt\\\":1581519600,\\\"main\\\":{\\\"temp\\\":6.82,\\\"feels_like\\\":0.47,\\\"temp_min\\\":6.82,\\\"temp_max\\\":7.52,\\\"pressure\\\":1015,\\\"sea_level\\\":1015,\\\"grnd_level\\\":1011,\\\"humidity\\\":47,\\\"temp_kf\\\":-0.7},\\\"weather\\\":[{\\\"id\\\":804,\\\"main\\\":\\\"Clouds\\\",\\\"description\\\":\\\"overcast clouds\\\",\\\"icon\\\":\\\"04d\\\"}],\\\"clouds\\\":{\\\"all\\\":97},\\\"wind\\\":{\\\"speed\\\":5.55,\\\"deg\\\":267},\\\"sys\\\":{\\\"pod\\\":\\\"d\\\"},\\\"dt_txt\\\":\\\"2020-02-12 15:00:00\\\"},{\\\"dt\\\":1581530400,\\\"main\\\":{\\\"temp\\\":5.76,\\\"feels_like\\\":1.84,\\\"temp_min\\\":5.76,\\\"temp_max\\\":6.11,\\\"pressure\\\":1015,\\\"sea_level\\\":1015,\\\"grnd_level\\\":1010,\\\"humidity\\\":57,\\\"temp_kf\\\":-0.35},\\\"weather\\\":[{\\\"id\\\":804,\\\"main\\\":\\\"Clouds\\\",\\\"description\\\":\\\"overcast clouds\\\",\\\"icon\\\":\\\"04n\\\"}],\\\"clouds\\\":{\\\"all\\\":99},\\\"wind\\\":{\\\"speed\\\":2.35,\\\"deg\\\":232},\\\"sys\\\":{\\\"pod\\\":\\\"n\\\"},\\\"dt_txt\\\":\\\"2020-02-12 18:00:00\\\"},{\\\"dt\\\":1581541200,\\\"main\\\":{\\\"temp\\\":5.7,\\\"feels_like\\\":1.34,\\\"temp_min\\\":5.7,\\\"temp_max\\\":5.7,\\\"pressure\\\":1012,\\\"sea_level\\\":1012,\\\"grnd_level\\\":1008,\\\"humidity\\\":71,\\\"temp_kf\\\":0},\\\"weather\\\":[{\\\"id\\\":804,\\\"main\\\":\\\"Clouds\\\",\\\"description\\\":\\\"overcast clouds\\\",\\\"icon\\\":\\\"04n\\\"}],\\\"clouds\\\":{\\\"all\\\":100},\\\"wind\\\":{\\\"speed\\\":3.57,\\\"deg\\\":198},\\\"sys\\\":{\\\"pod\\\":\\\"n\\\"},\\\"dt_txt\\\":\\\"2020-02-12 21:00:00\\\"},{\\\"dt\\\":1581552000,\\\"main\\\":{\\\"temp\\\":5.82,\\\"feels_like\\\":1.39,\\\"temp_min\\\":5.82,\\\"temp_max\\\":5.82,\\\"pressure\\\":1009,\\\"sea_level\\\":1009,\\\"grnd_level\\\":1004,\\\"humidity\\\":86,\\\"temp_kf\\\":0},\\\"weather\\\":[{\\\"id\\\":500,\\\"main\\\":\\\"Rain\\\",\\\"description\\\":\\\"light rain\\\",\\\"icon\\\":\\\"10n\\\"}],\\\"clouds\\\":{\\\"all\\\":100},\\\"wind\\\":{\\\"speed\\\":4.35,\\\"deg\\\":169},\\\"rain\\\":{\\\"3h\\\":0.5},\\\"sys\\\":{\\\"pod\\\":\\\"n\\\"},\\\"dt_txt\\\":\\\"2020-02-13 00:00:00\\\"},{\\\"dt\\\":1581562800,\\\"main\\\":{\\\"temp\\\":5.9,\\\"feels_like\\\":-0.85,\\\"temp_min\\\":5.9,\\\"temp_max\\\":5.9,\\\"pressure\\\":1000,\\\"sea_level\\\":1000,\\\"grnd_level\\\":997,\\\"humidity\\\":86,\\\"temp_kf\\\":0},\\\"weather\\\":[{\\\"id\\\":500,\\\"main\\\":\\\"Rain\\\",\\\"description\\\":\\\"light rain\\\",\\\"icon\\\":\\\"10n\\\"}],\\\"clouds\\\":{\\\"all\\\":100},\\\"wind\\\":{\\\"speed\\\":7.69,\\\"deg\\\":178},\\\"rain\\\":{\\\"3h\\\":1.75},\\\"sys\\\":{\\\"pod\\\":\\\"n\\\"},\\\"dt_txt\\\":\\\"2020-02-13 03:00:00\\\"},{\\\"dt\\\":1581573600,\\\"main\\\":{\\\"temp\\\":7.52,\\\"feels_like\\\":1.74,\\\"temp_min\\\":7.52,\\\"temp_max\\\":7.52,\\\"pressure\\\":993,\\\"sea_level\\\":993,\\\"grnd_level\\\":988,\\\"humidity\\\":88,\\\"temp_kf\\\":0},\\\"weather\\\":[{\\\"id\\\":501,\\\"main\\\":\\\"Rain\\\",\\\"description\\\":\\\"moderate rain\\\",\\\"icon\\\":\\\"10n\\\"}],\\\"clouds\\\":{\\\"all\\\":100},\\\"wind\\\":{\\\"speed\\\":6.84,\\\"deg\\\":184},\\\"rain\\\":{\\\"3h\\\":7.06},\\\"sys\\\":{\\\"pod\\\":\\\"n\\\"},\\\"dt_txt\\\":\\\"2020-02-13 06:00:00\\\"},{\\\"dt\\\":1581584400,\\\"main\\\":{\\\"temp\\\":7.23,\\\"feels_like\\\":0.81,\\\"temp_min\\\":7.23,\\\"temp_max\\\":7.23,\\\"pressure\\\":992,\\\"sea_level\\\":992,\\\"grnd_level\\\":988,\\\"humidity\\\":69,\\\"temp_kf\\\":0},\\\"weather\\\":[{\\\"id\\\":500,\\\"main\\\":\\\"Rain\\\",\\\"description\\\":\\\"light rain\\\",\\\"icon\\\":\\\"10d\\\"}],\\\"clouds\\\":{\\\"all\\\":49},\\\"wind\\\":{\\\"speed\\\":6.77,\\\"deg\\\":239},\\\"rain\\\":{\\\"3h\\\":0.25},\\\"sys\\\":{\\\"pod\\\":\\\"d\\\"},\\\"dt_txt\\\":\\\"2020-02-13 09:00:00\\\"},{\\\"dt\\\":1581595200,\\\"main\\\":{\\\"temp\\\":7.67,\\\"feels_like\\\":2.81,\\\"temp_min\\\":7.67,\\\"temp_max\\\":7.67,\\\"pressure\\\":991,\\\"sea_level\\\":991,\\\"grnd_level\\\":987,\\\"humidity\\\":75,\\\"temp_kf\\\":0},\\\"weather\\\":[{\\\"id\\\":500,\\\"main\\\":\\\"Rain\\\",\\\"description\\\":\\\"light rain\\\",\\\"icon\\\":\\\"10d\\\"}],\\\"clouds\\\":{\\\"all\\\":73},\\\"wind\\\":{\\\"speed\\\":4.93,\\\"deg\\\":235},\\\"rain\\\":{\\\"3h\\\":0.75},\\\"sys\\\":{\\\"pod\\\":\\\"d\\\"},\\\"dt_txt\\\":\\\"2020-02-13 12:00:00\\\"},{\\\"dt\\\":1581606000,\\\"main\\\":{\\\"temp\\\":8.83,\\\"feels_like\\\":3.23,\\\"temp_min\\\":8.83,\\\"temp_max\\\":8.83,\\\"pressure\\\":993,\\\"sea_level\\\":993,\\\"grnd_level\\\":990,\\\"humidity\\\":64,\\\"temp_kf\\\":0},\\\"weather\\\":[{\\\"id\\\":500,\\\"main\\\":\\\"Rain\\\",\\\"description\\\":\\\"light rain\\\",\\\"icon\\\":\\\"10d\\\"}],\\\"clouds\\\":{\\\"all\\\":83},\\\"wind\\\":{\\\"speed\\\":5.7,\\\"deg\\\":293},\\\"rain\\\":{\\\"3h\\\":0.38},\\\"sys\\\":{\\\"pod\\\":\\\"d\\\"},\\\"dt_txt\\\":\\\"2020-02-13 15:00:00\\\"},{\\\"dt\\\":1581616800,\\\"main\\\":{\\\"temp\\\":7.42,\\\"feels_like\\\":1.77,\\\"temp_min\\\":7.42,\\\"temp_max\\\":7.42,\\\"pressure\\\":1000,\\\"sea_level\\\":1000,\\\"grnd_level\\\":996,\\\"humidity\\\":71,\\\"temp_kf\\\":0},\\\"weather\\\":[{\\\"id\\\":803,\\\"main\\\":\\\"Clouds\\\",\\\"description\\\":\\\"broken clouds\\\",\\\"icon\\\":\\\"04n\\\"}],\\\"clouds\\\":{\\\"all\\\":54},\\\"wind\\\":{\\\"speed\\\":5.81,\\\"deg\\\":307},\\\"sys\\\":{\\\"pod\\\":\\\"n\\\"},\\\"dt_txt\\\":\\\"2020-02-13 18:00:00\\\"},{\\\"dt\\\":1581627600,\\\"main\\\":{\\\"temp\\\":5.82,\\\"feels_like\\\":0.89,\\\"temp_min\\\":5.82,\\\"temp_max\\\":5.82,\\\"pressure\\\":1007,\\\"sea_level\\\":1007,\\\"grnd_level\\\":1003,\\\"humidity\\\":79,\\\"temp_kf\\\":0},\\\"weather\\\":[{\\\"id\\\":800,\\\"main\\\":\\\"Clear\\\",\\\"description\\\":\\\"clear sky\\\",\\\"icon\\\":\\\"01n\\\"}],\\\"clouds\\\":{\\\"all\\\":6},\\\"wind\\\":{\\\"speed\\\":4.76,\\\"deg\\\":300},\\\"sys\\\":{\\\"pod\\\":\\\"n\\\"},\\\"dt_txt\\\":\\\"2020-02-13 21:00:00\\\"},{\\\"dt\\\":1581638400,\\\"main\\\":{\\\"temp\\\":5.58,\\\"feels_like\\\":2.09,\\\"temp_min\\\":5.58,\\\"temp_max\\\":5.58,\\\"pressure\\\":1011,\\\"sea_level\\\":1011,\\\"grnd_level\\\":1007,\\\"humidity\\\":81,\\\"temp_kf\\\":0},\\\"weather\\\":[{\\\"id\\\":802,\\\"main\\\":\\\"Clouds\\\",\\\"description\\\":\\\"scattered clouds\\\",\\\"icon\\\":\\\"03n\\\"}],\\\"clouds\\\":{\\\"all\\\":47},\\\"wind\\\":{\\\"speed\\\":2.73,\\\"deg\\\":326},\\\"sys\\\":{\\\"pod\\\":\\\"n\\\"},\\\"dt_txt\\\":\\\"2020-02-14 00:00:00\\\"},{\\\"dt\\\":1581649200,\\\"main\\\":{\\\"temp\\\":4.27,\\\"feels_like\\\":1.72,\\\"temp_min\\\":4.27,\\\"temp_max\\\":4.27,\\\"pressure\\\":1014,\\\"sea_level\\\":1014,\\\"grnd_level\\\":1010,\\\"humidity\\\":85,\\\"temp_kf\\\":0},\\\"weather\\\":[{\\\"id\\\":803,\\\"main\\\":\\\"Clouds\\\",\\\"description\\\":\\\"broken clouds\\\",\\\"icon\\\":\\\"04n\\\"}],\\\"clouds\\\":{\\\"all\\\":69},\\\"wind\\\":{\\\"speed\\\":1.24,\\\"deg\\\":295},\\\"sys\\\":{\\\"pod\\\":\\\"n\\\"},\\\"dt_txt\\\":\\\"2020-02-14 03:00:00\\\"},{\\\"dt\\\":1581660000,\\\"main\\\":{\\\"temp\\\":3.91,\\\"feels_like\\\":1.54,\\\"temp_min\\\":3.91,\\\"temp_max\\\":3.91,\\\"pressure\\\":1016,\\\"sea_level\\\":1016,\\\"grnd_level\\\":1012,\\\"humidity\\\":87,\\\"temp_kf\\\":0},\\\"weather\\\":[{\\\"id\\\":804,\\\"main\\\":\\\"Clouds\\\",\\\"description\\\":\\\"overcast clouds\\\",\\\"icon\\\":\\\"04n\\\"}],\\\"clouds\\\":{\\\"all\\\":85},\\\"wind\\\":{\\\"speed\\\":0.98,\\\"deg\\\":211},\\\"sys\\\":{\\\"pod\\\":\\\"n\\\"},\\\"dt_txt\\\":\\\"2020-02-14 06:00:00\\\"},{\\\"dt\\\":1581670800,\\\"main\\\":{\\\"temp\\\":4.77,\\\"feels_like\\\":0.74,\\\"temp_min\\\":4.77,\\\"temp_max\\\":4.77,\\\"pressure\\\":1017,\\\"sea_level\\\":1017,\\\"grnd_level\\\":1013,\\\"humidity\\\":78,\\\"temp_kf\\\":0},\\\"weather\\\":[{\\\"id\\\":804,\\\"main\\\":\\\"Clouds\\\",\\\"description\\\":\\\"overcast clouds\\\",\\\"icon\\\":\\\"04d\\\"}],\\\"clouds\\\":{\\\"all\\\":100},\\\"wind\\\":{\\\"speed\\\":3.19,\\\"deg\\\":184},\\\"sys\\\":{\\\"pod\\\":\\\"d\\\"},\\\"dt_txt\\\":\\\"2020-02-14 09:00:00\\\"},{\\\"dt\\\":1581681600,\\\"main\\\":{\\\"temp\\\":9.03,\\\"feels_like\\\":4,\\\"temp_min\\\":9.03,\\\"temp_max\\\":9.03,\\\"pressure\\\":1016,\\\"sea_level\\\":1016,\\\"grnd_level\\\":1012,\\\"humidity\\\":73,\\\"temp_kf\\\":0},\\\"weather\\\":[{\\\"id\\\":804,\\\"main\\\":\\\"Clouds\\\",\\\"description\\\":\\\"overcast clouds\\\",\\\"icon\\\":\\\"04d\\\"}],\\\"clouds\\\":{\\\"all\\\":100},\\\"wind\\\":{\\\"speed\\\":5.43,\\\"deg\\\":206},\\\"sys\\\":{\\\"pod\\\":\\\"d\\\"},\\\"dt_txt\\\":\\\"2020-02-14 12:00:00\\\"},{\\\"dt\\\":1581692400,\\\"main\\\":{\\\"temp\\\":9.86,\\\"feels_like\\\":4.22,\\\"temp_min\\\":9.86,\\\"temp_max\\\":9.86,\\\"pressure\\\":1014,\\\"sea_level\\\":1014,\\\"grnd_level\\\":1010,\\\"humidity\\\":74,\\\"temp_kf\\\":0},\\\"weather\\\":[{\\\"id\\\":804,\\\"main\\\":\\\"Clouds\\\",\\\"description\\\":\\\"overcast clouds\\\",\\\"icon\\\":\\\"04d\\\"}],\\\"clouds\\\":{\\\"all\\\":100},\\\"wind\\\":{\\\"speed\\\":6.58,\\\"deg\\\":209},\\\"sys\\\":{\\\"pod\\\":\\\"d\\\"},\\\"dt_txt\\\":\\\"2020-02-14 15:00:00\\\"},{\\\"dt\\\":1581703200,\\\"main\\\":{\\\"temp\\\":9.48,\\\"feels_like\\\":4.8,\\\"temp_min\\\":9.48,\\\"temp_max\\\":9.48,\\\"pressure\\\":1013,\\\"sea_level\\\":1013,\\\"grnd_level\\\":1009,\\\"humidity\\\":83,\\\"temp_kf\\\":0},\\\"weather\\\":[{\\\"id\\\":804,\\\"main\\\":\\\"Clouds\\\",\\\"description\\\":\\\"overcast clouds\\\",\\\"icon\\\":\\\"04n\\\"}],\\\"clouds\\\":{\\\"all\\\":100},\\\"wind\\\":{\\\"speed\\\":5.6,\\\"deg\\\":206},\\\"sys\\\":{\\\"pod\\\":\\\"n\\\"},\\\"dt_txt\\\":\\\"2020-02-14 18:00:00\\\"},{\\\"dt\\\":1581714000,\\\"main\\\":{\\\"temp\\\":10.03,\\\"feels_like\\\":6.48,\\\"temp_min\\\":10.03,\\\"temp_max\\\":10.03,\\\"pressure\\\":1013,\\\"sea_level\\\":1013,\\\"grnd_level\\\":1009,\\\"humidity\\\":93,\\\"temp_kf\\\":0},\\\"weather\\\":[{\\\"id\\\":501,\\\"main\\\":\\\"Rain\\\",\\\"description\\\":\\\"moderate rain\\\",\\\"icon\\\":\\\"10n\\\"}],\\\"clouds\\\":{\\\"all\\\":100},\\\"wind\\\":{\\\"speed\\\":4.75,\\\"deg\\\":226},\\\"rain\\\":{\\\"3h\\\":3.13},\\\"sys\\\":{\\\"pod\\\":\\\"n\\\"},\\\"dt_txt\\\":\\\"2020-02-14 21:00:00\\\"},{\\\"dt\\\":1581724800,\\\"main\\\":{\\\"temp\\\":9.48,\\\"feels_like\\\":6.25,\\\"temp_min\\\":9.48,\\\"temp_max\\\":9.48,\\\"pressure\\\":1013,\\\"sea_level\\\":1013,\\\"grnd_level\\\":1009,\\\"humidity\\\":89,\\\"temp_kf\\\":0},\\\"weather\\\":[{\\\"id\\\":500,\\\"main\\\":\\\"Rain\\\",\\\"description\\\":\\\"light rain\\\",\\\"icon\\\":\\\"10n\\\"}],\\\"clouds\\\":{\\\"all\\\":100},\\\"wind\\\":{\\\"speed\\\":3.87,\\\"deg\\\":214},\\\"rain\\\":{\\\"3h\\\":2.38},\\\"sys\\\":{\\\"pod\\\":\\\"n\\\"},\\\"dt_txt\\\":\\\"2020-02-15 00:00:00\\\"},{\\\"dt\\\":1581735600,\\\"main\\\":{\\\"temp\\\":9.12,\\\"feels_like\\\":7.08,\\\"temp_min\\\":9.12,\\\"temp_max\\\":9.12,\\\"pressure\\\":1011,\\\"sea_level\\\":1011,\\\"grnd_level\\\":1007,\\\"humidity\\\":96,\\\"temp_kf\\\":0},\\\"weather\\\":[{\\\"id\\\":500,\\\"main\\\":\\\"Rain\\\",\\\"description\\\":\\\"light rain\\\",\\\"icon\\\":\\\"10n\\\"}],\\\"clouds\\\":{\\\"all\\\":100},\\\"wind\\\":{\\\"speed\\\":2.43,\\\"deg\\\":194},\\\"rain\\\":{\\\"3h\\\":1},\\\"sys\\\":{\\\"pod\\\":\\\"n\\\"},\\\"dt_txt\\\":\\\"2020-02-15 03:00:00\\\"},{\\\"dt\\\":1581746400,\\\"main\\\":{\\\"temp\\\":10.32,\\\"feels_like\\\":6.71,\\\"temp_min\\\":10.32,\\\"temp_max\\\":10.32,\\\"pressure\\\":1009,\\\"sea_level\\\":1009,\\\"grnd_level\\\":1004,\\\"humidity\\\":95,\\\"temp_kf\\\":0},\\\"weather\\\":[{\\\"id\\\":500,\\\"main\\\":\\\"Rain\\\",\\\"description\\\":\\\"light rain\\\",\\\"icon\\\":\\\"10n\\\"}],\\\"clouds\\\":{\\\"all\\\":100},\\\"wind\\\":{\\\"speed\\\":5.05,\\\"deg\\\":196},\\\"rain\\\":{\\\"3h\\\":1.75},\\\"sys\\\":{\\\"pod\\\":\\\"n\\\"},\\\"dt_txt\\\":\\\"2020-02-15 06:00:00\\\"},{\\\"dt\\\":1581757200,\\\"main\\\":{\\\"temp\\\":11.57,\\\"feels_like\\\":5.85,\\\"temp_min\\\":11.57,\\\"temp_max\\\":11.57,\\\"pressure\\\":1006,\\\"sea_level\\\":1006,\\\"grnd_level\\\":1002,\\\"humidity\\\":85,\\\"temp_kf\\\":0},\\\"weather\\\":[{\\\"id\\\":500,\\\"main\\\":\\\"Rain\\\",\\\"description\\\":\\\"light rain\\\",\\\"icon\\\":\\\"10d\\\"}],\\\"clouds\\\":{\\\"all\\\":100},\\\"wind\\\":{\\\"speed\\\":7.91,\\\"deg\\\":205},\\\"rain\\\":{\\\"3h\\\":1.44},\\\"sys\\\":{\\\"pod\\\":\\\"d\\\"},\\\"dt_txt\\\":\\\"2020-02-15 09:00:00\\\"},{\\\"dt\\\":1581768000,\\\"main\\\":{\\\"temp\\\":12.25,\\\"feels_like\\\":4.46,\\\"temp_min\\\":12.25,\\\"temp_max\\\":12.25,\\\"pressure\\\":1003,\\\"sea_level\\\":1003,\\\"grnd_level\\\":998,\\\"humidity\\\":78,\\\"temp_kf\\\":0},\\\"weather\\\":[{\\\"id\\\":500,\\\"main\\\":\\\"Rain\\\",\\\"description\\\":\\\"light rain\\\",\\\"icon\\\":\\\"10d\\\"}],\\\"clouds\\\":{\\\"all\\\":100},\\\"wind\\\":{\\\"speed\\\":10.65,\\\"deg\\\":201},\\\"rain\\\":{\\\"3h\\\":1.81},\\\"sys\\\":{\\\"pod\\\":\\\"d\\\"},\\\"dt_txt\\\":\\\"2020-02-15 12:00:00\\\"},{\\\"dt\\\":1581778800,\\\"main\\\":{\\\"temp\\\":12.19,\\\"feels_like\\\":3.17,\\\"temp_min\\\":12.19,\\\"temp_max\\\":12.19,\\\"pressure\\\":998,\\\"sea_level\\\":998,\\\"grnd_level\\\":994,\\\"humidity\\\":80,\\\"temp_kf\\\":0},\\\"weather\\\":[{\\\"id\\\":501,\\\"main\\\":\\\"Rain\\\",\\\"description\\\":\\\"moderate rain\\\",\\\"icon\\\":\\\"10d\\\"}],\\\"clouds\\\":{\\\"all\\\":100},\\\"wind\\\":{\\\"speed\\\":12.52,\\\"deg\\\":204},\\\"rain\\\":{\\\"3h\\\":3.5},\\\"sys\\\":{\\\"pod\\\":\\\"d\\\"},\\\"dt_txt\\\":\\\"2020-02-15 15:00:00\\\"},{\\\"dt\\\":1581789600,\\\"main\\\":{\\\"temp\\\":12.25,\\\"feels_like\\\":4.15,\\\"temp_min\\\":12.25,\\\"temp_max\\\":12.25,\\\"pressure\\\":996,\\\"sea_level\\\":996,\\\"grnd_level\\\":992,\\\"humidity\\\":83,\\\"temp_kf\\\":0},\\\"weather\\\":[{\\\"id\\\":501,\\\"main\\\":\\\"Rain\\\",\\\"description\\\":\\\"moderate rain\\\",\\\"icon\\\":\\\"10n\\\"}],\\\"clouds\\\":{\\\"all\\\":100},\\\"wind\\\":{\\\"speed\\\":11.42,\\\"deg\\\":215},\\\"rain\\\":{\\\"3h\\\":4.88},\\\"sys\\\":{\\\"pod\\\":\\\"n\\\"},\\\"dt_txt\\\":\\\"2020-02-15 18:00:00\\\"},{\\\"dt\\\":1581800400,\\\"main\\\":{\\\"temp\\\":12.64,\\\"feels_like\\\":5.85,\\\"temp_min\\\":12.64,\\\"temp_max\\\":12.64,\\\"pressure\\\":994,\\\"sea_level\\\":994,\\\"grnd_level\\\":990,\\\"humidity\\\":76,\\\"temp_kf\\\":0},\\\"weather\\\":[{\\\"id\\\":501,\\\"main\\\":\\\"Rain\\\",\\\"description\\\":\\\"moderate rain\\\",\\\"icon\\\":\\\"10n\\\"}],\\\"clouds\\\":{\\\"all\\\":100},\\\"wind\\\":{\\\"speed\\\":9.22,\\\"deg\\\":217},\\\"rain\\\":{\\\"3h\\\":6.88},\\\"sys\\\":{\\\"pod\\\":\\\"n\\\"},\\\"dt_txt\\\":\\\"2020-02-15 21:00:00\\\"},{\\\"dt\\\":1581811200,\\\"main\\\":{\\\"temp\\\":12.96,\\\"feels_like\\\":4.03,\\\"temp_min\\\":12.96,\\\"temp_max\\\":12.96,\\\"pressure\\\":988,\\\"sea_level\\\":988,\\\"grnd_level\\\":984,\\\"humidity\\\":83,\\\"temp_kf\\\":0},\\\"weather\\\":[{\\\"id\\\":501,\\\"main\\\":\\\"Rain\\\",\\\"description\\\":\\\"moderate rain\\\",\\\"icon\\\":\\\"10n\\\"}],\\\"clouds\\\":{\\\"all\\\":100},\\\"wind\\\":{\\\"speed\\\":12.88,\\\"deg\\\":211},\\\"rain\\\":{\\\"3h\\\":5.63},\\\"sys\\\":{\\\"pod\\\":\\\"n\\\"},\\\"dt_txt\\\":\\\"2020-02-16 00:00:00\\\"},{\\\"dt\\\":1581822000,\\\"main\\\":{\\\"temp\\\":13.13,\\\"feels_like\\\":5.17,\\\"temp_min\\\":13.13,\\\"temp_max\\\":13.13,\\\"pressure\\\":987,\\\"sea_level\\\":987,\\\"grnd_level\\\":982,\\\"humidity\\\":82,\\\"temp_kf\\\":0},\\\"weather\\\":[{\\\"id\\\":501,\\\"main\\\":\\\"Rain\\\",\\\"description\\\":\\\"moderate rain\\\",\\\"icon\\\":\\\"10n\\\"}],\\\"clouds\\\":{\\\"all\\\":100},\\\"wind\\\":{\\\"speed\\\":11.49,\\\"deg\\\":246},\\\"rain\\\":{\\\"3h\\\":7.25},\\\"sys\\\":{\\\"pod\\\":\\\"n\\\"},\\\"dt_txt\\\":\\\"2020-02-16 03:00:00\\\"},{\\\"dt\\\":1581832800,\\\"main\\\":{\\\"temp\\\":9.07,\\\"feels_like\\\":0.79,\\\"temp_min\\\":9.07,\\\"temp_max\\\":9.07,\\\"pressure\\\":990,\\\"sea_level\\\":990,\\\"grnd_level\\\":986,\\\"humidity\\\":75,\\\"temp_kf\\\":0},\\\"weather\\\":[{\\\"id\\\":500,\\\"main\\\":\\\"Rain\\\",\\\"description\\\":\\\"light rain\\\",\\\"icon\\\":\\\"10n\\\"}],\\\"clouds\\\":{\\\"all\\\":100},\\\"wind\\\":{\\\"speed\\\":10.18,\\\"deg\\\":255},\\\"rain\\\":{\\\"3h\\\":2},\\\"sys\\\":{\\\"pod\\\":\\\"n\\\"},\\\"dt_txt\\\":\\\"2020-02-16 06:00:00\\\"},{\\\"dt\\\":1581843600,\\\"main\\\":{\\\"temp\\\":8.05,\\\"feels_like\\\":-0.9,\\\"temp_min\\\":8.05,\\\"temp_max\\\":8.05,\\\"pressure\\\":994,\\\"sea_level\\\":994,\\\"grnd_level\\\":990,\\\"humidity\\\":51,\\\"temp_kf\\\":0},\\\"weather\\\":[{\\\"id\\\":500,\\\"main\\\":\\\"Rain\\\",\\\"description\\\":\\\"light rain\\\",\\\"icon\\\":\\\"10d\\\"}],\\\"clouds\\\":{\\\"all\\\":100},\\\"wind\\\":{\\\"speed\\\":9.65,\\\"deg\\\":245},\\\"rain\\\":{\\\"3h\\\":1.19},\\\"sys\\\":{\\\"pod\\\":\\\"d\\\"},\\\"dt_txt\\\":\\\"2020-02-16 09:00:00\\\"},{\\\"dt\\\":1581854400,\\\"main\\\":{\\\"temp\\\":9.54,\\\"feels_like\\\":0.13,\\\"temp_min\\\":9.54,\\\"temp_max\\\":9.54,\\\"pressure\\\":996,\\\"sea_level\\\":996,\\\"grnd_level\\\":991,\\\"humidity\\\":41,\\\"temp_kf\\\":0},\\\"weather\\\":[{\\\"id\\\":804,\\\"main\\\":\\\"Clouds\\\",\\\"description\\\":\\\"overcast clouds\\\",\\\"icon\\\":\\\"04d\\\"}],\\\"clouds\\\":{\\\"all\\\":94},\\\"wind\\\":{\\\"speed\\\":10.03,\\\"deg\\\":243},\\\"sys\\\":{\\\"pod\\\":\\\"d\\\"},\\\"dt_txt\\\":\\\"2020-02-16 12:00:00\\\"},{\\\"dt\\\":1581865200,\\\"main\\\":{\\\"temp\\\":9.08,\\\"feels_like\\\":-0.35,\\\"temp_min\\\":9.08,\\\"temp_max\\\":9.08,\\\"pressure\\\":996,\\\"sea_level\\\":996,\\\"grnd_level\\\":991,\\\"humidity\\\":44,\\\"temp_kf\\\":0},\\\"weather\\\":[{\\\"id\\\":500,\\\"main\\\":\\\"Rain\\\",\\\"description\\\":\\\"light rain\\\",\\\"icon\\\":\\\"10d\\\"}],\\\"clouds\\\":{\\\"all\\\":89},\\\"wind\\\":{\\\"speed\\\":10.15,\\\"deg\\\":246},\\\"rain\\\":{\\\"3h\\\":0.25},\\\"sys\\\":{\\\"pod\\\":\\\"d\\\"},\\\"dt_txt\\\":\\\"2020-02-16 15:00:00\\\"},{\\\"dt\\\":1581876000,\\\"main\\\":{\\\"temp\\\":7.41,\\\"feels_like\\\":-1.34,\\\"temp_min\\\":7.41,\\\"temp_max\\\":7.41,\\\"pressure\\\":996,\\\"sea_level\\\":996,\\\"grnd_level\\\":992,\\\"humidity\\\":50,\\\"temp_kf\\\":0},\\\"weather\\\":[{\\\"id\\\":804,\\\"main\\\":\\\"Clouds\\\",\\\"description\\\":\\\"overcast clouds\\\",\\\"icon\\\":\\\"04n\\\"}],\\\"clouds\\\":{\\\"all\\\":94},\\\"wind\\\":{\\\"speed\\\":9.21,\\\"deg\\\":240},\\\"sys\\\":{\\\"pod\\\":\\\"n\\\"},\\\"dt_txt\\\":\\\"2020-02-16 18:00:00\\\"},{\\\"dt\\\":1581886800,\\\"main\\\":{\\\"temp\\\":6.42,\\\"feels_like\\\":-1.7,\\\"temp_min\\\":6.42,\\\"temp_max\\\":6.42,\\\"pressure\\\":997,\\\"sea_level\\\":997,\\\"grnd_level\\\":993,\\\"humidity\\\":58,\\\"temp_kf\\\":0},\\\"weather\\\":[{\\\"id\\\":803,\\\"main\\\":\\\"Clouds\\\",\\\"description\\\":\\\"broken clouds\\\",\\\"icon\\\":\\\"04n\\\"}],\\\"clouds\\\":{\\\"all\\\":67},\\\"wind\\\":{\\\"speed\\\":8.52,\\\"deg\\\":236},\\\"sys\\\":{\\\"pod\\\":\\\"n\\\"},\\\"dt_txt\\\":\\\"2020-02-16 21:00:00\\\"},{\\\"dt\\\":1581897600,\\\"main\\\":{\\\"temp\\\":6.03,\\\"feels_like\\\":-2.65,\\\"temp_min\\\":6.03,\\\"temp_max\\\":6.03,\\\"pressure\\\":996,\\\"sea_level\\\":996,\\\"grnd_level\\\":993,\\\"humidity\\\":51,\\\"temp_kf\\\":0},\\\"weather\\\":[{\\\"id\\\":802,\\\"main\\\":\\\"Clouds\\\",\\\"description\\\":\\\"scattered clouds\\\",\\\"icon\\\":\\\"03n\\\"}],\\\"clouds\\\":{\\\"all\\\":38},\\\"wind\\\":{\\\"speed\\\":8.94,\\\"deg\\\":240},\\\"sys\\\":{\\\"pod\\\":\\\"n\\\"},\\\"dt_txt\\\":\\\"2020-02-17 00:00:00\\\"},{\\\"dt\\\":1581908400,\\\"main\\\":{\\\"temp\\\":5.62,\\\"feels_like\\\":-2.86,\\\"temp_min\\\":5.62,\\\"temp_max\\\":5.62,\\\"pressure\\\":995,\\\"sea_level\\\":995,\\\"grnd_level\\\":991,\\\"humidity\\\":53,\\\"temp_kf\\\":0},\\\"weather\\\":[{\\\"id\\\":800,\\\"main\\\":\\\"Clear\\\",\\\"description\\\":\\\"clear sky\\\",\\\"icon\\\":\\\"01n\\\"}],\\\"clouds\\\":{\\\"all\\\":0},\\\"wind\\\":{\\\"speed\\\":8.67,\\\"deg\\\":241},\\\"sys\\\":{\\\"pod\\\":\\\"n\\\"},\\\"dt_txt\\\":\\\"2020-02-17 03:00:00\\\"},{\\\"dt\\\":1581919200,\\\"main\\\":{\\\"temp\\\":5.51,\\\"feels_like\\\":-2.41,\\\"temp_min\\\":5.51,\\\"temp_max\\\":5.51,\\\"pressure\\\":995,\\\"sea_level\\\":995,\\\"grnd_level\\\":991,\\\"humidity\\\":61,\\\"temp_kf\\\":0},\\\"weather\\\":[{\\\"id\\\":802,\\\"main\\\":\\\"Clouds\\\",\\\"description\\\":\\\"scattered clouds\\\",\\\"icon\\\":\\\"03n\\\"}],\\\"clouds\\\":{\\\"all\\\":35},\\\"wind\\\":{\\\"speed\\\":8.2,\\\"deg\\\":244},\\\"sys\\\":{\\\"pod\\\":\\\"n\\\"},\\\"dt_txt\\\":\\\"2020-02-17 06:00:00\\\"}],\\\"city\\\":{\\\"id\\\":2643743,\\\"name\\\":\\\"London\\\",\\\"coord\\\":{\\\"lat\\\":51.5085,\\\"lon\\\":-0.1257},\\\"country\\\":\\\"GB\\\",\\\"population\\\":1000000,\\\"timezone\\\":0,\\\"sunrise\\\":1581492085,\\\"sunset\\\":1581527294}}\";\n\n  const char* expected_json = \"{\\\"list\\\":[\"\n      \"{\\\"dt\\\":1581498000,\\\"main\\\":{\\\"temp\\\":3.23},\\\"weather\\\":[{\\\"description\\\":\\\"clear sky\\\"}]},\"\n      \"{\\\"dt\\\":1581508800,\\\"main\\\":{\\\"temp\\\":6.09},\\\"weather\\\":[{\\\"description\\\":\\\"clear sky\\\"}]},\"\n      \"{\\\"dt\\\":1581519600,\\\"main\\\":{\\\"temp\\\":6.82},\\\"weather\\\":[{\\\"description\\\":\\\"overcast clouds\\\"}]},\"\n      \"{\\\"dt\\\":1581530400,\\\"main\\\":{\\\"temp\\\":5.76},\\\"weather\\\":[{\\\"description\\\":\\\"overcast clouds\\\"}]},\"\n      \"{\\\"dt\\\":1581541200,\\\"main\\\":{\\\"temp\\\":5.7},\\\"weather\\\":[{\\\"description\\\":\\\"overcast clouds\\\"}]},\"\n      \"{\\\"dt\\\":1581552000,\\\"main\\\":{\\\"temp\\\":5.82},\\\"weather\\\":[{\\\"description\\\":\\\"light rain\\\"}]},\"\n      \"{\\\"dt\\\":1581562800,\\\"main\\\":{\\\"temp\\\":5.9},\\\"weather\\\":[{\\\"description\\\":\\\"light rain\\\"}]},\"\n      \"{\\\"dt\\\":1581573600,\\\"main\\\":{\\\"temp\\\":7.52},\\\"weather\\\":[{\\\"description\\\":\\\"moderate rain\\\"}]},\"\n      \"{\\\"dt\\\":1581584400,\\\"main\\\":{\\\"temp\\\":7.23},\\\"weather\\\":[{\\\"description\\\":\\\"light rain\\\"}]},\"\n      \"{\\\"dt\\\":1581595200,\\\"main\\\":{\\\"temp\\\":7.67},\\\"weather\\\":[{\\\"description\\\":\\\"light rain\\\"}]},\"\n      \"{\\\"dt\\\":1581606000,\\\"main\\\":{\\\"temp\\\":8.83},\\\"weather\\\":[{\\\"description\\\":\\\"light rain\\\"}]},\"\n      \"{\\\"dt\\\":1581616800,\\\"main\\\":{\\\"temp\\\":7.42},\\\"weather\\\":[{\\\"description\\\":\\\"broken clouds\\\"}]},\"\n      \"{\\\"dt\\\":1581627600,\\\"main\\\":{\\\"temp\\\":5.82},\\\"weather\\\":[{\\\"description\\\":\\\"clear sky\\\"}]},\"\n      \"{\\\"dt\\\":1581638400,\\\"main\\\":{\\\"temp\\\":5.58},\\\"weather\\\":[{\\\"description\\\":\\\"scattered clouds\\\"}]},\"\n      \"{\\\"dt\\\":1581649200,\\\"main\\\":{\\\"temp\\\":4.27},\\\"weather\\\":[{\\\"description\\\":\\\"broken clouds\\\"}]},\"\n      \"{\\\"dt\\\":1581660000,\\\"main\\\":{\\\"temp\\\":3.91},\\\"weather\\\":[{\\\"description\\\":\\\"overcast clouds\\\"}]},\"\n      \"{\\\"dt\\\":1581670800,\\\"main\\\":{\\\"temp\\\":4.77},\\\"weather\\\":[{\\\"description\\\":\\\"overcast clouds\\\"}]},\"\n      \"{\\\"dt\\\":1581681600,\\\"main\\\":{\\\"temp\\\":9.03},\\\"weather\\\":[{\\\"description\\\":\\\"overcast clouds\\\"}]},\"\n      \"{\\\"dt\\\":1581692400,\\\"main\\\":{\\\"temp\\\":9.86},\\\"weather\\\":[{\\\"description\\\":\\\"overcast clouds\\\"}]},\"\n      \"{\\\"dt\\\":1581703200,\\\"main\\\":{\\\"temp\\\":9.48},\\\"weather\\\":[{\\\"description\\\":\\\"overcast clouds\\\"}]},\"\n      \"{\\\"dt\\\":1581714000,\\\"main\\\":{\\\"temp\\\":10.03},\\\"weather\\\":[{\\\"description\\\":\\\"moderate rain\\\"}]},\"\n      \"{\\\"dt\\\":1581724800,\\\"main\\\":{\\\"temp\\\":9.48},\\\"weather\\\":[{\\\"description\\\":\\\"light rain\\\"}]},\"\n      \"{\\\"dt\\\":1581735600,\\\"main\\\":{\\\"temp\\\":9.12},\\\"weather\\\":[{\\\"description\\\":\\\"light rain\\\"}]},\"\n      \"{\\\"dt\\\":1581746400,\\\"main\\\":{\\\"temp\\\":10.32},\\\"weather\\\":[{\\\"description\\\":\\\"light rain\\\"}]},\"\n      \"{\\\"dt\\\":1581757200,\\\"main\\\":{\\\"temp\\\":11.57},\\\"weather\\\":[{\\\"description\\\":\\\"light rain\\\"}]},\"\n      \"{\\\"dt\\\":1581768000,\\\"main\\\":{\\\"temp\\\":12.25},\\\"weather\\\":[{\\\"description\\\":\\\"light rain\\\"}]},\"\n      \"{\\\"dt\\\":1581778800,\\\"main\\\":{\\\"temp\\\":12.19},\\\"weather\\\":[{\\\"description\\\":\\\"moderate rain\\\"}]},\"\n      \"{\\\"dt\\\":1581789600,\\\"main\\\":{\\\"temp\\\":12.25},\\\"weather\\\":[{\\\"description\\\":\\\"moderate rain\\\"}]},\"\n      \"{\\\"dt\\\":1581800400,\\\"main\\\":{\\\"temp\\\":12.64},\\\"weather\\\":[{\\\"description\\\":\\\"moderate rain\\\"}]},\"\n      \"{\\\"dt\\\":1581811200,\\\"main\\\":{\\\"temp\\\":12.96},\\\"weather\\\":[{\\\"description\\\":\\\"moderate rain\\\"}]},\"\n      \"{\\\"dt\\\":1581822000,\\\"main\\\":{\\\"temp\\\":13.13},\\\"weather\\\":[{\\\"description\\\":\\\"moderate rain\\\"}]},\"\n      \"{\\\"dt\\\":1581832800,\\\"main\\\":{\\\"temp\\\":9.07},\\\"weather\\\":[{\\\"description\\\":\\\"light rain\\\"}]},\"\n      \"{\\\"dt\\\":1581843600,\\\"main\\\":{\\\"temp\\\":8.05},\\\"weather\\\":[{\\\"description\\\":\\\"light rain\\\"}]},\"\n      \"{\\\"dt\\\":1581854400,\\\"main\\\":{\\\"temp\\\":9.54},\\\"weather\\\":[{\\\"description\\\":\\\"overcast clouds\\\"}]},\"\n      \"{\\\"dt\\\":1581865200,\\\"main\\\":{\\\"temp\\\":9.08},\\\"weather\\\":[{\\\"description\\\":\\\"light rain\\\"}]},\"\n      \"{\\\"dt\\\":1581876000,\\\"main\\\":{\\\"temp\\\":7.41},\\\"weather\\\":[{\\\"description\\\":\\\"overcast clouds\\\"}]},\"\n      \"{\\\"dt\\\":1581886800,\\\"main\\\":{\\\"temp\\\":6.42},\\\"weather\\\":[{\\\"description\\\":\\\"broken clouds\\\"}]},\"\n      \"{\\\"dt\\\":1581897600,\\\"main\\\":{\\\"temp\\\":6.03},\\\"weather\\\":[{\\\"description\\\":\\\"scattered clouds\\\"}]},\"\n      \"{\\\"dt\\\":1581908400,\\\"main\\\":{\\\"temp\\\":5.62},\\\"weather\\\":[{\\\"description\\\":\\\"clear sky\\\"}]},\"\n      \"{\\\"dt\\\":1581919200,\\\"main\\\":{\\\"temp\\\":5.51},\\\"weather\\\":[{\\\"description\\\":\\\"scattered clouds\\\"}]}\"\n      \"]}\";\n  // clang-format on\n\n  JsonDocument filter;\n  filter[\"list\"][0][\"dt\"] = true;\n  filter[\"list\"][0][\"main\"][\"temp\"] = true;\n  filter[\"list\"][0][\"weather\"][0][\"description\"] = true;\n\n  JsonDocument doc;\n\n  REQUIRE(\n      deserializeJson(doc, input_json, DeserializationOption::Filter(filter)) ==\n      DeserializationError::Ok);\n\n  REQUIRE(doc.as<std::string>() == expected_json);\n}\n"
  },
  {
    "path": "extras/tests/IntegrationTests/round_trip.cpp",
    "content": "// ArduinoJson - https://arduinojson.org\n// Copyright © 2014-2025, Benoit BLANCHON\n// MIT License\n\n#include <ArduinoJson.h>\n#include <catch.hpp>\n\nvoid check(std::string originalJson) {\n  JsonDocument doc;\n\n  std::string prettyJson;\n  deserializeJson(doc, originalJson);\n  serializeJsonPretty(doc, prettyJson);\n\n  std::string finalJson;\n  deserializeJson(doc, originalJson);\n  serializeJson(doc, finalJson);\n\n  REQUIRE(originalJson == finalJson);\n}\n\nTEST_CASE(\"Round Trip: parse -> prettyPrint -> parse -> print\") {\n  SECTION(\"OpenWeatherMap\") {\n    check(\n        \"{\\\"coord\\\":{\\\"lon\\\":145.77,\\\"lat\\\":-16.92},\\\"sys\\\":{\\\"type\\\":1,\\\"id\\\":\"\n        \"8166,\\\"message\\\":0.1222,\\\"country\\\":\\\"AU\\\",\\\"sunrise\\\":1414784325,\"\n        \"\\\"sunset\\\":1414830137},\\\"weather\\\":[{\\\"id\\\":801,\\\"main\\\":\\\"Clouds\\\",\"\n        \"\\\"description\\\":\\\"few clouds\\\",\\\"icon\\\":\\\"02n\\\"}],\\\"base\\\":\\\"cmc \"\n        \"stations\\\",\\\"main\\\":{\\\"temp\\\":296.15,\\\"pressure\\\":1014,\\\"humidity\\\":\"\n        \"83,\\\"temp_min\\\":296.15,\\\"temp_max\\\":296.15},\\\"wind\\\":{\\\"speed\\\":2.22,\"\n        \"\\\"deg\\\":114.501},\\\"clouds\\\":{\\\"all\\\":20},\\\"dt\\\":1414846800,\\\"id\\\":\"\n        \"2172797,\\\"name\\\":\\\"Cairns\\\",\\\"cod\\\":200}\");\n  }\n\n  SECTION(\"YahooQueryLanguage\") {\n    check(\n        \"{\\\"query\\\":{\\\"count\\\":40,\\\"created\\\":\\\"2014-11-01T14:16:49Z\\\",\"\n        \"\\\"lang\\\":\\\"fr-FR\\\",\\\"results\\\":{\\\"item\\\":[{\\\"title\\\":\\\"Burkina army \"\n        \"backs Zida as interim leader\\\"},{\\\"title\\\":\\\"British jets intercept \"\n        \"Russian bombers\\\"},{\\\"title\\\":\\\"Doubts chip away at nation's most \"\n        \"trusted agencies\\\"},{\\\"title\\\":\\\"Cruise ship stuck off Norway, no \"\n        \"damage\\\"},{\\\"title\\\":\\\"U.S. military launches 10 air strikes in \"\n        \"Syria, Iraq\\\"},{\\\"title\\\":\\\"Blackout hits Bangladesh as line from \"\n        \"India fails\\\"},{\\\"title\\\":\\\"Burkina Faso president in Ivory Coast \"\n        \"after ouster\\\"},{\\\"title\\\":\\\"Kurds in Turkey rally to back city \"\n        \"besieged by IS\\\"},{\\\"title\\\":\\\"A majority of Scots would vote for \"\n        \"independence now:poll\\\"},{\\\"title\\\":\\\"Tunisia elections possible \"\n        \"model for region\\\"},{\\\"title\\\":\\\"Islamic State kills 85 more members \"\n        \"of Iraqi tribe\\\"},{\\\"title\\\":\\\"Iraqi officials:IS extremists line \"\n        \"up, kill 50\\\"},{\\\"title\\\":\\\"Burkina Faso army backs presidential \"\n        \"guard official to lead transition\\\"},{\\\"title\\\":\\\"Kurdish peshmerga \"\n        \"arrive with weapons in Syria's Kobani\\\"},{\\\"title\\\":\\\"Driver sought \"\n        \"in crash that killed 3 on Halloween\\\"},{\\\"title\\\":\\\"Ex-Marine arrives \"\n        \"in US after release from Mexico jail\\\"},{\\\"title\\\":\\\"UN panel \"\n        \"scrambling to finish climate report\\\"},{\\\"title\\\":\\\"Investigators, \"\n        \"Branson go to spacecraft crash site\\\"},{\\\"title\\\":\\\"Soldiers vie for \"\n        \"power after Burkina Faso president quits\\\"},{\\\"title\\\":\\\"For a man \"\n        \"without a party, turnout is big test\\\"},{\\\"title\\\":\\\"'We just had a \"\n        \"hunch':US marshals nab Eric Frein\\\"},{\\\"title\\\":\\\"Boko Haram leader \"\n        \"threatens to kill German hostage\\\"},{\\\"title\\\":\\\"Nurse free to move \"\n        \"about as restrictions eased\\\"},{\\\"title\\\":\\\"Former Burkina president \"\n        \"Compaore arrives in Ivory Coast:sources\\\"},{\\\"title\\\":\\\"Libyan port \"\n        \"rebel leader refuses to hand over oil ports to rival \"\n        \"group\\\"},{\\\"title\\\":\\\"Iraqi peshmerga fighters prepare for Syria \"\n        \"battle\\\"},{\\\"title\\\":\\\"1 Dem Senate candidate welcoming Obama's \"\n        \"help\\\"},{\\\"title\\\":\\\"Bikers cancel party after police recover \"\n        \"bar\\\"},{\\\"title\\\":\\\"New question in Texas:Can Davis survive \"\n        \"defeat?\\\"},{\\\"title\\\":\\\"Ukraine rebels to hold election, despite \"\n        \"criticism\\\"},{\\\"title\\\":\\\"Iraqi officials say Islamic State group \"\n        \"lines up, kills 50 tribesmen, women in Anbar \"\n        \"province\\\"},{\\\"title\\\":\\\"James rebounds, leads Cavaliers past \"\n        \"Bulls\\\"},{\\\"title\\\":\\\"UK warns travelers they could be terror \"\n        \"targets\\\"},{\\\"title\\\":\\\"Hello Kitty celebrates 40th \"\n        \"birthday\\\"},{\\\"title\\\":\\\"A look at people killed during space \"\n        \"missions\\\"},{\\\"title\\\":\\\"Nigeria's purported Boko Haram leader says \"\n        \"has 'married off' girls:AFP\\\"},{\\\"title\\\":\\\"Mexico orders immediate \"\n        \"release of Marine veteran\\\"},{\\\"title\\\":\\\"As election closes in, \"\n        \"Obama on center stage\\\"},{\\\"title\\\":\\\"Body of Zambian president \"\n        \"arrives home\\\"},{\\\"title\\\":\\\"South Africa arrests 2 Vietnamese for \"\n        \"poaching\\\"}]}}}\");\n  }\n}\n"
  },
  {
    "path": "extras/tests/JsonArray/CMakeLists.txt",
    "content": "# ArduinoJson - https://arduinojson.org\n# Copyright © 2014-2025, Benoit BLANCHON\n# MIT License\n\nadd_executable(JsonArrayTests\n\tadd.cpp\n\tclear.cpp\n\tcompare.cpp\n\tcopyArray.cpp\n\tequals.cpp\n\tisNull.cpp\n\titerator.cpp\n\tnesting.cpp\n\tremove.cpp\n\tsize.cpp\n\tsubscript.cpp\n\tunbound.cpp\n)\n\nadd_test(JsonArray JsonArrayTests)\n\nset_tests_properties(JsonArray\n\tPROPERTIES\n\t\tLABELS \"Catch\"\n)\n"
  },
  {
    "path": "extras/tests/JsonArray/add.cpp",
    "content": "// ArduinoJson - https://arduinojson.org\n// Copyright © 2014-2025, Benoit BLANCHON\n// MIT License\n\n#include <ArduinoJson.h>\n#include <catch.hpp>\n\n#include \"Allocators.hpp\"\n#include \"Literals.hpp\"\n\nusing namespace ArduinoJson::detail;\n\nTEST_CASE(\"JsonArray::add(T)\") {\n  SpyingAllocator spy;\n  JsonDocument doc(&spy);\n  JsonArray array = doc.to<JsonArray>();\n\n  SECTION(\"int\") {\n    array.add(123);\n\n    REQUIRE(123 == array[0].as<int>());\n    REQUIRE(array[0].is<int>());\n    REQUIRE(array[0].is<double>());\n    REQUIRE(spy.log() == AllocatorLog{\n                             Allocate(sizeofPool()),\n                         });\n  }\n\n  SECTION(\"double\") {\n    array.add(123.45);\n\n    REQUIRE(123.45 == array[0].as<double>());\n    REQUIRE(array[0].is<double>());\n    REQUIRE_FALSE(array[0].is<bool>());\n    REQUIRE(spy.log() == AllocatorLog{\n                             Allocate(sizeofPool<VariantData>()),\n                             Allocate(sizeofPool<EightByteValue>()),\n                         });\n  }\n\n  SECTION(\"bool\") {\n    array.add(true);\n\n    REQUIRE(array[0].as<bool>() == true);\n    REQUIRE(array[0].is<bool>());\n    REQUIRE_FALSE(array[0].is<int>());\n    REQUIRE(spy.log() == AllocatorLog{\n                             Allocate(sizeofPool()),\n                         });\n  }\n\n  SECTION(\"string literal\") {\n    array.add(\"hello\");\n\n    REQUIRE(array[0].as<std::string>() == \"hello\");\n    REQUIRE(array[0].is<const char*>());\n    REQUIRE(array[0].is<int>() == false);\n    REQUIRE(spy.log() == AllocatorLog{\n                             Allocate(sizeofPool()),\n                             Allocate(sizeofString(\"hello\")),\n                         });\n  }\n\n  SECTION(\"std::string\") {\n    array.add(\"hello\"_s);\n\n    REQUIRE(array[0].as<std::string>() == \"hello\");\n    REQUIRE(array[0].is<const char*>() == true);\n    REQUIRE(array[0].is<int>() == false);\n    REQUIRE(spy.log() == AllocatorLog{\n                             Allocate(sizeofPool()),\n                             Allocate(sizeofString(\"hello\")),\n                         });\n  }\n\n  SECTION(\"const char*\") {\n    const char* str = \"hello\";\n    array.add(str);\n\n    REQUIRE(array[0].as<std::string>() == \"hello\");\n    REQUIRE(array[0].as<const char*>() != str);\n    REQUIRE(array[0].is<const char*>() == true);\n    REQUIRE(array[0].is<int>() == false);\n    REQUIRE(spy.log() == AllocatorLog{\n                             Allocate(sizeofPool()),\n                             Allocate(sizeofString(\"hello\")),\n                         });\n  }\n\n  SECTION(\"serialized(const char*)\") {\n    array.add(serialized(\"{}\"));\n\n    REQUIRE(doc.as<std::string>() == \"[{}]\");\n    REQUIRE(spy.log() == AllocatorLog{\n                             Allocate(sizeofPool()),\n                             Allocate(sizeofString(\"{}\")),\n                         });\n  }\n\n  SECTION(\"serialized(char*)\") {\n    array.add(serialized(const_cast<char*>(\"{}\")));\n\n    REQUIRE(doc.as<std::string>() == \"[{}]\");\n    REQUIRE(spy.log() == AllocatorLog{\n                             Allocate(sizeofPool()),\n                             Allocate(sizeofString(\"{}\")),\n                         });\n  }\n\n  SECTION(\"serialized(std::string)\") {\n    array.add(serialized(\"{}\"_s));\n\n    REQUIRE(doc.as<std::string>() == \"[{}]\");\n    REQUIRE(spy.log() == AllocatorLog{\n                             Allocate(sizeofPool()),\n                             Allocate(sizeofString(\"{}\")),\n                         });\n  }\n\n  SECTION(\"serialized(std::string)\") {\n    array.add(serialized(\"\\0XX\"_s));\n\n    REQUIRE(doc.as<std::string>() == \"[\\0XX]\"_s);\n    REQUIRE(spy.log() == AllocatorLog{\n                             Allocate(sizeofPool()),\n                             Allocate(sizeofString(\" XX\")),\n                         });\n  }\n\n#ifdef HAS_VARIABLE_LENGTH_ARRAY\n  SECTION(\"vla\") {\n    size_t i = 16;\n    char vla[i];\n    strcpy(vla, \"world\");\n\n    array.add(vla);\n\n    strcpy(vla, \"hello\");\n    REQUIRE(array[0] == \"world\"_s);\n    REQUIRE(spy.log() == AllocatorLog{\n                             Allocate(sizeofPool()),\n                             Allocate(sizeofString(\"hello\")),\n                         });\n  }\n#endif\n\n  SECTION(\"nested array\") {\n    JsonDocument doc2;\n    JsonArray arr = doc2.to<JsonArray>();\n\n    array.add(arr);\n\n    REQUIRE(arr == array[0].as<JsonArray>());\n    REQUIRE(array[0].is<JsonArray>());\n    REQUIRE_FALSE(array[0].is<int>());\n  }\n\n  SECTION(\"nested object\") {\n    JsonDocument doc2;\n    JsonObject obj = doc2.to<JsonObject>();\n\n    array.add(obj);\n\n    REQUIRE(obj == array[0].as<JsonObject>());\n    REQUIRE(array[0].is<JsonObject>());\n    REQUIRE_FALSE(array[0].is<int>());\n  }\n\n  SECTION(\"array subscript\") {\n    const char* str = \"hello\";\n    JsonDocument doc2;\n    JsonArray arr = doc2.to<JsonArray>();\n    arr.add(str);\n\n    array.add(arr[0]);\n\n    REQUIRE(str == array[0]);\n  }\n\n  SECTION(\"object subscript\") {\n    const char* str = \"hello\";\n    JsonDocument doc2;\n    JsonObject obj = doc2.to<JsonObject>();\n    obj[\"x\"] = str;\n\n    array.add(obj[\"x\"]);\n\n    REQUIRE(str == array[0]);\n  }\n}\n\nTEST_CASE(\"JsonArray::add<T>()\") {\n  JsonDocument doc;\n  JsonArray array = doc.to<JsonArray>();\n\n  SECTION(\"add<JsonArray>()\") {\n    JsonArray nestedArray = array.add<JsonArray>();\n    nestedArray.add(1);\n    nestedArray.add(2);\n    REQUIRE(doc.as<std::string>() == \"[[1,2]]\");\n  }\n\n  SECTION(\"add<JsonObject>()\") {\n    JsonObject nestedObject = array.add<JsonObject>();\n    nestedObject[\"a\"] = 1;\n    nestedObject[\"b\"] = 2;\n    REQUIRE(doc.as<std::string>() == \"[{\\\"a\\\":1,\\\"b\\\":2}]\");\n  }\n\n  SECTION(\"add<JsonVariant>()\") {\n    JsonVariant nestedVariant = array.add<JsonVariant>();\n    nestedVariant.set(42);\n    REQUIRE(doc.as<std::string>() == \"[42]\");\n  }\n}\n\nTEST_CASE(\"JsonObject::add(JsonObject) \") {\n  JsonDocument doc1;\n  doc1[\"key1\"_s] = \"value1\"_s;\n\n  TimebombAllocator allocator(10);\n  SpyingAllocator spy(&allocator);\n  JsonDocument doc2(&spy);\n  JsonArray array = doc2.to<JsonArray>();\n\n  SECTION(\"success\") {\n    bool result = array.add(doc1.as<JsonObject>());\n\n    REQUIRE(result == true);\n    REQUIRE(doc2.as<std::string>() == \"[{\\\"key1\\\":\\\"value1\\\"}]\");\n    REQUIRE(spy.log() == AllocatorLog{\n                             Allocate(sizeofPool()),\n                             Allocate(sizeofString(\"key1\")),\n                             Allocate(sizeofString(\"value1\")),\n                         });\n  }\n\n  SECTION(\"partial failure\") {  // issue #2081\n    allocator.setCountdown(2);\n\n    bool result = array.add(doc1.as<JsonObject>());\n\n    REQUIRE(result == false);\n    REQUIRE(doc2.as<std::string>() == \"[]\");\n    REQUIRE(spy.log() == AllocatorLog{\n                             Allocate(sizeofPool()),\n                             Allocate(sizeofString(\"key1\")),\n                             AllocateFail(sizeofString(\"value1\")),\n                             Deallocate(sizeofString(\"key1\")),\n                         });\n  }\n\n  SECTION(\"complete failure\") {\n    allocator.setCountdown(0);\n\n    bool result = array.add(doc1.as<JsonObject>());\n\n    REQUIRE(result == false);\n    REQUIRE(doc2.as<std::string>() == \"[]\");\n    REQUIRE(spy.log() == AllocatorLog{\n                             AllocateFail(sizeofPool()),\n                         });\n  }\n}\n"
  },
  {
    "path": "extras/tests/JsonArray/clear.cpp",
    "content": "// ArduinoJson - https://arduinojson.org\n// Copyright © 2014-2025, Benoit BLANCHON\n// MIT License\n\n#include <ArduinoJson.h>\n#include <catch.hpp>\n\n#include \"Allocators.hpp\"\n\nTEST_CASE(\"JsonArray::clear()\") {\n  SECTION(\"No-op on null JsonArray\") {\n    JsonArray array;\n    array.clear();\n    REQUIRE(array.isNull() == true);\n    REQUIRE(array.size() == 0);\n  }\n\n  SECTION(\"Removes all elements\") {\n    JsonDocument doc;\n    JsonArray array = doc.to<JsonArray>();\n    array.add(1);\n    array.add(2);\n    array.clear();\n    REQUIRE(array.size() == 0);\n    REQUIRE(array.isNull() == false);\n  }\n\n  SECTION(\"Removed elements are recycled\") {\n    SpyingAllocator spy;\n    JsonDocument doc(&spy);\n    JsonArray array = doc.to<JsonArray>();\n\n    // fill the pool entirely\n    for (int i = 0; i < ARDUINOJSON_POOL_CAPACITY; i++)\n      array.add(i);\n\n    // clear and fill again\n    array.clear();\n    for (int i = 0; i < ARDUINOJSON_POOL_CAPACITY; i++)\n      array.add(i);\n\n    REQUIRE(spy.log() == AllocatorLog{\n                             Allocate(sizeofPool()),\n                         });\n  }\n}\n"
  },
  {
    "path": "extras/tests/JsonArray/compare.cpp",
    "content": "// ArduinoJson - https://arduinojson.org\n// Copyright © 2014-2025, Benoit BLANCHON\n// MIT License\n\n#include <ArduinoJson.h>\n#include <catch.hpp>\n\nTEST_CASE(\"Compare JsonArray with JsonArray\") {\n  JsonDocument doc;\n\n  SECTION(\"Compare with unbound\") {\n    JsonArray array = doc.to<JsonArray>();\n    array.add(1);\n    array.add(\"hello\");\n    JsonArray unbound;\n\n    CHECK(array != unbound);\n    CHECK_FALSE(array == unbound);\n    CHECK_FALSE(array <= unbound);\n    CHECK_FALSE(array >= unbound);\n    CHECK_FALSE(array > unbound);\n    CHECK_FALSE(array < unbound);\n\n    CHECK(unbound != array);\n    CHECK_FALSE(unbound == array);\n    CHECK_FALSE(unbound <= array);\n    CHECK_FALSE(unbound >= array);\n    CHECK_FALSE(unbound > array);\n    CHECK_FALSE(unbound < array);\n  }\n\n  SECTION(\"Compare with self\") {\n    JsonArray array = doc.to<JsonArray>();\n    array.add(1);\n    array.add(\"hello\");\n\n    CHECK(array == array);\n    CHECK(array <= array);\n    CHECK(array >= array);\n    CHECK_FALSE(array != array);\n    CHECK_FALSE(array > array);\n    CHECK_FALSE(array < array);\n  }\n\n  SECTION(\"Compare with identical array\") {\n    JsonArray array1 = doc.add<JsonArray>();\n    array1.add(1);\n    array1.add(\"hello\");\n    array1.add<JsonObject>();\n\n    JsonArray array2 = doc.add<JsonArray>();\n    array2.add(1);\n    array2.add(\"hello\");\n    array2.add<JsonObject>();\n\n    CHECK(array1 == array2);\n    CHECK(array1 <= array2);\n    CHECK(array1 >= array2);\n    CHECK_FALSE(array1 != array2);\n    CHECK_FALSE(array1 > array2);\n    CHECK_FALSE(array1 < array2);\n  }\n\n  SECTION(\"Compare with different array\") {\n    JsonArray array1 = doc.add<JsonArray>();\n    array1.add(1);\n    array1.add(\"hello1\");\n    array1.add<JsonObject>();\n\n    JsonArray array2 = doc.add<JsonArray>();\n    array2.add(1);\n    array2.add(\"hello2\");\n    array2.add<JsonObject>();\n\n    CHECK(array1 != array2);\n    CHECK_FALSE(array1 == array2);\n    CHECK_FALSE(array1 > array2);\n    CHECK_FALSE(array1 < array2);\n    CHECK_FALSE(array1 <= array2);\n    CHECK_FALSE(array1 >= array2);\n  }\n}\n\nTEST_CASE(\"Compare JsonArray with JsonVariant\") {\n  JsonDocument doc;\n\n  SECTION(\"Compare with self\") {\n    JsonArray array = doc.to<JsonArray>();\n    array.add(1);\n    array.add(\"hello\");\n\n    JsonVariant variant = array;\n\n    CHECK(array == variant);\n    CHECK(array <= variant);\n    CHECK(array >= variant);\n    CHECK_FALSE(array != variant);\n    CHECK_FALSE(array > variant);\n    CHECK_FALSE(array < variant);\n\n    CHECK(variant == array);\n    CHECK(variant <= array);\n    CHECK(variant >= array);\n    CHECK_FALSE(variant != array);\n    CHECK_FALSE(variant > array);\n    CHECK_FALSE(variant < array);\n  }\n\n  SECTION(\"Compare with identical array\") {\n    JsonArray array = doc.add<JsonArray>();\n    array.add(1);\n    array.add(\"hello\");\n    array.add<JsonObject>();\n\n    JsonVariant variant = doc.add<JsonArray>();\n    variant.add(1);\n    variant.add(\"hello\");\n    variant.add<JsonObject>();\n\n    CHECK(array == variant);\n    CHECK(array <= variant);\n    CHECK(array >= variant);\n    CHECK_FALSE(array != variant);\n    CHECK_FALSE(array > variant);\n    CHECK_FALSE(array < variant);\n\n    CHECK(variant == array);\n    CHECK(variant <= array);\n    CHECK(variant >= array);\n    CHECK_FALSE(variant != array);\n    CHECK_FALSE(variant > array);\n    CHECK_FALSE(variant < array);\n  }\n\n  SECTION(\"Compare with different array\") {\n    JsonArray array = doc.add<JsonArray>();\n    array.add(1);\n    array.add(\"hello1\");\n    array.add<JsonObject>();\n\n    JsonVariant variant = doc.add<JsonArray>();\n    variant.add(1);\n    variant.add(\"hello2\");\n    variant.add<JsonObject>();\n\n    CHECK(array != variant);\n    CHECK_FALSE(array == variant);\n    CHECK_FALSE(array > variant);\n    CHECK_FALSE(array < variant);\n    CHECK_FALSE(array <= variant);\n    CHECK_FALSE(array >= variant);\n  }\n}\n\nTEST_CASE(\"Compare JsonArray with JsonVariantConst\") {\n  JsonDocument doc;\n\n  SECTION(\"Compare with unbound\") {\n    JsonArray array = doc.to<JsonArray>();\n    array.add(1);\n    array.add(\"hello\");\n    JsonVariantConst unbound;\n\n    CHECK(array != unbound);\n    CHECK_FALSE(array == unbound);\n    CHECK_FALSE(array <= unbound);\n    CHECK_FALSE(array >= unbound);\n    CHECK_FALSE(array > unbound);\n    CHECK_FALSE(array < unbound);\n\n    CHECK(unbound != array);\n    CHECK_FALSE(unbound == array);\n    CHECK_FALSE(unbound <= array);\n    CHECK_FALSE(unbound >= array);\n    CHECK_FALSE(unbound > array);\n    CHECK_FALSE(unbound < array);\n  }\n\n  SECTION(\"Compare with self\") {\n    JsonArray array = doc.to<JsonArray>();\n    array.add(1);\n    array.add(\"hello\");\n\n    JsonVariantConst variant = array;\n\n    CHECK(array == variant);\n    CHECK(array <= variant);\n    CHECK(array >= variant);\n    CHECK_FALSE(array != variant);\n    CHECK_FALSE(array > variant);\n    CHECK_FALSE(array < variant);\n\n    CHECK(variant == array);\n    CHECK(variant <= array);\n    CHECK(variant >= array);\n    CHECK_FALSE(variant != array);\n    CHECK_FALSE(variant > array);\n    CHECK_FALSE(variant < array);\n  }\n\n  SECTION(\"Compare with identical array\") {\n    JsonArray array = doc.add<JsonArray>();\n    array.add(1);\n    array.add(\"hello\");\n    array.add<JsonObject>();\n\n    JsonArray array2 = doc.add<JsonArray>();\n    array2.add(1);\n    array2.add(\"hello\");\n    array2.add<JsonObject>();\n    JsonVariantConst variant = array2;\n\n    CHECK(array == variant);\n    CHECK(array <= variant);\n    CHECK(array >= variant);\n    CHECK_FALSE(array != variant);\n    CHECK_FALSE(array > variant);\n    CHECK_FALSE(array < variant);\n\n    CHECK(variant == array);\n    CHECK(variant <= array);\n    CHECK(variant >= array);\n    CHECK_FALSE(variant != array);\n    CHECK_FALSE(variant > array);\n    CHECK_FALSE(variant < array);\n  }\n\n  SECTION(\"Compare with different array\") {\n    JsonArray array = doc.add<JsonArray>();\n    array.add(1);\n    array.add(\"hello1\");\n    array.add<JsonObject>();\n\n    JsonArray array2 = doc.add<JsonArray>();\n    array2.add(1);\n    array2.add(\"hello2\");\n    array2.add<JsonObject>();\n    JsonVariantConst variant = array2;\n\n    CHECK(array != variant);\n    CHECK_FALSE(array == variant);\n    CHECK_FALSE(array > variant);\n    CHECK_FALSE(array < variant);\n    CHECK_FALSE(array <= variant);\n    CHECK_FALSE(array >= variant);\n  }\n}\n\nTEST_CASE(\"Compare JsonArray with JsonArrayConst\") {\n  JsonDocument doc;\n\n  SECTION(\"Compare with unbound\") {\n    JsonArray array = doc.to<JsonArray>();\n    array.add(1);\n    array.add(\"hello\");\n    JsonArrayConst unbound;\n\n    CHECK(array != unbound);\n    CHECK_FALSE(array == unbound);\n    CHECK_FALSE(array <= unbound);\n    CHECK_FALSE(array >= unbound);\n    CHECK_FALSE(array > unbound);\n    CHECK_FALSE(array < unbound);\n\n    CHECK(unbound != array);\n    CHECK_FALSE(unbound == array);\n    CHECK_FALSE(unbound <= array);\n    CHECK_FALSE(unbound >= array);\n    CHECK_FALSE(unbound > array);\n    CHECK_FALSE(unbound < array);\n  }\n\n  SECTION(\"Compare with self\") {\n    JsonArray array = doc.to<JsonArray>();\n    array.add(1);\n    array.add(\"hello\");\n    JsonArrayConst carray = array;\n\n    CHECK(array == carray);\n    CHECK(array <= carray);\n    CHECK(array >= carray);\n    CHECK_FALSE(array != carray);\n    CHECK_FALSE(array > carray);\n    CHECK_FALSE(array < carray);\n\n    CHECK(carray == array);\n    CHECK(carray <= array);\n    CHECK(carray >= array);\n    CHECK_FALSE(carray != array);\n    CHECK_FALSE(carray > array);\n    CHECK_FALSE(carray < array);\n  }\n\n  SECTION(\"Compare with identical array\") {\n    JsonArray array1 = doc.add<JsonArray>();\n    array1.add(1);\n    array1.add(\"hello\");\n    array1.add<JsonObject>();\n\n    JsonArray array2 = doc.add<JsonArray>();\n    array2.add(1);\n    array2.add(\"hello\");\n    array2.add<JsonObject>();\n    JsonArrayConst carray2 = array2;\n\n    CHECK(array1 == carray2);\n    CHECK(array1 <= carray2);\n    CHECK(array1 >= carray2);\n    CHECK_FALSE(array1 != carray2);\n    CHECK_FALSE(array1 > carray2);\n    CHECK_FALSE(array1 < carray2);\n\n    CHECK(carray2 == array1);\n    CHECK(carray2 <= array1);\n    CHECK(carray2 >= array1);\n    CHECK_FALSE(carray2 != array1);\n    CHECK_FALSE(carray2 > array1);\n    CHECK_FALSE(carray2 < array1);\n  }\n\n  SECTION(\"Compare with different array\") {\n    JsonArray array1 = doc.add<JsonArray>();\n    array1.add(1);\n    array1.add(\"hello1\");\n    array1.add<JsonObject>();\n\n    JsonArray array2 = doc.add<JsonArray>();\n    array2.add(1);\n    array2.add(\"hello2\");\n    array2.add<JsonObject>();\n    JsonArrayConst carray2 = array2;\n\n    CHECK(array1 != carray2);\n    CHECK_FALSE(array1 == carray2);\n    CHECK_FALSE(array1 > carray2);\n    CHECK_FALSE(array1 < carray2);\n    CHECK_FALSE(array1 <= carray2);\n    CHECK_FALSE(array1 >= carray2);\n\n    CHECK(carray2 != array1);\n    CHECK_FALSE(carray2 == array1);\n    CHECK_FALSE(carray2 > array1);\n    CHECK_FALSE(carray2 < array1);\n    CHECK_FALSE(carray2 <= array1);\n    CHECK_FALSE(carray2 >= array1);\n  }\n}\n\nTEST_CASE(\"Compare JsonArrayConst with JsonArrayConst\") {\n  JsonDocument doc;\n\n  SECTION(\"Compare with unbound\") {\n    JsonArray array = doc.to<JsonArray>();\n    array.add(1);\n    array.add(\"hello\");\n\n    JsonArrayConst carray = array;\n    JsonArrayConst unbound;\n\n    CHECK(carray != unbound);\n    CHECK_FALSE(carray == unbound);\n    CHECK_FALSE(carray <= unbound);\n    CHECK_FALSE(carray >= unbound);\n    CHECK_FALSE(carray > unbound);\n    CHECK_FALSE(carray < unbound);\n\n    CHECK(unbound != carray);\n    CHECK_FALSE(unbound == carray);\n    CHECK_FALSE(unbound <= carray);\n    CHECK_FALSE(unbound >= carray);\n    CHECK_FALSE(unbound > carray);\n    CHECK_FALSE(unbound < carray);\n  }\n\n  SECTION(\"Compare with self\") {\n    JsonArray array = doc.to<JsonArray>();\n    array.add(1);\n    array.add(\"hello\");\n    JsonArrayConst carray = array;\n\n    CHECK(carray == carray);\n    CHECK(carray <= carray);\n    CHECK(carray >= carray);\n    CHECK_FALSE(carray != carray);\n    CHECK_FALSE(carray > carray);\n    CHECK_FALSE(carray < carray);\n  }\n\n  SECTION(\"Compare with identical array\") {\n    JsonArray array1 = doc.add<JsonArray>();\n    array1.add(1);\n    array1.add(\"hello\");\n    array1.add<JsonObject>();\n    JsonArrayConst carray1 = array1;\n\n    JsonArray array2 = doc.add<JsonArray>();\n    array2.add(1);\n    array2.add(\"hello\");\n    array2.add<JsonObject>();\n    JsonArrayConst carray2 = array2;\n\n    CHECK(carray1 == carray2);\n    CHECK(carray1 <= carray2);\n    CHECK(carray1 >= carray2);\n    CHECK_FALSE(carray1 != carray2);\n    CHECK_FALSE(carray1 > carray2);\n    CHECK_FALSE(carray1 < carray2);\n  }\n\n  SECTION(\"Compare with different array\") {\n    JsonArray array1 = doc.add<JsonArray>();\n    array1.add(1);\n    array1.add(\"hello1\");\n    array1.add<JsonObject>();\n    JsonArrayConst carray1 = array1;\n\n    JsonArray array2 = doc.add<JsonArray>();\n    array2.add(1);\n    array2.add(\"hello2\");\n    array2.add<JsonObject>();\n    JsonArrayConst carray2 = array2;\n\n    CHECK(carray1 != carray2);\n    CHECK_FALSE(carray1 == carray2);\n    CHECK_FALSE(carray1 > carray2);\n    CHECK_FALSE(carray1 < carray2);\n    CHECK_FALSE(carray1 <= carray2);\n    CHECK_FALSE(carray1 >= carray2);\n  }\n}\n\nTEST_CASE(\"Compare JsonArrayConst with JsonVariant\") {\n  JsonDocument doc;\n\n  SECTION(\"Compare with self\") {\n    JsonArray array = doc.to<JsonArray>();\n    array.add(1);\n    array.add(\"hello\");\n    JsonArrayConst carray = array;\n    JsonVariant variant = array;\n\n    CHECK(carray == variant);\n    CHECK(carray <= variant);\n    CHECK(carray >= variant);\n    CHECK_FALSE(carray != variant);\n    CHECK_FALSE(carray > variant);\n    CHECK_FALSE(carray < variant);\n\n    CHECK(variant == carray);\n    CHECK(variant <= carray);\n    CHECK(variant >= carray);\n    CHECK_FALSE(variant != carray);\n    CHECK_FALSE(variant > carray);\n    CHECK_FALSE(variant < carray);\n  }\n\n  SECTION(\"Compare with identical array\") {\n    JsonArray array1 = doc.add<JsonArray>();\n    array1.add(1);\n    array1.add(\"hello\");\n    array1.add<JsonObject>();\n    JsonArrayConst carray1 = array1;\n\n    JsonArray array2 = doc.add<JsonArray>();\n    array2.add(1);\n    array2.add(\"hello\");\n    array2.add<JsonObject>();\n    JsonVariant variant2 = array2;\n\n    CHECK(carray1 == variant2);\n    CHECK(carray1 <= variant2);\n    CHECK(carray1 >= variant2);\n    CHECK_FALSE(carray1 != variant2);\n    CHECK_FALSE(carray1 > variant2);\n    CHECK_FALSE(carray1 < variant2);\n\n    CHECK(variant2 == carray1);\n    CHECK(variant2 <= carray1);\n    CHECK(variant2 >= carray1);\n    CHECK_FALSE(variant2 != carray1);\n    CHECK_FALSE(variant2 > carray1);\n    CHECK_FALSE(variant2 < carray1);\n  }\n\n  SECTION(\"Compare with different array\") {\n    JsonArray array1 = doc.add<JsonArray>();\n    array1.add(1);\n    array1.add(\"hello1\");\n    array1.add<JsonObject>();\n    JsonArrayConst carray1 = array1;\n\n    JsonArray array2 = doc.add<JsonArray>();\n    array2.add(1);\n    array2.add(\"hello2\");\n    array2.add<JsonObject>();\n    JsonVariant variant2 = array2;\n\n    CHECK(carray1 != variant2);\n    CHECK_FALSE(carray1 == variant2);\n    CHECK_FALSE(carray1 > variant2);\n    CHECK_FALSE(carray1 < variant2);\n    CHECK_FALSE(carray1 <= variant2);\n    CHECK_FALSE(carray1 >= variant2);\n\n    CHECK(variant2 != carray1);\n    CHECK_FALSE(variant2 == carray1);\n    CHECK_FALSE(variant2 > carray1);\n    CHECK_FALSE(variant2 < carray1);\n    CHECK_FALSE(variant2 <= carray1);\n    CHECK_FALSE(variant2 >= carray1);\n  }\n}\n"
  },
  {
    "path": "extras/tests/JsonArray/copyArray.cpp",
    "content": "// ArduinoJson - https://arduinojson.org\n// Copyright © 2014-2025, Benoit BLANCHON\n// MIT License\n\n#include <ArduinoJson.h>\n#include <catch.hpp>\n\n#include \"Allocators.hpp\"\n#include \"Literals.hpp\"\n\nTEST_CASE(\"copyArray()\") {\n  SECTION(\"int[] -> JsonArray\") {\n    JsonDocument doc;\n    JsonArray array = doc.to<JsonArray>();\n    char json[32];\n    int source[] = {1, 2, 3};\n\n    bool ok = copyArray(source, array);\n    CHECK(ok);\n\n    serializeJson(array, json);\n    CHECK(\"[1,2,3]\"_s == json);\n  }\n\n  SECTION(\"std::string[] -> JsonArray\") {\n    JsonDocument doc;\n    JsonArray array = doc.to<JsonArray>();\n    char json[32];\n    std::string source[] = {\"a\", \"b\", \"c\"};\n\n    bool ok = copyArray(source, array);\n    CHECK(ok);\n\n    serializeJson(array, json);\n    CHECK(\"[\\\"a\\\",\\\"b\\\",\\\"c\\\"]\"_s == json);\n  }\n\n  SECTION(\"const char*[] -> JsonArray\") {\n    JsonDocument doc;\n    JsonArray array = doc.to<JsonArray>();\n    char json[32];\n    const char* source[] = {\"a\", \"b\", \"c\"};\n\n    bool ok = copyArray(source, array);\n    CHECK(ok);\n\n    serializeJson(array, json);\n    CHECK(\"[\\\"a\\\",\\\"b\\\",\\\"c\\\"]\"_s == json);\n  }\n\n  SECTION(\"const char[][] -> JsonArray\") {\n    JsonDocument doc;\n    JsonArray array = doc.to<JsonArray>();\n    char json[32];\n    char source[][2] = {\"a\", \"b\", \"c\"};\n\n    bool ok = copyArray(source, array);\n    CHECK(ok);\n\n    serializeJson(array, json);\n    CHECK(\"[\\\"a\\\",\\\"b\\\",\\\"c\\\"]\"_s == json);\n  }\n\n  SECTION(\"const char[][] -> JsonDocument\") {\n    JsonDocument doc;\n    char json[32];\n    char source[][2] = {\"a\", \"b\", \"c\"};\n\n    bool ok = copyArray(source, doc);\n    CHECK(ok);\n\n    serializeJson(doc, json);\n    CHECK(\"[\\\"a\\\",\\\"b\\\",\\\"c\\\"]\"_s == json);\n  }\n\n  SECTION(\"const char[][] -> MemberProxy\") {\n    JsonDocument doc;\n    char json[32];\n    char source[][2] = {\"a\", \"b\", \"c\"};\n\n    bool ok = copyArray(source, doc[\"data\"]);\n    CHECK(ok);\n\n    serializeJson(doc, json);\n    CHECK(\"{\\\"data\\\":[\\\"a\\\",\\\"b\\\",\\\"c\\\"]}\"_s == json);\n  }\n\n  SECTION(\"int[] -> JsonDocument\") {\n    JsonDocument doc;\n    char json[32];\n    int source[] = {1, 2, 3};\n\n    bool ok = copyArray(source, doc);\n    CHECK(ok);\n\n    serializeJson(doc, json);\n    CHECK(\"[1,2,3]\"_s == json);\n  }\n\n  SECTION(\"int[] -> MemberProxy\") {\n    JsonDocument doc;\n    char json[32];\n    int source[] = {1, 2, 3};\n\n    bool ok = copyArray(source, doc[\"data\"]);\n    CHECK(ok);\n\n    serializeJson(doc, json);\n    CHECK(\"{\\\"data\\\":[1,2,3]}\"_s == json);\n  }\n\n  SECTION(\"int[] -> JsonArray, but not enough memory\") {\n    JsonDocument doc(FailingAllocator::instance());\n    JsonArray array = doc.to<JsonArray>();\n    int source[] = {1, 2, 3};\n\n    bool ok = copyArray(source, array);\n    REQUIRE_FALSE(ok);\n  }\n\n  SECTION(\"int[][] -> JsonArray\") {\n    JsonDocument doc;\n    JsonArray array = doc.to<JsonArray>();\n    char json[32];\n    int source[][3] = {{1, 2, 3}, {4, 5, 6}};\n\n    bool ok = copyArray(source, array);\n    CHECK(ok);\n\n    serializeJson(array, json);\n    CHECK(\"[[1,2,3],[4,5,6]]\"_s == json);\n  }\n\n  SECTION(\"int[][] -> MemberProxy\") {\n    JsonDocument doc;\n    char json[32];\n    int source[][3] = {{1, 2, 3}, {4, 5, 6}};\n\n    bool ok = copyArray(source, doc[\"data\"]);\n    CHECK(ok);\n\n    serializeJson(doc, json);\n    CHECK(\"{\\\"data\\\":[[1,2,3],[4,5,6]]}\"_s == json);\n  }\n\n  SECTION(\"int[][] -> JsonDocument\") {\n    JsonDocument doc;\n    char json[32];\n    int source[][3] = {{1, 2, 3}, {4, 5, 6}};\n\n    bool ok = copyArray(source, doc);\n    CHECK(ok);\n\n    serializeJson(doc, json);\n    CHECK(\"[[1,2,3],[4,5,6]]\"_s == json);\n  }\n\n  SECTION(\"int[][] -> JsonArray, but not enough memory\") {\n    JsonDocument doc(FailingAllocator::instance());\n    JsonArray array = doc.to<JsonArray>();\n    int source[][3] = {{1, 2, 3}, {4, 5, 6}};\n\n    bool ok = copyArray(source, array);\n    REQUIRE(ok == false);\n  }\n\n  SECTION(\"JsonArray -> int[], with more space than needed\") {\n    JsonDocument doc;\n    char json[] = \"[1,2,3]\";\n    DeserializationError err = deserializeJson(doc, json);\n    CHECK(err == DeserializationError::Ok);\n    JsonArray array = doc.as<JsonArray>();\n\n    int destination[4] = {0};\n    size_t result = copyArray(array, destination);\n\n    CHECK(3 == result);\n    CHECK(1 == destination[0]);\n    CHECK(2 == destination[1]);\n    CHECK(3 == destination[2]);\n    CHECK(0 == destination[3]);\n  }\n\n  SECTION(\"JsonArray -> int[], without enough space\") {\n    JsonDocument doc;\n    char json[] = \"[1,2,3]\";\n    DeserializationError err = deserializeJson(doc, json);\n    CHECK(err == DeserializationError::Ok);\n    JsonArray array = doc.as<JsonArray>();\n\n    int destination[2] = {0};\n    size_t result = copyArray(array, destination);\n\n    CHECK(2 == result);\n    CHECK(1 == destination[0]);\n    CHECK(2 == destination[1]);\n  }\n\n  SECTION(\"JsonArray -> std::string[]\") {\n    JsonDocument doc;\n    char json[] = \"[\\\"a\\\",\\\"b\\\",\\\"c\\\"]\";\n    DeserializationError err = deserializeJson(doc, json);\n    CHECK(err == DeserializationError::Ok);\n    JsonArray array = doc.as<JsonArray>();\n\n    std::string destination[4];\n    size_t result = copyArray(array, destination);\n\n    CHECK(3 == result);\n    CHECK(\"a\" == destination[0]);\n    CHECK(\"b\" == destination[1]);\n    CHECK(\"c\" == destination[2]);\n    CHECK(\"\" == destination[3]);\n  }\n\n  SECTION(\"JsonArray -> char[N][]\") {\n    JsonDocument doc;\n    char json[] = \"[\\\"a12345\\\",\\\"b123456\\\",\\\"c1234567\\\"]\";\n    DeserializationError err = deserializeJson(doc, json);\n    CHECK(err == DeserializationError::Ok);\n    JsonArray array = doc.as<JsonArray>();\n\n    char destination[4][8] = {{0}};\n    size_t result = copyArray(array, destination);\n\n    CHECK(3 == result);\n    CHECK(\"a12345\"_s == destination[0]);\n    CHECK(\"b123456\"_s == destination[1]);\n    CHECK(\"c123456\"_s == destination[2]);  // truncated\n    CHECK(std::string(\"\") == destination[3]);\n  }\n\n  SECTION(\"JsonDocument -> int[]\") {\n    JsonDocument doc;\n    char json[] = \"[1,2,3]\";\n    DeserializationError err = deserializeJson(doc, json);\n    CHECK(err == DeserializationError::Ok);\n\n    int destination[4] = {0};\n    size_t result = copyArray(doc, destination);\n\n    CHECK(3 == result);\n    CHECK(1 == destination[0]);\n    CHECK(2 == destination[1]);\n    CHECK(3 == destination[2]);\n    CHECK(0 == destination[3]);\n  }\n\n  SECTION(\"MemberProxy -> int[]\") {\n    JsonDocument doc;\n    char json[] = \"{\\\"data\\\":[1,2,3]}\";\n    DeserializationError err = deserializeJson(doc, json);\n    CHECK(err == DeserializationError::Ok);\n\n    int destination[4] = {0};\n    size_t result = copyArray(doc[\"data\"], destination);\n\n    CHECK(3 == result);\n    CHECK(1 == destination[0]);\n    CHECK(2 == destination[1]);\n    CHECK(3 == destination[2]);\n    CHECK(0 == destination[3]);\n  }\n\n  SECTION(\"ElementProxy -> int[]\") {\n    JsonDocument doc;\n    char json[] = \"[[1,2,3]]\";\n    DeserializationError err = deserializeJson(doc, json);\n    CHECK(err == DeserializationError::Ok);\n\n    int destination[4] = {0};\n    size_t result = copyArray(doc[0], destination);\n\n    CHECK(3 == result);\n    CHECK(1 == destination[0]);\n    CHECK(2 == destination[1]);\n    CHECK(3 == destination[2]);\n    CHECK(0 == destination[3]);\n  }\n\n  SECTION(\"JsonArray -> int[][]\") {\n    JsonDocument doc;\n    char json[] = \"[[1,2],[3],[4]]\";\n\n    DeserializationError err = deserializeJson(doc, json);\n    CHECK(err == DeserializationError::Ok);\n    JsonArray array = doc.as<JsonArray>();\n\n    int destination[3][2] = {{0}};\n    copyArray(array, destination);\n\n    CHECK(1 == destination[0][0]);\n    CHECK(2 == destination[0][1]);\n    CHECK(3 == destination[1][0]);\n    CHECK(0 == destination[1][1]);\n    CHECK(4 == destination[2][0]);\n    CHECK(0 == destination[2][1]);\n  }\n\n  SECTION(\"JsonDocument -> int[][]\") {\n    JsonDocument doc;\n    char json[] = \"[[1,2],[3],[4]]\";\n\n    DeserializationError err = deserializeJson(doc, json);\n    CHECK(err == DeserializationError::Ok);\n\n    int destination[3][2] = {{0}};\n    copyArray(doc, destination);\n\n    CHECK(1 == destination[0][0]);\n    CHECK(2 == destination[0][1]);\n    CHECK(3 == destination[1][0]);\n    CHECK(0 == destination[1][1]);\n    CHECK(4 == destination[2][0]);\n    CHECK(0 == destination[2][1]);\n  }\n\n  SECTION(\"MemberProxy -> int[][]\") {\n    JsonDocument doc;\n    char json[] = \"{\\\"data\\\":[[1,2],[3],[4]]}\";\n\n    DeserializationError err = deserializeJson(doc, json);\n    CHECK(err == DeserializationError::Ok);\n\n    int destination[3][2] = {{0}};\n    copyArray(doc[\"data\"], destination);\n\n    CHECK(1 == destination[0][0]);\n    CHECK(2 == destination[0][1]);\n    CHECK(3 == destination[1][0]);\n    CHECK(0 == destination[1][1]);\n    CHECK(4 == destination[2][0]);\n    CHECK(0 == destination[2][1]);\n  }\n}\n"
  },
  {
    "path": "extras/tests/JsonArray/equals.cpp",
    "content": "// ArduinoJson - https://arduinojson.org\n// Copyright © 2014-2025, Benoit BLANCHON\n// MIT License\n\n#include <ArduinoJson.h>\n#include <catch.hpp>\n\nTEST_CASE(\"JsonArray::operator==()\") {\n  JsonDocument doc1;\n  JsonArray array1 = doc1.to<JsonArray>();\n\n  JsonDocument doc2;\n  JsonArray array2 = doc2.to<JsonArray>();\n\n  SECTION(\"should return false when arrays differ\") {\n    array1.add(\"coucou\");\n    array2.add(1);\n\n    REQUIRE_FALSE(array1 == array2);\n  }\n\n  SECTION(\"should return false when LHS has more elements\") {\n    array1.add(1);\n    array1.add(2);\n    array2.add(1);\n\n    REQUIRE_FALSE(array1 == array2);\n  }\n\n  SECTION(\"should return false when RHS has more elements\") {\n    array1.add(1);\n    array2.add(1);\n    array2.add(2);\n\n    REQUIRE_FALSE(array1 == array2);\n  }\n\n  SECTION(\"should return true when arrays equal\") {\n    array1.add(\"coucou\");\n    array2.add(\"coucou\");\n\n    REQUIRE(array1 == array2);\n  }\n\n  SECTION(\"should return false when RHS is null\") {\n    JsonArray null;\n\n    REQUIRE_FALSE(array1 == null);\n  }\n\n  SECTION(\"should return false when LHS is null\") {\n    JsonArray null;\n\n    REQUIRE_FALSE(null == array1);\n  }\n\n  SECTION(\"should return true when both are null\") {\n    JsonArray null1;\n    JsonArray null2;\n\n    REQUIRE(null1 == null2);\n  }\n}\n"
  },
  {
    "path": "extras/tests/JsonArray/isNull.cpp",
    "content": "// ArduinoJson - https://arduinojson.org\n// Copyright © 2014-2025, Benoit BLANCHON\n// MIT License\n\n#include <ArduinoJson.h>\n#include <catch.hpp>\n\nTEST_CASE(\"JsonArray::isNull()\") {\n  SECTION(\"returns true\") {\n    JsonArray arr;\n    REQUIRE(arr.isNull() == true);\n  }\n\n  SECTION(\"returns false\") {\n    JsonDocument doc;\n    JsonArray arr = doc.to<JsonArray>();\n    REQUIRE(arr.isNull() == false);\n  }\n}\n\nTEST_CASE(\"JsonArray::operator bool()\") {\n  SECTION(\"returns false\") {\n    JsonArray arr;\n    REQUIRE(static_cast<bool>(arr) == false);\n  }\n\n  SECTION(\"returns true\") {\n    JsonDocument doc;\n    JsonArray arr = doc.to<JsonArray>();\n    REQUIRE(static_cast<bool>(arr) == true);\n  }\n}\n"
  },
  {
    "path": "extras/tests/JsonArray/iterator.cpp",
    "content": "// ArduinoJson - https://arduinojson.org\n// Copyright © 2014-2025, Benoit BLANCHON\n// MIT License\n\n#include <ArduinoJson.h>\n#include <catch.hpp>\n\nTEST_CASE(\"JsonArray::begin()/end()\") {\n  SECTION(\"Non null JsonArray\") {\n    JsonDocument doc;\n    JsonArray array = doc.to<JsonArray>();\n    array.add(12);\n    array.add(34);\n\n    auto it = array.begin();\n    auto end = array.end();\n\n    REQUIRE(end != it);\n    REQUIRE(12 == it->as<int>());\n    REQUIRE(12 == static_cast<int>(*it));\n    ++it;\n    REQUIRE(end != it);\n    REQUIRE(34 == it->as<int>());\n    REQUIRE(34 == static_cast<int>(*it));\n    ++it;\n    REQUIRE(end == it);\n  }\n\n  SECTION(\"Null JsonArray\") {\n    JsonArray array;\n\n    REQUIRE(array.begin() == array.end());\n  }\n}\n"
  },
  {
    "path": "extras/tests/JsonArray/nesting.cpp",
    "content": "// ArduinoJson - https://arduinojson.org\n// Copyright © 2014-2025, Benoit BLANCHON\n// MIT License\n\n#include <ArduinoJson.h>\n#include <catch.hpp>\n\nTEST_CASE(\"JsonArray::nesting()\") {\n  JsonDocument doc;\n  JsonArray arr = doc.to<JsonArray>();\n\n  SECTION(\"return 0 if uninitialized\") {\n    JsonArray unitialized;\n    REQUIRE(unitialized.nesting() == 0);\n  }\n\n  SECTION(\"returns 1 for empty array\") {\n    REQUIRE(arr.nesting() == 1);\n  }\n\n  SECTION(\"returns 1 for flat array\") {\n    arr.add(\"hello\");\n    REQUIRE(arr.nesting() == 1);\n  }\n\n  SECTION(\"returns 2 with nested array\") {\n    arr.add<JsonArray>();\n    REQUIRE(arr.nesting() == 2);\n  }\n\n  SECTION(\"returns 2 with nested object\") {\n    arr.add<JsonObject>();\n    REQUIRE(arr.nesting() == 2);\n  }\n}\n"
  },
  {
    "path": "extras/tests/JsonArray/remove.cpp",
    "content": "// ArduinoJson - https://arduinojson.org\n// Copyright © 2014-2025, Benoit BLANCHON\n// MIT License\n\n#include <ArduinoJson.h>\n#include <catch.hpp>\n\n#include \"Allocators.hpp\"\n\nTEST_CASE(\"JsonArray::remove()\") {\n  JsonDocument doc;\n  JsonArray array = doc.to<JsonArray>();\n  array.add(1);\n  array.add(2);\n  array.add(3);\n\n  SECTION(\"remove first by index\") {\n    array.remove(0);\n\n    REQUIRE(2 == array.size());\n    REQUIRE(array[0] == 2);\n    REQUIRE(array[1] == 3);\n  }\n\n  SECTION(\"remove middle by index\") {\n    array.remove(1);\n\n    REQUIRE(2 == array.size());\n    REQUIRE(array[0] == 1);\n    REQUIRE(array[1] == 3);\n  }\n\n  SECTION(\"remove last by index\") {\n    array.remove(2);\n\n    REQUIRE(2 == array.size());\n    REQUIRE(array[0] == 1);\n    REQUIRE(array[1] == 2);\n  }\n\n  SECTION(\"remove first by iterator\") {\n    JsonArray::iterator it = array.begin();\n    array.remove(it);\n\n    REQUIRE(2 == array.size());\n    REQUIRE(array[0] == 2);\n    REQUIRE(array[1] == 3);\n  }\n\n  SECTION(\"remove middle by iterator\") {\n    JsonArray::iterator it = array.begin();\n    ++it;\n    array.remove(it);\n\n    REQUIRE(2 == array.size());\n    REQUIRE(array[0] == 1);\n    REQUIRE(array[1] == 3);\n  }\n\n  SECTION(\"remove last bty iterator\") {\n    JsonArray::iterator it = array.begin();\n    ++it;\n    ++it;\n    array.remove(it);\n\n    REQUIRE(2 == array.size());\n    REQUIRE(array[0] == 1);\n    REQUIRE(array[1] == 2);\n  }\n\n  SECTION(\"remove end()\") {\n    array.remove(array.end());\n\n    REQUIRE(3 == array.size());\n  }\n\n  SECTION(\"In a loop\") {\n    for (JsonArray::iterator it = array.begin(); it != array.end(); ++it) {\n      if (*it == 2)\n        array.remove(it);\n    }\n\n    REQUIRE(2 == array.size());\n    REQUIRE(array[0] == 1);\n    REQUIRE(array[1] == 3);\n  }\n\n  SECTION(\"remove by index on unbound reference\") {\n    JsonArray unboundArray;\n    unboundArray.remove(20);\n  }\n\n  SECTION(\"remove by iterator on unbound reference\") {\n    JsonArray unboundArray;\n    unboundArray.remove(unboundArray.begin());\n  }\n\n  SECTION(\"use JsonVariant as index\") {\n    array.remove(array[3]);  // no effect with null variant\n    array.remove(array[0]);  // remove element at index 1\n\n    REQUIRE(2 == array.size());\n    REQUIRE(array[0] == 1);\n    REQUIRE(array[1] == 3);\n  }\n}\n\nTEST_CASE(\"Removed elements are recycled\") {\n  SpyingAllocator spy;\n  JsonDocument doc(&spy);\n  JsonArray array = doc.to<JsonArray>();\n\n  // fill the pool entirely\n  for (int i = 0; i < ARDUINOJSON_POOL_CAPACITY; i++)\n    array.add(i);\n\n  // free one slot in the pool\n  array.remove(0);\n\n  // add one element; it should use the free slot\n  array.add(42);\n\n  REQUIRE(spy.log() == AllocatorLog{\n                           Allocate(sizeofPool()),  // only one pool\n                       });\n}\n"
  },
  {
    "path": "extras/tests/JsonArray/size.cpp",
    "content": "// ArduinoJson - https://arduinojson.org\n// Copyright © 2014-2025, Benoit BLANCHON\n// MIT License\n\n#include <ArduinoJson.h>\n#include <catch.hpp>\n\nTEST_CASE(\"JsonArray::size()\") {\n  JsonDocument doc;\n  JsonArray array = doc.to<JsonArray>();\n\n  SECTION(\"returns 0 is empty\") {\n    REQUIRE(0U == array.size());\n  }\n\n  SECTION(\"increases after add()\") {\n    array.add(\"hello\");\n    REQUIRE(1U == array.size());\n\n    array.add(\"world\");\n    REQUIRE(2U == array.size());\n  }\n\n  SECTION(\"remains the same after replacing an element\") {\n    array.add(\"hello\");\n    REQUIRE(1U == array.size());\n\n    array[0] = \"hello\";\n    REQUIRE(1U == array.size());\n  }\n}\n"
  },
  {
    "path": "extras/tests/JsonArray/subscript.cpp",
    "content": "// ArduinoJson - https://arduinojson.org\n// Copyright © 2014-2025, Benoit BLANCHON\n// MIT License\n\n#include <ArduinoJson.h>\n#include <stdint.h>\n#include <catch.hpp>\n\n#include \"Allocators.hpp\"\n#include \"Literals.hpp\"\n\nTEST_CASE(\"JsonArray::operator[]\") {\n  SpyingAllocator spy;\n  JsonDocument doc(&spy);\n  JsonArray array = doc.to<JsonArray>();\n\n  SECTION(\"Pad with null\") {\n    array[2] = 2;\n    array[5] = 5;\n    REQUIRE(array.size() == 6);\n    REQUIRE(array[0].isNull() == true);\n    REQUIRE(array[1].isNull() == true);\n    REQUIRE(array[2].isNull() == false);\n    REQUIRE(array[3].isNull() == true);\n    REQUIRE(array[4].isNull() == true);\n    REQUIRE(array[5].isNull() == false);\n    REQUIRE(array[2] == 2);\n    REQUIRE(array[5] == 5);\n  }\n\n  SECTION(\"int\") {\n    array[0] = 123;\n    REQUIRE(123 == array[0].as<int>());\n    REQUIRE(true == array[0].is<int>());\n    REQUIRE(false == array[0].is<bool>());\n  }\n\n#if ARDUINOJSON_USE_LONG_LONG\n  SECTION(\"long long\") {\n    array[0] = 9223372036854775807;\n    REQUIRE(9223372036854775807 == array[0].as<int64_t>());\n    REQUIRE(true == array[0].is<int64_t>());\n    REQUIRE(false == array[0].is<int32_t>());\n    REQUIRE(false == array[0].is<bool>());\n  }\n#endif\n\n  SECTION(\"double\") {\n    array[0] = 123.45;\n    REQUIRE(123.45 == array[0].as<double>());\n    REQUIRE(true == array[0].is<double>());\n    REQUIRE(false == array[0].is<int>());\n  }\n\n  SECTION(\"bool\") {\n    array[0] = true;\n    REQUIRE(true == array[0].as<bool>());\n    REQUIRE(true == array[0].is<bool>());\n    REQUIRE(false == array[0].is<int>());\n  }\n\n  SECTION(\"string literal\") {\n    array[0] = \"hello\";\n\n    REQUIRE(array[0].as<std::string>() == \"hello\");\n    REQUIRE(true == array[0].is<const char*>());\n    REQUIRE(false == array[0].is<int>());\n    REQUIRE(spy.log() == AllocatorLog{\n                             Allocate(sizeofPool()),\n                             Allocate(sizeofString(\"world\")),\n                         });\n  }\n\n  SECTION(\"const char*\") {\n    const char* str = \"hello\";\n    array[0] = str;\n\n    REQUIRE(array[0].as<std::string>() == \"hello\");\n    REQUIRE(true == array[0].is<const char*>());\n    REQUIRE(false == array[0].is<int>());\n    REQUIRE(spy.log() == AllocatorLog{\n                             Allocate(sizeofPool()),\n                             Allocate(sizeofString(\"world\")),\n                         });\n  }\n\n  SECTION(\"std::string\") {\n    array[0] = \"hello\"_s;\n\n    REQUIRE(array[0].as<std::string>() == \"hello\");\n    REQUIRE(true == array[0].is<const char*>());\n    REQUIRE(false == array[0].is<int>());\n    REQUIRE(spy.log() == AllocatorLog{\n                             Allocate(sizeofPool()),\n                             Allocate(sizeofString(\"world\")),\n                         });\n  }\n\n#ifdef HAS_VARIABLE_LENGTH_ARRAY\n  SECTION(\"VLA\") {\n    size_t i = 16;\n    char vla[i];\n    strcpy(vla, \"world\");\n\n    array.add(\"hello\");\n    array[0] = vla;\n\n    REQUIRE(array[0] == \"world\"_s);\n  }\n#endif\n\n  SECTION(\"nested array\") {\n    JsonDocument doc2;\n    JsonArray arr2 = doc2.to<JsonArray>();\n\n    array[0] = arr2;\n\n    REQUIRE(arr2 == array[0].as<JsonArray>());\n    REQUIRE(true == array[0].is<JsonArray>());\n    REQUIRE(false == array[0].is<int>());\n  }\n\n  SECTION(\"nested object\") {\n    JsonDocument doc2;\n    JsonObject obj = doc2.to<JsonObject>();\n\n    array[0] = obj;\n\n    REQUIRE(obj == array[0].as<JsonObject>());\n    REQUIRE(true == array[0].is<JsonObject>());\n    REQUIRE(false == array[0].is<int>());\n  }\n\n  SECTION(\"array subscript\") {\n    JsonDocument doc2;\n    JsonArray arr2 = doc2.to<JsonArray>();\n    const char* str = \"hello\";\n\n    arr2.add(str);\n\n    array[0] = arr2[0];\n\n    REQUIRE(str == array[0]);\n  }\n\n  SECTION(\"object subscript\") {\n    const char* str = \"hello\";\n    JsonDocument doc2;\n    JsonObject obj = doc2.to<JsonObject>();\n\n    obj[\"x\"] = str;\n\n    array[0] = obj[\"x\"];\n\n    REQUIRE(str == array[0]);\n  }\n\n  SECTION(\"array[0].to<JsonObject>()\") {\n    JsonObject obj = array[0].to<JsonObject>();\n    REQUIRE(obj.isNull() == false);\n  }\n\n  SECTION(\"Use a JsonVariant as index\") {\n    array[0] = 1;\n    array[1] = 2;\n    array[2] = 3;\n\n    REQUIRE(array[array[1]] == 3);\n    REQUIRE(array[array[3]] == nullptr);\n  }\n}\n"
  },
  {
    "path": "extras/tests/JsonArray/unbound.cpp",
    "content": "// ArduinoJson - https://arduinojson.org\n// Copyright © 2014-2025, Benoit BLANCHON\n// MIT License\n\n#include <ArduinoJson.h>\n#include <catch.hpp>\n\nusing namespace Catch::Matchers;\n\nTEST_CASE(\"Unbound JsonArray\") {\n  JsonArray array;\n\n  SECTION(\"SubscriptFails\") {\n    REQUIRE(array[0].isNull());\n  }\n\n  SECTION(\"AddFails\") {\n    array.add(1);\n    REQUIRE(0 == array.size());\n  }\n\n  SECTION(\"PrintToWritesBrackets\") {\n    char buffer[32];\n    serializeJson(array, buffer, sizeof(buffer));\n    REQUIRE_THAT(buffer, Equals(\"null\"));\n  }\n}\n"
  },
  {
    "path": "extras/tests/JsonArrayConst/CMakeLists.txt",
    "content": "# ArduinoJson - https://arduinojson.org\n# Copyright © 2014-2025, Benoit BLANCHON\n# MIT License\n\nadd_executable(JsonArrayConstTests\n\tequals.cpp\n\tisNull.cpp\n\titerator.cpp\n\tnesting.cpp\n\tsize.cpp\n\tsubscript.cpp\n)\n\nadd_test(JsonArrayConst JsonArrayConstTests)\n\nset_tests_properties(JsonArrayConst\n\tPROPERTIES\n\t\tLABELS \"Catch\"\n)\n"
  },
  {
    "path": "extras/tests/JsonArrayConst/equals.cpp",
    "content": "// ArduinoJson - https://arduinojson.org\n// Copyright © 2014-2025, Benoit BLANCHON\n// MIT License\n\n#include <ArduinoJson.h>\n#include <catch.hpp>\n\nTEST_CASE(\"JsonArrayConst::operator==()\") {\n  JsonDocument doc1;\n  JsonArrayConst array1 = doc1.to<JsonArray>();\n\n  JsonDocument doc2;\n  JsonArrayConst array2 = doc2.to<JsonArray>();\n\n  SECTION(\"should return false when arrays differ\") {\n    doc1.add(\"coucou\");\n    doc2.add(1);\n\n    REQUIRE_FALSE(array1 == array2);\n  }\n\n  SECTION(\"should return false when LHS has more elements\") {\n    doc1.add(1);\n    doc1.add(2);\n    doc2.add(1);\n\n    REQUIRE_FALSE(array1 == array2);\n  }\n\n  SECTION(\"should return false when RHS has more elements\") {\n    doc1.add(1);\n    doc2.add(1);\n    doc2.add(2);\n\n    REQUIRE_FALSE(array1 == array2);\n  }\n\n  SECTION(\"should return true when arrays equal\") {\n    doc1.add(\"coucou\");\n    doc2.add(\"coucou\");\n\n    REQUIRE(array1 == array2);\n  }\n\n  SECTION(\"should return false when RHS is null\") {\n    JsonArrayConst null;\n\n    REQUIRE_FALSE(array1 == null);\n  }\n\n  SECTION(\"should return false when LHS is null\") {\n    JsonArrayConst null;\n\n    REQUIRE_FALSE(null == array1);\n  }\n\n  SECTION(\"should return true when both are null\") {\n    JsonArrayConst null1;\n    JsonArrayConst null2;\n\n    REQUIRE(null1 == null2);\n  }\n}\n"
  },
  {
    "path": "extras/tests/JsonArrayConst/isNull.cpp",
    "content": "// ArduinoJson - https://arduinojson.org\n// Copyright © 2014-2025, Benoit BLANCHON\n// MIT License\n\n#include <ArduinoJson.h>\n#include <catch.hpp>\n\nTEST_CASE(\"JsonArrayConst::isNull()\") {\n  SECTION(\"returns true\") {\n    JsonArrayConst arr;\n    REQUIRE(arr.isNull() == true);\n  }\n\n  SECTION(\"returns false\") {\n    JsonDocument doc;\n    JsonArrayConst arr = doc.to<JsonArray>();\n    REQUIRE(arr.isNull() == false);\n  }\n}\n\nTEST_CASE(\"JsonArrayConst::operator bool()\") {\n  SECTION(\"returns false\") {\n    JsonArrayConst arr;\n    REQUIRE(static_cast<bool>(arr) == false);\n  }\n\n  SECTION(\"returns true\") {\n    JsonDocument doc;\n    JsonArrayConst arr = doc.to<JsonArray>();\n    REQUIRE(static_cast<bool>(arr) == true);\n  }\n}\n"
  },
  {
    "path": "extras/tests/JsonArrayConst/iterator.cpp",
    "content": "// ArduinoJson - https://arduinojson.org\n// Copyright © 2014-2025, Benoit BLANCHON\n// MIT License\n\n#include <ArduinoJson.h>\n#include <catch.hpp>\n\nTEST_CASE(\"JsonArrayConst::begin()/end()\") {\n  SECTION(\"Non null JsonArrayConst\") {\n    JsonDocument doc;\n    JsonArrayConst array = doc.to<JsonArray>();\n    doc.add(12);\n    doc.add(34);\n\n    auto it = array.begin();\n    auto end = array.end();\n\n    REQUIRE(end != it);\n    REQUIRE(12 == it->as<int>());\n    REQUIRE(12 == static_cast<int>(*it));\n    ++it;\n    REQUIRE(end != it);\n    REQUIRE(34 == it->as<int>());\n    REQUIRE(34 == static_cast<int>(*it));\n    ++it;\n    REQUIRE(end == it);\n  }\n\n  SECTION(\"Null JsonArrayConst\") {\n    JsonArrayConst array;\n\n    REQUIRE(array.begin() == array.end());\n  }\n}\n"
  },
  {
    "path": "extras/tests/JsonArrayConst/nesting.cpp",
    "content": "// ArduinoJson - https://arduinojson.org\n// Copyright © 2014-2025, Benoit BLANCHON\n// MIT License\n\n#include <ArduinoJson.h>\n#include <catch.hpp>\n\nTEST_CASE(\"JsonArrayConst::nesting()\") {\n  JsonDocument doc;\n  JsonArrayConst arr = doc.to<JsonArray>();\n\n  SECTION(\"return 0 if unbound\") {\n    JsonArrayConst unbound;\n    REQUIRE(unbound.nesting() == 0);\n  }\n\n  SECTION(\"returns 1 for empty array\") {\n    REQUIRE(arr.nesting() == 1);\n  }\n\n  SECTION(\"returns 1 for flat array\") {\n    doc.add(\"hello\");\n    REQUIRE(arr.nesting() == 1);\n  }\n\n  SECTION(\"returns 2 with nested array\") {\n    doc.add<JsonArray>();\n    REQUIRE(arr.nesting() == 2);\n  }\n\n  SECTION(\"returns 2 with nested object\") {\n    doc.add<JsonObject>();\n    REQUIRE(arr.nesting() == 2);\n  }\n}\n"
  },
  {
    "path": "extras/tests/JsonArrayConst/size.cpp",
    "content": "// ArduinoJson - https://arduinojson.org\n// Copyright © 2014-2025, Benoit BLANCHON\n// MIT License\n\n#include <ArduinoJson.h>\n#include <catch.hpp>\n\nTEST_CASE(\"JsonArrayConst::size()\") {\n  JsonDocument doc;\n  JsonArrayConst array = doc.to<JsonArray>();\n\n  SECTION(\"returns 0 if unbound\") {\n    JsonArrayConst unbound;\n    REQUIRE(0U == unbound.size());\n  }\n\n  SECTION(\"returns 0 is empty\") {\n    REQUIRE(0U == array.size());\n  }\n\n  SECTION(\"return number of elements\") {\n    doc.add(\"hello\");\n    doc.add(\"world\");\n\n    REQUIRE(2U == array.size());\n  }\n}\n"
  },
  {
    "path": "extras/tests/JsonArrayConst/subscript.cpp",
    "content": "// ArduinoJson - https://arduinojson.org\n// Copyright © 2014-2025, Benoit BLANCHON\n// MIT License\n\n#include <ArduinoJson.h>\n#include <stdint.h>\n#include <catch.hpp>\n\nTEST_CASE(\"JsonArrayConst::operator[]\") {\n  JsonDocument doc;\n  JsonArrayConst arr = doc.to<JsonArray>();\n  doc.add(1);\n  doc.add(2);\n  doc.add(3);\n\n  SECTION(\"int\") {\n    REQUIRE(1 == arr[0].as<int>());\n    REQUIRE(2 == arr[1].as<int>());\n    REQUIRE(3 == arr[2].as<int>());\n    REQUIRE(0 == arr[3].as<int>());\n  }\n\n  SECTION(\"JsonVariant\") {\n    REQUIRE(2 == arr[arr[0]].as<int>());\n    REQUIRE(0 == arr[arr[3]].as<int>());\n  }\n}\n"
  },
  {
    "path": "extras/tests/JsonDeserializer/CMakeLists.txt",
    "content": "# ArduinoJson - https://arduinojson.org\n# Copyright © 2014-2025, Benoit BLANCHON\n# MIT License\n\nadd_executable(JsonDeserializerTests\n\tarray.cpp\n\tDeserializationError.cpp\n\tdestination_types.cpp\n\terrors.cpp\n\tfilter.cpp\n\tinput_types.cpp\n\tmisc.cpp\n\tnestingLimit.cpp\n\tnumber.cpp\n\tobject.cpp\n\tstring.cpp\n)\n\nset_target_properties(JsonDeserializerTests PROPERTIES UNITY_BUILD OFF)\n\nadd_test(JsonDeserializer JsonDeserializerTests)\n\nset_tests_properties(JsonDeserializer\n\tPROPERTIES\n\t\tLABELS \"Catch\"\n)\n"
  },
  {
    "path": "extras/tests/JsonDeserializer/DeserializationError.cpp",
    "content": "// ArduinoJson - https://arduinojson.org\n// Copyright © 2014-2025, Benoit BLANCHON\n// MIT License\n\n#include <ArduinoJson.h>\n#include <catch.hpp>\n\n#include <sstream>\n\nvoid testStringification(DeserializationError error, std::string expected) {\n  REQUIRE(error.c_str() == expected);\n}\n\nvoid testBoolification(DeserializationError error, bool expected) {\n  // DeserializationError on left-hand side\n  CHECK(bool(error) == expected);\n  CHECK(bool(error) != !expected);\n  CHECK(!bool(error) == !expected);\n\n  // DeserializationError on right-hand side\n  CHECK(expected == bool(error));\n  CHECK(!expected != bool(error));\n  CHECK(!expected == !bool(error));\n}\n\n#define TEST_STRINGIFICATION(symbol) \\\n  testStringification(DeserializationError::symbol, #symbol)\n\n#define TEST_BOOLIFICATION(symbol, expected) \\\n  testBoolification(DeserializationError::symbol, expected)\n\nTEST_CASE(\"DeserializationError\") {\n  SECTION(\"c_str()\") {\n    TEST_STRINGIFICATION(Ok);\n    TEST_STRINGIFICATION(EmptyInput);\n    TEST_STRINGIFICATION(IncompleteInput);\n    TEST_STRINGIFICATION(InvalidInput);\n    TEST_STRINGIFICATION(NoMemory);\n    TEST_STRINGIFICATION(TooDeep);\n  }\n\n  SECTION(\"as boolean\") {\n    TEST_BOOLIFICATION(Ok, false);\n    TEST_BOOLIFICATION(EmptyInput, true);\n    TEST_BOOLIFICATION(IncompleteInput, true);\n    TEST_BOOLIFICATION(InvalidInput, true);\n    TEST_BOOLIFICATION(NoMemory, true);\n    TEST_BOOLIFICATION(TooDeep, true);\n  }\n\n  SECTION(\"ostream DeserializationError\") {\n    std::stringstream s;\n    s << DeserializationError(DeserializationError::InvalidInput);\n    REQUIRE(s.str() == \"InvalidInput\");\n  }\n\n  SECTION(\"ostream DeserializationError::Code\") {\n    std::stringstream s;\n    s << DeserializationError::InvalidInput;\n    REQUIRE(s.str() == \"InvalidInput\");\n  }\n\n  SECTION(\"switch\") {\n    DeserializationError err = DeserializationError::InvalidInput;\n    switch (err.code()) {\n      case DeserializationError::InvalidInput:\n        SUCCEED();\n        break;\n      default:\n        FAIL();\n        break;\n    }\n  }\n\n  SECTION(\"Use in a condition\") {\n    DeserializationError invalidInput(DeserializationError::InvalidInput);\n    DeserializationError ok(DeserializationError::Ok);\n\n    SECTION(\"if (!err)\") {\n      if (!invalidInput)\n        FAIL();\n    }\n\n    SECTION(\"if (err)\") {\n      if (ok)\n        FAIL();\n    }\n  }\n\n  SECTION(\"Comparisons\") {\n    DeserializationError invalidInput(DeserializationError::InvalidInput);\n    DeserializationError ok(DeserializationError::Ok);\n\n    SECTION(\"DeserializationError == Code\") {\n      REQUIRE(invalidInput == DeserializationError::InvalidInput);\n      REQUIRE(ok == DeserializationError::Ok);\n    }\n\n    SECTION(\"Code == DeserializationError\") {\n      REQUIRE(DeserializationError::InvalidInput == invalidInput);\n      REQUIRE(DeserializationError::Ok == ok);\n    }\n\n    SECTION(\"DeserializationError != Code\") {\n      REQUIRE(invalidInput != DeserializationError::Ok);\n      REQUIRE(ok != DeserializationError::InvalidInput);\n    }\n\n    SECTION(\"Code != DeserializationError\") {\n      REQUIRE(DeserializationError::Ok != invalidInput);\n      REQUIRE(DeserializationError::InvalidInput != ok);\n    }\n\n    SECTION(\"DeserializationError == DeserializationError\") {\n      REQUIRE_FALSE(invalidInput == ok);\n    }\n\n    SECTION(\"DeserializationError != DeserializationError\") {\n      REQUIRE(invalidInput != ok);\n    }\n  }\n}\n"
  },
  {
    "path": "extras/tests/JsonDeserializer/array.cpp",
    "content": "// ArduinoJson - https://arduinojson.org\n// Copyright © 2014-2025, Benoit BLANCHON\n// MIT License\n\n#include <ArduinoJson.h>\n#include <catch.hpp>\n\n#include \"Allocators.hpp\"\n\nusing namespace ArduinoJson::detail;\n\nTEST_CASE(\"deserialize JSON array\") {\n  SpyingAllocator spy;\n  JsonDocument doc(&spy);\n\n  SECTION(\"An empty array\") {\n    DeserializationError err = deserializeJson(doc, \"[]\");\n    JsonArray arr = doc.as<JsonArray>();\n\n    REQUIRE(err == DeserializationError::Ok);\n    REQUIRE(0 == arr.size());\n  }\n\n  SECTION(\"Spaces\") {\n    SECTION(\"Before the opening bracket\") {\n      DeserializationError err = deserializeJson(doc, \"  []\");\n      JsonArray arr = doc.as<JsonArray>();\n\n      REQUIRE(err == DeserializationError::Ok);\n      REQUIRE(0 == arr.size());\n    }\n\n    SECTION(\"Before first value\") {\n      DeserializationError err = deserializeJson(doc, \"[ \\t\\r\\n42]\");\n      JsonArray arr = doc.as<JsonArray>();\n\n      REQUIRE(err == DeserializationError::Ok);\n      REQUIRE(1 == arr.size());\n      REQUIRE(arr[0] == 42);\n    }\n\n    SECTION(\"After first value\") {\n      DeserializationError err = deserializeJson(doc, \"[42 \\t\\r\\n]\");\n      JsonArray arr = doc.as<JsonArray>();\n\n      REQUIRE(err == DeserializationError::Ok);\n      REQUIRE(1 == arr.size());\n      REQUIRE(arr[0] == 42);\n    }\n  }\n\n  SECTION(\"Values types\") {\n    SECTION(\"On integer\") {\n      DeserializationError err = deserializeJson(doc, \"[42]\");\n      JsonArray arr = doc.as<JsonArray>();\n\n      REQUIRE(err == DeserializationError::Ok);\n      REQUIRE(1 == arr.size());\n      REQUIRE(arr[0] == 42);\n    }\n\n    SECTION(\"Two integers\") {\n      DeserializationError err = deserializeJson(doc, \"[42,84]\");\n      JsonArray arr = doc.as<JsonArray>();\n\n      REQUIRE(err == DeserializationError::Ok);\n      REQUIRE(2 == arr.size());\n      REQUIRE(arr[0] == 42);\n      REQUIRE(arr[1] == 84);\n    }\n\n    SECTION(\"Float\") {\n      DeserializationError err = deserializeJson(doc, \"[4.2,1e2]\");\n      JsonArray arr = doc.as<JsonArray>();\n\n      REQUIRE(err == DeserializationError::Ok);\n      REQUIRE(2 == arr.size());\n      REQUIRE(arr[0].as<float>() == Approx(4.2f));\n      REQUIRE(arr[1] == 1e2f);\n      REQUIRE(spy.log() == AllocatorLog{\n                               Allocate(sizeofPool()),\n                               Reallocate(sizeofPool(), sizeofPool(2)),\n                           });\n    }\n\n    SECTION(\"Double\") {\n      DeserializationError err = deserializeJson(doc, \"[4.2123456,-7E89]\");\n      JsonArray arr = doc.as<JsonArray>();\n\n      REQUIRE(err == DeserializationError::Ok);\n      REQUIRE(2 == arr.size());\n      REQUIRE(arr[0].as<double>() == Approx(4.2123456));\n      REQUIRE(arr[1] == -7E89);\n      REQUIRE(spy.log() == AllocatorLog{\n                               Allocate(sizeofPool<VariantData>()),\n                               Allocate(sizeofPool<EightByteValue>()),\n                               Reallocate(sizeofPool<VariantData>(),\n                                          sizeofPool<VariantData>(2)),\n                               Reallocate(sizeofPool<EightByteValue>(),\n                                          sizeofPool<EightByteValue>(2)),\n                           });\n    }\n\n    SECTION(\"Unsigned long\") {\n      DeserializationError err = deserializeJson(doc, \"[4294967295]\");\n      JsonArray arr = doc.as<JsonArray>();\n\n      REQUIRE(err == DeserializationError::Ok);\n      REQUIRE(1 == arr.size());\n      REQUIRE(arr[0] == 4294967295UL);\n    }\n\n    SECTION(\"Boolean\") {\n      DeserializationError err = deserializeJson(doc, \"[true,false]\");\n      JsonArray arr = doc.as<JsonArray>();\n\n      REQUIRE(err == DeserializationError::Ok);\n      REQUIRE(2 == arr.size());\n      REQUIRE(arr[0] == true);\n      REQUIRE(arr[1] == false);\n    }\n\n    SECTION(\"Null\") {\n      DeserializationError err = deserializeJson(doc, \"[null,null]\");\n      JsonArray arr = doc.as<JsonArray>();\n\n      REQUIRE(err == DeserializationError::Ok);\n      REQUIRE(2 == arr.size());\n      REQUIRE(arr[0].as<const char*>() == 0);\n      REQUIRE(arr[1].as<const char*>() == 0);\n    }\n  }\n\n  SECTION(\"Quotes\") {\n    SECTION(\"Double quotes\") {\n      DeserializationError err =\n          deserializeJson(doc, \"[ \\\"hello\\\" , \\\"world\\\" ]\");\n      JsonArray arr = doc.as<JsonArray>();\n\n      REQUIRE(err == DeserializationError::Ok);\n      REQUIRE(2 == arr.size());\n      REQUIRE(arr[0] == \"hello\");\n      REQUIRE(arr[1] == \"world\");\n    }\n\n    SECTION(\"Single quotes\") {\n      DeserializationError err = deserializeJson(doc, \"[ 'hello' , 'world' ]\");\n      JsonArray arr = doc.as<JsonArray>();\n\n      REQUIRE(err == DeserializationError::Ok);\n      REQUIRE(2 == arr.size());\n      REQUIRE(arr[0] == \"hello\");\n      REQUIRE(arr[1] == \"world\");\n    }\n\n    SECTION(\"No quotes\") {\n      DeserializationError err = deserializeJson(doc, \"[ hello , world ]\");\n      REQUIRE(err == DeserializationError::InvalidInput);\n    }\n\n    SECTION(\"Double quotes (empty strings)\") {\n      DeserializationError err = deserializeJson(doc, \"[\\\"\\\",\\\"\\\"]\");\n      JsonArray arr = doc.as<JsonArray>();\n\n      REQUIRE(err == DeserializationError::Ok);\n      REQUIRE(2 == arr.size());\n      REQUIRE(arr[0] == \"\");\n      REQUIRE(arr[1] == \"\");\n    }\n\n    SECTION(\"Single quotes (empty strings)\") {\n      DeserializationError err = deserializeJson(doc, \"[\\'\\',\\'\\']\");\n      JsonArray arr = doc.as<JsonArray>();\n\n      REQUIRE(err == DeserializationError::Ok);\n      REQUIRE(2 == arr.size());\n      REQUIRE(arr[0] == \"\");\n      REQUIRE(arr[1] == \"\");\n    }\n\n    SECTION(\"No quotes (empty strings)\") {\n      DeserializationError err = deserializeJson(doc, \"[,]\");\n\n      REQUIRE(err == DeserializationError::InvalidInput);\n    }\n\n    SECTION(\"Closing single quotes missing\") {\n      DeserializationError err = deserializeJson(doc, \"[\\\"]\");\n\n      REQUIRE(err == DeserializationError::IncompleteInput);\n    }\n\n    SECTION(\"Closing double quotes missing\") {\n      DeserializationError err = deserializeJson(doc, \"[\\']\");\n\n      REQUIRE(err == DeserializationError::IncompleteInput);\n    }\n  }\n\n  SECTION(\"Premature null-terminator\") {\n    SECTION(\"After opening bracket\") {\n      DeserializationError err = deserializeJson(doc, \"[\");\n\n      REQUIRE(err == DeserializationError::IncompleteInput);\n    }\n\n    SECTION(\"After value\") {\n      DeserializationError err = deserializeJson(doc, \"[1\");\n\n      REQUIRE(err == DeserializationError::IncompleteInput);\n    }\n\n    SECTION(\"After comma\") {\n      DeserializationError err = deserializeJson(doc, \"[1,\");\n\n      REQUIRE(err == DeserializationError::IncompleteInput);\n    }\n  }\n\n  SECTION(\"Premature end of input\") {\n    const char* input = \"[1,2]\";\n\n    SECTION(\"After opening bracket\") {\n      DeserializationError err = deserializeJson(doc, input, 1);\n\n      REQUIRE(err == DeserializationError::IncompleteInput);\n    }\n\n    SECTION(\"After value\") {\n      DeserializationError err = deserializeJson(doc, input, 2);\n\n      REQUIRE(err == DeserializationError::IncompleteInput);\n    }\n\n    SECTION(\"After comma\") {\n      DeserializationError err = deserializeJson(doc, input, 3);\n\n      REQUIRE(err == DeserializationError::IncompleteInput);\n    }\n  }\n\n  SECTION(\"Misc\") {\n    SECTION(\"Nested objects\") {\n      char jsonString[] =\n          \" [ { \\\"a\\\" : 1 , \\\"b\\\" : 2 } , { \\\"c\\\" : 3 , \\\"d\\\" : 4 } ] \";\n\n      DeserializationError err = deserializeJson(doc, jsonString);\n      JsonArray arr = doc.as<JsonArray>();\n\n      JsonObject object1 = arr[0];\n      const JsonObject object2 = arr[1];\n      JsonObject object3 = arr[2];\n\n      REQUIRE(err == DeserializationError::Ok);\n\n      REQUIRE(object1.isNull() == false);\n      REQUIRE(object2.isNull() == false);\n      REQUIRE(object3.isNull() == true);\n\n      REQUIRE(2 == object1.size());\n      REQUIRE(2 == object2.size());\n      REQUIRE(0 == object3.size());\n\n      REQUIRE(1 == object1[\"a\"].as<int>());\n      REQUIRE(2 == object1[\"b\"].as<int>());\n      REQUIRE(3 == object2[\"c\"].as<int>());\n      REQUIRE(4 == object2[\"d\"].as<int>());\n      REQUIRE(0 == object3[\"e\"].as<int>());\n    }\n  }\n\n  SECTION(\"Should clear the JsonArray\") {\n    deserializeJson(doc, \"[1,2,3,4]\");\n    spy.clearLog();\n\n    deserializeJson(doc, \"[]\");\n\n    JsonArray arr = doc.as<JsonArray>();\n    REQUIRE(arr.size() == 0);\n    REQUIRE(spy.log() == AllocatorLog{\n                             Deallocate(sizeofArray(4)),\n                         });\n  }\n}\n\nTEST_CASE(\"deserialize JSON array under memory constraints\") {\n  TimebombAllocator timebomb(100);\n  SpyingAllocator spy(&timebomb);\n  JsonDocument doc(&spy);\n\n  SECTION(\"empty array requires no allocation\") {\n    timebomb.setCountdown(0);\n    char input[] = \"[]\";\n\n    DeserializationError err = deserializeJson(doc, input);\n\n    REQUIRE(err == DeserializationError::Ok);\n  }\n\n  SECTION(\"allocation of pool list fails\") {\n    timebomb.setCountdown(0);\n    char input[] = \"[1]\";\n\n    DeserializationError err = deserializeJson(doc, input);\n\n    REQUIRE(err == DeserializationError::NoMemory);\n    REQUIRE(doc.as<std::string>() == \"[]\");\n  }\n\n  SECTION(\"allocation of pool fails\") {\n    timebomb.setCountdown(0);\n    char input[] = \"[1]\";\n\n    DeserializationError err = deserializeJson(doc, input);\n\n    REQUIRE(err == DeserializationError::NoMemory);\n    REQUIRE(doc.as<std::string>() == \"[]\");\n  }\n\n  SECTION(\"allocation of string fails in array\") {\n    timebomb.setCountdown(1);\n    char input[] = \"[0,\\\"hi!\\\"]\";\n\n    DeserializationError err = deserializeJson(doc, input);\n\n    REQUIRE(err == DeserializationError::NoMemory);\n    REQUIRE(doc.as<std::string>() == \"[0,null]\");\n  }\n\n  SECTION(\"don't store space characters\") {\n    deserializeJson(doc, \"  [ \\\"1234567\\\" ] \");\n\n    REQUIRE(spy.log() ==\n            AllocatorLog{\n                Allocate(sizeofPool()),\n                Allocate(sizeofStringBuffer()),\n                Reallocate(sizeofStringBuffer(), sizeofString(\"1234567\")),\n                Reallocate(sizeofPool(), sizeofArray(1)),\n            });\n  }\n}\n"
  },
  {
    "path": "extras/tests/JsonDeserializer/destination_types.cpp",
    "content": "// ArduinoJson - https://arduinojson.org\n// Copyright © 2014-2025, Benoit BLANCHON\n// MIT License\n\n#include <ArduinoJson.h>\n\n#include <catch.hpp>\n#include <string>\n\n#include \"Allocators.hpp\"\n#include \"Literals.hpp\"\n\nusing ArduinoJson::detail::sizeofArray;\nusing ArduinoJson::detail::sizeofObject;\n\nTEST_CASE(\"deserializeJson(JsonDocument&)\") {\n  SpyingAllocator spy;\n  JsonDocument doc(&spy);\n  doc.add(\"hello\"_s);\n  spy.clearLog();\n\n  auto err = deserializeJson(doc, \"[42]\");\n\n  REQUIRE(err == DeserializationError::Ok);\n  REQUIRE(doc.as<std::string>() == \"[42]\");\n  REQUIRE(spy.log() == AllocatorLog{\n                           Deallocate(sizeofPool()),\n                           Deallocate(sizeofString(\"hello\")),\n                           Allocate(sizeofPool()),\n                           Reallocate(sizeofPool(), sizeofArray(1)),\n                       });\n}\n\nTEST_CASE(\"deserializeJson(JsonVariant)\") {\n  SECTION(\"variant is bound\") {\n    SpyingAllocator spy;\n    JsonDocument doc(&spy);\n    doc.add(\"hello\"_s);\n    spy.clearLog();\n\n    JsonVariant variant = doc[0];\n\n    auto err = deserializeJson(variant, \"[42]\");\n\n    REQUIRE(err == DeserializationError::Ok);\n    REQUIRE(doc.as<std::string>() == \"[[42]]\");\n    REQUIRE(spy.log() == AllocatorLog{\n                             Deallocate(sizeofString(\"hello\")),\n                         });\n  }\n\n  SECTION(\"variant is unbound\") {\n    JsonVariant variant;\n\n    auto err = deserializeJson(variant, \"[42]\");\n\n    REQUIRE(err == DeserializationError::NoMemory);\n  }\n}\n\nTEST_CASE(\"deserializeJson(ElementProxy)\") {\n  SpyingAllocator spy;\n  JsonDocument doc(&spy);\n  doc.add(\"hello\"_s);\n  spy.clearLog();\n\n  SECTION(\"element already exists\") {\n    auto err = deserializeJson(doc[0], \"[42]\");\n\n    REQUIRE(err == DeserializationError::Ok);\n    REQUIRE(doc.as<std::string>() == \"[[42]]\");\n    REQUIRE(spy.log() == AllocatorLog{\n                             Deallocate(sizeofString(\"hello\")),\n                         });\n  }\n\n  SECTION(\"element must be created\") {\n    auto err = deserializeJson(doc[1], \"[42]\");\n\n    REQUIRE(err == DeserializationError::Ok);\n    REQUIRE(doc.as<std::string>() == \"[\\\"hello\\\",[42]]\");\n    REQUIRE(spy.log() == AllocatorLog{});\n  }\n}\n\nTEST_CASE(\"deserializeJson(MemberProxy)\") {\n  SpyingAllocator spy;\n  JsonDocument doc(&spy);\n  doc[\"hello\"_s] = \"world\"_s;\n  spy.clearLog();\n\n  SECTION(\"member already exists\") {\n    auto err = deserializeJson(doc[\"hello\"], \"[42]\");\n\n    REQUIRE(err == DeserializationError::Ok);\n    REQUIRE(doc.as<std::string>() == \"{\\\"hello\\\":[42]}\");\n    REQUIRE(spy.log() == AllocatorLog{\n                             Deallocate(sizeofString(\"world\")),\n                         });\n  }\n\n  SECTION(\"member must be created exists\") {\n    auto err = deserializeJson(doc[\"value\"], \"[42]\");\n\n    REQUIRE(err == DeserializationError::Ok);\n    REQUIRE(doc.as<std::string>() == \"{\\\"hello\\\":\\\"world\\\",\\\"value\\\":[42]}\");\n    REQUIRE(spy.log() == AllocatorLog{\n                             Allocate(sizeofString(\"value\")),\n                         });\n  }\n}\n"
  },
  {
    "path": "extras/tests/JsonDeserializer/errors.cpp",
    "content": "// ArduinoJson - https://arduinojson.org\n// Copyright © 2014-2025, Benoit BLANCHON\n// MIT License\n\n#define ARDUINOJSON_DECODE_UNICODE 1\n#include <ArduinoJson.h>\n#include <catch.hpp>\n\n#include \"Allocators.hpp\"\n\nTEST_CASE(\"deserializeJson() returns IncompleteInput\") {\n  const char* testCases[] = {\n      // strings\n      \"\\\"\\\\\",\n      \"\\\"hello\",\n      \"\\'hello\",\n      // unicode\n      \"'\\\\u\",\n      \"'\\\\u00\",\n      \"'\\\\u000\",\n      // false\n      \"f\",\n      \"fa\",\n      \"fal\",\n      \"fals\",\n      // true\n      \"t\",\n      \"tr\",\n      \"tru\",\n      // null\n      \"n\",\n      \"nu\",\n      \"nul\",\n      // object\n      \"{\",\n      \"{a\",\n      \"{a:\",\n      \"{a:1\",\n      \"{a:1,\",\n      \"{a:1,b\",\n      \"{a:1,b:\",\n  };\n\n  for (auto input : testCases) {\n    SECTION(input) {\n      JsonDocument doc;\n      REQUIRE(deserializeJson(doc, input) ==\n              DeserializationError::IncompleteInput);\n    }\n  }\n}\n\nTEST_CASE(\"deserializeJson() returns InvalidInput\") {\n  const char* testCases[] = {\n      // unicode\n      \"'\\\\u'\", \"'\\\\u000g'\", \"'\\\\u000'\", \"'\\\\u000G'\", \"'\\\\u000/'\", \"\\\\x1234\",\n      // numbers\n      \"6a9\", \"1,\", \"2]\", \"3}\",\n      // constants\n      \"nulL\", \"tru3\", \"fals3\",\n      // garbage\n      \"%*$£¤\"};\n\n  for (auto input : testCases) {\n    SECTION(input) {\n      JsonDocument doc;\n      REQUIRE(deserializeJson(doc, input) ==\n              DeserializationError::InvalidInput);\n    }\n  }\n}\n\nTEST_CASE(\"deserializeJson() oversees some edge cases\") {\n  const char* testCases[] = {\n      \"'\\\\ud83d'\",         // leading surrogate without a trailing surrogate\n      \"'\\\\udda4'\",         // trailing surrogate without a leading surrogate\n      \"'\\\\ud83d\\\\ud83d'\",  // two leading surrogates\n  };\n\n  for (auto input : testCases) {\n    SECTION(input) {\n      JsonDocument doc;\n      REQUIRE(deserializeJson(doc, input) == DeserializationError::Ok);\n    }\n  }\n}\n\nTEST_CASE(\"deserializeJson() returns EmptyInput\") {\n  JsonDocument doc;\n\n  SECTION(\"null\") {\n    auto err = deserializeJson(doc, static_cast<const char*>(0));\n    REQUIRE(err == DeserializationError::EmptyInput);\n  }\n\n  SECTION(\"Empty string\") {\n    auto err = deserializeJson(doc, \"\");\n    REQUIRE(err == DeserializationError::EmptyInput);\n  }\n\n  SECTION(\"Only spaces\") {\n    auto err = deserializeJson(doc, \"  \\t\\n\\r\");\n    REQUIRE(err == DeserializationError::EmptyInput);\n  }\n}\n\nTEST_CASE(\"deserializeJson() returns NoMemory if string length overflows\") {\n  JsonDocument doc;\n  auto maxLength = ArduinoJson::detail::StringNode::maxLength;\n\n  SECTION(\"max length should succeed\") {\n    auto err = deserializeJson(doc, \"\\\"\" + std::string(maxLength, 'a') + \"\\\"\");\n\n    REQUIRE(err == DeserializationError::Ok);\n  }\n\n  SECTION(\"one above max length should fail\") {\n    auto err =\n        deserializeJson(doc, \"\\\"\" + std::string(maxLength + 1, 'a') + \"\\\"\");\n    REQUIRE(err == DeserializationError::NoMemory);\n  }\n}\n\nTEST_CASE(\"deserializeJson() returns NoMemory if 8-bit slot allocation fails\") {\n  JsonDocument doc(FailingAllocator::instance());\n\n  SECTION(\"uint32_t should pass\") {\n    auto err = deserializeJson(doc, \"4294967295\");\n\n    REQUIRE(err == DeserializationError::Ok);\n  }\n\n  SECTION(\"uint64_t should fail\") {\n    auto err = deserializeJson(doc, \"18446744073709551615\");\n\n    REQUIRE(err == DeserializationError::NoMemory);\n  }\n\n  SECTION(\"int32_t should pass\") {\n    auto err = deserializeJson(doc, \"-2147483648\");\n\n    REQUIRE(err == DeserializationError::Ok);\n  }\n\n  SECTION(\"int64_t should fail\") {\n    auto err = deserializeJson(doc, \"-9223372036854775808\");\n\n    REQUIRE(err == DeserializationError::NoMemory);\n  }\n\n  SECTION(\"float should pass\") {\n    auto err = deserializeJson(doc, \"3.402823e38\");\n\n    REQUIRE(err == DeserializationError::Ok);\n  }\n\n  SECTION(\"double should fail\") {\n    auto err = deserializeJson(doc, \"1.7976931348623157e308\");\n\n    REQUIRE(err == DeserializationError::NoMemory);\n  }\n}\n"
  },
  {
    "path": "extras/tests/JsonDeserializer/filter.cpp",
    "content": "// ArduinoJson - https://arduinojson.org\n// Copyright © 2014-2025, Benoit BLANCHON\n// MIT License\n\n#define ARDUINOJSON_ENABLE_COMMENTS 1\n#include <ArduinoJson.h>\n#include <catch.hpp>\n\n#include <sstream>\n#include <string>\n\n#include \"Allocators.hpp\"\n#include \"Literals.hpp\"\n\nusing ArduinoJson::detail::sizeofArray;\nusing ArduinoJson::detail::sizeofObject;\n\nTEST_CASE(\"Filtering\") {\n  struct TestCase {\n    const char* description;\n    const char* input;\n    const char* filter;\n    uint8_t nestingLimit;\n    DeserializationError error;\n    const char* output;\n    size_t memoryUsage;\n  };\n\n  TestCase testCases[] = {\n      {\n          \"Input is object, filter is null\",  // description\n          \"{\\\"hello\\\":\\\"world\\\"}\",            // input\n          \"null\",                             // filter\n          10,                                 // nestingLimit\n          DeserializationError::Ok,           // error\n          \"null\",                             // output\n          0,                                  // memoryUsage\n      },\n      {\n          \"Input is object, filter is false\",\n          \"{\\\"hello\\\":\\\"world\\\"}\",\n          \"false\",\n          10,\n          DeserializationError::Ok,\n          \"null\",\n          0,\n      },\n      {\n          \"Input is object, filter is true\",\n          \"{\\\"abcdefg\\\":\\\"hijklmn\\\"}\",\n          \"true\",\n          10,\n          DeserializationError::Ok,\n          \"{\\\"abcdefg\\\":\\\"hijklmn\\\"}\",\n          sizeofObject(1) + sizeofString(\"abcdefg\") + sizeofString(\"hijklmn\"),\n      },\n      {\n          \"Input is object, filter is empty object\",\n          \"{\\\"hello\\\":\\\"world\\\"}\",\n          \"{}\",\n          10,\n          DeserializationError::Ok,\n          \"{}\",\n          sizeofObject(0),\n      },\n      {\n          \"Input in an object, but filter wants an array\",\n          \"{\\\"hello\\\":\\\"world\\\"}\",\n          \"[]\",\n          10,\n          DeserializationError::Ok,\n          \"null\",\n          0,\n      },\n      {\n          \"Member is a string, but filter wants an array\",\n          \"{\\\"example\\\":\\\"example\\\"}\",\n          \"{\\\"example\\\":[true]}\",\n          10,\n          DeserializationError::Ok,\n          \"{\\\"example\\\":null}\",\n          sizeofObject(1) + sizeofString(\"example\"),\n      },\n      {\n          \"Member is a number, but filter wants an array\",\n          \"{\\\"example\\\":42}\",\n          \"{\\\"example\\\":[true]}\",\n          10,\n          DeserializationError::Ok,\n          \"{\\\"example\\\":null}\",\n          sizeofObject(1) + sizeofString(\"example\"),\n      },\n      {\n          \"Input is an array, but filter wants an object\",\n          \"[\\\"hello\\\",\\\"world\\\"]\",\n          \"{}\",\n          10,\n          DeserializationError::Ok,\n          \"null\",\n          0,\n      },\n      {\n          \"Input is a bool, but filter wants an object\",\n          \"true\",\n          \"{}\",\n          10,\n          DeserializationError::Ok,\n          \"null\",\n          0,\n      },\n      {\n          \"Input is a string, but filter wants an object\",\n          \"\\\"hello\\\"\",\n          \"{}\",\n          10,\n          DeserializationError::Ok,\n          \"null\",\n          0,\n      },\n      {\n          \"Skip an integer\",\n          \"{\\\"an_integer\\\":666,example:42}\",\n          \"{\\\"example\\\":true}\",\n          10,\n          DeserializationError::Ok,\n          \"{\\\"example\\\":42}\",\n          sizeofObject(1) + sizeofString(\"example\"),\n      },\n      {\n          \"Skip a float\",\n          \"{\\\"a_float\\\":12.34e-6,example:42}\",\n          \"{\\\"example\\\":true}\",\n          10,\n          DeserializationError::Ok,\n          \"{\\\"example\\\":42}\",\n          sizeofObject(1) + sizeofString(\"example\"),\n      },\n      {\n          \"Skip false\",\n          \"{\\\"a_bool\\\":false,example:42}\",\n          \"{\\\"example\\\":true}\",\n          10,\n          DeserializationError::Ok,\n          \"{\\\"example\\\":42}\",\n          sizeofObject(1) + sizeofString(\"example\"),\n      },\n      {\n          \"Skip true\",\n          \"{\\\"a_bool\\\":true,example:42}\",\n          \"{\\\"example\\\":true}\",\n          10,\n          DeserializationError::Ok,\n          \"{\\\"example\\\":42}\",\n          sizeofObject(1) + sizeofString(\"example\"),\n      },\n      {\n          \"Skip null\",\n          \"{\\\"a_bool\\\":null,example:42}\",\n          \"{\\\"example\\\":true}\",\n          10,\n          DeserializationError::Ok,\n          \"{\\\"example\\\":42}\",\n          sizeofObject(1) + sizeofString(\"example\"),\n      },\n      {\n          \"Skip a double-quoted string\",\n          \"{\\\"a_double_quoted_string\\\":\\\"hello\\\",example:42}\",\n          \"{\\\"example\\\":true}\",\n          10,\n          DeserializationError::Ok,\n          \"{\\\"example\\\":42}\",\n          sizeofObject(1) + sizeofString(\"example\"),\n      },\n      {\n          \"Skip a single-quoted string\",\n          \"{\\\"a_single_quoted_string\\\":'hello',example:42}\",\n          \"{\\\"example\\\":true}\",\n          10,\n          DeserializationError::Ok,\n          \"{\\\"example\\\":42}\",\n          sizeofObject(1) + sizeofString(\"example\"),\n      },\n      {\n          \"Skip an empty array\",\n          \"{\\\"an_empty_array\\\":[],example:42}\",\n          \"{\\\"example\\\":true}\",\n          10,\n          DeserializationError::Ok,\n          \"{\\\"example\\\":42}\",\n          sizeofObject(1) + sizeofString(\"example\"),\n      },\n      {\n          \"Skip an empty array with spaces in it\",\n          \"{\\\"an_empty_array\\\":[\\t],example:42}\",\n          \"{\\\"example\\\":true}\",\n          10,\n          DeserializationError::Ok,\n          \"{\\\"example\\\":42}\",\n          sizeofObject(1) + sizeofString(\"example\"),\n      },\n      {\n          \"Skip an array\",\n          \"{\\\"an_array\\\":[1,2,3],example:42}\",\n          \"{\\\"example\\\":true}\",\n          10,\n          DeserializationError::Ok,\n          \"{\\\"example\\\":42}\",\n          sizeofObject(1) + sizeofString(\"example\"),\n      },\n      {\n          \"Skip an array with spaces in it\",\n          \"{\\\"an_array\\\": [ 1 , 2 , 3 ] ,example:42}\",\n          \"{\\\"example\\\":true}\",\n          10,\n          DeserializationError::Ok,\n          \"{\\\"example\\\":42}\",\n          sizeofObject(1) + sizeofString(\"example\"),\n      },\n      {\n          \"Skip an empty nested object\",\n          \"{\\\"an_empty_object\\\":{},example:42}\",\n          \"{\\\"example\\\":true}\",\n          10,\n          DeserializationError::Ok,\n          \"{\\\"example\\\":42}\",\n          sizeofObject(1) + sizeofString(\"example\"),\n      },\n      {\n          \"Skip an empty nested object with spaces in it\",\n          \"{\\\"an_empty_object\\\":{    },example:42}\",\n          \"{\\\"example\\\":true}\",\n          10,\n          DeserializationError::Ok,\n          \"{\\\"example\\\":42}\",\n          sizeofObject(1) + sizeofString(\"example\"),\n      },\n      {\n          \"Skip a nested object\",\n          \"{\\\"an_object\\\":{a:1,'b':2,\\\"c\\\":3},example:42}\",\n          \"{\\\"example\\\":true}\",\n          10,\n          DeserializationError::Ok,\n          \"{\\\"example\\\":42}\",\n          sizeofObject(1) + sizeofString(\"example\"),\n      },\n      {\n          \"Skip an object with spaces in it\",\n          \"{\\\"an_object\\\" : { a : 1 , 'b' : 2 , \\\"c\\\" : 3 } ,example:42}\",\n          \"{\\\"example\\\":true}\",\n          10,\n          DeserializationError::Ok,\n          \"{\\\"example\\\":42}\",\n          sizeofObject(1) + sizeofString(\"example\"),\n      },\n      {\n          \"Skip a string in a nested object\",\n          \"{\\\"an_integer\\\": 0,\\\"example\\\":{\\\"type\\\":\\\"int\\\",\\\"outcome\\\":42}}\",\n          \"{\\\"example\\\":{\\\"outcome\\\":true}}\",\n          10,\n          DeserializationError::Ok,\n          \"{\\\"example\\\":{\\\"outcome\\\":42}}\",\n          2 * sizeofObject(1) + 2 * sizeofString(\"example\"),\n      },\n      {\n          \"wildcard\",\n          \"{\\\"example\\\":{\\\"type\\\":\\\"int\\\",\\\"outcome\\\":42}}\",\n          \"{\\\"*\\\":{\\\"outcome\\\":true}}\",\n          10,\n          DeserializationError::Ok,\n          \"{\\\"example\\\":{\\\"outcome\\\":42}}\",\n          2 * sizeofObject(1) + 2 * sizeofString(\"example\"),\n      },\n      {\n          \"exclusion filter (issue #1628)\",\n          \"{\\\"example\\\":1,\\\"ignored\\\":2}\",\n          \"{\\\"*\\\":true,\\\"ignored\\\":false}\",\n          10,\n          DeserializationError::Ok,\n          \"{\\\"example\\\":1}\",\n          sizeofObject(1) + sizeofString(\"example\"),\n      },\n      {\n          \"only the first element of array counts\",\n          \"[1,2,3]\",\n          \"[true, false]\",\n          10,\n          DeserializationError::Ok,\n          \"[1,2,3]\",\n          sizeofArray(3),\n      },\n      {\n          \"only the first element of array counts\",\n          \"[1,2,3]\",\n          \"[false, true]\",\n          10,\n          DeserializationError::Ok,\n          \"[]\",\n          sizeofArray(0),\n      },\n      {\n          \"filter members of object in array\",\n          \"[{\\\"example\\\":1,\\\"ignore\\\":2},{\\\"example\\\":3,\\\"ignore\\\":4}]\",\n          \"[{\\\"example\\\":true}]\",\n          10,\n          DeserializationError::Ok,\n          \"[{\\\"example\\\":1},{\\\"example\\\":3}]\",\n          sizeofArray(2) + 2 * sizeofObject(1) + sizeofString(\"example\"),\n      },\n      {\n          \"Unclosed single quote in skipped element\",\n          \"[',2,3]\",\n          \"[false,true]\",\n          10,\n          DeserializationError::IncompleteInput,\n          \"[]\",\n          sizeofArray(0),\n      },\n      {\n          \"Unclosed double quote in skipped element\",\n          \"[\\\",2,3]\",\n          \"[false,true]\",\n          10,\n          DeserializationError::IncompleteInput,\n          \"[]\",\n          sizeofArray(0),\n      },\n      {\n          \"Detect errors in skipped value\",\n          \"[!,2,\\\\]\",\n          \"[false]\",\n          10,\n          DeserializationError::InvalidInput,\n          \"[]\",\n          sizeofArray(0),\n      },\n      {\n          \"Detect incomplete string event if it's skipped\",\n          \"\\\"ABC\",\n          \"false\",\n          10,\n          DeserializationError::IncompleteInput,\n          \"null\",\n          0,\n      },\n      {\n          \"Detect incomplete string event if it's skipped\",\n          \"'ABC\",\n          \"false\",\n          10,\n          DeserializationError::IncompleteInput,\n          \"null\",\n          0,\n      },\n      {\n          \"Handle escaped quotes\",\n          \"'A\\\\'BC'\",\n          \"false\",\n          10,\n          DeserializationError::Ok,\n          \"null\",\n          0,\n      },\n      {\n          \"Handle escaped quotes\",\n          \"\\\"A\\\\\\\"BC\\\"\",\n          \"false\",\n          10,\n          DeserializationError::Ok,\n          \"null\",\n          0,\n      },\n      {\n          \"Detect incomplete string in presence of escaped quotes\",\n          \"'A\\\\'BC\",\n          \"false\",\n          10,\n          DeserializationError::IncompleteInput,\n          \"null\",\n          0,\n      },\n      {\n          \"Detect incomplete string in presence of escaped quotes\",\n          \"\\\"A\\\\\\\"BC\",\n          \"false\",\n          10,\n          DeserializationError::IncompleteInput,\n          \"null\",\n          0,\n      },\n      {\n          \"skip empty array\",\n          \"[]\",\n          \"false\",\n          10,\n          DeserializationError::Ok,\n          \"null\",\n          0,\n      },\n      {\n          \"Skip empty array with spaces\",\n          \" [ ] \",\n          \"false\",\n          10,\n          DeserializationError::Ok,\n          \"null\",\n          0,\n      },\n      {\n          \"Bubble up element error even if array is skipped\",\n          \"[1,'2,3]\",\n          \"false\",\n          10,\n          DeserializationError::IncompleteInput,\n          \"null\",\n          0,\n      },\n      {\n          \"Bubble up member error even if object is skipped\",\n          \"{'hello':'worl}\",\n          \"false\",\n          10,\n          DeserializationError::IncompleteInput,\n          \"null\",\n          0,\n      },\n      {\n          \"Bubble up colon error even if object is skipped\",\n          \"{'hello','world'}\",\n          \"false\",\n          10,\n          DeserializationError::InvalidInput,\n          \"null\",\n          0,\n      },\n      {\n          \"Bubble up key error even if object is skipped\",\n          \"{'hello:1}\",\n          \"false\",\n          10,\n          DeserializationError::IncompleteInput,\n          \"null\",\n          0,\n      },\n      {\n          \"Detect invalid value in skipped object\",\n          \"{'hello':!}\",\n          \"false\",\n          10,\n          DeserializationError::InvalidInput,\n          \"null\",\n          0,\n      },\n      {\n          \"Ignore invalid value in skipped object\",\n          \"{'hello':\\\\}\",\n          \"false\",\n          10,\n          DeserializationError::InvalidInput,\n          \"null\",\n          0,\n      },\n      {\n          \"Check nesting limit even for ignored objects\",\n          \"{}\",\n          \"false\",\n          0,\n          DeserializationError::TooDeep,\n          \"null\",\n          0,\n      },\n      {\n          \"Check nesting limit even for ignored objects\",\n          \"{'hello':{}}\",\n          \"false\",\n          1,\n          DeserializationError::TooDeep,\n          \"null\",\n          0,\n      },\n      {\n          \"Check nesting limit even for ignored values in objects\",\n          \"{'hello':{}}\",\n          \"{}\",\n          1,\n          DeserializationError::TooDeep,\n          \"{}\",\n          sizeofObject(0),\n      },\n      {\n          \"Check nesting limit even for ignored arrays\",\n          \"[]\",\n          \"false\",\n          0,\n          DeserializationError::TooDeep,\n          \"null\",\n          0,\n      },\n      {\n          \"Check nesting limit even for ignored arrays\",\n          \"[[]]\",\n          \"false\",\n          1,\n          DeserializationError::TooDeep,\n          \"null\",\n          0,\n      },\n      {\n          \"Check nesting limit even for ignored values in arrays\",\n          \"[[]]\",\n          \"[]\",\n          1,\n          DeserializationError::TooDeep,\n          \"[]\",\n          sizeofArray(0),\n      },\n      {\n          \"Supports back-slash at the end of skipped string\",\n          \"\\\"hell\\\\\",\n          \"false\",\n          1,\n          DeserializationError::IncompleteInput,\n          \"null\",\n          0,\n      },\n      {\n          \"Invalid comment at after an element in a skipped array\",\n          \"[1/]\",\n          \"false\",\n          10,\n          DeserializationError::InvalidInput,\n          \"null\",\n          0,\n      },\n      {\n          \"Incomplete comment at after an element in a skipped array\",\n          \"[1/*]\",\n          \"false\",\n          10,\n          DeserializationError::IncompleteInput,\n          \"null\",\n          0,\n      },\n      {\n          \"Missing comma in a skipped array\",\n          \"[1 2]\",\n          \"false\",\n          10,\n          DeserializationError::InvalidInput,\n          \"null\",\n          0,\n      },\n      {\n          \"Invalid comment at the beginning of array\",\n          \"[/1]\",\n          \"[false]\",\n          10,\n          DeserializationError::InvalidInput,\n          \"[]\",\n          sizeofArray(0),\n      },\n      {\n          \"Incomplete comment at the begining of an array\",\n          \"[/*]\",\n          \"[false]\",\n          10,\n          DeserializationError::IncompleteInput,\n          \"[]\",\n          sizeofArray(0),\n      },\n      {\n          \"Invalid comment before key\",\n          \"{/1:2}\",\n          \"{}\",\n          10,\n          DeserializationError::InvalidInput,\n          \"{}\",\n          sizeofObject(0),\n      },\n      {\n          \"Incomplete comment before key\",\n          \"{/*:2}\",\n          \"{}\",\n          10,\n          DeserializationError::IncompleteInput,\n          \"{}\",\n          sizeofObject(0),\n      },\n      {\n          \"Invalid comment after key\",\n          \"{\\\"example\\\"/1:2}\",\n          \"{}\",\n          10,\n          DeserializationError::InvalidInput,\n          \"{}\",\n          sizeofObject(0),\n      },\n      {\n          \"Incomplete comment after key\",\n          \"{\\\"example\\\"/*:2}\",\n          \"{}\",\n          10,\n          DeserializationError::IncompleteInput,\n          \"{}\",\n          sizeofObject(0),\n      },\n      {\n          \"Invalid comment after colon\",\n          \"{\\\"example\\\":/12}\",\n          \"{}\",\n          10,\n          DeserializationError::InvalidInput,\n          \"{}\",\n          sizeofObject(0),\n      },\n      {\n          \"Incomplete comment after colon\",\n          \"{\\\"example\\\":/*2}\",\n          \"{}\",\n          10,\n          DeserializationError::IncompleteInput,\n          \"{}\",\n          sizeofObject(0),\n      },\n      {\n          \"Comment next to an integer\",\n          \"{\\\"ignore\\\":1//,\\\"example\\\":2\\n}\",\n          \"{\\\"example\\\":true}\",\n          10,\n          DeserializationError::Ok,\n          \"{}\",\n          sizeofObject(0),\n      },\n      {\n          \"Invalid comment after opening brace of a skipped object\",\n          \"{/1:2}\",\n          \"false\",\n          10,\n          DeserializationError::InvalidInput,\n          \"null\",\n          0,\n      },\n      {\n          \"Incomplete after opening brace of a skipped object\",\n          \"{/*:2}\",\n          \"false\",\n          10,\n          DeserializationError::IncompleteInput,\n          \"null\",\n          0,\n      },\n      {\n          \"Invalid comment after key of a skipped object\",\n          \"{\\\"example\\\"/:2}\",\n          \"false\",\n          10,\n          DeserializationError::InvalidInput,\n          \"null\",\n          0,\n      },\n      {\n          \"Incomplete comment after key of a skipped object\",\n          \"{\\\"example\\\"/*:2}\",\n          \"false\",\n          10,\n          DeserializationError::IncompleteInput,\n          \"null\",\n          0,\n      },\n      {\n          \"Invalid comment after value in a skipped object\",\n          \"{\\\"example\\\":2/}\",\n          \"false\",\n          10,\n          DeserializationError::InvalidInput,\n          \"null\",\n          0,\n      },\n      {\n          \"Incomplete comment after value of a skipped object\",\n          \"{\\\"example\\\":2/*}\",\n          \"false\",\n          10,\n          DeserializationError::IncompleteInput,\n          \"null\",\n          0,\n      },\n      {\n          \"Incomplete comment after comma in skipped object\",\n          \"{\\\"example\\\":2,/*}\",\n          \"false\",\n          10,\n          DeserializationError::IncompleteInput,\n          \"null\",\n          0,\n      },\n      {\n          \"NUL character in key\",\n          \"{\\\"x\\\":0,\\\"x\\\\u0000a\\\":1,\\\"x\\\\u0000b\\\":2}\",\n          \"{\\\"x\\\\u0000a\\\":true}\",\n          10,\n          DeserializationError::Ok,\n          \"{\\\"x\\\\u0000a\\\":1}\",\n          sizeofObject(1) + sizeofString(\"x?a\"),\n      },\n  };\n\n  for (auto& tc : testCases) {\n    SECTION(tc.description) {\n      SpyingAllocator spy;\n      JsonDocument filter;\n      JsonDocument doc(&spy);\n\n      REQUIRE(deserializeJson(filter, tc.filter) == DeserializationError::Ok);\n\n      CHECK(deserializeJson(\n                doc, tc.input, DeserializationOption::Filter(filter),\n                DeserializationOption::NestingLimit(tc.nestingLimit)) ==\n            tc.error);\n\n      CHECK(doc.as<std::string>() == tc.output);\n\n      doc.shrinkToFit();\n      CHECK(spy.allocatedBytes() == tc.memoryUsage);\n    }\n  }\n}\n\nTEST_CASE(\"Overloads\") {\n  JsonDocument doc;\n  JsonDocument filter;\n\n  using namespace DeserializationOption;\n\n  // deserializeJson(..., Filter)\n\n  SECTION(\"const char*, Filter\") {\n    deserializeJson(doc, \"{}\", Filter(filter));\n  }\n\n  SECTION(\"const char*, size_t, Filter\") {\n    deserializeJson(doc, \"{}\", 2, Filter(filter));\n  }\n\n  SECTION(\"const std::string&, Filter\") {\n    deserializeJson(doc, \"{}\"_s, Filter(filter));\n  }\n\n  SECTION(\"std::istream&, Filter\") {\n    std::stringstream s(\"{}\");\n    deserializeJson(doc, s, Filter(filter));\n  }\n\n#ifdef HAS_VARIABLE_LENGTH_ARRAY\n  SECTION(\"char[n], Filter\") {\n    size_t i = 4;\n    char vla[i];\n    strcpy(vla, \"{}\");\n    deserializeJson(doc, vla, Filter(filter));\n  }\n#endif\n\n  // deserializeJson(..., Filter, NestingLimit)\n\n  SECTION(\"const char*, Filter, NestingLimit\") {\n    deserializeJson(doc, \"{}\", Filter(filter), NestingLimit(5));\n  }\n\n  SECTION(\"const char*, size_t, Filter, NestingLimit\") {\n    deserializeJson(doc, \"{}\", 2, Filter(filter), NestingLimit(5));\n  }\n\n  SECTION(\"const std::string&, Filter, NestingLimit\") {\n    deserializeJson(doc, \"{}\"_s, Filter(filter), NestingLimit(5));\n  }\n\n  SECTION(\"std::istream&, Filter, NestingLimit\") {\n    std::stringstream s(\"{}\");\n    deserializeJson(doc, s, Filter(filter), NestingLimit(5));\n  }\n\n#ifdef HAS_VARIABLE_LENGTH_ARRAY\n  SECTION(\"char[n], Filter, NestingLimit\") {\n    size_t i = 4;\n    char vla[i];\n    strcpy(vla, \"{}\");\n    deserializeJson(doc, vla, Filter(filter), NestingLimit(5));\n  }\n#endif\n\n  // deserializeJson(..., NestingLimit, Filter)\n\n  SECTION(\"const char*, NestingLimit, Filter\") {\n    deserializeJson(doc, \"{}\", NestingLimit(5), Filter(filter));\n  }\n\n  SECTION(\"const char*, size_t, NestingLimit, Filter\") {\n    deserializeJson(doc, \"{}\", 2, NestingLimit(5), Filter(filter));\n  }\n\n  SECTION(\"const std::string&, NestingLimit, Filter\") {\n    deserializeJson(doc, \"{}\"_s, NestingLimit(5), Filter(filter));\n  }\n\n  SECTION(\"std::istream&, NestingLimit, Filter\") {\n    std::stringstream s(\"{}\");\n    deserializeJson(doc, s, NestingLimit(5), Filter(filter));\n  }\n\n#ifdef HAS_VARIABLE_LENGTH_ARRAY\n  SECTION(\"char[n], NestingLimit, Filter\") {\n    size_t i = 4;\n    char vla[i];\n    strcpy(vla, \"{}\");\n    deserializeJson(doc, vla, NestingLimit(5), Filter(filter));\n  }\n#endif\n}\n\nTEST_CASE(\"shrink filter\") {\n  JsonDocument doc;\n  SpyingAllocator spy;\n  JsonDocument filter(&spy);\n  filter[\"a\"] = true;\n  spy.clearLog();\n\n  deserializeJson(doc, \"{}\", DeserializationOption::Filter(filter));\n\n  REQUIRE(spy.log() == AllocatorLog{\n                           Reallocate(sizeofPool(), sizeofObject(1)),\n                       });\n}\n"
  },
  {
    "path": "extras/tests/JsonDeserializer/input_types.cpp",
    "content": "// ArduinoJson - https://arduinojson.org\n// Copyright © 2014-2025, Benoit BLANCHON\n// MIT License\n\n#include <ArduinoJson.h>\n\n#include <catch.hpp>\n#include <sstream>\n\n#include \"Allocators.hpp\"\n#include \"CustomReader.hpp\"\n#include \"Literals.hpp\"\n\nusing ArduinoJson::detail::sizeofObject;\n\nTEST_CASE(\"deserializeJson(char*)\") {\n  SpyingAllocator spy;\n  JsonDocument doc(&spy);\n\n  char input[] = \"{\\\"hello\\\":\\\"world\\\"}\";\n\n  DeserializationError err = deserializeJson(doc, input);\n\n  REQUIRE(err == DeserializationError::Ok);\n\n  REQUIRE(spy.log() ==\n          AllocatorLog{\n              Allocate(sizeofStringBuffer()),\n              Allocate(sizeofPool()),\n              Reallocate(sizeofStringBuffer(), sizeofString(\"hello\")),\n              Allocate(sizeofStringBuffer()),\n              Reallocate(sizeofStringBuffer(), sizeofString(\"world\")),\n              Reallocate(sizeofPool(), sizeofObject(1)),\n          });\n}\n\nTEST_CASE(\"deserializeJson(unsigned char*, unsigned int)\") {  // issue #1897\n  JsonDocument doc;\n\n  unsigned char input[] = \"{\\\"hello\\\":\\\"world\\\"}\";\n  unsigned char* input_ptr = input;\n  unsigned int size = sizeof(input);\n\n  DeserializationError err = deserializeJson(doc, input_ptr, size);\n\n  REQUIRE(err == DeserializationError::Ok);\n}\n\nTEST_CASE(\"deserializeJson(uint8_t*, size_t)\") {  // issue #1898\n  JsonDocument doc;\n\n  uint8_t input[] = \"{\\\"hello\\\":\\\"world\\\"}\";\n  uint8_t* input_ptr = input;\n  size_t size = sizeof(input);\n\n  DeserializationError err = deserializeJson(doc, input_ptr, size);\n\n  REQUIRE(err == DeserializationError::Ok);\n}\n\nTEST_CASE(\"deserializeJson(const std::string&)\") {\n  JsonDocument doc;\n\n  SECTION(\"should accept const string\") {\n    const std::string input(\"[42]\");\n\n    DeserializationError err = deserializeJson(doc, input);\n\n    REQUIRE(err == DeserializationError::Ok);\n  }\n\n  SECTION(\"should accept temporary string\") {\n    DeserializationError err = deserializeJson(doc, \"[42]\"_s);\n\n    REQUIRE(err == DeserializationError::Ok);\n  }\n\n  SECTION(\"should duplicate content\") {\n    std::string input(\"[\\\"hello\\\"]\");\n\n    DeserializationError err = deserializeJson(doc, input);\n    input[2] = 'X';  // alter the string tomake sure we made a copy\n\n    JsonArray array = doc.as<JsonArray>();\n    REQUIRE(err == DeserializationError::Ok);\n    REQUIRE(\"hello\"_s == array[0]);\n  }\n}\n\nTEST_CASE(\"deserializeJson(std::istream&)\") {\n  JsonDocument doc;\n\n  SECTION(\"array\") {\n    std::istringstream json(\" [ 42 ] \");\n\n    DeserializationError err = deserializeJson(doc, json);\n    JsonArray arr = doc.as<JsonArray>();\n\n    REQUIRE(err == DeserializationError::Ok);\n    REQUIRE(1 == arr.size());\n    REQUIRE(42 == arr[0]);\n  }\n\n  SECTION(\"object\") {\n    std::istringstream json(\" { hello : 'world' }\");\n\n    DeserializationError err = deserializeJson(doc, json);\n    JsonObject obj = doc.as<JsonObject>();\n\n    REQUIRE(err == DeserializationError::Ok);\n    REQUIRE(1 == obj.size());\n    REQUIRE(\"world\"_s == obj[\"hello\"]);\n  }\n\n  SECTION(\"Should not read after the closing brace of an empty object\") {\n    std::istringstream json(\"{}123\");\n\n    deserializeJson(doc, json);\n\n    REQUIRE('1' == char(json.get()));\n  }\n\n  SECTION(\"Should not read after the closing brace\") {\n    std::istringstream json(\"{\\\"hello\\\":\\\"world\\\"}123\");\n\n    deserializeJson(doc, json);\n\n    REQUIRE('1' == char(json.get()));\n  }\n\n  SECTION(\"Should not read after the closing bracket of an empty array\") {\n    std::istringstream json(\"[]123\");\n\n    deserializeJson(doc, json);\n\n    REQUIRE('1' == char(json.get()));\n  }\n\n  SECTION(\"Should not read after the closing bracket\") {\n    std::istringstream json(\"[\\\"hello\\\",\\\"world\\\"]123\");\n\n    deserializeJson(doc, json);\n\n    REQUIRE('1' == char(json.get()));\n  }\n\n  SECTION(\"Should not read after the closing quote\") {\n    std::istringstream json(\"\\\"hello\\\"123\");\n\n    deserializeJson(doc, json);\n\n    REQUIRE('1' == char(json.get()));\n  }\n}\n\n#ifdef HAS_VARIABLE_LENGTH_ARRAY\nTEST_CASE(\"deserializeJson(VLA)\") {\n  size_t i = 9;\n  char vla[i];\n  strcpy(vla, \"{\\\"a\\\":42}\");\n\n  JsonDocument doc;\n  DeserializationError err = deserializeJson(doc, vla);\n\n  REQUIRE(err == DeserializationError::Ok);\n}\n#endif\n\nTEST_CASE(\"deserializeJson(CustomReader)\") {\n  JsonDocument doc;\n  CustomReader reader(\"[4,2]\");\n  DeserializationError err = deserializeJson(doc, reader);\n\n  REQUIRE(err == DeserializationError::Ok);\n  REQUIRE(doc.size() == 2);\n  REQUIRE(doc[0] == 4);\n  REQUIRE(doc[1] == 2);\n}\n\nTEST_CASE(\"deserializeJson(JsonDocument&, MemberProxy)\") {\n  JsonDocument doc1;\n  doc1[\"payload\"] = \"[4,2]\";\n\n  JsonDocument doc2;\n  DeserializationError err = deserializeJson(doc2, doc1[\"payload\"]);\n\n  REQUIRE(err == DeserializationError::Ok);\n  REQUIRE(doc2.size() == 2);\n  REQUIRE(doc2[0] == 4);\n  REQUIRE(doc2[1] == 2);\n}\n\nTEST_CASE(\"deserializeJson(JsonDocument&, JsonVariant)\") {\n  JsonDocument doc1;\n  doc1[\"payload\"] = \"[4,2]\";\n\n  JsonDocument doc2;\n  DeserializationError err =\n      deserializeJson(doc2, doc1[\"payload\"].as<JsonVariant>());\n\n  REQUIRE(err == DeserializationError::Ok);\n  REQUIRE(doc2.size() == 2);\n  REQUIRE(doc2[0] == 4);\n  REQUIRE(doc2[1] == 2);\n}\n\nTEST_CASE(\"deserializeJson(JsonDocument&, JsonVariantConst)\") {\n  JsonDocument doc1;\n  doc1[\"payload\"] = \"[4,2]\";\n\n  JsonDocument doc2;\n  DeserializationError err =\n      deserializeJson(doc2, doc1[\"payload\"].as<JsonVariantConst>());\n\n  REQUIRE(err == DeserializationError::Ok);\n  REQUIRE(doc2.size() == 2);\n  REQUIRE(doc2[0] == 4);\n  REQUIRE(doc2[1] == 2);\n}\n\nTEST_CASE(\"deserializeJson(JsonDocument&, ElementProxy)\") {\n  JsonDocument doc1;\n  doc1[0] = \"[4,2]\";\n\n  JsonDocument doc2;\n  DeserializationError err = deserializeJson(doc2, doc1[0]);\n\n  REQUIRE(err == DeserializationError::Ok);\n  REQUIRE(doc2.size() == 2);\n  REQUIRE(doc2[0] == 4);\n  REQUIRE(doc2[1] == 2);\n}\n"
  },
  {
    "path": "extras/tests/JsonDeserializer/misc.cpp",
    "content": "// ArduinoJson - https://arduinojson.org\n// Copyright © 2014-2025, Benoit BLANCHON\n// MIT License\n\n#include <ArduinoJson.h>\n#include <catch.hpp>\n\n#include \"Allocators.hpp\"\n\nusing ArduinoJson::detail::sizeofArray;\n\nTEST_CASE(\"deserializeJson() misc cases\") {\n  SpyingAllocator spy;\n  JsonDocument doc(&spy);\n\n  SECTION(\"null\") {\n    DeserializationError err = deserializeJson(doc, \"null\");\n    REQUIRE(err == DeserializationError::Ok);\n    REQUIRE(doc.is<float>() == false);\n  }\n\n  SECTION(\"true\") {\n    DeserializationError err = deserializeJson(doc, \"true\");\n\n    REQUIRE(err == DeserializationError::Ok);\n    REQUIRE(doc.is<bool>());\n    REQUIRE(doc.as<bool>() == true);\n  }\n\n  SECTION(\"false\") {\n    DeserializationError err = deserializeJson(doc, \"false\");\n\n    REQUIRE(err == DeserializationError::Ok);\n    REQUIRE(doc.is<bool>());\n    REQUIRE(doc.as<bool>() == false);\n  }\n\n  SECTION(\"Should clear the JsonVariant\") {\n    deserializeJson(doc, \"[1,2,3]\");\n    spy.clearLog();\n\n    deserializeJson(doc, \"{}\");\n\n    REQUIRE(doc.is<JsonObject>());\n    REQUIRE(spy.log() == AllocatorLog{\n                             Deallocate(sizeofArray(3)),\n                         });\n  }\n}\n"
  },
  {
    "path": "extras/tests/JsonDeserializer/nestingLimit.cpp",
    "content": "// ArduinoJson - https://arduinojson.org\n// Copyright © 2014-2025, Benoit BLANCHON\n// MIT License\n\n#include <ArduinoJson.h>\n#include <catch.hpp>\n\n#include <sstream>\n\n#include \"Literals.hpp\"\n\n#define SHOULD_WORK(expression) REQUIRE(DeserializationError::Ok == expression);\n#define SHOULD_FAIL(expression) \\\n  REQUIRE(DeserializationError::TooDeep == expression);\n\nTEST_CASE(\"JsonDeserializer nesting\") {\n  JsonDocument doc;\n\n  SECTION(\"Input = const char*\") {\n    SECTION(\"limit = 0\") {\n      DeserializationOption::NestingLimit nesting(0);\n      SHOULD_WORK(deserializeJson(doc, \"\\\"toto\\\"\", nesting));\n      SHOULD_WORK(deserializeJson(doc, \"123\", nesting));\n      SHOULD_WORK(deserializeJson(doc, \"true\", nesting));\n      SHOULD_FAIL(deserializeJson(doc, \"[]\", nesting));\n      SHOULD_FAIL(deserializeJson(doc, \"{}\", nesting));\n      SHOULD_FAIL(deserializeJson(doc, \"[\\\"toto\\\"]\", nesting));\n      SHOULD_FAIL(deserializeJson(doc, \"{\\\"toto\\\":1}\", nesting));\n    }\n\n    SECTION(\"limit = 1\") {\n      DeserializationOption::NestingLimit nesting(1);\n      SHOULD_WORK(deserializeJson(doc, \"[\\\"toto\\\"]\", nesting));\n      SHOULD_WORK(deserializeJson(doc, \"{\\\"toto\\\":1}\", nesting));\n      SHOULD_FAIL(deserializeJson(doc, \"{\\\"toto\\\":{}}\", nesting));\n      SHOULD_FAIL(deserializeJson(doc, \"{\\\"toto\\\":[]}\", nesting));\n      SHOULD_FAIL(deserializeJson(doc, \"[[\\\"toto\\\"]]\", nesting));\n      SHOULD_FAIL(deserializeJson(doc, \"[{\\\"toto\\\":1}]\", nesting));\n    }\n  }\n\n  SECTION(\"char* and size_t\") {\n    SECTION(\"limit = 0\") {\n      DeserializationOption::NestingLimit nesting(0);\n      SHOULD_WORK(deserializeJson(doc, \"\\\"toto\\\"\", 6, nesting));\n      SHOULD_WORK(deserializeJson(doc, \"123\", 3, nesting));\n      SHOULD_WORK(deserializeJson(doc, \"true\", 4, nesting));\n      SHOULD_FAIL(deserializeJson(doc, \"[]\", 2, nesting));\n      SHOULD_FAIL(deserializeJson(doc, \"{}\", 2, nesting));\n      SHOULD_FAIL(deserializeJson(doc, \"[\\\"toto\\\"]\", 8, nesting));\n      SHOULD_FAIL(deserializeJson(doc, \"{\\\"toto\\\":1}\", 10, nesting));\n    }\n\n    SECTION(\"limit = 1\") {\n      DeserializationOption::NestingLimit nesting(1);\n      SHOULD_WORK(deserializeJson(doc, \"[\\\"toto\\\"]\", 8, nesting));\n      SHOULD_WORK(deserializeJson(doc, \"{\\\"toto\\\":1}\", 10, nesting));\n      SHOULD_FAIL(deserializeJson(doc, \"{\\\"toto\\\":{}}\", 11, nesting));\n      SHOULD_FAIL(deserializeJson(doc, \"{\\\"toto\\\":[]}\", 11, nesting));\n      SHOULD_FAIL(deserializeJson(doc, \"[[\\\"toto\\\"]]\", 10, nesting));\n      SHOULD_FAIL(deserializeJson(doc, \"[{\\\"toto\\\":1}]\", 12, nesting));\n    }\n  }\n\n  SECTION(\"Input = std::string\") {\n    SECTION(\"limit = 0\") {\n      DeserializationOption::NestingLimit nesting(0);\n      SHOULD_WORK(deserializeJson(doc, \"\\\"toto\\\"\"_s, nesting));\n      SHOULD_WORK(deserializeJson(doc, \"123\"_s, nesting));\n      SHOULD_WORK(deserializeJson(doc, \"true\"_s, nesting));\n      SHOULD_FAIL(deserializeJson(doc, \"[]\"_s, nesting));\n      SHOULD_FAIL(deserializeJson(doc, \"{}\"_s, nesting));\n      SHOULD_FAIL(deserializeJson(doc, \"[\\\"toto\\\"]\"_s, nesting));\n      SHOULD_FAIL(deserializeJson(doc, \"{\\\"toto\\\":1}\"_s, nesting));\n    }\n\n    SECTION(\"limit = 1\") {\n      DeserializationOption::NestingLimit nesting(1);\n      SHOULD_WORK(deserializeJson(doc, \"[\\\"toto\\\"]\"_s, nesting));\n      SHOULD_WORK(deserializeJson(doc, \"{\\\"toto\\\":1}\"_s, nesting));\n      SHOULD_FAIL(deserializeJson(doc, \"{\\\"toto\\\":{}}\"_s, nesting));\n      SHOULD_FAIL(deserializeJson(doc, \"{\\\"toto\\\":[]}\"_s, nesting));\n      SHOULD_FAIL(deserializeJson(doc, \"[[\\\"toto\\\"]]\"_s, nesting));\n      SHOULD_FAIL(deserializeJson(doc, \"[{\\\"toto\\\":1}]\"_s, nesting));\n    }\n  }\n\n  SECTION(\"Input = std::istream\") {\n    SECTION(\"limit = 0\") {\n      DeserializationOption::NestingLimit nesting(0);\n      std::istringstream good(\"true\");\n      std::istringstream bad(\"[]\");\n      SHOULD_WORK(deserializeJson(doc, good, nesting));\n      SHOULD_FAIL(deserializeJson(doc, bad, nesting));\n    }\n\n    SECTION(\"limit = 1\") {\n      DeserializationOption::NestingLimit nesting(1);\n      std::istringstream good(\"[\\\"toto\\\"]\");\n      std::istringstream bad(\"{\\\"toto\\\":{}}\");\n      SHOULD_WORK(deserializeJson(doc, good, nesting));\n      SHOULD_FAIL(deserializeJson(doc, bad, nesting));\n    }\n  }\n}\n"
  },
  {
    "path": "extras/tests/JsonDeserializer/number.cpp",
    "content": "// ArduinoJson - https://arduinojson.org\n// Copyright © 2014-2025, Benoit BLANCHON\n// MIT License\n\n#define ARDUINOJSON_USE_LONG_LONG 0\n#define ARDUINOJSON_ENABLE_NAN 1\n#define ARDUINOJSON_ENABLE_INFINITY 1\n\n#include <ArduinoJson.h>\n#include <limits.h>\n#include <catch.hpp>\n\nnamespace my {\nusing ArduinoJson::detail::isinf;\nusing ArduinoJson::detail::isnan;\n}  // namespace my\n\nTEST_CASE(\"deserialize an integer\") {\n  JsonDocument doc;\n\n  SECTION(\"Integer\") {\n    SECTION(\"0\") {\n      DeserializationError err = deserializeJson(doc, \"0\");\n      REQUIRE(err == DeserializationError::Ok);\n      REQUIRE(doc.is<int>() == true);\n      REQUIRE(doc.as<int>() == 0);\n      REQUIRE(doc.as<std::string>() == \"0\");  // issue #808\n    }\n\n    SECTION(\"Negative\") {\n      DeserializationError err = deserializeJson(doc, \"-42\");\n\n      REQUIRE(err == DeserializationError::Ok);\n      REQUIRE(doc.is<int>());\n      REQUIRE_FALSE(doc.is<bool>());\n      REQUIRE(doc.as<int>() == -42);\n    }\n\n#if LONG_MAX == 2147483647\n    SECTION(\"LONG_MAX\") {\n      DeserializationError err = deserializeJson(doc, \"2147483647\");\n\n      REQUIRE(err == DeserializationError::Ok);\n      REQUIRE(doc.is<long>() == true);\n      REQUIRE(doc.as<long>() == LONG_MAX);\n    }\n\n    SECTION(\"LONG_MAX + 1\") {\n      DeserializationError err = deserializeJson(doc, \"2147483648\");\n\n      CAPTURE(LONG_MIN);\n      REQUIRE(err == DeserializationError::Ok);\n      REQUIRE(doc.is<long>() == false);\n      REQUIRE(doc.is<float>() == true);\n    }\n#endif\n\n#if LONG_MIN == -2147483648\n    SECTION(\"LONG_MIN\") {\n      DeserializationError err = deserializeJson(doc, \"-2147483648\");\n      REQUIRE(err == DeserializationError::Ok);\n      REQUIRE(doc.is<long>() == true);\n      REQUIRE(doc.as<long>() == LONG_MIN);\n    }\n\n    SECTION(\"LONG_MIN - 1\") {\n      DeserializationError err = deserializeJson(doc, \"-2147483649\");\n\n      REQUIRE(err == DeserializationError::Ok);\n      REQUIRE(doc.is<long>() == false);\n      REQUIRE(doc.is<float>() == true);\n    }\n#endif\n\n#if ULONG_MAX == 4294967295\n    SECTION(\"ULONG_MAX\") {\n      DeserializationError err = deserializeJson(doc, \"4294967295\");\n\n      REQUIRE(err == DeserializationError::Ok);\n      REQUIRE(doc.is<unsigned long>() == true);\n      REQUIRE(doc.as<unsigned long>() == ULONG_MAX);\n      REQUIRE(doc.is<long>() == false);\n    }\n\n    SECTION(\"ULONG_MAX + 1\") {\n      DeserializationError err = deserializeJson(doc, \"4294967296\");\n\n      REQUIRE(err == DeserializationError::Ok);\n      REQUIRE(doc.is<unsigned long>() == false);\n      REQUIRE(doc.is<float>() == true);\n    }\n#endif\n  }\n\n  SECTION(\"Floats\") {\n    SECTION(\"Double\") {\n      DeserializationError err = deserializeJson(doc, \"-1.23e+4\");\n\n      REQUIRE(err == DeserializationError::Ok);\n      REQUIRE_FALSE(doc.is<int>());\n      REQUIRE(doc.is<double>());\n      REQUIRE(doc.as<double>() == Approx(-1.23e+4));\n    }\n\n    SECTION(\"NaN\") {\n      DeserializationError err = deserializeJson(doc, \"NaN\");\n      REQUIRE(err == DeserializationError::Ok);\n      REQUIRE(doc.is<float>() == true);\n      REQUIRE(my::isnan(doc.as<float>()));\n    }\n\n    SECTION(\"Infinity\") {\n      DeserializationError err = deserializeJson(doc, \"Infinity\");\n      REQUIRE(err == DeserializationError::Ok);\n      REQUIRE(doc.is<float>() == true);\n      REQUIRE(my::isinf(doc.as<float>()));\n    }\n\n    SECTION(\"+Infinity\") {\n      DeserializationError err = deserializeJson(doc, \"+Infinity\");\n      REQUIRE(err == DeserializationError::Ok);\n      REQUIRE(doc.is<float>() == true);\n      REQUIRE(my::isinf(doc.as<float>()));\n    }\n\n    SECTION(\"-Infinity\") {\n      DeserializationError err = deserializeJson(doc, \"-Infinity\");\n      REQUIRE(err == DeserializationError::Ok);\n      REQUIRE(doc.is<float>() == true);\n      REQUIRE(my::isinf(doc.as<float>()));\n    }\n  }\n}\n"
  },
  {
    "path": "extras/tests/JsonDeserializer/object.cpp",
    "content": "// ArduinoJson - https://arduinojson.org\n// Copyright © 2014-2025, Benoit BLANCHON\n// MIT License\n\n#include <ArduinoJson.h>\n#include <catch.hpp>\n\n#include \"Allocators.hpp\"\n#include \"Literals.hpp\"\n\nusing ArduinoJson::detail::sizeofObject;\n\nTEST_CASE(\"deserialize JSON object\") {\n  SpyingAllocator spy;\n  JsonDocument doc(&spy);\n\n  SECTION(\"An empty object\") {\n    DeserializationError err = deserializeJson(doc, \"{}\");\n    JsonObject obj = doc.as<JsonObject>();\n\n    REQUIRE(err == DeserializationError::Ok);\n    REQUIRE(doc.is<JsonObject>());\n    REQUIRE(obj.size() == 0);\n  }\n\n  SECTION(\"Quotes\") {\n    SECTION(\"Double quotes\") {\n      DeserializationError err = deserializeJson(doc, \"{\\\"key\\\":\\\"value\\\"}\");\n      JsonObject obj = doc.as<JsonObject>();\n\n      REQUIRE(err == DeserializationError::Ok);\n      REQUIRE(doc.is<JsonObject>());\n      REQUIRE(obj.size() == 1);\n      REQUIRE(obj[\"key\"] == \"value\");\n    }\n\n    SECTION(\"Single quotes\") {\n      DeserializationError err = deserializeJson(doc, \"{'key':'value'}\");\n      JsonObject obj = doc.as<JsonObject>();\n\n      REQUIRE(err == DeserializationError::Ok);\n      REQUIRE(doc.is<JsonObject>());\n      REQUIRE(obj.size() == 1);\n      REQUIRE(obj[\"key\"] == \"value\");\n    }\n\n    SECTION(\"No quotes\") {\n      DeserializationError err = deserializeJson(doc, \"{key:'value'}\");\n      JsonObject obj = doc.as<JsonObject>();\n\n      REQUIRE(err == DeserializationError::Ok);\n      REQUIRE(doc.is<JsonObject>());\n      REQUIRE(obj.size() == 1);\n      REQUIRE(obj[\"key\"] == \"value\");\n    }\n\n    SECTION(\"No quotes, allow underscore in key\") {\n      DeserializationError err = deserializeJson(doc, \"{_k_e_y_:42}\");\n      JsonObject obj = doc.as<JsonObject>();\n\n      REQUIRE(err == DeserializationError::Ok);\n      REQUIRE(doc.is<JsonObject>());\n      REQUIRE(obj.size() == 1);\n      REQUIRE(obj[\"_k_e_y_\"] == 42);\n    }\n  }\n\n  SECTION(\"Spaces\") {\n    SECTION(\"Before the key\") {\n      DeserializationError err = deserializeJson(doc, \"{ \\\"key\\\":\\\"value\\\"}\");\n      JsonObject obj = doc.as<JsonObject>();\n\n      REQUIRE(err == DeserializationError::Ok);\n      REQUIRE(doc.is<JsonObject>());\n      REQUIRE(obj.size() == 1);\n      REQUIRE(obj[\"key\"] == \"value\");\n    }\n\n    SECTION(\"After the key\") {\n      DeserializationError err = deserializeJson(doc, \"{\\\"key\\\" :\\\"value\\\"}\");\n      JsonObject obj = doc.as<JsonObject>();\n\n      REQUIRE(err == DeserializationError::Ok);\n      REQUIRE(doc.is<JsonObject>());\n      REQUIRE(obj.size() == 1);\n      REQUIRE(obj[\"key\"] == \"value\");\n    }\n\n    SECTION(\"Before the value\") {\n      DeserializationError err = deserializeJson(doc, \"{\\\"key\\\": \\\"value\\\"}\");\n      JsonObject obj = doc.as<JsonObject>();\n\n      REQUIRE(err == DeserializationError::Ok);\n      REQUIRE(doc.is<JsonObject>());\n      REQUIRE(obj.size() == 1);\n      REQUIRE(obj[\"key\"] == \"value\");\n    }\n\n    SECTION(\"After the value\") {\n      DeserializationError err = deserializeJson(doc, \"{\\\"key\\\":\\\"value\\\" }\");\n      JsonObject obj = doc.as<JsonObject>();\n\n      REQUIRE(err == DeserializationError::Ok);\n      REQUIRE(doc.is<JsonObject>());\n      REQUIRE(obj.size() == 1);\n      REQUIRE(obj[\"key\"] == \"value\");\n    }\n\n    SECTION(\"Before the comma\") {\n      DeserializationError err =\n          deserializeJson(doc, \"{\\\"key1\\\":\\\"value1\\\" ,\\\"key2\\\":\\\"value2\\\"}\");\n      JsonObject obj = doc.as<JsonObject>();\n\n      REQUIRE(err == DeserializationError::Ok);\n      REQUIRE(doc.is<JsonObject>());\n      REQUIRE(obj.size() == 2);\n      REQUIRE(obj[\"key1\"] == \"value1\");\n      REQUIRE(obj[\"key2\"] == \"value2\");\n    }\n\n    SECTION(\"After the comma\") {\n      DeserializationError err =\n          deserializeJson(doc, \"{\\\"key1\\\":\\\"value1\\\", \\\"key2\\\":\\\"value2\\\"}\");\n      JsonObject obj = doc.as<JsonObject>();\n\n      REQUIRE(err == DeserializationError::Ok);\n      REQUIRE(doc.is<JsonObject>());\n      REQUIRE(obj.size() == 2);\n      REQUIRE(obj[\"key1\"] == \"value1\");\n      REQUIRE(obj[\"key2\"] == \"value2\");\n    }\n  }\n\n  SECTION(\"Values types\") {\n    SECTION(\"String\") {\n      DeserializationError err =\n          deserializeJson(doc, \"{\\\"key1\\\":\\\"value1\\\",\\\"key2\\\":\\\"value2\\\"}\");\n      JsonObject obj = doc.as<JsonObject>();\n\n      REQUIRE(err == DeserializationError::Ok);\n      REQUIRE(doc.is<JsonObject>());\n      REQUIRE(obj.size() == 2);\n      REQUIRE(obj[\"key1\"] == \"value1\");\n      REQUIRE(obj[\"key2\"] == \"value2\");\n    }\n\n    SECTION(\"Integer\") {\n      DeserializationError err =\n          deserializeJson(doc, \"{\\\"key1\\\":42,\\\"key2\\\":-42}\");\n      JsonObject obj = doc.as<JsonObject>();\n\n      REQUIRE(err == DeserializationError::Ok);\n      REQUIRE(doc.is<JsonObject>());\n      REQUIRE(obj.size() == 2);\n      REQUIRE(obj[\"key1\"] == 42);\n      REQUIRE(obj[\"key2\"] == -42);\n    }\n\n    SECTION(\"Float\") {\n      DeserializationError err =\n          deserializeJson(doc, \"{\\\"key1\\\":12.345,\\\"key2\\\":-7E3}\");\n      JsonObject obj = doc.as<JsonObject>();\n\n      REQUIRE(err == DeserializationError::Ok);\n      REQUIRE(doc.is<JsonObject>());\n      REQUIRE(obj.size() == 2);\n      REQUIRE(obj[\"key1\"].as<float>() == Approx(12.345f));\n      REQUIRE(obj[\"key2\"] == -7E3f);\n    }\n\n    SECTION(\"Double\") {\n      DeserializationError err =\n          deserializeJson(doc, \"{\\\"key1\\\":12.3456789,\\\"key2\\\":-7E89}\");\n      JsonObject obj = doc.as<JsonObject>();\n\n      REQUIRE(err == DeserializationError::Ok);\n      REQUIRE(doc.is<JsonObject>());\n      REQUIRE(obj.size() == 2);\n      REQUIRE(obj[\"key1\"].as<double>() == Approx(12.3456789));\n      REQUIRE(obj[\"key2\"] == -7E89);\n    }\n\n    SECTION(\"Booleans\") {\n      DeserializationError err =\n          deserializeJson(doc, \"{\\\"key1\\\":true,\\\"key2\\\":false}\");\n      JsonObject obj = doc.as<JsonObject>();\n\n      REQUIRE(err == DeserializationError::Ok);\n      REQUIRE(doc.is<JsonObject>());\n      REQUIRE(obj.size() == 2);\n      REQUIRE(obj[\"key1\"] == true);\n      REQUIRE(obj[\"key2\"] == false);\n    }\n\n    SECTION(\"Null\") {\n      DeserializationError err =\n          deserializeJson(doc, \"{\\\"key1\\\":null,\\\"key2\\\":null}\");\n      JsonObject obj = doc.as<JsonObject>();\n\n      REQUIRE(err == DeserializationError::Ok);\n      REQUIRE(doc.is<JsonObject>());\n      REQUIRE(obj.size() == 2);\n      REQUIRE(obj[\"key1\"].as<const char*>() == 0);\n      REQUIRE(obj[\"key2\"].as<const char*>() == 0);\n    }\n\n    SECTION(\"Array\") {\n      char jsonString[] = \" { \\\"ab\\\" : [ 1 , 2 ] , \\\"cd\\\" : [ 3 , 4 ] } \";\n\n      DeserializationError err = deserializeJson(doc, jsonString);\n      JsonObject obj = doc.as<JsonObject>();\n\n      JsonArray array1 = obj[\"ab\"];\n      const JsonArray array2 = obj[\"cd\"];\n      JsonArray array3 = obj[\"ef\"];\n\n      REQUIRE(err == DeserializationError::Ok);\n\n      REQUIRE(array1.isNull() == false);\n      REQUIRE(array2.isNull() == false);\n      REQUIRE(array3.isNull() == true);\n\n      REQUIRE(2 == array1.size());\n      REQUIRE(2 == array2.size());\n      REQUIRE(0 == array3.size());\n\n      REQUIRE(1 == array1[0].as<int>());\n      REQUIRE(2 == array1[1].as<int>());\n\n      REQUIRE(3 == array2[0].as<int>());\n      REQUIRE(4 == array2[1].as<int>());\n\n      REQUIRE(0 == array3[0].as<int>());\n    }\n  }\n\n  SECTION(\"Premature null terminator\") {\n    SECTION(\"After opening brace\") {\n      DeserializationError err = deserializeJson(doc, \"{\");\n\n      REQUIRE(err == DeserializationError::IncompleteInput);\n    }\n\n    SECTION(\"After key\") {\n      DeserializationError err = deserializeJson(doc, \"{\\\"hello\\\"\");\n\n      REQUIRE(err == DeserializationError::IncompleteInput);\n    }\n\n    SECTION(\"After colon\") {\n      DeserializationError err = deserializeJson(doc, \"{\\\"hello\\\":\");\n\n      REQUIRE(err == DeserializationError::IncompleteInput);\n    }\n\n    SECTION(\"After value\") {\n      DeserializationError err = deserializeJson(doc, \"{\\\"hello\\\":\\\"world\\\"\");\n\n      REQUIRE(err == DeserializationError::IncompleteInput);\n    }\n\n    SECTION(\"After comma\") {\n      DeserializationError err = deserializeJson(doc, \"{\\\"hello\\\":\\\"world\\\",\");\n\n      REQUIRE(err == DeserializationError::IncompleteInput);\n    }\n  }\n\n  SECTION(\"Misc\") {\n    SECTION(\"A quoted key without value\") {\n      DeserializationError err = deserializeJson(doc, \"{\\\"key\\\"}\");\n\n      REQUIRE(err == DeserializationError::InvalidInput);\n    }\n\n    SECTION(\"A non-quoted key without value\") {\n      DeserializationError err = deserializeJson(doc, \"{key}\");\n\n      REQUIRE(err == DeserializationError::InvalidInput);\n    }\n\n    SECTION(\"A dangling comma\") {\n      DeserializationError err = deserializeJson(doc, \"{\\\"key1\\\":\\\"value1\\\",}\");\n\n      REQUIRE(err == DeserializationError::InvalidInput);\n    }\n\n    SECTION(\"null as a key\") {\n      DeserializationError err = deserializeJson(doc, \"{null:\\\"value\\\"}\");\n\n      REQUIRE(err == DeserializationError::Ok);\n    }\n\n    SECTION(\"Repeated key\") {\n      DeserializationError err =\n          deserializeJson(doc, \"{alfa:{bravo:{charlie:1}},alfa:2}\");\n\n      REQUIRE(err == DeserializationError::Ok);\n      REQUIRE(doc.as<std::string>() == \"{\\\"alfa\\\":2}\");\n      REQUIRE(spy.log() ==\n              AllocatorLog{\n                  Allocate(sizeofStringBuffer()),\n                  Allocate(sizeofPool()),\n                  Reallocate(sizeofStringBuffer(), sizeofString(\"alfa\")),\n                  Allocate(sizeofStringBuffer()),\n                  Reallocate(sizeofStringBuffer(), sizeofString(\"bravo\")),\n                  Allocate(sizeofStringBuffer()),\n                  Reallocate(sizeofStringBuffer(), sizeofString(\"charlie\")),\n                  Allocate(sizeofStringBuffer()),\n                  Deallocate(sizeofString(\"bravo\")),\n                  Deallocate(sizeofString(\"charlie\")),\n                  Deallocate(sizeofStringBuffer()),\n                  Reallocate(sizeofPool(), sizeofObject(2) + sizeofObject(1)),\n              });\n    }\n\n    SECTION(\"Repeated key with zero copy mode\") {  // issue #1697\n      char input[] = \"{a:{b:{c:1}},a:2}\";\n      DeserializationError err = deserializeJson(doc, input);\n\n      REQUIRE(err == DeserializationError::Ok);\n      REQUIRE(doc[\"a\"] == 2);\n    }\n\n    SECTION(\"NUL in keys\") {\n      DeserializationError err =\n          deserializeJson(doc, \"{\\\"x\\\":0,\\\"x\\\\u0000a\\\":1,\\\"x\\\\u0000b\\\":2}\");\n\n      REQUIRE(err == DeserializationError::Ok);\n      REQUIRE(doc.as<std::string>() ==\n              \"{\\\"x\\\":0,\\\"x\\\\u0000a\\\":1,\\\"x\\\\u0000b\\\":2}\");\n    }\n  }\n\n  SECTION(\"Should clear the JsonObject\") {\n    deserializeJson(doc, \"{\\\"hello\\\":\\\"world\\\"}\");\n    spy.clearLog();\n\n    deserializeJson(doc, \"{}\");\n\n    REQUIRE(doc.is<JsonObject>());\n    REQUIRE(doc.size() == 0);\n    REQUIRE(spy.log() == AllocatorLog{\n                             Deallocate(sizeofObject(1)),\n                             Deallocate(sizeofString(\"hello\")),\n                             Deallocate(sizeofString(\"world\")),\n                         });\n  }\n\n  SECTION(\"Issue #1335\") {\n    std::string json(\"{\\\"a\\\":{},\\\"b\\\":{}}\");\n    deserializeJson(doc, json);\n    CHECK(doc.as<std::string>() == json);\n  }\n}\n\nTEST_CASE(\"deserialize JSON object under memory constraints\") {\n  TimebombAllocator timebomb(1024);\n  JsonDocument doc(&timebomb);\n\n  SECTION(\"empty object requires no allocation\") {\n    timebomb.setCountdown(0);\n    char input[] = \"{}\";\n\n    DeserializationError err = deserializeJson(doc, input);\n\n    REQUIRE(err == DeserializationError::Ok);\n    REQUIRE(doc.as<std::string>() == \"{}\");\n  }\n\n  SECTION(\"key allocation fails\") {\n    timebomb.setCountdown(0);\n    char input[] = \"{\\\"a\\\":1}\";\n\n    DeserializationError err = deserializeJson(doc, input);\n\n    REQUIRE(err == DeserializationError::NoMemory);\n    REQUIRE(doc.as<std::string>() == \"{}\");\n  }\n\n  SECTION(\"pool allocation fails\") {\n    timebomb.setCountdown(1);\n    char input[] = \"{\\\"a\\\":1}\";\n\n    DeserializationError err = deserializeJson(doc, input);\n\n    REQUIRE(err == DeserializationError::NoMemory);\n    REQUIRE(doc.as<std::string>() == \"{}\");\n  }\n\n  SECTION(\"string allocation fails\") {\n    timebomb.setCountdown(3);\n    char input[] = \"{\\\"alfa\\\":\\\"bravo\\\"}\";\n\n    DeserializationError err = deserializeJson(doc, input);\n\n    REQUIRE(err == DeserializationError::NoMemory);\n    REQUIRE(doc.as<std::string>() == \"{\\\"alfa\\\":null}\");\n  }\n}\n"
  },
  {
    "path": "extras/tests/JsonDeserializer/string.cpp",
    "content": "// ArduinoJson - https://arduinojson.org\n// Copyright © 2014-2025, Benoit BLANCHON\n// MIT License\n\n#define ARDUINOJSON_DECODE_UNICODE 1\n#include <ArduinoJson.h>\n#include <catch.hpp>\n\n#include \"Allocators.hpp\"\n\nusing ArduinoJson::detail::sizeofArray;\nusing ArduinoJson::detail::sizeofObject;\n\nTEST_CASE(\"Valid JSON strings value\") {\n  struct TestCase {\n    const char* input;\n    const char* expectedOutput;\n  };\n\n  TestCase testCases[] = {\n      {\"\\\"hello world\\\"\", \"hello world\"},\n      {\"\\'hello world\\'\", \"hello world\"},\n      {\"'\\\"'\", \"\\\"\"},\n      {\"'\\\\\\\\'\", \"\\\\\"},\n      {\"'\\\\/'\", \"/\"},\n      {\"'\\\\b'\", \"\\b\"},\n      {\"'\\\\f'\", \"\\f\"},\n      {\"'\\\\n'\", \"\\n\"},\n      {\"'\\\\r'\", \"\\r\"},\n      {\"'\\\\t'\", \"\\t\"},\n      {\"\\\"1\\\\\\\"2\\\\\\\\3\\\\/4\\\\b5\\\\f6\\\\n7\\\\r8\\\\t9\\\"\", \"1\\\"2\\\\3/4\\b5\\f6\\n7\\r8\\t9\"},\n      {\"'\\\\u0041'\", \"A\"},\n      {\"'\\\\u00e4'\", \"\\xc3\\xa4\"},                 // ä\n      {\"'\\\\u00E4'\", \"\\xc3\\xa4\"},                 // ä\n      {\"'\\\\u3042'\", \"\\xe3\\x81\\x82\"},             // あ\n      {\"'\\\\ud83d\\\\udda4'\", \"\\xf0\\x9f\\x96\\xa4\"},  // 🖤\n      {\"'\\\\uF053'\", \"\\xef\\x81\\x93\"},             // issue #1173\n      {\"'\\\\uF015'\", \"\\xef\\x80\\x95\"},             // issue #1173\n      {\"'\\\\uF054'\", \"\\xef\\x81\\x94\"},             // issue #1173\n  };\n  const size_t testCount = sizeof(testCases) / sizeof(testCases[0]);\n\n  JsonDocument doc;\n\n  for (size_t i = 0; i < testCount; i++) {\n    const TestCase& testCase = testCases[i];\n    CAPTURE(testCase.input);\n    DeserializationError err = deserializeJson(doc, testCase.input);\n    CHECK(err == DeserializationError::Ok);\n    CHECK(doc.as<std::string>() == testCase.expectedOutput);\n  }\n}\n\nTEST_CASE(\"\\\\u0000\") {\n  JsonDocument doc;\n\n  DeserializationError err = deserializeJson(doc, \"\\\"wx\\\\u0000yz\\\"\");\n  REQUIRE(err == DeserializationError::Ok);\n\n  const char* result = doc.as<const char*>();\n  CHECK(result[0] == 'w');\n  CHECK(result[1] == 'x');\n  CHECK(result[2] == 0);\n  CHECK(result[3] == 'y');\n  CHECK(result[4] == 'z');\n  CHECK(result[5] == 0);\n\n  CHECK(doc.as<JsonString>().size() == 5);\n  CHECK(doc.as<std::string>().size() == 5);\n}\n\nTEST_CASE(\"Truncated JSON string\") {\n  const char* testCases[] = {\"\\\"hello\", \"\\'hello\", \"'\\\\u\", \"'\\\\u00\", \"'\\\\u000\"};\n  const size_t testCount = sizeof(testCases) / sizeof(testCases[0]);\n\n  JsonDocument doc;\n\n  for (size_t i = 0; i < testCount; i++) {\n    const char* input = testCases[i];\n    CAPTURE(input);\n    REQUIRE(deserializeJson(doc, input) ==\n            DeserializationError::IncompleteInput);\n  }\n}\n\nTEST_CASE(\"Escape single quote in single quoted string\") {\n  JsonDocument doc;\n\n  DeserializationError err = deserializeJson(doc, \"'ab\\\\\\'cd'\");\n  REQUIRE(err == DeserializationError::Ok);\n  CHECK(doc.as<std::string>() == \"ab\\'cd\");\n}\n\nTEST_CASE(\"Escape double quote in double quoted string\") {\n  JsonDocument doc;\n\n  DeserializationError err = deserializeJson(doc, \"'ab\\\\\\\"cd'\");\n  REQUIRE(err == DeserializationError::Ok);\n  CHECK(doc.as<std::string>() == \"ab\\\"cd\");\n}\n\nTEST_CASE(\"Invalid JSON string\") {\n  const char* testCases[] = {\"'\\\\u'\",     \"'\\\\u000g'\", \"'\\\\u000'\",\n                             \"'\\\\u000G'\", \"'\\\\u000/'\", \"'\\\\x1234'\"};\n  const size_t testCount = sizeof(testCases) / sizeof(testCases[0]);\n\n  JsonDocument doc;\n\n  for (size_t i = 0; i < testCount; i++) {\n    const char* input = testCases[i];\n    CAPTURE(input);\n    REQUIRE(deserializeJson(doc, input) == DeserializationError::InvalidInput);\n  }\n}\n\nTEST_CASE(\"Allocation of the key fails\") {\n  TimebombAllocator timebomb(0);\n  SpyingAllocator spy(&timebomb);\n  JsonDocument doc(&spy);\n\n  SECTION(\"Quoted string, first member\") {\n    REQUIRE(deserializeJson(doc, \"{\\\"example\\\":1}\") ==\n            DeserializationError::NoMemory);\n    REQUIRE(spy.log() == AllocatorLog{\n                             AllocateFail(sizeofStringBuffer()),\n                         });\n  }\n\n  SECTION(\"Quoted string, second member\") {\n    timebomb.setCountdown(3);\n    REQUIRE(deserializeJson(doc, \"{\\\"hello\\\":1,\\\"world\\\"}\") ==\n            DeserializationError::NoMemory);\n    REQUIRE(spy.log() ==\n            AllocatorLog{\n                Allocate(sizeofStringBuffer()),\n                Allocate(sizeofPool()),\n                Reallocate(sizeofStringBuffer(), sizeofString(\"hello\")),\n                AllocateFail(sizeofStringBuffer()),\n                ReallocateFail(sizeofPool(), sizeofObject(1)),\n            });\n  }\n\n  SECTION(\"Non-Quoted string, first member\") {\n    REQUIRE(deserializeJson(doc, \"{example:1}\") ==\n            DeserializationError::NoMemory);\n    REQUIRE(spy.log() == AllocatorLog{\n                             AllocateFail(sizeofStringBuffer()),\n                         });\n  }\n\n  SECTION(\"Non-Quoted string, second member\") {\n    timebomb.setCountdown(3);\n    REQUIRE(deserializeJson(doc, \"{hello:1,world}\") ==\n            DeserializationError::NoMemory);\n    REQUIRE(spy.log() ==\n            AllocatorLog{\n                Allocate(sizeofStringBuffer()),\n                Allocate(sizeofPool()),\n                Reallocate(sizeofStringBuffer(), sizeofString(\"hello\")),\n                AllocateFail(sizeofStringBuffer()),\n                ReallocateFail(sizeofPool(), sizeofObject(1)),\n            });\n  }\n}\n\nTEST_CASE(\"String allocation fails\") {\n  SpyingAllocator spy(FailingAllocator::instance());\n  JsonDocument doc(&spy);\n\n  SECTION(\"Input is const char*\") {\n    REQUIRE(deserializeJson(doc, \"\\\"hello\\\"\") ==\n            DeserializationError::NoMemory);\n    REQUIRE(spy.log() == AllocatorLog{\n                             AllocateFail(sizeofStringBuffer()),\n                         });\n  }\n}\n\nTEST_CASE(\"Deduplicate values\") {\n  SpyingAllocator spy;\n  JsonDocument doc(&spy);\n  deserializeJson(doc, \"[\\\"example\\\",\\\"example\\\"]\");\n\n  CHECK(doc[0].as<const char*>() == doc[1].as<const char*>());\n  REQUIRE(spy.log() ==\n          AllocatorLog{\n              Allocate(sizeofPool()),\n              Allocate(sizeofStringBuffer()),\n              Reallocate(sizeofStringBuffer(), sizeofString(\"example\")),\n              Allocate(sizeofStringBuffer()),\n              Deallocate(sizeofStringBuffer()),\n              Reallocate(sizeofPool(), sizeofArray(2)),\n          });\n}\n\nTEST_CASE(\"Deduplicate keys\") {\n  SpyingAllocator spy;\n  JsonDocument doc(&spy);\n  deserializeJson(doc, \"[{\\\"example\\\":1},{\\\"example\\\":2}]\");\n\n  const char* key1 = doc[0].as<JsonObject>().begin()->key().c_str();\n  const char* key2 = doc[1].as<JsonObject>().begin()->key().c_str();\n  CHECK(key1 == key2);\n\n  REQUIRE(spy.log() ==\n          AllocatorLog{\n              Allocate(sizeofPool()),\n              Allocate(sizeofStringBuffer()),\n              Reallocate(sizeofStringBuffer(), sizeofString(\"example\")),\n              Allocate(sizeofStringBuffer()),\n              Deallocate(sizeofStringBuffer()),\n              Reallocate(sizeofPool(), sizeofArray(2) + 2 * sizeofObject(1)),\n          });\n}\n"
  },
  {
    "path": "extras/tests/JsonDocument/CMakeLists.txt",
    "content": "# ArduinoJson - https://arduinojson.org\n# Copyright © 2014-2025, Benoit BLANCHON\n# MIT License\n\nadd_executable(JsonDocumentTests\n\tadd.cpp\n\tassignment.cpp\n\tcast.cpp\n\tclear.cpp\n\tcompare.cpp\n\tconstructor.cpp\n\tElementProxy.cpp\n\tisNull.cpp\n\tissue1120.cpp\n\tMemberProxy.cpp\n\tnesting.cpp\n\toverflowed.cpp\n\tremove.cpp\n\tset.cpp\n\tshrinkToFit.cpp\n\tsize.cpp\n\tsubscript.cpp\n\tswap.cpp\n)\n\nadd_test(JsonDocument JsonDocumentTests)\n\nset_tests_properties(JsonDocument\n\tPROPERTIES\n\t\tLABELS \"Catch\"\n)\n"
  },
  {
    "path": "extras/tests/JsonDocument/ElementProxy.cpp",
    "content": "// ArduinoJson - https://arduinojson.org\n// Copyright © 2014-2025, Benoit BLANCHON\n// MIT License\n\n#include <ArduinoJson.h>\n#include <catch.hpp>\n\n#include \"Allocators.hpp\"\n#include \"Literals.hpp\"\n\nusing ElementProxy = ArduinoJson::detail::ElementProxy<JsonDocument&>;\n\nTEST_CASE(\"ElementProxy::add()\") {\n  SpyingAllocator spy;\n  JsonDocument doc(&spy);\n  doc.add<JsonVariant>();\n  const ElementProxy& ep = doc[0];\n\n  SECTION(\"integer\") {\n    ep.add(42);\n\n    REQUIRE(doc.as<std::string>() == \"[[42]]\");\n    REQUIRE(spy.log() == AllocatorLog{\n                             Allocate(sizeofPool()),\n                         });\n  }\n\n  SECTION(\"string literal\") {\n    ep.add(\"world\");\n\n    REQUIRE(doc.as<std::string>() == \"[[\\\"world\\\"]]\");\n    REQUIRE(spy.log() == AllocatorLog{\n                             Allocate(sizeofPool()),\n                             Allocate(sizeofString(\"world\")),\n                         });\n  }\n\n  SECTION(\"const char*\") {\n    const char* s = \"world\";\n    ep.add(s);\n\n    REQUIRE(doc.as<std::string>() == \"[[\\\"world\\\"]]\");\n    REQUIRE(spy.log() == AllocatorLog{\n                             Allocate(sizeofPool()),\n                             Allocate(sizeofString(\"world\")),\n                         });\n  }\n\n  SECTION(\"char[]\") {\n    char s[] = \"world\";\n    ep.add(s);\n    strcpy(s, \"!!!!!\");\n\n    REQUIRE(doc.as<std::string>() == \"[[\\\"world\\\"]]\");\n    REQUIRE(spy.log() == AllocatorLog{\n                             Allocate(sizeofPool()),\n                             Allocate(sizeofString(\"world\")),\n                         });\n  }\n\n#ifdef HAS_VARIABLE_LENGTH_ARRAY\n  SECTION(\"VLA\") {\n    size_t i = 8;\n    char vla[i];\n    strcpy(vla, \"world\");\n\n    ep.add(vla);\n\n    REQUIRE(doc.as<std::string>() == \"[[\\\"world\\\"]]\");\n    REQUIRE(spy.log() == AllocatorLog{\n                             Allocate(sizeofPool()),\n                             Allocate(sizeofString(\"world\")),\n                         });\n  }\n#endif\n}\n\nTEST_CASE(\"ElementProxy::clear()\") {\n  JsonDocument doc;\n  doc.add<JsonVariant>();\n  const ElementProxy& ep = doc[0];\n\n  SECTION(\"size goes back to zero\") {\n    ep.add(42);\n    ep.clear();\n\n    REQUIRE(ep.size() == 0);\n  }\n\n  SECTION(\"isNull() return true\") {\n    ep.add(\"hello\");\n    ep.clear();\n\n    REQUIRE(ep.isNull() == true);\n  }\n}\n\nTEST_CASE(\"ElementProxy::operator==()\") {\n  JsonDocument doc;\n\n  SECTION(\"1 vs 1\") {\n    doc.add(1);\n    doc.add(1);\n\n    REQUIRE(doc[0] <= doc[1]);\n    REQUIRE(doc[0] == doc[1]);\n    REQUIRE(doc[0] >= doc[1]);\n    REQUIRE_FALSE(doc[0] != doc[1]);\n    REQUIRE_FALSE(doc[0] < doc[1]);\n    REQUIRE_FALSE(doc[0] > doc[1]);\n  }\n\n  SECTION(\"1 vs 2\") {\n    doc.add(1);\n    doc.add(2);\n\n    REQUIRE(doc[0] != doc[1]);\n    REQUIRE(doc[0] < doc[1]);\n    REQUIRE(doc[0] <= doc[1]);\n    REQUIRE_FALSE(doc[0] == doc[1]);\n    REQUIRE_FALSE(doc[0] > doc[1]);\n    REQUIRE_FALSE(doc[0] >= doc[1]);\n  }\n\n  SECTION(\"'abc' vs 'bcd'\") {\n    doc.add(\"abc\");\n    doc.add(\"bcd\");\n\n    REQUIRE(doc[0] != doc[1]);\n    REQUIRE(doc[0] < doc[1]);\n    REQUIRE(doc[0] <= doc[1]);\n    REQUIRE_FALSE(doc[0] == doc[1]);\n    REQUIRE_FALSE(doc[0] > doc[1]);\n    REQUIRE_FALSE(doc[0] >= doc[1]);\n  }\n}\n\nTEST_CASE(\"ElementProxy::remove()\") {\n  JsonDocument doc;\n  doc.add<JsonVariant>();\n  const ElementProxy& ep = doc[0];\n\n  SECTION(\"remove(int)\") {\n    ep.add(1);\n    ep.add(2);\n    ep.add(3);\n\n    ep.remove(1);\n\n    REQUIRE(ep.as<std::string>() == \"[1,3]\");\n  }\n\n  SECTION(\"remove(const char *)\") {\n    ep[\"a\"] = 1;\n    ep[\"b\"] = 2;\n\n    ep.remove(\"a\");\n\n    REQUIRE(ep.as<std::string>() == \"{\\\"b\\\":2}\");\n  }\n\n  SECTION(\"remove(std::string)\") {\n    ep[\"a\"] = 1;\n    ep[\"b\"] = 2;\n\n    ep.remove(\"b\"_s);\n\n    REQUIRE(ep.as<std::string>() == \"{\\\"a\\\":1}\");\n  }\n\n#ifdef HAS_VARIABLE_LENGTH_ARRAY\n  SECTION(\"remove(vla)\") {\n    ep[\"a\"] = 1;\n    ep[\"b\"] = 2;\n\n    size_t i = 4;\n    char vla[i];\n    strcpy(vla, \"b\");\n    ep.remove(vla);\n\n    REQUIRE(ep.as<std::string>() == \"{\\\"a\\\":1}\");\n  }\n#endif\n}\n\nTEST_CASE(\"ElementProxy::set()\") {\n  JsonDocument doc;\n  const ElementProxy& ep = doc[0];\n\n  SECTION(\"set(int)\") {\n    ep.set(42);\n\n    REQUIRE(doc.as<std::string>() == \"[42]\");\n  }\n\n  SECTION(\"set(const char*)\") {\n    ep.set(\"world\");\n\n    REQUIRE(doc.as<std::string>() == \"[\\\"world\\\"]\");\n  }\n\n  SECTION(\"set(char[])\") {\n    char s[] = \"world\";\n    ep.set(s);\n    strcpy(s, \"!!!!!\");\n\n    REQUIRE(doc.as<std::string>() == \"[\\\"world\\\"]\");\n  }\n\n#ifdef HAS_VARIABLE_LENGTH_ARRAY\n  SECTION(\"set(VLA)\") {\n    size_t i = 8;\n    char vla[i];\n    strcpy(vla, \"world\");\n\n    ep.set(vla);\n\n    REQUIRE(doc.as<std::string>() == \"[\\\"world\\\"]\");\n  }\n#endif\n}\n\nTEST_CASE(\"ElementProxy::size()\") {\n  JsonDocument doc;\n  doc.add<JsonVariant>();\n  const ElementProxy& ep = doc[0];\n\n  SECTION(\"returns 0\") {\n    REQUIRE(ep.size() == 0);\n  }\n\n  SECTION(\"as an array, returns 2\") {\n    ep.add(1);\n    ep.add(2);\n    REQUIRE(ep.size() == 2);\n  }\n\n  SECTION(\"as an object, returns 2\") {\n    ep[\"a\"] = 1;\n    ep[\"b\"] = 2;\n    REQUIRE(ep.size() == 2);\n  }\n}\n\nTEST_CASE(\"ElementProxy::operator[]\") {\n  JsonDocument doc;\n  const ElementProxy& ep = doc[1];\n\n  SECTION(\"set member\") {\n    ep[\"world\"] = 42;\n\n    REQUIRE(doc.as<std::string>() == \"[null,{\\\"world\\\":42}]\");\n  }\n\n  SECTION(\"set element\") {\n    ep[2] = 42;\n\n    REQUIRE(doc.as<std::string>() == \"[null,[null,null,42]]\");\n  }\n\n#ifdef HAS_VARIABLE_LENGTH_ARRAY\n  SECTION(\"set VLA\") {\n    size_t i = 8;\n    char vla[i];\n    strcpy(vla, \"world\");\n\n    ep[0] = vla;\n\n    REQUIRE(doc.as<std::string>() == \"[null,[\\\"world\\\"]]\");\n  }\n#endif\n}\n\nTEST_CASE(\"ElementProxy cast to JsonVariantConst\") {\n  JsonDocument doc;\n  doc[0] = \"world\";\n\n  const ElementProxy& ep = doc[0];\n\n  JsonVariantConst var = ep;\n\n  CHECK(var.as<std::string>() == \"world\");\n}\n\nTEST_CASE(\"ElementProxy cast to JsonVariant\") {\n  JsonDocument doc;\n  doc[0] = \"world\";\n\n  const ElementProxy& ep = doc[0];\n\n  JsonVariant var = ep;\n\n  CHECK(var.as<std::string>() == \"world\");\n\n  var.set(\"toto\");\n\n  CHECK(doc.as<std::string>() == \"[\\\"toto\\\"]\");\n}\n"
  },
  {
    "path": "extras/tests/JsonDocument/MemberProxy.cpp",
    "content": "// ArduinoJson - https://arduinojson.org\n// Copyright © 2014-2025, Benoit BLANCHON\n// MIT License\n\n#define ARDUINOJSON_ENABLE_ARDUINO_STRING 1\n#define ARDUINOJSON_ENABLE_PROGMEM 1\n#include <ArduinoJson.h>\n\n#include <catch.hpp>\n\n#include \"Allocators.hpp\"\n#include \"Literals.hpp\"\n\nusing ArduinoJson::detail::sizeofArray;\nusing ArduinoJson::detail::sizeofObject;\n\nTEST_CASE(\"MemberProxy::add()\") {\n  SpyingAllocator spy;\n  JsonDocument doc(&spy);\n  const auto& mp = doc[\"hello\"];\n\n  SECTION(\"integer\") {\n    mp.add(42);\n\n    REQUIRE(doc.as<std::string>() == \"{\\\"hello\\\":[42]}\");\n    REQUIRE(spy.log() == AllocatorLog{\n                             Allocate(sizeofPool()),\n                             Allocate(sizeofString(\"hello\")),\n                         });\n  }\n\n  SECTION(\"string literal\") {\n    mp.add(\"world\");\n\n    REQUIRE(doc.as<std::string>() == \"{\\\"hello\\\":[\\\"world\\\"]}\");\n    REQUIRE(spy.log() == AllocatorLog{\n                             Allocate(sizeofPool()),\n                             Allocate(sizeofString(\"hello\")),\n                             Allocate(sizeofString(\"world\")),\n                         });\n  }\n\n  SECTION(\"const char*\") {\n    const char* temp = \"world\";\n    mp.add(temp);\n\n    REQUIRE(doc.as<std::string>() == \"{\\\"hello\\\":[\\\"world\\\"]}\");\n    REQUIRE(spy.log() == AllocatorLog{\n                             Allocate(sizeofPool()),\n                             Allocate(sizeofString(\"hello\")),\n                             Allocate(sizeofString(\"world\")),\n                         });\n  }\n\n  SECTION(\"char[]\") {\n    char temp[] = \"world\";\n    mp.add(temp);\n\n    REQUIRE(doc.as<std::string>() == \"{\\\"hello\\\":[\\\"world\\\"]}\");\n    REQUIRE(spy.log() == AllocatorLog{\n                             Allocate(sizeofPool()),\n                             Allocate(sizeofString(\"hello\")),\n                             Allocate(sizeofString(\"world\")),\n\n                         });\n  }\n\n#ifdef HAS_VARIABLE_LENGTH_ARRAY\n  SECTION(\"VLA\") {\n    size_t i = 16;\n    char vla[i];\n    strcpy(vla, \"world\");\n\n    mp.add(vla);\n\n    REQUIRE(doc.as<std::string>() == \"{\\\"hello\\\":[\\\"world\\\"]}\");\n    REQUIRE(spy.log() == AllocatorLog{\n                             Allocate(sizeofPool()),\n                             Allocate(sizeofString(\"hello\")),\n                             Allocate(sizeofString(\"world\")),\n                         });\n  }\n#endif\n}\n\nTEST_CASE(\"MemberProxy::clear()\") {\n  JsonDocument doc;\n  const auto& mp = doc[\"hello\"];\n\n  SECTION(\"size goes back to zero\") {\n    mp.add(42);\n    mp.clear();\n\n    REQUIRE(mp.size() == 0);\n  }\n\n  SECTION(\"isNull() return true\") {\n    mp.add(\"hello\");\n    mp.clear();\n\n    REQUIRE(mp.isNull() == true);\n  }\n}\n\nTEST_CASE(\"MemberProxy::operator==()\") {\n  JsonDocument doc;\n\n  SECTION(\"1 vs 1\") {\n    doc[\"a\"] = 1;\n    doc[\"b\"] = 1;\n\n    REQUIRE(doc[\"a\"] <= doc[\"b\"]);\n    REQUIRE(doc[\"a\"] == doc[\"b\"]);\n    REQUIRE(doc[\"a\"] >= doc[\"b\"]);\n    REQUIRE_FALSE(doc[\"a\"] != doc[\"b\"]);\n    REQUIRE_FALSE(doc[\"a\"] < doc[\"b\"]);\n    REQUIRE_FALSE(doc[\"a\"] > doc[\"b\"]);\n  }\n\n  SECTION(\"1 vs 2\") {\n    doc[\"a\"] = 1;\n    doc[\"b\"] = 2;\n\n    REQUIRE(doc[\"a\"] != doc[\"b\"]);\n    REQUIRE(doc[\"a\"] < doc[\"b\"]);\n    REQUIRE(doc[\"a\"] <= doc[\"b\"]);\n    REQUIRE_FALSE(doc[\"a\"] == doc[\"b\"]);\n    REQUIRE_FALSE(doc[\"a\"] > doc[\"b\"]);\n    REQUIRE_FALSE(doc[\"a\"] >= doc[\"b\"]);\n  }\n\n  SECTION(\"'abc' vs 'bcd'\") {\n    doc[\"a\"] = \"abc\";\n    doc[\"b\"] = \"bcd\";\n\n    REQUIRE(doc[\"a\"] != doc[\"b\"]);\n    REQUIRE(doc[\"a\"] < doc[\"b\"]);\n    REQUIRE(doc[\"a\"] <= doc[\"b\"]);\n    REQUIRE_FALSE(doc[\"a\"] == doc[\"b\"]);\n    REQUIRE_FALSE(doc[\"a\"] > doc[\"b\"]);\n    REQUIRE_FALSE(doc[\"a\"] >= doc[\"b\"]);\n  }\n}\n\nTEST_CASE(\"MemberProxy::operator|()\") {\n  JsonDocument doc;\n\n  SECTION(\"const char*\") {\n    doc[\"a\"] = \"hello\";\n\n    REQUIRE((doc[\"a\"] | \"world\") == \"hello\"_s);\n    REQUIRE((doc[\"b\"] | \"world\") == \"world\"_s);\n  }\n\n  SECTION(\"Issue #1411\") {\n    doc[\"sensor\"] = \"gps\";\n\n    const char* test = \"test\";  // <- the literal must be captured in a variable\n                                // to trigger the bug\n    const char* sensor = doc[\"sensor\"] | test;  // \"gps\"\n\n    REQUIRE(sensor == \"gps\"_s);\n  }\n\n  SECTION(\"Issue #1415\") {\n    JsonObject object = doc.to<JsonObject>();\n    object[\"hello\"] = \"world\";\n\n    JsonDocument emptyDoc;\n    JsonObject anotherObject = object[\"hello\"] | emptyDoc.to<JsonObject>();\n\n    REQUIRE(anotherObject.isNull() == false);\n    REQUIRE(anotherObject.size() == 0);\n  }\n}\n\nTEST_CASE(\"MemberProxy::remove()\") {\n  JsonDocument doc;\n  const auto& mp = doc[\"hello\"];\n\n  SECTION(\"remove(int)\") {\n    mp.add(1);\n    mp.add(2);\n    mp.add(3);\n\n    mp.remove(1);\n\n    REQUIRE(mp.as<std::string>() == \"[1,3]\");\n  }\n\n  SECTION(\"remove(const char *)\") {\n    mp[\"a\"] = 1;\n    mp[\"b\"] = 2;\n\n    mp.remove(\"a\");\n\n    REQUIRE(mp.as<std::string>() == \"{\\\"b\\\":2}\");\n  }\n\n  SECTION(\"remove(std::string)\") {\n    mp[\"a\"] = 1;\n    mp[\"b\"] = 2;\n\n    mp.remove(\"b\"_s);\n\n    REQUIRE(mp.as<std::string>() == \"{\\\"a\\\":1}\");\n  }\n\n#ifdef HAS_VARIABLE_LENGTH_ARRAY\n  SECTION(\"remove(vla)\") {\n    mp[\"a\"] = 1;\n    mp[\"b\"] = 2;\n\n    size_t i = 4;\n    char vla[i];\n    strcpy(vla, \"b\");\n    mp.remove(vla);\n\n    REQUIRE(mp.as<std::string>() == \"{\\\"a\\\":1}\");\n  }\n#endif\n}\n\nTEST_CASE(\"MemberProxy::set()\") {\n  JsonDocument doc;\n  const auto& mp = doc[\"hello\"];\n\n  SECTION(\"set(int)\") {\n    mp.set(42);\n\n    REQUIRE(doc.as<std::string>() == \"{\\\"hello\\\":42}\");\n  }\n\n  SECTION(\"set(const char*)\") {\n    mp.set(\"world\");\n\n    REQUIRE(doc.as<std::string>() == \"{\\\"hello\\\":\\\"world\\\"}\");\n  }\n\n  SECTION(\"set(char[])\") {  // issue #1191\n    char s[] = \"world\";\n    mp.set(s);\n    strcpy(s, \"!!!!!\");\n\n    REQUIRE(doc.as<std::string>() == \"{\\\"hello\\\":\\\"world\\\"}\");\n  }\n\n#ifdef HAS_VARIABLE_LENGTH_ARRAY\n  SECTION(\"set(vla)\") {\n    size_t i = 8;\n    char vla[i];\n    strcpy(vla, \"world\");\n\n    mp.set(vla);\n\n    REQUIRE(doc.as<std::string>() == \"{\\\"hello\\\":\\\"world\\\"}\");\n  }\n#endif\n}\n\nTEST_CASE(\"MemberProxy::size()\") {\n  JsonDocument doc;\n  const auto& mp = doc[\"hello\"];\n\n  SECTION(\"returns 0\") {\n    REQUIRE(mp.size() == 0);\n  }\n\n  SECTION(\"as an array, return 2\") {\n    mp.add(1);\n    mp.add(2);\n\n    REQUIRE(mp.size() == 2);\n  }\n\n  SECTION(\"as an object, return 2\") {\n    mp[\"a\"] = 1;\n    mp[\"b\"] = 2;\n\n    REQUIRE(mp.size() == 2);\n  }\n}\n\nTEST_CASE(\"MemberProxy::operator[]\") {\n  JsonDocument doc;\n  const auto& mp = doc[\"hello\"];\n\n  SECTION(\"set member\") {\n    mp[\"world\"] = 42;\n\n    REQUIRE(doc.as<std::string>() == \"{\\\"hello\\\":{\\\"world\\\":42}}\");\n  }\n\n  SECTION(\"set element\") {\n    mp[2] = 42;\n\n    REQUIRE(doc.as<std::string>() == \"{\\\"hello\\\":[null,null,42]}\");\n  }\n}\n\nTEST_CASE(\"MemberProxy cast to JsonVariantConst\") {\n  JsonDocument doc;\n  doc[\"hello\"] = \"world\";\n\n  const auto& mp = doc[\"hello\"];\n\n  JsonVariantConst var = mp;\n\n  CHECK(var.as<std::string>() == \"world\");\n}\n\nTEST_CASE(\"MemberProxy cast to JsonVariant\") {\n  JsonDocument doc;\n  doc[\"hello\"] = \"world\";\n\n  const auto& mp = doc[\"hello\"];\n\n  JsonVariant var = mp;\n\n  CHECK(var.as<std::string>() == \"world\");\n\n  var.set(\"toto\");\n\n  CHECK(doc.as<std::string>() == \"{\\\"hello\\\":\\\"toto\\\"}\");\n}\n\nTEST_CASE(\"Deduplicate keys\") {\n  SpyingAllocator spy;\n  JsonDocument doc(&spy);\n\n  SECTION(\"std::string\") {\n    doc[0][\"example\"_s] = 1;\n    doc[1][\"example\"_s] = 2;\n\n    const char* key1 = doc[0].as<JsonObject>().begin()->key().c_str();\n    const char* key2 = doc[1].as<JsonObject>().begin()->key().c_str();\n    CHECK(key1 == key2);\n\n    REQUIRE(spy.log() == AllocatorLog{\n                             Allocate(sizeofPool()),\n                             Allocate(sizeofString(\"example\")),\n                         });\n  }\n\n  SECTION(\"char*\") {\n    char key[] = \"example\";\n    doc[0][key] = 1;\n    doc[1][key] = 2;\n\n    const char* key1 = doc[0].as<JsonObject>().begin()->key().c_str();\n    const char* key2 = doc[1].as<JsonObject>().begin()->key().c_str();\n    CHECK(key1 == key2);\n\n    REQUIRE(spy.log() == AllocatorLog{\n                             Allocate(sizeofPool()),\n                             Allocate(sizeofString(\"example\")),\n                         });\n  }\n\n  SECTION(\"Arduino String\") {\n    doc[0][String(\"example\")] = 1;\n    doc[1][String(\"example\")] = 2;\n\n    const char* key1 = doc[0].as<JsonObject>().begin()->key().c_str();\n    const char* key2 = doc[1].as<JsonObject>().begin()->key().c_str();\n    CHECK(key1 == key2);\n\n    REQUIRE(spy.log() == AllocatorLog{\n                             Allocate(sizeofPool()),\n                             Allocate(sizeofString(\"example\")),\n                         });\n  }\n\n  SECTION(\"Flash string\") {\n    doc[0][F(\"example\")] = 1;\n    doc[1][F(\"example\")] = 2;\n\n    const char* key1 = doc[0].as<JsonObject>().begin()->key().c_str();\n    const char* key2 = doc[1].as<JsonObject>().begin()->key().c_str();\n    CHECK(key1 == key2);\n\n    REQUIRE(spy.log() == AllocatorLog{\n                             Allocate(sizeofPool()),\n                             Allocate(sizeofString(\"example\")),\n                         });\n  }\n}\n\nTEST_CASE(\"MemberProxy under memory constraints\") {\n  TimebombAllocator timebomb(1);\n  SpyingAllocator spy(&timebomb);\n  JsonDocument doc(&spy);\n\n  SECTION(\"key slot allocation fails\") {\n    timebomb.setCountdown(0);\n\n    doc[\"hello\"_s] = \"world\";\n\n    REQUIRE(doc.is<JsonObject>());\n    REQUIRE(doc.size() == 0);\n    REQUIRE(doc.overflowed() == true);\n    REQUIRE(spy.log() == AllocatorLog{\n                             AllocateFail(sizeofPool()),\n                         });\n  }\n\n  SECTION(\"value slot allocation fails\") {\n    timebomb.setCountdown(1);\n\n    // fill the pool entirely, but leave one slot for the key\n    doc[\"foo\"][ARDUINOJSON_POOL_CAPACITY - 4] = 1;\n    REQUIRE(doc.overflowed() == false);\n\n    doc[\"hello\"_s] = \"world\";\n\n    REQUIRE(doc.is<JsonObject>());\n    REQUIRE(doc.size() == 1);\n    REQUIRE(doc.overflowed() == true);\n    REQUIRE(spy.log() == AllocatorLog{\n                             Allocate(sizeofPool()),\n                             AllocateFail(sizeofPool()),\n                         });\n  }\n\n  SECTION(\"key string allocation fails\") {\n    timebomb.setCountdown(1);\n\n    doc[\"hello\"_s] = \"world\";\n\n    REQUIRE(doc.is<JsonObject>());\n    REQUIRE(doc.size() == 0);\n    REQUIRE(doc.overflowed() == true);\n    REQUIRE(spy.log() == AllocatorLog{\n                             Allocate(sizeofPool()),\n                             AllocateFail(sizeofString(\"hello\")),\n                         });\n  }\n}\n"
  },
  {
    "path": "extras/tests/JsonDocument/add.cpp",
    "content": "// ArduinoJson - https://arduinojson.org\n// Copyright © 2014-2025, Benoit BLANCHON\n// MIT License\n\n#define ARDUINOJSON_ENABLE_ARDUINO_STRING 1\n#define ARDUINOJSON_ENABLE_PROGMEM 1\n#include <ArduinoJson.h>\n\n#include <catch.hpp>\n\n#include \"Allocators.hpp\"\n#include \"Literals.hpp\"\n\nusing ArduinoJson::detail::sizeofArray;\n\nTEST_CASE(\"JsonDocument::add(T)\") {\n  SpyingAllocator spy;\n  JsonDocument doc(&spy);\n\n  SECTION(\"integer\") {\n    doc.add(42);\n\n    REQUIRE(doc.as<std::string>() == \"[42]\");\n    REQUIRE(spy.log() == AllocatorLog{\n                             Allocate(sizeofPool()),\n                         });\n  }\n\n  SECTION(\"string literal\") {\n    doc.add(\"hello\");\n\n    REQUIRE(doc.as<std::string>() == \"[\\\"hello\\\"]\");\n    REQUIRE(spy.log() == AllocatorLog{\n                             Allocate(sizeofPool()),\n                             Allocate(sizeofString(\"hello\")),\n                         });\n  }\n\n  SECTION(\"const char*\") {\n    const char* value = \"hello\";\n    doc.add(value);\n\n    REQUIRE(doc.as<std::string>() == \"[\\\"hello\\\"]\");\n    REQUIRE(spy.log() == AllocatorLog{\n                             Allocate(sizeofPool()),\n                             Allocate(sizeofString(\"hello\")),\n                         });\n  }\n\n  SECTION(\"std::string\") {\n    doc.add(\"example\"_s);\n    doc.add(\"example\"_s);\n\n    CHECK(doc[0].as<const char*>() == doc[1].as<const char*>());\n    REQUIRE(spy.log() == AllocatorLog{\n                             Allocate(sizeofPool()),\n                             Allocate(sizeofString(\"example\")),\n                         });\n  }\n\n  SECTION(\"char*\") {\n    char value[] = \"example\";\n    doc.add(value);\n    doc.add(value);\n\n    CHECK(doc[0].as<const char*>() == doc[1].as<const char*>());\n    REQUIRE(spy.log() == AllocatorLog{\n                             Allocate(sizeofPool()),\n                             Allocate(sizeofString(\"example\")),\n                         });\n  }\n\n  SECTION(\"Arduino String\") {\n    doc.add(String(\"example\"));\n    doc.add(String(\"example\"));\n\n    CHECK(doc[0].as<const char*>() == doc[1].as<const char*>());\n    REQUIRE(spy.log() == AllocatorLog{\n                             Allocate(sizeofPool()),\n                             Allocate(sizeofString(\"example\")),\n                         });\n  }\n\n  SECTION(\"Flash string\") {\n    doc.add(F(\"example\"));\n    doc.add(F(\"example\"));\n\n    CHECK(doc[0].as<const char*>() == doc[1].as<const char*>());\n    REQUIRE(spy.log() == AllocatorLog{\n                             Allocate(sizeofPool()),\n                             Allocate(sizeofString(\"example\")),\n                         });\n  }\n\n#ifdef HAS_VARIABLE_LENGTH_ARRAY\n  SECTION(\"VLA\") {\n    size_t i = 16;\n    char vla[i];\n    strcpy(vla, \"example\");\n\n    doc.add(vla);\n    doc.add(vla);\n\n    CHECK(doc[0].as<const char*>() == doc[1].as<const char*>());\n    REQUIRE(\"example\"_s == doc[0]);\n    REQUIRE(spy.log() == AllocatorLog{\n                             Allocate(sizeofPool()),\n                             Allocate(sizeofString(\"example\")),\n                         });\n  }\n#endif\n}\n\nTEST_CASE(\"JsonDocument::add<T>()\") {\n  JsonDocument doc;\n\n  SECTION(\"JsonArray\") {\n    JsonArray array = doc.add<JsonArray>();\n    array.add(1);\n    array.add(2);\n    REQUIRE(doc.as<std::string>() == \"[[1,2]]\");\n  }\n\n  SECTION(\"JsonVariant\") {\n    JsonVariant variant = doc.add<JsonVariant>();\n    variant.set(42);\n    REQUIRE(doc.as<std::string>() == \"[42]\");\n  }\n}\n\nTEST_CASE(\"JsonObject::add(JsonObject) \") {\n  JsonDocument doc1;\n  doc1[\"hello\"_s] = \"world\"_s;\n\n  TimebombAllocator allocator(10);\n  SpyingAllocator spy(&allocator);\n  JsonDocument doc2(&spy);\n\n  SECTION(\"success\") {\n    bool result = doc2.add(doc1.as<JsonObject>());\n\n    REQUIRE(result == true);\n    REQUIRE(doc2.as<std::string>() == \"[{\\\"hello\\\":\\\"world\\\"}]\");\n    REQUIRE(spy.log() == AllocatorLog{\n                             Allocate(sizeofPool()),\n                             Allocate(sizeofString(\"hello\")),\n                             Allocate(sizeofString(\"world\")),\n                         });\n  }\n\n  SECTION(\"partial failure\") {  // issue #2081\n    allocator.setCountdown(2);\n\n    bool result = doc2.add(doc1.as<JsonObject>());\n\n    REQUIRE(result == false);\n    REQUIRE(doc2.as<std::string>() == \"[]\");\n    REQUIRE(spy.log() == AllocatorLog{\n                             Allocate(sizeofPool()),\n                             Allocate(sizeofString(\"hello\")),\n                             AllocateFail(sizeofString(\"world\")),\n                             Deallocate(sizeofString(\"hello\")),\n                         });\n  }\n\n  SECTION(\"complete failure\") {\n    allocator.setCountdown(0);\n\n    bool result = doc2.add(doc1.as<JsonObject>());\n\n    REQUIRE(result == false);\n    REQUIRE(doc2.as<std::string>() == \"[]\");\n    REQUIRE(spy.log() == AllocatorLog{\n                             AllocateFail(sizeofPool()),\n                         });\n  }\n}\n"
  },
  {
    "path": "extras/tests/JsonDocument/assignment.cpp",
    "content": "// ArduinoJson - https://arduinojson.org\n// Copyright © 2014-2025, Benoit BLANCHON\n// MIT License\n\n#include <ArduinoJson.h>\n#include <catch.hpp>\n\n#include \"Allocators.hpp\"\n#include \"Literals.hpp\"\n\nTEST_CASE(\"JsonDocument assignment\") {\n  SpyingAllocator spyingAllocator;\n\n  SECTION(\"Copy assignment same capacity\") {\n    JsonDocument doc1(&spyingAllocator);\n    deserializeJson(doc1, \"{\\\"hello\\\":\\\"world\\\"}\");\n    JsonDocument doc2(&spyingAllocator);\n    spyingAllocator.clearLog();\n\n    doc2 = doc1;\n\n    REQUIRE(doc2.as<std::string>() == \"{\\\"hello\\\":\\\"world\\\"}\");\n\n    REQUIRE(spyingAllocator.log() == AllocatorLog{\n                                         Allocate(sizeofPool()),\n                                         Allocate(sizeofString(\"hello\")),\n                                         Allocate(sizeofString(\"world\")),\n                                     });\n  }\n\n  SECTION(\"Copy assignment reallocates when capacity is smaller\") {\n    JsonDocument doc1(&spyingAllocator);\n    deserializeJson(doc1, \"[{\\\"hello\\\":\\\"world\\\"}]\");\n    JsonDocument doc2(&spyingAllocator);\n    spyingAllocator.clearLog();\n\n    doc2 = doc1;\n\n    REQUIRE(doc2.as<std::string>() == \"[{\\\"hello\\\":\\\"world\\\"}]\");\n    REQUIRE(spyingAllocator.log() == AllocatorLog{\n                                         Allocate(sizeofPool()),\n                                         Allocate(sizeofString(\"hello\")),\n                                         Allocate(sizeofString(\"world\")),\n                                     });\n  }\n\n  SECTION(\"Copy assignment reallocates when capacity is larger\") {\n    JsonDocument doc1(&spyingAllocator);\n    deserializeJson(doc1, \"{\\\"hello\\\":\\\"world\\\"}\");\n    JsonDocument doc2(&spyingAllocator);\n    spyingAllocator.clearLog();\n\n    doc2 = doc1;\n\n    REQUIRE(doc2.as<std::string>() == \"{\\\"hello\\\":\\\"world\\\"}\");\n    REQUIRE(spyingAllocator.log() == AllocatorLog{\n                                         Allocate(sizeofPool()),\n                                         Allocate(sizeofString(\"hello\")),\n                                         Allocate(sizeofString(\"world\")),\n                                     });\n  }\n\n  SECTION(\"Move assign\") {\n    {\n      JsonDocument doc1(&spyingAllocator);\n      doc1[\"hello\"_s] = \"world\"_s;\n      JsonDocument doc2(&spyingAllocator);\n\n      doc2 = std::move(doc1);\n\n      REQUIRE(doc2.as<std::string>() == \"{\\\"hello\\\":\\\"world\\\"}\");\n\n      // NOLINTNEXTLINE(clang-analyzer-cplusplus.Move)\n      REQUIRE(doc1.as<std::string>() == \"null\");\n    }\n    REQUIRE(spyingAllocator.log() == AllocatorLog{\n                                         Allocate(sizeofPool()),\n                                         Allocate(sizeofString(\"hello\")),\n                                         Allocate(sizeofString(\"world\")),\n                                         Deallocate(sizeofString(\"hello\")),\n                                         Deallocate(sizeofString(\"world\")),\n                                         Deallocate(sizeofPool()),\n                                     });\n  }\n\n  SECTION(\"Assign from JsonObject\") {\n    JsonDocument doc1;\n    JsonObject obj = doc1.to<JsonObject>();\n    obj[\"hello\"] = \"world\";\n\n    JsonDocument doc2;\n    doc2 = obj;\n\n    REQUIRE(doc2.as<std::string>() == \"{\\\"hello\\\":\\\"world\\\"}\");\n  }\n\n  SECTION(\"Assign from JsonArray\") {\n    JsonDocument doc1;\n    JsonArray arr = doc1.to<JsonArray>();\n    arr.add(\"hello\");\n\n    JsonDocument doc2;\n    doc2 = arr;\n\n    REQUIRE(doc2.as<std::string>() == \"[\\\"hello\\\"]\");\n  }\n\n  SECTION(\"Assign from JsonVariant\") {\n    JsonDocument doc1;\n    deserializeJson(doc1, \"42\");\n\n    JsonDocument doc2;\n    doc2 = doc1.as<JsonVariant>();\n\n    REQUIRE(doc2.as<std::string>() == \"42\");\n  }\n\n  SECTION(\"Assign from MemberProxy\") {\n    JsonDocument doc1;\n    doc1[\"value\"] = 42;\n\n    JsonDocument doc2;\n    doc2 = doc1[\"value\"];\n\n    REQUIRE(doc2.as<std::string>() == \"42\");\n  }\n\n  SECTION(\"Assign from ElementProxy\") {\n    JsonDocument doc1;\n    doc1[0] = 42;\n\n    JsonDocument doc2;\n    doc2 = doc1[0];\n\n    REQUIRE(doc2.as<std::string>() == \"42\");\n  }\n}\n"
  },
  {
    "path": "extras/tests/JsonDocument/cast.cpp",
    "content": "// ArduinoJson - https://arduinojson.org\n// Copyright © 2014-2025, Benoit BLANCHON\n// MIT License\n\n#include <ArduinoJson.h>\n#include <catch.hpp>\n\n#include <string>\n\nTEST_CASE(\"Implicit cast to JsonVariant\") {\n  JsonDocument doc;\n\n  doc[\"hello\"] = \"world\";\n\n  JsonVariant var = doc;\n\n  CHECK(var.as<std::string>() == \"{\\\"hello\\\":\\\"world\\\"}\");\n}\n"
  },
  {
    "path": "extras/tests/JsonDocument/clear.cpp",
    "content": "// ArduinoJson - https://arduinojson.org\n// Copyright © 2014-2025, Benoit BLANCHON\n// MIT License\n\n#include <ArduinoJson.h>\n#include <catch.hpp>\n\n#include <stdlib.h>  // malloc, free\n#include <string>\n\n#include \"Allocators.hpp\"\n#include \"Literals.hpp\"\n\nTEST_CASE(\"JsonDocument::clear()\") {\n  SpyingAllocator spy;\n  JsonDocument doc(&spy);\n\n  SECTION(\"null\") {\n    doc.clear();\n\n    REQUIRE(doc.isNull());\n    REQUIRE(spy.log() == AllocatorLog{});\n  }\n\n  SECTION(\"releases resources\") {\n    doc[\"hello\"_s] = \"world\"_s;\n    spy.clearLog();\n\n    doc.clear();\n\n    REQUIRE(doc.isNull());\n    REQUIRE(spy.log() == AllocatorLog{\n                             Deallocate(sizeofPool()),\n                             Deallocate(sizeofString(\"hello\")),\n                             Deallocate(sizeofString(\"world\")),\n                         });\n  }\n\n  SECTION(\"clear free list\") {  // issue #2034\n    JsonObject obj = doc.to<JsonObject>();\n    obj[\"a\"] = 1;\n    obj.clear();  // puts the slot in the free list\n\n    doc.clear();\n\n    doc[\"b\"] = 2;  // will it pick from the free list?\n  }\n}\n"
  },
  {
    "path": "extras/tests/JsonDocument/compare.cpp",
    "content": "// ArduinoJson - https://arduinojson.org\n// Copyright © 2014-2025, Benoit BLANCHON\n// MIT License\n\n#include <ArduinoJson.h>\n#include <catch.hpp>\n\nTEST_CASE(\"JsonDocument::operator==(const JsonDocument&)\") {\n  JsonDocument doc1;\n  JsonDocument doc2;\n\n  SECTION(\"Empty\") {\n    REQUIRE(doc1 == doc2);\n    REQUIRE_FALSE(doc1 != doc2);\n  }\n\n  SECTION(\"With same object\") {\n    doc1[\"hello\"] = \"world\";\n    doc2[\"hello\"] = \"world\";\n    REQUIRE(doc1 == doc2);\n    REQUIRE_FALSE(doc1 != doc2);\n  }\n  SECTION(\"With different object\") {\n    doc1[\"hello\"] = \"world\";\n    doc2[\"world\"] = \"hello\";\n    REQUIRE_FALSE(doc1 == doc2);\n    REQUIRE(doc1 != doc2);\n  }\n}\n"
  },
  {
    "path": "extras/tests/JsonDocument/constructor.cpp",
    "content": "// ArduinoJson - https://arduinojson.org\n// Copyright © 2014-2025, Benoit BLANCHON\n// MIT License\n\n#include <ArduinoJson.h>\n#include <catch.hpp>\n\n#include \"Allocators.hpp\"\n#include \"Literals.hpp\"\n\nTEST_CASE(\"JsonDocument constructor\") {\n  SpyingAllocator spyingAllocator;\n\n  SECTION(\"JsonDocument(size_t)\") {\n    { JsonDocument doc(&spyingAllocator); }\n    REQUIRE(spyingAllocator.log() == AllocatorLog{});\n  }\n\n  SECTION(\"JsonDocument(const JsonDocument&)\") {\n    {\n      JsonDocument doc1(&spyingAllocator);\n      doc1.set(\"The size of this string is 32!!\"_s);\n\n      JsonDocument doc2(doc1);\n\n      REQUIRE(doc1.as<std::string>() == \"The size of this string is 32!!\");\n      REQUIRE(doc2.as<std::string>() == \"The size of this string is 32!!\");\n    }\n    REQUIRE(spyingAllocator.log() == AllocatorLog{\n                                         Allocate(sizeofStringBuffer()),\n                                         Allocate(sizeofStringBuffer()),\n                                         Deallocate(sizeofStringBuffer()),\n                                         Deallocate(sizeofStringBuffer()),\n                                     });\n  }\n\n  SECTION(\"JsonDocument(JsonDocument&&)\") {\n    {\n      JsonDocument doc1(&spyingAllocator);\n      doc1.set(\"The size of this string is 32!!\"_s);\n\n      JsonDocument doc2(std::move(doc1));\n\n      REQUIRE(doc2.as<std::string>() == \"The size of this string is 32!!\");\n\n      // NOLINTNEXTLINE(clang-analyzer-cplusplus.Move)\n      REQUIRE(doc1.as<std::string>() == \"null\");\n    }\n    REQUIRE(spyingAllocator.log() == AllocatorLog{\n                                         Allocate(sizeofStringBuffer()),\n                                         Deallocate(sizeofStringBuffer()),\n                                     });\n  }\n\n  SECTION(\"JsonDocument(JsonObject, Allocator*)\") {\n    JsonDocument doc1;\n    JsonObject obj = doc1.to<JsonObject>();\n    obj[\"hello\"] = \"world\";\n\n    JsonDocument doc2(obj, &spyingAllocator);\n\n    REQUIRE(doc2.as<std::string>() == \"{\\\"hello\\\":\\\"world\\\"}\");\n    REQUIRE(spyingAllocator.log() == AllocatorLog{\n                                         Allocate(sizeofPool()),\n                                         Allocate(sizeofString(\"hello\")),\n                                         Allocate(sizeofString(\"world\")),\n                                     });\n  }\n\n  SECTION(\"JsonDocument(JsonObject)\") {\n    JsonDocument doc1;\n    JsonObject obj = doc1.to<JsonObject>();\n    obj[\"hello\"] = \"world\";\n\n    JsonDocument doc2(obj);\n\n    REQUIRE(doc2.as<std::string>() == \"{\\\"hello\\\":\\\"world\\\"}\");\n  }\n\n  SECTION(\"JsonDocument(JsonArray, Allocator*)\") {\n    JsonDocument doc1;\n    JsonArray arr = doc1.to<JsonArray>();\n    arr.add(\"hello\");\n\n    JsonDocument doc2(arr, &spyingAllocator);\n\n    REQUIRE(doc2.as<std::string>() == \"[\\\"hello\\\"]\");\n    REQUIRE(spyingAllocator.log() == AllocatorLog{\n                                         Allocate(sizeofPool()),\n                                         Allocate(sizeofString(\"hello\")),\n                                     });\n  }\n\n  SECTION(\"JsonDocument(JsonArray)\") {\n    JsonDocument doc1;\n    JsonArray arr = doc1.to<JsonArray>();\n    arr.add(\"hello\");\n\n    JsonDocument doc2(arr);\n\n    REQUIRE(doc2.as<std::string>() == \"[\\\"hello\\\"]\");\n  }\n\n  SECTION(\"JsonDocument(JsonVariant, Allocator*)\") {\n    JsonDocument doc1;\n    deserializeJson(doc1, \"\\\"hello\\\"\");\n\n    JsonDocument doc2(doc1.as<JsonVariant>(), &spyingAllocator);\n\n    REQUIRE(doc2.as<std::string>() == \"hello\");\n    REQUIRE(spyingAllocator.log() == AllocatorLog{\n                                         Allocate(sizeofString(\"hello\")),\n                                     });\n  }\n\n  SECTION(\"JsonDocument(JsonVariant)\") {\n    JsonDocument doc1;\n    deserializeJson(doc1, \"\\\"hello\\\"\");\n\n    JsonDocument doc2(doc1.as<JsonVariant>());\n\n    REQUIRE(doc2.as<std::string>() == \"hello\");\n  }\n\n  SECTION(\"JsonDocument(JsonVariantConst)\") {\n    JsonDocument doc1;\n    deserializeJson(doc1, \"\\\"hello\\\"\");\n\n    JsonDocument doc2(doc1.as<JsonVariantConst>());\n\n    REQUIRE(doc2.as<std::string>() == \"hello\");\n  }\n\n  SECTION(\"JsonDocument(ElementProxy)\") {\n    JsonDocument doc1;\n    deserializeJson(doc1, \"[\\\"hello\\\",\\\"world\\\"]\");\n\n    JsonDocument doc2(doc1[1]);\n\n    REQUIRE(doc2.as<std::string>() == \"world\");\n  }\n\n  SECTION(\"JsonDocument(MemberProxy)\") {\n    JsonDocument doc1;\n    deserializeJson(doc1, \"{\\\"hello\\\":\\\"world\\\"}\");\n\n    JsonDocument doc2(doc1[\"hello\"]);\n\n    REQUIRE(doc2.as<std::string>() == \"world\");\n  }\n}\n"
  },
  {
    "path": "extras/tests/JsonDocument/isNull.cpp",
    "content": "// ArduinoJson - https://arduinojson.org\n// Copyright © 2014-2025, Benoit BLANCHON\n// MIT License\n\n#include <ArduinoJson.h>\n#include <catch.hpp>\n\nTEST_CASE(\"JsonDocument::isNull()\") {\n  JsonDocument doc;\n\n  SECTION(\"returns true if uninitialized\") {\n    REQUIRE(doc.isNull() == true);\n  }\n\n  SECTION(\"returns false after to<JsonObject>()\") {\n    doc.to<JsonObject>();\n    REQUIRE(doc.isNull() == false);\n  }\n\n  SECTION(\"returns false after to<JsonArray>()\") {\n    doc.to<JsonArray>();\n    REQUIRE(doc.isNull() == false);\n  }\n\n  SECTION(\"returns true after to<JsonVariant>()\") {\n    REQUIRE(doc.isNull() == true);\n  }\n\n  SECTION(\"returns false after set()\") {\n    doc.to<JsonVariant>().set(42);\n    REQUIRE(doc.isNull() == false);\n  }\n\n  SECTION(\"returns true after clear()\") {\n    doc.to<JsonObject>();\n    doc.clear();\n    REQUIRE(doc.isNull() == true);\n  }\n}\n"
  },
  {
    "path": "extras/tests/JsonDocument/issue1120.cpp",
    "content": "#include <ArduinoJson.h>\n\n#include <catch.hpp>\n\n#include \"Literals.hpp\"\n\nTEST_CASE(\"Issue #1120\") {\n  JsonDocument doc;\n  constexpr char str[] =\n      \"{\\\"contents\\\":[{\\\"module\\\":\\\"Packet\\\"},{\\\"module\\\":\\\"Analog\\\"}]}\";\n  deserializeJson(doc, str);\n\n  SECTION(\"MemberProxy<std::string>::isNull()\") {\n    SECTION(\"returns false\") {\n      CHECK(doc[\"contents\"_s].isNull() == false);\n    }\n\n    SECTION(\"returns true\") {\n      CHECK(doc[\"zontents\"_s].isNull() == true);\n    }\n  }\n\n  SECTION(\"ElementProxy<MemberProxy<const char*> >::isNull()\") {\n    SECTION(\"returns false\") {  // Issue #1120\n      CHECK(doc[\"contents\"][1].isNull() == false);\n    }\n\n    SECTION(\"returns true\") {\n      CHECK(doc[\"contents\"][2].isNull() == true);\n    }\n  }\n\n  SECTION(\"MemberProxy<ElementProxy<MemberProxy>, const char*>::isNull()\") {\n    SECTION(\"returns false\") {\n      CHECK(doc[\"contents\"][1][\"module\"].isNull() == false);\n    }\n\n    SECTION(\"returns true\") {\n      CHECK(doc[\"contents\"][1][\"zodule\"].isNull() == true);\n    }\n  }\n\n  SECTION(\"MemberProxy<ElementProxy<MemberProxy>, std::string>::isNull()\") {\n    SECTION(\"returns false\") {\n      CHECK(doc[\"contents\"][1][\"module\"_s].isNull() == false);\n    }\n\n    SECTION(\"returns true\") {\n      CHECK(doc[\"contents\"][1][\"zodule\"_s].isNull() == true);\n    }\n  }\n}\n"
  },
  {
    "path": "extras/tests/JsonDocument/nesting.cpp",
    "content": "// ArduinoJson - https://arduinojson.org\n// Copyright © 2014-2025, Benoit BLANCHON\n// MIT License\n\n#include <ArduinoJson.h>\n#include <catch.hpp>\n\nTEST_CASE(\"JsonDocument::nesting()\") {\n  JsonDocument doc;\n\n  SECTION(\"return 0 if uninitialized\") {\n    REQUIRE(doc.nesting() == 0);\n  }\n\n  SECTION(\"returns 0 for string\") {\n    JsonVariant var = doc.to<JsonVariant>();\n    var.set(\"hello\");\n    REQUIRE(doc.nesting() == 0);\n  }\n\n  SECTION(\"returns 1 for empty object\") {\n    doc.to<JsonObject>();\n    REQUIRE(doc.nesting() == 1);\n  }\n\n  SECTION(\"returns 1 for empty array\") {\n    doc.to<JsonArray>();\n    REQUIRE(doc.nesting() == 1);\n  }\n}\n"
  },
  {
    "path": "extras/tests/JsonDocument/overflowed.cpp",
    "content": "// ArduinoJson - https://arduinojson.org\n// Copyright © 2014-2025, Benoit BLANCHON\n// MIT License\n\n#include <ArduinoJson.h>\n#include <catch.hpp>\n\n#include \"Allocators.hpp\"\n#include \"Literals.hpp\"\n\nTEST_CASE(\"JsonDocument::overflowed()\") {\n  TimebombAllocator timebomb(10);\n  JsonDocument doc(&timebomb);\n\n  SECTION(\"returns false on a fresh object\") {\n    timebomb.setCountdown(0);\n    CHECK(doc.overflowed() == false);\n  }\n\n  SECTION(\"returns true after a failed insertion\") {\n    timebomb.setCountdown(0);\n    doc.add(0);\n    CHECK(doc.overflowed() == true);\n  }\n\n  SECTION(\"returns false after successful insertion\") {\n    timebomb.setCountdown(2);\n    doc.add(0);\n    CHECK(doc.overflowed() == false);\n  }\n\n  SECTION(\"returns true after a failed string copy\") {\n    timebomb.setCountdown(0);\n    doc.add(\"example\"_s);\n    CHECK(doc.overflowed() == true);\n  }\n\n  SECTION(\"returns false after a successful string copy\") {\n    timebomb.setCountdown(3);\n    doc.add(\"example\"_s);\n    CHECK(doc.overflowed() == false);\n  }\n\n  SECTION(\"returns true after a failed member add\") {\n    timebomb.setCountdown(0);\n    doc[\"example\"] = true;\n    CHECK(doc.overflowed() == true);\n  }\n\n  SECTION(\"returns true after a failed deserialization\") {\n    timebomb.setCountdown(0);\n    deserializeJson(doc, \"[1, 2]\");\n    CHECK(doc.overflowed() == true);\n  }\n\n  SECTION(\"returns false after a successful deserialization\") {\n    timebomb.setCountdown(3);\n    deserializeJson(doc, \"[\\\"example\\\"]\");\n    CHECK(doc.overflowed() == false);\n  }\n\n  SECTION(\"returns false after clear()\") {\n    timebomb.setCountdown(0);\n    doc.add(0);\n    doc.clear();\n    CHECK(doc.overflowed() == false);\n  }\n\n  SECTION(\"remains false after shrinkToFit()\") {\n    timebomb.setCountdown(2);\n    doc.add(0);\n    timebomb.setCountdown(2);\n    doc.shrinkToFit();\n    CHECK(doc.overflowed() == false);\n  }\n\n  SECTION(\"remains true after shrinkToFit()\") {\n    timebomb.setCountdown(0);\n    doc.add(0);\n    timebomb.setCountdown(2);\n    doc.shrinkToFit();\n    CHECK(doc.overflowed() == true);\n  }\n\n  SECTION(\"returns false when string length doesn't overflow\") {\n    auto maxLength = ArduinoJson::detail::StringNode::maxLength;\n    CHECK(doc.set(std::string(maxLength, 'a')) == true);\n    CHECK(doc.overflowed() == false);\n  }\n\n  SECTION(\"returns true when string length overflows\") {\n    auto maxLength = ArduinoJson::detail::StringNode::maxLength;\n    CHECK(doc.set(std::string(maxLength + 1, 'a')) == false);\n    CHECK(doc.overflowed() == true);\n  }\n}\n"
  },
  {
    "path": "extras/tests/JsonDocument/remove.cpp",
    "content": "// ArduinoJson - https://arduinojson.org\n// Copyright © 2014-2025, Benoit BLANCHON\n// MIT License\n\n#include <ArduinoJson.h>\n#include <catch.hpp>\n\n#include \"Literals.hpp\"\n\nTEST_CASE(\"JsonDocument::remove()\") {\n  JsonDocument doc;\n\n  SECTION(\"remove(int)\") {\n    doc.add(1);\n    doc.add(2);\n    doc.add(3);\n\n    doc.remove(1);\n\n    REQUIRE(doc.as<std::string>() == \"[1,3]\");\n  }\n\n  SECTION(\"string literal\") {\n    doc[\"a\"] = 1;\n    doc[\"ab\"_s] = 2;\n    doc[\"b\"] = 3;\n\n    doc.remove(\"ab\");\n\n    REQUIRE(doc.as<std::string>() == \"{\\\"a\\\":1,\\\"b\\\":3}\");\n  }\n\n  SECTION(\"remove(const char *)\") {\n    doc[\"a\"] = 1;\n    doc[\"b\"] = 2;\n\n    doc.remove(static_cast<const char*>(\"a\"));\n\n    REQUIRE(doc.as<std::string>() == \"{\\\"b\\\":2}\");\n  }\n\n  SECTION(\"remove(std::string)\") {\n    doc[\"a\"] = 1;\n    doc[\"b\"] = 2;\n\n    doc.remove(\"b\"_s);\n\n    REQUIRE(doc.as<std::string>() == \"{\\\"a\\\":1}\");\n  }\n\n#ifdef HAS_VARIABLE_LENGTH_ARRAY\n  SECTION(\"remove(vla)\") {\n    doc[\"a\"] = 1;\n    doc[\"b\"] = 2;\n\n    size_t i = 4;\n    char vla[i];\n    strcpy(vla, \"b\");\n    doc.remove(vla);\n\n    REQUIRE(doc.as<std::string>() == \"{\\\"a\\\":1}\");\n  }\n#endif\n\n  SECTION(\"remove(JsonVariant) from object\") {\n    doc[\"a\"] = 1;\n    doc[\"b\"] = 2;\n    doc[\"c\"] = \"b\";\n\n    doc.remove(doc[\"c\"]);\n\n    REQUIRE(doc.as<std::string>() == \"{\\\"a\\\":1,\\\"c\\\":\\\"b\\\"}\");\n  }\n\n  SECTION(\"remove(JsonVariant) from array\") {\n    doc[0] = 3;\n    doc[1] = 2;\n    doc[2] = 1;\n\n    doc.remove(doc[2]);\n    doc.remove(doc[3]);  // noop\n\n    REQUIRE(doc.as<std::string>() == \"[3,1]\");\n  }\n}\n"
  },
  {
    "path": "extras/tests/JsonDocument/set.cpp",
    "content": "#define ARDUINOJSON_ENABLE_ARDUINO_STRING 1\n#define ARDUINOJSON_ENABLE_PROGMEM 1\n#include <ArduinoJson.h>\n\n#include <catch.hpp>\n\n#include \"Allocators.hpp\"\n#include \"Literals.hpp\"\n\nTEST_CASE(\"JsonDocument::set()\") {\n  SpyingAllocator spy;\n  JsonDocument doc(&spy);\n\n  SECTION(\"nullptr\") {\n    doc.set(nullptr);\n\n    REQUIRE(doc.isNull());\n    REQUIRE(spy.log() == AllocatorLog{});\n  }\n\n  SECTION(\"integer&\") {\n    int toto = 42;\n    doc.set(toto);\n\n    REQUIRE(doc.as<std::string>() == \"42\");\n    REQUIRE(spy.log() == AllocatorLog{});\n  }\n\n  SECTION(\"integer\") {\n    doc.set(42);\n\n    REQUIRE(doc.as<std::string>() == \"42\");\n    REQUIRE(spy.log() == AllocatorLog{});\n  }\n\n  SECTION(\"string literal\") {\n    doc.set(\"example\");\n\n    REQUIRE(doc.as<const char*>() == \"example\"_s);\n    REQUIRE(spy.log() == AllocatorLog{\n                             Allocate(sizeofString(\"example\")),\n                         });\n  }\n\n  SECTION(\"const char*\") {\n    const char* value = \"example\";\n    doc.set(value);\n\n    REQUIRE(doc.as<const char*>() == \"example\"_s);\n    REQUIRE(spy.log() == AllocatorLog{\n                             Allocate(sizeofString(\"example\")),\n                         });\n  }\n\n  SECTION(\"std::string\") {\n    doc.set(\"example\"_s);\n\n    REQUIRE(doc.as<const char*>() == \"example\"_s);\n    REQUIRE(spy.log() == AllocatorLog{\n                             Allocate(sizeofString(\"example\")),\n                         });\n  }\n\n  SECTION(\"char*\") {\n    char value[] = \"example\";\n    doc.set(value);\n\n    REQUIRE(doc.as<const char*>() == \"example\"_s);\n    REQUIRE(spy.log() == AllocatorLog{\n                             Allocate(sizeofString(\"example\")),\n                         });\n  }\n\n  SECTION(\"Arduino String\") {\n    doc.set(String(\"example\"));\n\n    REQUIRE(doc.as<const char*>() == \"example\"_s);\n    REQUIRE(spy.log() == AllocatorLog{\n                             Allocate(sizeofString(\"example\")),\n                         });\n  }\n\n  SECTION(\"Flash string\") {\n    doc.set(F(\"example\"));\n\n    REQUIRE(doc.as<const char*>() == \"example\"_s);\n    REQUIRE(spy.log() == AllocatorLog{\n                             Allocate(sizeofString(\"example\")),\n                         });\n  }\n\n  SECTION(\"Flash tiny string\") {  // issue #2170\n    doc.set(F(\"abc\"));\n\n    REQUIRE(doc.as<const char*>() == \"abc\"_s);\n    REQUIRE(spy.log() == AllocatorLog{});\n  }\n\n#ifdef HAS_VARIABLE_LENGTH_ARRAY\n  SECTION(\"VLA\") {\n    size_t i = 16;\n    char vla[i];\n    strcpy(vla, \"example\");\n\n    doc.set(vla);\n\n    REQUIRE(doc.as<const char*>() == \"example\"_s);\n    REQUIRE(spy.log() == AllocatorLog{\n                             Allocate(sizeofString(\"example\")),\n                         });\n  }\n#endif\n}\n"
  },
  {
    "path": "extras/tests/JsonDocument/shrinkToFit.cpp",
    "content": "// ArduinoJson - https://arduinojson.org\n// Copyright © 2014-2025, Benoit BLANCHON\n// MIT License\n\n#include <ArduinoJson.h>\n#include <catch.hpp>\n\n#include <stdlib.h>  // malloc, free\n#include <string>\n\n#include \"Allocators.hpp\"\n#include \"Literals.hpp\"\n\nusing ArduinoJson::detail::sizeofArray;\nusing ArduinoJson::detail::sizeofObject;\n\nclass ArmoredAllocator : public Allocator {\n public:\n  virtual ~ArmoredAllocator() {}\n\n  void* allocate(size_t size) override {\n    return malloc(size);\n  }\n\n  void deallocate(void* ptr) override {\n    free(ptr);\n  }\n\n  void* reallocate(void* ptr, size_t new_size) override {\n    // don't call realloc, instead alloc a new buffer and erase the old one\n    // this way we make sure we support relocation\n    void* new_ptr = malloc(new_size);\n    memset(new_ptr, '#', new_size);  // erase\n    if (ptr) {\n      memcpy(new_ptr, ptr, std::min(new_size, new_size));\n      free(ptr);\n    }\n    return new_ptr;\n  }\n};\n\nTEST_CASE(\"JsonDocument::shrinkToFit()\") {\n  ArmoredAllocator armoredAllocator;\n  SpyingAllocator spyingAllocator(&armoredAllocator);\n  JsonDocument doc(&spyingAllocator);\n\n  SECTION(\"null\") {\n    doc.shrinkToFit();\n\n    REQUIRE(doc.as<std::string>() == \"null\");\n    REQUIRE(spyingAllocator.log() == AllocatorLog{});\n  }\n\n  SECTION(\"empty object\") {\n    deserializeJson(doc, \"{}\");\n\n    doc.shrinkToFit();\n\n    REQUIRE(doc.as<std::string>() == \"{}\");\n    REQUIRE(spyingAllocator.log() == AllocatorLog{});\n  }\n\n  SECTION(\"empty array\") {\n    deserializeJson(doc, \"[]\");\n\n    doc.shrinkToFit();\n\n    REQUIRE(doc.as<std::string>() == \"[]\");\n    REQUIRE(spyingAllocator.log() == AllocatorLog{});\n  }\n\n  SECTION(\"string\") {\n    doc.set(\"abcdefg\");\n    REQUIRE(doc.as<std::string>() == \"abcdefg\");\n\n    doc.shrinkToFit();\n\n    REQUIRE(doc.as<std::string>() == \"abcdefg\");\n    REQUIRE(spyingAllocator.log() == AllocatorLog{\n                                         Allocate(sizeofString(\"abcdefg\")),\n                                     });\n  }\n\n  SECTION(\"raw string\") {\n    doc.set(serialized(\"[{},12]\"));\n\n    doc.shrinkToFit();\n\n    REQUIRE(doc.as<std::string>() == \"[{},12]\");\n    REQUIRE(spyingAllocator.log() == AllocatorLog{\n                                         Allocate(sizeofString(\"[{},12]\")),\n                                     });\n  }\n\n  SECTION(\"object key\") {\n    doc[\"abcdefg\"_s] = 42;\n\n    doc.shrinkToFit();\n\n    REQUIRE(doc.as<std::string>() == \"{\\\"abcdefg\\\":42}\");\n    REQUIRE(spyingAllocator.log() ==\n            AllocatorLog{\n                Allocate(sizeofPool()),\n                Allocate(sizeofString(\"abcdefg\")),\n                Reallocate(sizeofPool(), sizeofObject(1)),\n            });\n  }\n\n  SECTION(\"string in array\") {\n    doc.add(\"abcdefg\"_s);\n\n    doc.shrinkToFit();\n\n    REQUIRE(doc.as<std::string>() == \"[\\\"abcdefg\\\"]\");\n    REQUIRE(spyingAllocator.log() ==\n            AllocatorLog{\n                Allocate(sizeofPool()),\n                Allocate(sizeofString(\"abcdefg\")),\n                Reallocate(sizeofPool(), sizeofArray(1)),\n            });\n  }\n\n  SECTION(\"string in object\") {\n    doc[\"key\"] = \"abcdefg\"_s;\n\n    doc.shrinkToFit();\n\n    REQUIRE(doc.as<std::string>() == \"{\\\"key\\\":\\\"abcdefg\\\"}\");\n    REQUIRE(spyingAllocator.log() ==\n            AllocatorLog{\n                Allocate(sizeofPool()),\n                Allocate(sizeofString(\"abcdefg\")),\n                Reallocate(sizeofPool(), sizeofPool(2)),\n            });\n  }\n}\n"
  },
  {
    "path": "extras/tests/JsonDocument/size.cpp",
    "content": "// ArduinoJson - https://arduinojson.org\n// Copyright © 2014-2025, Benoit BLANCHON\n// MIT License\n\n#include <ArduinoJson.h>\n#include <catch.hpp>\n\nTEST_CASE(\"JsonDocument::size()\") {\n  JsonDocument doc;\n\n  SECTION(\"returns 0\") {\n    REQUIRE(doc.size() == 0);\n  }\n\n  SECTION(\"as an array, return 2\") {\n    doc.add(1);\n    doc.add(2);\n\n    REQUIRE(doc.size() == 2);\n  }\n\n  SECTION(\"as an object, return 2\") {\n    doc[\"a\"] = 1;\n    doc[\"b\"] = 2;\n\n    REQUIRE(doc.size() == 2);\n  }\n}\n"
  },
  {
    "path": "extras/tests/JsonDocument/subscript.cpp",
    "content": "// ArduinoJson - https://arduinojson.org\n// Copyright © 2014-2025, Benoit BLANCHON\n// MIT License\n\n#include <ArduinoJson.h>\n#include <catch.hpp>\n\n#include \"Allocators.hpp\"\n#include \"Literals.hpp\"\n\nTEST_CASE(\"JsonDocument::operator[]\") {\n  JsonDocument doc;\n  const JsonDocument& cdoc = doc;\n\n  SECTION(\"object\") {\n    doc[\"abc\"_s] = \"ABC\";\n    doc[\"abcd\"_s] = \"ABCD\";\n\n    SECTION(\"const char*\") {\n      const char* key = \"abc\";\n      REQUIRE(doc[key] == \"ABC\");\n      REQUIRE(cdoc[key] == \"ABC\");\n    }\n\n    SECTION(\"string literal\") {\n      REQUIRE(doc[\"abc\"] == \"ABC\");\n      REQUIRE(cdoc[\"abc\"] == \"ABC\");\n      REQUIRE(doc[\"abcd\"] == \"ABCD\");\n      REQUIRE(cdoc[\"abcd\"] == \"ABCD\");\n    }\n\n    SECTION(\"std::string\") {\n      REQUIRE(doc[\"abc\"_s] == \"ABC\");\n      REQUIRE(cdoc[\"abc\"_s] == \"ABC\");\n      REQUIRE(doc[\"abcd\"_s] == \"ABCD\");\n      REQUIRE(cdoc[\"abcd\"_s] == \"ABCD\");\n    }\n\n    SECTION(\"JsonVariant\") {\n      doc[\"key1\"] = \"abc\";\n      doc[\"key2\"] = \"abcd\"_s;\n      doc[\"key3\"] = \"foo\";\n\n      CHECK(doc[doc[\"key1\"]] == \"ABC\");\n      CHECK(doc[doc[\"key2\"]] == \"ABCD\");\n      CHECK(doc[doc[\"key3\"]] == nullptr);\n      CHECK(doc[doc[\"key4\"]] == nullptr);\n\n      CHECK(cdoc[cdoc[\"key1\"]] == \"ABC\");\n      CHECK(cdoc[cdoc[\"key2\"]] == \"ABCD\");\n      CHECK(cdoc[cdoc[\"key3\"]] == nullptr);\n      CHECK(cdoc[cdoc[\"key4\"]] == nullptr);\n    }\n\n    SECTION(\"supports operator|\") {\n      REQUIRE((doc[\"abc\"] | \"nope\") == \"ABC\"_s);\n      REQUIRE((doc[\"def\"] | \"nope\") == \"nope\"_s);\n    }\n\n#if defined(HAS_VARIABLE_LENGTH_ARRAY) && \\\n    !defined(SUBSCRIPT_CONFLICTS_WITH_BUILTIN_OPERATOR)\n    SECTION(\"supports VLAs\") {\n      size_t i = 16;\n      char vla[i];\n      strcpy(vla, \"hello\");\n\n      doc[vla] = \"world\";\n\n      REQUIRE(doc[vla] == \"world\");\n      REQUIRE(cdoc[vla] == \"world\");\n    }\n#endif\n  }\n\n  SECTION(\"array\") {\n    deserializeJson(doc, \"[\\\"hello\\\",\\\"world\\\"]\");\n\n    SECTION(\"int\") {\n      REQUIRE(doc[1] == \"world\");\n      REQUIRE(cdoc[1] == \"world\");\n    }\n\n    SECTION(\"JsonVariant\") {\n      doc[2] = 1;\n      REQUIRE(doc[doc[2]] == \"world\");\n      REQUIRE(cdoc[doc[2]] == \"world\");\n    }\n  }\n}\n\nTEST_CASE(\"JsonDocument automatically promotes to object\") {\n  JsonDocument doc;\n\n  doc[\"one\"][\"two\"][\"three\"] = 4;\n\n  REQUIRE(doc[\"one\"][\"two\"][\"three\"] == 4);\n}\n\nTEST_CASE(\"JsonDocument automatically promotes to array\") {\n  JsonDocument doc;\n\n  doc[2] = 2;\n\n  REQUIRE(doc.as<std::string>() == \"[null,null,2]\");\n}\n\nTEST_CASE(\"JsonDocument::operator[] key storage\") {\n  SpyingAllocator spy;\n  JsonDocument doc(&spy);\n\n  SECTION(\"string literal\") {\n    doc[\"hello\"] = 0;\n\n    REQUIRE(doc.as<std::string>() == \"{\\\"hello\\\":0}\");\n    REQUIRE(spy.log() == AllocatorLog{\n                             Allocate(sizeofPool()),\n                             Allocate(sizeofString(\"hello\")),\n                         });\n  }\n\n  SECTION(\"const char*\") {\n    const char* key = \"hello\";\n    doc[key] = 0;\n\n    REQUIRE(doc.as<std::string>() == \"{\\\"hello\\\":0}\");\n    REQUIRE(spy.log() == AllocatorLog{\n                             Allocate(sizeofPool()),\n                             Allocate(sizeofString(\"hello\")),\n                         });\n  }\n\n  SECTION(\"char[]\") {\n    char key[] = \"hello\";\n    doc[key] = 0;\n\n    REQUIRE(doc.as<std::string>() == \"{\\\"hello\\\":0}\");\n    REQUIRE(spy.log() == AllocatorLog{\n                             Allocate(sizeofPool()),\n                             Allocate(sizeofString(\"hello\")),\n                         });\n  }\n\n  SECTION(\"std::string\") {\n    doc[\"hello\"_s] = 0;\n\n    REQUIRE(doc.as<std::string>() == \"{\\\"hello\\\":0}\");\n    REQUIRE(spy.log() == AllocatorLog{\n                             Allocate(sizeofPool()),\n                             Allocate(sizeofString(\"hello\")),\n                         });\n  }\n#if defined(HAS_VARIABLE_LENGTH_ARRAY) && \\\n    !defined(SUBSCRIPT_CONFLICTS_WITH_BUILTIN_OPERATOR)\n  SECTION(\"VLA\") {\n    size_t i = 16;\n    char vla[i];\n    strcpy(vla, \"hello\");\n\n    doc[vla] = 0;\n\n    REQUIRE(doc.as<std::string>() == \"{\\\"hello\\\":0}\");\n    REQUIRE(spy.log() == AllocatorLog{\n                             Allocate(sizeofPool()),\n                             Allocate(sizeofString(\"hello\")),\n                         });\n  }\n#endif\n}\n"
  },
  {
    "path": "extras/tests/JsonDocument/swap.cpp",
    "content": "#include <ArduinoJson.h>\n\n#include <catch.hpp>\n#include <string>\n#include <utility>\n\nusing namespace std;\n\nTEST_CASE(\"std::swap\") {\n  SECTION(\"JsonDocument*\") {\n    JsonDocument *p1, *p2;\n    swap(p1, p2);  // issue #1678\n  }\n\n  SECTION(\"JsonDocument\") {\n    JsonDocument doc1, doc2;\n    doc1.set(\"hello\");\n    doc2.set(\"world\");\n\n    swap(doc1, doc2);\n\n    CHECK(doc1.as<string>() == \"world\");\n    CHECK(doc2.as<string>() == \"hello\");\n  }\n}\n"
  },
  {
    "path": "extras/tests/JsonObject/CMakeLists.txt",
    "content": "# ArduinoJson - https://arduinojson.org\n# Copyright © 2014-2025, Benoit BLANCHON\n# MIT License\n\nadd_executable(JsonObjectTests\n\tclear.cpp\n\tcompare.cpp\n\tequals.cpp\n\tisNull.cpp\n\titerator.cpp\n\tnesting.cpp\n\tremove.cpp\n\tset.cpp\n\tsize.cpp\n\tstd_string.cpp\n\tsubscript.cpp\n\tunbound.cpp\n)\n\nadd_test(JsonObject JsonObjectTests)\n\nset_tests_properties(JsonObject\n\tPROPERTIES\n\t\tLABELS \"Catch\"\n)\n"
  },
  {
    "path": "extras/tests/JsonObject/clear.cpp",
    "content": "// ArduinoJson - https://arduinojson.org\n// Copyright © 2014-2025, Benoit BLANCHON\n// MIT License\n\n#include <ArduinoJson.h>\n#include <catch.hpp>\n\nTEST_CASE(\"JsonObject::clear()\") {\n  SECTION(\"No-op on null JsonObject\") {\n    JsonObject obj;\n    obj.clear();\n    REQUIRE(obj.isNull() == true);\n    REQUIRE(obj.size() == 0);\n  }\n\n  SECTION(\"Removes all elements\") {\n    JsonDocument doc;\n    JsonObject obj = doc.to<JsonObject>();\n    obj[\"hello\"] = 1;\n    obj[\"world\"] = 2;\n    obj.clear();\n    REQUIRE(obj.size() == 0);\n    REQUIRE(obj.isNull() == false);\n  }\n}\n"
  },
  {
    "path": "extras/tests/JsonObject/compare.cpp",
    "content": "// ArduinoJson - https://arduinojson.org\n// Copyright © 2014-2025, Benoit BLANCHON\n// MIT License\n\n#include <ArduinoJson.h>\n#include <catch.hpp>\n\nTEST_CASE(\"Compare JsonObject with JsonObject\") {\n  JsonDocument doc;\n\n  SECTION(\"Compare with unbound\") {\n    JsonObject object = doc.to<JsonObject>();\n    object[\"a\"] = 1;\n    object[\"b\"] = \"hello\";\n    JsonObject unbound;\n\n    CHECK(object != unbound);\n    CHECK_FALSE(object == unbound);\n    CHECK_FALSE(object <= unbound);\n    CHECK_FALSE(object >= unbound);\n    CHECK_FALSE(object > unbound);\n    CHECK_FALSE(object < unbound);\n\n    CHECK(unbound != object);\n    CHECK_FALSE(unbound == object);\n    CHECK_FALSE(unbound <= object);\n    CHECK_FALSE(unbound >= object);\n    CHECK_FALSE(unbound > object);\n    CHECK_FALSE(unbound < object);\n  }\n\n  SECTION(\"Compare with self\") {\n    JsonObject object = doc.to<JsonObject>();\n    object[\"a\"] = 1;\n    object[\"b\"] = \"hello\";\n\n    CHECK(object == object);\n    CHECK(object <= object);\n    CHECK(object >= object);\n    CHECK_FALSE(object != object);\n    CHECK_FALSE(object > object);\n    CHECK_FALSE(object < object);\n  }\n\n  SECTION(\"Compare with identical object\") {\n    JsonObject object1 = doc.add<JsonObject>();\n    object1[\"a\"] = 1;\n    object1[\"b\"] = \"hello\";\n    object1[\"c\"][0] = false;\n\n    JsonObject object2 = doc.add<JsonObject>();\n    object2[\"a\"] = 1;\n    object2[\"b\"] = \"hello\";\n    object2[\"c\"][0] = false;\n\n    CHECK(object1 == object2);\n    CHECK(object1 <= object2);\n    CHECK(object1 >= object2);\n    CHECK_FALSE(object1 != object2);\n    CHECK_FALSE(object1 > object2);\n    CHECK_FALSE(object1 < object2);\n  }\n\n  SECTION(\"Compare with different object\") {\n    JsonObject object1 = doc.add<JsonObject>();\n    object1[\"a\"] = 1;\n    object1[\"b\"] = \"hello1\";\n    object1[\"c\"][0] = false;\n\n    JsonObject object2 = doc.add<JsonObject>();\n    object2[\"a\"] = 1;\n    object2[\"b\"] = \"hello2\";\n    object2[\"c\"][0] = false;\n\n    CHECK(object1 != object2);\n    CHECK_FALSE(object1 == object2);\n    CHECK_FALSE(object1 > object2);\n    CHECK_FALSE(object1 < object2);\n    CHECK_FALSE(object1 <= object2);\n    CHECK_FALSE(object1 >= object2);\n  }\n}\n\nTEST_CASE(\"Compare JsonObject with JsonVariant\") {\n  JsonDocument doc;\n\n  SECTION(\"Compare with self\") {\n    JsonObject object = doc.to<JsonObject>();\n    object[\"a\"] = 1;\n    object[\"b\"] = \"hello\";\n\n    JsonVariant variant = object;\n\n    CHECK(object == variant);\n    CHECK(object <= variant);\n    CHECK(object >= variant);\n    CHECK_FALSE(object != variant);\n    CHECK_FALSE(object > variant);\n    CHECK_FALSE(object < variant);\n\n    CHECK(variant == object);\n    CHECK(variant <= object);\n    CHECK(variant >= object);\n    CHECK_FALSE(variant != object);\n    CHECK_FALSE(variant > object);\n    CHECK_FALSE(variant < object);\n  }\n\n  SECTION(\"Compare with identical object\") {\n    JsonObject object = doc.add<JsonObject>();\n    object[\"a\"] = 1;\n    object[\"b\"] = \"hello\";\n    object[\"c\"][0] = false;\n\n    JsonVariant variant = doc.add<JsonObject>();\n    variant[\"a\"] = 1;\n    variant[\"b\"] = \"hello\";\n    variant[\"c\"][0] = false;\n\n    CHECK(object == variant);\n    CHECK(object <= variant);\n    CHECK(object >= variant);\n    CHECK_FALSE(object != variant);\n    CHECK_FALSE(object > variant);\n    CHECK_FALSE(object < variant);\n\n    CHECK(variant == object);\n    CHECK(variant <= object);\n    CHECK(variant >= object);\n    CHECK_FALSE(variant != object);\n    CHECK_FALSE(variant > object);\n    CHECK_FALSE(variant < object);\n  }\n\n  SECTION(\"Compare with different object\") {\n    JsonObject object = doc.add<JsonObject>();\n    object[\"a\"] = 1;\n    object[\"b\"] = \"hello1\";\n    object[\"c\"][0] = false;\n\n    JsonVariant variant = doc.add<JsonObject>();\n    variant[\"a\"] = 1;\n    variant[\"b\"] = \"hello2\";\n    variant[\"c\"][0] = false;\n\n    CHECK(object != variant);\n    CHECK_FALSE(object == variant);\n    CHECK_FALSE(object > variant);\n    CHECK_FALSE(object < variant);\n    CHECK_FALSE(object <= variant);\n    CHECK_FALSE(object >= variant);\n  }\n}\n\nTEST_CASE(\"Compare JsonObject with JsonVariantConst\") {\n  JsonDocument doc;\n\n  SECTION(\"Compare with unbound\") {\n    JsonObject object = doc.to<JsonObject>();\n    object[\"a\"] = 1;\n    object[\"b\"] = \"hello\";\n    JsonVariantConst unbound;\n\n    CHECK(object != unbound);\n    CHECK_FALSE(object == unbound);\n    CHECK_FALSE(object <= unbound);\n    CHECK_FALSE(object >= unbound);\n    CHECK_FALSE(object > unbound);\n    CHECK_FALSE(object < unbound);\n\n    CHECK(unbound != object);\n    CHECK_FALSE(unbound == object);\n    CHECK_FALSE(unbound <= object);\n    CHECK_FALSE(unbound >= object);\n    CHECK_FALSE(unbound > object);\n    CHECK_FALSE(unbound < object);\n  }\n\n  SECTION(\"Compare with self\") {\n    JsonObject object = doc.to<JsonObject>();\n    object[\"a\"] = 1;\n    object[\"b\"] = \"hello\";\n\n    JsonVariantConst variant = object;\n\n    CHECK(object == variant);\n    CHECK(object <= variant);\n    CHECK(object >= variant);\n    CHECK_FALSE(object != variant);\n    CHECK_FALSE(object > variant);\n    CHECK_FALSE(object < variant);\n\n    CHECK(variant == object);\n    CHECK(variant <= object);\n    CHECK(variant >= object);\n    CHECK_FALSE(variant != object);\n    CHECK_FALSE(variant > object);\n    CHECK_FALSE(variant < object);\n  }\n\n  SECTION(\"Compare with identical object\") {\n    JsonObject object = doc.add<JsonObject>();\n    object[\"a\"] = 1;\n    object[\"b\"] = \"hello\";\n    object[\"c\"][0] = false;\n\n    JsonObject object2 = doc.add<JsonObject>();\n    object2[\"a\"] = 1;\n    object2[\"b\"] = \"hello\";\n    object2[\"c\"][0] = false;\n    JsonVariantConst variant = object2;\n\n    CHECK(object == variant);\n    CHECK(object <= variant);\n    CHECK(object >= variant);\n    CHECK_FALSE(object != variant);\n    CHECK_FALSE(object > variant);\n    CHECK_FALSE(object < variant);\n\n    CHECK(variant == object);\n    CHECK(variant <= object);\n    CHECK(variant >= object);\n    CHECK_FALSE(variant != object);\n    CHECK_FALSE(variant > object);\n    CHECK_FALSE(variant < object);\n  }\n\n  SECTION(\"Compare with different object\") {\n    JsonObject object = doc.add<JsonObject>();\n    object[\"a\"] = 1;\n    object[\"b\"] = \"hello1\";\n    object[\"c\"][0] = false;\n\n    JsonObject object2 = doc.add<JsonObject>();\n    object2[\"a\"] = 1;\n    object2[\"b\"] = \"hello2\";\n    object2[\"c\"][0] = false;\n    JsonVariantConst variant = object2;\n\n    CHECK(object != variant);\n    CHECK_FALSE(object == variant);\n    CHECK_FALSE(object > variant);\n    CHECK_FALSE(object < variant);\n    CHECK_FALSE(object <= variant);\n    CHECK_FALSE(object >= variant);\n  }\n}\n\nTEST_CASE(\"Compare JsonObject with JsonObjectConst\") {\n  JsonDocument doc;\n\n  SECTION(\"Compare with unbound\") {\n    JsonObject object = doc.to<JsonObject>();\n    object[\"a\"] = 1;\n    object[\"b\"] = \"hello\";\n    JsonObjectConst unbound;\n\n    CHECK(object != unbound);\n    CHECK_FALSE(object == unbound);\n    CHECK_FALSE(object <= unbound);\n    CHECK_FALSE(object >= unbound);\n    CHECK_FALSE(object > unbound);\n    CHECK_FALSE(object < unbound);\n\n    CHECK(unbound != object);\n    CHECK_FALSE(unbound == object);\n    CHECK_FALSE(unbound <= object);\n    CHECK_FALSE(unbound >= object);\n    CHECK_FALSE(unbound > object);\n    CHECK_FALSE(unbound < object);\n  }\n\n  SECTION(\"Compare with self\") {\n    JsonObject object = doc.to<JsonObject>();\n    object[\"a\"] = 1;\n    object[\"b\"] = \"hello\";\n    JsonObjectConst cobject = object;\n\n    CHECK(object == cobject);\n    CHECK(object <= cobject);\n    CHECK(object >= cobject);\n    CHECK_FALSE(object != cobject);\n    CHECK_FALSE(object > cobject);\n    CHECK_FALSE(object < cobject);\n\n    CHECK(cobject == object);\n    CHECK(cobject <= object);\n    CHECK(cobject >= object);\n    CHECK_FALSE(cobject != object);\n    CHECK_FALSE(cobject > object);\n    CHECK_FALSE(cobject < object);\n  }\n\n  SECTION(\"Compare with identical object\") {\n    JsonObject object1 = doc.add<JsonObject>();\n    object1[\"a\"] = 1;\n    object1[\"b\"] = \"hello\";\n    object1[\"c\"][0] = false;\n\n    JsonObject object2 = doc.add<JsonObject>();\n    object2[\"a\"] = 1;\n    object2[\"b\"] = \"hello\";\n    object2[\"c\"][0] = false;\n    JsonObjectConst carray2 = object2;\n\n    CHECK(object1 == carray2);\n    CHECK(object1 <= carray2);\n    CHECK(object1 >= carray2);\n    CHECK_FALSE(object1 != carray2);\n    CHECK_FALSE(object1 > carray2);\n    CHECK_FALSE(object1 < carray2);\n\n    CHECK(carray2 == object1);\n    CHECK(carray2 <= object1);\n    CHECK(carray2 >= object1);\n    CHECK_FALSE(carray2 != object1);\n    CHECK_FALSE(carray2 > object1);\n    CHECK_FALSE(carray2 < object1);\n  }\n\n  SECTION(\"Compare with different object\") {\n    JsonObject object1 = doc.add<JsonObject>();\n    object1[\"a\"] = 1;\n    object1[\"b\"] = \"hello1\";\n    object1[\"c\"][0] = false;\n\n    JsonObject object2 = doc.add<JsonObject>();\n    object2[\"a\"] = 1;\n    object2[\"b\"] = \"hello2\";\n    object2[\"c\"][0] = false;\n    JsonObjectConst carray2 = object2;\n\n    CHECK(object1 != carray2);\n    CHECK_FALSE(object1 == carray2);\n    CHECK_FALSE(object1 > carray2);\n    CHECK_FALSE(object1 < carray2);\n    CHECK_FALSE(object1 <= carray2);\n    CHECK_FALSE(object1 >= carray2);\n\n    CHECK(carray2 != object1);\n    CHECK_FALSE(carray2 == object1);\n    CHECK_FALSE(carray2 > object1);\n    CHECK_FALSE(carray2 < object1);\n    CHECK_FALSE(carray2 <= object1);\n    CHECK_FALSE(carray2 >= object1);\n  }\n}\n\nTEST_CASE(\"Compare JsonObjectConst with JsonObjectConst\") {\n  JsonDocument doc;\n\n  SECTION(\"Compare with unbound\") {\n    JsonObject object = doc.to<JsonObject>();\n    object[\"a\"] = 1;\n    object[\"b\"] = \"hello\";\n\n    JsonObjectConst cobject = object;\n    JsonObjectConst unbound;\n\n    CHECK(cobject != unbound);\n    CHECK_FALSE(cobject == unbound);\n    CHECK_FALSE(cobject <= unbound);\n    CHECK_FALSE(cobject >= unbound);\n    CHECK_FALSE(cobject > unbound);\n    CHECK_FALSE(cobject < unbound);\n\n    CHECK(unbound != cobject);\n    CHECK_FALSE(unbound == cobject);\n    CHECK_FALSE(unbound <= cobject);\n    CHECK_FALSE(unbound >= cobject);\n    CHECK_FALSE(unbound > cobject);\n    CHECK_FALSE(unbound < cobject);\n  }\n\n  SECTION(\"Compare with self\") {\n    JsonObject object = doc.to<JsonObject>();\n    object[\"a\"] = 1;\n    object[\"b\"] = \"hello\";\n    JsonObjectConst cobject = object;\n\n    CHECK(cobject == cobject);\n    CHECK(cobject <= cobject);\n    CHECK(cobject >= cobject);\n    CHECK_FALSE(cobject != cobject);\n    CHECK_FALSE(cobject > cobject);\n    CHECK_FALSE(cobject < cobject);\n  }\n\n  SECTION(\"Compare with identical object\") {\n    JsonObject object1 = doc.add<JsonObject>();\n    object1[\"a\"] = 1;\n    object1[\"b\"] = \"hello\";\n    object1[\"c\"][0] = false;\n    JsonObjectConst carray1 = object1;\n\n    JsonObject object2 = doc.add<JsonObject>();\n    object2[\"a\"] = 1;\n    object2[\"b\"] = \"hello\";\n    object2[\"c\"][0] = false;\n    JsonObjectConst carray2 = object2;\n\n    CHECK(carray1 == carray2);\n    CHECK(carray1 <= carray2);\n    CHECK(carray1 >= carray2);\n    CHECK_FALSE(carray1 != carray2);\n    CHECK_FALSE(carray1 > carray2);\n    CHECK_FALSE(carray1 < carray2);\n  }\n\n  SECTION(\"Compare with different object\") {\n    JsonObject object1 = doc.add<JsonObject>();\n    object1[\"a\"] = 1;\n    object1[\"b\"] = \"hello1\";\n    object1[\"c\"][0] = false;\n    JsonObjectConst carray1 = object1;\n\n    JsonObject object2 = doc.add<JsonObject>();\n    object2[\"a\"] = 1;\n    object2[\"b\"] = \"hello2\";\n    object2[\"c\"][0] = false;\n    JsonObjectConst carray2 = object2;\n\n    CHECK(carray1 != carray2);\n    CHECK_FALSE(carray1 == carray2);\n    CHECK_FALSE(carray1 > carray2);\n    CHECK_FALSE(carray1 < carray2);\n    CHECK_FALSE(carray1 <= carray2);\n    CHECK_FALSE(carray1 >= carray2);\n  }\n}\n\nTEST_CASE(\"Compare JsonObjectConst with JsonVariant\") {\n  JsonDocument doc;\n\n  SECTION(\"Compare with self\") {\n    JsonObject object = doc.to<JsonObject>();\n    object[\"a\"] = 1;\n    object[\"b\"] = \"hello\";\n    JsonObjectConst cobject = object;\n    JsonVariant variant = object;\n\n    CHECK(cobject == variant);\n    CHECK(cobject <= variant);\n    CHECK(cobject >= variant);\n    CHECK_FALSE(cobject != variant);\n    CHECK_FALSE(cobject > variant);\n    CHECK_FALSE(cobject < variant);\n\n    CHECK(variant == cobject);\n    CHECK(variant <= cobject);\n    CHECK(variant >= cobject);\n    CHECK_FALSE(variant != cobject);\n    CHECK_FALSE(variant > cobject);\n    CHECK_FALSE(variant < cobject);\n  }\n\n  SECTION(\"Compare with identical object\") {\n    JsonObject object1 = doc.add<JsonObject>();\n    object1[\"a\"] = 1;\n    object1[\"b\"] = \"hello\";\n    object1[\"c\"][0] = false;\n    JsonObjectConst carray1 = object1;\n\n    JsonObject object2 = doc.add<JsonObject>();\n    object2[\"a\"] = 1;\n    object2[\"b\"] = \"hello\";\n    object2[\"c\"][0] = false;\n    JsonVariant variant2 = object2;\n\n    CHECK(carray1 == variant2);\n    CHECK(carray1 <= variant2);\n    CHECK(carray1 >= variant2);\n    CHECK_FALSE(carray1 != variant2);\n    CHECK_FALSE(carray1 > variant2);\n    CHECK_FALSE(carray1 < variant2);\n\n    CHECK(variant2 == carray1);\n    CHECK(variant2 <= carray1);\n    CHECK(variant2 >= carray1);\n    CHECK_FALSE(variant2 != carray1);\n    CHECK_FALSE(variant2 > carray1);\n    CHECK_FALSE(variant2 < carray1);\n  }\n\n  SECTION(\"Compare with different object\") {\n    JsonObject object1 = doc.add<JsonObject>();\n    object1[\"a\"] = 1;\n    object1[\"b\"] = \"hello1\";\n    object1[\"c\"][0] = false;\n    JsonObjectConst carray1 = object1;\n\n    JsonObject object2 = doc.add<JsonObject>();\n    object2[\"a\"] = 1;\n    object2[\"b\"] = \"hello2\";\n    object2[\"c\"][0] = false;\n    JsonVariant variant2 = object2;\n\n    CHECK(carray1 != variant2);\n    CHECK_FALSE(carray1 == variant2);\n    CHECK_FALSE(carray1 > variant2);\n    CHECK_FALSE(carray1 < variant2);\n    CHECK_FALSE(carray1 <= variant2);\n    CHECK_FALSE(carray1 >= variant2);\n\n    CHECK(variant2 != carray1);\n    CHECK_FALSE(variant2 == carray1);\n    CHECK_FALSE(variant2 > carray1);\n    CHECK_FALSE(variant2 < carray1);\n    CHECK_FALSE(variant2 <= carray1);\n    CHECK_FALSE(variant2 >= carray1);\n  }\n}\n"
  },
  {
    "path": "extras/tests/JsonObject/equals.cpp",
    "content": "// ArduinoJson - https://arduinojson.org\n// Copyright © 2014-2025, Benoit BLANCHON\n// MIT License\n\n#include <ArduinoJson.h>\n#include <catch.hpp>\n\nTEST_CASE(\"JsonObject::operator==()\") {\n  JsonDocument doc1;\n  JsonObject obj1 = doc1.to<JsonObject>();\n\n  JsonDocument doc2;\n  JsonObject obj2 = doc2.to<JsonObject>();\n\n  SECTION(\"should return false when objs differ\") {\n    obj1[\"hello\"] = \"coucou\";\n    obj2[\"world\"] = 1;\n\n    REQUIRE_FALSE(obj1 == obj2);\n  }\n\n  SECTION(\"should return false when LHS has more elements\") {\n    obj1[\"hello\"] = \"coucou\";\n    obj1[\"world\"] = 666;\n    obj2[\"hello\"] = \"coucou\";\n\n    REQUIRE_FALSE(obj1 == obj2);\n  }\n\n  SECTION(\"should return false when RKS has more elements\") {\n    obj1[\"hello\"] = \"coucou\";\n    obj2[\"hello\"] = \"coucou\";\n    obj2[\"world\"] = 666;\n\n    REQUIRE_FALSE(obj1 == obj2);\n  }\n\n  SECTION(\"should return true when objs equal\") {\n    obj1[\"hello\"] = \"world\";\n    obj1[\"anwser\"] = 42;\n    // insert in different order\n    obj2[\"anwser\"] = 42;\n    obj2[\"hello\"] = \"world\";\n\n    REQUIRE(obj1 == obj2);\n  }\n\n  SECTION(\"should return false when RHS is null\") {\n    JsonObject null;\n\n    REQUIRE_FALSE(obj1 == null);\n  }\n\n  SECTION(\"should return false when LHS is null\") {\n    JsonObject null;\n\n    REQUIRE_FALSE(null == obj2);\n  }\n}\n"
  },
  {
    "path": "extras/tests/JsonObject/isNull.cpp",
    "content": "// ArduinoJson - https://arduinojson.org\n// Copyright © 2014-2025, Benoit BLANCHON\n// MIT License\n\n#include <ArduinoJson.h>\n#include <catch.hpp>\n\nTEST_CASE(\"JsonObject::isNull()\") {\n  SECTION(\"returns true\") {\n    JsonObject obj;\n    REQUIRE(obj.isNull() == true);\n  }\n\n  SECTION(\"returns false\") {\n    JsonDocument doc;\n    JsonObject obj = doc.to<JsonObject>();\n    REQUIRE(obj.isNull() == false);\n  }\n}\n\nTEST_CASE(\"JsonObject::operator bool()\") {\n  SECTION(\"returns false\") {\n    JsonObject obj;\n    REQUIRE(static_cast<bool>(obj) == false);\n  }\n\n  SECTION(\"returns true\") {\n    JsonDocument doc;\n    JsonObject obj = doc.to<JsonObject>();\n    REQUIRE(static_cast<bool>(obj) == true);\n  }\n}\n"
  },
  {
    "path": "extras/tests/JsonObject/iterator.cpp",
    "content": "// ArduinoJson - https://arduinojson.org\n// Copyright © 2014-2025, Benoit BLANCHON\n// MIT License\n\n#include <ArduinoJson.h>\n#include <catch.hpp>\n\nTEST_CASE(\"JsonObject::begin()/end()\") {\n  JsonDocument doc;\n  JsonObject obj = doc.to<JsonObject>();\n  obj[\"ab\"] = 12;\n  obj[\"cd\"] = 34;\n\n  SECTION(\"NonConstIterator\") {\n    JsonObject::iterator it = obj.begin();\n    REQUIRE(obj.end() != it);\n    REQUIRE(it->key() == \"ab\");\n    REQUIRE(12 == it->value());\n    ++it;\n    REQUIRE(obj.end() != it);\n    REQUIRE(it->key() == \"cd\");\n    REQUIRE(34 == it->value());\n    ++it;\n    REQUIRE(obj.end() == it);\n  }\n\n  SECTION(\"Dereferencing end() is safe\") {\n    REQUIRE(obj.end()->key().isNull());\n    REQUIRE(obj.end()->value().isNull());\n  }\n\n  SECTION(\"null JsonObject\") {\n    JsonObject null;\n    REQUIRE(null.begin() == null.end());\n  }\n}\n"
  },
  {
    "path": "extras/tests/JsonObject/nesting.cpp",
    "content": "// ArduinoJson - https://arduinojson.org\n// Copyright © 2014-2025, Benoit BLANCHON\n// MIT License\n\n#include <ArduinoJson.h>\n#include <catch.hpp>\n\nTEST_CASE(\"JsonObject::nesting()\") {\n  JsonDocument doc;\n  JsonObject obj = doc.to<JsonObject>();\n\n  SECTION(\"return 0 if uninitialized\") {\n    JsonObject unitialized;\n    REQUIRE(unitialized.nesting() == 0);\n  }\n\n  SECTION(\"returns 1 for empty object\") {\n    REQUIRE(obj.nesting() == 1);\n  }\n\n  SECTION(\"returns 1 for flat object\") {\n    obj[\"hello\"] = \"world\";\n    REQUIRE(obj.nesting() == 1);\n  }\n\n  SECTION(\"returns 2 with nested array\") {\n    obj[\"nested\"].to<JsonArray>();\n    REQUIRE(obj.nesting() == 2);\n  }\n\n  SECTION(\"returns 2 with nested object\") {\n    obj[\"nested\"].to<JsonObject>();\n    REQUIRE(obj.nesting() == 2);\n  }\n}\n"
  },
  {
    "path": "extras/tests/JsonObject/remove.cpp",
    "content": "// ArduinoJson - https://arduinojson.org\n// Copyright © 2014-2025, Benoit BLANCHON\n// MIT License\n\n#include <ArduinoJson.h>\n#include <catch.hpp>\n#include <string>\n\nTEST_CASE(\"JsonObject::remove()\") {\n  JsonDocument doc;\n  JsonObject obj = doc.to<JsonObject>();\n  obj[\"a\"] = 0;\n  obj[\"b\"] = 1;\n  obj[\"c\"] = 2;\n  std::string result;\n\n  SECTION(\"remove(key)\") {\n    SECTION(\"Remove first\") {\n      obj.remove(\"a\");\n      serializeJson(obj, result);\n      REQUIRE(\"{\\\"b\\\":1,\\\"c\\\":2}\" == result);\n    }\n\n    SECTION(\"Remove middle\") {\n      obj.remove(\"b\");\n      serializeJson(obj, result);\n      REQUIRE(\"{\\\"a\\\":0,\\\"c\\\":2}\" == result);\n    }\n\n    SECTION(\"Remove last\") {\n      obj.remove(\"c\");\n      serializeJson(obj, result);\n      REQUIRE(\"{\\\"a\\\":0,\\\"b\\\":1}\" == result);\n    }\n  }\n\n  SECTION(\"remove(iterator)\") {\n    JsonObject::iterator it = obj.begin();\n\n    SECTION(\"Remove first\") {\n      obj.remove(it);\n      serializeJson(obj, result);\n      REQUIRE(\"{\\\"b\\\":1,\\\"c\\\":2}\" == result);\n    }\n\n    SECTION(\"Remove middle\") {\n      ++it;\n      obj.remove(it);\n      serializeJson(obj, result);\n      REQUIRE(\"{\\\"a\\\":0,\\\"c\\\":2}\" == result);\n    }\n\n    SECTION(\"Remove last\") {\n      ++it;\n      ++it;\n      obj.remove(it);\n      serializeJson(obj, result);\n      REQUIRE(\"{\\\"a\\\":0,\\\"b\\\":1}\" == result);\n    }\n  }\n\n#ifdef HAS_VARIABLE_LENGTH_ARRAY\n  SECTION(\"key is a vla\") {\n    size_t i = 16;\n    char vla[i];\n    strcpy(vla, \"b\");\n    obj.remove(vla);\n\n    serializeJson(obj, result);\n    REQUIRE(\"{\\\"a\\\":0,\\\"c\\\":2}\" == result);\n  }\n#endif\n\n  SECTION(\"remove by key on unbound reference\") {\n    JsonObject unboundObject;\n    unboundObject.remove(\"key\");\n  }\n\n  SECTION(\"remove by iterator on unbound reference\") {\n    JsonObject unboundObject;\n    unboundObject.remove(unboundObject.begin());\n  }\n\n  SECTION(\"remove(JsonVariant)\") {\n    obj[\"key\"] = \"b\";\n    obj.remove(obj[\"key\"]);\n    REQUIRE(\"{\\\"a\\\":0,\\\"c\\\":2,\\\"key\\\":\\\"b\\\"}\" == doc.as<std::string>());\n  }\n}\n"
  },
  {
    "path": "extras/tests/JsonObject/set.cpp",
    "content": "// ArduinoJson - https://arduinojson.org\n// Copyright © 2014-2025, Benoit BLANCHON\n// MIT License\n\n#include <ArduinoJson.h>\n#include <catch.hpp>\n\n#include \"Allocators.hpp\"\n#include \"Literals.hpp\"\n\nTEST_CASE(\"JsonObject::set()\") {\n  SpyingAllocator spy;\n  JsonDocument doc1(&spy);\n  JsonDocument doc2(&spy);\n\n  JsonObject obj1 = doc1.to<JsonObject>();\n  JsonObject obj2 = doc2.to<JsonObject>();\n\n  SECTION(\"copy key and string value\") {\n    obj1[\"hello\"] = \"world\";\n    spy.clearLog();\n\n    bool success = obj2.set(obj1);\n\n    REQUIRE(success == true);\n    REQUIRE(obj2[\"hello\"] == \"world\"_s);\n    REQUIRE(spy.log() == AllocatorLog{\n                             Allocate(sizeofPool()),\n                             Allocate(sizeofString(\"hello\")),\n                             Allocate(sizeofString(\"world\")),\n                         });\n  }\n\n  SECTION(\"copy string from deserializeJson()\") {\n    deserializeJson(doc1, \"{'hello':'world'}\");\n    spy.clearLog();\n\n    bool success = obj2.set(obj1);\n\n    REQUIRE(success == true);\n    REQUIRE(obj2[\"hello\"] == \"world\"_s);\n    REQUIRE(spy.log() == AllocatorLog{\n                             Allocate(sizeofPool()),\n                             Allocate(sizeofString(\"hello\")),\n                             Allocate(sizeofString(\"world\")),\n                         });\n  }\n\n  SECTION(\"copy string from deserializeMsgPack()\") {\n    deserializeMsgPack(doc1, \"\\x81\\xA5hello\\xA5world\");\n    spy.clearLog();\n\n    bool success = obj2.set(obj1);\n\n    REQUIRE(success == true);\n    REQUIRE(obj2[\"hello\"] == \"world\"_s);\n    REQUIRE(spy.log() == AllocatorLog{\n                             Allocate(sizeofPool()),\n                             Allocate(sizeofString(\"hello\")),\n                             Allocate(sizeofString(\"world\")),\n                         });\n  }\n\n  SECTION(\"should work with JsonObjectConst\") {\n    obj1[\"hello\"] = \"world\";\n\n    obj2.set(static_cast<JsonObjectConst>(obj1));\n\n    REQUIRE(obj2[\"hello\"] == \"world\"_s);\n  }\n\n  SECTION(\"copy fails in the middle of an object\") {\n    TimebombAllocator timebomb(2);\n    JsonDocument doc3(&timebomb);\n    JsonObject obj3 = doc3.to<JsonObject>();\n\n    obj1[\"alpha\"_s] = 1;\n    obj1[\"beta\"_s] = 2;\n\n    bool success = obj3.set(obj1);\n\n    REQUIRE(success == false);\n    REQUIRE(doc3.as<std::string>() == \"{\\\"alpha\\\":1}\");\n  }\n\n  SECTION(\"copy fails in the middle of an array\") {\n    TimebombAllocator timebomb(2);\n    JsonDocument doc3(&timebomb);\n    JsonObject obj3 = doc3.to<JsonObject>();\n\n    obj1[\"hello\"][0] = \"world\"_s;\n\n    bool success = obj3.set(obj1);\n\n    REQUIRE(success == false);\n    REQUIRE(doc3.as<std::string>() == \"{\\\"hello\\\":[]}\");\n  }\n\n  SECTION(\"destination is null\") {\n    JsonObject null;\n    obj1[\"hello\"] = \"world\";\n\n    bool success = null.set(obj1);\n\n    REQUIRE(success == false);\n  }\n\n  SECTION(\"source is null\") {\n    JsonObject null;\n    obj1[\"hello\"] = \"world\";\n\n    bool success = obj1.set(null);\n\n    REQUIRE(success == false);\n  }\n}\n"
  },
  {
    "path": "extras/tests/JsonObject/size.cpp",
    "content": "// ArduinoJson - https://arduinojson.org\n// Copyright © 2014-2025, Benoit BLANCHON\n// MIT License\n\n#include <ArduinoJson.h>\n#include <catch.hpp>\n#include <string>\n\nTEST_CASE(\"JsonObject::size()\") {\n  JsonDocument doc;\n  JsonObject obj = doc.to<JsonObject>();\n\n  SECTION(\"initial size is zero\") {\n    REQUIRE(0 == obj.size());\n  }\n\n  SECTION(\"increases when values are added\") {\n    obj[\"hello\"] = 42;\n    REQUIRE(1 == obj.size());\n  }\n\n  SECTION(\"decreases when values are removed\") {\n    obj[\"hello\"] = 42;\n    obj.remove(\"hello\");\n    REQUIRE(0 == obj.size());\n  }\n\n  SECTION(\"doesn't increase when the same key is added twice\") {\n    obj[\"hello\"] = 1;\n    obj[\"hello\"] = 2;\n    REQUIRE(1 == obj.size());\n  }\n\n  SECTION(\"doesn't decrease when another key is removed\") {\n    obj[\"hello\"] = 1;\n    obj.remove(\"world\");\n    REQUIRE(1 == obj.size());\n  }\n}\n"
  },
  {
    "path": "extras/tests/JsonObject/std_string.cpp",
    "content": "// ArduinoJson - https://arduinojson.org\n// Copyright © 2014-2025, Benoit BLANCHON\n// MIT License\n\n#include <ArduinoJson.h>\n#include <catch.hpp>\n\n#include \"Literals.hpp\"\n\nstatic void eraseString(std::string& str) {\n  char* p = const_cast<char*>(str.c_str());\n  while (*p)\n    *p++ = '*';\n}\n\nTEST_CASE(\"std::string\") {\n  JsonDocument doc;\n\n  SECTION(\"operator[]\") {\n    char json[] = \"{\\\"key\\\":\\\"value\\\"}\";\n\n    deserializeJson(doc, json);\n    JsonObject obj = doc.as<JsonObject>();\n\n    REQUIRE(\"value\"_s == obj[\"key\"_s]);\n  }\n\n  SECTION(\"operator[] const\") {\n    char json[] = \"{\\\"key\\\":\\\"value\\\"}\";\n\n    deserializeJson(doc, json);\n    JsonObject obj = doc.as<JsonObject>();\n\n    REQUIRE(\"value\"_s == obj[\"key\"_s]);\n  }\n\n  SECTION(\"remove()\") {\n    JsonObject obj = doc.to<JsonObject>();\n    obj[\"key\"] = \"value\";\n\n    obj.remove(\"key\"_s);\n\n    REQUIRE(0 == obj.size());\n  }\n\n  SECTION(\"operator[], set key\") {\n    std::string key(\"hello\");\n    JsonObject obj = doc.to<JsonObject>();\n    obj[key] = \"world\";\n    eraseString(key);\n    REQUIRE(\"world\"_s == obj[\"hello\"]);\n  }\n\n  SECTION(\"operator[], set value\") {\n    std::string value(\"world\");\n    JsonObject obj = doc.to<JsonObject>();\n    obj[\"hello\"] = value;\n    eraseString(value);\n    REQUIRE(\"world\"_s == obj[\"hello\"]);\n  }\n}\n"
  },
  {
    "path": "extras/tests/JsonObject/subscript.cpp",
    "content": "// ArduinoJson - https://arduinojson.org\n// Copyright © 2014-2025, Benoit BLANCHON\n// MIT License\n\n#include <ArduinoJson.h>\n#include <catch.hpp>\n\n#include \"Allocators.hpp\"\n#include \"Literals.hpp\"\n\nTEST_CASE(\"JsonObject::operator[]\") {\n  SpyingAllocator spy;\n  JsonDocument doc(&spy);\n  JsonObject obj = doc.to<JsonObject>();\n\n  SECTION(\"int\") {\n    obj[\"hello\"] = 123;\n\n    REQUIRE(123 == obj[\"hello\"].as<int>());\n    REQUIRE(true == obj[\"hello\"].is<int>());\n    REQUIRE(false == obj[\"hello\"].is<bool>());\n  }\n\n  SECTION(\"volatile int\") {  // issue #415\n    volatile int i = 123;\n    obj[\"hello\"] = i;\n\n    REQUIRE(123 == obj[\"hello\"].as<int>());\n    REQUIRE(true == obj[\"hello\"].is<int>());\n    REQUIRE(false == obj[\"hello\"].is<bool>());\n  }\n\n  SECTION(\"double\") {\n    obj[\"hello\"] = 123.45;\n\n    REQUIRE(true == obj[\"hello\"].is<double>());\n    REQUIRE(false == obj[\"hello\"].is<long>());\n    REQUIRE(123.45 == obj[\"hello\"].as<double>());\n  }\n\n  SECTION(\"bool\") {\n    obj[\"hello\"] = true;\n\n    REQUIRE(true == obj[\"hello\"].is<bool>());\n    REQUIRE(false == obj[\"hello\"].is<long>());\n    REQUIRE(true == obj[\"hello\"].as<bool>());\n  }\n\n  SECTION(\"const char*\") {\n    obj[\"hello\"] = \"h3110\";\n\n    REQUIRE(true == obj[\"hello\"].is<const char*>());\n    REQUIRE(false == obj[\"hello\"].is<long>());\n    REQUIRE(\"h3110\"_s == obj[\"hello\"].as<const char*>());\n  }\n\n  SECTION(\"array\") {\n    JsonDocument doc2;\n    JsonArray arr = doc2.to<JsonArray>();\n\n    obj[\"hello\"] = arr;\n\n    REQUIRE(arr == obj[\"hello\"].as<JsonArray>());\n    REQUIRE(true == obj[\"hello\"].is<JsonArray>());\n    REQUIRE(false == obj[\"hello\"].is<JsonObject>());\n  }\n\n  SECTION(\"object\") {\n    JsonDocument doc2;\n    JsonObject obj2 = doc2.to<JsonObject>();\n\n    obj[\"hello\"] = obj2;\n\n    REQUIRE(obj2 == obj[\"hello\"].as<JsonObject>());\n    REQUIRE(true == obj[\"hello\"].is<JsonObject>());\n    REQUIRE(false == obj[\"hello\"].is<JsonArray>());\n  }\n\n  SECTION(\"array subscript\") {\n    JsonDocument doc2;\n    JsonArray arr = doc2.to<JsonArray>();\n    arr.add(42);\n\n    obj[\"a\"] = arr[0];\n\n    REQUIRE(42 == obj[\"a\"]);\n  }\n\n  SECTION(\"object subscript\") {\n    JsonDocument doc2;\n    JsonObject obj2 = doc2.to<JsonObject>();\n    obj2[\"x\"] = 42;\n\n    obj[\"a\"] = obj2[\"x\"];\n\n    REQUIRE(42 == obj[\"a\"]);\n  }\n\n  SECTION(\"char key[]\") {  // issue #423\n    char key[] = \"hello\";\n    obj[key] = 42;\n    REQUIRE(42 == obj[key]);\n  }\n  SECTION(\"should duplicate key and value strings\") {\n    obj[\"hello\"] = \"world\";\n    REQUIRE(spy.log() == AllocatorLog{\n                             Allocate(sizeofPool()),\n                             Allocate(sizeofString(\"hello\")),\n                             Allocate(sizeofString(\"world\")),\n                         });\n  }\n\n  SECTION(\"should ignore null key\") {\n    // object must have a value to make a call to strcmp()\n    obj[\"dummy\"] = 42;\n\n    const char* null = 0;\n    obj[null] = 666;\n\n    REQUIRE(obj.size() == 1);\n    REQUIRE(obj[null] == null);\n  }\n\n  SECTION(\"obj[key].to<JsonArray>()\") {\n    JsonArray arr = obj[\"hello\"].to<JsonArray>();\n\n    REQUIRE(arr.isNull() == false);\n  }\n\n#if defined(HAS_VARIABLE_LENGTH_ARRAY) && \\\n    !defined(SUBSCRIPT_CONFLICTS_WITH_BUILTIN_OPERATOR)\n  SECTION(\"obj[VLA] = str\") {\n    size_t i = 16;\n    char vla[i];\n    strcpy(vla, \"hello\");\n\n    obj[vla] = \"world\";\n\n    REQUIRE(\"world\"_s == obj[\"hello\"]);\n  }\n\n  SECTION(\"obj[str] = VLA\") {  // issue #416\n    size_t i = 32;\n    char vla[i];\n    strcpy(vla, \"world\");\n\n    obj[\"hello\"] = vla;\n\n    REQUIRE(\"world\"_s == obj[\"hello\"].as<const char*>());\n  }\n\n  SECTION(\"obj.set(VLA, str)\") {\n    size_t i = 16;\n    char vla[i];\n    strcpy(vla, \"hello\");\n\n    obj[vla] = \"world\";\n\n    REQUIRE(\"world\"_s == obj[\"hello\"]);\n  }\n\n  SECTION(\"obj.set(str, VLA)\") {\n    size_t i = 32;\n    char vla[i];\n    strcpy(vla, \"world\");\n\n    obj[\"hello\"].set(vla);\n\n    REQUIRE(\"world\"_s == obj[\"hello\"].as<const char*>());\n  }\n\n  SECTION(\"obj[VLA]\") {\n    size_t i = 16;\n    char vla[i];\n    strcpy(vla, \"hello\");\n\n    deserializeJson(doc, \"{\\\"hello\\\":\\\"world\\\"}\");\n\n    obj = doc.as<JsonObject>();\n    REQUIRE(\"world\"_s == obj[vla]);\n  }\n#endif\n\n  SECTION(\"chain\") {\n    obj[\"hello\"][\"world\"] = 123;\n\n    REQUIRE(123 == obj[\"hello\"][\"world\"].as<int>());\n    REQUIRE(true == obj[\"hello\"][\"world\"].is<int>());\n    REQUIRE(false == obj[\"hello\"][\"world\"].is<bool>());\n  }\n\n  SECTION(\"JsonVariant\") {\n    obj[\"hello\"] = \"world\";\n    obj[\"a\\0b\"_s] = \"ABC\";\n\n    doc[\"key1\"] = \"hello\";\n    doc[\"key2\"] = \"a\\0b\"_s;\n    doc[\"key3\"] = \"foo\";\n\n    REQUIRE(obj[obj[\"key1\"]] == \"world\");\n    REQUIRE(obj[obj[\"key2\"]] == \"ABC\");\n    REQUIRE(obj[obj[\"key3\"]] == nullptr);\n    REQUIRE(obj[obj[\"key4\"]] == nullptr);\n  }\n}\n"
  },
  {
    "path": "extras/tests/JsonObject/unbound.cpp",
    "content": "// ArduinoJson - https://arduinojson.org\n// Copyright © 2014-2025, Benoit BLANCHON\n// MIT License\n\n#include <ArduinoJson.h>\n#include <catch.hpp>\n\nusing namespace Catch::Matchers;\n\nTEST_CASE(\"Unbound JsonObject\") {\n  JsonObject obj;\n\n  SECTION(\"retrieve member\") {\n    REQUIRE(obj[\"key\"].isNull());\n  }\n\n  SECTION(\"add member\") {\n    obj[\"hello\"] = \"world\";\n    REQUIRE(0 == obj.size());\n  }\n\n  SECTION(\"serialize\") {\n    char buffer[32];\n    serializeJson(obj, buffer, sizeof(buffer));\n    REQUIRE_THAT(buffer, Equals(\"null\"));\n  }\n}\n"
  },
  {
    "path": "extras/tests/JsonObjectConst/CMakeLists.txt",
    "content": "# ArduinoJson - https://arduinojson.org\n# Copyright © 2014-2025, Benoit BLANCHON\n# MIT License\n\nadd_executable(JsonObjectConstTests\n\tequals.cpp\n\tisNull.cpp\n\titerator.cpp\n\tnesting.cpp\n\tsize.cpp\n\tsubscript.cpp\n)\n\nadd_test(JsonObjectConst JsonObjectConstTests)\n\nset_tests_properties(JsonObjectConst\n\tPROPERTIES\n\t\tLABELS \"Catch\"\n)\n"
  },
  {
    "path": "extras/tests/JsonObjectConst/equals.cpp",
    "content": "// ArduinoJson - https://arduinojson.org\n// Copyright © 2014-2025, Benoit BLANCHON\n// MIT License\n\n#include <ArduinoJson.h>\n#include <catch.hpp>\n\nTEST_CASE(\"JsonObjectConst::operator==()\") {\n  JsonDocument doc1;\n  JsonObjectConst obj1 = doc1.to<JsonObject>();\n\n  JsonDocument doc2;\n  JsonObjectConst obj2 = doc2.to<JsonObject>();\n\n  SECTION(\"should return false when objs differ\") {\n    doc1[\"hello\"] = \"coucou\";\n    doc2[\"world\"] = 1;\n\n    REQUIRE_FALSE(obj1 == obj2);\n  }\n\n  SECTION(\"should return false when LHS has more elements\") {\n    doc1[\"hello\"] = \"coucou\";\n    doc1[\"world\"] = 666;\n    doc2[\"hello\"] = \"coucou\";\n\n    REQUIRE_FALSE(obj1 == obj2);\n  }\n\n  SECTION(\"should return false when RKS has more elements\") {\n    doc1[\"hello\"] = \"coucou\";\n    doc2[\"hello\"] = \"coucou\";\n    doc2[\"world\"] = 666;\n\n    REQUIRE_FALSE(obj1 == obj2);\n  }\n\n  SECTION(\"should return true when objs equal\") {\n    doc1[\"hello\"] = \"world\";\n    doc1[\"anwser\"] = 42;\n    // insert in different order\n    doc2[\"anwser\"] = 42;\n    doc2[\"hello\"] = \"world\";\n\n    REQUIRE(obj1 == obj2);\n  }\n\n  SECTION(\"should return false when RHS is null\") {\n    JsonObjectConst null;\n\n    REQUIRE_FALSE(obj1 == null);\n  }\n\n  SECTION(\"should return false when LHS is null\") {\n    JsonObjectConst null;\n\n    REQUIRE_FALSE(null == obj2);\n  }\n\n  SECTION(\"should return true when both are null\") {\n    JsonObjectConst null1, null2;\n\n    REQUIRE(null1 == null2);\n  }\n}\n"
  },
  {
    "path": "extras/tests/JsonObjectConst/isNull.cpp",
    "content": "// ArduinoJson - https://arduinojson.org\n// Copyright © 2014-2025, Benoit BLANCHON\n// MIT License\n\n#include <ArduinoJson.h>\n#include <catch.hpp>\n\nTEST_CASE(\"JsonObjectConst::isNull()\") {\n  SECTION(\"returns true\") {\n    JsonObjectConst obj;\n    REQUIRE(obj.isNull() == true);\n  }\n\n  SECTION(\"returns false\") {\n    JsonDocument doc;\n    JsonObjectConst obj = doc.to<JsonObject>();\n    REQUIRE(obj.isNull() == false);\n  }\n}\n\nTEST_CASE(\"JsonObjectConst::operator bool()\") {\n  SECTION(\"returns false\") {\n    JsonObjectConst obj;\n    REQUIRE(static_cast<bool>(obj) == false);\n  }\n\n  SECTION(\"returns true\") {\n    JsonDocument doc;\n    JsonObjectConst obj = doc.to<JsonObject>();\n    REQUIRE(static_cast<bool>(obj) == true);\n  }\n}\n"
  },
  {
    "path": "extras/tests/JsonObjectConst/iterator.cpp",
    "content": "// ArduinoJson - https://arduinojson.org\n// Copyright © 2014-2025, Benoit BLANCHON\n// MIT License\n\n#include <ArduinoJson.h>\n#include <catch.hpp>\n\nTEST_CASE(\"JsonObjectConst::begin()/end()\") {\n  JsonDocument doc;\n  JsonObjectConst obj = doc.to<JsonObject>();\n  doc[\"ab\"] = 12;\n  doc[\"cd\"] = 34;\n\n  SECTION(\"Iteration\") {\n    JsonObjectConst::iterator it = obj.begin();\n    REQUIRE(obj.end() != it);\n    REQUIRE(it->key() == \"ab\");\n    REQUIRE(12 == it->value());\n\n    ++it;\n    REQUIRE(obj.end() != it);\n    JsonPairConst pair = *it;\n    REQUIRE(pair.key() == \"cd\");\n    REQUIRE(34 == pair.value());\n\n    ++it;\n    REQUIRE(obj.end() == it);\n  }\n\n  SECTION(\"Dereferencing end() is safe\") {\n    REQUIRE(obj.end()->key().isNull());\n    REQUIRE(obj.end()->value().isNull());\n  }\n\n  SECTION(\"null JsonObjectConst\") {\n    JsonObjectConst null;\n    REQUIRE(null.begin() == null.end());\n  }\n}\n"
  },
  {
    "path": "extras/tests/JsonObjectConst/nesting.cpp",
    "content": "// ArduinoJson - https://arduinojson.org\n// Copyright © 2014-2025, Benoit BLANCHON\n// MIT License\n\n#include <ArduinoJson.h>\n#include <catch.hpp>\n\nTEST_CASE(\"JsonObjectConst::nesting()\") {\n  JsonDocument doc;\n  JsonObjectConst obj = doc.to<JsonObject>();\n\n  SECTION(\"return 0 if unbound\") {\n    JsonObjectConst unbound;\n    REQUIRE(unbound.nesting() == 0);\n  }\n\n  SECTION(\"returns 1 for empty object\") {\n    REQUIRE(obj.nesting() == 1);\n  }\n\n  SECTION(\"returns 1 for flat object\") {\n    doc[\"hello\"] = \"world\";\n    REQUIRE(obj.nesting() == 1);\n  }\n\n  SECTION(\"returns 2 with nested array\") {\n    doc[\"nested\"].to<JsonArray>();\n    REQUIRE(obj.nesting() == 2);\n  }\n\n  SECTION(\"returns 2 with nested object\") {\n    doc[\"nested\"].to<JsonObject>();\n    REQUIRE(obj.nesting() == 2);\n  }\n}\n"
  },
  {
    "path": "extras/tests/JsonObjectConst/size.cpp",
    "content": "// ArduinoJson - https://arduinojson.org\n// Copyright © 2014-2025, Benoit BLANCHON\n// MIT License\n\n#include <ArduinoJson.h>\n#include <catch.hpp>\n#include <string>\n\nTEST_CASE(\"JsonObjectConst::size()\") {\n  JsonDocument doc;\n  JsonObjectConst obj = doc.to<JsonObject>();\n\n  SECTION(\"returns 0 when empty\") {\n    REQUIRE(0 == obj.size());\n  }\n\n  SECTION(\"returns the number of members\") {\n    doc[\"hello\"] = 1;\n    doc[\"world\"] = 2;\n    REQUIRE(2 == obj.size());\n  }\n}\n"
  },
  {
    "path": "extras/tests/JsonObjectConst/subscript.cpp",
    "content": "// ArduinoJson - https://arduinojson.org\n// Copyright © 2014-2025, Benoit BLANCHON\n// MIT License\n\n#include <ArduinoJson.h>\n#include <catch.hpp>\n\n#include \"Allocators.hpp\"\n#include \"Literals.hpp\"\n\nTEST_CASE(\"JsonObjectConst::operator[]\") {\n  JsonDocument doc;\n  doc[\"hello\"] = \"world\";\n  doc[\"a\\0b\"_s] = \"ABC\";\n  JsonObjectConst obj = doc.as<JsonObjectConst>();\n\n  SECTION(\"supports const char*\") {\n    REQUIRE(obj[\"hello\"] == \"world\");  // issue #2019\n  }\n\n  SECTION(\"supports std::string\") {\n    REQUIRE(obj[\"hello\"_s] == \"world\");  // issue #2019\n    REQUIRE(obj[\"a\\0b\"_s] == \"ABC\");\n  }\n\n#if defined(HAS_VARIABLE_LENGTH_ARRAY) && \\\n    !defined(SUBSCRIPT_CONFLICTS_WITH_BUILTIN_OPERATOR)\n  SECTION(\"supports VLA\") {\n    size_t i = 16;\n    char vla[i];\n    strcpy(vla, \"hello\");\n\n    REQUIRE(obj[vla] == \"world\"_s);\n  }\n#endif\n\n  SECTION(\"supports JsonVariant\") {\n    doc[\"key1\"] = \"hello\";\n    doc[\"key2\"] = \"a\\0b\"_s;\n    doc[\"key3\"] = \"foo\";\n    REQUIRE(obj[obj[\"key1\"]] == \"world\");\n    REQUIRE(obj[obj[\"key2\"]] == \"ABC\");\n    REQUIRE(obj[obj[\"key3\"]] == nullptr);\n    REQUIRE(obj[obj[\"key4\"]] == nullptr);\n  }\n}\n"
  },
  {
    "path": "extras/tests/JsonSerializer/CMakeLists.txt",
    "content": "# ArduinoJson - https://arduinojson.org\n# Copyright © 2014-2025, Benoit BLANCHON\n# MIT License\n\nadd_executable(JsonSerializerTests\n\tCustomWriter.cpp\n\tJsonArray.cpp\n\tJsonArrayPretty.cpp\n\tJsonObject.cpp\n\tJsonObjectPretty.cpp\n\tJsonVariant.cpp\n\tmisc.cpp\n\tstd_stream.cpp\n\tstd_string.cpp\n)\n\nadd_test(JsonSerializer JsonSerializerTests)\n\nset_tests_properties(JsonSerializer\n\tPROPERTIES\n\t\tLABELS \"Catch\"\n)\n"
  },
  {
    "path": "extras/tests/JsonSerializer/CustomWriter.cpp",
    "content": "// ArduinoJson - https://arduinojson.org\n// Copyright © 2014-2025, Benoit BLANCHON\n// MIT License\n\n#include <ArduinoJson.h>\n#include <catch.hpp>\n\nclass CustomWriter {\n public:\n  CustomWriter() {}\n  CustomWriter(const CustomWriter&) = delete;\n  CustomWriter& operator=(const CustomWriter&) = delete;\n\n  size_t write(uint8_t c) {\n    str_.append(1, static_cast<char>(c));\n    return 1;\n  }\n\n  size_t write(const uint8_t* s, size_t n) {\n    str_.append(reinterpret_cast<const char*>(s), n);\n    return n;\n  }\n\n  const std::string& str() const {\n    return str_;\n  }\n\n private:\n  std::string str_;\n};\n\nTEST_CASE(\"CustomWriter\") {\n  JsonDocument doc;\n  JsonArray array = doc.to<JsonArray>();\n  array.add(4);\n  array.add(2);\n\n  SECTION(\"serializeJson()\") {\n    CustomWriter writer;\n    serializeJson(array, writer);\n\n    REQUIRE(\"[4,2]\" == writer.str());\n  }\n\n  SECTION(\"serializeJsonPretty\") {\n    CustomWriter writer;\n    serializeJsonPretty(array, writer);\n\n    REQUIRE(\"[\\r\\n  4,\\r\\n  2\\r\\n]\" == writer.str());\n  }\n}\n"
  },
  {
    "path": "extras/tests/JsonSerializer/JsonArray.cpp",
    "content": "// ArduinoJson - https://arduinojson.org\n// Copyright © 2014-2025, Benoit BLANCHON\n// MIT License\n\n#include <ArduinoJson.h>\n#include <catch.hpp>\n\nstatic void check(JsonArray array, std::string expected) {\n  std::string actual;\n  size_t actualLen = serializeJson(array, actual);\n  REQUIRE(expected == actual);\n  REQUIRE(actualLen == expected.size());\n  size_t measuredLen = measureJson(array);\n  REQUIRE(measuredLen == expected.size());\n}\n\nTEST_CASE(\"serializeJson(JsonArray)\") {\n  JsonDocument doc;\n  JsonArray array = doc.to<JsonArray>();\n\n  SECTION(\"Empty\") {\n    check(array, \"[]\");\n  }\n\n  SECTION(\"Null\") {\n    array.add(static_cast<char*>(0));\n\n    check(array, \"[null]\");\n  }\n\n  SECTION(\"OneString\") {\n    array.add(\"hello\");\n\n    check(array, \"[\\\"hello\\\"]\");\n  }\n\n  SECTION(\"TwoStrings\") {\n    array.add(\"hello\");\n    array.add(\"world\");\n\n    check(array, \"[\\\"hello\\\",\\\"world\\\"]\");\n  }\n\n  SECTION(\"One double\") {\n    array.add(3.1415927);\n    check(array, \"[3.1415927]\");\n  }\n\n  SECTION(\"OneInteger\") {\n    array.add(1);\n\n    check(array, \"[1]\");\n  }\n\n  SECTION(\"TwoIntegers\") {\n    array.add(1);\n    array.add(2);\n\n    check(array, \"[1,2]\");\n  }\n\n  SECTION(\"serialized(const char*)\") {\n    array.add(serialized(\"{\\\"key\\\":\\\"value\\\"}\"));\n\n    check(array, \"[{\\\"key\\\":\\\"value\\\"}]\");\n  }\n\n  SECTION(\"serialized(char*)\") {\n    char tmp[] = \"{\\\"key\\\":\\\"value\\\"}\";\n    array.add(serialized(tmp));\n\n    check(array, \"[{\\\"key\\\":\\\"value\\\"}]\");\n  }\n\n  SECTION(\"OneTrue\") {\n    array.add(true);\n\n    check(array, \"[true]\");\n  }\n\n  SECTION(\"OneFalse\") {\n    array.add(false);\n\n    check(array, \"[false]\");\n  }\n\n  SECTION(\"TwoBooleans\") {\n    array.add(false);\n    array.add(true);\n\n    check(array, \"[false,true]\");\n  }\n\n  SECTION(\"OneEmptyNestedArray\") {\n    array.add<JsonArray>();\n\n    check(array, \"[[]]\");\n  }\n\n  SECTION(\"OneEmptyNestedHash\") {\n    array.add<JsonObject>();\n\n    check(array, \"[{}]\");\n  }\n}\n"
  },
  {
    "path": "extras/tests/JsonSerializer/JsonArrayPretty.cpp",
    "content": "// ArduinoJson - https://arduinojson.org\n// Copyright © 2014-2025, Benoit BLANCHON\n// MIT License\n\n#include <ArduinoJson.h>\n#include <catch.hpp>\n\nstatic void checkArray(JsonArray array, std::string expected) {\n  std::string actual;\n  size_t actualLen = serializeJsonPretty(array, actual);\n  size_t measuredLen = measureJsonPretty(array);\n  CHECK(actualLen == expected.size());\n  CHECK(measuredLen == expected.size());\n  REQUIRE(expected == actual);\n}\n\nTEST_CASE(\"serializeJsonPretty(JsonArray)\") {\n  JsonDocument doc;\n  JsonArray array = doc.to<JsonArray>();\n\n  SECTION(\"Empty\") {\n    checkArray(array, \"[]\");\n  }\n\n  SECTION(\"OneElement\") {\n    array.add(1);\n\n    checkArray(array,\n               \"[\\r\\n\"\n               \"  1\\r\\n\"\n               \"]\");\n  }\n\n  SECTION(\"TwoElements\") {\n    array.add(1);\n    array.add(2);\n\n    checkArray(array,\n               \"[\\r\\n\"\n               \"  1,\\r\\n\"\n               \"  2\\r\\n\"\n               \"]\");\n  }\n\n  SECTION(\"EmptyNestedArrays\") {\n    array.add<JsonArray>();\n    array.add<JsonArray>();\n\n    checkArray(array,\n               \"[\\r\\n\"\n               \"  [],\\r\\n\"\n               \"  []\\r\\n\"\n               \"]\");\n  }\n\n  SECTION(\"NestedArrays\") {\n    JsonArray nested1 = array.add<JsonArray>();\n    nested1.add(1);\n    nested1.add(2);\n\n    JsonObject nested2 = array.add<JsonObject>();\n    nested2[\"key\"] = 3;\n\n    checkArray(array,\n               \"[\\r\\n\"\n               \"  [\\r\\n\"\n               \"    1,\\r\\n\"\n               \"    2\\r\\n\"\n               \"  ],\\r\\n\"\n               \"  {\\r\\n\"\n               \"    \\\"key\\\": 3\\r\\n\"\n               \"  }\\r\\n\"\n               \"]\");\n  }\n}\n"
  },
  {
    "path": "extras/tests/JsonSerializer/JsonObject.cpp",
    "content": "// ArduinoJson - https://arduinojson.org\n// Copyright © 2014-2025, Benoit BLANCHON\n// MIT License\n\n#include <ArduinoJson.h>\n#include <catch.hpp>\n#include <string>\n\nstatic void checkObject(const JsonObject obj, const std::string& expected) {\n  char actual[256];\n  memset(actual, '!', sizeof(actual));\n\n  size_t actualLen = serializeJson(obj, actual);\n  size_t measuredLen = measureJson(obj);\n\n  REQUIRE(expected.size() == measuredLen);\n  REQUIRE(expected.size() == actualLen);\n  REQUIRE(actual[actualLen] == 0);  // serializeJson() adds a null terminator\n  REQUIRE(expected == actual);\n}\n\nTEST_CASE(\"serializeJson(JsonObject)\") {\n  JsonDocument doc;\n  JsonObject obj = doc.to<JsonObject>();\n\n  SECTION(\"EmptyObject\") {\n    checkObject(obj, \"{}\");\n  }\n\n  SECTION(\"TwoStrings\") {\n    obj[\"key1\"] = \"value1\";\n    obj[\"key2\"] = \"value2\";\n\n    checkObject(obj, \"{\\\"key1\\\":\\\"value1\\\",\\\"key2\\\":\\\"value2\\\"}\");\n  }\n\n  SECTION(\"RemoveFirst\") {\n    obj[\"key1\"] = \"value1\";\n    obj[\"key2\"] = \"value2\";\n    obj.remove(\"key1\");\n\n    checkObject(obj, \"{\\\"key2\\\":\\\"value2\\\"}\");\n  }\n\n  SECTION(\"RemoveLast\") {\n    obj[\"key1\"] = \"value1\";\n    obj[\"key2\"] = \"value2\";\n    obj.remove(\"key2\");\n\n    checkObject(obj, \"{\\\"key1\\\":\\\"value1\\\"}\");\n  }\n\n  SECTION(\"RemoveUnexistingKey\") {\n    obj[\"key1\"] = \"value1\";\n    obj[\"key2\"] = \"value2\";\n    obj.remove(\"key3\");\n\n    checkObject(obj, \"{\\\"key1\\\":\\\"value1\\\",\\\"key2\\\":\\\"value2\\\"}\");\n  }\n\n  SECTION(\"ReplaceExistingKey\") {\n    obj[\"key\"] = \"value1\";\n    obj[\"key\"] = \"value2\";\n\n    checkObject(obj, \"{\\\"key\\\":\\\"value2\\\"}\");\n  }\n\n  SECTION(\"TwoIntegers\") {\n    obj[\"a\"] = 1;\n    obj[\"b\"] = 2;\n    checkObject(obj, \"{\\\"a\\\":1,\\\"b\\\":2}\");\n  }\n\n  SECTION(\"serialized(const char*)\") {\n    obj[\"a\"] = serialized(\"[1,2]\");\n    obj[\"b\"] = serialized(\"[4,5]\");\n    checkObject(obj, \"{\\\"a\\\":[1,2],\\\"b\\\":[4,5]}\");\n  }\n\n  SECTION(\"Two doubles\") {\n    obj[\"a\"] = 12.34;\n    obj[\"b\"] = 56.78;\n    checkObject(obj, \"{\\\"a\\\":12.34,\\\"b\\\":56.78}\");\n  }\n\n  SECTION(\"TwoNull\") {\n    obj[\"a\"] = static_cast<char*>(0);\n    obj[\"b\"] = static_cast<char*>(0);\n    checkObject(obj, \"{\\\"a\\\":null,\\\"b\\\":null}\");\n  }\n\n  SECTION(\"TwoBooleans\") {\n    obj[\"a\"] = true;\n    obj[\"b\"] = false;\n    checkObject(obj, \"{\\\"a\\\":true,\\\"b\\\":false}\");\n  }\n\n  SECTION(\"ThreeNestedArrays\") {\n    JsonDocument b;\n    JsonDocument c;\n\n    obj[\"a\"].to<JsonArray>();\n    obj[\"b\"] = b.to<JsonArray>();\n    obj[\"c\"] = c.to<JsonArray>();\n\n    checkObject(obj, \"{\\\"a\\\":[],\\\"b\\\":[],\\\"c\\\":[]}\");\n  }\n\n  SECTION(\"ThreeNestedObjects\") {\n    JsonDocument b;\n    JsonDocument c;\n\n    obj[\"a\"].to<JsonObject>();\n    obj[\"b\"] = b.to<JsonObject>();\n    obj[\"c\"] = c.to<JsonObject>();\n\n    checkObject(obj, \"{\\\"a\\\":{},\\\"b\\\":{},\\\"c\\\":{}}\");\n  }\n}\n"
  },
  {
    "path": "extras/tests/JsonSerializer/JsonObjectPretty.cpp",
    "content": "// ArduinoJson - https://arduinojson.org\n// Copyright © 2014-2025, Benoit BLANCHON\n// MIT License\n\n#include <ArduinoJson.h>\n#include <catch.hpp>\n#include <string>\n\nstatic void checkObjectPretty(const JsonObject obj,\n                              const std::string expected) {\n  char json[256];\n\n  size_t actualLen = serializeJsonPretty(obj, json);\n  size_t measuredLen = measureJsonPretty(obj);\n\n  REQUIRE(json == expected);\n  REQUIRE(expected.size() == actualLen);\n  REQUIRE(expected.size() == measuredLen);\n}\n\nTEST_CASE(\"serializeJsonPretty(JsonObject)\") {\n  JsonDocument doc;\n  JsonObject obj = doc.to<JsonObject>();\n\n  SECTION(\"EmptyObject\") {\n    checkObjectPretty(obj, \"{}\");\n  }\n\n  SECTION(\"OneMember\") {\n    obj[\"key\"] = \"value\";\n\n    checkObjectPretty(obj,\n                      \"{\\r\\n\"\n                      \"  \\\"key\\\": \\\"value\\\"\\r\\n\"\n                      \"}\");\n  }\n\n  SECTION(\"TwoMembers\") {\n    obj[\"key1\"] = \"value1\";\n    obj[\"key2\"] = \"value2\";\n\n    checkObjectPretty(obj,\n                      \"{\\r\\n\"\n                      \"  \\\"key1\\\": \\\"value1\\\",\\r\\n\"\n                      \"  \\\"key2\\\": \\\"value2\\\"\\r\\n\"\n                      \"}\");\n  }\n\n  SECTION(\"EmptyNestedContainers\") {\n    obj[\"key1\"].to<JsonObject>();\n    obj[\"key2\"].to<JsonArray>();\n\n    checkObjectPretty(obj,\n                      \"{\\r\\n\"\n                      \"  \\\"key1\\\": {},\\r\\n\"\n                      \"  \\\"key2\\\": []\\r\\n\"\n                      \"}\");\n  }\n\n  SECTION(\"NestedContainers\") {\n    JsonObject nested1 = obj[\"key1\"].to<JsonObject>();\n    nested1[\"a\"] = 1;\n\n    JsonArray nested2 = obj[\"key2\"].to<JsonArray>();\n    nested2.add(2);\n\n    checkObjectPretty(obj,\n                      \"{\\r\\n\"\n                      \"  \\\"key1\\\": {\\r\\n\"\n                      \"    \\\"a\\\": 1\\r\\n\"\n                      \"  },\\r\\n\"\n                      \"  \\\"key2\\\": [\\r\\n\"\n                      \"    2\\r\\n\"\n                      \"  ]\\r\\n\"\n                      \"}\");\n  }\n}\n"
  },
  {
    "path": "extras/tests/JsonSerializer/JsonVariant.cpp",
    "content": "// ArduinoJson - https://arduinojson.org\n// Copyright © 2014-2025, Benoit BLANCHON\n// MIT License\n\n#include <ArduinoJson.h>\n#include <catch.hpp>\n#include <limits>\n\n#include \"Literals.hpp\"\n\ntemplate <typename T>\nvoid check(T value, const std::string& expected) {\n  JsonDocument doc;\n  doc.to<JsonVariant>().set(value);\n  char buffer[256] = \"\";\n  size_t returnValue = serializeJson(doc, buffer, sizeof(buffer));\n  REQUIRE(expected == buffer);\n  REQUIRE(expected.size() == returnValue);\n}\n\nTEST_CASE(\"serializeJson(JsonVariant)\") {\n  SECTION(\"Undefined\") {\n    check(JsonVariant(), \"null\");\n  }\n\n  SECTION(\"Null string\") {\n    check(static_cast<char*>(0), \"null\");\n  }\n\n  SECTION(\"const char*\") {\n    check(\"hello\", \"\\\"hello\\\"\");\n  }\n\n  SECTION(\"string\") {\n    check(\"hello\"_s, \"\\\"hello\\\"\");\n\n    SECTION(\"Escape quotation mark\") {\n      check(\"hello \\\"world\\\"\"_s, \"\\\"hello \\\\\\\"world\\\\\\\"\\\"\");\n    }\n\n    SECTION(\"Escape reverse solidus\") {\n      check(\"hello\\\\world\"_s, \"\\\"hello\\\\\\\\world\\\"\");\n    }\n\n    SECTION(\"Don't escape solidus\") {\n      check(\"fifty/fifty\"_s, \"\\\"fifty/fifty\\\"\");\n    }\n\n    SECTION(\"Don't escape single quote\") {\n      check(\"hello'world\"_s, \"\\\"hello'world\\\"\");\n    }\n\n    SECTION(\"Escape backspace\") {\n      check(\"hello\\bworld\"_s, \"\\\"hello\\\\bworld\\\"\");\n    }\n\n    SECTION(\"Escape formfeed\") {\n      check(\"hello\\fworld\"_s, \"\\\"hello\\\\fworld\\\"\");\n    }\n\n    SECTION(\"Escape linefeed\") {\n      check(\"hello\\nworld\"_s, \"\\\"hello\\\\nworld\\\"\");\n    }\n\n    SECTION(\"Escape carriage return\") {\n      check(\"hello\\rworld\"_s, \"\\\"hello\\\\rworld\\\"\");\n    }\n\n    SECTION(\"Escape tab\") {\n      check(\"hello\\tworld\"_s, \"\\\"hello\\\\tworld\\\"\");\n    }\n\n    SECTION(\"NUL char\") {\n      check(\"hello\\0world\"_s, \"\\\"hello\\\\u0000world\\\"\");\n    }\n  }\n\n  SECTION(\"SerializedValue<const char*>\") {\n    check(serialized(\"[1,2]\"), \"[1,2]\");\n  }\n\n  SECTION(\"SerializedValue<std::string>\") {\n    check(serialized(\"[1,2]\"_s), \"[1,2]\");\n  }\n\n  SECTION(\"Double\") {\n    check(3.1415927, \"3.1415927\");\n  }\n\n  SECTION(\"Float\") {\n    REQUIRE(sizeof(float) == 4);\n    check(3.1415927f, \"3.141593\");\n  }\n\n  SECTION(\"Zero\") {\n    check(0, \"0\");\n  }\n\n  SECTION(\"Integer\") {\n    check(42, \"42\");\n  }\n\n  SECTION(\"NegativeLong\") {\n    check(-42, \"-42\");\n  }\n\n  SECTION(\"UnsignedLong\") {\n    check(4294967295UL, \"4294967295\");\n  }\n\n  SECTION(\"True\") {\n    check(true, \"true\");\n  }\n\n  SECTION(\"OneFalse\") {\n    check(false, \"false\");\n  }\n\n#if ARDUINOJSON_USE_LONG_LONG\n  SECTION(\"NegativeInt64\") {\n    check(-9223372036854775807 - 1, \"-9223372036854775808\");\n  }\n\n  SECTION(\"PositiveInt64\") {\n    check(9223372036854775807, \"9223372036854775807\");\n  }\n\n  SECTION(\"UInt64\") {\n    check(18446744073709551615U, \"18446744073709551615\");\n  }\n#endif\n}\n"
  },
  {
    "path": "extras/tests/JsonSerializer/misc.cpp",
    "content": "#include <ArduinoJson.h>\n#include <catch.hpp>\n#include <limits>\n\nTEST_CASE(\"serializeJson(MemberProxy)\") {\n  JsonDocument doc;\n  deserializeJson(doc, \"{\\\"hello\\\":42}\");\n  JsonObject obj = doc.as<JsonObject>();\n  std::string result;\n\n  serializeJson(obj[\"hello\"], result);\n\n  REQUIRE(result == \"42\");\n}\n\nTEST_CASE(\"serializeJson(ElementProxy)\") {\n  JsonDocument doc;\n  deserializeJson(doc, \"[42]\");\n  JsonArray arr = doc.as<JsonArray>();\n  std::string result;\n\n  serializeJson(arr[0], result);\n\n  REQUIRE(result == \"42\");\n}\n\nTEST_CASE(\"serializeJson(JsonVariantSubscript)\") {\n  JsonDocument doc;\n  deserializeJson(doc, \"[42]\");\n  JsonVariant var = doc.as<JsonVariant>();\n  std::string result;\n\n  serializeJson(var[0], result);\n\n  REQUIRE(result == \"42\");\n}\n"
  },
  {
    "path": "extras/tests/JsonSerializer/std_stream.cpp",
    "content": "// ArduinoJson - https://arduinojson.org\n// Copyright © 2014-2025, Benoit BLANCHON\n// MIT License\n\n#include <ArduinoJson.h>\n#include <catch.hpp>\n#include <sstream>\n\nTEST_CASE(\"operator<<(std::ostream)\") {\n  JsonDocument doc;\n  std::ostringstream os;\n\n  SECTION(\"JsonVariant containing false\") {\n    JsonVariant variant = doc.to<JsonVariant>();\n\n    variant.set(false);\n    os << variant;\n\n    REQUIRE(\"false\" == os.str());\n  }\n\n  SECTION(\"JsonVariant containing string\") {\n    JsonVariant variant = doc.to<JsonVariant>();\n\n    variant.set(\"coucou\");\n    os << variant;\n\n    REQUIRE(\"\\\"coucou\\\"\" == os.str());\n  }\n\n  SECTION(\"JsonObject\") {\n    JsonObject object = doc.to<JsonObject>();\n    object[\"key\"] = \"value\";\n\n    os << object;\n\n    REQUIRE(\"{\\\"key\\\":\\\"value\\\"}\" == os.str());\n  }\n\n  SECTION(\"MemberProxy\") {\n    JsonObject object = doc.to<JsonObject>();\n    object[\"key\"] = \"value\";\n\n    os << object[\"key\"];\n\n    REQUIRE(\"\\\"value\\\"\" == os.str());\n  }\n\n  SECTION(\"JsonArray\") {\n    JsonArray array = doc.to<JsonArray>();\n    array.add(\"value\");\n\n    os << array;\n\n    REQUIRE(\"[\\\"value\\\"]\" == os.str());\n  }\n\n  SECTION(\"ElementProxy\") {\n    JsonArray array = doc.to<JsonArray>();\n    array.add(\"value\");\n\n    os << array[0];\n\n    REQUIRE(\"\\\"value\\\"\" == os.str());\n  }\n}\n"
  },
  {
    "path": "extras/tests/JsonSerializer/std_string.cpp",
    "content": "// ArduinoJson - https://arduinojson.org\n// Copyright © 2014-2025, Benoit BLANCHON\n// MIT License\n\n#include <ArduinoJson.h>\n#include <catch.hpp>\n\n#include \"Literals.hpp\"\n\nTEST_CASE(\"serialize JsonArray to std::string\") {\n  JsonDocument doc;\n  JsonArray array = doc.to<JsonArray>();\n  array.add(4);\n  array.add(2);\n\n  SECTION(\"serializeJson()\") {\n    std::string json = \"erase me\";\n    serializeJson(array, json);\n\n    REQUIRE(\"[4,2]\" == json);\n  }\n\n  SECTION(\"serializeJsonPretty\") {\n    std::string json = \"erase me\";\n    serializeJsonPretty(array, json);\n\n    REQUIRE(\"[\\r\\n  4,\\r\\n  2\\r\\n]\" == json);\n  }\n}\n\nTEST_CASE(\"serialize JsonObject to std::string\") {\n  JsonDocument doc;\n  JsonObject obj = doc.to<JsonObject>();\n  obj[\"key\"] = \"value\";\n\n  SECTION(\"object\") {\n    std::string json = \"erase me\";\n    serializeJson(doc, json);\n\n    REQUIRE(\"{\\\"key\\\":\\\"value\\\"}\" == json);\n  }\n\n  SECTION(\"serializeJsonPretty\") {\n    std::string json = \"erase me\";\n    serializeJsonPretty(doc, json);\n\n    REQUIRE(\"{\\r\\n  \\\"key\\\": \\\"value\\\"\\r\\n}\" == json);\n  }\n}\n\nTEST_CASE(\"serialize an std::string containing a NUL\") {\n  JsonDocument doc;\n  doc.set(\"hello\\0world\"_s);\n\n  std::string json = \"erase me\";\n  serializeJson(doc, json);\n  CHECK(\"\\\"hello\\\\u0000world\\\"\" == json);\n}\n"
  },
  {
    "path": "extras/tests/JsonVariant/CMakeLists.txt",
    "content": "# ArduinoJson - https://arduinojson.org\n# Copyright © 2014-2025, Benoit BLANCHON\n# MIT License\n\nadd_executable(JsonVariantTests\n\tadd.cpp\n\tas.cpp\n\tclear.cpp\n\tcompare.cpp\n\tconverters.cpp\n\tcopy.cpp\n\tis.cpp\n\tisnull.cpp\n\tmisc.cpp\n\tnesting.cpp\n\tnullptr.cpp\n\tor.cpp\n\toverflow.cpp\n\tremove.cpp\n\tset.cpp\n\tsize.cpp\n\tstl_containers.cpp\n\tsubscript.cpp\n\ttypes.cpp\n\tunbound.cpp\n)\n\nadd_test(JsonVariant JsonVariantTests)\n\nset_tests_properties(JsonVariant\n\tPROPERTIES\n\t\tLABELS \"Catch\"\n)\n"
  },
  {
    "path": "extras/tests/JsonVariant/add.cpp",
    "content": "// ArduinoJson - https://arduinojson.org\n// Copyright © 2014-2025, Benoit BLANCHON\n// MIT License\n\n#include <ArduinoJson.h>\n#include <stdint.h>\n#include <catch.hpp>\n\n#include \"Allocators.hpp\"\n#include \"Literals.hpp\"\n\nTEST_CASE(\"JsonVariant::add(T)\") {\n  JsonDocument doc;\n  JsonVariant var = doc.to<JsonVariant>();\n\n  SECTION(\"add integer to new variant\") {\n    var.add(42);\n\n    REQUIRE(var.as<std::string>() == \"[42]\");\n  }\n\n  SECTION(\"add const char* to new variant\") {\n    var.add(\"hello\");\n\n    REQUIRE(var.as<std::string>() == \"[\\\"hello\\\"]\");\n  }\n\n  SECTION(\"add std::string to new variant\") {\n    var.add(\"hello\"_s);\n\n    REQUIRE(var.as<std::string>() == \"[\\\"hello\\\"]\");\n  }\n\n  SECTION(\"add integer to integer\") {\n    var.set(123);\n\n    var.add(456);  // no-op\n\n    REQUIRE(var.as<std::string>() == \"123\");\n  }\n\n  SECTION(\"add integer to object\") {\n    var[\"val\"] = 123;\n\n    var.add(456);  // no-op\n\n    REQUIRE(var.as<std::string>() == \"{\\\"val\\\":123}\");\n  }\n\n#ifdef HAS_VARIABLE_LENGTH_ARRAY\n  SECTION(\"supports VLAs\") {\n    size_t i = 16;\n    char vla[i];\n    strcpy(vla, \"hello\");\n\n    var.add(vla);\n\n    REQUIRE(var.as<std::string>() == \"[\\\"hello\\\"]\");\n  }\n#endif\n}\n\nTEST_CASE(\"JsonVariant::add<T>()\") {\n  JsonDocument doc;\n  JsonVariant var = doc.to<JsonVariant>();\n\n  SECTION(\"JsonArray\") {\n    JsonArray array = var.add<JsonArray>();\n    array.add(1);\n    array.add(2);\n    REQUIRE(doc.as<std::string>() == \"[[1,2]]\");\n  }\n\n  SECTION(\"JsonVariant\") {\n    JsonVariant variant = var.add<JsonVariant>();\n    variant.set(42);\n    REQUIRE(doc.as<std::string>() == \"[42]\");\n  }\n}\n\nTEST_CASE(\"JsonObject::add(JsonObject) \") {\n  JsonDocument doc1;\n  doc1[\"hello\"_s] = \"world\"_s;\n\n  TimebombAllocator allocator(10);\n  SpyingAllocator spy(&allocator);\n  JsonDocument doc2(&spy);\n  JsonVariant variant = doc2.to<JsonVariant>();\n\n  SECTION(\"success\") {\n    bool result = variant.add(doc1.as<JsonObject>());\n\n    REQUIRE(result == true);\n    REQUIRE(doc2.as<std::string>() == \"[{\\\"hello\\\":\\\"world\\\"}]\");\n    REQUIRE(spy.log() == AllocatorLog{\n                             Allocate(sizeofPool()),\n                             Allocate(sizeofString(\"hello\")),\n                             Allocate(sizeofString(\"world\")),\n                         });\n  }\n\n  SECTION(\"partial failure\") {  // issue #2081\n    allocator.setCountdown(2);\n\n    bool result = variant.add(doc1.as<JsonObject>());\n\n    REQUIRE(result == false);\n    REQUIRE(doc2.as<std::string>() == \"[]\");\n    REQUIRE(spy.log() == AllocatorLog{\n                             Allocate(sizeofPool()),\n                             Allocate(sizeofString(\"hello\")),\n                             AllocateFail(sizeofString(\"world\")),\n                             Deallocate(sizeofString(\"hello\")),\n                         });\n  }\n\n  SECTION(\"complete failure\") {\n    allocator.setCountdown(0);\n\n    bool result = variant.add(doc1.as<JsonObject>());\n\n    REQUIRE(result == false);\n    REQUIRE(doc2.as<std::string>() == \"[]\");\n    REQUIRE(spy.log() == AllocatorLog{\n                             AllocateFail(sizeofPool()),\n                         });\n  }\n}\n"
  },
  {
    "path": "extras/tests/JsonVariant/as.cpp",
    "content": "// ArduinoJson - https://arduinojson.org\n// Copyright © 2014-2025, Benoit BLANCHON\n// MIT License\n\n#include <ArduinoJson.h>\n#include <stdint.h>\n#include <catch.hpp>\n\n#include \"Literals.hpp\"\n\nnamespace my {\nusing ArduinoJson::detail::isinf;\n}  // namespace my\n\nenum MY_ENUM { ONE = 1, TWO = 2 };\n\nTEST_CASE(\"JsonVariant::as()\") {\n  static const char* null = 0;\n\n  JsonDocument doc;\n  JsonVariant variant = doc.to<JsonVariant>();\n\n  SECTION(\"not set\") {\n    REQUIRE(false == variant.as<bool>());\n    REQUIRE(0 == variant.as<int>());\n    REQUIRE(0.0f == variant.as<float>());\n    REQUIRE(0 == variant.as<const char*>());\n    REQUIRE(\"null\" == variant.as<std::string>());\n    REQUIRE(variant.as<JsonString>().isNull());\n    REQUIRE(variant.as<MsgPackBinary>().data() == nullptr);\n    REQUIRE(variant.as<MsgPackExtension>().data() == nullptr);\n  }\n\n  SECTION(\"set(float)\") {\n    variant.set(4.2f);\n\n    REQUIRE(variant.as<bool>());\n    REQUIRE(0 == variant.as<const char*>());\n    REQUIRE(variant.as<std::string>() == \"4.2\");\n    REQUIRE(variant.as<long>() == 4L);\n    REQUIRE(variant.as<float>() == 4.2f);\n    REQUIRE(variant.as<unsigned>() == 4U);\n    REQUIRE(variant.as<JsonString>().isNull());\n    REQUIRE(variant.as<MsgPackBinary>().data() == nullptr);\n    REQUIRE(variant.as<MsgPackExtension>().data() == nullptr);\n  }\n\n  SECTION(\"set(double)\") {\n    variant.set(4.2);\n\n    REQUIRE(variant.as<bool>());\n    REQUIRE(0 == variant.as<const char*>());\n    REQUIRE(variant.as<std::string>() == \"4.2\");\n    REQUIRE(variant.as<long>() == 4L);\n    REQUIRE(variant.as<double>() == 4.2);\n    REQUIRE(variant.as<unsigned>() == 4U);\n    REQUIRE(variant.as<JsonString>().isNull());\n    REQUIRE(variant.as<MsgPackBinary>().data() == nullptr);\n    REQUIRE(variant.as<MsgPackExtension>().data() == nullptr);\n  }\n\n  SECTION(\"set(0.0)\") {\n    variant.set(0.0);\n\n    REQUIRE(variant.as<bool>() == false);\n    REQUIRE(variant.as<long>() == 0L);\n    REQUIRE(variant.as<JsonString>().isNull());\n    REQUIRE(variant.as<MsgPackBinary>().data() == nullptr);\n    REQUIRE(variant.as<MsgPackExtension>().data() == nullptr);\n  }\n\n  SECTION(\"set(false)\") {\n    variant.set(false);\n\n    REQUIRE(false == variant.as<bool>());\n    REQUIRE(variant.as<double>() == 0.0);\n    REQUIRE(variant.as<long>() == 0L);\n    REQUIRE(variant.as<std::string>() == \"false\");\n    REQUIRE(variant.as<JsonString>().isNull());\n    REQUIRE(variant.as<MsgPackBinary>().data() == nullptr);\n    REQUIRE(variant.as<MsgPackExtension>().data() == nullptr);\n  }\n\n  SECTION(\"set(true)\") {\n    variant.set(true);\n\n    REQUIRE(variant.as<bool>());\n    REQUIRE(variant.as<double>() == 1.0);\n    REQUIRE(variant.as<long>() == 1L);\n    REQUIRE(variant.as<std::string>() == \"true\");\n    REQUIRE(variant.as<JsonString>().isNull());\n    REQUIRE(variant.as<MsgPackBinary>().data() == nullptr);\n    REQUIRE(variant.as<MsgPackExtension>().data() == nullptr);\n  }\n\n  SECTION(\"set(uint32_t)\") {\n    variant.set(4294967295U);\n\n    REQUIRE(variant.as<bool>() == true);\n    REQUIRE(variant.as<double>() == 4294967295.0);\n    REQUIRE(variant.as<int32_t>() == 0);\n    REQUIRE(variant.as<uint32_t>() == 4294967295U);\n    REQUIRE(variant.as<uint64_t>() == 4294967295U);\n    REQUIRE(variant.as<std::string>() == \"4294967295\");\n    REQUIRE(variant.as<JsonString>().isNull());\n    REQUIRE(variant.as<MsgPackBinary>().data() == nullptr);\n    REQUIRE(variant.as<MsgPackExtension>().data() == nullptr);\n  }\n\n  SECTION(\"set(int32_t)\") {\n    variant.set(-2147483648LL);\n\n    REQUIRE(variant.as<bool>() == true);\n    REQUIRE(variant.as<double>() == -2147483648LL);\n    REQUIRE(variant.as<int32_t>() == -2147483648LL);\n    REQUIRE(variant.as<int64_t>() == -2147483648LL);\n    REQUIRE(variant.as<uint32_t>() == 0);\n    REQUIRE(variant.as<uint64_t>() == 0);\n    REQUIRE(variant.as<std::string>() == \"-2147483648\");\n    REQUIRE(variant.as<JsonString>().isNull());\n    REQUIRE(variant.as<MsgPackBinary>().data() == nullptr);\n    REQUIRE(variant.as<MsgPackExtension>().data() == nullptr);\n  }\n\n  SECTION(\"set(uint64_t)\") {\n    variant.set(4294967296U);\n\n    REQUIRE(variant.as<bool>() == true);\n    REQUIRE(variant.as<double>() == 4294967296.0);\n    REQUIRE(variant.as<int32_t>() == 0);\n    REQUIRE(variant.as<uint32_t>() == 0);\n    REQUIRE(variant.as<uint64_t>() == 4294967296U);\n    REQUIRE(variant.as<std::string>() == \"4294967296\");\n    REQUIRE(variant.as<JsonString>().isNull());\n    REQUIRE(variant.as<MsgPackBinary>().data() == nullptr);\n    REQUIRE(variant.as<MsgPackExtension>().data() == nullptr);\n  }\n\n  SECTION(\"set(int64_t)\") {\n    variant.set(-2147483649LL);\n\n    REQUIRE(variant.as<bool>() == true);\n    REQUIRE(variant.as<double>() == -2147483649LL);\n    REQUIRE(variant.as<int32_t>() == 0);\n    REQUIRE(variant.as<int64_t>() == -2147483649LL);\n    REQUIRE(variant.as<uint32_t>() == 0);\n    REQUIRE(variant.as<uint64_t>() == 0);\n    REQUIRE(variant.as<std::string>() == \"-2147483649\");\n    REQUIRE(variant.as<JsonString>().isNull());\n    REQUIRE(variant.as<MsgPackBinary>().data() == nullptr);\n    REQUIRE(variant.as<MsgPackExtension>().data() == nullptr);\n  }\n\n  SECTION(\"set(0L)\") {\n    variant.set(0L);\n\n    REQUIRE(variant.as<bool>() == false);\n    REQUIRE(variant.as<double>() == 0.0);\n    REQUIRE(variant.as<std::string>() == \"0\");\n    REQUIRE(variant.as<JsonString>().isNull());\n  }\n\n  SECTION(\"set(0UL)\") {\n    variant.set(0UL);\n\n    REQUIRE(variant.as<bool>() == false);\n    REQUIRE(variant.as<double>() == 0.0);\n    REQUIRE(variant.as<std::string>() == \"0\");\n    REQUIRE(variant.as<JsonString>().isNull());\n  }\n\n  SECTION(\"set(null)\") {\n    variant.set(null);\n\n    REQUIRE(variant.as<bool>() == false);\n    REQUIRE(variant.as<double>() == 0.0);\n    REQUIRE(variant.as<long>() == 0L);\n    REQUIRE(variant.as<std::string>() == \"null\");\n    REQUIRE(variant.as<JsonString>().isNull());\n  }\n\n  SECTION(\"set(\\\"42\\\")\") {\n    variant.set(\"42\");\n\n    REQUIRE(variant.as<long>() == 42L);\n    REQUIRE(variant.as<double>() == 42);\n    REQUIRE(variant.as<JsonString>() == \"42\");\n  }\n\n  SECTION(\"set(\\\"hello\\\")\") {\n    variant.set(\"hello\");\n\n    REQUIRE(variant.as<bool>() == true);\n    REQUIRE(variant.as<long>() == 0L);\n    REQUIRE(variant.as<const char*>() == \"hello\"_s);\n    REQUIRE(variant.as<const char*>() == \"hello\"_s);\n    REQUIRE(variant.as<std::string>() == \"hello\"_s);\n    REQUIRE(variant.as<JsonString>() == \"hello\");\n  }\n\n  SECTION(\"set(std::string(\\\"4.2\\\")) (tiny string optimization)\") {\n    variant.set(\"4.2\"_s);\n\n    REQUIRE(variant.as<bool>() == true);\n    REQUIRE(variant.as<long>() == 4L);\n    REQUIRE(variant.as<double>() == Approx(4.2));\n    REQUIRE(variant.as<const char*>() == \"4.2\"_s);\n    REQUIRE(variant.as<std::string>() == \"4.2\"_s);\n    REQUIRE(variant.as<JsonString>() == \"4.2\");\n  }\n\n  SECTION(\"set(std::string(\\\"123.45\\\"))\") {\n    variant.set(\"123.45\"_s);\n\n    REQUIRE(variant.as<bool>() == true);\n    REQUIRE(variant.as<long>() == 123L);\n    REQUIRE(variant.as<double>() == Approx(123.45));\n    REQUIRE(variant.as<const char*>() == \"123.45\"_s);\n    REQUIRE(variant.as<std::string>() == \"123.45\"_s);\n    REQUIRE(variant.as<JsonString>() == \"123.45\");\n  }\n\n  SECTION(\"set(\\\"true\\\")\") {\n    variant.set(\"true\");\n\n    REQUIRE(variant.as<bool>() == true);\n    REQUIRE(variant.as<int>() == 0);\n    REQUIRE(variant.as<JsonString>() == \"true\");\n  }\n\n  SECTION(\"set(-1e300)\") {\n    variant.set(-1e300);\n\n    REQUIRE(variant.as<bool>() == true);\n    REQUIRE(variant.as<double>() == -1e300);\n    REQUIRE(variant.as<float>() < 0);\n    REQUIRE(my::isinf(variant.as<float>()));\n    REQUIRE(variant.as<JsonString>().isNull());\n  }\n\n  SECTION(\"set(1e300)\") {\n    variant.set(1e300);\n\n    REQUIRE(variant.as<bool>() == true);\n    REQUIRE(variant.as<double>() == 1e300);\n    REQUIRE(variant.as<float>() > 0);\n    REQUIRE(my::isinf(variant.as<float>()));\n    REQUIRE(variant.as<JsonString>().isNull());\n  }\n\n  SECTION(\"set(1e-300)\") {\n    variant.set(1e-300);\n\n    REQUIRE(variant.as<bool>() == true);\n    REQUIRE(variant.as<double>() == 1e-300);\n    REQUIRE(variant.as<float>() == 0);\n    REQUIRE(variant.as<JsonString>().isNull());\n  }\n\n  SECTION(\"set(serialized(\\\"hello\\\"))\") {\n    variant.set(serialized(\"hello\"));\n\n    REQUIRE(variant.as<MsgPackBinary>().data() == nullptr);\n    REQUIRE(variant.as<MsgPackExtension>().data() == nullptr);\n  }\n\n  SECTION(\"to<JsonObject>()\") {\n    JsonObject obj = variant.to<JsonObject>();\n    obj[\"key\"] = \"value\";\n\n    SECTION(\"as<bool>()\") {\n      REQUIRE(variant.as<bool>() == true);\n    }\n\n    SECTION(\"as<std::string>()\") {\n      REQUIRE(variant.as<std::string>() == \"{\\\"key\\\":\\\"value\\\"}\"_s);\n    }\n\n    SECTION(\"ObjectAsJsonObject\") {\n      JsonObject o = variant.as<JsonObject>();\n      REQUIRE(o.size() == 1);\n      REQUIRE(o[\"key\"] == \"value\"_s);\n    }\n  }\n\n  SECTION(\"to<JsonArray>()\") {\n    JsonArray arr = variant.to<JsonArray>();\n    arr.add(4);\n    arr.add(2);\n\n    SECTION(\"as<bool>()\") {\n      REQUIRE(variant.as<bool>() == true);\n    }\n\n    SECTION(\"as<std::string>()\") {\n      REQUIRE(variant.as<std::string>() == \"[4,2]\"_s);\n    }\n\n    SECTION(\"as<JsonArray>()\") {\n      JsonArray a = variant.as<JsonArray>();\n      REQUIRE(a.size() == 2);\n      REQUIRE(a[0] == 4);\n      REQUIRE(a[1] == 2);\n    }\n  }\n\n#if ARDUINOJSON_USE_LONG_LONG\n  SECTION(\"Smallest int64 negative\") {\n    variant.set(\"-9223372036854775808\");\n    REQUIRE(variant.as<long long>() == -9223372036854775807 - 1);\n  }\n\n  SECTION(\"Biggest int64 positive\") {\n    variant.set(\"9223372036854775807\");\n    REQUIRE(variant.as<long long>() == 9223372036854775807);\n  }\n#endif\n\n  SECTION(\"as<enum>()\") {\n    variant.set(1);\n\n    REQUIRE(variant.as<MY_ENUM>() == ONE);\n  }\n}\n"
  },
  {
    "path": "extras/tests/JsonVariant/clear.cpp",
    "content": "// ArduinoJson - https://arduinojson.org\n// Copyright © 2014-2025, Benoit BLANCHON\n// MIT License\n\n#include <ArduinoJson.h>\n#include <stdint.h>\n#include <catch.hpp>\n\n#include \"Allocators.hpp\"\n#include \"Literals.hpp\"\n\nTEST_CASE(\"JsonVariant::clear()\") {\n  SpyingAllocator spy;\n  JsonDocument doc(&spy);\n  JsonVariant var = doc.to<JsonVariant>();\n\n  SECTION(\"size goes back to zero\") {\n    var.add(42);\n    var.clear();\n\n    REQUIRE(var.size() == 0);\n  }\n\n  SECTION(\"isNull() return true\") {\n    var.add(\"hello\");\n    var.clear();\n\n    REQUIRE(var.isNull() == true);\n  }\n\n  SECTION(\"releases owned string\") {\n    var.set(\"hello\"_s);\n    var.clear();\n\n    REQUIRE(spy.log() == AllocatorLog{\n                             Allocate(sizeofString(\"hello\")),\n                             Deallocate(sizeofString(\"hello\")),\n                         });\n  }\n}\n"
  },
  {
    "path": "extras/tests/JsonVariant/compare.cpp",
    "content": "// ArduinoJson - https://arduinojson.org\n// Copyright © 2014-2025, Benoit BLANCHON\n// MIT License\n\n#include <ArduinoJson.h>\n#include <catch.hpp>\n\n// Most code is already covered by arithmeticCompare.cpp.\n// Here, we're just filling the holes\n\nTEST_CASE(\"Compare JsonVariant with value\") {\n  JsonDocument doc;\n  JsonVariant a = doc.add<JsonVariant>();\n\n  SECTION(\"null vs (char*)0\") {\n    char* b = 0;\n\n    CHECK(a == b);\n    CHECK(a <= b);\n    CHECK(a >= b);\n    CHECK_FALSE(a != b);\n    CHECK_FALSE(a < b);\n    CHECK_FALSE(a > b);\n  }\n\n  SECTION(\"42 vs 42\") {\n    a.set(42);\n    int b = 42;\n\n    CHECK(a == b);\n    CHECK(a <= b);\n    CHECK(a >= b);\n    CHECK_FALSE(a != b);\n    CHECK_FALSE(a < b);\n    CHECK_FALSE(a > b);\n  }\n}\n\nTEST_CASE(\"Compare JsonVariant with JsonVariant\") {\n  JsonDocument doc;\n  JsonVariant a = doc.add<JsonVariant>();\n  JsonVariant b = doc.add<JsonVariant>();\n\n  SECTION(\"'abc' vs 'abc'\") {\n    a.set(\"abc\");\n    b.set(\"abc\");\n\n    CHECK(a == b);\n    CHECK(a <= b);\n    CHECK(a >= b);\n    CHECK_FALSE(a != b);\n    CHECK_FALSE(a < b);\n    CHECK_FALSE(a > b);\n  }\n\n  SECTION(\"'abc' vs 'bcd'\") {\n    a.set(\"abc\");\n    b.set(\"bcd\");\n\n    CHECK(a != b);\n    CHECK(a < b);\n    CHECK(a <= b);\n    CHECK_FALSE(a == b);\n    CHECK_FALSE(a > b);\n    CHECK_FALSE(a >= b);\n  }\n\n  SECTION(\"'bcd' vs 'abc'\") {\n    a.set(\"bcd\");\n    b.set(\"abc\");\n\n    CHECK(a != b);\n    CHECK(a > b);\n    CHECK(a >= b);\n    CHECK_FALSE(a < b);\n    CHECK_FALSE(a <= b);\n    CHECK_FALSE(a == b);\n  }\n\n  SECTION(\"serialized('abc') vs serialized('abc')\") {\n    a.set(serialized(\"abc\"));\n    b.set(serialized(\"abc\"));\n\n    CHECK(a == b);\n    CHECK(a <= b);\n    CHECK(a >= b);\n    CHECK_FALSE(a != b);\n    CHECK_FALSE(a < b);\n    CHECK_FALSE(a > b);\n  }\n\n  SECTION(\"serialized('abc') vs serialized('bcd')\") {\n    a.set(serialized(\"abc\"));\n    b.set(serialized(\"bcd\"));\n\n    CHECK(a != b);\n    CHECK(a < b);\n    CHECK(a <= b);\n    CHECK_FALSE(a == b);\n    CHECK_FALSE(a > b);\n    CHECK_FALSE(a >= b);\n  }\n\n  SECTION(\"serialized('bcd') vs serialized('abc')\") {\n    a.set(serialized(\"bcd\"));\n    b.set(serialized(\"abc\"));\n\n    CHECK(a != b);\n    CHECK(a > b);\n    CHECK(a >= b);\n    CHECK_FALSE(a < b);\n    CHECK_FALSE(a <= b);\n    CHECK_FALSE(a == b);\n  }\n\n  SECTION(\"MsgPackBinary('abc') vs MsgPackBinary('abc')\") {\n    a.set(MsgPackBinary(\"abc\", 4));\n    b.set(MsgPackBinary(\"abc\", 4));\n\n    CHECK(a == b);\n    CHECK(a <= b);\n    CHECK(a >= b);\n    CHECK_FALSE(a != b);\n    CHECK_FALSE(a < b);\n    CHECK_FALSE(a > b);\n  }\n\n  SECTION(\"MsgPackBinary('abc') vs MsgPackBinary('bcd')\") {\n    a.set(MsgPackBinary(\"abc\", 4));\n    b.set(MsgPackBinary(\"bcd\", 4));\n\n    CHECK(a != b);\n    CHECK(a < b);\n    CHECK(a <= b);\n    CHECK_FALSE(a == b);\n    CHECK_FALSE(a > b);\n    CHECK_FALSE(a >= b);\n  }\n\n  SECTION(\"MsgPackBinary('bcd') vs MsgPackBinary('abc')\") {\n    a.set(MsgPackBinary(\"bcd\", 4));\n    b.set(MsgPackBinary(\"abc\", 4));\n\n    CHECK(a != b);\n    CHECK(a > b);\n    CHECK(a >= b);\n    CHECK_FALSE(a < b);\n    CHECK_FALSE(a <= b);\n    CHECK_FALSE(a == b);\n  }\n\n  SECTION(\"false vs true\") {\n    a.set(false);\n    b.set(true);\n\n    CHECK(a != b);\n    CHECK(a < b);\n    CHECK(a <= b);\n    CHECK_FALSE(a == b);\n    CHECK_FALSE(a > b);\n    CHECK_FALSE(a >= b);\n  }\n\n  SECTION(\"false vs -1\") {\n    a.set(false);\n    b.set(-1);\n\n    CHECK(a != b);\n    CHECK(a > b);\n    CHECK(a >= b);\n    CHECK_FALSE(a < b);\n    CHECK_FALSE(a <= b);\n    CHECK_FALSE(a == b);\n  }\n\n  SECTION(\"null vs null\") {\n    CHECK(a == b);\n    CHECK(a <= b);\n    CHECK(a >= b);\n    CHECK_FALSE(a != b);\n    CHECK_FALSE(a < b);\n    CHECK_FALSE(a > b);\n  }\n\n  SECTION(\"42 vs 42\") {\n    a.set(42);\n    b.set(42);\n\n    CHECK(a == b);\n    CHECK(a <= b);\n    CHECK(a >= b);\n    CHECK_FALSE(a != b);\n    CHECK_FALSE(a < b);\n    CHECK_FALSE(a > b);\n  }\n\n  SECTION(\"42 vs 42U\") {\n    a.set(42);\n    b.set(42U);\n\n    CHECK(a == b);\n    CHECK(a <= b);\n    CHECK(a >= b);\n    CHECK_FALSE(a != b);\n    CHECK_FALSE(a < b);\n    CHECK_FALSE(a > b);\n  }\n\n  SECTION(\"42 vs 42.0\") {\n    a.set(42);\n    b.set(42.0);\n\n    CHECK(a == b);\n    CHECK(a <= b);\n    CHECK(a >= b);\n    CHECK_FALSE(a != b);\n    CHECK_FALSE(a < b);\n    CHECK_FALSE(a > b);\n  }\n\n  SECTION(\"42.0 vs 42\") {\n    a.set(42.0);\n    b.set(42);\n\n    CHECK(a == b);\n    CHECK(a <= b);\n    CHECK(a >= b);\n    CHECK_FALSE(a != b);\n    CHECK_FALSE(a < b);\n    CHECK_FALSE(a > b);\n  }\n\n  SECTION(\"-42 vs -42\") {\n    a.set(-42);\n    b.set(-42);\n\n    CHECK(a == b);\n    CHECK(a <= b);\n    CHECK(a >= b);\n    CHECK_FALSE(a != b);\n    CHECK_FALSE(a < b);\n    CHECK_FALSE(a > b);\n  }\n\n  SECTION(\"-42 vs 42\") {\n    a.set(-42);\n    b.set(42);\n\n    CHECK(a != b);\n    CHECK(a < b);\n    CHECK(a <= b);\n    CHECK_FALSE(a == b);\n    CHECK_FALSE(a > b);\n    CHECK_FALSE(a >= b);\n  }\n\n  SECTION(\"42 vs -42\") {\n    a.set(42);\n    b.set(-42);\n\n    CHECK(a != b);\n    CHECK(a > b);\n    CHECK(a >= b);\n    CHECK_FALSE(a < b);\n    CHECK_FALSE(a <= b);\n    CHECK_FALSE(a == b);\n  }\n\n  SECTION(\"42.0 vs -42\") {\n    a.set(42.0);\n    b.set(-42);\n\n    CHECK(a != b);\n    CHECK(a > b);\n    CHECK(a >= b);\n    CHECK_FALSE(a < b);\n    CHECK_FALSE(a <= b);\n    CHECK_FALSE(a == b);\n  }\n\n  SECTION(\"42U vs 42U\") {\n    a.set(42U);\n    b.set(42U);\n\n    CHECK(a == b);\n    CHECK(a <= b);\n    CHECK(a >= b);\n    CHECK_FALSE(a != b);\n    CHECK_FALSE(a < b);\n    CHECK_FALSE(a > b);\n  }\n\n  SECTION(\"42U vs 42\") {\n    a.set(42U);\n    b.set(42);\n\n    CHECK(a == b);\n    CHECK(a <= b);\n    CHECK(a >= b);\n    CHECK_FALSE(a != b);\n    CHECK_FALSE(a < b);\n    CHECK_FALSE(a > b);\n  }\n\n  SECTION(\"[1] vs [1]\") {\n    a.add(1);\n    b.add(1);\n\n    CHECK(a <= b);\n    CHECK(a == b);\n    CHECK(a >= b);\n    CHECK_FALSE(a != b);\n    CHECK_FALSE(a < b);\n    CHECK_FALSE(a > b);\n  }\n\n  SECTION(\"[1] vs [2]\") {\n    a.add(1);\n    b.add(2);\n\n    CHECK(a != b);\n    CHECK_FALSE(a < b);\n    CHECK_FALSE(a <= b);\n    CHECK_FALSE(a == b);\n    CHECK_FALSE(a > b);\n    CHECK_FALSE(a >= b);\n  }\n\n  SECTION(\"{x:1} vs {x:1}\") {\n    a[\"x\"] = 1;\n    b[\"x\"] = 1;\n\n    CHECK(a <= b);\n    CHECK(a == b);\n    CHECK(a >= b);\n    CHECK_FALSE(a != b);\n    CHECK_FALSE(a < b);\n    CHECK_FALSE(a > b);\n  }\n\n  SECTION(\"{x:1} vs {x:2}\") {\n    a[\"x\"] = 1;\n    b[\"x\"] = 2;\n\n    CHECK(a != b);\n    CHECK_FALSE(a < b);\n    CHECK_FALSE(a <= b);\n    CHECK_FALSE(a == b);\n    CHECK_FALSE(a > b);\n    CHECK_FALSE(a >= b);\n  }\n}\n"
  },
  {
    "path": "extras/tests/JsonVariant/converters.cpp",
    "content": "// ArduinoJson - https://arduinojson.org\n// Copyright © 2014-2025, Benoit BLANCHON\n// MIT License\n\n#include <ArduinoJson.h>\n#include <stdint.h>\n#include <catch.hpp>\n\nnamespace {\nstruct Date {\n  int day;\n  int month;\n  int year;\n};\n\nvoid convertToJson(const Date& src, JsonVariant dst) {\n  dst[\"day\"] = src.day;\n  dst[\"month\"] = src.month;\n  dst[\"year\"] = src.year;\n}\n\nvoid convertFromJson(JsonVariantConst src, Date& dst) {\n  dst.day = src[\"day\"];\n  dst.month = src[\"month\"];\n  dst.year = src[\"year\"];\n}\n\nbool canConvertFromJson(JsonVariantConst src, const Date&) {\n  return src[\"day\"].is<int>() && src[\"month\"].is<int>() &&\n         src[\"year\"].is<int>();\n}\n}  // namespace\n\nTEST_CASE(\"Custom converter with overloading\") {\n  JsonDocument doc;\n\n  SECTION(\"convert JSON to Date\") {\n    doc[\"date\"][\"day\"] = 2;\n    doc[\"date\"][\"month\"] = 3;\n    doc[\"date\"][\"year\"] = 2021;\n\n    Date date = doc[\"date\"];\n\n    REQUIRE(date.day == 2);\n    REQUIRE(date.month == 3);\n    REQUIRE(date.year == 2021);\n  }\n\n  SECTION(\"is<Date>() returns true\") {\n    doc[\"date\"][\"day\"] = 2;\n    doc[\"date\"][\"month\"] = 3;\n    doc[\"date\"][\"year\"] = 2021;\n\n    REQUIRE(doc[\"date\"].is<Date>());\n  }\n\n  SECTION(\"is<Date>() returns false\") {\n    doc[\"date\"][\"day\"] = 2;\n    doc[\"date\"][\"month\"] = 3;\n    doc[\"date\"][\"year\"] = \"2021\";\n\n    REQUIRE(doc[\"date\"].is<Date>() == false);\n  }\n\n  SECTION(\"convert Date to JSON\") {\n    Date date = {19, 3, 2021};\n    doc[\"date\"] = date;\n\n    REQUIRE(doc[\"date\"][\"day\"] == 19);\n    REQUIRE(doc[\"date\"][\"month\"] == 3);\n    REQUIRE(doc[\"date\"][\"year\"] == 2021);\n  }\n}\n\nclass Complex {\n public:\n  explicit Complex(double r, double i) : real_(r), imag_(i) {}\n\n  double real() const {\n    return real_;\n  }\n\n  double imag() const {\n    return imag_;\n  }\n\n private:\n  double real_, imag_;\n};\n\nnamespace ArduinoJson {\ntemplate <>\nstruct Converter<Complex> {\n  static void toJson(const Complex& src, JsonVariant dst) {\n    dst[\"real\"] = src.real();\n    dst[\"imag\"] = src.imag();\n  }\n\n  static Complex fromJson(JsonVariantConst src) {\n    return Complex(src[\"real\"], src[\"imag\"]);\n  }\n\n  static bool checkJson(JsonVariantConst src) {\n    return src[\"real\"].is<double>() && src[\"imag\"].is<double>();\n  }\n};\n}  // namespace ArduinoJson\n\nTEST_CASE(\"Custom converter with specialization\") {\n  JsonDocument doc;\n\n  SECTION(\"convert JSON to Complex\") {\n    doc[\"value\"][\"real\"] = 2;\n    doc[\"value\"][\"imag\"] = 3;\n\n    Complex value = doc[\"value\"];\n\n    REQUIRE(value.real() == 2);\n    REQUIRE(value.imag() == 3);\n  }\n\n  SECTION(\"is<Complex>() returns true\") {\n    doc[\"value\"][\"real\"] = 2;\n    doc[\"value\"][\"imag\"] = 3;\n\n    REQUIRE(doc[\"value\"].is<Complex>());\n  }\n\n  SECTION(\"is<Complex>() returns false\") {\n    doc[\"value\"][\"real\"] = 2;\n    doc[\"value\"][\"imag\"] = \"3\";\n\n    REQUIRE(doc[\"value\"].is<Complex>() == false);\n  }\n\n  SECTION(\"convert value to JSON\") {\n    doc[\"value\"] = Complex(19, 3);\n\n    REQUIRE(doc[\"value\"][\"real\"] == 19);\n    REQUIRE(doc[\"value\"][\"imag\"] == 3);\n  }\n}\n"
  },
  {
    "path": "extras/tests/JsonVariant/copy.cpp",
    "content": "// ArduinoJson - https://arduinojson.org\n// Copyright © 2014-2025, Benoit BLANCHON\n// MIT License\n\n#include <ArduinoJson.h>\n#include <catch.hpp>\n#include \"Allocators.hpp\"\n\n#include \"Literals.hpp\"\n\nTEST_CASE(\"JsonVariant::set(JsonVariant)\") {\n  KillswitchAllocator killswitch;\n  SpyingAllocator spyingAllocator(&killswitch);\n  JsonDocument doc1(&spyingAllocator);\n  JsonDocument doc2(&spyingAllocator);\n  JsonVariant var1 = doc1.to<JsonVariant>();\n  JsonVariant var2 = doc2.to<JsonVariant>();\n\n  SECTION(\"stores JsonArray by copy\") {\n    JsonArray arr = doc2.to<JsonArray>();\n    JsonObject obj = arr.add<JsonObject>();\n    obj[\"hello\"] = \"world\";\n\n    var1.set(arr);\n\n    arr[0] = 666;\n    REQUIRE(var1.as<std::string>() == \"[{\\\"hello\\\":\\\"world\\\"}]\");\n  }\n\n  SECTION(\"stores JsonObject by copy\") {\n    JsonObject obj = doc2.to<JsonObject>();\n    JsonArray arr = obj[\"value\"].to<JsonArray>();\n    arr.add(42);\n\n    var1.set(obj);\n\n    obj[\"value\"] = 666;\n    REQUIRE(var1.as<std::string>() == \"{\\\"value\\\":[42]}\");\n  }\n\n  SECTION(\"stores string literals by copy\") {\n    var1.set(\"hello!!\");\n    spyingAllocator.clearLog();\n\n    var2.set(var1);\n\n    REQUIRE(spyingAllocator.log() == AllocatorLog{\n                                         Allocate(sizeofString(\"hello!!\")),\n                                     });\n  }\n\n  SECTION(\"stores char* by copy\") {\n    char str[] = \"hello!!\";\n    var1.set(str);\n    spyingAllocator.clearLog();\n\n    var2.set(var1);\n\n    REQUIRE(spyingAllocator.log() == AllocatorLog{\n                                         Allocate(sizeofString(\"hello!!\")),\n                                     });\n  }\n\n  SECTION(\"fails gracefully if string allocation fails\") {\n    char str[] = \"hello!!\";\n    var1.set(str);\n    killswitch.on();\n    spyingAllocator.clearLog();\n\n    var2.set(var1);\n\n    REQUIRE(doc2.overflowed() == true);\n    REQUIRE(spyingAllocator.log() == AllocatorLog{\n                                         AllocateFail(sizeofString(\"hello!!\")),\n                                     });\n  }\n\n  SECTION(\"stores std::string by copy\") {\n    var1.set(\"hello!!\"_s);\n    spyingAllocator.clearLog();\n\n    var2.set(var1);\n\n    REQUIRE(spyingAllocator.log() == AllocatorLog{\n                                         Allocate(sizeofString(\"hello!!\")),\n                                     });\n  }\n\n  SECTION(\"stores Serialized<const char*> by copy\") {\n    var1.set(serialized(\"hello!!\", 7));\n    spyingAllocator.clearLog();\n\n    var2.set(var1);\n\n    REQUIRE(spyingAllocator.log() == AllocatorLog{\n                                         Allocate(sizeofString(\"hello!!\")),\n                                     });\n  }\n\n  SECTION(\"stores Serialized<char*> by copy\") {\n    char str[] = \"hello!!\";\n    var1.set(serialized(str, 7));\n    spyingAllocator.clearLog();\n\n    var2.set(var1);\n\n    REQUIRE(spyingAllocator.log() == AllocatorLog{\n                                         Allocate(sizeofString(\"hello!!\")),\n                                     });\n  }\n\n  SECTION(\"stores Serialized<std::string> by copy\") {\n    var1.set(serialized(\"hello!!\"_s));\n    spyingAllocator.clearLog();\n\n    var2.set(var1);\n\n    REQUIRE(spyingAllocator.log() == AllocatorLog{\n                                         Allocate(sizeofString(\"hello!!\")),\n                                     });\n  }\n\n  SECTION(\"fails gracefully if raw string allocation fails\") {\n    var1.set(serialized(\"hello!!\"_s));\n    killswitch.on();\n    spyingAllocator.clearLog();\n\n    var2.set(var1);\n\n    REQUIRE(doc2.overflowed() == true);\n    REQUIRE(spyingAllocator.log() == AllocatorLog{\n                                         AllocateFail(sizeofString(\"hello!!\")),\n                                     });\n  }\n\n  SECTION(\"destination is unbound\") {\n    JsonVariant unboundVariant;\n\n    unboundVariant.set(var1);\n\n    REQUIRE(unboundVariant.isUnbound());\n    REQUIRE(unboundVariant.isNull());\n  }\n}\n"
  },
  {
    "path": "extras/tests/JsonVariant/is.cpp",
    "content": "// ArduinoJson - https://arduinojson.org\n// Copyright © 2014-2025, Benoit BLANCHON\n// MIT License\n\n#include <ArduinoJson.h>\n#include <catch.hpp>\n\nenum MYENUM2 { ONE = 1, TWO = 2 };\n\nTEST_CASE(\"JsonVariant::is<T>()\") {\n  JsonDocument doc;\n  JsonVariant variant = doc.to<JsonVariant>();\n\n  SECTION(\"unbound\") {\n    variant = JsonVariant();\n\n    CHECK(variant.is<JsonObject>() == false);\n    CHECK(variant.is<JsonArray>() == false);\n    CHECK(variant.is<JsonVariant>() == false);\n    CHECK(variant.is<JsonVariantConst>() == false);\n    CHECK(variant.is<bool>() == false);\n    CHECK(variant.is<const char*>() == false);\n    CHECK(variant.is<int>() == false);\n    CHECK(variant.is<std::string>() == false);\n    CHECK(variant.is<JsonString>() == false);\n    CHECK(variant.is<float>() == false);\n    CHECK(variant.is<MYENUM2>() == false);\n    CHECK(variant.is<JsonString>() == false);\n  }\n\n  SECTION(\"null\") {\n    CHECK(variant.is<JsonVariant>() == true);\n    CHECK(variant.is<JsonVariantConst>() == true);\n    CHECK(variant.is<JsonObject>() == false);\n    CHECK(variant.is<JsonArray>() == false);\n    CHECK(variant.is<bool>() == false);\n    CHECK(variant.is<const char*>() == false);\n    CHECK(variant.is<int>() == false);\n    CHECK(variant.is<std::string>() == false);\n    CHECK(variant.is<JsonString>() == false);\n    CHECK(variant.is<float>() == false);\n    CHECK(variant.is<MYENUM2>() == false);\n  }\n\n  SECTION(\"true\") {\n    variant.set(true);\n\n    CHECK(variant.is<bool>() == true);\n    CHECK(variant.is<JsonVariant>() == true);\n    CHECK(variant.is<JsonVariantConst>() == true);\n    CHECK(variant.is<JsonObject>() == false);\n    CHECK(variant.is<JsonArray>() == false);\n    CHECK(variant.is<const char*>() == false);\n    CHECK(variant.is<int>() == false);\n    CHECK(variant.is<std::string>() == false);\n    CHECK(variant.is<JsonString>() == false);\n    CHECK(variant.is<float>() == false);\n    CHECK(variant.is<MYENUM2>() == false);\n  }\n\n  SECTION(\"false\") {\n    variant.set(false);\n\n    CHECK(variant.is<bool>() == true);\n    CHECK(variant.is<JsonVariant>() == true);\n    CHECK(variant.is<JsonVariantConst>() == true);\n    CHECK(variant.is<JsonObject>() == false);\n    CHECK(variant.is<JsonArray>() == false);\n    CHECK(variant.is<const char*>() == false);\n    CHECK(variant.is<int>() == false);\n    CHECK(variant.is<std::string>() == false);\n    CHECK(variant.is<JsonString>() == false);\n    CHECK(variant.is<float>() == false);\n    CHECK(variant.is<MYENUM2>() == false);\n  }\n\n  SECTION(\"int\") {\n    variant.set(42);\n\n    CHECK(variant.is<int>() == true);\n    CHECK(variant.is<short>() == true);\n    CHECK(variant.is<long>() == true);\n    CHECK(variant.is<double>() == true);\n    CHECK(variant.is<float>() == true);\n    CHECK(variant.is<MYENUM2>() == true);\n    CHECK(variant.is<JsonVariant>() == true);\n    CHECK(variant.is<JsonVariantConst>() == true);\n    CHECK(variant.is<bool>() == false);\n    CHECK(variant.is<JsonObject>() == false);\n    CHECK(variant.is<JsonArray>() == false);\n    CHECK(variant.is<const char*>() == false);\n    CHECK(variant.is<std::string>() == false);\n    CHECK(variant.is<JsonString>() == false);\n  }\n\n  SECTION(\"double\") {\n    variant.set(4.2);\n\n    CHECK(variant.is<double>() == true);\n    CHECK(variant.is<float>() == true);\n    CHECK(variant.is<JsonVariant>() == true);\n    CHECK(variant.is<JsonVariantConst>() == true);\n    CHECK(variant.is<bool>() == false);\n    CHECK(variant.is<JsonObject>() == false);\n    CHECK(variant.is<JsonArray>() == false);\n    CHECK(variant.is<const char*>() == false);\n    CHECK(variant.is<int>() == false);\n    CHECK(variant.is<std::string>() == false);\n    CHECK(variant.is<JsonString>() == false);\n    CHECK(variant.is<MYENUM2>() == false);\n  }\n\n  SECTION(\"const char*\") {\n    variant.set(\"4.2\");\n\n    CHECK(variant.is<const char*>() == true);\n    CHECK(variant.is<const char*>() == true);\n    CHECK(variant.is<std::string>() == true);\n    CHECK(variant.is<JsonString>() == true);\n    CHECK(variant.is<JsonVariant>() == true);\n    CHECK(variant.is<JsonVariantConst>() == true);\n    CHECK(variant.is<double>() == false);\n    CHECK(variant.is<float>() == false);\n    CHECK(variant.is<bool>() == false);\n    CHECK(variant.is<JsonObject>() == false);\n    CHECK(variant.is<JsonArray>() == false);\n    CHECK(variant.is<int>() == false);\n    CHECK(variant.is<MYENUM2>() == false);\n  }\n\n  SECTION(\"JsonArray\") {\n    variant.to<JsonArray>();\n\n    CHECK(variant.is<JsonArray>() == true);\n    CHECK(variant.is<JsonArrayConst>() == true);\n    CHECK(variant.is<JsonVariant>() == true);\n    CHECK(variant.is<JsonVariantConst>() == true);\n    CHECK(variant.is<JsonObject>() == false);\n    CHECK(variant.is<JsonObjectConst>() == false);\n    CHECK(variant.is<int>() == false);\n    CHECK(variant.is<float>() == false);\n    CHECK(variant.is<bool>() == false);\n    CHECK(variant.is<const char*>() == false);\n    CHECK(variant.is<MYENUM2>() == false);\n  }\n\n  SECTION(\"JsonObject\") {\n    variant.to<JsonObject>();\n\n    CHECK(variant.is<JsonObject>() == true);\n    CHECK(variant.is<JsonObjectConst>() == true);\n    CHECK(variant.is<JsonVariant>() == true);\n    CHECK(variant.is<JsonVariantConst>() == true);\n    CHECK(variant.is<JsonArray>() == false);\n    CHECK(variant.is<JsonArrayConst>() == false);\n    CHECK(variant.is<int>() == false);\n    CHECK(variant.is<float>() == false);\n    CHECK(variant.is<bool>() == false);\n    CHECK(variant.is<const char*>() == false);\n    CHECK(variant.is<MYENUM2>() == false);\n    CHECK(variant.is<JsonVariant>() == true);\n    CHECK(variant.is<JsonVariantConst>() == true);\n  }\n}\n"
  },
  {
    "path": "extras/tests/JsonVariant/isnull.cpp",
    "content": "// ArduinoJson - https://arduinojson.org\n// Copyright © 2014-2025, Benoit BLANCHON\n// MIT License\n\n#include <ArduinoJson.h>\n#include <catch.hpp>\n\nTEST_CASE(\"JsonVariant::isNull()\") {\n  JsonDocument doc;\n  JsonVariant variant = doc.to<JsonVariant>();\n\n  SECTION(\"returns true when Undefined\") {\n    REQUIRE(variant.isNull() == true);\n  }\n\n  SECTION(\"returns false when Integer\") {\n    variant.set(42);\n\n    REQUIRE(variant.isNull() == false);\n  }\n\n  SECTION(\"returns false when EmptyArray\") {\n    JsonDocument doc2;\n    JsonArray array = doc2.to<JsonArray>();\n\n    variant.set(array);\n    REQUIRE(variant.isNull() == false);\n  }\n\n  SECTION(\"returns false when EmptyObject\") {\n    JsonDocument doc2;\n    JsonObject obj = doc2.to<JsonObject>();\n\n    variant.set(obj);\n    REQUIRE(variant.isNull() == false);\n  }\n\n  SECTION(\"returns true after set(JsonArray())\") {\n    variant.set(JsonArray());\n    REQUIRE(variant.isNull() == true);\n  }\n\n  SECTION(\"returns true after set(JsonObject())\") {\n    variant.set(JsonObject());\n    REQUIRE(variant.isNull() == true);\n  }\n\n  SECTION(\"returns false after set('hello')\") {\n    variant.set(\"hello\");\n    REQUIRE(variant.isNull() == false);\n  }\n\n  SECTION(\"returns true after set((char*)0)\") {\n    variant.set(static_cast<char*>(0));\n    REQUIRE(variant.isNull() == true);\n  }\n\n  SECTION(\"returns true after set((const char*)0)\") {\n    variant.set(static_cast<const char*>(0));\n    REQUIRE(variant.isNull() == true);\n  }\n\n  SECTION(\"returns true after set(serialized((char*)0))\") {\n    variant.set(serialized(static_cast<char*>(0)));\n    REQUIRE(variant.isNull() == true);\n  }\n\n  SECTION(\"returns true after set(serialized((const char*)0))\") {\n    variant.set(serialized(static_cast<const char*>(0)));\n    REQUIRE(variant.isNull() == true);\n  }\n}\n"
  },
  {
    "path": "extras/tests/JsonVariant/misc.cpp",
    "content": "// ArduinoJson - https://arduinojson.org\n// Copyright © 2014-2025, Benoit BLANCHON\n// MIT License\n\n#include <ArduinoJson.h>\n#include <catch.hpp>\n\nTEST_CASE(\"VariantData\") {\n  REQUIRE(std::is_standard_layout<ArduinoJson::detail::VariantData>::value ==\n          true);\n}\n\nTEST_CASE(\"StringNode\") {\n  REQUIRE(std::is_standard_layout<ArduinoJson::detail::StringNode>::value ==\n          true);\n}\n\nTEST_CASE(\"JsonVariant from JsonArray\") {\n  SECTION(\"JsonArray is null\") {\n    JsonArray arr;\n    JsonVariant v = arr;\n    REQUIRE(v.isNull() == true);\n  }\n\n  SECTION(\"JsonArray is not null\") {\n    JsonDocument doc;\n    JsonArray arr = doc.to<JsonArray>();\n    arr.add(12);\n    arr.add(34);\n\n    JsonVariant v = arr;\n\n    REQUIRE(v.is<JsonArray>() == true);\n    REQUIRE(v.size() == 2);\n    REQUIRE(v[0] == 12);\n    REQUIRE(v[1] == 34);\n  }\n}\n\nTEST_CASE(\"JsonVariant from JsonObject\") {\n  SECTION(\"JsonObject is null\") {\n    JsonObject obj;\n    JsonVariant v = obj;\n    REQUIRE(v.isNull() == true);\n  }\n\n  SECTION(\"JsonObject is not null\") {\n    JsonDocument doc;\n    JsonObject obj = doc.to<JsonObject>();\n    obj[\"a\"] = 12;\n    obj[\"b\"] = 34;\n\n    JsonVariant v = obj;\n\n    REQUIRE(v.is<JsonObject>() == true);\n    REQUIRE(v.size() == 2);\n    REQUIRE(v[\"a\"] == 12);\n    REQUIRE(v[\"b\"] == 34);\n  }\n}\n"
  },
  {
    "path": "extras/tests/JsonVariant/nesting.cpp",
    "content": "// ArduinoJson - https://arduinojson.org\n// Copyright © 2014-2025, Benoit BLANCHON\n// MIT License\n\n#include <ArduinoJson.h>\n#include <catch.hpp>\n\nTEST_CASE(\"JsonVariant::nesting()\") {\n  JsonDocument doc;\n  JsonVariant var = doc.to<JsonVariant>();\n\n  SECTION(\"return 0 if uninitialized\") {\n    JsonVariant unitialized;\n    REQUIRE(unitialized.nesting() == 0);\n  }\n\n  SECTION(\"returns 0 for string\") {\n    var.set(\"hello\");\n    REQUIRE(var.nesting() == 0);\n  }\n\n  SECTION(\"returns 1 for empty object\") {\n    var.to<JsonObject>();\n    REQUIRE(var.nesting() == 1);\n  }\n\n  SECTION(\"returns 1 for empty array\") {\n    var.to<JsonArray>();\n    REQUIRE(var.nesting() == 1);\n  }\n}\n"
  },
  {
    "path": "extras/tests/JsonVariant/nullptr.cpp",
    "content": "#include <ArduinoJson.h>\n\n#include <catch.hpp>\n\nTEST_CASE(\"nullptr\") {\n  JsonDocument doc;\n  JsonVariant variant = doc.to<JsonVariant>();\n\n  SECTION(\"JsonVariant == nullptr\") {\n    REQUIRE(variant == nullptr);\n    REQUIRE_FALSE(variant != nullptr);\n  }\n\n  SECTION(\"JsonVariant != nullptr\") {\n    variant.set(42);\n\n    REQUIRE_FALSE(variant == nullptr);\n    REQUIRE(variant != nullptr);\n  }\n\n  SECTION(\"JsonVariant.set(nullptr)\") {\n    variant.set(42);\n    variant.set(nullptr);\n\n    REQUIRE(variant.isNull());\n  }\n\n  SECTION(\"JsonVariant.set(nullptr) with unbound reference\") {\n    JsonVariant unboundReference;\n\n    unboundReference.set(nullptr);\n\n    REQUIRE(variant.isNull());\n  }\n\n  SECTION(\"JsonVariant.is<nullptr_t>()\") {\n    variant.set(42);\n    REQUIRE(variant.is<std::nullptr_t>() == false);\n\n    variant.clear();\n    REQUIRE(variant.is<std::nullptr_t>() == true);\n  }\n}\n"
  },
  {
    "path": "extras/tests/JsonVariant/or.cpp",
    "content": "// ArduinoJson - https://arduinojson.org\n// Copyright © 2014-2025, Benoit BLANCHON\n// MIT License\n\n#include <ArduinoJson.h>\n#include <catch.hpp>\n\nTEST_CASE(\"JsonVariant::operator|()\") {\n  JsonDocument doc;\n  JsonVariant variant = doc[\"value\"].to<JsonVariant>();\n\n  SECTION(\"null\") {\n    SECTION(\"null | const char*\") {\n      std::string result = variant | \"default\";\n      REQUIRE(result == \"default\");\n    }\n\n    SECTION(\"null | int\") {\n      int result = variant | 42;\n      REQUIRE(result == 42);\n    }\n\n    SECTION(\"null | bool\") {\n      bool result = variant | true;\n      REQUIRE(result == true);\n    }\n\n    SECTION(\"null | ElementProxy\") {\n      doc[\"array\"][0] = 42;\n\n      JsonVariantConst result = variant | doc[\"array\"][0];\n      REQUIRE(result == 42);\n    }\n\n    SECTION(\"null | MemberProxy\") {\n      doc[\"other\"] = 42;\n\n      JsonVariantConst result = variant | doc[\"other\"];\n      REQUIRE(result == 42);\n    }\n\n    SECTION(\"ElementProxy | ElementProxy\") {\n      doc[\"array\"][0] = 42;\n\n      JsonVariantConst result = doc[\"array\"][1] | doc[\"array\"][0];\n      REQUIRE(result == 42);\n    }\n  }\n\n  SECTION(\"null\") {\n    variant.set(static_cast<const char*>(0));\n\n    SECTION(\"null | const char*\") {\n      std::string result = variant | \"default\";\n      REQUIRE(result == \"default\");\n    }\n\n    SECTION(\"null | int\") {\n      int result = variant | 42;\n      REQUIRE(result == 42);\n    }\n\n    SECTION(\"null | bool\") {\n      bool result = variant | true;\n      REQUIRE(result == true);\n    }\n\n    SECTION(\"null | ElementProxy\") {\n      doc[\"array\"][0] = 42;\n\n      JsonVariantConst result = variant | doc[\"array\"][0];\n      REQUIRE(result == 42);\n    }\n\n    SECTION(\"null | MemberProxy\") {\n      doc[\"other\"] = 42;\n\n      JsonVariantConst result = variant | doc[\"other\"];\n      REQUIRE(result == 42);\n    }\n  }\n\n  SECTION(\"int | const char*\") {\n    variant.set(42);\n    std::string result = variant | \"default\";\n    REQUIRE(result == \"default\");\n  }\n\n  SECTION(\"int | uint8_t (out of range)\") {\n    variant.set(666);\n    uint8_t result = variant | static_cast<uint8_t>(42);\n    REQUIRE(result == 42);\n  }\n\n  SECTION(\"int | ElementProxy\") {\n    variant.set(42);\n    doc[\"array\"][0] = 666;\n    JsonVariantConst result = variant | doc[\"array\"][0];\n    REQUIRE(result == 42);\n  }\n\n  SECTION(\"int | MemberProxy\") {\n    variant.set(42);\n    doc[\"other\"] = 666;\n    JsonVariantConst result = variant | doc[\"other\"];\n    REQUIRE(result == 42);\n  }\n\n  SECTION(\"int | int\") {\n    variant.set(0);\n    int result = variant | 666;\n    REQUIRE(result == 0);\n  }\n\n  SECTION(\"double | int\") {\n    // NOTE: changed the behavior to fix #981\n    variant.set(666.0);\n    int result = variant | 42;\n    REQUIRE(result == 42);\n  }\n\n  SECTION(\"bool | bool\") {\n    variant.set(false);\n    bool result = variant | true;\n    REQUIRE(result == false);\n  }\n\n  SECTION(\"int | bool\") {\n    variant.set(0);\n    bool result = variant | true;\n    REQUIRE(result == true);\n  }\n\n  SECTION(\"const char* | const char*\") {\n    variant.set(\"not default\");\n    std::string result = variant | \"default\";\n    REQUIRE(result == \"not default\");\n  }\n\n  SECTION(\"const char* | char*\") {\n    char dflt[] = \"default\";\n    variant.set(\"not default\");\n    std::string result = variant | dflt;\n    REQUIRE(result == \"not default\");\n  }\n\n  SECTION(\"int | char*\") {\n    char dflt[] = \"default\";\n    variant.set(42);\n    std::string result = variant | dflt;\n    REQUIRE(result == \"default\");\n  }\n\n  SECTION(\"const char* | int\") {\n    variant.set(\"not default\");\n    int result = variant | 42;\n    REQUIRE(result == 42);\n  }\n}\n"
  },
  {
    "path": "extras/tests/JsonVariant/overflow.cpp",
    "content": "// ArduinoJson - https://arduinojson.org\n// Copyright © 2014-2025, Benoit BLANCHON\n// MIT License\n\n#include <ArduinoJson.h>\n#include <catch.hpp>\n\ntemplate <typename TOut, typename TIn>\nvoid shouldBeOk(TIn value) {\n  JsonDocument doc;\n  JsonVariant var = doc.to<JsonVariant>();\n  var.set(value);\n  REQUIRE(var.as<TOut>() == TOut(value));\n}\n\ntemplate <typename TOut, typename TIn>\nvoid shouldOverflow(TIn value) {\n  JsonDocument doc;\n  JsonVariant var = doc.to<JsonVariant>();\n  var.set(value);\n  REQUIRE(var.as<TOut>() == 0);\n  REQUIRE(var.is<TOut>() == false);\n}\n\nTEST_CASE(\"Handle integer overflow in stored integer\") {\n  SECTION(\"int8_t\") {\n    // ok\n    shouldBeOk<int8_t>(-128);\n    shouldBeOk<int8_t>(42.0);\n    shouldBeOk<int8_t>(127);\n\n    // too low\n    shouldOverflow<int8_t>(-128.1);\n    shouldOverflow<int8_t>(-129);\n\n    // too high\n    shouldOverflow<int8_t>(128);\n    shouldOverflow<int8_t>(127.1);\n  }\n\n  SECTION(\"int16_t\") {\n    // ok\n    shouldBeOk<int16_t>(-32768);\n    shouldBeOk<int16_t>(-32767.9);\n    shouldBeOk<int16_t>(32766.9);\n    shouldBeOk<int16_t>(32767);\n\n    // too low\n    shouldOverflow<int16_t>(-32768.1);\n    shouldOverflow<int16_t>(-32769);\n\n    // too high\n    shouldOverflow<int16_t>(32767.1);\n    shouldOverflow<int16_t>(32768);\n  }\n\n  SECTION(\"uint8_t\") {\n    // ok\n    shouldBeOk<uint8_t>(1);\n    shouldBeOk<uint8_t>(42.0);\n    shouldBeOk<uint8_t>(255);\n\n    // too low\n    shouldOverflow<uint8_t>(-1);\n    shouldOverflow<uint8_t>(-0.1);\n\n    // to high\n    shouldOverflow<uint8_t>(255.1);\n    shouldOverflow<uint8_t>(256);\n    shouldOverflow<uint8_t>(257);\n  }\n}\n"
  },
  {
    "path": "extras/tests/JsonVariant/remove.cpp",
    "content": "// ArduinoJson - https://arduinojson.org\n// Copyright © 2014-2025, Benoit BLANCHON\n// MIT License\n\n#include <ArduinoJson.h>\n#include <stdint.h>\n#include <catch.hpp>\n\n#include \"Allocators.hpp\"\n#include \"Literals.hpp\"\n\nusing ArduinoJson::detail::sizeofArray;\n\nTEST_CASE(\"JsonVariant::remove(int)\") {\n  SpyingAllocator spy;\n  JsonDocument doc(&spy);\n\n  SECTION(\"release top level strings\") {\n    doc.add(\"hello\"_s);\n    doc.add(\"hello\"_s);\n    doc.add(\"world\"_s);\n\n    JsonVariant var = doc.as<JsonVariant>();\n    REQUIRE(var.as<std::string>() == \"[\\\"hello\\\",\\\"hello\\\",\\\"world\\\"]\");\n\n    spy.clearLog();\n    var.remove(1);\n    REQUIRE(var.as<std::string>() == \"[\\\"hello\\\",\\\"world\\\"]\");\n    REQUIRE(spy.log() == AllocatorLog{});\n\n    spy.clearLog();\n    var.remove(1);\n    REQUIRE(var.as<std::string>() == \"[\\\"hello\\\"]\");\n    REQUIRE(spy.log() == AllocatorLog{\n                             Deallocate(sizeofString(\"world\")),\n                         });\n\n    spy.clearLog();\n    var.remove(0);\n    REQUIRE(var.as<std::string>() == \"[]\");\n    REQUIRE(spy.log() == AllocatorLog{\n                             Deallocate(sizeofString(\"hello\")),\n                         });\n  }\n\n  SECTION(\"release strings in nested array\") {\n    doc[0][0] = \"hello\"_s;\n\n    JsonVariant var = doc.as<JsonVariant>();\n    REQUIRE(var.as<std::string>() == \"[[\\\"hello\\\"]]\");\n\n    spy.clearLog();\n    var.remove(0);\n\n    REQUIRE(var.as<std::string>() == \"[]\");\n    REQUIRE(spy.log() == AllocatorLog{\n                             Deallocate(sizeofString(\"hello\")),\n                         });\n  }\n}\n\nTEST_CASE(\"JsonVariant::remove(const char *)\") {\n  JsonDocument doc;\n  JsonVariant var = doc.to<JsonVariant>();\n\n  var[\"a\"] = 1;\n  var[\"b\"] = 2;\n\n  var.remove(\"a\");\n\n  REQUIRE(var.as<std::string>() == \"{\\\"b\\\":2}\");\n}\n\nTEST_CASE(\"JsonVariant::remove(std::string)\") {\n  JsonDocument doc;\n  JsonVariant var = doc.to<JsonVariant>();\n\n  var[\"a\"] = 1;\n  var[\"b\"] = 2;\n\n  var.remove(\"b\"_s);\n\n  REQUIRE(var.as<std::string>() == \"{\\\"a\\\":1}\");\n}\n\n#ifdef HAS_VARIABLE_LENGTH_ARRAY\nTEST_CASE(\"JsonVariant::remove(VLA)\") {\n  JsonDocument doc;\n  JsonVariant var = doc.to<JsonVariant>();\n\n  var[\"a\"] = 1;\n  var[\"b\"] = 2;\n  size_t i = 16;\n  char vla[i];\n  strcpy(vla, \"b\");\n\n  var.remove(\"b\"_s);\n\n  REQUIRE(var.as<std::string>() == \"{\\\"a\\\":1}\");\n}\n#endif\n\nTEST_CASE(\"JsonVariant::remove(JsonVariant) from object\") {\n  JsonDocument doc;\n  JsonVariant var = doc.to<JsonVariant>();\n\n  var[\"a\"] = \"a\";\n  var[\"b\"] = 2;\n  var[\"c\"] = \"b\";\n\n  var.remove(var[\"c\"]);\n\n  REQUIRE(var.as<std::string>() == \"{\\\"a\\\":\\\"a\\\",\\\"c\\\":\\\"b\\\"}\");\n}\n\nTEST_CASE(\"JsonVariant::remove(JsonVariant) from array\") {\n  JsonDocument doc;\n  JsonVariant var = doc.to<JsonVariant>();\n\n  var[0] = 3;\n  var[1] = 2;\n  var[2] = 1;\n\n  var.remove(var[2]);\n  var.remove(var[3]);  // noop\n\n  REQUIRE(var.as<std::string>() == \"[3,1]\");\n}\n"
  },
  {
    "path": "extras/tests/JsonVariant/set.cpp",
    "content": "// ArduinoJson - https://arduinojson.org\n// Copyright © 2014-2025, Benoit BLANCHON\n// MIT License\n\n#include <ArduinoJson.h>\n#include <catch.hpp>\n\n#include \"Allocators.hpp\"\n#include \"Literals.hpp\"\n\nusing namespace ArduinoJson::detail;\n\nenum ErrorCode { ERROR_01 = 1, ERROR_10 = 10 };\n\nTEST_CASE(\"JsonVariant::set() when there is enough memory\") {\n  SpyingAllocator spy;\n  JsonDocument doc(&spy);\n  JsonVariant variant = doc.to<JsonVariant>();\n\n  SECTION(\"string literal\") {\n    bool result = variant.set(\"hello world\");\n\n    REQUIRE(result == true);\n    REQUIRE(variant == \"hello world\"_s);  // stores by copy\n    REQUIRE(spy.log() == AllocatorLog{\n                             Allocate(sizeofString(11)),\n                         });\n  }\n\n  SECTION(\"const char*\") {\n    char str[16];\n\n    strcpy(str, \"hello\");\n    bool result = variant.set(static_cast<const char*>(str));\n    strcpy(str, \"world\");\n\n    REQUIRE(result == true);\n    REQUIRE(variant == \"hello\");  // stores by copy\n    REQUIRE(spy.log() == AllocatorLog{\n                             Allocate(sizeofString(\"hello\")),\n                         });\n  }\n\n  SECTION(\"(const char*)0\") {\n    bool result = variant.set(static_cast<const char*>(0));\n\n    REQUIRE(result == true);\n    REQUIRE(variant.isNull());\n    REQUIRE(variant.as<const char*>() == nullptr);\n    REQUIRE(spy.log() == AllocatorLog{});\n  }\n\n  SECTION(\"char*\") {\n    char str[16];\n\n    strcpy(str, \"hello\");\n    bool result = variant.set(str);\n    strcpy(str, \"world\");\n\n    REQUIRE(result == true);\n    REQUIRE(variant == \"hello\");  // stores by copy\n    REQUIRE(spy.log() == AllocatorLog{\n                             Allocate(sizeofString(\"hello\")),\n                         });\n  }\n\n  SECTION(\"char* (tiny string optimization)\") {\n    char str[16];\n\n    strcpy(str, \"abc\");\n    bool result = variant.set(str);\n    strcpy(str, \"def\");\n\n    REQUIRE(result == true);\n    REQUIRE(variant == \"abc\");  // stores by copy\n    REQUIRE(spy.log() == AllocatorLog{});\n  }\n\n  SECTION(\"(char*)0\") {\n    bool result = variant.set(static_cast<char*>(0));\n\n    REQUIRE(result == true);\n    REQUIRE(variant.isNull());\n    REQUIRE(spy.log() == AllocatorLog{});\n  }\n\n  SECTION(\"unsigned char*\") {\n    char str[16];\n\n    strcpy(str, \"hello\");\n    bool result = variant.set(reinterpret_cast<unsigned char*>(str));\n    strcpy(str, \"world\");\n\n    REQUIRE(result == true);\n    REQUIRE(variant == \"hello\");  // stores by copy\n    REQUIRE(spy.log() == AllocatorLog{\n                             Allocate(sizeofString(\"hello\")),\n                         });\n  }\n\n  SECTION(\"signed char*\") {\n    char str[16];\n\n    strcpy(str, \"hello\");\n    bool result = variant.set(reinterpret_cast<signed char*>(str));\n    strcpy(str, \"world\");\n\n    REQUIRE(result == true);\n    REQUIRE(variant == \"hello\");  // stores by copy\n    REQUIRE(spy.log() == AllocatorLog{\n                             Allocate(sizeofString(\"hello\")),\n                         });\n  }\n\n#ifdef HAS_VARIABLE_LENGTH_ARRAY\n  SECTION(\"VLA\") {\n    size_t n = 16;\n    char str[n];\n\n    strcpy(str, \"hello\");\n    bool result = variant.set(str);\n    strcpy(str, \"world\");\n\n    REQUIRE(result == true);\n    REQUIRE(variant == \"hello\");  // stores by copy\n    REQUIRE(spy.log() == AllocatorLog{\n                             Allocate(sizeofString(\"hello\")),\n                         });\n  }\n#endif\n\n  SECTION(\"std::string\") {\n    std::string str = \"hello\\0world\"_s;\n    bool result = variant.set(str);\n    str.replace(0, 5, \"world\");\n\n    REQUIRE(result == true);\n    REQUIRE(variant == \"hello\\0world\"_s);  // stores by copy\n    REQUIRE(spy.log() == AllocatorLog{\n                             Allocate(sizeofString(\"hello?world\")),\n                         });\n  }\n\n  SECTION(\"JsonString\") {\n    char str[16];\n\n    strcpy(str, \"hello\");\n    bool result = variant.set(JsonString(str));\n    strcpy(str, \"world\");\n\n    REQUIRE(result == true);\n    REQUIRE(variant == \"hello\");  // stores by copy\n    REQUIRE(spy.log() == AllocatorLog{\n                             Allocate(sizeofString(\"hello\")),\n                         });\n  }\n\n  SECTION(\"enum\") {\n    ErrorCode code = ERROR_10;\n\n    bool result = variant.set(code);\n\n    REQUIRE(result == true);\n    REQUIRE(variant.is<int>() == true);\n    REQUIRE(variant.as<int>() == 10);\n    REQUIRE(spy.log() == AllocatorLog{});\n  }\n\n  SECTION(\"float\") {\n    bool result = variant.set(1.2f);\n\n    REQUIRE(result == true);\n    REQUIRE(variant.is<float>() == true);\n    REQUIRE(variant.as<float>() == 1.2f);\n    REQUIRE(spy.log() == AllocatorLog{});\n  }\n\n  SECTION(\"double\") {\n    bool result = variant.set(1.2);\n    doc.shrinkToFit();\n\n    REQUIRE(result == true);\n    REQUIRE(variant.is<double>() == true);\n    REQUIRE(variant.as<double>() == 1.2);\n    REQUIRE(spy.log() == AllocatorLog{\n                             Allocate(sizeofPool<EightByteValue>()),\n                             Reallocate(sizeofPool<EightByteValue>(),\n                                        sizeofPool<EightByteValue>(1)),\n                         });\n  }\n\n  SECTION(\"int32_t\") {\n    bool result = variant.set(int32_t(42));\n\n    REQUIRE(result == true);\n    REQUIRE(variant.is<int32_t>() == true);\n    REQUIRE(variant.as<int32_t>() == 42);\n    REQUIRE(spy.log() == AllocatorLog{});\n  }\n\n  SECTION(\"int64_t\") {\n    bool result = variant.set(int64_t(-2147483649LL));\n    doc.shrinkToFit();\n\n    REQUIRE(result == true);\n    REQUIRE(variant.is<int64_t>() == true);\n    REQUIRE(variant.as<int64_t>() == -2147483649LL);\n    REQUIRE(spy.log() == AllocatorLog{\n                             Allocate(sizeofPool<EightByteValue>()),\n                             Reallocate(sizeofPool<EightByteValue>(),\n                                        sizeofPool<EightByteValue>(1)),\n                         });\n  }\n\n  SECTION(\"uint32_t\") {\n    bool result = variant.set(uint32_t(42));\n\n    REQUIRE(result == true);\n    REQUIRE(variant.is<uint32_t>() == true);\n    REQUIRE(variant.as<uint32_t>() == 42);\n    REQUIRE(spy.log() == AllocatorLog{});\n  }\n\n  SECTION(\"uint64_t\") {\n    bool result = variant.set(uint64_t(4294967296));\n    doc.shrinkToFit();\n\n    REQUIRE(result == true);\n    REQUIRE(variant.is<uint64_t>() == true);\n    REQUIRE(variant.as<uint64_t>() == 4294967296);\n    REQUIRE(spy.log() == AllocatorLog{\n                             Allocate(sizeofPool<EightByteValue>()),\n                             Reallocate(sizeofPool<EightByteValue>(),\n                                        sizeofPool<EightByteValue>(1)),\n                         });\n  }\n\n  SECTION(\"JsonDocument\") {\n    JsonDocument doc1;\n    doc1[\"hello\"] = \"world\";\n\n    // Should copy the doc\n    variant.set(doc1);\n    doc1.clear();\n\n    std::string json;\n    serializeJson(doc, json);\n    REQUIRE(json == \"{\\\"hello\\\":\\\"world\\\"}\");\n  }\n}\n\nTEST_CASE(\"JsonVariant::set() with not enough memory\") {\n  JsonDocument doc(FailingAllocator::instance());\n\n  JsonVariant v = doc.to<JsonVariant>();\n\n  SECTION(\"std::string\") {\n    bool result = v.set(\"hello world!!\"_s);\n\n    REQUIRE(result == false);\n    REQUIRE(v.isNull());\n  }\n\n  SECTION(\"Serialized<std::string>\") {\n    bool result = v.set(serialized(\"hello world!!\"_s));\n\n    REQUIRE(result == false);\n    REQUIRE(v.isNull());\n  }\n\n  SECTION(\"char*\") {\n    char s[] = \"hello world!!\";\n    bool result = v.set(s);\n\n    REQUIRE(result == false);\n    REQUIRE(v.isNull());\n  }\n\n  SECTION(\"float\") {\n    bool result = v.set(1.2f);\n\n    REQUIRE(result == true);\n    REQUIRE(v.is<float>());\n  }\n\n  SECTION(\"double\") {\n    bool result = v.set(1.2);\n\n    REQUIRE(result == false);\n    REQUIRE(v.isNull());\n  }\n\n  SECTION(\"int32_t\") {\n    bool result = v.set(-42);\n\n    REQUIRE(result == true);\n    REQUIRE(v.is<int32_t>());\n  }\n\n  SECTION(\"int64_t\") {\n    bool result = v.set(-2147483649LL);\n\n    REQUIRE(result == false);\n    REQUIRE(v.isNull());\n  }\n\n  SECTION(\"uint32_t\") {\n    bool result = v.set(42);\n\n    REQUIRE(result == true);\n    REQUIRE(v.is<uint32_t>());\n  }\n\n  SECTION(\"uint64_t\") {\n    bool result = v.set(4294967296U);\n\n    REQUIRE(result == false);\n    REQUIRE(v.isNull());\n  }\n}\n\nTEST_CASE(\"JsonVariant::set() releases the previous value\") {\n  SpyingAllocator spy;\n  JsonDocument doc(&spy);\n  doc[\"hello\"] = \"world\"_s;\n  spy.clearLog();\n\n  JsonVariant v = doc[\"hello\"];\n\n  SECTION(\"int\") {\n    v.set(42);\n    REQUIRE(spy.log() == AllocatorLog{\n                             Deallocate(sizeofString(\"world\")),\n                         });\n  }\n\n  SECTION(\"bool\") {\n    v.set(false);\n    REQUIRE(spy.log() == AllocatorLog{\n                             Deallocate(sizeofString(\"world\")),\n                         });\n  }\n\n  SECTION(\"const char*\") {\n    v.set(\"hello\");\n    REQUIRE(spy.log() == AllocatorLog{\n                             Deallocate(sizeofString(\"world\")),\n                         });\n  }\n\n  SECTION(\"float\") {\n    v.set(1.2f);\n    REQUIRE(spy.log() == AllocatorLog{\n                             Deallocate(sizeofString(\"world\")),\n                         });\n  }\n\n  SECTION(\"Serialized<const char*>\") {\n    v.set(serialized(\"[]\"));\n    REQUIRE(spy.log() == AllocatorLog{\n                             Deallocate(sizeofString(\"world\")),\n                             Allocate(sizeofString(\"[]\")),\n                         });\n  }\n}\n\nTEST_CASE(\"JsonVariant::set() reuses 8-bit slot\") {\n  SpyingAllocator spy;\n  JsonDocument doc(&spy);\n  JsonVariant variant = doc.to<JsonVariant>();\n\n  variant.set(1.2);\n  doc.shrinkToFit();\n  spy.clearLog();\n\n  SECTION(\"double\") {\n    bool result = variant.set(3.4);\n\n    REQUIRE(result == true);\n    REQUIRE(spy.log() == AllocatorLog{});\n  }\n\n  SECTION(\"int64_t\") {\n    bool result = variant.set(-2147483649LL);\n\n    REQUIRE(result == true);\n    REQUIRE(spy.log() == AllocatorLog{});\n  }\n\n  SECTION(\"uint64_t\") {\n    bool result = variant.set(4294967296U);\n\n    REQUIRE(result == true);\n    REQUIRE(spy.log() == AllocatorLog{});\n  }\n}\n"
  },
  {
    "path": "extras/tests/JsonVariant/size.cpp",
    "content": "// ArduinoJson - https://arduinojson.org\n// Copyright © 2014-2025, Benoit BLANCHON\n// MIT License\n\n#include <ArduinoJson.h>\n#include <catch.hpp>\n\nTEST_CASE(\"JsonVariant::size()\") {\n  JsonDocument doc;\n  JsonVariant variant = doc.to<JsonVariant>();\n\n  SECTION(\"unbound reference\") {\n    JsonVariant unbound;\n\n    CHECK(unbound.size() == 0);\n  }\n\n  SECTION(\"int\") {\n    variant.set(42);\n\n    CHECK(variant.size() == 0);\n  }\n\n  SECTION(\"string\") {\n    variant.set(\"hello\");\n\n    CHECK(variant.size() == 0);\n  }\n\n  SECTION(\"object\") {\n    variant[\"a\"] = 1;\n    variant[\"b\"] = 2;\n\n    CHECK(variant.size() == 2);\n  }\n}\n"
  },
  {
    "path": "extras/tests/JsonVariant/stl_containers.cpp",
    "content": "// ArduinoJson - https://arduinojson.org\n// Copyright © 2014-2025, Benoit BLANCHON\n// MIT License\n\n#include <ArduinoJson.h>\n#include <stdint.h>\n#include <catch.hpp>\n\n#include <array>\n#include <string>\n#include <vector>\n\nnamespace ArduinoJson {\ntemplate <typename T>\nstruct Converter<std::vector<T>> {\n  static void toJson(const std::vector<T>& src, JsonVariant dst) {\n    JsonArray array = dst.to<JsonArray>();\n    for (T item : src)\n      array.add(item);\n  }\n\n  static std::vector<T> fromJson(JsonVariantConst src) {\n    std::vector<T> dst;\n    for (T item : src.as<JsonArrayConst>())\n      dst.push_back(item);\n    return dst;\n  }\n\n  static bool checkJson(JsonVariantConst src) {\n    JsonArrayConst array = src;\n    bool result = array;\n    for (JsonVariantConst item : array)\n      result &= item.is<T>();\n    return result;\n  }\n};\n\ntemplate <typename T, size_t N>\nstruct Converter<std::array<T, N>> {\n  static void toJson(const std::array<T, N>& src, JsonVariant dst) {\n    JsonArray array = dst.to<JsonArray>();\n    for (T item : src)\n      array.add(item);\n  }\n\n  static std::array<T, N> fromJson(JsonVariantConst src) {\n    std::array<T, N> dst;\n    dst.fill(0);\n    size_t idx = 0;\n    for (T item : src.as<JsonArrayConst>())\n      dst[idx++] = item;\n    return dst;\n  }\n\n  static bool checkJson(JsonVariantConst src) {\n    JsonArrayConst array = src;\n    bool result = array;\n    size_t size = 0;\n    for (JsonVariantConst item : array) {\n      result &= item.is<T>();\n      size++;\n    }\n    return result && size == N;\n  }\n};\n}  // namespace ArduinoJson\n\nTEST_CASE(\"vector<int>\") {\n  SECTION(\"toJson\") {\n    std::vector<int> v = {1, 2};\n\n    JsonDocument doc;\n    doc.set(v);\n    REQUIRE(doc.as<std::string>() == \"[1,2]\");\n  }\n\n  SECTION(\"fromJson\") {\n    JsonDocument doc;\n    doc.add(1);\n    doc.add(2);\n\n    auto v = doc.as<std::vector<int>>();\n    REQUIRE(v.size() == 2);\n    CHECK(v[0] == 1);\n    CHECK(v[1] == 2);\n  }\n\n  SECTION(\"checkJson\") {\n    JsonDocument doc;\n    CHECK(doc.is<std::vector<int>>() == false);\n\n    doc.add(1);\n    doc.add(2);\n    CHECK(doc.is<std::vector<int>>() == true);\n\n    doc.add(\"foo\");\n    CHECK(doc.is<std::vector<int>>() == false);\n  }\n}\n\nTEST_CASE(\"array<int, 2>\") {\n  using array_type = std::array<int, 2>;\n\n  SECTION(\"toJson\") {\n    array_type v;\n    v[0] = 1;\n    v[1] = 2;\n\n    JsonDocument doc;\n    doc.set(v);\n    REQUIRE(doc.as<std::string>() == \"[1,2]\");\n  }\n\n  SECTION(\"fromJson\") {\n    JsonDocument doc;\n    doc.add(1);\n    doc.add(2);\n\n    auto v = doc.as<array_type>();\n    REQUIRE(v.size() == 2);\n    CHECK(v[0] == 1);\n    CHECK(v[1] == 2);\n  }\n\n  SECTION(\"checkJson\") {\n    JsonDocument doc;\n    CHECK(doc.is<array_type>() == false);\n\n    doc.add(1);\n    CHECK(doc.is<array_type>() == false);\n\n    doc.add(2);\n    CHECK(doc.is<array_type>() == true);\n\n    doc[0] = \"foo\";\n    CHECK(doc.is<array_type>() == false);\n  }\n}\n"
  },
  {
    "path": "extras/tests/JsonVariant/subscript.cpp",
    "content": "// ArduinoJson - https://arduinojson.org\n// Copyright © 2014-2025, Benoit BLANCHON\n// MIT License\n\n#include <ArduinoJson.h>\n#include <catch.hpp>\n\n#include \"Literals.hpp\"\n\nTEST_CASE(\"JsonVariant::operator[]\") {\n  JsonDocument doc;\n  JsonVariant var = doc.to<JsonVariant>();\n\n  SECTION(\"The JsonVariant is null\") {\n    REQUIRE(0 == var.size());\n    REQUIRE(var[\"0\"].isNull());\n    REQUIRE(var[0].isNull());\n  }\n\n  SECTION(\"The JsonVariant is a string\") {\n    var.set(\"hello world\");\n    REQUIRE(0 == var.size());\n    REQUIRE(var[\"0\"].isNull());\n    REQUIRE(var[0].isNull());\n  }\n\n  SECTION(\"The JsonVariant is a JsonArray\") {\n    JsonArray array = var.to<JsonArray>();\n\n    SECTION(\"get value\") {\n      array.add(\"element at index 0\");\n      array.add(\"element at index 1\");\n\n      REQUIRE(2 == var.size());\n      var[0].as<std::string>();\n      // REQUIRE(\"element at index 0\"_s == );\n      REQUIRE(\"element at index 1\"_s == var[1]);\n      REQUIRE(\"element at index 0\"_s ==\n              var[static_cast<unsigned char>(0)]);  // issue #381\n      REQUIRE(var[666].isNull());\n      REQUIRE(var[3].isNull());\n      REQUIRE(var[\"0\"].isNull());\n    }\n\n    SECTION(\"set value\") {\n      array.add(\"hello\");\n\n      var[1] = \"world\";\n\n      REQUIRE(var.size() == 2);\n      REQUIRE(\"world\"_s == var[1]);\n    }\n\n    SECTION(\"set value in a nested object\") {\n      array.add<JsonObject>();\n\n      var[0][\"hello\"] = \"world\";\n\n      REQUIRE(1 == var.size());\n      REQUIRE(1 == var[0].size());\n      REQUIRE(\"world\"_s == var[0][\"hello\"]);\n    }\n\n    SECTION(\"variant[0] when variant contains an integer\") {\n      var.set(123);\n\n      var[0] = 345;  // no-op\n\n      REQUIRE(var.is<int>());\n      REQUIRE(var.as<int>() == 123);\n    }\n\n    SECTION(\"use JsonVariant as index\") {\n      array.add(\"A\");\n      array.add(\"B\");\n      array.add(1);\n\n      REQUIRE(var[var[2]] == \"B\");\n      REQUIRE(var[var[3]].isNull());\n    }\n  }\n\n  SECTION(\"The JsonVariant is a JsonObject\") {\n    JsonObject object = var.to<JsonObject>();\n\n    SECTION(\"get value\") {\n      object[\"a\"] = \"element at key \\\"a\\\"\";\n      object[\"b\"] = \"element at key \\\"b\\\"\";\n\n      REQUIRE(2 == var.size());\n      REQUIRE(\"element at key \\\"a\\\"\"_s == var[\"a\"]);\n      REQUIRE(\"element at key \\\"b\\\"\"_s == var[\"b\"]);\n      REQUIRE(var[\"c\"].isNull());\n      REQUIRE(var[0].isNull());\n    }\n\n    SECTION(\"set value, key is a const char*\") {\n      var[\"hello\"] = \"world\";\n\n      REQUIRE(1 == var.size());\n      REQUIRE(\"world\"_s == var[\"hello\"]);\n    }\n\n    SECTION(\"set value, key is a char[]\") {\n      char key[] = \"hello\";\n      var[key] = \"world\";\n      key[0] = '!';  // make sure the key is duplicated\n\n      REQUIRE(1 == var.size());\n      REQUIRE(\"world\"_s == var[\"hello\"]);\n    }\n\n    SECTION(\"var[key].to<JsonArray>()\") {\n      JsonArray arr = var[\"hello\"].to<JsonArray>();\n      REQUIRE(arr.isNull() == false);\n    }\n\n    SECTION(\"use JsonVariant as key\") {\n      object[\"a\"] = \"A\";\n      object[\"ab\"] = \"AB\";\n      object[\"ab\\0c\"_s] = \"ABC\";\n      object[\"key1\"] = \"a\";\n      object[\"key2\"] = \"ab\";\n      object[\"key3\"] = \"ab\\0c\"_s;\n      object[\"key4\"] = \"foo\";\n\n      REQUIRE(var[var[\"key1\"]] == \"A\");\n      REQUIRE(var[var[\"key2\"]] == \"AB\");\n      REQUIRE(var[var[\"key3\"]] == \"ABC\");\n      REQUIRE(var[var[\"key4\"]].isNull());\n      REQUIRE(var[var[\"key5\"]].isNull());\n    }\n  }\n\n#if defined(HAS_VARIABLE_LENGTH_ARRAY) && \\\n    !defined(SUBSCRIPT_CONFLICTS_WITH_BUILTIN_OPERATOR)\n  SECTION(\"key is a VLA\") {\n    size_t i = 16;\n    char vla[i];\n    strcpy(vla, \"hello\");\n\n    deserializeJson(doc, \"{\\\"hello\\\":\\\"world\\\"}\");\n    JsonVariant variant = doc.as<JsonVariant>();\n\n    REQUIRE(\"world\"_s == variant[vla]);\n  }\n\n  SECTION(\"key is a VLA, const JsonVariant\") {\n    size_t i = 16;\n    char vla[i];\n    strcpy(vla, \"hello\");\n\n    deserializeJson(doc, \"{\\\"hello\\\":\\\"world\\\"}\");\n    const JsonVariant variant = doc.as<JsonVariant>();\n\n    REQUIRE(\"world\"_s == variant[vla]);\n  }\n#endif\n}\n"
  },
  {
    "path": "extras/tests/JsonVariant/types.cpp",
    "content": "// ArduinoJson - https://arduinojson.org\n// Copyright © 2014-2025, Benoit BLANCHON\n// MIT License\n\n#include <ArduinoJson.h>\n#include <stdint.h>\n#include <catch.hpp>\n#include <limits>\n\n#include \"Allocators.hpp\"\n#include \"Literals.hpp\"\n\ntemplate <typename T>\nvoid checkReference(T& expected) {\n  JsonVariant variant = expected;\n  REQUIRE(expected == variant.as<T&>());\n}\n\ntemplate <typename T>\nvoid checkNumericType() {\n  JsonDocument docMin, docMax;\n  JsonVariant variantMin = docMin.to<JsonVariant>();\n  JsonVariant variantMax = docMax.to<JsonVariant>();\n\n  T min = std::numeric_limits<T>::min();\n  T max = std::numeric_limits<T>::max();\n\n  variantMin.set(min);\n  variantMax.set(max);\n\n  REQUIRE(min == variantMin.as<T>());\n  REQUIRE(max == variantMax.as<T>());\n}\n\nTEST_CASE(\"JsonVariant set()/get()\") {\n  SpyingAllocator spy;\n  JsonDocument doc(&spy);\n  JsonVariant variant = doc.to<JsonVariant>();\n\n#if ARDUINOJSON_USE_LONG_LONG\n  SECTION(\"SizeOfJsonInteger\") {\n    REQUIRE(8 == sizeof(JsonInteger));\n  }\n#endif\n\n  // /!\\ Most test were moved to `JsonVariant/set.cpp`\n  // TODO: move the remaining tests too\n\n  SECTION(\"False\") {\n    variant.set(false);\n    REQUIRE(variant.as<bool>() == false);\n    REQUIRE(spy.log() == AllocatorLog{});\n  }\n\n  SECTION(\"True\") {\n    variant.set(true);\n    REQUIRE(variant.as<bool>() == true);\n    REQUIRE(spy.log() == AllocatorLog{});\n  }\n\n  SECTION(\"Double\") {\n    checkNumericType<double>();\n  }\n  SECTION(\"Float\") {\n    checkNumericType<float>();\n  }\n  SECTION(\"SChar\") {\n    checkNumericType<signed char>();\n  }\n  SECTION(\"SInt\") {\n    checkNumericType<signed int>();\n  }\n  SECTION(\"SLong\") {\n    checkNumericType<signed long>();\n  }\n  SECTION(\"SShort\") {\n    checkNumericType<signed short>();\n  }\n  SECTION(\"UChar\") {\n    checkNumericType<unsigned char>();\n  }\n  SECTION(\"UInt\") {\n    checkNumericType<unsigned int>();\n  }\n  SECTION(\"ULong\") {\n    checkNumericType<unsigned long>();\n  }\n  SECTION(\"UShort\") {\n    checkNumericType<unsigned short>();\n  }\n#if ARDUINOJSON_USE_LONG_LONG\n  SECTION(\"LongLong\") {\n    checkNumericType<unsigned long long>();\n  }\n  SECTION(\"ULongLong\") {\n    checkNumericType<unsigned long long>();\n  }\n#endif\n\n  SECTION(\"Int8\") {\n    checkNumericType<int8_t>();\n  }\n  SECTION(\"Uint8\") {\n    checkNumericType<uint8_t>();\n  }\n  SECTION(\"Int16\") {\n    checkNumericType<int16_t>();\n  }\n  SECTION(\"Uint16\") {\n    checkNumericType<uint16_t>();\n  }\n  SECTION(\"Int32\") {\n    checkNumericType<int32_t>();\n  }\n  SECTION(\"Uint32\") {\n    checkNumericType<uint32_t>();\n  }\n#if ARDUINOJSON_USE_LONG_LONG\n  SECTION(\"Int64\") {\n    checkNumericType<int64_t>();\n  }\n  SECTION(\"Uint64\") {\n    checkNumericType<uint64_t>();\n  }\n#endif\n\n  SECTION(\"CanStoreObject\") {\n    JsonDocument doc2;\n    JsonObject object = doc2.to<JsonObject>();\n\n    variant.set(object);\n    REQUIRE(variant.is<JsonObject>());\n    REQUIRE(variant.as<JsonObject>() == object);\n  }\n}\n\nTEST_CASE(\"volatile\") {\n  JsonDocument doc;\n  JsonVariant variant = doc.to<JsonVariant>();\n\n  SECTION(\"volatile bool\") {  // issue #2029\n    volatile bool f = true;\n    variant.set(f);\n    CHECK(variant.is<bool>() == true);\n    CHECK(variant.as<bool>() == true);\n  }\n\n  SECTION(\"volatile int\") {\n    volatile int f = 42;\n    variant.set(f);\n    CHECK(variant.is<int>() == true);\n    CHECK(variant.as<int>() == 42);\n  }\n\n  SECTION(\"volatile float\") {  // issue #1557\n    volatile float f = 3.14f;\n    variant.set(f);\n    CHECK(variant.is<float>() == true);\n    CHECK(variant.as<float>() == 3.14f);\n  }\n\n  SECTION(\"volatile double\") {\n    volatile double f = 3.14;\n    variant.set(f);\n    CHECK(variant.is<double>() == true);\n    CHECK(variant.as<double>() == 3.14);\n  }\n}\n"
  },
  {
    "path": "extras/tests/JsonVariant/unbound.cpp",
    "content": "// ArduinoJson - https://arduinojson.org\n// Copyright © 2014-2025, Benoit BLANCHON\n// MIT License\n\n#include <ArduinoJson.h>\n#include <catch.hpp>\n\n#include \"Literals.hpp\"\n\nTEST_CASE(\"Unbound JsonVariant\") {\n  JsonVariant variant;\n\n  SECTION(\"as<T>()\") {\n    CHECK(variant.as<bool>() == false);\n    CHECK(variant.as<int>() == 0);\n    CHECK(variant.as<float>() == 0.0f);\n    CHECK(variant.as<const char*>() == 0);\n    CHECK(variant.as<std::string>() == \"null\");\n    CHECK(variant.as<JsonVariant>().isNull());\n    CHECK(variant.as<JsonVariantConst>().isNull());\n    CHECK(variant.as<JsonArray>().isNull());\n    CHECK(variant.as<JsonArrayConst>().isNull());\n    CHECK(variant.as<JsonObject>().isNull());\n    CHECK(variant.as<JsonObjectConst>().isNull());\n    CHECK(variant.as<JsonString>().isNull());\n    CHECK(variant.as<MsgPackBinary>().data() == nullptr);\n    CHECK(variant.as<MsgPackBinary>().size() == 0);\n    CHECK(variant.as<MsgPackExtension>().data() == nullptr);\n    CHECK(variant.as<MsgPackExtension>().size() == 0);\n  }\n\n  SECTION(\"is<T>()\") {\n    CHECK_FALSE(variant.is<bool>());\n    CHECK_FALSE(variant.is<int>());\n    CHECK_FALSE(variant.is<float>());\n    CHECK_FALSE(variant.is<const char*>());\n    CHECK_FALSE(variant.is<std::string>());\n    CHECK_FALSE(variant.is<JsonVariant>());\n    CHECK_FALSE(variant.is<JsonVariantConst>());\n    CHECK_FALSE(variant.is<JsonArray>());\n    CHECK_FALSE(variant.is<JsonArrayConst>());\n    CHECK_FALSE(variant.is<JsonObject>());\n    CHECK_FALSE(variant.is<JsonObjectConst>());\n    CHECK_FALSE(variant.is<JsonString>());\n  }\n\n  SECTION(\"set()\") {\n    CHECK_FALSE(variant.set(\"42\"));\n    CHECK_FALSE(variant.set(42.0));\n    CHECK_FALSE(variant.set(42L));\n    CHECK_FALSE(variant.set(42U));\n    CHECK_FALSE(variant.set(serialized(\"42\")));\n    CHECK_FALSE(variant.set(serialized(\"42\"_s)));\n    CHECK_FALSE(variant.set(true));\n    CHECK_FALSE(variant.set(MsgPackBinary(\"hello\", 5)));\n    CHECK_FALSE(variant.set(MsgPackExtension(1, \"hello\", 5)));\n  }\n\n  SECTION(\"add()\") {\n    CHECK_FALSE(variant.add(\"42\"));\n    CHECK_FALSE(variant.add(42.0));\n    CHECK_FALSE(variant.add(42L));\n    CHECK_FALSE(variant.add(42U));\n    CHECK_FALSE(variant.add(serialized(\"42\")));\n    CHECK_FALSE(variant.add(true));\n  }\n\n  SECTION(\"operator[]\") {\n    CHECK(variant[0].isNull());\n    CHECK(variant[\"key\"].isNull());\n    CHECK_FALSE(variant[0].set(1));\n    CHECK_FALSE(variant[\"key\"].set(1));\n    CHECK_FALSE(variant[\"key\"_s].set(1));\n  }\n\n  SECTION(\"remove()\") {\n    variant.remove(0);\n    variant.remove(\"hello\");\n  }\n}\n"
  },
  {
    "path": "extras/tests/JsonVariantConst/CMakeLists.txt",
    "content": "# ArduinoJson - https://arduinojson.org\n# Copyright © 2014-2025, Benoit BLANCHON\n# MIT License\n\nadd_executable(JsonVariantConstTests\n\tas.cpp\n\tis.cpp\n\tisnull.cpp\n\tnesting.cpp\n\tsize.cpp\n\tsubscript.cpp\n)\n\nadd_test(JsonVariantConst JsonVariantConstTests)\n\nset_tests_properties(JsonVariantConst\n\tPROPERTIES\n\t\tLABELS \"Catch\"\n)\n"
  },
  {
    "path": "extras/tests/JsonVariantConst/as.cpp",
    "content": "// ArduinoJson - https://arduinojson.org\n// Copyright © 2014-2025, Benoit BLANCHON\n// MIT License\n\n#include <ArduinoJson.h>\n#include <stdint.h>\n#include <catch.hpp>\n\n#include \"Literals.hpp\"\n\nTEST_CASE(\"JsonVariantConst::as<T>()\") {\n  JsonDocument doc;\n  JsonVariantConst var = doc.to<JsonVariant>();\n\n  doc.set(\"hello\");\n\n  REQUIRE(var.as<bool>() == true);\n  REQUIRE(var.as<long>() == 0L);\n  REQUIRE(var.as<const char*>() == \"hello\"_s);\n  REQUIRE(var.as<std::string>() == \"hello\"_s);\n}\n\nTEST_CASE(\"Invalid conversions\") {\n  using namespace ArduinoJson::detail;\n\n  JsonVariantConst variant;\n\n  CHECK(is_same<decltype(variant.as<int>()), int>::value);\n  CHECK(is_same<decltype(variant.as<float>()), float>::value);\n  CHECK(is_same<decltype(variant.as<JsonVariantConst>()),\n                JsonVariantConst>::value);\n  CHECK(\n      is_same<decltype(variant.as<JsonObjectConst>()), JsonObjectConst>::value);\n  CHECK(is_same<decltype(variant.as<JsonArrayConst>()), JsonArrayConst>::value);\n\n  CHECK(is_same<decltype(variant.as<JsonVariant>()),\n                InvalidConversion<JsonVariantConst, JsonVariant>>::value);\n  CHECK(is_same<decltype(variant.as<JsonObject>()),\n                InvalidConversion<JsonVariantConst, JsonObject>>::value);\n  CHECK(is_same<decltype(variant.as<JsonArray>()),\n                InvalidConversion<JsonVariantConst, JsonArray>>::value);\n}\n"
  },
  {
    "path": "extras/tests/JsonVariantConst/is.cpp",
    "content": "// ArduinoJson - https://arduinojson.org\n// Copyright © 2014-2025, Benoit BLANCHON\n// MIT License\n\n#include <ArduinoJson.h>\n#include <catch.hpp>\n\nenum MYENUM2 { ONE = 1, TWO = 2 };\n\nTEST_CASE(\"JsonVariantConst::is<T>()\") {\n  JsonDocument doc;\n  JsonVariantConst var = doc.to<JsonVariant>();\n\n  SECTION(\"unbound\") {\n    var = JsonVariantConst();\n\n    CHECK(var.is<JsonArray>() == false);\n    CHECK(var.is<JsonArrayConst>() == false);\n    CHECK(var.is<JsonObject>() == false);\n    CHECK(var.is<JsonObjectConst>() == false);\n    CHECK(var.is<JsonVariant>() == false);\n    CHECK(var.is<JsonVariantConst>() == false);\n    CHECK(var.is<bool>() == false);\n    CHECK(var.is<const char*>() == false);\n    CHECK(var.is<int>() == false);\n    CHECK(var.is<std::string>() == false);\n    CHECK(var.is<JsonString>() == false);\n    CHECK(var.is<float>() == false);\n    CHECK(var.is<MYENUM2>() == false);\n  }\n\n  SECTION(\"null\") {\n    CHECK(var.is<JsonVariantConst>() == true);\n    CHECK(var.is<JsonObject>() == false);\n    CHECK(var.is<JsonArray>() == false);\n    CHECK(var.is<JsonVariant>() == false);\n    CHECK(var.is<bool>() == false);\n    CHECK(var.is<const char*>() == false);\n    CHECK(var.is<int>() == false);\n    CHECK(var.is<std::string>() == false);\n    CHECK(var.is<JsonString>() == false);\n    CHECK(var.is<float>() == false);\n    CHECK(var.is<MYENUM2>() == false);\n  }\n\n  SECTION(\"true\") {\n    doc.set(true);\n\n    CHECK(var.is<bool>() == true);\n    CHECK(var.is<JsonVariantConst>() == true);\n    CHECK(var.is<JsonVariant>() == false);\n    CHECK(var.is<JsonObject>() == false);\n    CHECK(var.is<JsonArray>() == false);\n    CHECK(var.is<const char*>() == false);\n    CHECK(var.is<int>() == false);\n    CHECK(var.is<std::string>() == false);\n    CHECK(var.is<JsonString>() == false);\n    CHECK(var.is<float>() == false);\n    CHECK(var.is<MYENUM2>() == false);\n  }\n\n  SECTION(\"false\") {\n    doc.set(false);\n\n    CHECK(var.is<bool>() == true);\n    CHECK(var.is<JsonVariantConst>() == true);\n    CHECK(var.is<JsonVariant>() == false);\n    CHECK(var.is<JsonObject>() == false);\n    CHECK(var.is<JsonArray>() == false);\n    CHECK(var.is<const char*>() == false);\n    CHECK(var.is<int>() == false);\n    CHECK(var.is<std::string>() == false);\n    CHECK(var.is<JsonString>() == false);\n    CHECK(var.is<float>() == false);\n    CHECK(var.is<MYENUM2>() == false);\n  }\n\n  SECTION(\"int\") {\n    doc.set(42);\n\n    CHECK(var.is<int>() == true);\n    CHECK(var.is<short>() == true);\n    CHECK(var.is<long>() == true);\n    CHECK(var.is<double>() == true);\n    CHECK(var.is<float>() == true);\n    CHECK(var.is<MYENUM2>() == true);\n    CHECK(var.is<JsonVariantConst>() == true);\n    CHECK(var.is<bool>() == false);\n    CHECK(var.is<JsonObject>() == false);\n    CHECK(var.is<JsonArray>() == false);\n    CHECK(var.is<JsonVariant>() == false);\n    CHECK(var.is<const char*>() == false);\n    CHECK(var.is<std::string>() == false);\n    CHECK(var.is<JsonString>() == false);\n  }\n\n  SECTION(\"double\") {\n    doc.set(4.2);\n\n    CHECK(var.is<double>() == true);\n    CHECK(var.is<float>() == true);\n    CHECK(var.is<JsonVariantConst>() == true);\n    CHECK(var.is<bool>() == false);\n    CHECK(var.is<JsonObject>() == false);\n    CHECK(var.is<JsonArray>() == false);\n    CHECK(var.is<JsonVariant>() == false);\n    CHECK(var.is<const char*>() == false);\n    CHECK(var.is<int>() == false);\n    CHECK(var.is<std::string>() == false);\n    CHECK(var.is<JsonString>() == false);\n    CHECK(var.is<MYENUM2>() == false);\n  }\n\n  SECTION(\"const char*\") {\n    doc.set(\"4.2\");\n\n    CHECK(var.is<const char*>() == true);\n    CHECK(var.is<const char*>() == true);\n    CHECK(var.is<std::string>() == true);\n    CHECK(var.is<JsonString>() == true);\n    CHECK(var.is<double>() == false);\n    CHECK(var.is<float>() == false);\n    CHECK(var.is<bool>() == false);\n    CHECK(var.is<JsonObject>() == false);\n    CHECK(var.is<JsonArray>() == false);\n    CHECK(var.is<JsonVariant>() == false);\n    CHECK(var.is<int>() == false);\n    CHECK(var.is<MYENUM2>() == false);\n  }\n\n  SECTION(\"JsonArray\") {\n    doc.to<JsonArray>();\n\n    CHECK(var.is<JsonArrayConst>() == true);\n    CHECK(var.is<JsonVariantConst>() == true);\n    CHECK(var.is<JsonArray>() == false);\n    CHECK(var.is<JsonVariant>() == false);\n    CHECK(var.is<JsonObject>() == false);\n    CHECK(var.is<JsonObjectConst>() == false);\n    CHECK(var.is<int>() == false);\n    CHECK(var.is<float>() == false);\n    CHECK(var.is<bool>() == false);\n    CHECK(var.is<const char*>() == false);\n    CHECK(var.is<MYENUM2>() == false);\n  }\n\n  SECTION(\"JsonObject\") {\n    doc.to<JsonObject>();\n\n    CHECK(var.is<JsonObjectConst>() == true);\n    CHECK(var.is<JsonVariantConst>() == true);\n    CHECK(var.is<JsonObject>() == false);\n    CHECK(var.is<JsonVariant>() == false);\n    CHECK(var.is<JsonArray>() == false);\n    CHECK(var.is<JsonArrayConst>() == false);\n    CHECK(var.is<int>() == false);\n    CHECK(var.is<float>() == false);\n    CHECK(var.is<bool>() == false);\n    CHECK(var.is<const char*>() == false);\n    CHECK(var.is<MYENUM2>() == false);\n  }\n}\n"
  },
  {
    "path": "extras/tests/JsonVariantConst/isnull.cpp",
    "content": "// ArduinoJson - https://arduinojson.org\n// Copyright © 2014-2025, Benoit BLANCHON\n// MIT License\n\n#include <ArduinoJson.h>\n#include <catch.hpp>\n\nTEST_CASE(\"JsonVariantConst::isNull()\") {\n  JsonDocument doc;\n  JsonVariantConst variant = doc.to<JsonVariant>();\n\n  SECTION(\"returns true when undefined\") {\n    REQUIRE(variant.isNull() == true);\n  }\n\n  SECTION(\"returns false if value is integer\") {\n    doc.set(42);\n\n    REQUIRE(variant.isNull() == false);\n  }\n}\n"
  },
  {
    "path": "extras/tests/JsonVariantConst/nesting.cpp",
    "content": "// ArduinoJson - https://arduinojson.org\n// Copyright © 2014-2025, Benoit BLANCHON\n// MIT License\n\n#include <ArduinoJson.h>\n#include <catch.hpp>\n\nTEST_CASE(\"JsonVariantConst::nesting()\") {\n  JsonDocument doc;\n  JsonVariantConst var = doc.to<JsonVariant>();\n\n  SECTION(\"return 0 if unbound\") {\n    JsonVariantConst unbound;\n    REQUIRE(unbound.nesting() == 0);\n  }\n\n  SECTION(\"returns 0 for string\") {\n    doc.set(\"hello\");\n    REQUIRE(var.nesting() == 0);\n  }\n\n  SECTION(\"returns 1 for empty object\") {\n    doc.to<JsonObject>();\n    REQUIRE(var.nesting() == 1);\n  }\n\n  SECTION(\"returns 1 for empty array\") {\n    doc.to<JsonArray>();\n    REQUIRE(var.nesting() == 1);\n  }\n}\n"
  },
  {
    "path": "extras/tests/JsonVariantConst/size.cpp",
    "content": "// ArduinoJson - https://arduinojson.org\n// Copyright © 2014-2025, Benoit BLANCHON\n// MIT License\n\n#include <ArduinoJson.h>\n#include <catch.hpp>\n\nTEST_CASE(\"JsonVariantConst::size()\") {\n  JsonDocument doc;\n  JsonVariantConst variant = doc.to<JsonVariant>();\n\n  SECTION(\"unbound reference\") {\n    JsonVariantConst unbound;\n\n    CHECK(unbound.size() == 0);\n  }\n\n  SECTION(\"int\") {\n    doc.set(42);\n\n    CHECK(variant.size() == 0);\n  }\n\n  SECTION(\"string\") {\n    doc.set(\"hello\");\n\n    CHECK(variant.size() == 0);\n  }\n\n  SECTION(\"object\") {\n    doc[\"a\"] = 1;\n    doc[\"b\"] = 2;\n\n    CHECK(variant.size() == 2);\n  }\n}\n"
  },
  {
    "path": "extras/tests/JsonVariantConst/subscript.cpp",
    "content": "// ArduinoJson - https://arduinojson.org\n// Copyright © 2014-2025, Benoit BLANCHON\n// MIT License\n\n#include <ArduinoJson.h>\n#include <catch.hpp>\n\n#include \"Literals.hpp\"\n\nTEST_CASE(\"JsonVariantConst::operator[]\") {\n  JsonDocument doc;\n  JsonVariantConst var = doc.to<JsonVariant>();\n\n  SECTION(\"null\") {\n    REQUIRE(0 == var.size());\n    REQUIRE(var[\"0\"].isNull());\n    REQUIRE(var[0].isNull());\n  }\n\n  SECTION(\"string\") {\n    doc.set(\"hello world\");\n    REQUIRE(0 == var.size());\n    REQUIRE(var[\"0\"].isNull());\n    REQUIRE(var[0].isNull());\n  }\n\n  SECTION(\"array\") {\n    JsonArray array = doc.to<JsonArray>();\n    array.add(\"A\");\n    array.add(\"B\");\n\n    SECTION(\"int\") {\n      REQUIRE(\"A\"_s == var[0]);\n      REQUIRE(\"B\"_s == var[1]);\n      REQUIRE(\"A\"_s == var[static_cast<unsigned char>(0)]);  // issue #381\n      REQUIRE(var[666].isNull());\n      REQUIRE(var[3].isNull());\n    }\n\n    SECTION(\"const char*\") {\n      REQUIRE(var[\"0\"].isNull());\n    }\n\n    SECTION(\"JsonVariant\") {\n      array.add(1);\n      REQUIRE(var[var[2]] == \"B\"_s);\n      REQUIRE(var[var[3]].isNull());\n    }\n  }\n\n  SECTION(\"object\") {\n    JsonObject object = doc.to<JsonObject>();\n    object[\"ab\"_s] = \"AB\";\n    object[\"abc\"_s] = \"ABC\";\n    object[\"abcd\"_s] = \"ABCD\";\n\n    SECTION(\"string literal\") {\n      REQUIRE(var[\"ab\"] == \"AB\"_s);\n      REQUIRE(var[\"abc\"] == \"ABC\"_s);\n      REQUIRE(var[\"abcd\"] == \"ABCD\"_s);\n      REQUIRE(var[\"def\"].isNull());\n      REQUIRE(var[0].isNull());\n    }\n\n    SECTION(\"const char*\") {\n      REQUIRE(var[static_cast<const char*>(\"ab\")] == \"AB\"_s);\n      REQUIRE(var[static_cast<const char*>(\"abc\")] == \"ABC\"_s);\n      REQUIRE(var[static_cast<const char*>(\"abc\\0d\")] == \"ABC\"_s);\n      REQUIRE(var[static_cast<const char*>(\"def\")].isNull());\n      REQUIRE(var[static_cast<const char*>(0)].isNull());\n    }\n\n    SECTION(\"supports std::string\") {\n      REQUIRE(var[\"ab\"_s] == \"AB\"_s);\n      REQUIRE(var[\"abc\"_s] == \"ABC\"_s);\n      REQUIRE(var[\"abcd\"_s] == \"ABCD\"_s);\n      REQUIRE(var[\"def\"_s].isNull());\n    }\n\n#if defined(HAS_VARIABLE_LENGTH_ARRAY) && \\\n    !defined(SUBSCRIPT_CONFLICTS_WITH_BUILTIN_OPERATOR)\n    SECTION(\"supports VLA\") {\n      size_t i = 16;\n      char vla[i];\n      strcpy(vla, \"abc\");\n\n      REQUIRE(var[vla] == \"ABC\"_s);\n    }\n#endif\n\n    SECTION(\"supports JsonVariant\") {\n      object[\"key1\"] = \"ab\";\n      object[\"key2\"] = \"abc\";\n      object[\"key3\"] = \"abcd\"_s;\n      object[\"key4\"] = \"foo\";\n\n      REQUIRE(var[var[\"key1\"]] == \"AB\"_s);\n      REQUIRE(var[var[\"key2\"]] == \"ABC\"_s);\n      REQUIRE(var[var[\"key3\"]] == \"ABCD\"_s);\n      REQUIRE(var[var[\"key4\"]].isNull());\n      REQUIRE(var[var[\"key5\"]].isNull());\n    }\n  }\n}\n"
  },
  {
    "path": "extras/tests/Misc/CMakeLists.txt",
    "content": "# ArduinoJson - https://arduinojson.org\n# Copyright © 2014-2025, Benoit BLANCHON\n# MIT License\n\nadd_executable(MiscTests\n\tarithmeticCompare.cpp\n\tconflicts.cpp\n\tissue1967.cpp\n\tissue2129.cpp\n\tissue2166.cpp\n\tJsonString.cpp\n\tNoArduinoHeader.cpp\n\tprintable.cpp\n\tReaders.cpp\n\tStringAdapters.cpp\n\tStringWriter.cpp\n\tTypeTraits.cpp\n\tunsigned_char.cpp\n\tUtf16.cpp\n\tUtf8.cpp\n\tversion.cpp\n)\n\nset_target_properties(MiscTests PROPERTIES UNITY_BUILD OFF)\n\nadd_test(Misc MiscTests)\n\nset_tests_properties(Misc\n\tPROPERTIES\n\t\tLABELS \"Catch\"\n)\n\nadd_executable(Issue2181\n\tissue2181.cpp # Cannot be linked with other tests\n)\n\nset_target_properties(Issue2181 PROPERTIES UNITY_BUILD OFF)\n\nadd_test(Issue2181 Issue2181)\n\nset_tests_properties(Issue2181\n\tPROPERTIES\n\t\tLABELS \"Catch\"\n)\n\nif(CMAKE_CXX_COMPILER_ID MATCHES \"Clang\")\n\ttarget_compile_options(Issue2181\n\t\tPRIVATE\n\t\t\t-Wno-keyword-macro # keyword is hidden by macro definition\n\t)\nendif()\n"
  },
  {
    "path": "extras/tests/Misc/JsonString.cpp",
    "content": "// ArduinoJson - https://arduinojson.org\n// Copyright © 2014-2025, Benoit BLANCHON\n// MIT License\n\n#include <ArduinoJson.h>\n#include <catch.hpp>\n\n#include <sstream>\n\nTEST_CASE(\"JsonString\") {\n  SECTION(\"Default constructor creates a null JsonString\") {\n    JsonString s;\n\n    CHECK(s.isNull() == true);\n    CHECK(s.c_str() == 0);\n    CHECK(s == JsonString());\n    CHECK(s != \"\");\n  }\n\n  SECTION(\"Null converts to false\") {\n    JsonString s;\n\n    CHECK(bool(s) == false);\n  }\n\n  SECTION(\"Empty string converts to true\") {\n    JsonString s(\"\");\n\n    CHECK(bool(s) == true);\n  }\n\n  SECTION(\"Non-empty string converts to true\") {\n    JsonString s(\"\");\n\n    CHECK(bool(s) == true);\n  }\n\n  SECTION(\"Null strings equals each others\") {\n    JsonString a, b;\n\n    CHECK(a == b);\n    CHECK_FALSE(a != b);\n  }\n\n  SECTION(\"Null and empty strings differ\") {\n    JsonString a, b(\"\");\n\n    CHECK_FALSE(a == b);\n    CHECK(a != b);\n\n    CHECK_FALSE(b == a);\n    CHECK(b != a);\n  }\n\n  SECTION(\"Null and non-empty strings differ\") {\n    JsonString a, b(\"hello\");\n\n    CHECK_FALSE(a == b);\n    CHECK(a != b);\n\n    CHECK_FALSE(b == a);\n    CHECK(b != a);\n  }\n\n  SECTION(\"Compare different strings\") {\n    JsonString a(\"hello\"), b(\"world\");\n\n    CHECK_FALSE(a == b);\n    CHECK(a != b);\n  }\n\n  SECTION(\"Compare identical by pointer\") {\n    JsonString a(\"hello\"), b(\"hello\");\n\n    CHECK(a == b);\n    CHECK_FALSE(a != b);\n  }\n\n  SECTION(\"Compare identical by value\") {\n    char s1[] = \"hello\";\n    char s2[] = \"hello\";\n    JsonString a(s1), b(s2);\n\n    CHECK(a == b);\n    CHECK_FALSE(a != b);\n  }\n\n  SECTION(\"std::stream\") {\n    std::stringstream ss;\n    ss << JsonString(\"hello world!\");\n    CHECK(ss.str() == \"hello world!\");\n  }\n\n  SECTION(\"Construct with a size\") {\n    JsonString s(\"hello world\", 5);\n\n    CHECK(s.size() == 5);\n    CHECK(s == \"hello\");\n    CHECK(s != \"hello world\");\n  }\n}\n"
  },
  {
    "path": "extras/tests/Misc/NoArduinoHeader.cpp",
    "content": "// ArduinoJson - https://arduinojson.org\n// Copyright © 2014-2025, Benoit BLANCHON\n// MIT License\n\n#define ARDUINO 1\n#define ARDUINOJSON_ENABLE_PROGMEM 0\n#define ARDUINOJSON_ENABLE_ARDUINO_STRING 0\n#define ARDUINOJSON_ENABLE_ARDUINO_STREAM 0\n#define ARDUINOJSON_ENABLE_ARDUINO_PRINT 0\n#include <ArduinoJson.h>\n\n#include <catch.hpp>\n\nTEST_CASE(\"Arduino.h\") {\n#ifdef ARDUINO_H_INCLUDED\n  FAIL(\"Arduino.h should not be included\");\n#else\n  INFO(\"Arduino.h not included\");\n#endif\n}\n"
  },
  {
    "path": "extras/tests/Misc/Readers.cpp",
    "content": "// ArduinoJson - https://arduinojson.org\n// Copyright © 2014-2025, Benoit BLANCHON\n// MIT License\n\n#include <Arduino.h>\n#include <ArduinoJson.hpp>\n#include <catch.hpp>\n\n#include <sstream>\n\nusing namespace ArduinoJson::detail;\n\nTEST_CASE(\"Reader<std::istringstream>\") {\n  SECTION(\"read()\") {\n    std::istringstream src(\"\\x01\\xFF\");\n    Reader<std::istringstream> reader(src);\n\n    REQUIRE(reader.read() == 0x01);\n    REQUIRE(reader.read() == 0xFF);\n    REQUIRE(reader.read() == -1);\n  }\n\n  SECTION(\"readBytes() all at once\") {\n    std::istringstream src(\"ABC\");\n    Reader<std::istringstream> reader(src);\n\n    char buffer[8] = \"abcd\";\n    REQUIRE(reader.readBytes(buffer, 4) == 3);\n\n    REQUIRE(buffer[0] == 'A');\n    REQUIRE(buffer[1] == 'B');\n    REQUIRE(buffer[2] == 'C');\n    REQUIRE(buffer[3] == 'd');\n  }\n\n  SECTION(\"readBytes() in two parts\") {\n    std::istringstream src(\"ABCDEF\");\n    Reader<std::istringstream> reader(src);\n\n    char buffer[12] = \"abcdefg\";\n    REQUIRE(reader.readBytes(buffer, 4) == 4);\n    REQUIRE(reader.readBytes(buffer + 4, 4) == 2);\n\n    REQUIRE(buffer[0] == 'A');\n    REQUIRE(buffer[1] == 'B');\n    REQUIRE(buffer[2] == 'C');\n    REQUIRE(buffer[3] == 'D');\n    REQUIRE(buffer[4] == 'E');\n    REQUIRE(buffer[5] == 'F');\n    REQUIRE(buffer[6] == 'g');\n  }\n}\n\nTEST_CASE(\"BoundedReader<const char*>\") {\n  SECTION(\"read\") {\n    BoundedReader<const char*> reader(\"\\x01\\xFF\", 2);\n    REQUIRE(reader.read() == 0x01);\n    REQUIRE(reader.read() == 0xFF);\n    REQUIRE(reader.read() == -1);\n    REQUIRE(reader.read() == -1);\n  }\n\n  SECTION(\"readBytes() all at once\") {\n    BoundedReader<const char*> reader(\"ABCD\", 3);\n\n    char buffer[8] = \"abcd\";\n    REQUIRE(reader.readBytes(buffer, 4) == 3);\n\n    REQUIRE(buffer[0] == 'A');\n    REQUIRE(buffer[1] == 'B');\n    REQUIRE(buffer[2] == 'C');\n    REQUIRE(buffer[3] == 'd');\n  }\n\n  SECTION(\"readBytes() in two parts\") {\n    BoundedReader<const char*> reader(\"ABCDEF\", 6);\n\n    char buffer[8] = \"abcdefg\";\n    REQUIRE(reader.readBytes(buffer, 4) == 4);\n    REQUIRE(reader.readBytes(buffer + 4, 4) == 2);\n\n    REQUIRE(buffer[0] == 'A');\n    REQUIRE(buffer[1] == 'B');\n    REQUIRE(buffer[2] == 'C');\n    REQUIRE(buffer[3] == 'D');\n    REQUIRE(buffer[4] == 'E');\n    REQUIRE(buffer[5] == 'F');\n    REQUIRE(buffer[6] == 'g');\n  }\n}\n\nTEST_CASE(\"Reader<const char*>\") {\n  SECTION(\"read()\") {\n    Reader<const char*> reader(\"\\x01\\xFF\\x00\\x12\");\n    REQUIRE(reader.read() == 0x01);\n    REQUIRE(reader.read() == 0xFF);\n    REQUIRE(reader.read() == 0);\n    REQUIRE(reader.read() == 0x12);\n  }\n\n  SECTION(\"readBytes() all at once\") {\n    Reader<const char*> reader(\"ABCD\");\n\n    char buffer[8] = \"abcd\";\n    REQUIRE(reader.readBytes(buffer, 3) == 3);\n\n    REQUIRE(buffer[0] == 'A');\n    REQUIRE(buffer[1] == 'B');\n    REQUIRE(buffer[2] == 'C');\n    REQUIRE(buffer[3] == 'd');\n  }\n\n  SECTION(\"readBytes() in two parts\") {\n    Reader<const char*> reader(\"ABCDEF\");\n\n    char buffer[8] = \"abcdefg\";\n    REQUIRE(reader.readBytes(buffer, 4) == 4);\n    REQUIRE(reader.readBytes(buffer + 4, 2) == 2);\n\n    REQUIRE(buffer[0] == 'A');\n    REQUIRE(buffer[1] == 'B');\n    REQUIRE(buffer[2] == 'C');\n    REQUIRE(buffer[3] == 'D');\n    REQUIRE(buffer[4] == 'E');\n    REQUIRE(buffer[5] == 'F');\n    REQUIRE(buffer[6] == 'g');\n  }\n}\n\nTEST_CASE(\"IteratorReader\") {\n  SECTION(\"read()\") {\n    std::string src(\"\\x01\\xFF\");\n    IteratorReader<std::string::const_iterator> reader(src.begin(), src.end());\n\n    REQUIRE(reader.read() == 0x01);\n    REQUIRE(reader.read() == 0xFF);\n    REQUIRE(reader.read() == -1);\n  }\n\n  SECTION(\"readBytes() all at once\") {\n    std::string src(\"ABC\");\n    IteratorReader<std::string::const_iterator> reader(src.begin(), src.end());\n\n    char buffer[8] = \"abcd\";\n    REQUIRE(reader.readBytes(buffer, 4) == 3);\n\n    REQUIRE(buffer[0] == 'A');\n    REQUIRE(buffer[1] == 'B');\n    REQUIRE(buffer[2] == 'C');\n    REQUIRE(buffer[3] == 'd');\n  }\n\n  SECTION(\"readBytes() in two parts\") {\n    std::string src(\"ABCDEF\");\n    IteratorReader<std::string::const_iterator> reader(src.begin(), src.end());\n\n    char buffer[12] = \"abcdefg\";\n    REQUIRE(reader.readBytes(buffer, 4) == 4);\n    REQUIRE(reader.readBytes(buffer + 4, 4) == 2);\n\n    REQUIRE(buffer[0] == 'A');\n    REQUIRE(buffer[1] == 'B');\n    REQUIRE(buffer[2] == 'C');\n    REQUIRE(buffer[3] == 'D');\n    REQUIRE(buffer[4] == 'E');\n    REQUIRE(buffer[5] == 'F');\n    REQUIRE(buffer[6] == 'g');\n  }\n}\n\nclass StreamStub : public Stream {\n public:\n  StreamStub(const char* s) : stream_(s) {}\n\n  int read() {\n    return stream_.get();\n  }\n\n  size_t readBytes(char* buffer, size_t length) {\n    stream_.read(buffer, static_cast<std::streamsize>(length));\n    return static_cast<size_t>(stream_.gcount());\n  }\n\n private:\n  std::istringstream stream_;\n};\n\nTEST_CASE(\"Reader<Stream>\") {\n  SECTION(\"read()\") {\n    StreamStub src(\"\\x01\\xFF\");\n    Reader<StreamStub> reader(src);\n\n    REQUIRE(reader.read() == 0x01);\n    REQUIRE(reader.read() == 0xFF);\n    REQUIRE(reader.read() == -1);\n  }\n\n  SECTION(\"readBytes() all at once\") {\n    StreamStub src(\"ABC\");\n    Reader<StreamStub> reader(src);\n\n    char buffer[8] = \"abcd\";\n    REQUIRE(reader.readBytes(buffer, 4) == 3);\n\n    REQUIRE(buffer[0] == 'A');\n    REQUIRE(buffer[1] == 'B');\n    REQUIRE(buffer[2] == 'C');\n    REQUIRE(buffer[3] == 'd');\n  }\n\n  SECTION(\"readBytes() in two parts\") {\n    StreamStub src(\"ABCDEF\");\n    Reader<StreamStub> reader(src);\n\n    char buffer[12] = \"abcdefg\";\n    REQUIRE(reader.readBytes(buffer, 4) == 4);\n    REQUIRE(reader.readBytes(buffer + 4, 4) == 2);\n\n    REQUIRE(buffer[0] == 'A');\n    REQUIRE(buffer[1] == 'B');\n    REQUIRE(buffer[2] == 'C');\n    REQUIRE(buffer[3] == 'D');\n    REQUIRE(buffer[4] == 'E');\n    REQUIRE(buffer[5] == 'F');\n    REQUIRE(buffer[6] == 'g');\n  }\n}\n"
  },
  {
    "path": "extras/tests/Misc/StringAdapters.cpp",
    "content": "// ArduinoJson - https://arduinojson.org\n// Copyright © 2014-2025, Benoit BLANCHON\n// MIT License\n\n#include <Arduino.h>\n\n#include <ArduinoJson/Strings/IsString.hpp>\n#include <ArduinoJson/Strings/JsonString.hpp>\n#include <ArduinoJson/Strings/StringAdapters.hpp>\n\n#include <catch.hpp>\n\n#include \"custom_string.hpp\"\n#include \"weird_strcmp.hpp\"\n\nusing ArduinoJson::JsonString;\nusing namespace ArduinoJson::detail;\n\nTEST_CASE(\"adaptString()\") {\n  SECTION(\"string literal\") {\n    auto s = adaptString(\"bravo\\0alpha\");\n\n    CHECK(s.isNull() == false);\n    CHECK(s.size() == 5);\n  }\n\n  SECTION(\"null const char*\") {\n    auto s = adaptString(static_cast<const char*>(0));\n\n    CHECK(s.isNull() == true);\n    CHECK(s.size() == 0);\n  }\n\n  SECTION(\"non-null const char*\") {\n    const char* p = \"bravo\";\n    auto s = adaptString(p);\n\n    CHECK(s.isNull() == false);\n    CHECK(s.size() == 5);\n    CHECK(s.data() == p);\n  }\n\n  SECTION(\"null const char* + size\") {\n    auto s = adaptString(static_cast<const char*>(0), 10);\n\n    CHECK(s.isNull() == true);\n  }\n\n  SECTION(\"non-null const char* + size\") {\n    auto s = adaptString(\"bravo\", 5);\n\n    CHECK(s.isNull() == false);\n    CHECK(s.size() == 5);\n  }\n\n  SECTION(\"null Flash string\") {\n    auto s = adaptString(static_cast<const __FlashStringHelper*>(0));\n\n    CHECK(s.isNull() == true);\n    CHECK(s.size() == 0);\n  }\n\n  SECTION(\"non-null Flash string\") {\n    auto s = adaptString(F(\"bravo\"));\n\n    CHECK(s.isNull() == false);\n    CHECK(s.size() == 5);\n  }\n\n  SECTION(\"std::string\") {\n    std::string orig(\"bravo\");\n    auto s = adaptString(orig);\n\n    CHECK(s.isNull() == false);\n    CHECK(s.size() == 5);\n  }\n\n  SECTION(\"Arduino String\") {\n    ::String orig(\"bravo\");\n    auto s = adaptString(orig);\n\n    CHECK(s.isNull() == false);\n    CHECK(s.size() == 5);\n  }\n\n  SECTION(\"custom_string\") {\n    custom_string orig(\"bravo\");\n    auto s = adaptString(orig);\n\n    CHECK(s.isNull() == false);\n    CHECK(s.size() == 5);\n  }\n\n  SECTION(\"JsonString\") {\n    JsonString orig(\"hello\");\n    auto s = adaptString(orig);\n\n    CHECK(s.isNull() == false);\n    CHECK(s.size() == 5);\n  }\n}\n\nstruct EmptyStruct {};\n\nTEST_CASE(\"IsString<T>\") {\n  CHECK(IsString<std::string>::value == true);\n  CHECK(IsString<std::basic_string<wchar_t>>::value == false);\n  CHECK(IsString<custom_string>::value == true);\n  CHECK(IsString<const __FlashStringHelper*>::value == true);\n  CHECK(IsString<const char*>::value == true);\n  CHECK(IsString<const char[8]>::value == true);\n  CHECK(IsString<const char[]>::value == true);\n  CHECK(IsString<::String>::value == true);\n  CHECK(IsString<::StringSumHelper>::value == true);\n  CHECK(IsString<const EmptyStruct*>::value == false);\n  CHECK(IsString<JsonString>::value == true);\n}\n\nTEST_CASE(\"stringCompare\") {\n  SECTION(\"ZeroTerminatedRamString vs ZeroTerminatedRamString\") {\n    CHECK(stringCompare(adaptString(\"bravo\"), adaptString(\"alpha\")) > 0);\n    CHECK(stringCompare(adaptString(\"bravo\"), adaptString(\"bravo\")) == 0);\n    CHECK(stringCompare(adaptString(\"bravo\"), adaptString(\"charlie\")) < 0);\n  }\n\n  SECTION(\"ZeroTerminatedRamString vs SizedRamString\") {\n    CHECK(stringCompare(adaptString(\"bravo\"), adaptString(\"alpha?\", 5)) > 0);\n    CHECK(stringCompare(adaptString(\"bravo\"), adaptString(\"bravo?\", 4)) > 0);\n    CHECK(stringCompare(adaptString(\"bravo\"), adaptString(\"bravo?\", 5)) == 0);\n    CHECK(stringCompare(adaptString(\"bravo\"), adaptString(\"bravo?\", 6)) < 0);\n    CHECK(stringCompare(adaptString(\"bravo\"), adaptString(\"charlie?\", 7)) < 0);\n  }\n\n  SECTION(\"SizedRamString vs SizedRamString\") {\n    // clang-format off\n    CHECK(stringCompare(adaptString(\"bravo!\", 5), adaptString(\"alpha?\", 5)) > 0);\n    CHECK(stringCompare(adaptString(\"bravo!\", 5), adaptString(\"bravo?\", 5)) == 0);\n    CHECK(stringCompare(adaptString(\"bravo!\", 5), adaptString(\"charlie?\", 7)) < 0);\n\n    CHECK(stringCompare(adaptString(\"bravo!\", 5), adaptString(\"bravo!\", 4)) > 0);\n    CHECK(stringCompare(adaptString(\"bravo!\", 5), adaptString(\"bravo!\", 5)) == 0);\n    CHECK(stringCompare(adaptString(\"bravo!\", 5), adaptString(\"bravo!\", 6)) < 0);\n    // clang-format on\n  }\n\n  SECTION(\"FlashString vs FlashString\") {\n    // clang-format off\n    CHECK(stringCompare(adaptString(F(\"bravo\")), adaptString(F(\"alpha\"))) > 0);\n    CHECK(stringCompare(adaptString(F(\"bravo\")), adaptString(F(\"bravo\"))) == 0);\n    CHECK(stringCompare(adaptString(F(\"bravo\")), adaptString(F(\"charlie\"))) < 0);\n    // clang-format on\n  }\n\n  SECTION(\"FlashString vs SizedRamString\") {\n    // clang-format off\n    CHECK(stringCompare(adaptString(F(\"bravo\")), adaptString(\"alpha?\", 5)) > 0);\n    CHECK(stringCompare(adaptString(F(\"bravo\")), adaptString(\"bravo?\", 5)) == 0);\n    CHECK(stringCompare(adaptString(F(\"bravo\")), adaptString(\"charlie?\", 7)) < 0);\n\n    CHECK(stringCompare(adaptString(F(\"bravo\")), adaptString(\"bravo!\", 4)) > 0);\n    CHECK(stringCompare(adaptString(F(\"bravo\")), adaptString(\"bravo!\", 5)) == 0);\n    CHECK(stringCompare(adaptString(F(\"bravo\")), adaptString(\"bravo!\", 6)) < 0);\n    // clang-format on\n  }\n\n  SECTION(\"ZeroTerminatedRamString vs FlashString\") {\n    // clang-format off\n    CHECK(stringCompare(adaptString(\"bravo\"), adaptString(F(\"alpha?\"), 5)) > 0);\n    CHECK(stringCompare(adaptString(\"bravo\"), adaptString(F(\"bravo?\"), 4)) > 0);\n    CHECK(stringCompare(adaptString(\"bravo\"), adaptString(F(\"bravo?\"), 5)) == 0);\n    CHECK(stringCompare(adaptString(\"bravo\"), adaptString(F(\"bravo?\"), 6)) < 0);\n    CHECK(stringCompare(adaptString(\"bravo\"), adaptString(F(\"charlie?\"), 7)) < 0);\n    // clang-format on\n  }\n}\n\nTEST_CASE(\"stringEquals()\") {\n  SECTION(\"ZeroTerminatedRamString vs ZeroTerminatedRamString\") {\n    CHECK(stringEquals(adaptString(\"bravo\"), adaptString(\"brav\")) == false);\n    CHECK(stringEquals(adaptString(\"bravo\"), adaptString(\"bravo\")) == true);\n    CHECK(stringEquals(adaptString(\"bravo\"), adaptString(\"bravo!\")) == false);\n  }\n\n  SECTION(\"ZeroTerminatedRamString vs SizedRamString\") {\n    // clang-format off\n    CHECK(stringEquals(adaptString(\"bravo\"), adaptString(\"bravo!\", 4)) == false);\n    CHECK(stringEquals(adaptString(\"bravo\"), adaptString(\"bravo!\", 5)) == true);\n    CHECK(stringEquals(adaptString(\"bravo\"), adaptString(\"bravo!\", 6)) == false);\n    // clang-format on\n  }\n\n  SECTION(\"FlashString vs SizedRamString\") {\n    // clang-format off\n    CHECK(stringEquals(adaptString(F(\"bravo\")), adaptString(\"bravo!\", 4)) == false);\n    CHECK(stringEquals(adaptString(F(\"bravo\")), adaptString(\"bravo!\", 5)) == true);\n    CHECK(stringEquals(adaptString(F(\"bravo\")), adaptString(\"bravo!\", 6)) == false);\n    // clang-format on\n  }\n\n  SECTION(\"SizedRamString vs SizedRamString\") {\n    // clang-format off\n    CHECK(stringEquals(adaptString(\"bravo?\", 5), adaptString(\"bravo!\", 4)) == false);\n    CHECK(stringEquals(adaptString(\"bravo?\", 5), adaptString(\"bravo!\", 5)) == true);\n    CHECK(stringEquals(adaptString(\"bravo?\", 5), adaptString(\"bravo!\", 6)) == false);\n    // clang-format on\n  }\n}\n"
  },
  {
    "path": "extras/tests/Misc/StringWriter.cpp",
    "content": "// ArduinoJson - https://arduinojson.org\n// Copyright © 2014-2025, Benoit BLANCHON\n// MIT License\n\n#include <Arduino.h>\n\n#define ARDUINOJSON_STRING_BUFFER_SIZE 5\n#include <ArduinoJson.h>\n\n#include <catch.hpp>\n\n#include \"Literals.hpp\"\n#include \"custom_string.hpp\"\n\nusing namespace ArduinoJson::detail;\n\ntemplate <typename StringWriter>\nstatic size_t print(StringWriter& writer, const char* s) {\n  return writer.write(reinterpret_cast<const uint8_t*>(s), strlen(s));\n}\n\ntemplate <typename StringWriter>\nstatic size_t print(StringWriter& writer, char c) {\n  return writer.write(static_cast<uint8_t>(c));\n}\n\ntemplate <typename StringWriter, typename String>\nvoid common_tests(StringWriter& writer, const String& output) {\n  SECTION(\"InitialState\") {\n    REQUIRE(std::string(\"\") == output);\n  }\n\n  SECTION(\"EmptyString\") {\n    REQUIRE(0 == print(writer, \"\"));\n    REQUIRE(std::string(\"\") == output);\n  }\n\n  SECTION(\"OneString\") {\n    REQUIRE(4 == print(writer, \"ABCD\"));\n    REQUIRE(\"ABCD\"_s == output);\n  }\n\n  SECTION(\"TwoStrings\") {\n    REQUIRE(4 == print(writer, \"ABCD\"));\n    REQUIRE(4 == print(writer, \"EFGH\"));\n    REQUIRE(\"ABCDEFGH\"_s == output);\n  }\n}\n\nTEST_CASE(\"StaticStringWriter\") {\n  char output[20] = {0};\n  StaticStringWriter writer(output, sizeof(output));\n\n  common_tests(writer, static_cast<const char*>(output));\n\n  SECTION(\"OverCapacity\") {\n    REQUIRE(20 == print(writer, \"ABCDEFGHIJKLMNOPQRSTUVWXYZ\"));\n    REQUIRE(0 == print(writer, \"ABC\"));\n    REQUIRE(0 == print(writer, 'D'));\n    REQUIRE(\"ABCDEFGHIJKLMNOPQRST\" == std::string(output, 20));\n  }\n}\n\nTEST_CASE(\"Writer<std::string>\") {\n  std::string output;\n  Writer<std::string> writer(output);\n  common_tests(writer, output);\n}\n\nTEST_CASE(\"Writer<String>\") {\n  ::String output;\n  Writer<::String> writer(output);\n\n  SECTION(\"write(char)\") {\n    SECTION(\"writes to temporary buffer\") {\n      // accumulate in buffer\n      writer.write('a');\n      writer.write('b');\n      writer.write('c');\n      writer.write('d');\n      REQUIRE(output == \"\");\n\n      // flush when full\n      writer.write('e');\n      REQUIRE(output == \"abcd\");\n\n      // flush on destruction\n      writer.write('f');\n      writer.~Writer();\n      REQUIRE(output == \"abcdef\");\n    }\n\n    SECTION(\"returns 1 on success\") {\n      for (int i = 0; i < ARDUINOJSON_STRING_BUFFER_SIZE; i++) {\n        REQUIRE(writer.write('x') == 1);\n      }\n    }\n\n    SECTION(\"returns 0 on error\") {\n      output.limitCapacityTo(1);\n\n      REQUIRE(writer.write('a') == 1);\n      REQUIRE(writer.write('b') == 1);\n      REQUIRE(writer.write('c') == 1);\n      REQUIRE(writer.write('d') == 1);\n      REQUIRE(writer.write('e') == 0);\n      REQUIRE(writer.write('f') == 0);\n    }\n  }\n\n  SECTION(\"write(char*, size_t)\") {\n    SECTION(\"empty string\") {\n      REQUIRE(0 == print(writer, \"\"));\n      writer.flush();\n      REQUIRE(output == \"\");\n    }\n\n    SECTION(\"writes to temporary buffer\") {\n      // accumulate in buffer\n      print(writer, \"abc\");\n      REQUIRE(output == \"\");\n\n      // flush when full, and continue to accumulate\n      print(writer, \"de\");\n      REQUIRE(output == \"abcd\");\n\n      // flush on destruction\n      writer.~Writer();\n      REQUIRE(output == \"abcde\");\n    }\n  }\n}\n\nTEST_CASE(\"Writer<custom_string>\") {\n  custom_string output;\n  Writer<custom_string> writer(output);\n\n  REQUIRE(4 == print(writer, \"ABCD\"));\n  REQUIRE(\"ABCD\" == output);\n}\n\nTEST_CASE(\"serializeJson(doc, String)\") {\n  JsonDocument doc;\n  doc[\"hello\"] = \"world\";\n  ::String output = \"erase me\";\n\n  SECTION(\"sufficient capacity\") {\n    serializeJson(doc, output);\n    REQUIRE(output == \"{\\\"hello\\\":\\\"world\\\"}\");\n  }\n\n  SECTION(\"unsufficient capacity\") {  // issue #1561\n    output.limitCapacityTo(10);\n    serializeJson(doc, output);\n    REQUIRE(output == \"{\\\"hello\\\"\");\n  }\n}\n"
  },
  {
    "path": "extras/tests/Misc/TypeTraits.cpp",
    "content": "// ArduinoJson - https://arduinojson.org\n// Copyright © 2014-2025, Benoit BLANCHON\n// MIT License\n\n#include <ArduinoJson.h>\n#include <catch.hpp>\n\n#include <sstream>\n\nusing namespace ArduinoJson::detail;\n\nclass EmptyClass {};\nenum EmptyEnum {};\n\nTEST_CASE(\"Polyfills/type_traits\") {\n  SECTION(\"is_base_of\") {\n    REQUIRE_FALSE(\n        static_cast<bool>(is_base_of<std::istream, std::ostringstream>::value));\n    REQUIRE(\n        static_cast<bool>(is_base_of<std::istream, std::istringstream>::value));\n  }\n\n  SECTION(\"is_array\") {\n    REQUIRE_FALSE(is_array<const char*>::value);\n    REQUIRE(is_array<const char[]>::value);\n    REQUIRE(is_array<const char[10]>::value);\n  }\n\n  SECTION(\"is_const\") {\n    CHECK(is_const<char>::value == false);\n    CHECK(is_const<const char>::value == true);\n  }\n\n  SECTION(\"is_integral\") {\n    CHECK(is_integral<double>::value == false);\n    CHECK(is_integral<float>::value == false);\n    CHECK(is_integral<const double>::value == false);\n    CHECK(is_integral<const float>::value == false);\n    CHECK(is_integral<volatile double>::value == false);\n    CHECK(is_integral<volatile float>::value == false);\n    CHECK(is_integral<const volatile double>::value == false);\n    CHECK(is_integral<const volatile float>::value == false);\n\n    CHECK(is_integral<bool>::value == true);\n    CHECK(is_integral<char>::value == true);\n    CHECK(is_integral<signed char>::value == true);\n    CHECK(is_integral<signed int>::value == true);\n    CHECK(is_integral<signed long>::value == true);\n    CHECK(is_integral<signed short>::value == true);\n    CHECK(is_integral<unsigned char>::value == true);\n    CHECK(is_integral<unsigned int>::value == true);\n    CHECK(is_integral<unsigned long>::value == true);\n    CHECK(is_integral<unsigned short>::value == true);\n    CHECK(is_integral<const bool>::value == true);\n    CHECK(is_integral<const char>::value == true);\n    CHECK(is_integral<const signed char>::value == true);\n    CHECK(is_integral<const signed int>::value == true);\n    CHECK(is_integral<const signed long>::value == true);\n    CHECK(is_integral<const signed short>::value == true);\n    CHECK(is_integral<const unsigned char>::value == true);\n    CHECK(is_integral<const unsigned int>::value == true);\n    CHECK(is_integral<const unsigned long>::value == true);\n    CHECK(is_integral<const unsigned short>::value == true);\n    CHECK(is_integral<volatile bool>::value == true);\n    CHECK(is_integral<volatile char>::value == true);\n    CHECK(is_integral<volatile signed char>::value == true);\n    CHECK(is_integral<volatile signed int>::value == true);\n    CHECK(is_integral<volatile signed long>::value == true);\n    CHECK(is_integral<volatile signed short>::value == true);\n    CHECK(is_integral<volatile unsigned char>::value == true);\n    CHECK(is_integral<volatile unsigned int>::value == true);\n    CHECK(is_integral<volatile unsigned long>::value == true);\n    CHECK(is_integral<volatile unsigned short>::value == true);\n    CHECK(is_integral<const volatile bool>::value == true);\n    CHECK(is_integral<const volatile char>::value == true);\n    CHECK(is_integral<const volatile signed char>::value == true);\n    CHECK(is_integral<const volatile signed int>::value == true);\n    CHECK(is_integral<const volatile signed long>::value == true);\n    CHECK(is_integral<const volatile signed short>::value == true);\n    CHECK(is_integral<const volatile unsigned char>::value == true);\n    CHECK(is_integral<const volatile unsigned int>::value == true);\n    CHECK(is_integral<const volatile unsigned long>::value == true);\n    CHECK(is_integral<const volatile unsigned short>::value == true);\n\n    CHECK(is_integral<JsonUInt>::value == true);\n  }\n\n  SECTION(\"is_signed\") {\n    CHECK(is_signed<char>::value == true);\n    CHECK(is_signed<signed char>::value == true);\n    CHECK(is_signed<signed int>::value == true);\n    CHECK(is_signed<signed short>::value == true);\n    CHECK(is_signed<signed long>::value == true);\n    CHECK(is_signed<float>::value == true);\n    CHECK(is_signed<double>::value == true);\n    CHECK(is_signed<bool>::value == false);\n\n    CHECK(is_signed<const char>::value == true);\n    CHECK(is_signed<const signed char>::value == true);\n    CHECK(is_signed<const signed int>::value == true);\n    CHECK(is_signed<const signed short>::value == true);\n    CHECK(is_signed<const signed long>::value == true);\n    CHECK(is_signed<const float>::value == true);\n    CHECK(is_signed<const double>::value == true);\n    CHECK(is_signed<const bool>::value == false);\n\n    CHECK(is_signed<volatile char>::value == true);\n    CHECK(is_signed<volatile signed char>::value == true);\n    CHECK(is_signed<volatile signed int>::value == true);\n    CHECK(is_signed<volatile signed short>::value == true);\n    CHECK(is_signed<volatile signed long>::value == true);\n    CHECK(is_signed<volatile float>::value == true);\n    CHECK(is_signed<volatile double>::value == true);\n    CHECK(is_signed<volatile bool>::value == false);\n\n    CHECK(is_signed<const volatile char>::value == true);\n    CHECK(is_signed<const volatile signed char>::value == true);\n    CHECK(is_signed<const volatile signed int>::value == true);\n    CHECK(is_signed<const volatile signed short>::value == true);\n    CHECK(is_signed<const volatile signed long>::value == true);\n    CHECK(is_signed<const volatile float>::value == true);\n    CHECK(is_signed<const volatile double>::value == true);\n    CHECK(is_signed<const volatile bool>::value == false);\n  }\n\n  SECTION(\"is_unsigned\") {\n    CHECK(is_unsigned<unsigned char>::value == true);\n    CHECK(is_unsigned<unsigned int>::value == true);\n    CHECK(is_unsigned<unsigned short>::value == true);\n    CHECK(is_unsigned<unsigned long>::value == true);\n    CHECK(is_unsigned<bool>::value == true);\n    CHECK(is_unsigned<char>::value == false);\n    CHECK(is_unsigned<float>::value == false);\n    CHECK(is_unsigned<double>::value == false);\n\n    CHECK(is_unsigned<const unsigned char>::value == true);\n    CHECK(is_unsigned<const unsigned int>::value == true);\n    CHECK(is_unsigned<const unsigned short>::value == true);\n    CHECK(is_unsigned<const unsigned long>::value == true);\n    CHECK(is_unsigned<const bool>::value == true);\n    CHECK(is_unsigned<const char>::value == false);\n    CHECK(is_unsigned<const float>::value == false);\n    CHECK(is_unsigned<const double>::value == false);\n\n    CHECK(is_unsigned<volatile unsigned char>::value == true);\n    CHECK(is_unsigned<volatile unsigned int>::value == true);\n    CHECK(is_unsigned<volatile unsigned short>::value == true);\n    CHECK(is_unsigned<volatile unsigned long>::value == true);\n    CHECK(is_unsigned<volatile bool>::value == true);\n    CHECK(is_unsigned<volatile char>::value == false);\n    CHECK(is_unsigned<volatile float>::value == false);\n    CHECK(is_unsigned<volatile double>::value == false);\n\n    CHECK(is_unsigned<const volatile unsigned char>::value == true);\n    CHECK(is_unsigned<const volatile unsigned int>::value == true);\n    CHECK(is_unsigned<const volatile unsigned short>::value == true);\n    CHECK(is_unsigned<const volatile unsigned long>::value == true);\n    CHECK(is_unsigned<const volatile bool>::value == true);\n    CHECK(is_unsigned<const volatile char>::value == false);\n    CHECK(is_unsigned<const volatile float>::value == false);\n    CHECK(is_unsigned<const volatile double>::value == false);\n  }\n\n  SECTION(\"is_floating_point\") {\n    CHECK(is_floating_point<int>::value == false);\n    CHECK(is_floating_point<float>::value == true);\n    CHECK(is_floating_point<double>::value == true);\n    CHECK(is_floating_point<const float>::value == true);\n    CHECK(is_floating_point<const double>::value == true);\n    CHECK(is_floating_point<volatile float>::value == true);\n    CHECK(is_floating_point<volatile double>::value == true);\n    CHECK(is_floating_point<const volatile float>::value == true);\n    CHECK(is_floating_point<const volatile double>::value == true);\n  }\n\n  SECTION(\"is_convertible\") {\n    CHECK(is_convertible<short, int>::value == true);\n    CHECK(is_convertible<int, int>::value == true);\n    CHECK(is_convertible<EmptyEnum, int>::value == true);\n    CHECK(is_convertible<int*, int>::value == false);\n    CHECK(is_convertible<EmptyClass, int>::value == false);\n\n    CHECK(is_convertible<DeserializationError, JsonVariantConst>::value ==\n          false);\n    CHECK(is_convertible<JsonPair, JsonVariantConst>::value == false);\n    CHECK(is_convertible<JsonVariant, JsonVariantConst>::value == true);\n    CHECK(is_convertible<JsonVariantConst, JsonVariantConst>::value == true);\n    CHECK(is_convertible<JsonArray, JsonVariantConst>::value == true);\n    CHECK(is_convertible<ElementProxy<JsonArray>, JsonVariantConst>::value ==\n          true);\n    CHECK(is_convertible<JsonArrayConst, JsonVariantConst>::value == true);\n    CHECK(is_convertible<JsonObject, JsonVariantConst>::value == true);\n    CHECK(is_convertible<MemberProxy<JsonObject, const char*>,\n                         JsonVariantConst>::value == true);\n    CHECK(is_convertible<JsonObjectConst, JsonVariantConst>::value == true);\n    CHECK(is_convertible<JsonDocument, JsonVariantConst>::value == true);\n  }\n\n  SECTION(\"is_class\") {\n    CHECK(is_class<int>::value == false);\n    CHECK(is_class<EmptyEnum>::value == false);\n    CHECK(is_class<int*>::value == false);\n    CHECK(is_class<EmptyClass>::value == true);\n  }\n\n  SECTION(\"is_enum\") {\n    CHECK(is_enum<int>::value == false);\n    CHECK(is_enum<EmptyEnum>::value == true);\n    CHECK(is_enum<int*>::value == false);\n    CHECK(is_enum<EmptyClass>::value == false);\n    CHECK(is_enum<bool>::value == false);\n    CHECK(is_enum<double>::value == false);\n  }\n\n  SECTION(\"remove_cv\") {\n    CHECK(is_same<remove_cv_t<const int>, int>::value);\n    CHECK(is_same<remove_cv_t<volatile int>, int>::value);\n    CHECK(is_same<remove_cv_t<const volatile int>, int>::value);\n    CHECK(is_same<remove_cv_t<int>, int>::value);\n    CHECK(is_same<remove_cv_t<decltype(\"toto\")>, decltype(\"toto\")>::value);\n  }\n\n  SECTION(\"decay\") {\n    CHECK(is_same<decay_t<int>, int>::value);\n    CHECK(is_same<decay_t<int&>, int>::value);\n    CHECK(is_same<decay_t<int&&>, int>::value);\n    CHECK(is_same<decay_t<int[]>, int*>::value);\n    CHECK(is_same<decay_t<int[10]>, int*>::value);\n    CHECK(is_same<decay_t<decltype(\"toto\")>, const char*>::value);\n  }\n}\n\nTEST_CASE(\"is_std_string\") {\n  REQUIRE(is_std_string<std::string>::value == true);\n  REQUIRE(is_std_string<EmptyClass>::value == false);\n}\n"
  },
  {
    "path": "extras/tests/Misc/Utf16.cpp",
    "content": "// ArduinoJson - https://arduinojson.org\n// Copyright © 2014-2025, Benoit BLANCHON\n// MIT License\n\n#include <ArduinoJson/Json/Utf16.hpp>\n#include <catch.hpp>\n\nusing namespace ArduinoJson::detail;\n\nstatic void testUtf16Codepoint(uint16_t codeunit, uint32_t expectedCodepoint) {\n  Utf16::Codepoint cp;\n  REQUIRE(cp.append(codeunit) == true);\n  REQUIRE(cp.value() == expectedCodepoint);\n}\n\nstatic void testUtf16Codepoint(uint16_t codeunit1, uint16_t codeunit2,\n                               uint32_t expectedCodepoint) {\n  Utf16::Codepoint cp;\n  REQUIRE(cp.append(codeunit1) == false);\n  REQUIRE(cp.append(codeunit2) == true);\n  REQUIRE(cp.value() == expectedCodepoint);\n}\n\nTEST_CASE(\"Utf16::Codepoint()\") {\n  SECTION(\"U+0000\") {\n    testUtf16Codepoint(0x0000, 0x000000);\n  }\n\n  SECTION(\"U+0001\") {\n    testUtf16Codepoint(0x0001, 0x000001);\n  }\n\n  SECTION(\"U+D7FF\") {\n    testUtf16Codepoint(0xD7FF, 0x00D7FF);\n  }\n\n  SECTION(\"U+E000\") {\n    testUtf16Codepoint(0xE000, 0x00E000);\n  }\n\n  SECTION(\"U+FFFF\") {\n    testUtf16Codepoint(0xFFFF, 0x00FFFF);\n  }\n\n  SECTION(\"U+010000\") {\n    testUtf16Codepoint(0xD800, 0xDC00, 0x010000);\n  }\n\n  SECTION(\"U+010001\") {\n    testUtf16Codepoint(0xD800, 0xDC01, 0x010001);\n  }\n\n  SECTION(\"U+0103FF\") {\n    testUtf16Codepoint(0xD800, 0xDFFF, 0x0103FF);\n  }\n\n  SECTION(\"U+010400\") {\n    testUtf16Codepoint(0xD801, 0xDC00, 0x010400);\n  }\n\n  SECTION(\"U+010400\") {\n    testUtf16Codepoint(0xDBFF, 0xDC00, 0x10FC00);\n  }\n\n  SECTION(\"U+10FFFF\") {\n    testUtf16Codepoint(0xDBFF, 0xDFFF, 0x10FFFF);\n  }\n}\n"
  },
  {
    "path": "extras/tests/Misc/Utf8.cpp",
    "content": "// ArduinoJson - https://arduinojson.org\n// Copyright © 2014-2025, Benoit BLANCHON\n// MIT License\n\n#include <ArduinoJson.h>\n#include <catch.hpp>\n\n#include <string>\n\nusing namespace ArduinoJson::detail;\n\nstatic void testCodepoint(uint32_t codepoint, std::string expected) {\n  ResourceManager resources;\n  StringBuilder str(&resources);\n  str.startString();\n\n  CAPTURE(codepoint);\n  Utf8::encodeCodepoint(codepoint, str);\n\n  REQUIRE(str.str().c_str() == expected);\n}\n\nTEST_CASE(\"Utf8::encodeCodepoint()\") {\n  SECTION(\"U+0000\") {\n    testCodepoint(0x0000, \"\");\n  }\n\n  SECTION(\"U+0001\") {\n    testCodepoint(0x0001, \"\\x01\");\n  }\n\n  SECTION(\"U+007F\") {\n    testCodepoint(0x007F, \"\\x7f\");\n  }\n\n  SECTION(\"U+0080\") {\n    testCodepoint(0x0080, \"\\xc2\\x80\");\n  }\n\n  SECTION(\"U+07FF\") {\n    testCodepoint(0x07FF, \"\\xdf\\xbf\");\n  }\n\n  SECTION(\"U+0800\") {\n    testCodepoint(0x0800, \"\\xe0\\xa0\\x80\");\n  }\n\n  SECTION(\"U+FFFF\") {\n    testCodepoint(0xFFFF, \"\\xef\\xbf\\xbf\");\n  }\n\n  SECTION(\"U+10000\") {\n    testCodepoint(0x10000, \"\\xf0\\x90\\x80\\x80\");\n  }\n\n  SECTION(\"U+10FFFF\") {\n    testCodepoint(0x10FFFF, \"\\xf4\\x8f\\xbf\\xbf\");\n  }\n}\n"
  },
  {
    "path": "extras/tests/Misc/arithmeticCompare.cpp",
    "content": "// ArduinoJson - https://arduinojson.org\n// Copyright © 2014-2025, Benoit BLANCHON\n// MIT License\n\n#include <ArduinoJson/Numbers/arithmeticCompare.hpp>\n#include <catch.hpp>\n\nusing namespace ArduinoJson::detail;\n\nTEST_CASE(\"arithmeticCompare()\") {\n  SECTION(\"int vs uint8_t\") {\n    CHECK(arithmeticCompare<int, uint8_t>(256, 1) == COMPARE_RESULT_GREATER);\n    CHECK(arithmeticCompare<int, uint8_t>(41, 42) == COMPARE_RESULT_LESS);\n    CHECK(arithmeticCompare<int, uint8_t>(42, 42) == COMPARE_RESULT_EQUAL);\n    CHECK(arithmeticCompare<int, uint8_t>(43, 42) == COMPARE_RESULT_GREATER);\n  }\n\n  SECTION(\"unsigned vs int\") {\n    CHECK(arithmeticCompare<unsigned, int>(0, -1) == COMPARE_RESULT_GREATER);\n    CHECK(arithmeticCompare<unsigned, int>(42, 41) == COMPARE_RESULT_GREATER);\n    CHECK(arithmeticCompare<unsigned, int>(42, 42) == COMPARE_RESULT_EQUAL);\n    CHECK(arithmeticCompare<unsigned, int>(42, 43) == COMPARE_RESULT_LESS);\n  }\n\n  SECTION(\"float vs int\") {\n    CHECK(arithmeticCompare<float, int>(42, 41) == COMPARE_RESULT_GREATER);\n    CHECK(arithmeticCompare<float, int>(42, 42) == COMPARE_RESULT_EQUAL);\n    CHECK(arithmeticCompare<float, int>(42, 43) == COMPARE_RESULT_LESS);\n  }\n\n  SECTION(\"int vs unsigned\") {\n    CHECK(arithmeticCompare<int, unsigned>(-1, 0) == COMPARE_RESULT_LESS);\n    CHECK(arithmeticCompare<int, unsigned>(0, 0) == COMPARE_RESULT_EQUAL);\n    CHECK(arithmeticCompare<int, unsigned>(1, 0) == COMPARE_RESULT_GREATER);\n    CHECK(arithmeticCompare<int, unsigned>(42, 41) == COMPARE_RESULT_GREATER);\n    CHECK(arithmeticCompare<int, unsigned>(42, 42) == COMPARE_RESULT_EQUAL);\n    CHECK(arithmeticCompare<int, unsigned>(42, 43) == COMPARE_RESULT_LESS);\n  }\n\n  SECTION(\"unsigned vs unsigned\") {\n    CHECK(arithmeticCompare<unsigned, unsigned>(42, 41) ==\n          COMPARE_RESULT_GREATER);\n    CHECK(arithmeticCompare<unsigned, unsigned>(42, 42) ==\n          COMPARE_RESULT_EQUAL);\n    CHECK(arithmeticCompare<unsigned, unsigned>(42, 43) == COMPARE_RESULT_LESS);\n  }\n\n  SECTION(\"bool vs bool\") {\n    CHECK(arithmeticCompare<bool, bool>(false, false) == COMPARE_RESULT_EQUAL);\n    CHECK(arithmeticCompare<bool, bool>(true, true) == COMPARE_RESULT_EQUAL);\n    CHECK(arithmeticCompare<bool, bool>(false, true) == COMPARE_RESULT_LESS);\n    CHECK(arithmeticCompare<bool, bool>(true, false) == COMPARE_RESULT_GREATER);\n  }\n\n  SECTION(\"bool vs int\") {\n    CHECK(arithmeticCompare<bool, int>(false, -1) == COMPARE_RESULT_GREATER);\n    CHECK(arithmeticCompare<bool, int>(false, 0) == COMPARE_RESULT_EQUAL);\n    CHECK(arithmeticCompare<bool, int>(false, 1) == COMPARE_RESULT_LESS);\n    CHECK(arithmeticCompare<bool, int>(true, 0) == COMPARE_RESULT_GREATER);\n    CHECK(arithmeticCompare<bool, int>(true, 1) == COMPARE_RESULT_EQUAL);\n    CHECK(arithmeticCompare<bool, int>(true, 2) == COMPARE_RESULT_LESS);\n  }\n\n  SECTION(\"bool vs int\") {\n    CHECK(arithmeticCompare<int, bool>(0, false) == COMPARE_RESULT_EQUAL);\n    CHECK(arithmeticCompare<int, bool>(1, true) == COMPARE_RESULT_EQUAL);\n    CHECK(arithmeticCompare<int, bool>(1, false) == COMPARE_RESULT_GREATER);\n    CHECK(arithmeticCompare<int, bool>(0, true) == COMPARE_RESULT_LESS);\n  }\n}\n\nTEST_CASE(\"arithmeticCompareNegateLeft()\") {\n  SECTION(\"unsigned vs int\") {\n    CHECK(arithmeticCompareNegateLeft<int>(0, 1) == COMPARE_RESULT_LESS);\n    CHECK(arithmeticCompareNegateLeft<int>(42, -41) == COMPARE_RESULT_LESS);\n    CHECK(arithmeticCompareNegateLeft<int>(42, -42) == COMPARE_RESULT_EQUAL);\n    CHECK(arithmeticCompareNegateLeft<int>(42, -43) == COMPARE_RESULT_GREATER);\n  }\n\n  SECTION(\"unsigned vs unsigned\") {\n    CHECK(arithmeticCompareNegateLeft<unsigned>(42, 42) == COMPARE_RESULT_LESS);\n  }\n}\n\nTEST_CASE(\"arithmeticCompareNegateRight()\") {\n  SECTION(\"int vs unsigned\") {\n    CHECK(arithmeticCompareNegateRight<int>(1, 0) == COMPARE_RESULT_GREATER);\n    CHECK(arithmeticCompareNegateRight<int>(-41, 42) == COMPARE_RESULT_GREATER);\n    CHECK(arithmeticCompareNegateRight<int>(-42, 42) == COMPARE_RESULT_EQUAL);\n    CHECK(arithmeticCompareNegateRight<int>(-43, 42) == COMPARE_RESULT_LESS);\n  }\n\n  SECTION(\"unsigned vs unsigned\") {\n    CHECK(arithmeticCompareNegateRight<unsigned>(42, 42) ==\n          COMPARE_RESULT_GREATER);\n  }\n}\n"
  },
  {
    "path": "extras/tests/Misc/conflicts.cpp",
    "content": "// ArduinoJson - https://arduinojson.org\n// Copyright © 2014-2025, Benoit BLANCHON\n// MIT License\n\n// Include any header that might use the conflicting macros\n#include <cmath>\n#include <iostream>\n#include <string>\n\n// All cores\n#define bit()\n#define constrain()\n#define DEFAULT\n#define DISABLED\n#define HIGH\n#define INPUT\n#define LOW\n#define max()\n#define min()\n#define OUTPUT\n#define round()\n#define sq()\n#define word()\n#define bitRead()\n#define bitSet()\n#define bitClear()\n#define bitWrite()\n#define interrupts()\n#define lowByte()\n#define highByte()\n#define DEC\n#define HEX\n#define OCT\n#define BIN\n#define cbi()\n#define sbi()\n\n// ESP8266\n#define _max()\n#define _min()\n\n// Realtek Ameba\n#define isdigit(c) (((c) >= '0') && ((c) <= '9'))\n#define isprint(c)\n#define isxdigit(c)\n#define isspace(c)\n#define isupper(c)\n#define islower(c)\n#define isalpha(c)\n\n// issue #839\n#define BLOCKSIZE\n#define CAPACITY\n\n// issue #1905\n#define _current\n\n// issue #1914\n#define V7 7\n\n// STM32, Mbed, Particle\n#define A0 16\n#define A1 17\n#define A2 18\n\n// catch.hpp mutes several warnings, this file also allows to detect them\n#include \"ArduinoJson.h\"\n"
  },
  {
    "path": "extras/tests/Misc/custom_string.hpp",
    "content": "// ArduinoJson - https://arduinojson.org\n// Copyright © 2014-2025, Benoit BLANCHON\n// MIT License\n\n#pragma once\n\n#include <string>\n\nstruct custom_char_traits : std::char_traits<char> {};\n\nusing custom_string = std::basic_string<char, custom_char_traits>;\n"
  },
  {
    "path": "extras/tests/Misc/issue1967.cpp",
    "content": "// ArduinoJson - https://arduinojson.org\n// Copyright © 2014-2025, Benoit BLANCHON\n// MIT License\n\n// we expect ArduinoJson.h to include <string>\n#define ARDUINOJSON_ENABLE_STD_STRING 1\n\n// but we don't want it to included accidentally\n#undef ARDUINO\n#define ARDUINOJSON_ENABLE_STD_STREAM 0\n#define ARDUINOJSON_ENABLE_STRING_VIEW 0\n\n#include <ArduinoJson.h>\n"
  },
  {
    "path": "extras/tests/Misc/issue2129.cpp",
    "content": "// ArduinoJson - https://arduinojson.org\n// Copyright © 2014-2025, Benoit BLANCHON\n// MIT License\n\n#include <ArduinoJson.h>\n#include <catch.hpp>\n\ntemplate <typename T>\nclass Nullable {\n public:\n  Nullable() : value_{} {}\n  Nullable(T value) : value_{value} {}\n\n  operator T() const {\n    return value_;\n  }\n\n  operator T&() {\n    return value_;\n  }\n\n  bool is_valid() const {\n    return value_ != invalid_value_;\n  }\n\n  T value() const {\n    return value_;\n  }\n\n private:\n  T value_;\n  static T invalid_value_;\n};\n\ntemplate <>\nfloat Nullable<float>::invalid_value_ = std::numeric_limits<float>::lowest();\n\ntemplate <typename T>\nvoid convertToJson(const Nullable<T>& src, JsonVariant dst) {\n  if (src.is_valid()) {\n    dst.set(src.value());\n  } else {\n    dst.clear();\n  }\n}\n\nTEST_CASE(\"Issue #2129\") {\n  Nullable<float> nullable_value = Nullable<float>{123.4f};\n\n  JsonDocument doc;\n\n  doc[\"value\"] = nullable_value;\n\n  REQUIRE(doc[\"value\"].as<float>() == Approx(123.4f));\n}\n"
  },
  {
    "path": "extras/tests/Misc/issue2166.cpp",
    "content": "// ArduinoJson - https://arduinojson.org\n// Copyright © 2014-2025, Benoit BLANCHON\n// MIT License\n\n#include <ArduinoJson.h>\n#include <catch.hpp>\n\nstruct CCLASS {\n  static const char mszKey[];\n};\n\nTEST_CASE(\"Issue #2166\") {\n  JsonDocument doc;\n  doc[CCLASS::mszKey] = 12;\n  REQUIRE(doc.as<std::string>() == \"{\\\"test3\\\":12}\");\n\n  JsonObject obj = doc.to<JsonObject>();\n  obj[CCLASS::mszKey] = 12;\n  REQUIRE(doc.as<std::string>() == \"{\\\"test3\\\":12}\");\n}\n\nconst char CCLASS::mszKey[] = \"test3\";\n"
  },
  {
    "path": "extras/tests/Misc/issue2181.cpp",
    "content": "// ArduinoJson - https://arduinojson.org\n// Copyright © 2014-2025, Benoit BLANCHON\n// MIT License\n\n#define true 0x1\n#define false 0x0\n\n#include <ArduinoJson.h>\n#include <catch.hpp>\n\nTEST_CASE(\"Issue #2181\") {\n  JsonDocument doc;\n  doc[\"hello\"] = \"world\";\n  REQUIRE(doc.as<std::string>() == \"{\\\"hello\\\":\\\"world\\\"}\");\n}\n"
  },
  {
    "path": "extras/tests/Misc/printable.cpp",
    "content": "// ArduinoJson - https://arduinojson.org\n// Copyright © 2014-2025, Benoit BLANCHON\n// MIT License\n\n#include <Arduino.h>\n#include <catch.hpp>\n\n#define ARDUINOJSON_ENABLE_ARDUINO_STREAM 1\n#include <ArduinoJson.h>\n\n#include \"Allocators.hpp\"\n\nusing ArduinoJson::detail::sizeofArray;\n\nstruct PrintOneCharacterAtATime {\n  static size_t printStringTo(const std::string& s, Print& p) {\n    size_t result = 0;\n    for (std::string::const_iterator it = s.begin(); it != s.end(); ++it) {\n      size_t n = p.write(uint8_t(*it));\n      if (n == 0)\n        break;\n      result += n;\n    }\n    return result;\n  }\n};\n\nstruct PrintAllAtOnce {\n  static size_t printStringTo(const std::string& s, Print& p) {\n    return p.write(s.data(), s.size());\n  }\n};\n\ntemplate <typename PrintPolicy>\nstruct PrintableString : public Printable {\n  PrintableString(const char* s) : str_(s), total_(0) {}\n\n  virtual size_t printTo(Print& p) const {\n    size_t result = PrintPolicy::printStringTo(str_, p);\n    total_ += result;\n    return result;\n  }\n\n  size_t totalBytesWritten() const {\n    return total_;\n  }\n\n private:\n  std::string str_;\n  mutable size_t total_;\n};\n\nTEST_CASE(\"Printable\") {\n  SECTION(\"Doesn't overflow\") {\n    SpyingAllocator spy;\n    JsonDocument doc(&spy);\n    const char* value = \"example\";\n\n    doc.set(666);  // to make sure we override the value\n\n    SECTION(\"Via Print::write(char)\") {\n      PrintableString<PrintOneCharacterAtATime> printable(value);\n      CHECK(doc.set(printable) == true);\n      CHECK(doc.as<std::string>() == value);\n      CHECK(printable.totalBytesWritten() == 7);\n      CHECK(doc.overflowed() == false);\n      CHECK(spy.log() ==\n            AllocatorLog{\n                Allocate(sizeofStringBuffer()),\n                Reallocate(sizeofStringBuffer(), sizeofString(\"example\")),\n            });\n    }\n\n    SECTION(\"Via Print::write(const char* size_t)\") {\n      PrintableString<PrintAllAtOnce> printable(value);\n      CHECK(doc.set(printable) == true);\n      CHECK(doc.as<std::string>() == value);\n      CHECK(printable.totalBytesWritten() == 7);\n      CHECK(doc.overflowed() == false);\n      CHECK(spy.log() ==\n            AllocatorLog{\n                Allocate(sizeofStringBuffer()),\n                Reallocate(sizeofStringBuffer(), sizeofString(\"example\")),\n            });\n    }\n  }\n\n  SECTION(\"First allocation fails\") {\n    SpyingAllocator spy(FailingAllocator::instance());\n    JsonDocument doc(&spy);\n    const char* value = \"hello world\";\n\n    doc.set(666);  // to make sure we override the value\n\n    SECTION(\"Via Print::write(char)\") {\n      PrintableString<PrintOneCharacterAtATime> printable(value);\n\n      bool success = doc.set(printable);\n\n      CHECK(success == false);\n      CHECK(doc.isNull());\n      CHECK(printable.totalBytesWritten() == 0);\n      CHECK(doc.overflowed() == true);\n      CHECK(spy.log() == AllocatorLog{\n                             AllocateFail(sizeofStringBuffer()),\n                         });\n    }\n\n    SECTION(\"Via Print::write(const char*, size_t)\") {\n      PrintableString<PrintAllAtOnce> printable(value);\n\n      bool success = doc.set(printable);\n\n      CHECK(success == false);\n      CHECK(doc.isNull());\n      CHECK(printable.totalBytesWritten() == 0);\n      CHECK(doc.overflowed() == true);\n      CHECK(spy.log() == AllocatorLog{\n                             AllocateFail(sizeofStringBuffer()),\n                         });\n    }\n  }\n\n  SECTION(\"Reallocation fails\") {\n    TimebombAllocator timebomb(1);\n    SpyingAllocator spy(&timebomb);\n    JsonDocument doc(&spy);\n    const char* value = \"Lorem ipsum dolor sit amet, cons\";  // > 31 chars\n\n    doc.set(666);  // to make sure we override the value\n\n    SECTION(\"Via Print::write(char)\") {\n      PrintableString<PrintOneCharacterAtATime> printable(value);\n\n      bool success = doc.set(printable);\n\n      CHECK(success == false);\n      CHECK(doc.isNull());\n      CHECK(printable.totalBytesWritten() == 31);\n      CHECK(doc.overflowed() == true);\n      CHECK(spy.log() ==\n            AllocatorLog{\n                Allocate(sizeofStringBuffer()),\n                ReallocateFail(sizeofStringBuffer(), sizeofStringBuffer(2)),\n                Deallocate(sizeofStringBuffer()),\n            });\n    }\n\n    SECTION(\"Via Print::write(const char*, size_t)\") {\n      PrintableString<PrintAllAtOnce> printable(value);\n\n      bool success = doc.set(printable);\n\n      CHECK(success == false);\n      CHECK(doc.isNull());\n      CHECK(printable.totalBytesWritten() == 31);\n      CHECK(doc.overflowed() == true);\n      CHECK(spy.log() ==\n            AllocatorLog{\n                Allocate(sizeofStringBuffer()),\n                ReallocateFail(sizeofStringBuffer(), sizeofStringBuffer(2)),\n                Deallocate(sizeofStringBuffer()),\n            });\n    }\n  }\n\n  SECTION(\"Null variant\") {\n    JsonVariant var;\n    PrintableString<PrintOneCharacterAtATime> printable = \"Hello World!\";\n    CHECK(var.set(printable) == false);\n    CHECK(var.isNull());\n    CHECK(printable.totalBytesWritten() == 0);\n  }\n\n  SECTION(\"String deduplication\") {\n    SpyingAllocator spy;\n    JsonDocument doc(&spy);\n    doc.add(PrintableString<PrintOneCharacterAtATime>(\"Hello World!\"));\n    doc.add(PrintableString<PrintAllAtOnce>(\"Hello World!\"));\n    REQUIRE(doc.size() == 2);\n    CHECK(doc[0] == \"Hello World!\");\n    CHECK(doc[1] == \"Hello World!\");\n    CHECK(spy.log() ==\n          AllocatorLog{\n              Allocate(sizeofPool()),\n              Allocate(sizeofStringBuffer()),\n              Reallocate(sizeofStringBuffer(), sizeofString(\"Hello World!\")),\n              Allocate(sizeofStringBuffer()),\n              Deallocate(sizeofStringBuffer()),\n          });\n  }\n}\n"
  },
  {
    "path": "extras/tests/Misc/unsigned_char.cpp",
    "content": "// ArduinoJson - https://arduinojson.org\n// Copyright © 2014-2025, Benoit BLANCHON\n// MIT License\n\n#include <ArduinoJson.h>\n#include <catch.hpp>\n\n#include \"Literals.hpp\"\n\n#if defined(__clang__)\n#  define CONFLICTS_WITH_BUILTIN_OPERATOR\n#endif\n\nTEST_CASE(\"unsigned char[]\") {\n  SECTION(\"deserializeJson()\") {\n    unsigned char input[] = \"{\\\"a\\\":42}\";\n\n    JsonDocument doc;\n    DeserializationError err = deserializeJson(doc, input);\n\n    REQUIRE(err == DeserializationError::Ok);\n  }\n\n  SECTION(\"deserializeMsgPack()\") {\n    unsigned char input[] = \"\\xDE\\x00\\x01\\xA5Hello\\xA5world\";\n\n    JsonDocument doc;\n    DeserializationError err = deserializeMsgPack(doc, input);\n\n    REQUIRE(err == DeserializationError::Ok);\n  }\n\n  SECTION(\"serializeMsgPack(unsigned char[])\") {\n    unsigned char buffer[32];\n    JsonDocument doc;\n    doc[\"hello\"] = \"world\";\n\n    size_t n = serializeMsgPack(doc, buffer);\n\n    REQUIRE(n == 13);\n    REQUIRE(memcmp(buffer, \"\\x81\\xA5hello\\xA5world\", 13) == 0);\n  }\n\n  SECTION(\"serializeMsgPack(unsigned char*)\") {\n    unsigned char buffer[32];\n    JsonDocument doc;\n    doc[\"hello\"] = \"world\";\n\n    size_t n = serializeMsgPack(doc, buffer, sizeof(buffer));\n\n    REQUIRE(n == 13);\n    REQUIRE(memcmp(buffer, \"\\x81\\xA5hello\\xA5world\", 13) == 0);\n  }\n\n  SECTION(\"serializeJson(unsigned char[])\") {\n    unsigned char buffer[32];\n    JsonDocument doc;\n    doc[\"hello\"] = \"world\";\n\n    size_t n = serializeJson(doc, buffer);\n\n    REQUIRE(n == 17);\n    REQUIRE(memcmp(buffer, \"{\\\"hello\\\":\\\"world\\\"}\", n) == 0);\n  }\n\n  SECTION(\"serializeJson(unsigned char*)\") {\n    unsigned char buffer[32];\n    JsonDocument doc;\n    doc[\"hello\"] = \"world\";\n\n    size_t n = serializeJson(doc, buffer, sizeof(buffer));\n\n    REQUIRE(n == 17);\n    REQUIRE(memcmp(buffer, \"{\\\"hello\\\":\\\"world\\\"}\", n) == 0);\n  }\n\n  SECTION(\"serializeJsonPretty(unsigned char[])\") {\n    unsigned char buffer[32];\n    JsonDocument doc;\n    doc[\"hello\"] = \"world\";\n\n    size_t n = serializeJsonPretty(doc, buffer);\n\n    REQUIRE(n == 24);\n  }\n\n  SECTION(\"serializeJsonPretty(unsigned char*)\") {\n    unsigned char buffer[32];\n    JsonDocument doc;\n    doc[\"hello\"] = \"world\";\n\n    size_t n = serializeJsonPretty(doc, buffer, sizeof(buffer));\n\n    REQUIRE(n == 24);\n  }\n\n  SECTION(\"JsonVariant\") {\n    JsonDocument doc;\n\n    SECTION(\"set\") {\n      unsigned char value[] = \"42\";\n\n      JsonVariant variant = doc.to<JsonVariant>();\n      variant.set(value);\n\n      REQUIRE(42 == variant.as<int>());\n    }\n\n#ifndef CONFLICTS_WITH_BUILTIN_OPERATOR\n    SECTION(\"operator[]\") {\n      unsigned char key[] = \"hello\";\n\n      deserializeJson(doc, \"{\\\"hello\\\":\\\"world\\\"}\");\n      JsonVariant variant = doc.as<JsonVariant>();\n\n      REQUIRE(\"world\"_s == variant[key]);\n    }\n#endif\n\n#ifndef CONFLICTS_WITH_BUILTIN_OPERATOR\n    SECTION(\"operator[] const\") {\n      unsigned char key[] = \"hello\";\n\n      deserializeJson(doc, \"{\\\"hello\\\":\\\"world\\\"}\");\n      const JsonVariant variant = doc.as<JsonVariant>();\n\n      REQUIRE(\"world\"_s == variant[key]);\n    }\n#endif\n\n    SECTION(\"operator==\") {\n      unsigned char comparand[] = \"hello\";\n\n      JsonVariant variant = doc.to<JsonVariant>();\n      variant.set(\"hello\");\n\n      REQUIRE(comparand == variant);\n      REQUIRE(variant == comparand);\n      REQUIRE_FALSE(comparand != variant);\n      REQUIRE_FALSE(variant != comparand);\n    }\n\n    SECTION(\"operator!=\") {\n      unsigned char comparand[] = \"hello\";\n\n      JsonVariant variant = doc.to<JsonVariant>();\n      variant.set(\"world\");\n\n      REQUIRE(comparand != variant);\n      REQUIRE(variant != comparand);\n      REQUIRE_FALSE(comparand == variant);\n      REQUIRE_FALSE(variant == comparand);\n    }\n  }\n\n  SECTION(\"JsonObject\") {\n#ifndef CONFLICTS_WITH_BUILTIN_OPERATOR\n    SECTION(\"operator[]\") {\n      unsigned char key[] = \"hello\";\n\n      JsonDocument doc;\n      JsonObject obj = doc.to<JsonObject>();\n      obj[key] = \"world\";\n\n      REQUIRE(\"world\"_s == obj[\"hello\"]);\n    }\n\n    SECTION(\"JsonObject::operator[] const\") {\n      unsigned char key[] = \"hello\";\n\n      JsonDocument doc;\n      deserializeJson(doc, \"{\\\"hello\\\":\\\"world\\\"}\");\n\n      JsonObject obj = doc.as<JsonObject>();\n      REQUIRE(\"world\"_s == obj[key]);\n    }\n#endif\n\n    SECTION(\"remove()\") {\n      unsigned char key[] = \"hello\";\n\n      JsonDocument doc;\n      deserializeJson(doc, \"{\\\"hello\\\":\\\"world\\\"}\");\n      JsonObject obj = doc.as<JsonObject>();\n      obj.remove(key);\n\n      REQUIRE(0 == obj.size());\n    }\n  }\n\n  SECTION(\"MemberProxy\") {\n    SECTION(\"operator=\") {  // issue #416\n      unsigned char value[] = \"world\";\n\n      JsonDocument doc;\n      JsonObject obj = doc.to<JsonObject>();\n      obj[\"hello\"] = value;\n\n      REQUIRE(\"world\"_s == obj[\"hello\"]);\n    }\n\n    SECTION(\"set()\") {\n      unsigned char value[] = \"world\";\n\n      JsonDocument doc;\n      JsonObject obj = doc.to<JsonObject>();\n      obj[\"hello\"].set(value);\n\n      REQUIRE(\"world\"_s == obj[\"hello\"]);\n    }\n  }\n\n  SECTION(\"JsonArray\") {\n    SECTION(\"add()\") {\n      unsigned char value[] = \"world\";\n\n      JsonDocument doc;\n      JsonArray arr = doc.to<JsonArray>();\n      arr.add(value);\n\n      REQUIRE(\"world\"_s == arr[0]);\n    }\n  }\n\n  SECTION(\"ElementProxy\") {\n    SECTION(\"set()\") {\n      unsigned char value[] = \"world\";\n\n      JsonDocument doc;\n      JsonArray arr = doc.to<JsonArray>();\n      arr.add(\"hello\");\n      arr[0].set(value);\n\n      REQUIRE(\"world\"_s == arr[0]);\n    }\n\n    SECTION(\"operator=\") {\n      unsigned char value[] = \"world\";\n\n      JsonDocument doc;\n      JsonArray arr = doc.to<JsonArray>();\n      arr.add(\"hello\");\n      arr[0] = value;\n\n      REQUIRE(\"world\"_s == arr[0]);\n    }\n  }\n}\n"
  },
  {
    "path": "extras/tests/Misc/version.cpp",
    "content": "// ArduinoJson - https://arduinojson.org\n// Copyright © 2014-2025, Benoit BLANCHON\n// MIT License\n\n#include <ArduinoJson/version.hpp>\n#include <catch.hpp>\n#include <sstream>\n\nusing Catch::Matchers::StartsWith;\n\nTEST_CASE(\"ARDUINOJSON_VERSION\") {\n  std::stringstream version;\n\n  version << ARDUINOJSON_VERSION_MAJOR << \".\" << ARDUINOJSON_VERSION_MINOR\n          << \".\" << ARDUINOJSON_VERSION_REVISION;\n\n  REQUIRE_THAT(ARDUINOJSON_VERSION, StartsWith(version.str()));\n}\n"
  },
  {
    "path": "extras/tests/Misc/weird_strcmp.hpp",
    "content": "// ArduinoJson - https://arduinojson.org\n// Copyright © 2014-2025, Benoit BLANCHON\n// MIT License\n\n#include <ArduinoJson/Namespace.hpp>\n\n#include <string.h>  // strcmp, strncmp\n\n// Issue #1198: strcmp() implementation that returns a value larger than 8-bit\n\nARDUINOJSON_BEGIN_PRIVATE_NAMESPACE\n\nint strcmp(const char* a, const char* b) {\n  int result = ::strcmp(a, b);\n  if (result > 0)\n    return 2147483647;\n  if (result < 0)\n    return -214748364;\n  return 0;\n}\n\nint strncmp(const char* a, const char* b, size_t n) {\n  int result = ::strncmp(a, b, n);\n  if (result > 0)\n    return 2147483647;\n  if (result < 0)\n    return -214748364;\n  return 0;\n}\n\nARDUINOJSON_END_PRIVATE_NAMESPACE\n"
  },
  {
    "path": "extras/tests/MixedConfiguration/CMakeLists.txt",
    "content": "# ArduinoJson - https://arduinojson.org\n# Copyright © 2014-2025, Benoit BLANCHON\n# MIT License\n\nadd_executable(MixedConfigurationTests\n\tdecode_unicode_0.cpp\n\tdecode_unicode_1.cpp\n\tenable_alignment_0.cpp\n\tenable_alignment_1.cpp\n\tenable_comments_0.cpp\n\tenable_comments_1.cpp\n\tenable_infinity_0.cpp\n\tenable_infinity_1.cpp\n\tenable_nan_0.cpp\n\tenable_nan_1.cpp\n\tenable_progmem_1.cpp\n\tissue1707.cpp\n\tstring_length_size_1.cpp\n\tstring_length_size_2.cpp\n\tstring_length_size_4.cpp\n\tuse_double_0.cpp\n\tuse_double_1.cpp\n\tuse_long_long_0.cpp\n\tuse_long_long_1.cpp\n)\n\nset_target_properties(MixedConfigurationTests PROPERTIES UNITY_BUILD OFF)\n\nadd_test(MixedConfiguration MixedConfigurationTests)\n\nset_tests_properties(MixedConfiguration\n\tPROPERTIES\n\t\tLABELS \"Catch\"\n)\n"
  },
  {
    "path": "extras/tests/MixedConfiguration/decode_unicode_0.cpp",
    "content": "#define ARDUINOJSON_DECODE_UNICODE 0\n#include <ArduinoJson.h>\n\n#include <catch.hpp>\n\nTEST_CASE(\"ARDUINOJSON_DECODE_UNICODE == 0\") {\n  JsonDocument doc;\n  DeserializationError err = deserializeJson(doc, \"\\\"\\\\uD834\\\\uDD1E\\\"\");\n\n  REQUIRE(err == DeserializationError::Ok);\n  REQUIRE(doc.as<std::string>() == \"\\\\uD834\\\\uDD1E\");\n}\n"
  },
  {
    "path": "extras/tests/MixedConfiguration/decode_unicode_1.cpp",
    "content": "#define ARDUINOJSON_DECODE_UNICODE 1\n#include <ArduinoJson.h>\n\n#include <catch.hpp>\n\nTEST_CASE(\"ARDUINOJSON_DECODE_UNICODE == 1\") {\n  JsonDocument doc;\n  DeserializationError err = deserializeJson(doc, \"\\\"\\\\uD834\\\\uDD1E\\\"\");\n\n  REQUIRE(err == DeserializationError::Ok);\n}\n"
  },
  {
    "path": "extras/tests/MixedConfiguration/enable_alignment_0.cpp",
    "content": "#define ARDUINOJSON_VERSION_NAMESPACE NoAlignment\n#define ARDUINOJSON_ENABLE_ALIGNMENT 0\n#include <ArduinoJson.h>\n\n#include <ArduinoJson/Memory/Alignment.hpp>\n\n#include <catch.hpp>\n\nTEST_CASE(\"ARDUINOJSON_ENABLE_ALIGNMENT == 0\") {\n  using namespace ArduinoJson::detail;\n\n  const size_t N = sizeof(void*);\n\n  SECTION(\"isAligned()\") {\n    CHECK(isAligned(0) == true);\n    CHECK(isAligned(1) == true);\n    CHECK(isAligned(N) == true);\n    CHECK(isAligned(N + 1) == true);\n    CHECK(isAligned(2 * N) == true);\n    CHECK(isAligned(2 * N + 1) == true);\n  }\n\n  SECTION(\"addPadding()\") {\n    CHECK(addPadding(0) == 0);\n    CHECK(addPadding(1) == 1);\n    CHECK(addPadding(N) == N);\n    CHECK(addPadding(N + 1) == N + 1);\n  }\n\n  SECTION(\"AddPadding<>\") {\n    const size_t a = AddPadding<0>::value;\n    CHECK(a == 0);\n\n    const size_t b = AddPadding<1>::value;\n    CHECK(b == 1);\n\n    const size_t c = AddPadding<N>::value;\n    CHECK(c == N);\n\n    const size_t d = AddPadding<N + 1>::value;\n    CHECK(d == N + 1);\n  }\n}\n"
  },
  {
    "path": "extras/tests/MixedConfiguration/enable_alignment_1.cpp",
    "content": "#define ARDUINOJSON_ENABLE_ALIGNMENT 1\n#include <ArduinoJson.h>\n\n#include <ArduinoJson/Memory/Alignment.hpp>\n\n#include <catch.hpp>\n\nTEST_CASE(\"ARDUINOJSON_ENABLE_ALIGNMENT == 1\") {\n  using namespace ArduinoJson::detail;\n\n  const size_t N = sizeof(void*);\n\n  SECTION(\"isAligned()\") {\n    CHECK(isAligned(0) == true);\n    CHECK(isAligned(1) == false);\n    CHECK(isAligned(N) == true);\n    CHECK(isAligned(N + 1) == false);\n    CHECK(isAligned(2 * N) == true);\n    CHECK(isAligned(2 * N + 1) == false);\n  }\n\n  SECTION(\"addPadding()\") {\n    CHECK(addPadding(0) == 0);\n    CHECK(addPadding(1) == N);\n    CHECK(addPadding(N) == N);\n    CHECK(addPadding(N + 1) == 2 * N);\n  }\n\n  SECTION(\"AddPadding<>\") {\n    const size_t a = AddPadding<0>::value;\n    CHECK(a == 0);\n\n    const size_t b = AddPadding<1>::value;\n    CHECK(b == N);\n\n    const size_t c = AddPadding<N>::value;\n    CHECK(c == N);\n\n    const size_t d = AddPadding<N + 1>::value;\n    CHECK(d == 2 * N);\n  }\n}\n"
  },
  {
    "path": "extras/tests/MixedConfiguration/enable_comments_0.cpp",
    "content": "// ArduinoJson - https://arduinojson.org\n// Copyright © 2014-2025, Benoit BLANCHON\n// MIT License\n\n#define ARDUINOJSON_ENABLE_COMMENTS 0\n#include <ArduinoJson.h>\n\n#include <catch.hpp>\n\nTEST_CASE(\"Comments should produce InvalidInput\") {\n  JsonDocument doc;\n\n  const char* testCases[] = {\n      \"/*COMMENT*/  [\\\"hello\\\"]\",\n      \"[/*COMMENT*/ \\\"hello\\\"]\",\n      \"[\\\"hello\\\"/*COMMENT*/]\",\n      \"[\\\"hello\\\"/*COMMENT*/,\\\"world\\\"]\",\n      \"[\\\"hello\\\",/*COMMENT*/ \\\"world\\\"]\",\n      \"[/*/\\n]\",\n      \"[/*COMMENT]\",\n      \"[/*COMMENT*]\",\n      \"//COMMENT\\n\\t[\\\"hello\\\"]\",\n      \"[//COMMENT\\n\\\"hello\\\"]\",\n      \"[\\\"hello\\\"//COMMENT\\r\\n]\",\n      \"[\\\"hello\\\"//COMMENT\\n,\\\"world\\\"]\",\n      \"[\\\"hello\\\",//COMMENT\\n\\\"world\\\"]\",\n      \"[/COMMENT\\n]\",\n      \"[//COMMENT\",\n      \"/*COMMENT*/ {\\\"hello\\\":\\\"world\\\"}\",\n      \"{/*COMMENT*/\\\"hello\\\":\\\"world\\\"}\",\n      \"{\\\"hello\\\"/*COMMENT*/:\\\"world\\\"}\",\n      \"{\\\"hello\\\":/*COMMENT*/\\\"world\\\"}\",\n      \"{\\\"hello\\\":\\\"world\\\"/*COMMENT*/}\",\n      \"//COMMENT\\n {\\\"hello\\\":\\\"world\\\"}\",\n      \"{//COMMENT\\n\\\"hello\\\":\\\"world\\\"}\",\n      \"{\\\"hello\\\"//COMMENT\\n:\\\"world\\\"}\",\n      \"{\\\"hello\\\"://COMMENT\\n\\\"world\\\"}\",\n      \"{\\\"hello\\\":\\\"world\\\"//COMMENT\\n}\",\n      \"/{\\\"hello\\\":\\\"world\\\"}\",\n      \"{/\\\"hello\\\":\\\"world\\\"}\",\n      \"{\\\"hello\\\"/:\\\"world\\\"}\",\n      \"{\\\"hello\\\":/\\\"world\\\"}\",\n      \"{\\\"hello\\\":\\\"world\\\"/}\",\n      \"{\\\"hello\\\":\\\"world\\\"/,\\\"answer\\\":42}\",\n      \"{\\\"hello\\\":\\\"world\\\",/\\\"answer\\\":42}\",\n  };\n  const size_t testCount = sizeof(testCases) / sizeof(testCases[0]);\n\n  for (size_t i = 0; i < testCount; i++) {\n    const char* input = testCases[i];\n    CAPTURE(input);\n    REQUIRE(deserializeJson(doc, input) == DeserializationError::InvalidInput);\n  }\n}\n"
  },
  {
    "path": "extras/tests/MixedConfiguration/enable_comments_1.cpp",
    "content": "// ArduinoJson - https://arduinojson.org\n// Copyright © 2014-2025, Benoit BLANCHON\n// MIT License\n\n#define ARDUINOJSON_ENABLE_COMMENTS 1\n#include <ArduinoJson.h>\n\n#include <catch.hpp>\n\nTEST_CASE(\"Comments in arrays\") {\n  JsonDocument doc;\n\n  SECTION(\"Block comments\") {\n    SECTION(\"Before opening bracket\") {\n      DeserializationError err =\n          deserializeJson(doc, \"/*COMMENT*/  [\\\"hello\\\"]\");\n      JsonArray arr = doc.as<JsonArray>();\n\n      REQUIRE(err == DeserializationError::Ok);\n      REQUIRE(1 == arr.size());\n      REQUIRE(arr[0] == \"hello\");\n    }\n\n    SECTION(\"After opening bracket\") {\n      DeserializationError err =\n          deserializeJson(doc, \"[/*COMMENT*/ \\\"hello\\\"]\");\n      JsonArray arr = doc.as<JsonArray>();\n\n      REQUIRE(err == DeserializationError::Ok);\n      REQUIRE(1 == arr.size());\n      REQUIRE(arr[0] == \"hello\");\n    }\n\n    SECTION(\"Before closing bracket\") {\n      DeserializationError err = deserializeJson(doc, \"[\\\"hello\\\"/*COMMENT*/]\");\n      JsonArray arr = doc.as<JsonArray>();\n\n      REQUIRE(err == DeserializationError::Ok);\n      REQUIRE(1 == arr.size());\n      REQUIRE(arr[0] == \"hello\");\n    }\n\n    SECTION(\"After closing bracket\") {\n      DeserializationError err = deserializeJson(doc, \"[\\\"hello\\\"]/*COMMENT*/\");\n      JsonArray arr = doc.as<JsonArray>();\n\n      REQUIRE(err == DeserializationError::Ok);\n      REQUIRE(1 == arr.size());\n      REQUIRE(arr[0] == \"hello\");\n    }\n\n    SECTION(\"Before comma\") {\n      DeserializationError err =\n          deserializeJson(doc, \"[\\\"hello\\\"/*COMMENT*/,\\\"world\\\"]\");\n      JsonArray arr = doc.as<JsonArray>();\n\n      REQUIRE(err == DeserializationError::Ok);\n      REQUIRE(2 == arr.size());\n      REQUIRE(arr[0] == \"hello\");\n      REQUIRE(arr[1] == \"world\");\n    }\n\n    SECTION(\"After comma\") {\n      DeserializationError err =\n          deserializeJson(doc, \"[\\\"hello\\\",/*COMMENT*/ \\\"world\\\"]\");\n      JsonArray arr = doc.as<JsonArray>();\n\n      REQUIRE(err == DeserializationError::Ok);\n      REQUIRE(2 == arr.size());\n      REQUIRE(arr[0] == \"hello\");\n      REQUIRE(arr[1] == \"world\");\n    }\n\n    SECTION(\"/*/\") {\n      DeserializationError err = deserializeJson(doc, \"[/*/\\n]\");\n      REQUIRE(err == DeserializationError::IncompleteInput);\n    }\n\n    SECTION(\"Unfinished comment\") {\n      DeserializationError err = deserializeJson(doc, \"[/*COMMENT]\");\n      REQUIRE(err == DeserializationError::IncompleteInput);\n    }\n\n    SECTION(\"Final slash missing\") {\n      DeserializationError err = deserializeJson(doc, \"[/*COMMENT*]\");\n      REQUIRE(err == DeserializationError::IncompleteInput);\n    }\n  }\n\n  SECTION(\"Trailing comments\") {\n    SECTION(\"Before opening bracket\") {\n      DeserializationError err =\n          deserializeJson(doc, \"//COMMENT\\n\\t[\\\"hello\\\"]\");\n      JsonArray arr = doc.as<JsonArray>();\n\n      REQUIRE(err == DeserializationError::Ok);\n      REQUIRE(1 == arr.size());\n      REQUIRE(arr[0] == \"hello\");\n    }\n\n    SECTION(\"After opening bracket\") {\n      DeserializationError err = deserializeJson(doc, \"[//COMMENT\\n\\\"hello\\\"]\");\n      JsonArray arr = doc.as<JsonArray>();\n\n      REQUIRE(err == DeserializationError::Ok);\n      REQUIRE(1 == arr.size());\n      REQUIRE(arr[0] == \"hello\");\n    }\n\n    SECTION(\"Before closing bracket\") {\n      DeserializationError err =\n          deserializeJson(doc, \"[\\\"hello\\\"//COMMENT\\r\\n]\");\n      JsonArray arr = doc.as<JsonArray>();\n\n      REQUIRE(err == DeserializationError::Ok);\n      REQUIRE(1 == arr.size());\n      REQUIRE(arr[0] == \"hello\");\n    }\n\n    SECTION(\"After closing bracket\") {\n      DeserializationError err = deserializeJson(doc, \"[\\\"hello\\\"]//COMMENT\\n\");\n      JsonArray arr = doc.as<JsonArray>();\n\n      REQUIRE(err == DeserializationError::Ok);\n      REQUIRE(1 == arr.size());\n      REQUIRE(arr[0] == \"hello\");\n    }\n\n    SECTION(\"Before comma\") {\n      DeserializationError err =\n          deserializeJson(doc, \"[\\\"hello\\\"//COMMENT\\n,\\\"world\\\"]\");\n      JsonArray arr = doc.as<JsonArray>();\n\n      REQUIRE(err == DeserializationError::Ok);\n      REQUIRE(2 == arr.size());\n      REQUIRE(arr[0] == \"hello\");\n      REQUIRE(arr[1] == \"world\");\n    }\n\n    SECTION(\"After comma\") {\n      DeserializationError err =\n          deserializeJson(doc, \"[\\\"hello\\\",//COMMENT\\n\\\"world\\\"]\");\n      JsonArray arr = doc.as<JsonArray>();\n\n      REQUIRE(err == DeserializationError::Ok);\n      REQUIRE(2 == arr.size());\n      REQUIRE(arr[0] == \"hello\");\n      REQUIRE(arr[1] == \"world\");\n    }\n\n    SECTION(\"Invalid comment\") {\n      DeserializationError err = deserializeJson(doc, \"[/COMMENT\\n]\");\n      REQUIRE(err == DeserializationError::InvalidInput);\n    }\n\n    SECTION(\"End document with comment\") {\n      DeserializationError err = deserializeJson(doc, \"[//COMMENT\");\n      REQUIRE(err == DeserializationError::IncompleteInput);\n    }\n  }\n}\n\nTEST_CASE(\"Comments in objects\") {\n  JsonDocument doc;\n\n  SECTION(\"Block comments\") {\n    SECTION(\"Before opening brace\") {\n      DeserializationError err =\n          deserializeJson(doc, \"/*COMMENT*/ {\\\"hello\\\":\\\"world\\\"}\");\n      JsonObject obj = doc.as<JsonObject>();\n\n      REQUIRE(err == DeserializationError::Ok);\n      REQUIRE(obj[\"hello\"] == \"world\");\n    }\n\n    SECTION(\"After opening brace\") {\n      DeserializationError err =\n          deserializeJson(doc, \"{/*COMMENT*/\\\"hello\\\":\\\"world\\\"}\");\n      JsonObject obj = doc.as<JsonObject>();\n\n      REQUIRE(err == DeserializationError::Ok);\n      REQUIRE(obj[\"hello\"] == \"world\");\n    }\n\n    SECTION(\"Before colon\") {\n      DeserializationError err =\n          deserializeJson(doc, \"{\\\"hello\\\"/*COMMENT*/:\\\"world\\\"}\");\n      JsonObject obj = doc.as<JsonObject>();\n\n      REQUIRE(err == DeserializationError::Ok);\n      REQUIRE(obj[\"hello\"] == \"world\");\n    }\n\n    SECTION(\"After colon\") {\n      DeserializationError err =\n          deserializeJson(doc, \"{\\\"hello\\\":/*COMMENT*/\\\"world\\\"}\");\n      JsonObject obj = doc.as<JsonObject>();\n\n      REQUIRE(err == DeserializationError::Ok);\n      REQUIRE(obj[\"hello\"] == \"world\");\n    }\n\n    SECTION(\"Before closing brace\") {\n      DeserializationError err =\n          deserializeJson(doc, \"{\\\"hello\\\":\\\"world\\\"/*COMMENT*/}\");\n      JsonObject obj = doc.as<JsonObject>();\n\n      REQUIRE(err == DeserializationError::Ok);\n      REQUIRE(obj[\"hello\"] == \"world\");\n    }\n\n    SECTION(\"After closing brace\") {\n      DeserializationError err =\n          deserializeJson(doc, \"{\\\"hello\\\":\\\"world\\\"}/*COMMENT*/\");\n      JsonObject obj = doc.as<JsonObject>();\n\n      REQUIRE(err == DeserializationError::Ok);\n      REQUIRE(obj[\"hello\"] == \"world\");\n    }\n\n    SECTION(\"Before comma\") {\n      DeserializationError err = deserializeJson(\n          doc, \"{\\\"hello\\\":\\\"world\\\"/*COMMENT*/,\\\"answer\\\":42}\");\n      JsonObject obj = doc.as<JsonObject>();\n\n      REQUIRE(err == DeserializationError::Ok);\n      REQUIRE(obj[\"hello\"] == \"world\");\n      REQUIRE(obj[\"answer\"] == 42);\n    }\n\n    SECTION(\"After comma\") {\n      DeserializationError err = deserializeJson(\n          doc, \"{\\\"hello\\\":\\\"world\\\",/*COMMENT*/\\\"answer\\\":42}\");\n      JsonObject obj = doc.as<JsonObject>();\n\n      REQUIRE(err == DeserializationError::Ok);\n      REQUIRE(obj[\"hello\"] == \"world\");\n      REQUIRE(obj[\"answer\"] == 42);\n    }\n  }\n\n  SECTION(\"Trailing comments\") {\n    SECTION(\"Before opening brace\") {\n      DeserializationError err =\n          deserializeJson(doc, \"//COMMENT\\n {\\\"hello\\\":\\\"world\\\"}\");\n      JsonObject obj = doc.as<JsonObject>();\n\n      REQUIRE(err == DeserializationError::Ok);\n      REQUIRE(obj[\"hello\"] == \"world\");\n    }\n\n    SECTION(\"After opening brace\") {\n      DeserializationError err =\n          deserializeJson(doc, \"{//COMMENT\\n\\\"hello\\\":\\\"world\\\"}\");\n      JsonObject obj = doc.as<JsonObject>();\n\n      REQUIRE(err == DeserializationError::Ok);\n      REQUIRE(obj[\"hello\"] == \"world\");\n    }\n\n    SECTION(\"Before colon\") {\n      DeserializationError err =\n          deserializeJson(doc, \"{\\\"hello\\\"//COMMENT\\n:\\\"world\\\"}\");\n      JsonObject obj = doc.as<JsonObject>();\n\n      REQUIRE(err == DeserializationError::Ok);\n      REQUIRE(obj[\"hello\"] == \"world\");\n    }\n\n    SECTION(\"After colon\") {\n      DeserializationError err =\n          deserializeJson(doc, \"{\\\"hello\\\"://COMMENT\\n\\\"world\\\"}\");\n      JsonObject obj = doc.as<JsonObject>();\n\n      REQUIRE(err == DeserializationError::Ok);\n      REQUIRE(obj[\"hello\"] == \"world\");\n    }\n\n    SECTION(\"Before closing brace\") {\n      DeserializationError err =\n          deserializeJson(doc, \"{\\\"hello\\\":\\\"world\\\"//COMMENT\\n}\");\n      JsonObject obj = doc.as<JsonObject>();\n\n      REQUIRE(err == DeserializationError::Ok);\n      REQUIRE(obj[\"hello\"] == \"world\");\n    }\n\n    SECTION(\"After closing brace\") {\n      DeserializationError err =\n          deserializeJson(doc, \"{\\\"hello\\\":\\\"world\\\"}//COMMENT\\n\");\n      JsonObject obj = doc.as<JsonObject>();\n\n      REQUIRE(err == DeserializationError::Ok);\n      REQUIRE(obj[\"hello\"] == \"world\");\n    }\n\n    SECTION(\"Before comma\") {\n      DeserializationError err = deserializeJson(\n          doc, \"{\\\"hello\\\":\\\"world\\\"//COMMENT\\n,\\\"answer\\\":42}\");\n      JsonObject obj = doc.as<JsonObject>();\n\n      REQUIRE(err == DeserializationError::Ok);\n      REQUIRE(obj[\"hello\"] == \"world\");\n      REQUIRE(obj[\"answer\"] == 42);\n    }\n\n    SECTION(\"After comma\") {\n      DeserializationError err = deserializeJson(\n          doc, \"{\\\"hello\\\":\\\"world\\\",//COMMENT\\n\\\"answer\\\":42}\");\n      JsonObject obj = doc.as<JsonObject>();\n\n      REQUIRE(err == DeserializationError::Ok);\n      REQUIRE(obj[\"hello\"] == \"world\");\n      REQUIRE(obj[\"answer\"] == 42);\n    }\n  }\n\n  SECTION(\"Dangling slash\") {\n    SECTION(\"Before opening brace\") {\n      DeserializationError err = deserializeJson(doc, \"/{\\\"hello\\\":\\\"world\\\"}\");\n\n      REQUIRE(err == DeserializationError::InvalidInput);\n    }\n\n    SECTION(\"After opening brace\") {\n      DeserializationError err = deserializeJson(doc, \"{/\\\"hello\\\":\\\"world\\\"}\");\n\n      REQUIRE(err == DeserializationError::InvalidInput);\n    }\n\n    SECTION(\"Before colon\") {\n      DeserializationError err = deserializeJson(doc, \"{\\\"hello\\\"/:\\\"world\\\"}\");\n\n      REQUIRE(err == DeserializationError::InvalidInput);\n    }\n\n    SECTION(\"After colon\") {\n      DeserializationError err = deserializeJson(doc, \"{\\\"hello\\\":/\\\"world\\\"}\");\n\n      REQUIRE(err == DeserializationError::InvalidInput);\n    }\n\n    SECTION(\"Before closing brace\") {\n      DeserializationError err = deserializeJson(doc, \"{\\\"hello\\\":\\\"world\\\"/}\");\n\n      REQUIRE(err == DeserializationError::InvalidInput);\n    }\n\n    SECTION(\"After closing brace\") {\n      DeserializationError err = deserializeJson(doc, \"{\\\"hello\\\":\\\"world\\\"}/\");\n      JsonObject obj = doc.as<JsonObject>();\n\n      REQUIRE(err == DeserializationError::Ok);\n      REQUIRE(obj[\"hello\"] == \"world\");\n    }\n\n    SECTION(\"Before comma\") {\n      DeserializationError err =\n          deserializeJson(doc, \"{\\\"hello\\\":\\\"world\\\"/,\\\"answer\\\":42}\");\n\n      REQUIRE(err == DeserializationError::InvalidInput);\n    }\n\n    SECTION(\"After comma\") {\n      DeserializationError err =\n          deserializeJson(doc, \"{\\\"hello\\\":\\\"world\\\",/\\\"answer\\\":42}\");\n\n      REQUIRE(err == DeserializationError::InvalidInput);\n    }\n  }\n}\n\nTEST_CASE(\"Comments alone\") {\n  JsonDocument doc;\n\n  SECTION(\"Just a trailing comment with no line break\") {\n    DeserializationError err = deserializeJson(doc, \"// comment\");\n\n    REQUIRE(err == DeserializationError::IncompleteInput);\n  }\n\n  SECTION(\"Just a trailing comment with no a break\") {\n    DeserializationError err = deserializeJson(doc, \"// comment\\n\");\n\n    REQUIRE(err == DeserializationError::EmptyInput);\n  }\n\n  SECTION(\"Just a block comment\") {\n    DeserializationError err = deserializeJson(doc, \"/*comment*/\");\n\n    REQUIRE(err == DeserializationError::EmptyInput);\n  }\n\n  SECTION(\"Just a slash\") {\n    DeserializationError err = deserializeJson(doc, \"/\");\n\n    REQUIRE(err == DeserializationError::InvalidInput);\n  }\n\n  SECTION(\"Premature terminator\") {\n    DeserializationError err = deserializeJson(doc, \"/* comment\");\n\n    REQUIRE(err == DeserializationError::IncompleteInput);\n  }\n\n  SECTION(\"Premature end on sized input\") {\n    DeserializationError err = deserializeJson(doc, \"/* comment */\", 10);\n\n    REQUIRE(err == DeserializationError::IncompleteInput);\n  }\n}\n"
  },
  {
    "path": "extras/tests/MixedConfiguration/enable_infinity_0.cpp",
    "content": "#define ARDUINOJSON_ENABLE_INFINITY 0\n#include <ArduinoJson.h>\n\n#include <catch.hpp>\n#include <limits>\n\nstatic void assertParseFails(const char* json) {\n  JsonDocument doc;\n  DeserializationError err = deserializeJson(doc, json);\n\n  REQUIRE(err == DeserializationError::InvalidInput);\n}\n\nstatic void assertJsonEquals(const JsonDocument& doc,\n                             std::string expectedJson) {\n  std::string actualJson;\n  serializeJson(doc, actualJson);\n  REQUIRE(actualJson == expectedJson);\n}\n\nTEST_CASE(\"ARDUINOJSON_ENABLE_INFINITY == 0\") {\n  SECTION(\"serializeJson()\") {\n    JsonDocument doc;\n    doc.add(std::numeric_limits<double>::infinity());\n    doc.add(-std::numeric_limits<double>::infinity());\n\n    assertJsonEquals(doc, \"[null,null]\");\n  }\n\n  SECTION(\"deserializeJson()\") {\n    assertParseFails(\"{\\\"X\\\":Infinity}\");\n    assertParseFails(\"{\\\"X\\\":-Infinity}\");\n    assertParseFails(\"{\\\"X\\\":+Infinity}\");\n  }\n}\n"
  },
  {
    "path": "extras/tests/MixedConfiguration/enable_infinity_1.cpp",
    "content": "#define ARDUINOJSON_ENABLE_INFINITY 1\n#include <ArduinoJson.h>\n\n#include <catch.hpp>\n#include <limits>\n\nnamespace my {\nusing ArduinoJson::detail::isinf;\n}  // namespace my\n\nTEST_CASE(\"ARDUINOJSON_ENABLE_INFINITY == 1\") {\n  JsonDocument doc;\n\n  SECTION(\"serializeJson()\") {\n    doc.add(std::numeric_limits<double>::infinity());\n    doc.add(-std::numeric_limits<double>::infinity());\n\n    std::string json;\n    serializeJson(doc, json);\n\n    REQUIRE(json == \"[Infinity,-Infinity]\");\n  }\n\n  SECTION(\"deserializeJson()\") {\n    DeserializationError err =\n        deserializeJson(doc, \"[Infinity,-Infinity,+Infinity]\");\n    float a = doc[0];\n    float b = doc[1];\n    float c = doc[2];\n\n    REQUIRE(err == DeserializationError::Ok);\n    REQUIRE(my::isinf(a));\n    REQUIRE(a > 0);\n    REQUIRE(my::isinf(b));\n    REQUIRE(b < 0);\n    REQUIRE(my::isinf(c));\n    REQUIRE(c > 0);\n  }\n}\n"
  },
  {
    "path": "extras/tests/MixedConfiguration/enable_nan_0.cpp",
    "content": "#define ARDUINOJSON_ENABLE_NAN 0\n#include <ArduinoJson.h>\n\n#include <catch.hpp>\n#include <limits>\n\nTEST_CASE(\"ARDUINOJSON_ENABLE_NAN == 0\") {\n  JsonDocument doc;\n  JsonObject root = doc.to<JsonObject>();\n\n  SECTION(\"serializeJson()\") {\n    root[\"X\"] = std::numeric_limits<double>::signaling_NaN();\n\n    std::string json;\n    serializeJson(doc, json);\n\n    REQUIRE(json == \"{\\\"X\\\":null}\");\n  }\n\n  SECTION(\"deserializeJson()\") {\n    DeserializationError err = deserializeJson(doc, \"{\\\"X\\\":NaN}\");\n\n    REQUIRE(err == DeserializationError::InvalidInput);\n  }\n}\n"
  },
  {
    "path": "extras/tests/MixedConfiguration/enable_nan_1.cpp",
    "content": "#define ARDUINOJSON_ENABLE_NAN 1\n#include <ArduinoJson.h>\n\n#include <catch.hpp>\n#include <limits>\n\nnamespace my {\nusing ArduinoJson::detail::isnan;\n}  // namespace my\n\nTEST_CASE(\"ARDUINOJSON_ENABLE_NAN == 1\") {\n  JsonDocument doc;\n  JsonObject root = doc.to<JsonObject>();\n\n  SECTION(\"serializeJson()\") {\n    root[\"X\"] = std::numeric_limits<double>::signaling_NaN();\n\n    std::string json;\n    serializeJson(doc, json);\n\n    REQUIRE(json == \"{\\\"X\\\":NaN}\");\n  }\n\n  SECTION(\"deserializeJson()\") {\n    DeserializationError err = deserializeJson(doc, \"{\\\"X\\\":NaN}\");\n    float x = doc[\"X\"];\n\n    REQUIRE(err == DeserializationError::Ok);\n    REQUIRE(my::isnan(x));\n  }\n}\n"
  },
  {
    "path": "extras/tests/MixedConfiguration/enable_progmem_1.cpp",
    "content": "// ArduinoJson - https://arduinojson.org\n// Copyright © 2014-2025, Benoit BLANCHON\n// MIT License\n\n#define ARDUINOJSON_ENABLE_PROGMEM 1\n#include <ArduinoJson.h>\n\n#include <catch.hpp>\n\nTEST_CASE(\"Flash strings\") {\n  JsonDocument doc;\n\n  SECTION(\"deserializeJson()\") {\n    DeserializationError err = deserializeJson(doc, F(\"{'hello':'world'}\"));\n\n    REQUIRE(err == DeserializationError::Ok);\n    REQUIRE(doc[\"hello\"] == \"world\");\n  }\n\n  SECTION(\"JsonDocument::operator[]\") {\n    doc[F(\"hello\")] = F(\"world\");\n\n    REQUIRE(doc[\"hello\"] == \"world\");\n  }\n\n  SECTION(\"JsonDocument::add()\") {\n    doc.add(F(\"world\"));\n\n    REQUIRE(doc[0] == \"world\");\n  }\n\n  SECTION(\"JsonVariant::set()\") {\n    JsonVariant var = doc.to<JsonVariant>();\n\n    var.set(F(\"world\"));\n\n    REQUIRE(var == \"world\");\n  }\n\n  SECTION(\"MemberProxy::operator==\") {\n    doc[\"hello\"] = \"world\";\n\n    REQUIRE(doc[\"hello\"] == F(\"world\"));\n  }\n\n  SECTION(\"ElementProxy::operator==\") {\n    doc.add(\"world\");\n\n    REQUIRE(doc[0] == F(\"world\"));\n  }\n}\n\nTEST_CASE(\"parseNumber()\") {  // tables are in Flash\n  using ArduinoJson::detail::parseNumber;\n\n  CHECK(parseNumber<float>(\"1\") == 1.f);\n  CHECK(parseNumber<float>(\"1.23\") == 1.23f);\n  CHECK(parseNumber<float>(\"-1.23e34\") == -1.23e34f);\n}\n\nTEST_CASE(\"strlen_P\") {\n  CHECK(strlen_P(PSTR(\"\")) == 0);\n  CHECK(strlen_P(PSTR(\"a\")) == 1);\n  CHECK(strlen_P(PSTR(\"ac\")) == 2);\n}\n\nTEST_CASE(\"strncmp_P\") {\n  CHECK(strncmp_P(\"a\", PSTR(\"b\"), 0) == 0);\n  CHECK(strncmp_P(\"a\", PSTR(\"b\"), 1) == -1);\n  CHECK(strncmp_P(\"b\", PSTR(\"a\"), 1) == 1);\n  CHECK(strncmp_P(\"a\", PSTR(\"a\"), 0) == 0);\n  CHECK(strncmp_P(\"a\", PSTR(\"b\"), 2) == -1);\n  CHECK(strncmp_P(\"b\", PSTR(\"a\"), 2) == 1);\n  CHECK(strncmp_P(\"a\", PSTR(\"a\"), 2) == 0);\n}\n\nTEST_CASE(\"strcmp_P\") {\n  CHECK(strcmp_P(\"a\", PSTR(\"b\")) == -1);\n  CHECK(strcmp_P(\"b\", PSTR(\"a\")) == 1);\n  CHECK(strcmp_P(\"a\", PSTR(\"a\")) == 0);\n  CHECK(strcmp_P(\"aa\", PSTR(\"ab\")) == -1);\n  CHECK(strcmp_P(\"ab\", PSTR(\"aa\")) == 1);\n  CHECK(strcmp_P(\"aa\", PSTR(\"aa\")) == 0);\n}\n\nTEST_CASE(\"memcpy_P\") {\n  char dst[4];\n  CHECK(memcpy_P(dst, PSTR(\"ABC\"), 4) == dst);\n  CHECK(dst[0] == 'A');\n  CHECK(dst[1] == 'B');\n  CHECK(dst[2] == 'C');\n  CHECK(dst[3] == 0);\n}\n\nTEST_CASE(\"BoundedReader<const __FlashStringHelper*>\") {\n  using namespace ArduinoJson::detail;\n\n  SECTION(\"read\") {\n    BoundedReader<const __FlashStringHelper*> reader(F(\"\\x01\\xFF\"), 2);\n    REQUIRE(reader.read() == 0x01);\n    REQUIRE(reader.read() == 0xFF);\n    REQUIRE(reader.read() == -1);\n    REQUIRE(reader.read() == -1);\n  }\n\n  SECTION(\"readBytes() all at once\") {\n    BoundedReader<const __FlashStringHelper*> reader(F(\"ABCD\"), 3);\n\n    char buffer[8] = \"abcd\";\n    REQUIRE(reader.readBytes(buffer, 4) == 3);\n\n    REQUIRE(buffer[0] == 'A');\n    REQUIRE(buffer[1] == 'B');\n    REQUIRE(buffer[2] == 'C');\n    REQUIRE(buffer[3] == 'd');\n  }\n\n  SECTION(\"readBytes() in two parts\") {\n    BoundedReader<const __FlashStringHelper*> reader(F(\"ABCDEF\"), 6);\n\n    char buffer[8] = \"abcdefg\";\n    REQUIRE(reader.readBytes(buffer, 4) == 4);\n    REQUIRE(reader.readBytes(buffer + 4, 4) == 2);\n\n    REQUIRE(buffer[0] == 'A');\n    REQUIRE(buffer[1] == 'B');\n    REQUIRE(buffer[2] == 'C');\n    REQUIRE(buffer[3] == 'D');\n    REQUIRE(buffer[4] == 'E');\n    REQUIRE(buffer[5] == 'F');\n    REQUIRE(buffer[6] == 'g');\n  }\n}\n\nTEST_CASE(\"Reader<const __FlashStringHelper*>\") {\n  using namespace ArduinoJson::detail;\n\n  SECTION(\"read()\") {\n    Reader<const __FlashStringHelper*> reader(F(\"\\x01\\xFF\\x00\\x12\"));\n    REQUIRE(reader.read() == 0x01);\n    REQUIRE(reader.read() == 0xFF);\n    REQUIRE(reader.read() == 0);\n    REQUIRE(reader.read() == 0x12);\n  }\n\n  SECTION(\"readBytes() all at once\") {\n    Reader<const __FlashStringHelper*> reader(F(\"ABCD\"));\n\n    char buffer[8] = \"abcd\";\n    REQUIRE(reader.readBytes(buffer, 3) == 3);\n\n    REQUIRE(buffer[0] == 'A');\n    REQUIRE(buffer[1] == 'B');\n    REQUIRE(buffer[2] == 'C');\n    REQUIRE(buffer[3] == 'd');\n  }\n\n  SECTION(\"readBytes() in two parts\") {\n    Reader<const __FlashStringHelper*> reader(F(\"ABCDEF\"));\n\n    char buffer[8] = \"abcdefg\";\n    REQUIRE(reader.readBytes(buffer, 4) == 4);\n    REQUIRE(reader.readBytes(buffer + 4, 2) == 2);\n\n    REQUIRE(buffer[0] == 'A');\n    REQUIRE(buffer[1] == 'B');\n    REQUIRE(buffer[2] == 'C');\n    REQUIRE(buffer[3] == 'D');\n    REQUIRE(buffer[4] == 'E');\n    REQUIRE(buffer[5] == 'F');\n    REQUIRE(buffer[6] == 'g');\n  }\n}\n\nstatic void testStringification(DeserializationError error,\n                                std::string expected) {\n  const __FlashStringHelper* s = error.f_str();\n  CHECK(reinterpret_cast<const char*>(convertFlashToPtr(s)) == expected);\n}\n\n#define TEST_STRINGIFICATION(symbol) \\\n  testStringification(DeserializationError::symbol, #symbol)\n\nTEST_CASE(\"DeserializationError::f_str()\") {\n  TEST_STRINGIFICATION(Ok);\n  TEST_STRINGIFICATION(EmptyInput);\n  TEST_STRINGIFICATION(IncompleteInput);\n  TEST_STRINGIFICATION(InvalidInput);\n  TEST_STRINGIFICATION(NoMemory);\n  TEST_STRINGIFICATION(TooDeep);\n}\n"
  },
  {
    "path": "extras/tests/MixedConfiguration/issue1707.cpp",
    "content": "// ArduinoJson - https://arduinojson.org\n// Copyright © 2014-2025, Benoit BLANCHON\n// MIT License\n\n#define ARDUINO\n#define memcpy_P(dest, src, n) memcpy((dest), (src), (n))\n\n#include <ArduinoJson.h>\n\n#include <catch.hpp>\n\nTEST_CASE(\"Issue1707\") {\n  JsonDocument doc;\n\n  DeserializationError err = deserializeJson(doc, F(\"{\\\"hello\\\":12}\"));\n  REQUIRE(err == DeserializationError::Ok);\n}\n"
  },
  {
    "path": "extras/tests/MixedConfiguration/string_length_size_1.cpp",
    "content": "#define ARDUINOJSON_STRING_LENGTH_SIZE 1\n#include <ArduinoJson.h>\n\n#include <catch.hpp>\n#include <string>\n\n#include \"Literals.hpp\"\n\nTEST_CASE(\"ARDUINOJSON_STRING_LENGTH_SIZE == 1\") {\n  JsonDocument doc;\n\n  SECTION(\"set(std::string)\") {\n    SECTION(\"returns true if len <= 255\") {\n      auto result = doc.set(std::string(255, '?'));\n\n      REQUIRE(result == true);\n      REQUIRE(doc.overflowed() == false);\n    }\n\n    SECTION(\"returns false if len >= 256\") {\n      auto result = doc.set(std::string(256, '?'));\n\n      REQUIRE(result == false);\n      REQUIRE(doc.overflowed() == true);\n    }\n  }\n\n  SECTION(\"set(MsgPackBinary)\") {\n    SECTION(\"returns true if size <= 253\") {\n      auto str = std::string(253, '?');\n      auto result = doc.set(MsgPackBinary(str.data(), str.size()));\n\n      REQUIRE(result == true);\n      REQUIRE(doc.overflowed() == false);\n    }\n\n    SECTION(\"returns false if size >= 254\") {\n      auto str = std::string(254, '?');\n      auto result = doc.set(MsgPackBinary(str.data(), str.size()));\n\n      REQUIRE(result == false);\n      REQUIRE(doc.overflowed() == true);\n    }\n  }\n\n  SECTION(\"set(MsgPackExtension)\") {\n    SECTION(\"returns true if size <= 252\") {\n      auto str = std::string(252, '?');\n      auto result = doc.set(MsgPackExtension(1, str.data(), str.size()));\n\n      REQUIRE(result == true);\n      REQUIRE(doc.overflowed() == false);\n    }\n\n    SECTION(\"returns false if size >= 253\") {\n      auto str = std::string(253, '?');\n      auto result = doc.set(MsgPackExtension(1, str.data(), str.size()));\n\n      REQUIRE(result == false);\n      REQUIRE(doc.overflowed() == true);\n    }\n  }\n\n  SECTION(\"deserializeJson()\") {\n    SECTION(\"returns Ok if string length <= 255\") {\n      auto input = \"\\\"\" + std::string(255, '?') + \"\\\"\";\n\n      auto err = deserializeJson(doc, input);\n\n      REQUIRE(err == DeserializationError::Ok);\n    }\n\n    SECTION(\"returns NoMemory if string length >= 256\") {\n      auto input = \"\\\"\" + std::string(256, '?') + \"\\\"\";\n\n      auto err = deserializeJson(doc, input);\n\n      REQUIRE(err == DeserializationError::NoMemory);\n    }\n  }\n\n  SECTION(\"deserializeMsgPack()\") {\n    SECTION(\"returns Ok if string length <= 255\") {\n      auto input = \"\\xd9\\xff\" + std::string(255, '?');\n\n      auto err = deserializeMsgPack(doc, input);\n\n      REQUIRE(err == DeserializationError::Ok);\n    }\n\n    SECTION(\"returns NoMemory if string length >= 256\") {\n      auto input = \"\\xda\\x01\\x00\"_s + std::string(256, '?');\n\n      auto err = deserializeMsgPack(doc, input);\n\n      REQUIRE(err == DeserializationError::NoMemory);\n    }\n\n    SECTION(\"returns Ok if binary size <= 253\") {\n      auto input = \"\\xc4\\xfd\" + std::string(253, '?');\n\n      auto err = deserializeMsgPack(doc, input);\n\n      REQUIRE(err == DeserializationError::Ok);\n    }\n\n    SECTION(\"returns NoMemory if binary size >= 254\") {\n      auto input = \"\\xc4\\xfe\" + std::string(254, '?');\n\n      auto err = deserializeMsgPack(doc, input);\n\n      REQUIRE(err == DeserializationError::NoMemory);\n    }\n\n    SECTION(\"returns Ok if extension size <= 252\") {\n      auto input = \"\\xc7\\xfc\\x01\" + std::string(252, '?');\n\n      auto err = deserializeMsgPack(doc, input);\n\n      REQUIRE(err == DeserializationError::Ok);\n    }\n\n    SECTION(\"returns NoMemory if binary size >= 253\") {\n      auto input = \"\\xc7\\xfd\\x01\" + std::string(253, '?');\n\n      auto err = deserializeMsgPack(doc, input);\n\n      REQUIRE(err == DeserializationError::NoMemory);\n    }\n  }\n}\n"
  },
  {
    "path": "extras/tests/MixedConfiguration/string_length_size_2.cpp",
    "content": "#define ARDUINOJSON_STRING_LENGTH_SIZE 2\n#include <ArduinoJson.h>\n\n#include <catch.hpp>\n#include <string>\n\n#include \"Literals.hpp\"\n\nTEST_CASE(\"ARDUINOJSON_STRING_LENGTH_SIZE == 2\") {\n  JsonDocument doc;\n\n  SECTION(\"set(std::string)\") {\n    SECTION(\"returns true if len <= 65535\") {\n      auto result = doc.set(std::string(65535, '?'));\n\n      REQUIRE(result == true);\n      REQUIRE(doc.overflowed() == false);\n    }\n\n    SECTION(\"returns false if len >= 65536\") {\n      auto result = doc.set(std::string(65536, '?'));\n\n      REQUIRE(result == false);\n      REQUIRE(doc.overflowed() == true);\n    }\n  }\n\n  SECTION(\"set(MsgPackBinary)\") {\n    SECTION(\"returns true if size <= 65532\") {\n      auto str = std::string(65532, '?');\n      auto result = doc.set(MsgPackBinary(str.data(), str.size()));\n\n      REQUIRE(result == true);\n      REQUIRE(doc.overflowed() == false);\n    }\n\n    SECTION(\"returns false if size >= 65533\") {\n      auto str = std::string(65533, '?');\n      auto result = doc.set(MsgPackBinary(str.data(), str.size()));\n\n      REQUIRE(result == false);\n      REQUIRE(doc.overflowed() == true);\n    }\n  }\n\n  SECTION(\"set(MsgPackExtension)\") {\n    SECTION(\"returns true if size <= 65531\") {\n      auto str = std::string(65531, '?');\n      auto result = doc.set(MsgPackExtension(1, str.data(), str.size()));\n\n      REQUIRE(result == true);\n      REQUIRE(doc.overflowed() == false);\n    }\n\n    SECTION(\"returns false if size >= 65532\") {\n      auto str = std::string(65532, '?');\n      auto result = doc.set(MsgPackExtension(1, str.data(), str.size()));\n\n      REQUIRE(result == false);\n      REQUIRE(doc.overflowed() == true);\n    }\n  }\n\n  SECTION(\"deserializeJson()\") {\n    SECTION(\"returns Ok if string length <= 65535\") {\n      auto input = \"\\\"\" + std::string(65535, '?') + \"\\\"\";\n\n      auto err = deserializeJson(doc, input);\n\n      REQUIRE(err == DeserializationError::Ok);\n    }\n\n    SECTION(\"returns NoMemory if string length >= 65536\") {\n      auto input = \"\\\"\" + std::string(65536, '?') + \"\\\"\";\n\n      auto err = deserializeJson(doc, input);\n\n      REQUIRE(err == DeserializationError::NoMemory);\n    }\n  }\n\n  SECTION(\"deserializeMsgPack()\") {\n    SECTION(\"returns Ok if string length <= 65535\") {\n      auto input = \"\\xda\\xff\\xff\" + std::string(65535, '?');\n\n      auto err = deserializeMsgPack(doc, input);\n\n      REQUIRE(err == DeserializationError::Ok);\n    }\n\n    SECTION(\"returns NoMemory if string length >= 65536\") {\n      auto input = \"\\xdb\\x00\\x01\\x00\\x00\"_s + std::string(65536, '?');\n\n      auto err = deserializeMsgPack(doc, input);\n\n      REQUIRE(err == DeserializationError::NoMemory);\n    }\n\n    SECTION(\"returns Ok if binary size <= 65532\") {\n      auto input = \"\\xc5\\xff\\xfc\" + std::string(65532, '?');\n\n      auto err = deserializeMsgPack(doc, input);\n\n      REQUIRE(err == DeserializationError::Ok);\n    }\n\n    SECTION(\"returns NoMemory if binary size >= 65534\") {\n      auto input = \"\\xc5\\xff\\xfd\" + std::string(65534, '?');\n\n      auto err = deserializeMsgPack(doc, input);\n\n      REQUIRE(err == DeserializationError::NoMemory);\n    }\n\n    // https://oss-fuzz.com/testcase?key=5354792971993088\n    SECTION(\"doesn't overflow if binary size == 0xFFFF\") {\n      auto input = \"\\xc5\\xff\\xff\"_s;\n\n      auto err = deserializeMsgPack(doc, input);\n\n      REQUIRE(err == DeserializationError::NoMemory);\n    }\n\n    SECTION(\"returns Ok if extension size <= 65531\") {\n      auto input = \"\\xc8\\xff\\xfb\\x01\" + std::string(65531, '?');\n\n      auto err = deserializeMsgPack(doc, input);\n\n      REQUIRE(err == DeserializationError::Ok);\n    }\n\n    SECTION(\"returns NoMemory if extension size >= 65532\") {\n      auto input = \"\\xc8\\xff\\xfc\\x01\" + std::string(65532, '?');\n\n      auto err = deserializeMsgPack(doc, input);\n\n      REQUIRE(err == DeserializationError::NoMemory);\n    }\n  }\n}\n"
  },
  {
    "path": "extras/tests/MixedConfiguration/string_length_size_4.cpp",
    "content": "#define ARDUINOJSON_STRING_LENGTH_SIZE 4\n#include <ArduinoJson.h>\n\n#include <catch.hpp>\n#include <string>\n\n#include \"Literals.hpp\"\n\nTEST_CASE(\"ARDUINOJSON_STRING_LENGTH_SIZE == 4\") {\n  JsonDocument doc;\n\n  SECTION(\"set(std::string)\") {\n    SECTION(\"returns true if string length >= 65536\") {\n      auto result = doc.set(std::string(65536, '?'));\n\n      REQUIRE(result == true);\n      REQUIRE(doc.overflowed() == false);\n    }\n  }\n\n  SECTION(\"set(MsgPackBinary)\") {\n    SECTION(\"returns true if size >= 65536\") {\n      auto str = std::string(65536, '?');\n      auto result = doc.set(MsgPackBinary(str.data(), str.size()));\n\n      REQUIRE(result == true);\n      REQUIRE(doc.overflowed() == false);\n    }\n  }\n\n  SECTION(\"set(MsgPackExtension)\") {\n    SECTION(\"returns true if size >= 65532\") {\n      auto str = std::string(65532, '?');\n      auto result = doc.set(MsgPackExtension(1, str.data(), str.size()));\n\n      REQUIRE(result == true);\n      REQUIRE(doc.overflowed() == false);\n    }\n  }\n\n  SECTION(\"deserializeJson()\") {\n    SECTION(\"returns Ok if string length >= 65536\") {\n      auto input = \"\\\"\" + std::string(65536, '?') + \"\\\"\";\n\n      auto err = deserializeJson(doc, input);\n\n      REQUIRE(err == DeserializationError::Ok);\n    }\n  }\n\n  SECTION(\"deserializeMsgPack()\") {\n    SECTION(\"returns Ok if string size >= 65536\") {\n      auto input = \"\\xda\\xff\\xff\" + std::string(65536, '?');\n\n      auto err = deserializeMsgPack(doc, input);\n\n      REQUIRE(err == DeserializationError::Ok);\n    }\n\n    SECTION(\"returns Ok if binary size >= 65536\") {\n      auto input = \"\\xc5\\xff\\xff\" + std::string(65536, '?');\n\n      auto err = deserializeMsgPack(doc, input);\n\n      REQUIRE(err == DeserializationError::Ok);\n    }\n\n    SECTION(\"returns Ok if extension size >= 65532\") {\n      auto input = \"\\xc8\\xff\\xfb\\x01\" + std::string(65532, '?');\n\n      auto err = deserializeMsgPack(doc, input);\n\n      REQUIRE(err == DeserializationError::Ok);\n    }\n\n    // https://oss-fuzz.com/testcase?key=5354792971993088\n    SECTION(\"doesn't overflow if binary size == 0xFFFFFFFF\") {\n      auto input = \"\\xc6\\xff\\xff\\xff\\xff\"_s;\n\n      auto err = deserializeMsgPack(doc, input);\n\n      REQUIRE(err == DeserializationError::NoMemory);\n    }\n\n    SECTION(\"doesn't overflow if string size == 0xFFFFFFFF\") {\n      auto input = \"\\xdb\\xff\\xff\\xff\\xff???????????????????\"_s;\n\n      auto err = deserializeMsgPack(doc, input);\n\n      REQUIRE(err != DeserializationError::Ok);\n    }\n\n    SECTION(\"bin 32\") {\n      auto str = std::string(65536, '?');\n      auto input = \"\\xc6\\x00\\x01\\x00\\x00\"_s + str;\n\n      auto err = deserializeMsgPack(doc, input);\n\n      REQUIRE(err == DeserializationError::Ok);\n      REQUIRE(doc.is<MsgPackBinary>());\n      auto binary = doc.as<MsgPackBinary>();\n      REQUIRE(binary.size() == 65536);\n      REQUIRE(binary.data() != nullptr);\n      REQUIRE(std::string(reinterpret_cast<const char*>(binary.data()),\n                          binary.size()) == str);\n    }\n\n    SECTION(\"ext 32 deserialization\") {\n      auto str = std::string(65536, '?');\n      auto input = \"\\xc9\\x00\\x01\\x00\\x00\\x2a\"_s + str;\n\n      auto err = deserializeMsgPack(doc, input);\n\n      REQUIRE(err == DeserializationError::Ok);\n      REQUIRE(doc.is<MsgPackExtension>());\n      auto value = doc.as<MsgPackExtension>();\n      REQUIRE(value.type() == 42);\n      REQUIRE(value.size() == 65536);\n      REQUIRE(value.data() != nullptr);\n      REQUIRE(std::string(reinterpret_cast<const char*>(value.data()),\n                          value.size()) == str);\n    }\n  }\n\n  SECTION(\"serializeMsgPack()\") {\n    SECTION(\"bin 32 serialization\") {\n      auto str = std::string(65536, '?');\n      doc.set(MsgPackBinary(str.data(), str.size()));\n\n      std::string output;\n      auto result = serializeMsgPack(doc, output);\n\n      REQUIRE(result == 5 + str.size());\n      REQUIRE(output == \"\\xc6\\x00\\x01\\x00\\x00\"_s + str);\n    }\n\n    SECTION(\"ext 32 serialization\") {\n      auto str = std::string(65536, '?');\n      doc.set(MsgPackExtension(42, str.data(), str.size()));\n\n      std::string output;\n      auto result = serializeMsgPack(doc, output);\n\n      REQUIRE(result == 6 + str.size());\n      REQUIRE(output == \"\\xc9\\x00\\x01\\x00\\x00\\x2a\"_s + str);\n    }\n\n    SECTION(\"str 32 serialization\") {\n      auto str = std::string(65536, '?');\n      doc.set(str);\n\n      std::string output;\n      auto result = serializeMsgPack(doc, output);\n\n      REQUIRE(result == 5 + str.size());\n      REQUIRE(output == \"\\xDB\\x00\\x01\\x00\\x00\"_s + str);\n    }\n  }\n}\n"
  },
  {
    "path": "extras/tests/MixedConfiguration/use_double_0.cpp",
    "content": "#define ARDUINOJSON_USE_DOUBLE 0\n#include <ArduinoJson.h>\n\n#include <catch.hpp>\n\nnamespace my {\nusing ArduinoJson::detail::isinf;\n}  // namespace my\n\nvoid checkFloat(const char* input, float expected) {\n  using ArduinoJson::detail::NumberType;\n  using ArduinoJson::detail::parseNumber;\n  CAPTURE(input);\n  auto result = parseNumber(input);\n  REQUIRE(result.type() == NumberType::Float);\n  REQUIRE(result.asFloat() == Approx(expected));\n}\n\nTEST_CASE(\"ARDUINOJSON_USE_DOUBLE == 0\") {\n  SECTION(\"serializeJson()\") {\n    JsonDocument doc;\n    JsonObject root = doc.to<JsonObject>();\n\n    root[\"pi\"] = 3.14;\n    root[\"e\"] = 2.72;\n\n    std::string json;\n    serializeJson(doc, json);\n\n    REQUIRE(json == \"{\\\"pi\\\":3.14,\\\"e\\\":2.72}\");\n  }\n\n  SECTION(\"parseNumber()\") {\n    using ArduinoJson::detail::NumberType;\n    using ArduinoJson::detail::parseNumber;\n\n    SECTION(\"Large positive number\") {\n      auto result = parseNumber(\"1e300\");\n      REQUIRE(result.type() == NumberType::Float);\n      REQUIRE(result.asFloat() > 0);\n      REQUIRE(my::isinf(result.asFloat()));\n    }\n\n    SECTION(\"Large negative number\") {\n      auto result = parseNumber(\"-1e300\");\n      REQUIRE(result.type() == NumberType::Float);\n      REQUIRE(result.asFloat() < 0);\n      REQUIRE(my::isinf(result.asFloat()));\n    }\n\n    SECTION(\"Too small to be represented\") {\n      auto result = parseNumber(\"1e-300\");\n      REQUIRE(result.type() == NumberType::Float);\n      REQUIRE(result.asFloat() == 0);\n    }\n\n    SECTION(\"MantissaTooLongToFit\") {\n      checkFloat(\"0.340282346638528861111111111111\", 0.34028234663852886f);\n      checkFloat(\"34028234663852886.11111111111111\", 34028234663852886.0f);\n      checkFloat(\"34028234.66385288611111111111111\", 34028234.663852886f);\n\n      checkFloat(\"-0.340282346638528861111111111111\", -0.34028234663852886f);\n      checkFloat(\"-34028234663852886.11111111111111\", -34028234663852886.0f);\n      checkFloat(\"-34028234.66385288611111111111111\", -34028234.663852886f);\n    }\n  }\n}\n"
  },
  {
    "path": "extras/tests/MixedConfiguration/use_double_1.cpp",
    "content": "#define ARDUINOJSON_USE_DOUBLE 1\n#include <ArduinoJson.h>\n\n#include <catch.hpp>\n\nTEST_CASE(\"ARDUINOJSON_USE_DOUBLE == 1\") {\n  JsonDocument doc;\n  JsonObject root = doc.to<JsonObject>();\n\n  root[\"pi\"] = 3.14;\n  root[\"e\"] = 2.72;\n\n  std::string json;\n  serializeJson(doc, json);\n\n  REQUIRE(json == \"{\\\"pi\\\":3.14,\\\"e\\\":2.72}\");\n}\n"
  },
  {
    "path": "extras/tests/MixedConfiguration/use_long_long_0.cpp",
    "content": "#define ARDUINOJSON_USE_LONG_LONG 0\n#include <ArduinoJson.h>\n\n#include <catch.hpp>\n\n#include \"Literals.hpp\"\n\nTEST_CASE(\"ARDUINOJSON_USE_LONG_LONG == 0\") {\n  JsonDocument doc;\n\n  SECTION(\"smoke test\") {\n    doc[\"A\"] = 42;\n    doc[\"B\"] = 84;\n\n    std::string json;\n    serializeJson(doc, json);\n\n    REQUIRE(json == \"{\\\"A\\\":42,\\\"B\\\":84}\");\n  }\n\n  SECTION(\"deserializeMsgPack()\") {\n    SECTION(\"cf 00 00 00 00 ff ff ff ff\") {\n      auto err =\n          deserializeMsgPack(doc, \"\\xcf\\x00\\x00\\x00\\x00\\xff\\xff\\xff\\xff\"_s);\n\n      REQUIRE(err == DeserializationError::Ok);\n      REQUIRE(doc.as<uint32_t>() == 0xFFFFFFFF);\n    }\n\n    SECTION(\"cf 00 00 00 01 00 00 00 00\") {\n      auto err =\n          deserializeMsgPack(doc, \"\\xcf\\x00\\x00\\x00\\x01\\x00\\x00\\x00\\x00\"_s);\n\n      REQUIRE(err == DeserializationError::Ok);\n      REQUIRE(doc.isNull());\n    }\n  }\n}\n"
  },
  {
    "path": "extras/tests/MixedConfiguration/use_long_long_1.cpp",
    "content": "#define ARDUINOJSON_USE_LONG_LONG 1\n#include <ArduinoJson.h>\n\n#include <catch.hpp>\n\nTEST_CASE(\"ARDUINOJSON_USE_LONG_LONG == 1\") {\n  JsonDocument doc;\n  JsonObject root = doc.to<JsonObject>();\n\n  root[\"A\"] = 123456789123456789;\n  root[\"B\"] = 987654321987654321;\n\n  std::string json;\n  serializeJson(doc, json);\n\n  REQUIRE(json == \"{\\\"A\\\":123456789123456789,\\\"B\\\":987654321987654321}\");\n}\n"
  },
  {
    "path": "extras/tests/MsgPackDeserializer/CMakeLists.txt",
    "content": "# ArduinoJson - https://arduinojson.org\n# Copyright © 2014-2025, Benoit BLANCHON\n# MIT License\n\nadd_executable(MsgPackDeserializerTests\n\tdeserializeArray.cpp\n\tdeserializeObject.cpp\n\tdeserializeVariant.cpp\n\tdestination_types.cpp\n\tdoubleToFloat.cpp\n\terrors.cpp\n\tfilter.cpp\n\tinput_types.cpp\n\tnestingLimit.cpp\n)\n\nadd_test(MsgPackDeserializer MsgPackDeserializerTests)\n\nset_tests_properties(MsgPackDeserializer\n\tPROPERTIES\n\t\tLABELS \"Catch\"\n)\n"
  },
  {
    "path": "extras/tests/MsgPackDeserializer/deserializeArray.cpp",
    "content": "// ArduinoJson - https://arduinojson.org\n// Copyright © 2014-2025, Benoit BLANCHON\n// MIT License\n\n#include <ArduinoJson.h>\n#include <catch.hpp>\n\n#include \"Allocators.hpp\"\n\nTEST_CASE(\"deserialize MsgPack array\") {\n  SpyingAllocator spy;\n  JsonDocument doc(&spy);\n\n  SECTION(\"fixarray\") {\n    SECTION(\"empty\") {\n      const char* input = \"\\x90\";\n\n      DeserializationError error = deserializeMsgPack(doc, input);\n      JsonArray array = doc.as<JsonArray>();\n\n      REQUIRE(error == DeserializationError::Ok);\n      REQUIRE(array.size() == 0);\n    }\n\n    SECTION(\"two integers\") {\n      const char* input = \"\\x92\\x01\\x02\";\n\n      DeserializationError error = deserializeMsgPack(doc, input);\n      JsonArray array = doc.as<JsonArray>();\n\n      REQUIRE(error == DeserializationError::Ok);\n      REQUIRE(array.size() == 2);\n      REQUIRE(array[0] == 1);\n      REQUIRE(array[1] == 2);\n    }\n\n    SECTION(\"tiny strings\") {\n      DeserializationError error =\n          deserializeMsgPack(doc, \"\\x92\\xA3xxx\\xA3yyy\");\n\n      REQUIRE(error == DeserializationError::Ok);\n      REQUIRE(doc.is<JsonArray>());\n      REQUIRE(doc.size() == 2);\n      REQUIRE(doc[0] == \"xxx\");\n      REQUIRE(doc[1] == \"yyy\");\n      REQUIRE(spy.log() == AllocatorLog{\n                               Allocate(sizeofPool()),\n                               Allocate(sizeofString(\"xxx\")),\n                               // Buffer is reused for the next string\n                               Deallocate(sizeofString(\"xxx\")),\n                               Reallocate(sizeofPool(), sizeofPool(2)),\n                           });\n    }\n  }\n\n  SECTION(\"array 16\") {\n    SECTION(\"empty\") {\n      const char* input = \"\\xDC\\x00\\x00\";\n\n      DeserializationError error = deserializeMsgPack(doc, input);\n      JsonArray array = doc.as<JsonArray>();\n\n      REQUIRE(error == DeserializationError::Ok);\n      REQUIRE(array.size() == 0);\n    }\n\n    SECTION(\"two strings\") {\n      const char* input = \"\\xDC\\x00\\x02\\xA5hello\\xA5world\";\n\n      DeserializationError error = deserializeMsgPack(doc, input);\n      JsonArray array = doc.as<JsonArray>();\n\n      REQUIRE(error == DeserializationError::Ok);\n      REQUIRE(array.size() == 2);\n      REQUIRE(array[0] == \"hello\");\n      REQUIRE(array[1] == \"world\");\n    }\n  }\n\n  SECTION(\"array 32\") {\n    SECTION(\"empty\") {\n      const char* input = \"\\xDD\\x00\\x00\\x00\\x00\";\n\n      DeserializationError error = deserializeMsgPack(doc, input);\n      JsonArray array = doc.as<JsonArray>();\n\n      REQUIRE(error == DeserializationError::Ok);\n      REQUIRE(array.size() == 0);\n    }\n\n    SECTION(\"two floats\") {\n      const char* input =\n          \"\\xDD\\x00\\x00\\x00\\x02\\xCA\\x00\\x00\\x00\\x00\\xCA\\x40\\x48\\xF5\\xC3\";\n\n      DeserializationError error = deserializeMsgPack(doc, input);\n      JsonArray array = doc.as<JsonArray>();\n\n      REQUIRE(error == DeserializationError::Ok);\n      REQUIRE(array.size() == 2);\n      REQUIRE(array[0] == 0.0f);\n      REQUIRE(array[1] == 3.14f);\n    }\n  }\n}\n"
  },
  {
    "path": "extras/tests/MsgPackDeserializer/deserializeObject.cpp",
    "content": "// ArduinoJson - https://arduinojson.org\n// Copyright © 2014-2025, Benoit BLANCHON\n// MIT License\n\n#include <ArduinoJson.h>\n#include <catch.hpp>\n\nTEST_CASE(\"deserialize MsgPack object\") {\n  JsonDocument doc;\n\n  SECTION(\"fixmap\") {\n    SECTION(\"empty\") {\n      const char* input = \"\\x80\";\n\n      DeserializationError error = deserializeMsgPack(doc, input);\n      JsonObject obj = doc.as<JsonObject>();\n\n      REQUIRE(error == DeserializationError::Ok);\n      REQUIRE(doc.is<JsonObject>());\n      REQUIRE(obj.size() == 0);\n    }\n\n    SECTION(\"two integers\") {\n      const char* input = \"\\x82\\xA3one\\x01\\xA3two\\x02\";\n\n      DeserializationError error = deserializeMsgPack(doc, input);\n      JsonObject obj = doc.as<JsonObject>();\n\n      REQUIRE(error == DeserializationError::Ok);\n      REQUIRE(doc.is<JsonObject>());\n      REQUIRE(obj.size() == 2);\n      REQUIRE(obj[\"one\"] == 1);\n      REQUIRE(obj[\"two\"] == 2);\n    }\n\n    SECTION(\"key is str 8\") {\n      const char* input = \"\\x82\\xd9\\x03one\\x01\\xd9\\x03two\\x02\";\n\n      DeserializationError error = deserializeMsgPack(doc, input);\n      JsonObject obj = doc.as<JsonObject>();\n\n      REQUIRE(error == DeserializationError::Ok);\n      REQUIRE(doc.is<JsonObject>());\n      REQUIRE(obj.size() == 2);\n      REQUIRE(obj[\"one\"] == 1);\n      REQUIRE(obj[\"two\"] == 2);\n    }\n\n    SECTION(\"key is str 16\") {\n      const char* input = \"\\x82\\xda\\x00\\x03one\\x01\\xda\\x00\\x03two\\x02\";\n\n      DeserializationError error = deserializeMsgPack(doc, input);\n      JsonObject obj = doc.as<JsonObject>();\n\n      REQUIRE(error == DeserializationError::Ok);\n      REQUIRE(doc.is<JsonObject>());\n      REQUIRE(obj.size() == 2);\n      REQUIRE(obj[\"one\"] == 1);\n      REQUIRE(obj[\"two\"] == 2);\n    }\n\n    SECTION(\"key is str 32\") {\n      const char* input =\n          \"\\x82\\xdb\\x00\\x00\\x00\\x03one\\x01\\xdb\\x00\\x00\\x00\\x03two\\x02\";\n\n      DeserializationError error = deserializeMsgPack(doc, input);\n      JsonObject obj = doc.as<JsonObject>();\n\n      REQUIRE(error == DeserializationError::Ok);\n      REQUIRE(doc.is<JsonObject>());\n      REQUIRE(obj.size() == 2);\n      REQUIRE(obj[\"one\"] == 1);\n      REQUIRE(obj[\"two\"] == 2);\n    }\n  }\n\n  SECTION(\"map 16\") {\n    SECTION(\"empty\") {\n      const char* input = \"\\xDE\\x00\\x00\";\n\n      DeserializationError error = deserializeMsgPack(doc, input);\n      JsonObject obj = doc.as<JsonObject>();\n\n      REQUIRE(error == DeserializationError::Ok);\n      REQUIRE(doc.is<JsonObject>());\n      REQUIRE(obj.size() == 0);\n    }\n\n    SECTION(\"two strings\") {\n      const char* input = \"\\xDE\\x00\\x02\\xA1H\\xA5hello\\xA1W\\xA5world\";\n\n      DeserializationError error = deserializeMsgPack(doc, input);\n      JsonObject obj = doc.as<JsonObject>();\n\n      REQUIRE(error == DeserializationError::Ok);\n      REQUIRE(doc.is<JsonObject>());\n      REQUIRE(obj.size() == 2);\n      REQUIRE(obj[\"H\"] == \"hello\");\n      REQUIRE(obj[\"W\"] == \"world\");\n    }\n  }\n\n  SECTION(\"map 32\") {\n    SECTION(\"empty\") {\n      const char* input = \"\\xDF\\x00\\x00\\x00\\x00\";\n\n      DeserializationError error = deserializeMsgPack(doc, input);\n      JsonObject obj = doc.as<JsonObject>();\n\n      REQUIRE(error == DeserializationError::Ok);\n      REQUIRE(doc.is<JsonObject>());\n      REQUIRE(obj.size() == 0);\n    }\n\n    SECTION(\"two floats\") {\n      const char* input =\n          \"\\xDF\\x00\\x00\\x00\\x02\\xA4zero\\xCA\\x00\\x00\\x00\\x00\\xA2pi\\xCA\\x40\\x48\"\n          \"\\xF5\\xC3\";\n\n      DeserializationError error = deserializeMsgPack(doc, input);\n      JsonObject obj = doc.as<JsonObject>();\n\n      REQUIRE(error == DeserializationError::Ok);\n      REQUIRE(doc.is<JsonObject>());\n      REQUIRE(obj.size() == 2);\n      REQUIRE(obj[\"zero\"] == 0.0f);\n      REQUIRE(obj[\"pi\"] == 3.14f);\n    }\n  }\n}\n"
  },
  {
    "path": "extras/tests/MsgPackDeserializer/deserializeVariant.cpp",
    "content": "// ArduinoJson - https://arduinojson.org\n// Copyright © 2014-2025, Benoit BLANCHON\n// MIT License\n\n#include <ArduinoJson.h>\n#include <catch.hpp>\n\n#include \"Allocators.hpp\"\n#include \"Literals.hpp\"\n\ntemplate <typename T>\nstatic void checkValue(const char* input, T expected) {\n  JsonDocument doc;\n\n  DeserializationError error = deserializeMsgPack(doc, input);\n\n  REQUIRE(error == DeserializationError::Ok);\n  REQUIRE(doc.is<T>());\n  REQUIRE(doc.as<T>() == expected);\n}\n\nstatic void checkError(size_t timebombCountDown, const char* input,\n                       DeserializationError expected) {\n  TimebombAllocator timebomb(timebombCountDown);\n  JsonDocument doc(&timebomb);\n\n  DeserializationError error = deserializeMsgPack(doc, input);\n\n  CAPTURE(input);\n  REQUIRE(error == expected);\n}\n\nTEST_CASE(\"deserialize MsgPack value\") {\n  SECTION(\"nil\") {\n    checkValue(\"\\xc0\", nullptr);\n  }\n\n  SECTION(\"bool\") {\n    checkValue<bool>(\"\\xc2\", false);\n    checkValue<bool>(\"\\xc3\", true);\n  }\n\n  SECTION(\"positive fixint\") {\n    checkValue<int>(\"\\x00\", 0);\n    checkValue<int>(\"\\x7F\", 127);\n  }\n\n  SECTION(\"negative fixint\") {\n    checkValue<int>(\"\\xe0\", -32);\n    checkValue<int>(\"\\xff\", -1);\n  }\n\n  SECTION(\"uint 8\") {\n    checkValue<int>(\"\\xcc\\x00\", 0);\n    checkValue<int>(\"\\xcc\\xff\", 255);\n  }\n\n  SECTION(\"uint 16\") {\n    checkValue<int>(\"\\xcd\\x00\\x00\", 0);\n    checkValue<int>(\"\\xcd\\xFF\\xFF\", 65535);\n    checkValue<int>(\"\\xcd\\x30\\x39\", 12345);\n  }\n\n  SECTION(\"uint 32\") {\n    checkValue<uint32_t>(\"\\xCE\\x00\\x00\\x00\\x00\", 0x00000000U);\n    checkValue<uint32_t>(\"\\xCE\\xFF\\xFF\\xFF\\xFF\", 0xFFFFFFFFU);\n    checkValue<uint32_t>(\"\\xCE\\x12\\x34\\x56\\x78\", 0x12345678U);\n  }\n\n  SECTION(\"uint 64\") {\n#if ARDUINOJSON_USE_LONG_LONG\n    checkValue<uint64_t>(\"\\xCF\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\", 0U);\n    checkValue<uint64_t>(\"\\xCF\\xFF\\xFF\\xFF\\xFF\\xFF\\xFF\\xFF\\xFF\",\n                         0xFFFFFFFFFFFFFFFFU);\n    checkValue<uint64_t>(\"\\xCF\\x12\\x34\\x56\\x78\\x9A\\xBC\\xDE\\xF0\",\n                         0x123456789ABCDEF0U);\n#else\n    checkValue(\"\\xCF\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\", nullptr);\n    checkValue(\"\\xCF\\xFF\\xFF\\xFF\\xFF\\xFF\\xFF\\xFF\\xFF\", nullptr);\n    checkValue(\"\\xCF\\x12\\x34\\x56\\x78\\x9A\\xBC\\xDE\\xF0\", nullptr);\n#endif\n  }\n\n  SECTION(\"int 8\") {\n    checkValue<int>(\"\\xd0\\x00\", 0);\n    checkValue<int>(\"\\xd0\\xff\", -1);\n  }\n\n  SECTION(\"int 16\") {\n    checkValue<int>(\"\\xD1\\x00\\x00\", 0);\n    checkValue<int>(\"\\xD1\\xFF\\xFF\", -1);\n    checkValue<int>(\"\\xD1\\xCF\\xC7\", -12345);\n  }\n\n  SECTION(\"int 32\") {\n    checkValue<int>(\"\\xD2\\x00\\x00\\x00\\x00\", 0);\n    checkValue<int>(\"\\xD2\\xFF\\xFF\\xFF\\xFF\", -1);\n    checkValue<int>(\"\\xD2\\xB6\\x69\\xFD\\x2E\", -1234567890);\n  }\n\n  SECTION(\"int 64\") {\n#if ARDUINOJSON_USE_LONG_LONG\n    checkValue<int64_t>(\"\\xD3\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\", int64_t(0U));\n    checkValue<int64_t>(\"\\xD3\\xFF\\xFF\\xFF\\xFF\\xFF\\xFF\\xFF\\xFF\",\n                        int64_t(0xFFFFFFFFFFFFFFFFU));\n    checkValue<int64_t>(\"\\xD3\\x12\\x34\\x56\\x78\\x9A\\xBC\\xDE\\xF0\",\n                        int64_t(0x123456789ABCDEF0));\n#else\n    checkValue(\"\\xD3\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\", nullptr);\n    checkValue(\"\\xD3\\xFF\\xFF\\xFF\\xFF\\xFF\\xFF\\xFF\\xFF\", nullptr);\n    checkValue(\"\\xD3\\x12\\x34\\x56\\x78\\x9A\\xBC\\xDE\\xF0\", nullptr);\n#endif\n  }\n\n  SECTION(\"float 32\") {\n    checkValue<double>(\"\\xCA\\x00\\x00\\x00\\x00\", 0.0f);\n    checkValue<double>(\"\\xCA\\x40\\x48\\xF5\\xC3\", 3.14f);\n  }\n\n  SECTION(\"float 64\") {\n    checkValue<double>(\"\\xCB\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\", 0.0);\n    checkValue<double>(\"\\xCB\\x40\\x09\\x21\\xCA\\xC0\\x83\\x12\\x6F\", 3.1415);\n  }\n\n  SECTION(\"fixstr\") {\n    checkValue<std::string>(\"\\xA0\", std::string(\"\"));\n    checkValue<std::string>(\"\\xABhello world\", \"hello world\"_s);\n    checkValue<std::string>(\"\\xBFhello world hello world hello !\",\n                            \"hello world hello world hello !\"_s);\n  }\n\n  SECTION(\"str 8\") {\n    checkValue<std::string>(\"\\xd9\\x05hello\", \"hello\"_s);\n  }\n\n  SECTION(\"str 16\") {\n    checkValue<std::string>(\"\\xda\\x00\\x05hello\", \"hello\"_s);\n  }\n\n  SECTION(\"str 32\") {\n    checkValue<std::string>(\"\\xdb\\x00\\x00\\x00\\x05hello\", \"hello\"_s);\n  }\n\n  SECTION(\"bin 8\") {\n    JsonDocument doc;\n\n    DeserializationError error = deserializeMsgPack(doc, \"\\xc4\\x01?\");\n\n    REQUIRE(error == DeserializationError::Ok);\n    REQUIRE(doc.is<MsgPackBinary>());\n    auto binary = doc.as<MsgPackBinary>();\n    REQUIRE(binary.size() == 1);\n    REQUIRE(binary.data() != nullptr);\n    REQUIRE(reinterpret_cast<const char*>(binary.data())[0] == '?');\n  }\n\n  SECTION(\"bin 16\") {\n    JsonDocument doc;\n    auto str = std::string(256, '?');\n    auto input = \"\\xc5\\x01\\x00\"_s + str;\n\n    DeserializationError error = deserializeMsgPack(doc, input);\n\n    REQUIRE(error == DeserializationError::Ok);\n    REQUIRE(doc.is<MsgPackBinary>());\n    auto binary = doc.as<MsgPackBinary>();\n    REQUIRE(binary.size() == 0x100);\n    REQUIRE(binary.data() != nullptr);\n    REQUIRE(std::string(reinterpret_cast<const char*>(binary.data()),\n                        binary.size()) == str);\n  }\n\n  SECTION(\"fixext 1\") {\n    JsonDocument doc;\n\n    auto error = deserializeMsgPack(doc, \"\\xd4\\x01\\x02\");\n\n    REQUIRE(error == DeserializationError::Ok);\n    REQUIRE(doc.is<MsgPackExtension>());\n    auto ext = doc.as<MsgPackExtension>();\n    REQUIRE(ext.type() == 1);\n    REQUIRE(ext.size() == 1);\n    auto data = reinterpret_cast<const uint8_t*>(ext.data());\n    REQUIRE(data[0] == 2);\n  }\n\n  SECTION(\"fixext 2\") {\n    JsonDocument doc;\n\n    auto error = deserializeMsgPack(doc, \"\\xd5\\x01\\x02\\x03\");\n\n    REQUIRE(error == DeserializationError::Ok);\n    REQUIRE(doc.is<MsgPackExtension>());\n    auto ext = doc.as<MsgPackExtension>();\n    REQUIRE(ext.type() == 1);\n    REQUIRE(ext.size() == 2);\n    auto data = reinterpret_cast<const uint8_t*>(ext.data());\n    REQUIRE(data[0] == 2);\n    REQUIRE(data[1] == 3);\n  }\n\n  SECTION(\"fixext 4\") {\n    JsonDocument doc;\n\n    auto error = deserializeMsgPack(doc, \"\\xd6\\x01\\x02\\x03\\x04\\x05\");\n\n    REQUIRE(error == DeserializationError::Ok);\n    REQUIRE(doc.is<MsgPackExtension>());\n    auto ext = doc.as<MsgPackExtension>();\n    REQUIRE(ext.type() == 1);\n    REQUIRE(ext.size() == 4);\n    auto data = reinterpret_cast<const uint8_t*>(ext.data());\n    REQUIRE(data[0] == 2);\n    REQUIRE(data[1] == 3);\n    REQUIRE(data[2] == 4);\n    REQUIRE(data[3] == 5);\n  }\n\n  SECTION(\"fixext 8\") {\n    JsonDocument doc;\n\n    auto error = deserializeMsgPack(doc, \"\\xd7\\x01????????\");\n\n    REQUIRE(error == DeserializationError::Ok);\n    REQUIRE(doc.is<MsgPackExtension>());\n    auto ext = doc.as<MsgPackExtension>();\n    REQUIRE(ext.type() == 1);\n    REQUIRE(ext.size() == 8);\n    auto data = reinterpret_cast<const uint8_t*>(ext.data());\n    REQUIRE(data[0] == '?');\n    REQUIRE(data[7] == '?');\n  }\n\n  SECTION(\"fixext 16\") {\n    JsonDocument doc;\n\n    auto error = deserializeMsgPack(doc, \"\\xd8\\x01?????????????????\");\n\n    REQUIRE(error == DeserializationError::Ok);\n    REQUIRE(doc.is<MsgPackExtension>());\n    auto ext = doc.as<MsgPackExtension>();\n    REQUIRE(ext.type() == 1);\n    REQUIRE(ext.size() == 16);\n    auto data = reinterpret_cast<const uint8_t*>(ext.data());\n    REQUIRE(data[0] == '?');\n    REQUIRE(data[15] == '?');\n  }\n\n  SECTION(\"ext 8\") {\n    JsonDocument doc;\n\n    auto error = deserializeMsgPack(doc, \"\\xc7\\x02\\x01\\x03\\x04\");\n\n    REQUIRE(error == DeserializationError::Ok);\n    REQUIRE(doc.is<MsgPackExtension>());\n    auto ext = doc.as<MsgPackExtension>();\n    REQUIRE(ext.type() == 1);\n    REQUIRE(ext.size() == 2);\n    auto data = reinterpret_cast<const uint8_t*>(ext.data());\n    REQUIRE(data[0] == 3);\n    REQUIRE(data[1] == 4);\n  }\n\n  SECTION(\"ext 16\") {\n    JsonDocument doc;\n\n    auto error = deserializeMsgPack(doc, \"\\xc8\\x00\\x02\\x01\\x03\\x04\");\n\n    REQUIRE(error == DeserializationError::Ok);\n    REQUIRE(doc.is<MsgPackExtension>());\n    auto ext = doc.as<MsgPackExtension>();\n    REQUIRE(ext.type() == 1);\n    REQUIRE(ext.size() == 2);\n    auto data = reinterpret_cast<const uint8_t*>(ext.data());\n    REQUIRE(data[0] == 3);\n    REQUIRE(data[1] == 4);\n  }\n\n  SECTION(\"ext 32\") {\n    JsonDocument doc;\n\n    auto error = deserializeMsgPack(doc, \"\\xc9\\x00\\x00\\x00\\x02\\x01\\x03\\x04\");\n\n    REQUIRE(error == DeserializationError::Ok);\n    REQUIRE(doc.is<MsgPackExtension>());\n    auto ext = doc.as<MsgPackExtension>();\n    REQUIRE(ext.type() == 1);\n    REQUIRE(ext.size() == 2);\n    auto data = reinterpret_cast<const uint8_t*>(ext.data());\n    REQUIRE(data[0] == 3);\n    REQUIRE(data[1] == 4);\n  }\n}\n\nTEST_CASE(\"deserializeMsgPack() under memory constaints\") {\n  SECTION(\"single values always fit\") {\n    checkError(0, \"\\xc0\", DeserializationError::Ok);          // nil\n    checkError(0, \"\\xc2\", DeserializationError::Ok);          // false\n    checkError(0, \"\\xc3\", DeserializationError::Ok);          // true\n    checkError(0, \"\\xcc\\x00\", DeserializationError::Ok);      // uint 8\n    checkError(0, \"\\xcd\\x30\\x39\", DeserializationError::Ok);  // uint 16\n    checkError(0, \"\\xCE\\x12\\x34\\x56\\x78\",\n               DeserializationError::Ok);  // uint 32\n  }\n\n  SECTION(\"fixstr\") {\n    checkError(2, \"\\xA7ZZZZZZZ\", DeserializationError::Ok);\n    checkError(0, \"\\xA7ZZZZZZZ\", DeserializationError::NoMemory);\n  }\n\n  SECTION(\"str 8\") {\n    checkError(2, \"\\xD9\\x07ZZZZZZZ\", DeserializationError::Ok);\n    checkError(0, \"\\xD9\\x07ZZZZZZZ\", DeserializationError::NoMemory);\n  }\n\n  SECTION(\"str 16\") {\n    checkError(2, \"\\xDA\\x00\\x07ZZZZZZZ\", DeserializationError::Ok);\n    checkError(0, \"\\xDA\\x00\\x07ZZZZZZZ\", DeserializationError::NoMemory);\n  }\n\n  SECTION(\"str 32\") {\n    checkError(2, \"\\xDB\\x00\\x00\\x00\\x07ZZZZZZZ\", DeserializationError::Ok);\n    checkError(0, \"\\xDB\\x00\\x00\\x00\\x07ZZZZZZZ\",\n               DeserializationError::NoMemory);\n  }\n\n  SECTION(\"fixarray\") {\n    checkError(0, \"\\x90\", DeserializationError::Ok);  // []\n    checkError(0, \"\\x91\\x01\",\n               DeserializationError::NoMemory);  // [1]\n    checkError(1, \"\\x91\\x01\",\n               DeserializationError::Ok);  // [1]\n  }\n\n  SECTION(\"array 16\") {\n    checkError(0, \"\\xDC\\x00\\x00\", DeserializationError::Ok);\n    checkError(0, \"\\xDC\\x00\\x01\\x01\", DeserializationError::NoMemory);\n    checkError(1, \"\\xDC\\x00\\x01\\x01\", DeserializationError::Ok);\n  }\n\n  SECTION(\"array 32\") {\n    checkError(0, \"\\xDD\\x00\\x00\\x00\\x00\", DeserializationError::Ok);\n    checkError(0, \"\\xDD\\x00\\x00\\x00\\x01\\x01\", DeserializationError::NoMemory);\n    checkError(1, \"\\xDD\\x00\\x00\\x00\\x01\\x01\", DeserializationError::Ok);\n  }\n\n  SECTION(\"fixmap\") {\n    SECTION(\"{}\") {\n      checkError(0, \"\\x80\", DeserializationError::Ok);\n    }\n    SECTION(\"{Hello:1}\") {\n      checkError(1, \"\\x81\\xA5Hello\\x01\", DeserializationError::NoMemory);\n      checkError(2, \"\\x81\\xA5Hello\\x01\", DeserializationError::Ok);\n    }\n    SECTION(\"{Hello:1,World:2}\") {\n      checkError(2, \"\\x82\\xA5Hello\\x01\\xA5World\\x02\",\n                 DeserializationError::NoMemory);\n      checkError(3, \"\\x82\\xA5Hello\\x01\\xA5World\\x02\", DeserializationError::Ok);\n    }\n  }\n\n  SECTION(\"map 16\") {\n    SECTION(\"{}\") {\n      checkError(0, \"\\xDE\\x00\\x00\", DeserializationError::Ok);\n    }\n    SECTION(\"{Hello:1}\") {\n      checkError(1, \"\\xDE\\x00\\x01\\xA5Hello\\x01\",\n                 DeserializationError::NoMemory);\n      checkError(2, \"\\xDE\\x00\\x01\\xA5Hello\\x01\", DeserializationError::Ok);\n    }\n    SECTION(\"{Hello:1,World:2}\") {\n      checkError(2, \"\\xDE\\x00\\x02\\xA5Hello\\x01\\xA5World\\x02\",\n                 DeserializationError::NoMemory);\n      checkError(3, \"\\xDE\\x00\\x02\\xA5Hello\\x01\\xA5World\\x02\",\n                 DeserializationError::Ok);\n    }\n  }\n\n  SECTION(\"map 32\") {\n    SECTION(\"{}\") {\n      checkError(0, \"\\xDF\\x00\\x00\\x00\\x00\", DeserializationError::Ok);\n    }\n    SECTION(\"{H:1}\") {\n      checkError(1, \"\\xDF\\x00\\x00\\x00\\x01\\xA1H\\x01\",\n                 DeserializationError::NoMemory);\n      checkError(2, \"\\xDF\\x00\\x00\\x00\\x01\\xA1H\\x01\", DeserializationError::Ok);\n    }\n    SECTION(\"{Hello:1,World:2}\") {\n      checkError(2, \"\\xDF\\x00\\x00\\x00\\x02\\xA5Hello\\x01\\xA5World\\x02\",\n                 DeserializationError::NoMemory);\n      checkError(3, \"\\xDF\\x00\\x00\\x00\\x02\\xA1H\\x01\\xA1W\\x02\",\n                 DeserializationError::Ok);\n    }\n  }\n}\n"
  },
  {
    "path": "extras/tests/MsgPackDeserializer/destination_types.cpp",
    "content": "// ArduinoJson - https://arduinojson.org\n// Copyright © 2014-2025, Benoit BLANCHON\n// MIT License\n\n#include <ArduinoJson.h>\n\n#include <catch.hpp>\n#include <string>\n\n#include \"Allocators.hpp\"\n#include \"Literals.hpp\"\n\nusing ArduinoJson::detail::sizeofArray;\nusing ArduinoJson::detail::sizeofObject;\n\nTEST_CASE(\"deserializeMsgPack(JsonDocument&)\") {\n  SpyingAllocator spy;\n  JsonDocument doc(&spy);\n  doc.add(\"hello\"_s);\n  spy.clearLog();\n\n  auto err = deserializeMsgPack(doc, \"\\x91\\x2A\");\n\n  REQUIRE(err == DeserializationError::Ok);\n  REQUIRE(doc.as<std::string>() == \"[42]\");\n  REQUIRE(spy.log() == AllocatorLog{\n                           Deallocate(sizeofPool()),\n                           Deallocate(sizeofString(\"hello\")),\n                           Allocate(sizeofPool()),\n                           Reallocate(sizeofPool(), sizeofArray(1)),\n                       });\n}\n\nTEST_CASE(\"deserializeMsgPack(JsonVariant)\") {\n  SECTION(\"variant is bound\") {\n    SpyingAllocator spy;\n    JsonDocument doc(&spy);\n    doc.add(\"hello\"_s);\n    spy.clearLog();\n\n    JsonVariant variant = doc[0];\n\n    auto err = deserializeMsgPack(variant, \"\\x91\\x2A\");\n\n    REQUIRE(err == DeserializationError::Ok);\n    REQUIRE(doc.as<std::string>() == \"[[42]]\");\n    REQUIRE(spy.log() == AllocatorLog{\n                             Deallocate(sizeofString(\"hello\")),\n                         });\n  }\n\n  SECTION(\"variant is unbound\") {\n    JsonVariant variant;\n\n    auto err = deserializeMsgPack(variant, \"\\x91\\x2A\");\n\n    REQUIRE(err == DeserializationError::NoMemory);\n  }\n}\n\nTEST_CASE(\"deserializeMsgPack(ElementProxy)\") {\n  SpyingAllocator spy;\n  JsonDocument doc(&spy);\n  doc.add(\"hello\"_s);\n  spy.clearLog();\n\n  SECTION(\"element already exists\") {\n    auto err = deserializeMsgPack(doc[0], \"\\x91\\x2A\");\n\n    REQUIRE(err == DeserializationError::Ok);\n    REQUIRE(doc.as<std::string>() == \"[[42]]\");\n    REQUIRE(spy.log() == AllocatorLog{\n                             Deallocate(sizeofString(\"hello\")),\n                         });\n  }\n\n  SECTION(\"element must be created exists\") {\n    auto err = deserializeMsgPack(doc[1], \"\\x91\\x2A\");\n\n    REQUIRE(err == DeserializationError::Ok);\n    REQUIRE(doc.as<std::string>() == \"[\\\"hello\\\",[42]]\");\n    REQUIRE(spy.log() == AllocatorLog{});\n  }\n}\n\nTEST_CASE(\"deserializeMsgPack(MemberProxy)\") {\n  SpyingAllocator spy;\n  JsonDocument doc(&spy);\n  doc[\"hello\"_s] = \"world\"_s;\n  spy.clearLog();\n\n  SECTION(\"member already exists\") {\n    auto err = deserializeMsgPack(doc[\"hello\"], \"\\x91\\x2A\");\n\n    REQUIRE(err == DeserializationError::Ok);\n    REQUIRE(doc.as<std::string>() == \"{\\\"hello\\\":[42]}\");\n    REQUIRE(spy.log() == AllocatorLog{\n                             Deallocate(sizeofString(\"world\")),\n                         });\n  }\n\n  SECTION(\"member must be created\") {\n    auto err = deserializeMsgPack(doc[\"value\"], \"\\x91\\x2A\");\n\n    REQUIRE(err == DeserializationError::Ok);\n    REQUIRE(doc.as<std::string>() == \"{\\\"hello\\\":\\\"world\\\",\\\"value\\\":[42]}\");\n    REQUIRE(spy.log() == AllocatorLog{\n                             Allocate(sizeofString(\"value\")),\n                         });\n  }\n}\n"
  },
  {
    "path": "extras/tests/MsgPackDeserializer/doubleToFloat.cpp",
    "content": "// ArduinoJson - https://arduinojson.org\n// Copyright © 2014-2025, Benoit BLANCHON\n// MIT License\n\n#include <ArduinoJson.h>\n#include <catch.hpp>\n\nusing namespace ArduinoJson::detail;\n\ntemplate <typename T>\nstatic void check(const char* input, T expected) {\n  T actual;\n  uint8_t* f = reinterpret_cast<uint8_t*>(&actual);\n  const uint8_t* d = reinterpret_cast<const uint8_t*>(input);\n  doubleToFloat(d, f);\n  fixEndianness(actual);\n  CHECK(actual == expected);\n}\n\nTEST_CASE(\"doubleToFloat()\") {\n  check(\"\\x40\\x09\\x21\\xCA\\xC0\\x83\\x12\\x6F\", 3.1415f);\n  check(\"\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\", 0.0f);\n  check(\"\\x80\\x00\\x00\\x00\\x00\\x00\\x00\\x00\", -0.0f);\n  check(\"\\xC0\\x5E\\xDC\\xCC\\xCC\\xCC\\xCC\\xCD\", -123.45f);\n}\n"
  },
  {
    "path": "extras/tests/MsgPackDeserializer/errors.cpp",
    "content": "// ArduinoJson - https://arduinojson.org\n// Copyright © 2014-2025, Benoit BLANCHON\n// MIT License\n\n#include <ArduinoJson.h>\n#include <catch.hpp>\n\n#include <sstream>\n\n#include \"Allocators.hpp\"\n\nTEST_CASE(\"deserializeMsgPack() returns InvalidInput\") {\n  JsonDocument doc;\n\n  SECTION(\"integer as key\") {\n    auto err = deserializeMsgPack(doc, \"\\x81\\x01\\xA1H\", 3);\n    REQUIRE(err == DeserializationError::InvalidInput);\n  }\n}\n\nTEST_CASE(\"deserializeMsgPack() returns EmptyInput\") {\n  JsonDocument doc;\n\n  SECTION(\"from sized buffer\") {\n    auto err = deserializeMsgPack(doc, \"\", 0);\n\n    REQUIRE(err == DeserializationError::EmptyInput);\n  }\n\n  SECTION(\"from stream\") {\n    std::istringstream input(\"\");\n\n    auto err = deserializeMsgPack(doc, input);\n\n    REQUIRE(err == DeserializationError::EmptyInput);\n  }\n}\n\nstatic void testIncompleteInput(const char* input, size_t len) {\n  JsonDocument doc;\n  REQUIRE(deserializeMsgPack(doc, input, len) == DeserializationError::Ok);\n\n  while (--len) {\n    REQUIRE(deserializeMsgPack(doc, input, len) ==\n            DeserializationError::IncompleteInput);\n  }\n}\n\nTEST_CASE(\"deserializeMsgPack() returns IncompleteInput\") {\n  SECTION(\"empty input\") {\n    testIncompleteInput(\"\\x00\", 1);\n  }\n\n  SECTION(\"fixarray\") {\n    testIncompleteInput(\"\\x91\\x01\", 2);\n  }\n\n  SECTION(\"array 16\") {\n    testIncompleteInput(\"\\xDC\\x00\\x01\\x01\", 4);\n  }\n\n  SECTION(\"array 32\") {\n    testIncompleteInput(\"\\xDD\\x00\\x00\\x00\\x01\\x01\", 6);\n  }\n\n  SECTION(\"fixmap\") {\n    testIncompleteInput(\"\\x81\\xA3one\\x01\", 6);\n  }\n\n  SECTION(\"map 16\") {\n    testIncompleteInput(\"\\xDE\\x00\\x01\\xA3one\\x01\", 8);\n  }\n\n  SECTION(\"map 32\") {\n    testIncompleteInput(\"\\xDF\\x00\\x00\\x00\\x01\\xA3one\\x01\", 10);\n    testIncompleteInput(\"\\xDF\\x00\\x00\\x00\\x01\\xd9\\x03one\\x01\", 11);\n  }\n\n  SECTION(\"uint 8\") {\n    testIncompleteInput(\"\\xcc\\x01\", 2);\n  }\n\n  SECTION(\"uint 16\") {\n    testIncompleteInput(\"\\xcd\\x00\\x01\", 3);\n  }\n\n  SECTION(\"uint 32\") {\n    testIncompleteInput(\"\\xCE\\x00\\x00\\x00\\x01\", 5);\n  }\n\n#if ARDUINOJSON_USE_LONG_LONG\n  SECTION(\"uint 64\") {\n    testIncompleteInput(\"\\xCF\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\", 9);\n  }\n#endif\n\n  SECTION(\"int 8\") {\n    testIncompleteInput(\"\\xD0\\x01\", 2);\n  }\n\n  SECTION(\"int 16\") {\n    testIncompleteInput(\"\\xD1\\x00\\x01\", 3);\n  }\n\n  SECTION(\"int 32\") {\n    testIncompleteInput(\"\\xD2\\x00\\x00\\x00\\x01\", 5);\n  }\n\n#if ARDUINOJSON_USE_LONG_LONG\n  SECTION(\"int 64\") {\n    testIncompleteInput(\"\\xD3\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\", 9);\n  }\n#endif\n\n  SECTION(\"float 32\") {\n    testIncompleteInput(\"\\xCA\\x40\\x48\\xF5\\xC3\", 5);\n  }\n\n  SECTION(\"float 64\") {\n    testIncompleteInput(\"\\xCB\\x40\\x09\\x21\\xCA\\xC0\\x83\\x12\\x6F\", 9);\n  }\n\n  SECTION(\"fixstr\") {\n    testIncompleteInput(\"\\xABhello world\", 12);\n  }\n\n  SECTION(\"str 8\") {\n    testIncompleteInput(\"\\xd9\\x05hello\", 7);\n  }\n\n  SECTION(\"str 16\") {\n    testIncompleteInput(\"\\xda\\x00\\x05hello\", 8);\n  }\n\n  SECTION(\"str 32\") {\n    testIncompleteInput(\"\\xdb\\x00\\x00\\x00\\x05hello\", 10);\n  }\n\n  SECTION(\"bin 8\") {\n    testIncompleteInput(\"\\xc4\\x01X\", 3);\n  }\n\n  SECTION(\"bin 16\") {\n    testIncompleteInput(\"\\xc5\\x00\\x01X\", 4);\n  }\n\n  SECTION(\"bin 32\") {\n    testIncompleteInput(\"\\xc6\\x00\\x00\\x00\\x01X\", 6);\n  }\n\n  SECTION(\"ext 8\") {\n    testIncompleteInput(\"\\xc7\\x01\\x01\\x01\", 4);\n  }\n\n  SECTION(\"ext 16\") {\n    testIncompleteInput(\"\\xc8\\x00\\x01\\x01\\x01\", 5);\n  }\n\n  SECTION(\"ext 32\") {\n    testIncompleteInput(\"\\xc9\\x00\\x00\\x00\\x01\\x01\\x01\", 7);\n  }\n\n  SECTION(\"fixext 1\") {\n    testIncompleteInput(\"\\xd4\\x01\\x01\", 3);\n  }\n\n  SECTION(\"fixext 2\") {\n    testIncompleteInput(\"\\xd5\\x01\\x01\\x02\", 4);\n  }\n\n  SECTION(\"fixext 4\") {\n    testIncompleteInput(\"\\xd6\\x01\\x01\\x02\\x03\\x04\", 6);\n  }\n\n  SECTION(\"fixext 8\") {\n    testIncompleteInput(\"\\xd7\\x01\\x01\\x02\\x03\\x04\\x05\\x06\\x07\\x08\", 10);\n  }\n\n  SECTION(\"fixext 16\") {\n    testIncompleteInput(\n        \"\\xd8\\x01\\x01\\x02\\x03\\x04\\x05\\x06\\x07\\x08\\x09\\x0A\\x0B\\x0C\\x0D\\x0E\"\n        \"\\x0F\\x10\",\n        18);\n  }\n}\n\nTEST_CASE(\n    \"deserializeMsgPack() returns NoMemory when string allocation fails\") {\n  TimebombAllocator allocator(0);\n  JsonDocument doc(&allocator);\n\n  SECTION(\"fixstr\") {\n    DeserializationError err = deserializeMsgPack(doc, \"\\xA5hello\", 9);\n    REQUIRE(err == DeserializationError::NoMemory);\n  }\n\n  SECTION(\"bin 8\") {\n    DeserializationError err = deserializeMsgPack(doc, \"\\xC4\\x01X\", 3);\n    REQUIRE(err == DeserializationError::NoMemory);\n  }\n}\n\nTEST_CASE(\n    \"deserializeMsgPack() returns NoMemory if extension allocation fails\") {\n  JsonDocument doc(FailingAllocator::instance());\n\n  SECTION(\"uint32_t should pass\") {\n    auto err = deserializeMsgPack(doc, \"\\xceXXXX\");\n\n    REQUIRE(err == DeserializationError::Ok);\n  }\n\n  SECTION(\"uint64_t should fail\") {\n    auto err = deserializeMsgPack(doc, \"\\xcfXXXXXXXX\");\n\n    REQUIRE(err == DeserializationError::NoMemory);\n  }\n\n  SECTION(\"int32_t should pass\") {\n    auto err = deserializeMsgPack(doc, \"\\xd2XXXX\");\n\n    REQUIRE(err == DeserializationError::Ok);\n  }\n\n  SECTION(\"int64_t should fail\") {\n    auto err = deserializeMsgPack(doc, \"\\xd3XXXXXXXX\");\n\n    REQUIRE(err == DeserializationError::NoMemory);\n  }\n\n  SECTION(\"float should pass\") {\n    auto err = deserializeMsgPack(doc, \"\\xcaXXXX\");\n\n    REQUIRE(err == DeserializationError::Ok);\n  }\n\n  SECTION(\"double should fail\") {\n    auto err = deserializeMsgPack(doc, \"\\xcbXXXXXXXX\");\n\n    REQUIRE(err == DeserializationError::NoMemory);\n  }\n}\n"
  },
  {
    "path": "extras/tests/MsgPackDeserializer/filter.cpp",
    "content": "// ArduinoJson - https://arduinojson.org\n// Copyright © 2014-2025, Benoit BLANCHON\n// MIT License\n\n#include <ArduinoJson.h>\n#include <catch.hpp>\n\n#include <sstream>\n\n#include \"Allocators.hpp\"\n#include \"Literals.hpp\"\n\nusing namespace ArduinoJson::detail;\n\nTEST_CASE(\"deserializeMsgPack() filter\") {\n  SpyingAllocator spy;\n  JsonDocument doc(&spy);\n  DeserializationError error;\n\n  JsonDocument filter;\n  DeserializationOption::Filter filterOpt(filter);\n\n  SECTION(\"root is fixmap\") {\n    SECTION(\"filter = {include:true,ignore:false)\") {\n      filter[\"include\"] = true;\n      filter[\"ignore\"] = false;\n\n      SECTION(\"input truncated after ignored key\") {\n        error = deserializeMsgPack(doc, \"\\x82\\xA6ignore\", 8, filterOpt);\n\n        CHECK(error == DeserializationError::IncompleteInput);\n        CHECK(doc.as<std::string>() == \"{}\");\n        CHECK(spy.log() == AllocatorLog{\n                               Allocate(sizeofString(\"ignore\")),\n                               Deallocate(sizeofString(\"ignore\")),\n                           });\n      }\n\n      SECTION(\"input truncated after inside skipped uint 8\") {\n        error = deserializeMsgPack(doc, \"\\x82\\xA6ignore\\xCC\\x2A\\xA7include\\x2A\",\n                                   9, filterOpt);\n\n        CHECK(error == DeserializationError::IncompleteInput);\n        CHECK(doc.as<std::string>() == \"{}\");\n        CHECK(spy.log() == AllocatorLog{\n                               Allocate(sizeofString(\"ignore\")),\n                               Deallocate(sizeofString(\"ignore\")),\n                           });\n      }\n\n      SECTION(\"input truncated after before skipped string size\") {\n        error = deserializeMsgPack(doc, \"\\x82\\xA6ignore\\xd9\", 9, filterOpt);\n\n        CHECK(error == DeserializationError::IncompleteInput);\n        CHECK(doc.as<std::string>() == \"{}\");\n        CHECK(spy.log() == AllocatorLog{\n                               Allocate(sizeofString(\"ignore\")),\n                               Deallocate(sizeofString(\"ignore\")),\n                           });\n      }\n\n      SECTION(\"input truncated after before skipped ext size\") {\n        error = deserializeMsgPack(doc, \"\\x82\\xA6ignore\\xC7\", 9, filterOpt);\n\n        CHECK(error == DeserializationError::IncompleteInput);\n        CHECK(doc.as<std::string>() == \"{}\");\n        CHECK(spy.log() == AllocatorLog{\n                               Allocate(sizeofString(\"ignore\")),\n                               Deallocate(sizeofString(\"ignore\")),\n                           });\n      }\n\n      SECTION(\"skip nil\") {\n        error = deserializeMsgPack(doc, \"\\x82\\xA6ignore\\xC0\\xA7include\\x2A\",\n                                   filterOpt);\n\n        CHECK(error == DeserializationError::Ok);\n        CHECK(doc.as<std::string>() == \"{\\\"include\\\":42}\");\n        CHECK(spy.log() == AllocatorLog{\n                               Allocate(sizeofString(\"ignore\")),\n                               Deallocate(sizeofString(\"ignore\")),\n                               Allocate(sizeofString(\"include\")),\n                               Allocate(sizeofPool()),\n                               Reallocate(sizeofPool(), sizeofObject(1)),\n                           });\n      }\n\n      SECTION(\"reject 0xc1\") {\n        error = deserializeMsgPack(doc, \"\\x82\\xA6ignore\\xC1\\xA7include\\x2A\",\n                                   filterOpt);\n\n        CHECK(error == DeserializationError::InvalidInput);\n        CHECK(spy.log() == AllocatorLog{\n                               Allocate(sizeofString(\"ignore\")),\n                               Deallocate(sizeofString(\"ignore\")),\n                           });\n      }\n\n      SECTION(\"skip false\") {\n        error = deserializeMsgPack(doc, \"\\x82\\xA6ignore\\xC2\\xA7include\\x2A\",\n                                   filterOpt);\n\n        CHECK(error == DeserializationError::Ok);\n        CHECK(doc.as<std::string>() == \"{\\\"include\\\":42}\");\n        CHECK(spy.log() == AllocatorLog{\n                               Allocate(sizeofString(\"ignore\")),\n                               Deallocate(sizeofString(\"ignore\")),\n                               Allocate(sizeofString(\"include\")),\n                               Allocate(sizeofPool()),\n                               Reallocate(sizeofPool(), sizeofObject(1)),\n                           });\n      }\n\n      SECTION(\"skip true\") {\n        error = deserializeMsgPack(doc, \"\\x82\\xA6ignore\\xC3\\xA7include\\x2A\",\n                                   filterOpt);\n\n        CHECK(error == DeserializationError::Ok);\n        CHECK(doc.as<std::string>() == \"{\\\"include\\\":42}\");\n        CHECK(spy.log() == AllocatorLog{\n                               Allocate(sizeofString(\"ignore\")),\n                               Deallocate(sizeofString(\"ignore\")),\n                               Allocate(sizeofString(\"include\")),\n                               Allocate(sizeofPool()),\n                               Reallocate(sizeofPool(), sizeofObject(1)),\n                           });\n      }\n\n      SECTION(\"skip positive fixint\") {\n        error = deserializeMsgPack(doc, \"\\x82\\xA6ignore\\x2A\\xA7include\\x2A\",\n                                   filterOpt);\n\n        CHECK(error == DeserializationError::Ok);\n        CHECK(doc.as<std::string>() == \"{\\\"include\\\":42}\");\n        CHECK(spy.log() == AllocatorLog{\n                               Allocate(sizeofString(\"ignore\")),\n                               Deallocate(sizeofString(\"ignore\")),\n                               Allocate(sizeofString(\"include\")),\n                               Allocate(sizeofPool()),\n                               Reallocate(sizeofPool(), sizeofObject(1)),\n                           });\n      }\n\n      SECTION(\"skip negative fixint\") {\n        error = deserializeMsgPack(doc, \"\\x82\\xA6ignore\\xFF\\xA7include\\x2A\",\n                                   filterOpt);\n\n        CHECK(error == DeserializationError::Ok);\n        CHECK(doc.as<std::string>() == \"{\\\"include\\\":42}\");\n        CHECK(spy.log() == AllocatorLog{\n                               Allocate(sizeofString(\"ignore\")),\n                               Deallocate(sizeofString(\"ignore\")),\n                               Allocate(sizeofString(\"include\")),\n                               Allocate(sizeofPool()),\n                               Reallocate(sizeofPool(), sizeofObject(1)),\n                           });\n      }\n\n      SECTION(\"skip uint 8\") {\n        error = deserializeMsgPack(doc, \"\\x82\\xA6ignore\\xCC\\x2A\\xA7include\\x2A\",\n                                   filterOpt);\n\n        CHECK(error == DeserializationError::Ok);\n        CHECK(doc.as<std::string>() == \"{\\\"include\\\":42}\");\n        CHECK(spy.log() == AllocatorLog{\n                               Allocate(sizeofString(\"ignore\")),\n                               Deallocate(sizeofString(\"ignore\")),\n                               Allocate(sizeofString(\"include\")),\n                               Allocate(sizeofPool()),\n                               Reallocate(sizeofPool(), sizeofObject(1)),\n                           });\n      }\n\n      SECTION(\"skip int 8\") {\n        error = deserializeMsgPack(doc, \"\\x82\\xA6ignore\\xD0\\x2A\\xA7include\\x2A\",\n                                   filterOpt);\n\n        CHECK(error == DeserializationError::Ok);\n        CHECK(doc.as<std::string>() == \"{\\\"include\\\":42}\");\n        CHECK(spy.log() == AllocatorLog{\n                               Allocate(sizeofString(\"ignore\")),\n                               Deallocate(sizeofString(\"ignore\")),\n                               Allocate(sizeofString(\"include\")),\n                               Allocate(sizeofPool()),\n                               Reallocate(sizeofPool(), sizeofObject(1)),\n                           });\n      }\n\n      SECTION(\"skip uint 16\") {\n        error = deserializeMsgPack(\n            doc, \"\\x82\\xA6ignore\\xcd\\x30\\x39\\xA7include\\x2A\", filterOpt);\n\n        CHECK(error == DeserializationError::Ok);\n        CHECK(doc.as<std::string>() == \"{\\\"include\\\":42}\");\n        CHECK(spy.log() == AllocatorLog{\n                               Allocate(sizeofString(\"ignore\")),\n                               Deallocate(sizeofString(\"ignore\")),\n                               Allocate(sizeofString(\"include\")),\n                               Allocate(sizeofPool()),\n                               Reallocate(sizeofPool(), sizeofObject(1)),\n                           });\n      }\n\n      SECTION(\"skip int 16\") {\n        error = deserializeMsgPack(\n            doc, \"\\x82\\xA6ignore\\xD1\\xCF\\xC7\\xA7include\\x2A\", filterOpt);\n\n        CHECK(error == DeserializationError::Ok);\n        CHECK(doc.as<std::string>() == \"{\\\"include\\\":42}\");\n        CHECK(spy.log() == AllocatorLog{\n                               Allocate(sizeofString(\"ignore\")),\n                               Deallocate(sizeofString(\"ignore\")),\n                               Allocate(sizeofString(\"include\")),\n                               Allocate(sizeofPool()),\n                               Reallocate(sizeofPool(), sizeofObject(1)),\n                           });\n      }\n\n      SECTION(\"skip uint 32\") {\n        error = deserializeMsgPack(\n            doc, \"\\x82\\xA6ignore\\xCE\\x12\\x34\\x56\\x78\\xA7include\\x2A\",\n            filterOpt);\n\n        CHECK(error == DeserializationError::Ok);\n        CHECK(doc.as<std::string>() == \"{\\\"include\\\":42}\");\n        CHECK(spy.log() == AllocatorLog{\n                               Allocate(sizeofString(\"ignore\")),\n                               Deallocate(sizeofString(\"ignore\")),\n                               Allocate(sizeofString(\"include\")),\n                               Allocate(sizeofPool()),\n                               Reallocate(sizeofPool(), sizeofObject(1)),\n                           });\n      }\n\n      SECTION(\"skip int 32\") {\n        error = deserializeMsgPack(\n            doc, \"\\x82\\xA6ignore\\xD2\\xB6\\x69\\xFD\\x2E\\xA7include\\x2A\",\n            filterOpt);\n\n        CHECK(error == DeserializationError::Ok);\n        CHECK(doc.as<std::string>() == \"{\\\"include\\\":42}\");\n        CHECK(spy.log() == AllocatorLog{\n                               Allocate(sizeofString(\"ignore\")),\n                               Deallocate(sizeofString(\"ignore\")),\n                               Allocate(sizeofString(\"include\")),\n                               Allocate(sizeofPool()),\n                               Reallocate(sizeofPool(), sizeofObject(1)),\n                           });\n      }\n\n      SECTION(\"skip uint 64\") {\n        error = deserializeMsgPack(\n            doc,\n            \"\\x82\\xA6ignore\\xCF\\x12\\x34\\x56\\x78\\x9A\\xBC\\xDE\\xF0\\xA7include\\x2A\",\n            filterOpt);\n\n        CHECK(error == DeserializationError::Ok);\n        CHECK(doc.as<std::string>() == \"{\\\"include\\\":42}\");\n        CHECK(spy.log() == AllocatorLog{\n                               Allocate(sizeofString(\"ignore\")),\n                               Deallocate(sizeofString(\"ignore\")),\n                               Allocate(sizeofString(\"include\")),\n                               Allocate(sizeofPool()),\n                               Reallocate(sizeofPool(), sizeofObject(1)),\n                           });\n      }\n\n      SECTION(\"skip int 64\") {\n        error = deserializeMsgPack(\n            doc,\n            \"\\x82\\xA6ignore\\xD3\\x12\\x34\\x56\\x78\\x9A\\xBC\\xDE\\xF0\\xA7include\\x2A\",\n            filterOpt);\n\n        CHECK(error == DeserializationError::Ok);\n        CHECK(doc.as<std::string>() == \"{\\\"include\\\":42}\");\n        CHECK(spy.log() == AllocatorLog{\n                               Allocate(sizeofString(\"ignore\")),\n                               Deallocate(sizeofString(\"ignore\")),\n                               Allocate(sizeofString(\"include\")),\n                               Allocate(sizeofPool()),\n                               Reallocate(sizeofPool(), sizeofObject(1)),\n                           });\n      }\n\n      SECTION(\"skip float 32\") {\n        error = deserializeMsgPack(\n            doc, \"\\x82\\xA6ignore\\xCA\\x40\\x48\\xF5\\xC3\\xA7include\\x2A\",\n            filterOpt);\n\n        CHECK(error == DeserializationError::Ok);\n        CHECK(doc.as<std::string>() == \"{\\\"include\\\":42}\");\n        CHECK(spy.log() == AllocatorLog{\n                               Allocate(sizeofString(\"ignore\")),\n                               Deallocate(sizeofString(\"ignore\")),\n                               Allocate(sizeofString(\"include\")),\n                               Allocate(sizeofPool()),\n                               Reallocate(sizeofPool(), sizeofObject(1)),\n                           });\n      }\n\n      SECTION(\"skip float 64\") {\n        error = deserializeMsgPack(\n            doc,\n            \"\\x82\\xA6ignore\\xCB\\x40\\x09\\x21\\xCA\\xC0\\x83\\x12\\x6F\\xA7include\\x2A\",\n            filterOpt);\n\n        CHECK(error == DeserializationError::Ok);\n        CHECK(doc.as<std::string>() == \"{\\\"include\\\":42}\");\n        CHECK(spy.log() == AllocatorLog{\n                               Allocate(sizeofString(\"ignore\")),\n                               Deallocate(sizeofString(\"ignore\")),\n                               Allocate(sizeofString(\"include\")),\n                               Allocate(sizeofPool()),\n                               Reallocate(sizeofPool(), sizeofObject(1)),\n                           });\n      }\n\n      SECTION(\"skip fixstr\") {\n        error = deserializeMsgPack(\n            doc, \"\\x82\\xA6ignore\\xABhello world\\xA7include\\x2A\", filterOpt);\n\n        CHECK(error == DeserializationError::Ok);\n        CHECK(doc.as<std::string>() == \"{\\\"include\\\":42}\");\n        CHECK(spy.log() == AllocatorLog{\n                               Allocate(sizeofString(\"ignore\")),\n                               Deallocate(sizeofString(\"ignore\")),\n                               Allocate(sizeofString(\"include\")),\n                               Allocate(sizeofPool()),\n                               Reallocate(sizeofPool(), sizeofObject(1)),\n                           });\n      }\n\n      SECTION(\"skip str 8\") {\n        error = deserializeMsgPack(\n            doc, \"\\x82\\xA6ignore\\xd9\\x05hello\\xA7include\\x2A\", filterOpt);\n\n        CHECK(error == DeserializationError::Ok);\n        CHECK(doc.as<std::string>() == \"{\\\"include\\\":42}\");\n        CHECK(spy.log() == AllocatorLog{\n                               Allocate(sizeofString(\"ignore\")),\n                               Deallocate(sizeofString(\"ignore\")),\n                               Allocate(sizeofString(\"include\")),\n                               Allocate(sizeofPool()),\n                               Reallocate(sizeofPool(), sizeofObject(1)),\n                           });\n      }\n\n      SECTION(\"skip str 16\") {\n        error = deserializeMsgPack(\n            doc, \"\\x82\\xA6ignore\\xda\\x00\\x05hello\\xA7include\\x2A\", filterOpt);\n\n        CHECK(error == DeserializationError::Ok);\n        CHECK(doc.as<std::string>() == \"{\\\"include\\\":42}\");\n        CHECK(spy.log() == AllocatorLog{\n                               Allocate(sizeofString(\"ignore\")),\n                               Deallocate(sizeofString(\"ignore\")),\n                               Allocate(sizeofString(\"include\")),\n                               Allocate(sizeofPool()),\n                               Reallocate(sizeofPool(), sizeofObject(1)),\n                           });\n      }\n\n      SECTION(\"skip str 32\") {\n        error = deserializeMsgPack(\n            doc, \"\\x82\\xA6ignore\\xdb\\x00\\x00\\x00\\x05hello\\xA7include\\x2A\",\n            filterOpt);\n\n        CHECK(error == DeserializationError::Ok);\n        CHECK(doc.as<std::string>() == \"{\\\"include\\\":42}\");\n        CHECK(spy.log() == AllocatorLog{\n                               Allocate(sizeofString(\"ignore\")),\n                               Deallocate(sizeofString(\"ignore\")),\n                               Allocate(sizeofString(\"include\")),\n                               Allocate(sizeofPool()),\n                               Reallocate(sizeofPool(), sizeofObject(1)),\n                           });\n      }\n\n      SECTION(\"skip bin 8\") {\n        error = deserializeMsgPack(\n            doc, \"\\x82\\xA6ignore\\xC4\\x05hello\\xA7include\\x2A\", filterOpt);\n\n        CHECK(error == DeserializationError::Ok);\n        CHECK(doc.as<std::string>() == \"{\\\"include\\\":42}\");\n        CHECK(spy.log() == AllocatorLog{\n                               Allocate(sizeofString(\"ignore\")),\n                               Deallocate(sizeofString(\"ignore\")),\n                               Allocate(sizeofString(\"include\")),\n                               Allocate(sizeofPool()),\n                               Reallocate(sizeofPool(), sizeofObject(1)),\n                           });\n      }\n\n      SECTION(\"skip bin 16\") {\n        error = deserializeMsgPack(\n            doc, \"\\x82\\xA6ignore\\xC5\\x00\\x05hello\\xA7include\\x2A\", filterOpt);\n\n        CHECK(error == DeserializationError::Ok);\n        CHECK(doc.as<std::string>() == \"{\\\"include\\\":42}\");\n        CHECK(spy.log() == AllocatorLog{\n                               Allocate(sizeofString(\"ignore\")),\n                               Deallocate(sizeofString(\"ignore\")),\n                               Allocate(sizeofString(\"include\")),\n                               Allocate(sizeofPool()),\n                               Reallocate(sizeofPool(), sizeofObject(1)),\n                           });\n      }\n\n      SECTION(\"skip bin 32\") {\n        error = deserializeMsgPack(\n            doc, \"\\x82\\xA6ignore\\xC6\\x00\\x00\\x00\\x05hello\\xA7include\\x2A\",\n            filterOpt);\n\n        CHECK(error == DeserializationError::Ok);\n        CHECK(doc.as<std::string>() == \"{\\\"include\\\":42}\");\n        CHECK(spy.log() == AllocatorLog{\n                               Allocate(sizeofString(\"ignore\")),\n                               Deallocate(sizeofString(\"ignore\")),\n                               Allocate(sizeofString(\"include\")),\n                               Allocate(sizeofPool()),\n                               Reallocate(sizeofPool(), sizeofObject(1)),\n                           });\n      }\n\n      SECTION(\"skip fixarray\") {\n        error = deserializeMsgPack(\n            doc, \"\\x82\\xA6ignore\\x92\\x01\\x02\\xA7include\\x2A\", filterOpt);\n\n        CHECK(error == DeserializationError::Ok);\n        CHECK(doc.as<std::string>() == \"{\\\"include\\\":42}\");\n        CHECK(spy.log() == AllocatorLog{\n                               Allocate(sizeofString(\"ignore\")),\n                               Deallocate(sizeofString(\"ignore\")),\n                               Allocate(sizeofString(\"include\")),\n                               Allocate(sizeofPool()),\n                               Reallocate(sizeofPool(), sizeofObject(1)),\n                           });\n      }\n\n      SECTION(\"skip array 16\") {\n        error = deserializeMsgPack(\n            doc, \"\\x82\\xA6ignore\\xDC\\x00\\x02\\xA5hello\\xA5world\\xA7include\\x2A\",\n            filterOpt);\n\n        CHECK(error == DeserializationError::Ok);\n        CHECK(doc.as<std::string>() == \"{\\\"include\\\":42}\");\n        CHECK(spy.log() == AllocatorLog{\n                               Allocate(sizeofString(\"ignore\")),\n                               Deallocate(sizeofString(\"ignore\")),\n                               Allocate(sizeofString(\"include\")),\n                               Allocate(sizeofPool()),\n                               Reallocate(sizeofPool(), sizeofObject(1)),\n                           });\n      }\n\n      SECTION(\"skip array 32\") {\n        error = deserializeMsgPack(\n            doc,\n            \"\\x82\\xA6ignore\"\n            \"\\xDD\\x00\\x00\\x00\\x02\\xCA\\x00\\x00\\x00\\x00\\xCA\\x40\\x48\\xF5\\xC3\"\n            \"\\xA7include\\x2A\",\n            filterOpt);\n\n        CHECK(error == DeserializationError::Ok);\n        CHECK(doc.as<std::string>() == \"{\\\"include\\\":42}\");\n        CHECK(spy.log() == AllocatorLog{\n                               Allocate(sizeofString(\"ignore\")),\n                               Deallocate(sizeofString(\"ignore\")),\n                               Allocate(sizeofString(\"include\")),\n                               Allocate(sizeofPool()),\n                               Reallocate(sizeofPool(), sizeofObject(1)),\n                           });\n      }\n\n      SECTION(\"skip fixmap\") {\n        error = deserializeMsgPack(\n            doc, \"\\x82\\xA6ignore\\x82\\xA3one\\x01\\xA3two\\x02\\xA7include\\x2A\",\n            filterOpt);\n\n        CHECK(error == DeserializationError::Ok);\n        CHECK(doc.as<std::string>() == \"{\\\"include\\\":42}\");\n        CHECK(spy.log() == AllocatorLog{\n                               Allocate(sizeofString(\"ignore\")),\n                               Deallocate(sizeofString(\"ignore\")),\n                               Allocate(sizeofString(\"include\")),\n                               Allocate(sizeofPool()),\n                               Reallocate(sizeofPool(), sizeofObject(1)),\n                           });\n      }\n\n      SECTION(\"skip map 16\") {\n        error = deserializeMsgPack(doc,\n                                   \"\\x82\\xA6ignore\"\n                                   \"\\xDE\\x00\\x02\\xA1H\\xA5hello\\xA1W\\xA5world\"\n                                   \"\\xA7include\\x2A\",\n                                   filterOpt);\n\n        CHECK(error == DeserializationError::Ok);\n        CHECK(doc.as<std::string>() == \"{\\\"include\\\":42}\");\n        CHECK(spy.log() == AllocatorLog{\n                               Allocate(sizeofString(\"ignore\")),\n                               Deallocate(sizeofString(\"ignore\")),\n                               Allocate(sizeofString(\"include\")),\n                               Allocate(sizeofPool()),\n                               Reallocate(sizeofPool(), sizeofObject(1)),\n                           });\n      }\n\n      SECTION(\"skip map 32\") {\n        error = deserializeMsgPack(doc,\n                                   \"\\x82\\xA6ignore\"\n                                   \"\\xDF\\x00\\x00\\x00\\x02\"\n                                   \"\\xA4zero\\xCA\\x00\\x00\\x00\\x00\"\n                                   \"\\xA2pi\\xCA\\x40\\x48\\xF5\\xC3\"\n                                   \"\\xA7include\\x2A\",\n                                   filterOpt);\n\n        CHECK(error == DeserializationError::Ok);\n        CHECK(doc.as<std::string>() == \"{\\\"include\\\":42}\");\n        CHECK(spy.log() == AllocatorLog{\n                               Allocate(sizeofString(\"ignore\")),\n                               Deallocate(sizeofString(\"ignore\")),\n                               Allocate(sizeofString(\"include\")),\n                               Allocate(sizeofPool()),\n                               Reallocate(sizeofPool(), sizeofObject(1)),\n                           });\n      }\n\n      SECTION(\"skip fixext 1\") {\n        error = deserializeMsgPack(doc,\n                                   \"\\x82\\xA6ignore\"\n                                   \"\\xd4\\x01\\x02\"\n                                   \"\\xA7include\\x2A\",\n                                   filterOpt);\n\n        CHECK(error == DeserializationError::Ok);\n        CHECK(doc.as<std::string>() == \"{\\\"include\\\":42}\");\n        CHECK(spy.log() == AllocatorLog{\n                               Allocate(sizeofString(\"ignore\")),\n                               Deallocate(sizeofString(\"ignore\")),\n                               Allocate(sizeofString(\"include\")),\n                               Allocate(sizeofPool()),\n                               Reallocate(sizeofPool(), sizeofObject(1)),\n                           });\n      }\n\n      SECTION(\"skip fixext 2\") {\n        error = deserializeMsgPack(doc,\n                                   \"\\x82\\xA6ignore\"\n                                   \"\\xd5\\x01\\x02\\x03\"\n                                   \"\\xA7include\\x2A\",\n                                   filterOpt);\n\n        CHECK(error == DeserializationError::Ok);\n        CHECK(doc.as<std::string>() == \"{\\\"include\\\":42}\");\n        CHECK(spy.log() == AllocatorLog{\n                               Allocate(sizeofString(\"ignore\")),\n                               Deallocate(sizeofString(\"ignore\")),\n                               Allocate(sizeofString(\"include\")),\n                               Allocate(sizeofPool()),\n                               Reallocate(sizeofPool(), sizeofObject(1)),\n                           });\n      }\n\n      SECTION(\"skip fixext 4\") {\n        error = deserializeMsgPack(doc,\n                                   \"\\x82\\xA6ignore\"\n                                   \"\\xd6\\x01\\x02\\x03\\x04\\x05\"\n                                   \"\\xA7include\\x2A\",\n                                   filterOpt);\n\n        CHECK(error == DeserializationError::Ok);\n        CHECK(doc.as<std::string>() == \"{\\\"include\\\":42}\");\n        CHECK(spy.log() == AllocatorLog{\n                               Allocate(sizeofString(\"ignore\")),\n                               Deallocate(sizeofString(\"ignore\")),\n                               Allocate(sizeofString(\"include\")),\n                               Allocate(sizeofPool()),\n                               Reallocate(sizeofPool(), sizeofObject(1)),\n                           });\n      }\n\n      SECTION(\"skip fixext 8\") {\n        error = deserializeMsgPack(doc,\n                                   \"\\x82\\xA6ignore\"\n                                   \"\\xd7\\x01\\x02\\x03\\x04\\x05\\x06\\x07\\x08\\x09\"\n                                   \"\\xA7include\\x2A\",\n                                   filterOpt);\n\n        CHECK(error == DeserializationError::Ok);\n        CHECK(doc.as<std::string>() == \"{\\\"include\\\":42}\");\n        CHECK(spy.log() == AllocatorLog{\n                               Allocate(sizeofString(\"ignore\")),\n                               Deallocate(sizeofString(\"ignore\")),\n                               Allocate(sizeofString(\"include\")),\n                               Allocate(sizeofPool()),\n                               Reallocate(sizeofPool(), sizeofObject(1)),\n                           });\n      }\n\n      SECTION(\"skip fixext 16\") {\n        error =\n            deserializeMsgPack(doc,\n                               \"\\x82\\xA6ignore\"\n                               \"\\xd8\\x01\\x02\\x03\\x04\\x05\\x06\\x07\\x08\\x09\\x0A\"\n                               \"\\x0B\\x0C\\x0D\\x0E\\x0F\\x10\\x11\"\n                               \"\\xA7include\\x2A\",\n                               filterOpt);\n\n        CHECK(error == DeserializationError::Ok);\n        CHECK(doc.as<std::string>() == \"{\\\"include\\\":42}\");\n        CHECK(spy.log() == AllocatorLog{\n                               Allocate(sizeofString(\"ignore\")),\n                               Deallocate(sizeofString(\"ignore\")),\n                               Allocate(sizeofString(\"include\")),\n                               Allocate(sizeofPool()),\n                               Reallocate(sizeofPool(), sizeofObject(1)),\n                           });\n      }\n\n      SECTION(\"skip ext 8\") {\n        error = deserializeMsgPack(doc,\n                                   \"\\x82\\xA6ignore\"\n                                   \"\\xc7\\x02\\x00\\x01\\x02\"\n                                   \"\\xA7include\\x2A\",\n                                   filterOpt);\n\n        CHECK(error == DeserializationError::Ok);\n        CHECK(doc.as<std::string>() == \"{\\\"include\\\":42}\");\n        CHECK(spy.log() == AllocatorLog{\n                               Allocate(sizeofString(\"ignore\")),\n                               Deallocate(sizeofString(\"ignore\")),\n                               Allocate(sizeofString(\"include\")),\n                               Allocate(sizeofPool()),\n                               Reallocate(sizeofPool(), sizeofObject(1)),\n                           });\n      }\n\n      SECTION(\"skip ext 16\") {\n        error = deserializeMsgPack(doc,\n                                   \"\\x82\\xA6ignore\"\n                                   \"\\xc8\\x00\\x02\\x00\\x01\\x02\"\n                                   \"\\xA7include\\x2A\",\n                                   filterOpt);\n\n        CHECK(error == DeserializationError::Ok);\n        CHECK(doc.as<std::string>() == \"{\\\"include\\\":42}\");\n        CHECK(spy.log() == AllocatorLog{\n                               Allocate(sizeofString(\"ignore\")),\n                               Deallocate(sizeofString(\"ignore\")),\n                               Allocate(sizeofString(\"include\")),\n                               Allocate(sizeofPool()),\n                               Reallocate(sizeofPool(), sizeofObject(1)),\n                           });\n      }\n\n      SECTION(\"skip ext 32\") {\n        error = deserializeMsgPack(doc,\n                                   \"\\x82\\xA6ignore\"\n                                   \"\\xc9\\x00\\x00\\x00\\x02\\x00\\x01\\x02\"\n                                   \"\\xA7include\\x2A\",\n                                   filterOpt);\n\n        CHECK(error == DeserializationError::Ok);\n        CHECK(doc.as<std::string>() == \"{\\\"include\\\":42}\");\n        CHECK(spy.log() == AllocatorLog{\n                               Allocate(sizeofString(\"ignore\")),\n                               Deallocate(sizeofString(\"ignore\")),\n                               Allocate(sizeofString(\"include\")),\n                               Allocate(sizeofPool()),\n                               Reallocate(sizeofPool(), sizeofObject(1)),\n                           });\n      }\n    }\n\n    SECTION(\"Filter = {arronly:[{measure:true}],include:true}\") {\n      filter[\"onlyarr\"][0][\"measure\"] = true;\n      filter[\"include\"] = true;\n\n      CAPTURE(filter.as<std::string>());\n\n      SECTION(\"include fixarray\") {\n        error = deserializeMsgPack(doc,\n                                   \"\\x82\\xA7onlyarr\\x92\"\n                                   \"\\x82\\xA8location\\x01\\xA7measure\\x02\"\n                                   \"\\x82\\xA8location\\x02\\xA7measure\\x04\"\n                                   \"\\xA7include\\x2A\",\n                                   filterOpt);\n\n        CHECK(error == DeserializationError::Ok);\n        CHECK(doc.as<std::string>() ==\n              \"{\\\"onlyarr\\\":[{\\\"measure\\\":2},{\\\"measure\\\":4}],\\\"include\\\":42}\");\n        CHECK(spy.log() ==\n              AllocatorLog{\n                  Allocate(sizeofString(\"onlyarr\")),\n                  Allocate(sizeofPool()),\n                  Allocate(sizeofString(\"location\")),\n                  Reallocate(sizeofString(\"location\"), sizeofString(\"measure\")),\n                  Allocate(sizeofString(\"location\")),\n                  Reallocate(sizeofString(\"location\"), sizeofString(\"include\")),\n                  Reallocate(sizeofPool(), sizeofObject(2) + sizeofArray(2) +\n                                               2 * sizeofObject(1)),\n              });\n      }\n\n      SECTION(\"include array 16\") {\n        error = deserializeMsgPack(doc,\n                                   \"\\x82\\xA7onlyarr\"\n                                   \"\\xDC\\x00\\x02\"\n                                   \"\\x82\\xA8location\\x01\\xA7measure\\x02\"\n                                   \"\\x82\\xA8location\\x02\\xA7measure\\x04\"\n                                   \"\\xA7include\\x2A\",\n                                   filterOpt);\n\n        CHECK(error == DeserializationError::Ok);\n        CHECK(doc.as<std::string>() ==\n              \"{\\\"onlyarr\\\":[{\\\"measure\\\":2},{\\\"measure\\\":4}],\\\"include\\\":42}\");\n        CHECK(spy.log() ==\n              AllocatorLog{\n                  Allocate(sizeofString(\"onlyarr\")),\n                  Allocate(sizeofPool()),\n                  Allocate(sizeofString(\"location\")),\n                  Reallocate(sizeofString(\"location\"), sizeofString(\"measure\")),\n                  Allocate(sizeofString(\"location\")),\n                  Reallocate(sizeofString(\"location\"), sizeofString(\"include\")),\n                  Reallocate(sizeofPool(), sizeofObject(2) + sizeofArray(2) +\n                                               2 * sizeofObject(1)),\n              });\n      }\n\n      SECTION(\"include array 32\") {\n        error = deserializeMsgPack(doc,\n                                   \"\\x82\\xA7onlyarr\"\n                                   \"\\xDD\\x00\\x00\\x00\\x02\"\n                                   \"\\x82\\xA8location\\x01\\xA7measure\\x02\"\n                                   \"\\x82\\xA8location\\x02\\xA7measure\\x04\"\n                                   \"\\xA7include\\x2A\",\n                                   filterOpt);\n\n        CHECK(error == DeserializationError::Ok);\n        CHECK(doc.as<std::string>() ==\n              \"{\\\"onlyarr\\\":[{\\\"measure\\\":2},{\\\"measure\\\":4}],\\\"include\\\":42}\");\n        CHECK(spy.log() ==\n              AllocatorLog{\n                  Allocate(sizeofString(\"onlyarr\")),\n                  Allocate(sizeofPool()),\n                  Allocate(sizeofString(\"location\")),\n                  Reallocate(sizeofString(\"location\"), sizeofString(\"measure\")),\n                  Allocate(sizeofString(\"location\")),\n                  Reallocate(sizeofString(\"location\"), sizeofString(\"include\")),\n                  Reallocate(sizeofPool(), sizeofObject(2) + sizeofArray(2) +\n                                               2 * sizeofObject(1)),\n              });\n      }\n\n      SECTION(\"skip null\") {\n        error = deserializeMsgPack(doc, \"\\x82\\xA7onlyarr\\xC0\\xA7include\\x2A\",\n                                   filterOpt);\n\n        CHECK(error == DeserializationError::Ok);\n        CHECK(doc.as<std::string>() == \"{\\\"onlyarr\\\":null,\\\"include\\\":42}\");\n        CHECK(spy.log() == AllocatorLog{\n                               Allocate(sizeofString(\"onlyarr\")),\n                               Allocate(sizeofPool()),\n                               Allocate(sizeofString(\"include\")),\n                               Reallocate(sizeofPool(), sizeofObject(2)),\n                           });\n      }\n\n      SECTION(\"skip false\") {\n        error = deserializeMsgPack(doc, \"\\x82\\xA7onlyarr\\xC2\\xA7include\\x2A\",\n                                   filterOpt);\n\n        CHECK(error == DeserializationError::Ok);\n        CHECK(doc.as<std::string>() == \"{\\\"onlyarr\\\":null,\\\"include\\\":42}\");\n        CHECK(spy.log() == AllocatorLog{\n                               Allocate(sizeofString(\"onlyarr\")),\n                               Allocate(sizeofPool()),\n                               Allocate(sizeofString(\"include\")),\n                               Reallocate(sizeofPool(), sizeofObject(2)),\n                           });\n      }\n\n      SECTION(\"skip true\") {\n        error = deserializeMsgPack(doc, \"\\x82\\xA7onlyarr\\xC3\\xA7include\\x2A\",\n                                   filterOpt);\n\n        CHECK(error == DeserializationError::Ok);\n        CHECK(doc.as<std::string>() == \"{\\\"onlyarr\\\":null,\\\"include\\\":42}\");\n        CHECK(spy.log() == AllocatorLog{\n                               Allocate(sizeofString(\"onlyarr\")),\n                               Allocate(sizeofPool()),\n                               Allocate(sizeofString(\"include\")),\n                               Reallocate(sizeofPool(), sizeofObject(2)),\n                           });\n      }\n\n      SECTION(\"skip positive fixint\") {\n        error = deserializeMsgPack(doc, \"\\x82\\xA7onlyarr\\x2A\\xA7include\\x2A\",\n                                   filterOpt);\n\n        CHECK(error == DeserializationError::Ok);\n        CHECK(doc.as<std::string>() == \"{\\\"onlyarr\\\":null,\\\"include\\\":42}\");\n        CHECK(spy.log() == AllocatorLog{\n                               Allocate(sizeofString(\"onlyarr\")),\n                               Allocate(sizeofPool()),\n                               Allocate(sizeofString(\"include\")),\n                               Reallocate(sizeofPool(), sizeofObject(2)),\n                           });\n      }\n\n      SECTION(\"skip negative fixint\") {\n        error = deserializeMsgPack(doc, \"\\x82\\xA7onlyarr\\xFF\\xA7include\\x2A\",\n                                   filterOpt);\n\n        CHECK(error == DeserializationError::Ok);\n        CHECK(doc.as<std::string>() == \"{\\\"onlyarr\\\":null,\\\"include\\\":42}\");\n        CHECK(spy.log() == AllocatorLog{\n                               Allocate(sizeofString(\"onlyarr\")),\n                               Allocate(sizeofPool()),\n                               Allocate(sizeofString(\"include\")),\n                               Reallocate(sizeofPool(), sizeofObject(2)),\n                           });\n      }\n\n      SECTION(\"skip uint 8\") {\n        error = deserializeMsgPack(\n            doc, \"\\x82\\xA7onlyarr\\xCC\\x2A\\xA7include\\x2A\", filterOpt);\n\n        CHECK(error == DeserializationError::Ok);\n        CHECK(doc.as<std::string>() == \"{\\\"onlyarr\\\":null,\\\"include\\\":42}\");\n        CHECK(spy.log() == AllocatorLog{\n                               Allocate(sizeofString(\"onlyarr\")),\n                               Allocate(sizeofPool()),\n                               Allocate(sizeofString(\"include\")),\n                               Reallocate(sizeofPool(), sizeofObject(2)),\n                           });\n      }\n\n      SECTION(\"skip uint 16\") {\n        error = deserializeMsgPack(\n            doc, \"\\x82\\xA7onlyarr\\xcd\\x30\\x39\\xA7include\\x2A\", filterOpt);\n\n        CHECK(error == DeserializationError::Ok);\n        CHECK(doc.as<std::string>() == \"{\\\"onlyarr\\\":null,\\\"include\\\":42}\");\n        CHECK(spy.log() == AllocatorLog{\n                               Allocate(sizeofString(\"onlyarr\")),\n                               Allocate(sizeofPool()),\n                               Allocate(sizeofString(\"include\")),\n                               Reallocate(sizeofPool(), sizeofObject(2)),\n                           });\n      }\n\n      SECTION(\"skip uint 32\") {\n        error = deserializeMsgPack(\n            doc, \"\\x82\\xA7onlyarr\\xCE\\x12\\x34\\x56\\x78\\xA7include\\x2A\",\n            filterOpt);\n\n        CHECK(error == DeserializationError::Ok);\n        CHECK(doc.as<std::string>() == \"{\\\"onlyarr\\\":null,\\\"include\\\":42}\");\n        CHECK(spy.log() == AllocatorLog{\n                               Allocate(sizeofString(\"onlyarr\")),\n                               Allocate(sizeofPool()),\n                               Allocate(sizeofString(\"include\")),\n                               Reallocate(sizeofPool(), sizeofObject(2)),\n                           });\n      }\n\n      SECTION(\"skip uint 64\") {\n        error = deserializeMsgPack(doc,\n                                   \"\\x82\\xA7onlyarr\\xCF\\x12\\x34\\x56\\x78\\x9A\\xBC\"\n                                   \"\\xDE\\xF0\\xA7include\\x2A\",\n                                   filterOpt);\n\n        CHECK(error == DeserializationError::Ok);\n        CHECK(doc.as<std::string>() == \"{\\\"onlyarr\\\":null,\\\"include\\\":42}\");\n        CHECK(spy.log() == AllocatorLog{\n                               Allocate(sizeofString(\"onlyarr\")),\n                               Allocate(sizeofPool()),\n                               Allocate(sizeofString(\"include\")),\n                               Reallocate(sizeofPool(), sizeofObject(2)),\n                           });\n      }\n\n      SECTION(\"skip int 8\") {\n        error = deserializeMsgPack(\n            doc, \"\\x82\\xA7onlyarr\\xD0\\x2A\\xA7include\\x2A\", filterOpt);\n\n        CHECK(error == DeserializationError::Ok);\n        CHECK(doc.as<std::string>() == \"{\\\"onlyarr\\\":null,\\\"include\\\":42}\");\n        CHECK(spy.log() == AllocatorLog{\n                               Allocate(sizeofString(\"onlyarr\")),\n                               Allocate(sizeofPool()),\n                               Allocate(sizeofString(\"include\")),\n                               Reallocate(sizeofPool(), sizeofObject(2)),\n                           });\n      }\n\n      SECTION(\"skip int 16\") {\n        error = deserializeMsgPack(\n            doc, \"\\x82\\xA7onlyarr\\xD1\\xCF\\xC7\\xA7include\\x2A\", filterOpt);\n\n        CHECK(error == DeserializationError::Ok);\n        CHECK(doc.as<std::string>() == \"{\\\"onlyarr\\\":null,\\\"include\\\":42}\");\n        CHECK(spy.log() == AllocatorLog{\n                               Allocate(sizeofString(\"onlyarr\")),\n                               Allocate(sizeofPool()),\n                               Allocate(sizeofString(\"include\")),\n                               Reallocate(sizeofPool(), sizeofObject(2)),\n                           });\n      }\n\n      SECTION(\"skip int 32\") {\n        error = deserializeMsgPack(\n            doc, \"\\x82\\xA7onlyarr\\xD2\\xB6\\x69\\xFD\\x2E\\xA7include\\x2A\",\n            filterOpt);\n\n        CHECK(error == DeserializationError::Ok);\n        CHECK(doc.as<std::string>() == \"{\\\"onlyarr\\\":null,\\\"include\\\":42}\");\n        CHECK(spy.log() == AllocatorLog{\n                               Allocate(sizeofString(\"onlyarr\")),\n                               Allocate(sizeofPool()),\n                               Allocate(sizeofString(\"include\")),\n                               Reallocate(sizeofPool(), sizeofObject(2)),\n                           });\n      }\n\n      SECTION(\"skip int 64\") {\n        error = deserializeMsgPack(doc,\n                                   \"\\x82\\xA7onlyarr\\xD3\\x12\\x34\\x56\\x78\\x9A\\xBC\"\n                                   \"\\xDE\\xF0\\xA7include\\x2A\",\n                                   filterOpt);\n\n        CHECK(error == DeserializationError::Ok);\n        CHECK(doc.as<std::string>() == \"{\\\"onlyarr\\\":null,\\\"include\\\":42}\");\n        CHECK(spy.log() == AllocatorLog{\n                               Allocate(sizeofString(\"onlyarr\")),\n                               Allocate(sizeofPool()),\n                               Allocate(sizeofString(\"include\")),\n                               Reallocate(sizeofPool(), sizeofObject(2)),\n                           });\n      }\n\n      SECTION(\"skip float 32\") {\n        error = deserializeMsgPack(\n            doc, \"\\x82\\xA7onlyarr\\xCA\\x40\\x48\\xF5\\xC3\\xA7include\\x2A\",\n            filterOpt);\n\n        CHECK(error == DeserializationError::Ok);\n        CHECK(doc.as<std::string>() == \"{\\\"onlyarr\\\":null,\\\"include\\\":42}\");\n        CHECK(spy.log() == AllocatorLog{\n                               Allocate(sizeofString(\"onlyarr\")),\n                               Allocate(sizeofPool()),\n                               Allocate(sizeofString(\"include\")),\n                               Reallocate(sizeofPool(), sizeofObject(2)),\n                           });\n      }\n\n      SECTION(\"skip float 64\") {\n        error = deserializeMsgPack(doc,\n                                   \"\\x82\\xA7onlyarr\\xCB\\x40\\x09\\x21\\xCA\\xC0\\x83\"\n                                   \"\\x12\\x6F\\xA7include\\x2A\",\n                                   filterOpt);\n\n        CHECK(error == DeserializationError::Ok);\n        CHECK(doc.as<std::string>() == \"{\\\"onlyarr\\\":null,\\\"include\\\":42}\");\n        CHECK(spy.log() == AllocatorLog{\n                               Allocate(sizeofString(\"onlyarr\")),\n                               Allocate(sizeofPool()),\n                               Allocate(sizeofString(\"include\")),\n                               Reallocate(sizeofPool(), sizeofObject(2)),\n                           });\n      }\n\n      SECTION(\"skip fixstr\") {\n        error = deserializeMsgPack(\n            doc, \"\\x82\\xA7onlyarr\\xABhello world\\xA7include\\x2A\", filterOpt);\n\n        CHECK(error == DeserializationError::Ok);\n        CHECK(doc.as<std::string>() == \"{\\\"onlyarr\\\":null,\\\"include\\\":42}\");\n        CHECK(spy.log() == AllocatorLog{\n                               Allocate(sizeofString(\"onlyarr\")),\n                               Allocate(sizeofPool()),\n                               Allocate(sizeofString(\"include\")),\n                               Reallocate(sizeofPool(), sizeofObject(2)),\n                           });\n      }\n\n      SECTION(\"skip str 8\") {\n        error = deserializeMsgPack(\n            doc, \"\\x82\\xA7onlyarr\\xd9\\x05hello\\xA7include\\x2A\", filterOpt);\n\n        CHECK(error == DeserializationError::Ok);\n      }\n\n      SECTION(\"skip str 16\") {\n        error = deserializeMsgPack(\n            doc, \"\\x82\\xA7onlyarr\\xda\\x00\\x05hello\\xA7include\\x2A\", filterOpt);\n\n        CHECK(doc.as<std::string>() == \"{\\\"onlyarr\\\":null,\\\"include\\\":42}\");\n      }\n\n      SECTION(\"skip str 32\") {\n        error = deserializeMsgPack(\n            doc, \"\\x82\\xA7onlyarr\\xdb\\x00\\x00\\x00\\x05hello\\xA7include\\x2A\",\n            filterOpt);\n\n        CHECK(spy.log() == AllocatorLog{\n                               Allocate(sizeofString(\"onlyarr\")),\n                               Allocate(sizeofPool()),\n                               Allocate(sizeofString(\"include\")),\n                               Reallocate(sizeofPool(), sizeofObject(2)),\n                           });\n      }\n\n      SECTION(\"skip fixmap\") {\n        error = deserializeMsgPack(\n            doc, \"\\x82\\xA7onlyarr\\x82\\xA3one\\x01\\xA3two\\x02\\xA7include\\x2A\",\n            filterOpt);\n\n        CHECK(error == DeserializationError::Ok);\n        CHECK(doc.as<std::string>() == \"{\\\"onlyarr\\\":null,\\\"include\\\":42}\");\n        CHECK(spy.log() == AllocatorLog{\n                               Allocate(sizeofString(\"onlyarr\")),\n                               Allocate(sizeofPool()),\n                               Allocate(sizeofString(\"one\")),\n                               Deallocate(sizeofString(\"one\")),\n                               Allocate(sizeofString(\"include\")),\n                               Reallocate(sizeofPool(), sizeofObject(2)),\n                           });\n      }\n\n      SECTION(\"skip map 16\") {\n        error = deserializeMsgPack(doc,\n                                   \"\\x82\\xA7onlyarr\"\n                                   \"\\xDE\\x00\\x02\\xA1H\\xA5hello\\xA1W\\xA5world\"\n                                   \"\\xA7include\\x2A\",\n                                   filterOpt);\n\n        CHECK(error == DeserializationError::Ok);\n        CHECK(doc.as<std::string>() == \"{\\\"onlyarr\\\":null,\\\"include\\\":42}\");\n        CHECK(spy.log() == AllocatorLog{\n                               Allocate(sizeofString(\"onlyarr\")),\n                               Allocate(sizeofPool()),\n                               Allocate(sizeofString(\"H\")),\n                               Deallocate(sizeofString(\"H\")),\n                               Allocate(sizeofString(\"include\")),\n                               Reallocate(sizeofPool(), sizeofObject(2)),\n                           });\n      }\n\n      SECTION(\"skip map 32\") {\n        error = deserializeMsgPack(doc,\n                                   \"\\x82\\xA7onlyarr\"\n                                   \"\\xDF\\x00\\x00\\x00\\x02\"\n                                   \"\\xA4zero\\xCA\\x00\\x00\\x00\\x00\"\n                                   \"\\xA2pi\\xCA\\x40\\x48\\xF5\\xC3\"\n                                   \"\\xA7include\\x2A\",\n                                   filterOpt);\n\n        CHECK(error == DeserializationError::Ok);\n        CHECK(doc.as<std::string>() == \"{\\\"onlyarr\\\":null,\\\"include\\\":42}\");\n        CHECK(spy.log() == AllocatorLog{\n                               Allocate(sizeofString(\"onlyarr\")),\n                               Allocate(sizeofPool()),\n                               Allocate(sizeofString(\"zero\")),\n                               Deallocate(sizeofString(\"zero\")),\n                               Allocate(sizeofString(\"include\")),\n                               Reallocate(sizeofPool(), sizeofObject(2)),\n                           });\n      }\n    }\n  }\n\n  SECTION(\"root is fixarray\") {\n    SECTION(\"filter = [false, true]\") {\n      filter[0] = false;  // only the first elment of the filter matters\n      filter[1] = true;   // so this one is ignored\n\n      SECTION(\"input = [1,2,3]\") {\n        error = deserializeMsgPack(doc, \"\\x93\\x01\\x02\\x03\", filterOpt);\n\n        CHECK(error == DeserializationError::Ok);\n        CHECK(doc.as<std::string>() == \"[]\");\n        CHECK(spy.log() == AllocatorLog());\n      }\n    }\n\n    SECTION(\"filter = [true, false]\") {\n      filter[0] = true;   // only the first elment of the filter matters\n      filter[1] = false;  // so this one is ignored\n\n      SECTION(\"input = [1,2,3]\") {\n        error = deserializeMsgPack(doc, \"\\x93\\x01\\x02\\x03\", filterOpt);\n\n        CHECK(error == DeserializationError::Ok);\n        CHECK(doc.as<std::string>() == \"[1,2,3]\");\n        CHECK(spy.log() == AllocatorLog{\n                               Allocate(sizeofPool()),\n                               Reallocate(sizeofPool(), sizeofArray(3)),\n                           });\n      }\n    }\n  }\n\n  SECTION(\"Filter = {onlyobj:{measure:true},include:true}\") {\n    filter[\"onlyobj\"][\"measure\"] = true;\n    filter[\"include\"] = true;\n\n    CAPTURE(filter.as<std::string>());\n\n    SECTION(\"include fixmap\") {\n      error = deserializeMsgPack(doc,\n                                 \"\\x82\\xA7onlyobj\"\n                                 \"\\x82\\xA8location\\x01\\xA7measure\\x02\"\n                                 \"\\xA7include\\x2A\",\n                                 filterOpt);\n\n      CHECK(error == DeserializationError::Ok);\n      CHECK(doc.as<std::string>() ==\n            \"{\\\"onlyobj\\\":{\\\"measure\\\":2},\\\"include\\\":42}\");\n      CHECK(spy.log() ==\n            AllocatorLog{\n                Allocate(sizeofString(\"onlyobj\")),\n                Allocate(sizeofPool()),\n                Allocate(sizeofString(\"location\")),\n                Reallocate(sizeofString(\"location\"), sizeofString(\"measure\")),\n                Allocate(sizeofString(\"include\")),\n                Reallocate(sizeofPool(), sizeofObject(2) + sizeofObject(1)),\n            });\n    }\n\n    SECTION(\"include map 16\") {\n      error = deserializeMsgPack(doc,\n                                 \"\\x82\\xA7onlyobj\"\n                                 \"\\xDE\\x00\\x02\\xA8location\\x01\\xA7measure\\x02\"\n                                 \"\\xA7include\\x2A\",\n                                 filterOpt);\n\n      CHECK(error == DeserializationError::Ok);\n      CHECK(doc.as<std::string>() ==\n            \"{\\\"onlyobj\\\":{\\\"measure\\\":2},\\\"include\\\":42}\");\n      CHECK(spy.log() ==\n            AllocatorLog{\n                Allocate(sizeofString(\"onlyobj\")),\n                Allocate(sizeofPool()),\n                Allocate(sizeofString(\"location\")),\n                Reallocate(sizeofString(\"location\"), sizeofString(\"measure\")),\n                Allocate(sizeofString(\"include\")),\n                Reallocate(sizeofPool(), sizeofObject(2) + sizeofObject(1)),\n            });\n    }\n\n    SECTION(\"include map 32\") {\n      error = deserializeMsgPack(doc,\n                                 \"\\x82\\xA7onlyobj\"\n                                 \"\\xDF\\x00\\x00\\x00\\x02\"\n                                 \"\\xA8location\\x01\\xA7measure\\x02\"\n                                 \"\\xA7include\\x2A\",\n                                 filterOpt);\n\n      CHECK(error == DeserializationError::Ok);\n      CHECK(doc.as<std::string>() ==\n            \"{\\\"onlyobj\\\":{\\\"measure\\\":2},\\\"include\\\":42}\");\n      CHECK(spy.log() ==\n            AllocatorLog{\n                Allocate(sizeofString(\"onlyobj\")),\n                Allocate(sizeofPool()),\n                Allocate(sizeofString(\"location\")),\n                Reallocate(sizeofString(\"location\"), sizeofString(\"measure\")),\n                Allocate(sizeofString(\"include\")),\n                Reallocate(sizeofPool(), sizeofObject(2) + sizeofObject(1)),\n            });\n    }\n\n    SECTION(\"skip null\") {\n      error = deserializeMsgPack(doc, \"\\x82\\xA7onlyobj\\xC0\\xA7include\\x2A\",\n                                 filterOpt);\n\n      CHECK(error == DeserializationError::Ok);\n      CHECK(doc.as<std::string>() == \"{\\\"onlyobj\\\":null,\\\"include\\\":42}\");\n      CHECK(spy.log() == AllocatorLog{\n                             Allocate(sizeofString(\"onlyarr\")),\n                             Allocate(sizeofPool()),\n                             Allocate(sizeofString(\"include\")),\n                             Reallocate(sizeofPool(), sizeofObject(2)),\n                         });\n    }\n\n    SECTION(\"skip false\") {\n      error = deserializeMsgPack(doc, \"\\x82\\xA7onlyobj\\xC2\\xA7include\\x2A\",\n                                 filterOpt);\n\n      CHECK(error == DeserializationError::Ok);\n      CHECK(doc.as<std::string>() == \"{\\\"onlyobj\\\":null,\\\"include\\\":42}\");\n      CHECK(spy.log() == AllocatorLog{\n                             Allocate(sizeofString(\"onlyarr\")),\n                             Allocate(sizeofPool()),\n                             Allocate(sizeofString(\"include\")),\n                             Reallocate(sizeofPool(), sizeofObject(2)),\n                         });\n    }\n\n    SECTION(\"skip true\") {\n      error = deserializeMsgPack(doc, \"\\x82\\xA7onlyobj\\xC3\\xA7include\\x2A\",\n                                 filterOpt);\n\n      CHECK(error == DeserializationError::Ok);\n      CHECK(doc.as<std::string>() == \"{\\\"onlyobj\\\":null,\\\"include\\\":42}\");\n      CHECK(spy.log() == AllocatorLog{\n                             Allocate(sizeofString(\"onlyarr\")),\n                             Allocate(sizeofPool()),\n                             Allocate(sizeofString(\"include\")),\n                             Reallocate(sizeofPool(), sizeofObject(2)),\n                         });\n    }\n\n    SECTION(\"skip positive fixint\") {\n      error = deserializeMsgPack(doc, \"\\x82\\xA7onlyobj\\x2A\\xA7include\\x2A\",\n                                 filterOpt);\n\n      CHECK(error == DeserializationError::Ok);\n      CHECK(doc.as<std::string>() == \"{\\\"onlyobj\\\":null,\\\"include\\\":42}\");\n      CHECK(spy.log() == AllocatorLog{\n                             Allocate(sizeofString(\"onlyarr\")),\n                             Allocate(sizeofPool()),\n                             Allocate(sizeofString(\"include\")),\n                             Reallocate(sizeofPool(), sizeofObject(2)),\n                         });\n    }\n\n    SECTION(\"skip negative fixint\") {\n      error = deserializeMsgPack(doc, \"\\x82\\xA7onlyobj\\xFF\\xA7include\\x2A\",\n                                 filterOpt);\n\n      CHECK(error == DeserializationError::Ok);\n      CHECK(doc.as<std::string>() == \"{\\\"onlyobj\\\":null,\\\"include\\\":42}\");\n      CHECK(spy.log() == AllocatorLog{\n                             Allocate(sizeofString(\"onlyarr\")),\n                             Allocate(sizeofPool()),\n                             Allocate(sizeofString(\"include\")),\n                             Reallocate(sizeofPool(), sizeofObject(2)),\n                         });\n    }\n\n    SECTION(\"skip uint 8\") {\n      error = deserializeMsgPack(doc, \"\\x82\\xA7onlyobj\\xCC\\x2A\\xA7include\\x2A\",\n                                 filterOpt);\n\n      CHECK(error == DeserializationError::Ok);\n      CHECK(doc.as<std::string>() == \"{\\\"onlyobj\\\":null,\\\"include\\\":42}\");\n      CHECK(spy.log() == AllocatorLog{\n                             Allocate(sizeofString(\"onlyarr\")),\n                             Allocate(sizeofPool()),\n                             Allocate(sizeofString(\"include\")),\n                             Reallocate(sizeofPool(), sizeofObject(2)),\n                         });\n    }\n\n    SECTION(\"skip uint 16\") {\n      error = deserializeMsgPack(\n          doc, \"\\x82\\xA7onlyobj\\xcd\\x30\\x39\\xA7include\\x2A\", filterOpt);\n\n      CHECK(error == DeserializationError::Ok);\n      CHECK(doc.as<std::string>() == \"{\\\"onlyobj\\\":null,\\\"include\\\":42}\");\n      CHECK(spy.log() == AllocatorLog{\n                             Allocate(sizeofString(\"onlyarr\")),\n                             Allocate(sizeofPool()),\n                             Allocate(sizeofString(\"include\")),\n                             Reallocate(sizeofPool(), sizeofObject(2)),\n                         });\n    }\n\n    SECTION(\"skip uint 32\") {\n      error = deserializeMsgPack(\n          doc, \"\\x82\\xA7onlyobj\\xCE\\x12\\x34\\x56\\x78\\xA7include\\x2A\", filterOpt);\n\n      CHECK(error == DeserializationError::Ok);\n      CHECK(doc.as<std::string>() == \"{\\\"onlyobj\\\":null,\\\"include\\\":42}\");\n      CHECK(spy.log() == AllocatorLog{\n                             Allocate(sizeofString(\"onlyarr\")),\n                             Allocate(sizeofPool()),\n                             Allocate(sizeofString(\"include\")),\n                             Reallocate(sizeofPool(), sizeofObject(2)),\n                         });\n    }\n\n    SECTION(\"skip uint 64\") {\n      error = deserializeMsgPack(doc,\n                                 \"\\x82\\xA7onlyobj\\xCF\\x12\\x34\\x56\\x78\\x9A\\xBC\"\n                                 \"\\xDE\\xF0\\xA7include\\x2A\",\n                                 filterOpt);\n\n      CHECK(error == DeserializationError::Ok);\n      CHECK(doc.as<std::string>() == \"{\\\"onlyobj\\\":null,\\\"include\\\":42}\");\n      CHECK(spy.log() == AllocatorLog{\n                             Allocate(sizeofString(\"onlyarr\")),\n                             Allocate(sizeofPool()),\n                             Allocate(sizeofString(\"include\")),\n                             Reallocate(sizeofPool(), sizeofObject(2)),\n                         });\n    }\n\n    SECTION(\"skip int 8\") {\n      error = deserializeMsgPack(doc, \"\\x82\\xA7onlyobj\\xD0\\x2A\\xA7include\\x2A\",\n                                 filterOpt);\n\n      CHECK(error == DeserializationError::Ok);\n      CHECK(doc.as<std::string>() == \"{\\\"onlyobj\\\":null,\\\"include\\\":42}\");\n      CHECK(spy.log() == AllocatorLog{\n                             Allocate(sizeofString(\"onlyarr\")),\n                             Allocate(sizeofPool()),\n                             Allocate(sizeofString(\"include\")),\n                             Reallocate(sizeofPool(), sizeofObject(2)),\n                         });\n    }\n\n    SECTION(\"skip int 16\") {\n      error = deserializeMsgPack(\n          doc, \"\\x82\\xA7onlyobj\\xD1\\xCF\\xC7\\xA7include\\x2A\", filterOpt);\n\n      CHECK(error == DeserializationError::Ok);\n      CHECK(doc.as<std::string>() == \"{\\\"onlyobj\\\":null,\\\"include\\\":42}\");\n      CHECK(spy.log() == AllocatorLog{\n                             Allocate(sizeofString(\"onlyarr\")),\n                             Allocate(sizeofPool()),\n                             Allocate(sizeofString(\"include\")),\n                             Reallocate(sizeofPool(), sizeofObject(2)),\n                         });\n    }\n\n    SECTION(\"skip int 32\") {\n      error = deserializeMsgPack(\n          doc, \"\\x82\\xA7onlyobj\\xD2\\xB6\\x69\\xFD\\x2E\\xA7include\\x2A\", filterOpt);\n\n      CHECK(error == DeserializationError::Ok);\n      CHECK(doc.as<std::string>() == \"{\\\"onlyobj\\\":null,\\\"include\\\":42}\");\n      CHECK(spy.log() == AllocatorLog{\n                             Allocate(sizeofString(\"onlyarr\")),\n                             Allocate(sizeofPool()),\n                             Allocate(sizeofString(\"include\")),\n                             Reallocate(sizeofPool(), sizeofObject(2)),\n                         });\n    }\n\n    SECTION(\"skip int 64\") {\n      error = deserializeMsgPack(doc,\n                                 \"\\x82\\xA7onlyobj\\xD3\\x12\\x34\\x56\\x78\\x9A\\xBC\"\n                                 \"\\xDE\\xF0\\xA7include\\x2A\",\n                                 filterOpt);\n\n      CHECK(error == DeserializationError::Ok);\n      CHECK(doc.as<std::string>() == \"{\\\"onlyobj\\\":null,\\\"include\\\":42}\");\n      CHECK(spy.log() == AllocatorLog{\n                             Allocate(sizeofString(\"onlyarr\")),\n                             Allocate(sizeofPool()),\n                             Allocate(sizeofString(\"include\")),\n                             Reallocate(sizeofPool(), sizeofObject(2)),\n                         });\n    }\n\n    SECTION(\"skip float 32\") {\n      error = deserializeMsgPack(\n          doc, \"\\x82\\xA7onlyobj\\xCA\\x40\\x48\\xF5\\xC3\\xA7include\\x2A\", filterOpt);\n\n      CHECK(error == DeserializationError::Ok);\n      CHECK(doc.as<std::string>() == \"{\\\"onlyobj\\\":null,\\\"include\\\":42}\");\n      CHECK(spy.log() == AllocatorLog{\n                             Allocate(sizeofString(\"onlyarr\")),\n                             Allocate(sizeofPool()),\n                             Allocate(sizeofString(\"include\")),\n                             Reallocate(sizeofPool(), sizeofObject(2)),\n                         });\n    }\n\n    SECTION(\"skip float 64\") {\n      error = deserializeMsgPack(doc,\n                                 \"\\x82\\xA7onlyobj\\xCB\\x40\\x09\\x21\\xCA\\xC0\\x83\"\n                                 \"\\x12\\x6F\\xA7include\\x2A\",\n                                 filterOpt);\n\n      CHECK(error == DeserializationError::Ok);\n      CHECK(doc.as<std::string>() == \"{\\\"onlyobj\\\":null,\\\"include\\\":42}\");\n      CHECK(spy.log() == AllocatorLog{\n                             Allocate(sizeofString(\"onlyarr\")),\n                             Allocate(sizeofPool()),\n                             Allocate(sizeofString(\"include\")),\n                             Reallocate(sizeofPool(), sizeofObject(2)),\n                         });\n    }\n\n    SECTION(\"skip fixstr\") {\n      error = deserializeMsgPack(\n          doc, \"\\x82\\xA7onlyobj\\xABhello world\\xA7include\\x2A\", filterOpt);\n\n      CHECK(error == DeserializationError::Ok);\n      CHECK(doc.as<std::string>() == \"{\\\"onlyobj\\\":null,\\\"include\\\":42}\");\n      CHECK(spy.log() == AllocatorLog{\n                             Allocate(sizeofString(\"onlyarr\")),\n                             Allocate(sizeofPool()),\n                             Allocate(sizeofString(\"include\")),\n                             Reallocate(sizeofPool(), sizeofObject(2)),\n                         });\n    }\n\n    SECTION(\"skip str 8\") {\n      error = deserializeMsgPack(\n          doc, \"\\x82\\xA7onlyobj\\xd9\\x05hello\\xA7include\\x2A\", filterOpt);\n\n      CHECK(error == DeserializationError::Ok);\n    }\n\n    SECTION(\"skip str 16\") {\n      error = deserializeMsgPack(\n          doc, \"\\x82\\xA7onlyobj\\xda\\x00\\x05hello\\xA7include\\x2A\", filterOpt);\n\n      CHECK(doc.as<std::string>() == \"{\\\"onlyobj\\\":null,\\\"include\\\":42}\");\n    }\n\n    SECTION(\"skip str 32\") {\n      error = deserializeMsgPack(\n          doc, \"\\x82\\xA7onlyobj\\xdb\\x00\\x00\\x00\\x05hello\\xA7include\\x2A\",\n          filterOpt);\n\n      CHECK(spy.log() == AllocatorLog{\n                             Allocate(sizeofString(\"onlyarr\")),\n                             Allocate(sizeofPool()),\n                             Allocate(sizeofString(\"include\")),\n                             Reallocate(sizeofPool(), sizeofObject(2)),\n                         });\n    }\n\n    SECTION(\"skip fixarray\") {\n      error = deserializeMsgPack(\n          doc, \"\\x82\\xA7onlyobj\\x92\\x01\\x02\\xA7include\\x2A\", filterOpt);\n\n      CHECK(error == DeserializationError::Ok);\n      CHECK(doc.as<std::string>() == \"{\\\"onlyobj\\\":null,\\\"include\\\":42}\");\n      CHECK(spy.log() == AllocatorLog{\n                             Allocate(sizeofString(\"onlyarr\")),\n                             Allocate(sizeofPool()),\n                             Allocate(sizeofString(\"include\")),\n                             Reallocate(sizeofPool(), sizeofObject(2)),\n                         });\n    }\n\n    SECTION(\"skip array 16\") {\n      error = deserializeMsgPack(doc,\n                                 \"\\x82\\xA7onlyobj\\xDC\\x00\\x01\\xA7\"\n                                 \"example\\xA7include\\x2A\",\n                                 filterOpt);\n\n      CHECK(error == DeserializationError::Ok);\n      CHECK(doc.as<std::string>() == \"{\\\"onlyobj\\\":null,\\\"include\\\":42}\");\n      CHECK(spy.log() == AllocatorLog{\n                             Allocate(sizeofString(\"onlyarr\")),\n                             Allocate(sizeofPool()),\n                             Allocate(sizeofString(\"include\")),\n                             Reallocate(sizeofPool(), sizeofObject(2)),\n                         });\n    }\n\n    SECTION(\"skip array 32\") {\n      error = deserializeMsgPack(doc,\n                                 \"\\x82\\xA7onlyobj\"\n                                 \"\\xDD\\x00\\x00\\x00\\x02\\x01\\x02\"\n                                 \"\\xA7include\\x2A\",\n                                 filterOpt);\n\n      CHECK(error == DeserializationError::Ok);\n      CHECK(doc.as<std::string>() == \"{\\\"onlyobj\\\":null,\\\"include\\\":42}\");\n      CHECK(spy.log() == AllocatorLog{\n                             Allocate(sizeofString(\"onlyarr\")),\n                             Allocate(sizeofPool()),\n                             Allocate(sizeofString(\"include\")),\n                             Reallocate(sizeofPool(), sizeofObject(2)),\n                         });\n    }\n  }\n\n  SECTION(\"filter = true\") {\n    filter.set(true);\n\n    error = deserializeMsgPack(doc, \"\\x90\", filterOpt);\n\n    CHECK(error == DeserializationError::Ok);\n    CHECK(doc.is<JsonArray>() == true);\n    CHECK(doc.size() == 0);\n  }\n\n  SECTION(\"filter = false\") {\n    filter.set(false);\n\n    SECTION(\"input = fixarray\") {\n      error = deserializeMsgPack(doc, \"\\x92\\x01\\x02\", filterOpt);\n\n      CHECK(error == DeserializationError::Ok);\n      CHECK(doc.isNull() == true);\n    }\n\n    SECTION(\"input = array 16\") {\n      error = deserializeMsgPack(doc, \"\\xDC\\x00\\x02\\x01\\x02\", filterOpt);\n\n      CHECK(error == DeserializationError::Ok);\n      CHECK(doc.isNull() == true);\n    }\n\n    SECTION(\"array too deep\") {\n      error = deserializeMsgPack(doc, \"\\x91\\x91\\x91\\x91\\x91\", 5, filterOpt,\n                                 DeserializationOption::NestingLimit(4));\n\n      CHECK(error == DeserializationError::TooDeep);\n    }\n\n    SECTION(\"object too deep\") {\n      error = deserializeMsgPack(\n          doc, \"\\x81\\xA1z\\x81\\xA1z\\x81\\xA1z\\x81\\xA1z\\x81\\xA1z\", 15, filterOpt,\n          DeserializationOption::NestingLimit(4));\n\n      CHECK(error == DeserializationError::TooDeep);\n    }\n  }\n}\n\nTEST_CASE(\"Zero-copy mode\") {  // issue #1697\n  char input[] = \"\\x82\\xA7include\\x01\\xA6ignore\\x02\";\n\n  JsonDocument filter;\n  filter[\"include\"] = true;\n\n  JsonDocument doc;\n  DeserializationError err =\n      deserializeMsgPack(doc, input, 18, DeserializationOption::Filter(filter));\n\n  CHECK(err == DeserializationError::Ok);\n  CHECK(doc.as<std::string>() == \"{\\\"include\\\":1}\");\n}\n\nTEST_CASE(\"Overloads\") {\n  JsonDocument doc;\n  JsonDocument filter;\n\n  using namespace DeserializationOption;\n\n  // deserializeMsgPack(..., Filter)\n\n  SECTION(\"const char*, Filter\") {\n    deserializeMsgPack(doc, \"{}\", Filter(filter));\n  }\n\n  SECTION(\"const char*, size_t, Filter\") {\n    deserializeMsgPack(doc, \"{}\", 2, Filter(filter));\n  }\n\n  SECTION(\"const std::string&, Filter\") {\n    deserializeMsgPack(doc, \"{}\"_s, Filter(filter));\n  }\n\n  SECTION(\"std::istream&, Filter\") {\n    std::stringstream s(\"{}\");\n    deserializeMsgPack(doc, s, Filter(filter));\n  }\n\n#ifdef HAS_VARIABLE_LENGTH_ARRAY\n  SECTION(\"char[n], Filter\") {\n    size_t i = 4;\n    char vla[i];\n    strcpy(vla, \"{}\");\n    deserializeMsgPack(doc, vla, Filter(filter));\n  }\n#endif\n\n  // deserializeMsgPack(..., Filter, NestingLimit)\n\n  SECTION(\"const char*, Filter, NestingLimit\") {\n    deserializeMsgPack(doc, \"{}\", Filter(filter), NestingLimit(5));\n  }\n\n  SECTION(\"const char*, size_t, Filter, NestingLimit\") {\n    deserializeMsgPack(doc, \"{}\", 2, Filter(filter), NestingLimit(5));\n  }\n\n  SECTION(\"const std::string&, Filter, NestingLimit\") {\n    deserializeMsgPack(doc, \"{}\"_s, Filter(filter), NestingLimit(5));\n  }\n\n  SECTION(\"std::istream&, Filter, NestingLimit\") {\n    std::stringstream s(\"{}\");\n    deserializeMsgPack(doc, s, Filter(filter), NestingLimit(5));\n  }\n\n#ifdef HAS_VARIABLE_LENGTH_ARRAY\n  SECTION(\"char[n], Filter, NestingLimit\") {\n    size_t i = 4;\n    char vla[i];\n    strcpy(vla, \"{}\");\n    deserializeMsgPack(doc, vla, Filter(filter), NestingLimit(5));\n  }\n#endif\n\n  // deserializeMsgPack(..., NestingLimit, Filter)\n\n  SECTION(\"const char*, NestingLimit, Filter\") {\n    deserializeMsgPack(doc, \"{}\", NestingLimit(5), Filter(filter));\n  }\n\n  SECTION(\"const char*, size_t, NestingLimit, Filter\") {\n    deserializeMsgPack(doc, \"{}\", 2, NestingLimit(5), Filter(filter));\n  }\n\n  SECTION(\"const std::string&, NestingLimit, Filter\") {\n    deserializeMsgPack(doc, \"{}\"_s, NestingLimit(5), Filter(filter));\n  }\n\n  SECTION(\"std::istream&, NestingLimit, Filter\") {\n    std::stringstream s(\"{}\");\n    deserializeMsgPack(doc, s, NestingLimit(5), Filter(filter));\n  }\n\n#ifdef HAS_VARIABLE_LENGTH_ARRAY\n  SECTION(\"char[n], NestingLimit, Filter\") {\n    size_t i = 4;\n    char vla[i];\n    strcpy(vla, \"{}\");\n    deserializeMsgPack(doc, vla, NestingLimit(5), Filter(filter));\n  }\n#endif\n}\n"
  },
  {
    "path": "extras/tests/MsgPackDeserializer/input_types.cpp",
    "content": "// ArduinoJson - https://arduinojson.org\n// Copyright © 2014-2025, Benoit BLANCHON\n// MIT License\n\n#include <ArduinoJson.h>\n#include <catch.hpp>\n\n#include \"CustomReader.hpp\"\n#include \"Literals.hpp\"\n\nusing ArduinoJson::detail::sizeofObject;\n\nTEST_CASE(\"deserializeMsgPack(const std::string&)\") {\n  JsonDocument doc;\n\n  SECTION(\"should accept const string\") {\n    const std::string input(\"\\x92\\x01\\x02\");\n\n    DeserializationError err = deserializeMsgPack(doc, input);\n\n    REQUIRE(err == DeserializationError::Ok);\n  }\n\n  SECTION(\"should accept temporary string\") {\n    DeserializationError err = deserializeMsgPack(doc, \"\\x92\\x01\\x02\"_s);\n\n    REQUIRE(err == DeserializationError::Ok);\n  }\n\n  SECTION(\"should duplicate content\") {\n    std::string input(\"\\x91\\xA5hello\");\n\n    DeserializationError err = deserializeMsgPack(doc, input);\n    input[2] = 'X';  // alter the string tomake sure we made a copy\n\n    JsonArray array = doc.as<JsonArray>();\n    REQUIRE(err == DeserializationError::Ok);\n    REQUIRE(\"hello\"_s == array[0]);\n  }\n\n  SECTION(\"should accept a zero in input\") {\n    DeserializationError err = deserializeMsgPack(doc, \"\\x92\\x00\\x02\"_s);\n\n    REQUIRE(err == DeserializationError::Ok);\n    JsonArray arr = doc.as<JsonArray>();\n    REQUIRE(arr[0] == 0);\n    REQUIRE(arr[1] == 2);\n  }\n}\n\nTEST_CASE(\"deserializeMsgPack(std::istream&)\") {\n  JsonDocument doc;\n\n  SECTION(\"should accept a zero in input\") {\n    std::istringstream input(\"\\x92\\x00\\x02\"_s);\n\n    DeserializationError err = deserializeMsgPack(doc, input);\n\n    REQUIRE(err == DeserializationError::Ok);\n    JsonArray arr = doc.as<JsonArray>();\n    REQUIRE(arr[0] == 0);\n    REQUIRE(arr[1] == 2);\n  }\n\n  SECTION(\"should detect incomplete input\") {\n    std::istringstream input(\"\\x92\\x00\\x02\");\n\n    DeserializationError err = deserializeMsgPack(doc, input);\n\n    REQUIRE(err == DeserializationError::IncompleteInput);\n  }\n}\n\n#ifdef HAS_VARIABLE_LENGTH_ARRAY\nTEST_CASE(\"deserializeMsgPack(VLA)\") {\n  size_t i = 16;\n  char vla[i];\n  memcpy(vla, \"\\xDE\\x00\\x01\\xA5Hello\\xA5world\", 15);\n\n  JsonDocument doc;\n  DeserializationError err = deserializeMsgPack(doc, vla);\n\n  REQUIRE(err == DeserializationError::Ok);\n}\n#endif\n\nTEST_CASE(\"deserializeMsgPack(CustomReader)\") {\n  JsonDocument doc;\n  CustomReader reader(\"\\x92\\xA5Hello\\xA5world\");\n  DeserializationError err = deserializeMsgPack(doc, reader);\n\n  REQUIRE(err == DeserializationError::Ok);\n  REQUIRE(doc.size() == 2);\n  REQUIRE(doc[0] == \"Hello\");\n  REQUIRE(doc[1] == \"world\");\n}\n"
  },
  {
    "path": "extras/tests/MsgPackDeserializer/nestingLimit.cpp",
    "content": "// ArduinoJson - https://arduinojson.org\n// Copyright © 2014-2025, Benoit BLANCHON\n// MIT License\n\n#include <ArduinoJson.h>\n#include <catch.hpp>\n\n#include <sstream>\n\n#define SHOULD_WORK(expression) REQUIRE(DeserializationError::Ok == expression);\n#define SHOULD_FAIL(expression) \\\n  REQUIRE(DeserializationError::TooDeep == expression);\n\nTEST_CASE(\"JsonDeserializer nesting\") {\n  JsonDocument doc;\n\n  SECTION(\"Input = const char*\") {\n    SECTION(\"limit = 0\") {\n      DeserializationOption::NestingLimit nesting(0);\n      SHOULD_WORK(deserializeMsgPack(doc, \"\\xA1H\", nesting));  // \"H\"\n      SHOULD_FAIL(deserializeMsgPack(doc, \"\\x90\", nesting));   // []\n      SHOULD_FAIL(deserializeMsgPack(doc, \"\\x80\", nesting));   // {}\n    }\n\n    SECTION(\"limit = 1\") {\n      DeserializationOption::NestingLimit nesting(1);\n      SHOULD_WORK(deserializeMsgPack(doc, \"\\x90\", nesting));           // {}\n      SHOULD_WORK(deserializeMsgPack(doc, \"\\x80\", nesting));           // []\n      SHOULD_FAIL(deserializeMsgPack(doc, \"\\x81\\xA1H\\x80\", nesting));  // {H:{}}\n      SHOULD_FAIL(deserializeMsgPack(doc, \"\\x91\\x90\", nesting));       // [[]]\n    }\n  }\n\n  SECTION(\"char* and size_t\") {\n    SECTION(\"limit = 0\") {\n      DeserializationOption::NestingLimit nesting(0);\n      SHOULD_WORK(deserializeMsgPack(doc, \"\\xA1H\", 2, nesting));\n      SHOULD_FAIL(deserializeMsgPack(doc, \"\\x90\", 1, nesting));\n      SHOULD_FAIL(deserializeMsgPack(doc, \"\\x80\", 1, nesting));\n    }\n\n    SECTION(\"limit = 1\") {\n      DeserializationOption::NestingLimit nesting(1);\n      SHOULD_WORK(deserializeMsgPack(doc, \"\\x90\", 1, nesting));\n      SHOULD_WORK(deserializeMsgPack(doc, \"\\x80\", 1, nesting));\n      SHOULD_FAIL(deserializeMsgPack(doc, \"\\x81\\xA1H\\x80\", 4, nesting));\n      SHOULD_FAIL(deserializeMsgPack(doc, \"\\x91\\x90\", 2, nesting));\n    }\n  }\n\n  SECTION(\"Input = std::string\") {\n    using std::string;\n\n    SECTION(\"limit = 0\") {\n      DeserializationOption::NestingLimit nesting(0);\n      SHOULD_WORK(deserializeMsgPack(doc, string(\"\\xA1H\"), nesting));\n      SHOULD_FAIL(deserializeMsgPack(doc, string(\"\\x90\"), nesting));\n      SHOULD_FAIL(deserializeMsgPack(doc, string(\"\\x80\"), nesting));\n    }\n\n    SECTION(\"limit = 1\") {\n      DeserializationOption::NestingLimit nesting(1);\n      SHOULD_WORK(deserializeMsgPack(doc, string(\"\\x90\"), nesting));\n      SHOULD_WORK(deserializeMsgPack(doc, string(\"\\x80\"), nesting));\n      SHOULD_FAIL(deserializeMsgPack(doc, string(\"\\x81\\xA1H\\x80\"), nesting));\n      SHOULD_FAIL(deserializeMsgPack(doc, string(\"\\x91\\x90\"), nesting));\n    }\n  }\n\n  SECTION(\"Input = std::istream\") {\n    SECTION(\"limit = 0\") {\n      DeserializationOption::NestingLimit nesting(0);\n      std::istringstream good(\"\\xA1H\");  // \"H\"\n      std::istringstream bad(\"\\x90\");    // []\n      SHOULD_WORK(deserializeMsgPack(doc, good, nesting));\n      SHOULD_FAIL(deserializeMsgPack(doc, bad, nesting));\n    }\n\n    SECTION(\"limit = 1\") {\n      DeserializationOption::NestingLimit nesting(1);\n      std::istringstream good(\"\\x90\");     // []\n      std::istringstream bad(\"\\x91\\x90\");  // [[]]\n      SHOULD_WORK(deserializeMsgPack(doc, good, nesting));\n      SHOULD_FAIL(deserializeMsgPack(doc, bad, nesting));\n    }\n  }\n}\n"
  },
  {
    "path": "extras/tests/MsgPackSerializer/CMakeLists.txt",
    "content": "# ArduinoJson - https://arduinojson.org\n# Copyright © 2014-2025, Benoit BLANCHON\n# MIT License\n\nadd_executable(MsgPackSerializerTests\n\tdestination_types.cpp\n\tmeasure.cpp\n\tmisc.cpp\n\tserializeArray.cpp\n\tserializeObject.cpp\n\tserializeVariant.cpp\n)\n\nadd_test(MsgPackSerializer MsgPackSerializerTests)\n\nset_tests_properties(MsgPackSerializer\n\tPROPERTIES\n\t\tLABELS \"Catch\"\n)\n"
  },
  {
    "path": "extras/tests/MsgPackSerializer/destination_types.cpp",
    "content": "// ArduinoJson - https://arduinojson.org\n// Copyright © 2014-2025, Benoit BLANCHON\n// MIT License\n\n#include <ArduinoJson.h>\n#include <catch.hpp>\n\nTEST_CASE(\"serialize MsgPack to various destination types\") {\n  JsonDocument doc;\n  JsonObject object = doc.to<JsonObject>();\n  object[\"hello\"] = \"world\";\n  const char* expected_result = \"\\x81\\xA5hello\\xA5world\";\n  const size_t expected_length = 13;\n\n  SECTION(\"std::string\") {\n    std::string result;\n    size_t len = serializeMsgPack(object, result);\n\n    REQUIRE(expected_result == result);\n    REQUIRE(expected_length == len);\n  }\n\n  /*  SECTION(\"std::vector<char>\") {\n      std::vector<char> result;\n      size_t len = serializeMsgPack(object, result);\n\n      REQUIRE(std::vector<char>(expected_result, expected_result + 13) ==\n    result);\n    REQUIRE(expected_length == len);\n    } */\n\n  SECTION(\"char[] larger than needed\") {\n    char result[64];\n    memset(result, 42, sizeof(result));\n    size_t len = serializeMsgPack(object, result);\n\n    REQUIRE(expected_length == len);\n    REQUIRE(std::string(expected_result, len) == std::string(result, len));\n    REQUIRE(result[len] == 42);\n  }\n\n  SECTION(\"char[] of the right size\") {  // #1545\n    char result[13];\n    size_t len = serializeMsgPack(object, result);\n\n    REQUIRE(expected_length == len);\n    REQUIRE(std::string(expected_result, len) == std::string(result, len));\n  }\n\n  SECTION(\"char*\") {\n    char result[64];\n    memset(result, 42, sizeof(result));\n    size_t len = serializeMsgPack(object, result, 64);\n\n    REQUIRE(expected_length == len);\n    REQUIRE(std::string(expected_result, len) == std::string(result, len));\n    REQUIRE(result[len] == 42);\n  }\n}\n"
  },
  {
    "path": "extras/tests/MsgPackSerializer/measure.cpp",
    "content": "// ArduinoJson - https://arduinojson.org\n// Copyright © 2014-2025, Benoit BLANCHON\n// MIT License\n\n#include <ArduinoJson.h>\n#include <catch.hpp>\n\nTEST_CASE(\"measureMsgPack()\") {\n  JsonDocument doc;\n  JsonObject object = doc.to<JsonObject>();\n  object[\"hello\"] = \"world\";\n\n  REQUIRE(measureMsgPack(doc) == 13);\n}\n"
  },
  {
    "path": "extras/tests/MsgPackSerializer/misc.cpp",
    "content": "#include <ArduinoJson.h>\n#include <catch.hpp>\n#include <limits>\n\ntemplate <typename T>\nvoid check(T value, const std::string& expected) {\n  JsonDocument doc;\n  doc.to<JsonVariant>().set(value);\n  char buffer[256] = \"\";\n  size_t returnValue = serializeMsgPack(doc, buffer, sizeof(buffer));\n  REQUIRE(expected == buffer);\n  REQUIRE(expected.size() == returnValue);\n}\n\nTEST_CASE(\"serializeMsgPack(MemberProxy)\") {\n  JsonDocument doc;\n  deserializeJson(doc, \"{\\\"hello\\\":42}\");\n  JsonObject obj = doc.as<JsonObject>();\n  std::string result;\n\n  serializeMsgPack(obj[\"hello\"], result);\n\n  REQUIRE(result == \"*\");\n}\n\nTEST_CASE(\"serializeMsgPack(ElementProxy)\") {\n  JsonDocument doc;\n  deserializeJson(doc, \"[42]\");\n  JsonArray arr = doc.as<JsonArray>();\n  std::string result;\n\n  serializeMsgPack(arr[0], result);\n\n  REQUIRE(result == \"*\");\n}\n\nTEST_CASE(\"serializeMsgPack(JsonVariantSubscript)\") {\n  JsonDocument doc;\n  deserializeJson(doc, \"[42]\");\n  JsonVariant var = doc.as<JsonVariant>();\n  std::string result;\n\n  serializeMsgPack(var[0], result);\n\n  REQUIRE(result == \"*\");\n}\n"
  },
  {
    "path": "extras/tests/MsgPackSerializer/serializeArray.cpp",
    "content": "// ArduinoJson - https://arduinojson.org\n// Copyright © 2014-2025, Benoit BLANCHON\n// MIT License\n\n#define ARDUINOJSON_SLOT_ID_SIZE 4  // required to reach 65536 elements\n\n#include <ArduinoJson.h>\n#include <catch.hpp>\n\n#include \"Literals.hpp\"\n\nstatic void check(const JsonArray array, const char* expected_data,\n                  size_t expected_len) {\n  std::string expected(expected_data, expected_data + expected_len);\n  std::string actual;\n  size_t len = serializeMsgPack(array, actual);\n  CAPTURE(array);\n  REQUIRE(len == expected_len);\n  REQUIRE(actual == expected);\n}\n\ntemplate <size_t N>\nstatic void check(const JsonArray array, const char (&expected_data)[N]) {\n  const size_t expected_len = N - 1;\n  check(array, expected_data, expected_len);\n}\n\nstatic void check(const JsonArray array, const std::string& expected) {\n  check(array, expected.data(), expected.length());\n}\n\nTEST_CASE(\"serialize MsgPack array\") {\n  JsonDocument doc;\n  JsonArray array = doc.to<JsonArray>();\n\n  SECTION(\"empty\") {\n    check(array, \"\\x90\");\n  }\n\n  SECTION(\"fixarray\") {\n    array.add(\"hello\");\n    array.add(\"world\");\n\n    check(array, \"\\x92\\xA5hello\\xA5world\");\n  }\n\n  SECTION(\"array 16\") {\n    for (int i = 0; i < 16; i++)\n      array.add(i);\n\n    check(array,\n          \"\\xDC\\x00\\x10\\x00\\x01\\x02\\x03\\x04\\x05\\x06\\x07\\x08\\x09\\x0A\\x0B\\x0C\\x0D\"\n          \"\\x0E\\x0F\");\n  }\n\n  SECTION(\"array 32\") {\n    const char* nil = 0;\n    for (int i = 0; i < 65536; i++)\n      array.add(nil);\n    REQUIRE(array.size() == 65536);\n\n    check(array, \"\\xDD\\x00\\x01\\x00\\x00\"_s + std::string(65536, '\\xc0'));\n  }\n}\n"
  },
  {
    "path": "extras/tests/MsgPackSerializer/serializeObject.cpp",
    "content": "// ArduinoJson - https://arduinojson.org\n// Copyright © 2014-2025, Benoit BLANCHON\n// MIT License\n\n#include <ArduinoJson.h>\n#include <stdio.h>\n#include <catch.hpp>\n\n#include \"Literals.hpp\"\n\nstatic void check(const JsonObject object, const char* expected_data,\n                  size_t expected_len) {\n  std::string expected(expected_data, expected_data + expected_len);\n  std::string actual;\n  size_t len = serializeMsgPack(object, actual);\n  CAPTURE(object);\n  REQUIRE(len == expected_len);\n  REQUIRE(actual == expected);\n}\n\ntemplate <size_t N>\nstatic void check(const JsonObject object, const char (&expected_data)[N]) {\n  const size_t expected_len = N - 1;\n  check(object, expected_data, expected_len);\n}\n\n// TODO: used by the commented test\n// static void check(const JsonObject object, const std::string& expected) {\n//  check(object, expected.data(), expected.length());\n//}\n\nTEST_CASE(\"serialize MsgPack object\") {\n  JsonDocument doc;\n  JsonObject object = doc.to<JsonObject>();\n\n  SECTION(\"empty\") {\n    check(object, \"\\x80\");\n  }\n\n  SECTION(\"fixmap\") {\n    object[\"hello\"] = \"world\";\n\n    check(object, \"\\x81\\xA5hello\\xA5world\");\n  }\n\n  SECTION(\"map 16\") {\n    for (int i = 0; i < 16; ++i) {\n      char key[16];\n      snprintf(key, sizeof(key), \"i%X\", i);\n      object[key] = i;\n    }\n\n    check(object,\n          \"\\xDE\\x00\\x10\\xA2i0\\x00\\xA2i1\\x01\\xA2i2\\x02\\xA2i3\\x03\\xA2i4\\x04\\xA2i5\"\n          \"\\x05\\xA2i6\\x06\\xA2i7\\x07\\xA2i8\\x08\\xA2i9\\x09\\xA2iA\\x0A\\xA2iB\\x0B\\xA2\"\n          \"iC\\x0C\\xA2iD\\x0D\\xA2iE\\x0E\\xA2iF\\x0F\");\n  }\n\n  // TODO: improve performance and uncomment\n  // SECTION(\"map 32\") {\n  //   std::string expected(\"\\xDF\\x00\\x01\\x00\\x00\", 5);\n  //\n  //   for (int i = 0; i < 65536; ++i) {\n  //     char kv[16];\n  //     snprintf(kv, sizeof(kv), \"%04x\", i);\n  //     object[kv] = kv;\n  //     expected += '\\xA4';\n  //     expected += kv;\n  //     expected += '\\xA4';\n  //     expected += kv;\n  //   }\n  //\n  //   check(object, expected);\n  // }\n\n  SECTION(\"serialized(const char*)\") {\n    object[\"hello\"] = serialized(\"\\xDB\\x00\\x01\\x00\\x00\", 5);\n    check(object, \"\\x81\\xA5hello\\xDB\\x00\\x01\\x00\\x00\");\n  }\n\n  SECTION(\"serialized(std::string)\") {\n    object[\"hello\"] = serialized(\"\\xDB\\x00\\x01\\x00\\x00\"_s);\n    check(object, \"\\x81\\xA5hello\\xDB\\x00\\x01\\x00\\x00\");\n  }\n}\n"
  },
  {
    "path": "extras/tests/MsgPackSerializer/serializeVariant.cpp",
    "content": "// ArduinoJson - https://arduinojson.org\n// Copyright © 2014-2025, Benoit BLANCHON\n// MIT License\n\n#include <ArduinoJson.h>\n#include <catch.hpp>\n\n#include \"Literals.hpp\"\n\ntemplate <typename T>\nstatic void checkVariant(T value, const char* expected_data,\n                         size_t expected_len) {\n  JsonDocument doc;\n  JsonVariant variant = doc.to<JsonVariant>();\n  variant.set(value);\n  std::string expected(expected_data, expected_data + expected_len);\n  std::string actual;\n  size_t len = serializeMsgPack(variant, actual);\n  CAPTURE(variant);\n  REQUIRE(len == expected_len);\n  REQUIRE(actual == expected);\n}\n\ntemplate <typename T, size_t N>\nstatic void checkVariant(T value, const char (&expected_data)[N]) {\n  const size_t expected_len = N - 1;\n  checkVariant(value, expected_data, expected_len);\n}\n\ntemplate <typename T>\nstatic void checkVariant(T value, const std::string& expected) {\n  checkVariant(value, expected.data(), expected.length());\n}\n\nTEST_CASE(\"serialize MsgPack value\") {\n  SECTION(\"unbound\") {\n    checkVariant(JsonVariant(), \"\\xC0\");  // we represent undefined as nil\n  }\n\n  SECTION(\"nil\") {\n    const char* nil = 0;  // ArduinoJson uses a string for null\n    checkVariant(nil, \"\\xC0\");\n  }\n\n  SECTION(\"bool\") {\n    checkVariant(false, \"\\xC2\");\n    checkVariant(true, \"\\xC3\");\n  }\n\n  SECTION(\"positive fixint\") {\n    SECTION(\"signed\") {\n      checkVariant(0, \"\\x00\");\n      checkVariant(127, \"\\x7F\");\n    }\n    SECTION(\"unsigned\") {\n      checkVariant(0U, \"\\x00\");\n      checkVariant(127U, \"\\x7F\");\n    }\n  }\n\n  SECTION(\"uint 8\") {\n    checkVariant(128, \"\\xCC\\x80\");\n    checkVariant(255, \"\\xCC\\xFF\");\n  }\n\n  SECTION(\"uint 16\") {\n    checkVariant(256, \"\\xCD\\x01\\x00\");\n    checkVariant(0xFFFF, \"\\xCD\\xFF\\xFF\");\n  }\n\n  SECTION(\"uint 32\") {\n    checkVariant(0x00010000U, \"\\xCE\\x00\\x01\\x00\\x00\");\n    checkVariant(0x12345678U, \"\\xCE\\x12\\x34\\x56\\x78\");\n    checkVariant(0xFFFFFFFFU, \"\\xCE\\xFF\\xFF\\xFF\\xFF\");\n  }\n\n#if ARDUINOJSON_USE_LONG_LONG\n  SECTION(\"uint 64\") {\n    checkVariant(0x0001000000000000U, \"\\xCF\\x00\\x01\\x00\\x00\\x00\\x00\\x00\\x00\");\n    checkVariant(0x123456789ABCDEF0U, \"\\xCF\\x12\\x34\\x56\\x78\\x9A\\xBC\\xDE\\xF0\");\n    checkVariant(0xFFFFFFFFFFFFFFFFU, \"\\xCF\\xFF\\xFF\\xFF\\xFF\\xFF\\xFF\\xFF\\xFF\");\n  }\n#endif\n\n  SECTION(\"negative fixint\") {\n    checkVariant(-1, \"\\xFF\");\n    checkVariant(-32, \"\\xE0\");\n  }\n\n  SECTION(\"int 8\") {\n    checkVariant(-33, \"\\xD0\\xDF\");\n    checkVariant(-128, \"\\xD0\\x80\");\n  }\n\n  SECTION(\"int 16\") {\n    checkVariant(-129, \"\\xD1\\xFF\\x7F\");\n    checkVariant(-32768, \"\\xD1\\x80\\x00\");\n  }\n\n  SECTION(\"int 32\") {\n    checkVariant(-32769, \"\\xD2\\xFF\\xFF\\x7F\\xFF\");\n    checkVariant(-2147483647 - 1, \"\\xD2\\x80\\x00\\x00\\x00\");\n  }\n\n#if ARDUINOJSON_USE_LONG_LONG\n  SECTION(\"int 64\") {\n    checkVariant(int64_t(0xFEDCBA9876543210),\n                 \"\\xD3\\xFE\\xDC\\xBA\\x98\\x76\\x54\\x32\\x10\");\n  }\n#endif\n\n  SECTION(\"float 32\") {\n    checkVariant(1.25, \"\\xCA\\x3F\\xA0\\x00\\x00\");\n    checkVariant(9.22337204e+18f, \"\\xca\\x5f\\x00\\x00\\x00\");\n  }\n\n  SECTION(\"float 64\") {\n    checkVariant(3.1415, \"\\xCB\\x40\\x09\\x21\\xCA\\xC0\\x83\\x12\\x6F\");\n  }\n\n  SECTION(\"fixstr\") {\n    checkVariant(\"\", \"\\xA0\");\n    checkVariant(\"hello world hello world hello !\",\n                 \"\\xBFhello world hello world hello !\");\n  }\n\n  SECTION(\"str 8\") {\n    checkVariant(\"hello world hello world hello !!\",\n                 \"\\xD9\\x20hello world hello world hello !!\");\n  }\n\n  SECTION(\"str 16\") {\n    std::string shortest(256, '?');\n    checkVariant(shortest.c_str(), \"\\xDA\\x01\\x00\"_s + shortest);\n\n    std::string longest(65535, '?');\n    checkVariant(longest.c_str(), \"\\xDA\\xFF\\xFF\"_s + longest);\n  }\n\n#if ARDUINOJSON_STRING_LENGTH_SIZE > 2\n  SECTION(\"str 32\") {\n    std::string shortest(65536, '?');\n    checkVariant(shortest.c_str(), \"\\xDB\\x00\\x01\\x00\\x00\"_s + shortest);\n  }\n#endif\n\n  SECTION(\"serialized(const char*)\") {\n    checkVariant(serialized(\"\\xDA\\xFF\\xFF\"), \"\\xDA\\xFF\\xFF\");\n    checkVariant(serialized(\"\\xDB\\x00\\x01\\x00\\x00\", 5), \"\\xDB\\x00\\x01\\x00\\x00\");\n  }\n\n  SECTION(\"bin 8\") {\n    checkVariant(MsgPackBinary(\"?\", 1), \"\\xC4\\x01?\");\n  }\n\n  SECTION(\"bin 16\") {\n    auto str = std::string(256, '?');\n    checkVariant(MsgPackBinary(str.data(), str.size()), \"\\xC5\\x01\\x00\"_s + str);\n  }\n\n  // bin 32 is tested in string_length_size_4.cpp\n\n  SECTION(\"fixext 1\") {\n    checkVariant(MsgPackExtension(1, \"\\x02\", 1), \"\\xD4\\x01\\x02\");\n  }\n\n  SECTION(\"fixext 2\") {\n    checkVariant(MsgPackExtension(1, \"\\x03\\x04\", 2), \"\\xD5\\x01\\x03\\x04\");\n  }\n\n  SECTION(\"fixext 4\") {\n    checkVariant(MsgPackExtension(1, \"\\x05\\x06\\x07\\x08\", 4),\n                 \"\\xD6\\x01\\x05\\x06\\x07\\x08\");\n  }\n\n  SECTION(\"fixext 8\") {\n    checkVariant(MsgPackExtension(1, \"????????\", 8), \"\\xD7\\x01????????\");\n  }\n\n  SECTION(\"fixext 16\") {\n    checkVariant(MsgPackExtension(1, \"????????????????\", 16),\n                 \"\\xD8\\x01????????????????\");\n  }\n\n  SECTION(\"ext 8\") {\n    checkVariant(MsgPackExtension(2, \"???\", 3), \"\\xC7\\x03\\x02???\");\n    checkVariant(MsgPackExtension(2, \"?????\", 5), \"\\xC7\\x05\\x02?????\");\n    checkVariant(MsgPackExtension(2, \"???????\", 7), \"\\xC7\\x07\\x02???????\");\n    checkVariant(MsgPackExtension(2, \"?????????\", 9), \"\\xC7\\x09\\x02?????????\");\n    checkVariant(MsgPackExtension(2, \"???????????????\", 15),\n                 \"\\xC7\\x0F\\x02???????????????\");\n    checkVariant(MsgPackExtension(2, \"?????????????????\", 17),\n                 \"\\xC7\\x11\\x02?????????????????\");\n  }\n\n  SECTION(\"ext 16\") {\n    auto str = std::string(256, '?');\n    checkVariant(MsgPackExtension(2, str.data(), str.size()),\n                 \"\\xC8\\x01\\x00\\x02\"_s + str);\n  }\n\n  SECTION(\"serialize round double as integer\") {  // Issue #1718\n    checkVariant(-32768.0, \"\\xD1\\x80\\x00\");\n    checkVariant(-129.0, \"\\xD1\\xFF\\x7F\");\n    checkVariant(-128.0, \"\\xD0\\x80\");\n    checkVariant(-33.0, \"\\xD0\\xDF\");\n    checkVariant(-32.0, \"\\xE0\");\n    checkVariant(-1.0, \"\\xFF\");\n    checkVariant(0.0, \"\\x00\");\n    checkVariant(127.0, \"\\x7F\");\n    checkVariant(128.0, \"\\xCC\\x80\");\n    checkVariant(255.0, \"\\xCC\\xFF\");\n    checkVariant(256.0, \"\\xCD\\x01\\x00\");\n  }\n}\n"
  },
  {
    "path": "extras/tests/Numbers/CMakeLists.txt",
    "content": "# ArduinoJson - https://arduinojson.org\n# Copyright © 2014-2025, Benoit BLANCHON\n# MIT License\n\nadd_executable(NumbersTests\n\tconvertNumber.cpp\n\tdecomposeFloat.cpp\n\tparseDouble.cpp\n\tparseFloat.cpp\n\tparseInteger.cpp\n\tparseNumber.cpp\n)\n\nadd_test(Numbers NumbersTests)\n\nset_tests_properties(Numbers\n\tPROPERTIES\n\t\tLABELS \"Catch\"\n)\n"
  },
  {
    "path": "extras/tests/Numbers/convertNumber.cpp",
    "content": "// ArduinoJson - https://arduinojson.org\n// Copyright © 2014-2025, Benoit BLANCHON\n// MIT License\n\n#include <stdint.h>\n#include <ArduinoJson.hpp>\n#include <catch.hpp>\n\nusing namespace ArduinoJson::detail;\n\nTEST_CASE(\"canConvertNumber<TOut, TIn>()\") {\n  SECTION(\"int8_t -> int8_t\") {\n    CHECK(canConvertNumber<int8_t, int8_t>(0) == true);\n    CHECK(canConvertNumber<int8_t, int8_t>(127) == true);\n    CHECK(canConvertNumber<int8_t, int8_t>(-128) == true);\n  }\n\n  SECTION(\"int8_t -> int16_t\") {\n    CHECK(canConvertNumber<int16_t, int8_t>(0) == true);\n    CHECK(canConvertNumber<int16_t, int8_t>(127) == true);\n    CHECK(canConvertNumber<int16_t, int8_t>(-128) == true);\n  }\n\n  SECTION(\"int8_t -> uint8_t\") {\n    CHECK(canConvertNumber<uint8_t, int8_t>(0) == true);\n    CHECK(canConvertNumber<uint8_t, int8_t>(127) == true);\n    CHECK(canConvertNumber<uint8_t, int8_t>(-128) == false);\n  }\n\n  SECTION(\"int8_t -> uint16_t\") {\n    CHECK(canConvertNumber<uint16_t, int8_t>(0) == true);\n    CHECK(canConvertNumber<uint16_t, int8_t>(127) == true);\n    CHECK(canConvertNumber<uint16_t, int8_t>(-128) == false);\n  }\n\n  SECTION(\"int16_t -> int8_t\") {\n    CHECK(canConvertNumber<int8_t, int16_t>(0) == true);\n    CHECK(canConvertNumber<int8_t, int16_t>(127) == true);\n    CHECK(canConvertNumber<int8_t, int16_t>(128) == false);\n    CHECK(canConvertNumber<int8_t, int16_t>(-128) == true);\n    CHECK(canConvertNumber<int8_t, int16_t>(-129) == false);\n  }\n\n  SECTION(\"int16_t -> uint8_t\") {\n    CHECK(canConvertNumber<uint8_t, int16_t>(0) == true);\n    CHECK(canConvertNumber<uint8_t, int16_t>(255) == true);\n    CHECK(canConvertNumber<uint8_t, int16_t>(256) == false);\n    CHECK(canConvertNumber<uint8_t, int16_t>(-1) == false);\n  }\n\n  SECTION(\"uint8_t -> int8_t\") {\n    CHECK(canConvertNumber<int8_t, uint8_t>(0) == true);\n    CHECK(canConvertNumber<int8_t, uint8_t>(127) == true);\n    CHECK(canConvertNumber<int8_t, uint8_t>(128) == false);\n    CHECK(canConvertNumber<int8_t, uint8_t>(255) == false);\n  }\n\n  SECTION(\"uint8_t -> int16_t\") {\n    CHECK(canConvertNumber<int16_t, uint8_t>(0) == true);\n    CHECK(canConvertNumber<int16_t, uint8_t>(127) == true);\n    CHECK(canConvertNumber<int16_t, uint8_t>(128) == true);\n    CHECK(canConvertNumber<int16_t, uint8_t>(255) == true);\n  }\n\n  SECTION(\"uint8_t -> uint8_t\") {\n    CHECK(canConvertNumber<uint8_t, uint8_t>(0) == true);\n    CHECK(canConvertNumber<uint8_t, uint8_t>(127) == true);\n    CHECK(canConvertNumber<uint8_t, uint8_t>(128) == true);\n    CHECK(canConvertNumber<uint8_t, uint8_t>(255) == true);\n  }\n\n  SECTION(\"uint8_t -> uint16_t\") {\n    CHECK(canConvertNumber<uint16_t, uint8_t>(0) == true);\n    CHECK(canConvertNumber<uint16_t, uint8_t>(127) == true);\n    CHECK(canConvertNumber<uint16_t, uint8_t>(128) == true);\n    CHECK(canConvertNumber<uint16_t, uint8_t>(255) == true);\n  }\n\n  SECTION(\"float -> int32_t\") {\n    CHECK(canConvertNumber<int32_t, float>(0) == true);\n    CHECK(canConvertNumber<int32_t, float>(-2.147483904e9f) == false);\n    CHECK(canConvertNumber<int32_t, float>(-2.147483648e+9f) == true);\n    CHECK(canConvertNumber<int32_t, float>(2.14748352e+9f) == true);\n    CHECK(canConvertNumber<int32_t, float>(2.14748365e+9f) == false);\n  }\n\n  SECTION(\"double -> int32_t\") {\n    CHECK(canConvertNumber<int32_t, double>(0) == true);\n    CHECK(canConvertNumber<int32_t, double>(-2.147483649e+9) == false);\n    CHECK(canConvertNumber<int32_t, double>(-2.147483648e+9) == true);\n    CHECK(canConvertNumber<int32_t, double>(2.147483647e+9) == true);\n    CHECK(canConvertNumber<int32_t, double>(2.147483648e+9) == false);\n  }\n\n  SECTION(\"float -> uint32_t\") {\n    CHECK(canConvertNumber<uint32_t, float>(0) == true);\n    CHECK(canConvertNumber<uint32_t, float>(-1.401298e-45f) == false);\n    CHECK(canConvertNumber<uint32_t, float>(4.29496704e+9f) == true);\n    CHECK(canConvertNumber<uint32_t, float>(4.294967296e+9f) == false);\n  }\n\n  SECTION(\"float -> int64_t\") {\n    CHECK(canConvertNumber<int64_t, float>(0) == true);\n    CHECK(canConvertNumber<int64_t, float>(-9.22337204e+18f) == true);\n    CHECK(canConvertNumber<int64_t, float>(9.22337149e+18f) == true);\n    CHECK(canConvertNumber<int64_t, float>(9.22337204e+18f) == false);\n  }\n\n  SECTION(\"double -> int64_t\") {\n    CHECK(canConvertNumber<int64_t, double>(0) == true);\n    CHECK(canConvertNumber<int64_t, double>(-9.2233720368547758e+18) == true);\n    CHECK(canConvertNumber<int64_t, double>(9.2233720368547748e+18) == true);\n    CHECK(canConvertNumber<int64_t, double>(9.2233720368547758e+18) == false);\n  }\n\n  SECTION(\"float -> uint64_t\") {\n    CHECK(canConvertNumber<uint64_t, float>(0) == true);\n    CHECK(canConvertNumber<uint64_t, float>(-1.401298e-45f) == false);\n    CHECK(canConvertNumber<uint64_t, float>(1.84467429741979238e+19f) == true);\n    CHECK(canConvertNumber<uint64_t, float>(1.844674407370955161e+19f) ==\n          false);\n  }\n\n  SECTION(\"double -> uint64_t\") {\n    CHECK(canConvertNumber<uint64_t, double>(0) == true);\n    CHECK(canConvertNumber<uint64_t, double>(-4.9406564584124e-324) == false);\n    CHECK(canConvertNumber<uint64_t, double>(1.844674407370954958e+19) == true);\n    CHECK(canConvertNumber<uint64_t, double>(1.844674407370955166e+19) ==\n          false);\n  }\n}\n"
  },
  {
    "path": "extras/tests/Numbers/decomposeFloat.cpp",
    "content": "// ArduinoJson - https://arduinojson.org\n// Copyright © 2014-2025, Benoit BLANCHON\n// MIT License\n\n#include <ArduinoJson/Numbers/FloatParts.hpp>\n#include <catch.hpp>\n\nusing namespace ArduinoJson::detail;\n\nTEST_CASE(\"decomposeFloat()\") {\n  SECTION(\"1.7976931348623157E+308\") {\n    auto parts = decomposeFloat(1.7976931348623157E+308, 9);\n    REQUIRE(parts.integral == 1);\n    REQUIRE(parts.decimal == 797693135);\n    REQUIRE(parts.decimalPlaces == 9);\n    REQUIRE(parts.exponent == 308);\n  }\n\n  SECTION(\"4.94065645841247e-324\") {\n    auto parts = decomposeFloat(4.94065645841247e-324, 9);\n    REQUIRE(parts.integral == 4);\n    REQUIRE(parts.decimal == 940656458);\n    REQUIRE(parts.decimalPlaces == 9);\n    REQUIRE(parts.exponent == -324);\n  }\n\n  SECTION(\"3.4E+38\") {\n    auto parts = decomposeFloat(3.4E+38f, 6);\n    REQUIRE(parts.integral == 3);\n    REQUIRE(parts.decimal == 4);\n    REQUIRE(parts.decimalPlaces == 1);\n    REQUIRE(parts.exponent == 38);\n  }\n\n  SECTION(\"1.17549435e−38\") {\n    auto parts = decomposeFloat(1.17549435e-38f, 6);\n    REQUIRE(parts.integral == 1);\n    REQUIRE(parts.decimal == 175494);\n    REQUIRE(parts.decimalPlaces == 6);\n    REQUIRE(parts.exponent == -38);\n  }\n}\n"
  },
  {
    "path": "extras/tests/Numbers/parseDouble.cpp",
    "content": "// ArduinoJson - https://arduinojson.org\n// Copyright © 2014-2025, Benoit BLANCHON\n// MIT License\n\n#define ARDUINOJSON_USE_DOUBLE 1\n#define ARDUINOJSON_ENABLE_NAN 1\n#define ARDUINOJSON_ENABLE_INFINITY 1\n\n#include <ArduinoJson.hpp>\n#include <catch.hpp>\n\nusing namespace ArduinoJson::detail;\n\nvoid checkDouble(const char* input, double expected) {\n  CAPTURE(input);\n  REQUIRE(parseNumber<double>(input) == Approx(expected));\n}\n\nvoid checkDoubleNaN(const char* input) {\n  CAPTURE(input);\n  double result = parseNumber<double>(input);\n  REQUIRE(result != result);\n}\n\nvoid checkDoubleInf(const char* input, bool negative) {\n  CAPTURE(input);\n  double x = parseNumber<double>(input);\n  if (negative)\n    REQUIRE(x < 0);\n  else\n    REQUIRE(x > 0);\n  REQUIRE(x == x);      // not a NaN\n  REQUIRE(x * 2 == x);  // a property of infinity\n}\n\nTEST_CASE(\"parseNumber<double>()\") {\n  SECTION(\"Short_NoExponent\") {\n    checkDouble(\"3.14\", 3.14);\n    checkDouble(\"-3.14\", -3.14);\n    checkDouble(\"+3.14\", +3.14);\n  }\n\n  SECTION(\"Short_NoDot\") {\n    checkDouble(\"1E+308\", 1E+308);\n    checkDouble(\"-1E+308\", -1E+308);\n    checkDouble(\"+1E-308\", +1E-308);\n    checkDouble(\"+1e+308\", +1e+308);\n    checkDouble(\"-1e-308\", -1e-308);\n  }\n\n  SECTION(\"Max\") {\n    checkDouble(\".017976931348623147e+310\", 1.7976931348623147e+308);\n    checkDouble(\".17976931348623147e+309\", 1.7976931348623147e+308);\n    checkDouble(\"1.7976931348623147e+308\", 1.7976931348623147e+308);\n    checkDouble(\"17.976931348623147e+307\", 1.7976931348623147e+308);\n    checkDouble(\"179.76931348623147e+306\", 1.7976931348623147e+308);\n  }\n\n  SECTION(\"Min\") {\n    checkDouble(\".022250738585072014e-306\", 2.2250738585072014e-308);\n    checkDouble(\".22250738585072014e-307\", 2.2250738585072014e-308);\n    checkDouble(\"2.2250738585072014e-308\", 2.2250738585072014e-308);\n    checkDouble(\"22.250738585072014e-309\", 2.2250738585072014e-308);\n    checkDouble(\"222.50738585072014e-310\", 2.2250738585072014e-308);\n  }\n\n  SECTION(\"VeryLong\") {\n    checkDouble(\"0.00000000000000000000000000000001\", 1e-32);\n    checkDouble(\"100000000000000000000000000000000.0\", 1e+32);\n    checkDouble(\n        \"100000000000000000000000000000000.00000000000000000000000000000\",\n        1e+32);\n  }\n\n  SECTION(\"MantissaTooLongToFit\") {\n    checkDouble(\"0.179769313486231571111111111111\", 0.17976931348623157);\n    checkDouble(\"17976931348623157.11111111111111\", 17976931348623157.0);\n    checkDouble(\"1797693.134862315711111111111111\", 1797693.1348623157);\n\n    checkDouble(\"-0.179769313486231571111111111111\", -0.17976931348623157);\n    checkDouble(\"-17976931348623157.11111111111111\", -17976931348623157.0);\n    checkDouble(\"-1797693.134862315711111111111111\", -1797693.1348623157);\n  }\n\n  SECTION(\"ExponentTooBig\") {\n    checkDoubleInf(\"1e309\", false);\n    checkDoubleInf(\"-1e309\", true);\n    checkDoubleInf(\"1e65535\", false);\n    checkDouble(\"1e-65535\", 0.0);\n  }\n\n  SECTION(\"NaN\") {\n    checkDoubleNaN(\"NaN\");\n    checkDoubleNaN(\"nan\");\n  }\n\n  SECTION(\"Overflow exponent with decimal part\") {  // Issue #2220\n    checkDoubleNaN(\n        \"0.000000000000000000000000000000000000000000000000\"\n        \"00000000000000000000000000000000000000000000000000\"\n        \"00000000000000000000000000000000000000000000000000\"\n        \"00000000000000000000000000000000000000000000000000\"\n        \"00000000000000000000000000000000000000000000000000\"\n        \"00000000000000000000000000000000000000000000000000\"\n        \"00000000000000000000000000000000000000000000000000\"\n        \"00000000000000000000000000000000000000000000000000\"\n        \"00000000000000000000000000000000000000000000000000\"\n        \"00000000000000000000000000000000000000000000000000\"\n        \"00000000000000000000000000000000000000000000000001\");\n  }\n\n  SECTION(\"Overflow exponent with integral part\") {\n    checkDoubleNaN(\n        \"10000000000000000000000000000000000000000000000000\"\n        \"00000000000000000000000000000000000000000000000000\"\n        \"00000000000000000000000000000000000000000000000000\"\n        \"00000000000000000000000000000000000000000000000000\"\n        \"00000000000000000000000000000000000000000000000000\"\n        \"00000000000000000000000000000000000000000000000000\"\n        \"00000000000000000000000000000000000000000000000000\"\n        \"00000000000000000000000000000000000000000000000000\"\n        \"00000000000000000000000000000000000000000000000000\"\n        \"00000000000000000000000000000000000000000000000000\"\n        \"00000000000000000000000000000000000000000000000000\");\n  }\n}\n"
  },
  {
    "path": "extras/tests/Numbers/parseFloat.cpp",
    "content": "// ArduinoJson - https://arduinojson.org\n// Copyright © 2014-2025, Benoit BLANCHON\n// MIT License\n\n#define ARDUINOJSON_ENABLE_NAN 1\n#define ARDUINOJSON_ENABLE_INFINITY 1\n\n#include <ArduinoJson.hpp>\n#include <catch.hpp>\n\nusing namespace ArduinoJson::detail;\n\nvoid checkFloat(const char* input, float expected) {\n  CAPTURE(input);\n  auto result = parseNumber(input);\n  REQUIRE(result.type() == NumberType::Float);\n  REQUIRE(result.asFloat() == Approx(expected));\n}\n\nvoid checkFloatNaN(const char* input) {\n  CAPTURE(input);\n  float result = parseNumber<float>(input);\n  REQUIRE(result != result);\n}\n\nvoid checkFloatInf(const char* input, bool negative) {\n  CAPTURE(input);\n  float x = parseNumber<float>(input);\n  if (negative)\n    REQUIRE(x < 0);\n  else\n    REQUIRE(x > 0);\n  REQUIRE(x == x);      // not a NaN\n  REQUIRE(x * 2 == x);  // a property of infinity\n}\n\nTEST_CASE(\"parseNumber<float>()\") {\n  SECTION(\"Float_Short_NoExponent\") {\n    checkFloat(\"3.14\", 3.14f);\n    checkFloat(\"-3.14\", -3.14f);\n    checkFloat(\"+3.14\", +3.14f);\n  }\n\n  SECTION(\"Short_NoDot\") {\n    checkFloat(\"1E+38\", 1E+38f);\n    checkFloat(\"-1E+38\", -1E+38f);\n    checkFloat(\"+1E-38\", +1E-38f);\n    checkFloat(\"+1e+38\", +1e+38f);\n    checkFloat(\"-1e-38\", -1e-38f);\n  }\n\n  SECTION(\"Max\") {\n    checkFloat(\"340.2823e+36\", 3.402823e+38f);\n    checkFloat(\"34.02823e+37\", 3.402823e+38f);\n    checkFloat(\"3.402823e+38\", 3.402823e+38f);\n    checkFloat(\"0.3402823e+39\", 3.402823e+38f);\n    checkFloat(\"0.03402823e+40\", 3.402823e+38f);\n    checkFloat(\"0.003402823e+41\", 3.402823e+38f);\n  }\n\n  SECTION(\"VeryLong\") {\n    checkFloat(\"0.00000000000000000000000000000001\", 1e-32f);\n\n    // The following don't work because they have many digits so parseNumber()\n    // treats them as double. But it's not an issue because JsonVariant will use\n    // a float to store them.\n    //\n    // checkFloat(\"100000000000000000000000000000000.0\", 1e+32f);\n    // checkFloat(\n    //     \"100000000000000000000000000000000.00000000000000000000000000000\",\n    //     1e+32f);\n  }\n\n  SECTION(\"NaN\") {\n    checkFloatNaN(\"NaN\");\n    checkFloatNaN(\"nan\");\n  }\n\n  SECTION(\"Infinity\") {\n    checkFloatInf(\"Infinity\", false);\n    checkFloatInf(\"+Infinity\", false);\n    checkFloatInf(\"-Infinity\", true);\n    checkFloatInf(\"inf\", false);\n    checkFloatInf(\"+inf\", false);\n    checkFloatInf(\"-inf\", true);\n  }\n}\n"
  },
  {
    "path": "extras/tests/Numbers/parseInteger.cpp",
    "content": "// ArduinoJson - https://arduinojson.org\n// Copyright © 2014-2025, Benoit BLANCHON\n// MIT License\n\n#include <stdint.h>\n#include <ArduinoJson.hpp>\n#include <catch.hpp>\n\nusing namespace ArduinoJson::detail;\n\ntemplate <typename T>\nvoid checkInteger(const char* input, T expected) {\n  CAPTURE(input);\n  T actual = parseNumber<T>(input);\n  REQUIRE(expected == actual);\n}\n\nTEST_CASE(\"parseNumber<int8_t>()\") {\n  checkInteger<int8_t>(\"-128\", -128);\n  checkInteger<int8_t>(\"127\", 127);\n  checkInteger<int8_t>(\"+127\", 127);\n  checkInteger<int8_t>(\"3.14\", 3);\n  checkInteger<int8_t>(\"x42\", 0);\n  checkInteger<int8_t>(\"128\", 0);   // overflow\n  checkInteger<int8_t>(\"-129\", 0);  // overflow\n}\n\nTEST_CASE(\"parseNumber<int16_t>()\") {\n  checkInteger<int16_t>(\"-32768\", -32768);\n  checkInteger<int16_t>(\"32767\", 32767);\n  checkInteger<int16_t>(\"+32767\", 32767);\n  checkInteger<int16_t>(\"3.14\", 3);\n  checkInteger<int16_t>(\"x42\", 0);\n  checkInteger<int16_t>(\"-32769\", 0);  // overflow\n  checkInteger<int16_t>(\"32768\", 0);   // overflow\n}\n\nTEST_CASE(\"parseNumber<int32_t>()\") {\n  checkInteger<int32_t>(\"-2147483648\", (-2147483647 - 1));\n  checkInteger<int32_t>(\"2147483647\", 2147483647);\n  checkInteger<int32_t>(\"+2147483647\", 2147483647);\n  checkInteger<int32_t>(\"3.14\", 3);\n  checkInteger<int32_t>(\"x42\", 0);\n  checkInteger<int32_t>(\"-2147483649\", 0);  // overflow\n  checkInteger<int32_t>(\"2147483648\", 0);   // overflow\n}\n\nTEST_CASE(\"parseNumber<uint8_t>()\") {\n  checkInteger<uint8_t>(\"0\", 0);\n  checkInteger<uint8_t>(\"-0\", 0);\n  checkInteger<uint8_t>(\"255\", 255);\n  checkInteger<uint8_t>(\"+255\", 255);\n  checkInteger<uint8_t>(\"3.14\", 3);\n  checkInteger<uint8_t>(\"x42\", 0);\n  checkInteger<uint8_t>(\"-1\", 0);\n  checkInteger<uint8_t>(\"256\", 0);\n}\n\nTEST_CASE(\"parseNumber<uint16_t>()\") {\n  checkInteger<uint16_t>(\"0\", 0);\n  checkInteger<uint16_t>(\"65535\", 65535);\n  checkInteger<uint16_t>(\"+65535\", 65535);\n  checkInteger<uint16_t>(\"3.14\", 3);\n  // checkInteger<uint16_t>(\" 42\", 0);\n  checkInteger<uint16_t>(\"x42\", 0);\n  checkInteger<uint16_t>(\"-1\", 0);\n  checkInteger<uint16_t>(\"65536\", 0);\n}\n"
  },
  {
    "path": "extras/tests/Numbers/parseNumber.cpp",
    "content": "// ArduinoJson - https://arduinojson.org\n// Copyright © 2014-2025, Benoit BLANCHON\n// MIT License\n\n#include <ArduinoJson.hpp>\n#include <catch.hpp>\n\nusing namespace ArduinoJson;\nusing namespace ArduinoJson::detail;\n\nTEST_CASE(\"Test unsigned integer overflow\") {\n  Number first, second;\n\n  // Avoids MSVC warning C4127 (conditional expression is constant)\n  size_t integerSize = sizeof(JsonInteger);\n\n  if (integerSize == 8) {\n    first = parseNumber(\"18446744073709551615\");\n    second = parseNumber(\"18446744073709551616\");\n  } else {\n    first = parseNumber(\"4294967295\");\n    second = parseNumber(\"4294967296\");\n  }\n\n  REQUIRE(first.type() == NumberType::UnsignedInteger);\n  REQUIRE(second.type() == NumberType::Double);\n}\n\nTEST_CASE(\"Test signed integer overflow\") {\n  Number first, second;\n\n  // Avoids MSVC warning C4127 (conditional expression is constant)\n  size_t integerSize = sizeof(JsonInteger);\n\n  if (integerSize == 8) {\n    first = parseNumber(\"-9223372036854775808\");\n    second = parseNumber(\"-9223372036854775809\");\n  } else {\n    first = parseNumber(\"-2147483648\");\n    second = parseNumber(\"-2147483649\");\n  }\n\n  REQUIRE(first.type() == NumberType::SignedInteger);\n  REQUIRE(second.type() == NumberType::Double);\n}\n\nTEST_CASE(\"Invalid value\") {\n  auto result = parseNumber(\"6a3\");\n\n  REQUIRE(result.type() == NumberType::Invalid);\n}\n\nTEST_CASE(\"float\") {\n  auto result = parseNumber(\"3.402823e38\");\n\n  REQUIRE(result.type() == NumberType::Float);\n}\n\nTEST_CASE(\"double\") {\n  auto result = parseNumber(\"1.7976931348623157e308\");\n\n  REQUIRE(result.type() == NumberType::Double);\n}\n"
  },
  {
    "path": "extras/tests/ResourceManager/CMakeLists.txt",
    "content": "# ArduinoJson - https://arduinojson.org\n# Copyright © 2014-2025, Benoit BLANCHON\n# MIT License\n\nadd_executable(ResourceManagerTests\n\tallocVariant.cpp\n\tclear.cpp\n\tsaveString.cpp\n\tshrinkToFit.cpp\n\tsize.cpp\n\tStringBuffer.cpp\n\tStringBuilder.cpp\n\tswap.cpp\n)\n\nadd_compile_definitions(ResourceManagerTests\n\tARDUINOJSON_SLOT_ID_SIZE=1 # require less RAM for overflow tests\n\tARDUINOJSON_POOL_CAPACITY=16\n)\n\nadd_test(ResourceManager ResourceManagerTests)\n\nset_tests_properties(ResourceManager\n\tPROPERTIES\n\t\tLABELS \"Catch\"\n)\n"
  },
  {
    "path": "extras/tests/ResourceManager/StringBuffer.cpp",
    "content": "// ArduinoJson - https://arduinojson.org\n// Copyright © 2014-2025, Benoit BLANCHON\n// MIT License\n\n#include <ArduinoJson/Memory/StringBuffer.hpp>\n#include <ArduinoJson/Variant/VariantImpl.hpp>\n#include <catch.hpp>\n\n#include \"Allocators.hpp\"\n#include \"Literals.hpp\"\n\nusing namespace ArduinoJson::detail;\n\nTEST_CASE(\"StringBuffer\") {\n  SpyingAllocator spy;\n  ResourceManager resources(&spy);\n  StringBuffer sb(&resources);\n  VariantData variant;\n\n  SECTION(\"Tiny string\") {\n    auto ptr = sb.reserve(3);\n    strcpy(ptr, \"hi!\");\n    sb.save(&variant);\n\n    REQUIRE(variant.type == VariantType::TinyString);\n    REQUIRE(variant.asString() == \"hi!\");\n  }\n\n  SECTION(\"Tiny string can't contain NUL\") {\n    auto ptr = sb.reserve(3);\n    memcpy(ptr, \"a\\0b\", 3);\n    sb.save(&variant);\n\n    REQUIRE(variant.type == VariantType::LongString);\n\n    auto str = variant.asString();\n    REQUIRE(str.size() == 3);\n    REQUIRE(str.c_str()[0] == 'a');\n    REQUIRE(str.c_str()[1] == 0);\n    REQUIRE(str.c_str()[2] == 'b');\n  }\n\n  SECTION(\"Tiny string can't have 4 characters\") {\n    auto ptr = sb.reserve(4);\n    strcpy(ptr, \"alfa\");\n    sb.save(&variant);\n\n    REQUIRE(variant.type == VariantType::LongString);\n    REQUIRE(variant.asString() == \"alfa\");\n  }\n}\n"
  },
  {
    "path": "extras/tests/ResourceManager/StringBuilder.cpp",
    "content": "// ArduinoJson - https://arduinojson.org\n// Copyright © 2014-2025, Benoit BLANCHON\n// MIT License\n\n#include <ArduinoJson/Memory/StringBuilder.hpp>\n#include <ArduinoJson/Variant/VariantImpl.hpp>\n#include <catch.hpp>\n\n#include \"Allocators.hpp\"\n\nusing namespace ArduinoJson;\nusing namespace ArduinoJson::detail;\n\nTEST_CASE(\"StringBuilder\") {\n  KillswitchAllocator killswitch;\n  SpyingAllocator spyingAllocator(&killswitch);\n  ResourceManager resources(&spyingAllocator);\n\n  SECTION(\"Empty string\") {\n    StringBuilder str(&resources);\n    VariantData data;\n\n    str.startString();\n    str.save(&data);\n\n    REQUIRE(resources.overflowed() == false);\n    REQUIRE(spyingAllocator.log() == AllocatorLog{\n                                         Allocate(sizeofStringBuffer()),\n                                     });\n    REQUIRE(data.type == VariantType::TinyString);\n  }\n\n  SECTION(\"Tiny string\") {\n    StringBuilder str(&resources);\n\n    str.startString();\n    str.append(\"url\");\n\n    REQUIRE(str.isValid() == true);\n    REQUIRE(str.str() == \"url\");\n    REQUIRE(spyingAllocator.log() == AllocatorLog{\n                                         Allocate(sizeofStringBuffer()),\n                                     });\n\n    VariantData data;\n    str.save(&data);\n\n    REQUIRE(resources.overflowed() == false);\n    REQUIRE(data.type == VariantType::TinyString);\n    REQUIRE(data.asString() == \"url\");\n  }\n\n  SECTION(\"Short string fits in first allocation\") {\n    StringBuilder str(&resources);\n\n    str.startString();\n    str.append(\"hello\");\n\n    REQUIRE(str.isValid() == true);\n    REQUIRE(str.str() == \"hello\");\n    REQUIRE(resources.overflowed() == false);\n    REQUIRE(spyingAllocator.log() == AllocatorLog{\n                                         Allocate(sizeofStringBuffer()),\n                                     });\n  }\n\n  SECTION(\"Long string needs reallocation\") {\n    StringBuilder str(&resources);\n    const char* lorem =\n        \"Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do \"\n        \"eiusmod tempor incididunt ut labore et dolore magna aliqua.\";\n\n    str.startString();\n    str.append(lorem);\n\n    REQUIRE(str.isValid() == true);\n    REQUIRE(str.str() == lorem);\n    REQUIRE(resources.overflowed() == false);\n    REQUIRE(spyingAllocator.log() ==\n            AllocatorLog{\n                Allocate(sizeofStringBuffer(1)),\n                Reallocate(sizeofStringBuffer(1), sizeofStringBuffer(2)),\n                Reallocate(sizeofStringBuffer(2), sizeofStringBuffer(3)),\n            });\n  }\n\n  SECTION(\"Realloc fails\") {\n    StringBuilder str(&resources);\n\n    str.startString();\n    killswitch.on();\n    str.append(\n        \"Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do \"\n        \"eiusmod tempor incididunt ut labore et dolore magna aliqua.\");\n\n    REQUIRE(spyingAllocator.log() ==\n            AllocatorLog{\n                Allocate(sizeofStringBuffer()),\n                ReallocateFail(sizeofStringBuffer(), sizeofStringBuffer(2)),\n                Deallocate(sizeofStringBuffer()),\n            });\n    REQUIRE(str.isValid() == false);\n    REQUIRE(resources.overflowed() == true);\n  }\n\n  SECTION(\"Initial allocation fails\") {\n    StringBuilder str(&resources);\n\n    killswitch.on();\n    str.startString();\n\n    REQUIRE(str.isValid() == false);\n    REQUIRE(resources.overflowed() == true);\n    REQUIRE(spyingAllocator.log() == AllocatorLog{\n                                         AllocateFail(sizeofStringBuffer()),\n                                     });\n  }\n}\n\nstatic VariantData saveString(StringBuilder& builder, const char* s) {\n  VariantData data;\n  builder.startString();\n  builder.append(s);\n  builder.save(&data);\n  return data;\n}\n\nTEST_CASE(\"StringBuilder::save() deduplicates strings\") {\n  SpyingAllocator spy;\n  ResourceManager resources(&spy);\n  StringBuilder builder(&resources);\n\n  SECTION(\"Basic\") {\n    auto s1 = saveString(builder, \"hello\");\n    auto s2 = saveString(builder, \"world\");\n    auto s3 = saveString(builder, \"hello\");\n\n    REQUIRE(s1.asString() == \"hello\");\n    REQUIRE(s2.asString() == \"world\");\n    REQUIRE(+s1.asString().c_str() == +s3.asString().c_str());  // same address\n\n    REQUIRE(spy.log() ==\n            AllocatorLog{\n                Allocate(sizeofStringBuffer()),\n                Reallocate(sizeofStringBuffer(), sizeofString(\"hello\")),\n                Allocate(sizeofStringBuffer()),\n                Reallocate(sizeofStringBuffer(), sizeofString(\"world\")),\n                Allocate(sizeofStringBuffer()),\n            });\n  }\n\n  SECTION(\"Requires terminator\") {\n    auto s1 = saveString(builder, \"hello world\");\n    auto s2 = saveString(builder, \"hello\");\n\n    REQUIRE(s1.asString() == \"hello world\");\n    REQUIRE(s2.asString() == \"hello\");\n    REQUIRE(+s2.asString().c_str() !=\n            +s1.asString().c_str());  // different address\n\n    REQUIRE(spy.log() ==\n            AllocatorLog{\n                Allocate(sizeofStringBuffer()),\n                Reallocate(sizeofStringBuffer(), sizeofString(\"hello world\")),\n                Allocate(sizeofStringBuffer()),\n                Reallocate(sizeofStringBuffer(), sizeofString(\"hello\")),\n            });\n  }\n\n  SECTION(\"Don't overrun\") {\n    auto s1 = saveString(builder, \"hello world\");\n    auto s2 = saveString(builder, \"worl\");\n\n    REQUIRE(s1.asString() == \"hello world\");\n    REQUIRE(s2.asString() == \"worl\");\n    REQUIRE(s2.asString().c_str() !=\n            s1.asString().c_str());  // different address\n\n    REQUIRE(spy.log() ==\n            AllocatorLog{\n                Allocate(sizeofStringBuffer()),\n                Reallocate(sizeofStringBuffer(), sizeofString(\"hello world\")),\n                Allocate(sizeofStringBuffer()),\n                Reallocate(sizeofStringBuffer(), sizeofString(\"worl\")),\n            });\n  }\n}\n"
  },
  {
    "path": "extras/tests/ResourceManager/allocVariant.cpp",
    "content": "// ArduinoJson - https://arduinojson.org\n// Copyright © 2014-2025, Benoit BLANCHON\n// MIT License\n\n#include <ArduinoJson.hpp>\n#include <catch.hpp>\n\n#include <ArduinoJson/Memory/Alignment.hpp>\n\n#include \"Allocators.hpp\"\n\nusing namespace ArduinoJson::detail;\n\nTEST_CASE(\"ResourceManager::allocVariant()\") {\n  SECTION(\"Returns different pointer\") {\n    ResourceManager resources;\n\n    auto s1 = resources.allocVariant();\n    REQUIRE(s1.ptr() != nullptr);\n    auto s2 = resources.allocVariant();\n    REQUIRE(s2.ptr() != nullptr);\n\n    REQUIRE(s1.ptr() != s2.ptr());\n  }\n\n  SECTION(\"Returns the same slot after calling freeVariant()\") {\n    ResourceManager resources;\n\n    auto s1 = resources.allocVariant();\n    auto s2 = resources.allocVariant();\n    resources.freeVariant(s1);\n    resources.freeVariant(s2);\n    auto s3 = resources.allocVariant();\n    auto s4 = resources.allocVariant();\n    auto s5 = resources.allocVariant();\n\n    REQUIRE(s2.id() != s1.id());\n    REQUIRE(s3.id() == s2.id());\n    REQUIRE(s4.id() == s1.id());\n    REQUIRE(s5.id() != s1.id());\n    REQUIRE(s5.id() != s2.id());\n  }\n\n  SECTION(\"Returns aligned pointers\") {\n    ResourceManager resources;\n\n    REQUIRE(isAligned(resources.allocVariant().ptr()));\n    REQUIRE(isAligned(resources.allocVariant().ptr()));\n  }\n\n  SECTION(\"Returns null if pool list allocation fails\") {\n    ResourceManager resources(FailingAllocator::instance());\n\n    auto variant = resources.allocVariant();\n    REQUIRE(variant.id() == NULL_SLOT);\n    REQUIRE(variant.ptr() == nullptr);\n  }\n\n  SECTION(\"Returns null if pool allocation fails\") {\n    ResourceManager resources(FailingAllocator::instance());\n\n    resources.allocVariant();\n\n    auto variant = resources.allocVariant();\n    REQUIRE(variant.id() == NULL_SLOT);\n    REQUIRE(variant.ptr() == nullptr);\n  }\n\n  SECTION(\"Try overflow pool counter\") {\n    ResourceManager resources;\n\n    // this test assumes SlotId is 8-bit; otherwise it consumes a lot of memory\n    // tyhe GitHub Workflow gets killed\n    REQUIRE(NULL_SLOT == 255);\n\n    // fill all the pools\n    for (SlotId i = 0; i < NULL_SLOT; i++) {\n      auto slot = resources.allocVariant();\n      REQUIRE(slot.id() == i);  // or != NULL_SLOT\n      REQUIRE(slot.ptr() != nullptr);\n    }\n\n    REQUIRE(resources.overflowed() == false);\n\n    // now all allocations should fail\n    for (int i = 0; i < 10; i++) {\n      auto slot = resources.allocVariant();\n      REQUIRE(slot.id() == NULL_SLOT);\n      REQUIRE(slot.ptr() == nullptr);\n    }\n\n    REQUIRE(resources.overflowed() == true);\n  }\n}\n"
  },
  {
    "path": "extras/tests/ResourceManager/clear.cpp",
    "content": "// ArduinoJson - https://arduinojson.org\n// Copyright © 2014-2025, Benoit BLANCHON\n// MIT License\n\n#include <ArduinoJson/Memory/ResourceManager.hpp>\n#include <ArduinoJson/Strings/StringAdapters.hpp>\n\n#include <catch.hpp>\n\nusing namespace ArduinoJson::detail;\n\nTEST_CASE(\"ResourceManager::clear()\") {\n  ResourceManager resources;\n\n  SECTION(\"Discards allocated variants\") {\n    resources.allocVariant();\n\n    resources.clear();\n    REQUIRE(resources.size() == 0);\n  }\n\n  SECTION(\"Discards allocated strings\") {\n    resources.saveString(adaptString(\"123456789\"));\n    REQUIRE(resources.size() == sizeofString(9));\n\n    resources.clear();\n\n    REQUIRE(resources.size() == 0);\n  }\n}\n"
  },
  {
    "path": "extras/tests/ResourceManager/saveString.cpp",
    "content": "// ArduinoJson - https://arduinojson.org\n// Copyright © 2014-2025, Benoit BLANCHON\n// MIT License\n\n#include <ArduinoJson/Memory/ResourceManager.hpp>\n#include <ArduinoJson/Strings/StringAdapters.hpp>\n#include <catch.hpp>\n\n#include \"Allocators.hpp\"\n\nusing namespace ArduinoJson::detail;\n\nstatic StringNode* saveString(ResourceManager& resources, const char* s) {\n  return resources.saveString(adaptString(s));\n}\n\nstatic StringNode* saveString(ResourceManager& resources, const char* s,\n                              size_t n) {\n  return resources.saveString(adaptString(s, n));\n}\n\nTEST_CASE(\"ResourceManager::saveString()\") {\n  ResourceManager resources;\n\n  SECTION(\"Duplicates different strings\") {\n    auto a = saveString(resources, \"hello\");\n    auto b = saveString(resources, \"world\");\n    REQUIRE(+a->data != +b->data);\n    REQUIRE(a->length == 5);\n    REQUIRE(b->length == 5);\n    REQUIRE(a->references == 1);\n    REQUIRE(b->references == 1);\n    REQUIRE(resources.size() == sizeofString(\"hello\") + sizeofString(\"world\"));\n  }\n\n  SECTION(\"Deduplicates identical strings\") {\n    auto a = saveString(resources, \"hello\");\n    auto b = saveString(resources, \"hello\");\n    REQUIRE(a == b);\n    REQUIRE(a->length == 5);\n    REQUIRE(a->references == 2);\n    REQUIRE(resources.size() == sizeofString(\"hello\"));\n  }\n\n  SECTION(\"Deduplicates identical strings that contain NUL\") {\n    auto a = saveString(resources, \"hello\\0world\", 11);\n    auto b = saveString(resources, \"hello\\0world\", 11);\n    REQUIRE(a == b);\n    REQUIRE(a->length == 11);\n    REQUIRE(a->references == 2);\n    REQUIRE(resources.size() == sizeofString(\"hello world\"));\n  }\n\n  SECTION(\"Don't stop on first NUL\") {\n    auto a = saveString(resources, \"hello\");\n    auto b = saveString(resources, \"hello\\0world\", 11);\n    REQUIRE(a != b);\n    REQUIRE(a->length == 5);\n    REQUIRE(b->length == 11);\n    REQUIRE(a->references == 1);\n    REQUIRE(b->references == 1);\n    REQUIRE(resources.size() ==\n            sizeofString(\"hello\") + sizeofString(\"hello world\"));\n  }\n\n  SECTION(\"Returns NULL when allocation fails\") {\n    ResourceManager pool2(FailingAllocator::instance());\n    REQUIRE(saveString(pool2, \"a\") == nullptr);\n  }\n}\n"
  },
  {
    "path": "extras/tests/ResourceManager/shrinkToFit.cpp",
    "content": "// ArduinoJson - https://arduinojson.org\n// Copyright © 2014-2025, Benoit BLANCHON\n// MIT License\n\n#include <ArduinoJson/Memory/ResourceManager.hpp>\n\n#include <catch.hpp>\n\n#include \"Allocators.hpp\"\n\nusing namespace ArduinoJson::detail;\n\nTEST_CASE(\"ResourceManager::shrinkToFit()\") {\n  SpyingAllocator spyingAllocator;\n  ResourceManager resources(&spyingAllocator);\n\n  SECTION(\"empty\") {\n    resources.shrinkToFit();\n\n    REQUIRE(spyingAllocator.log() == AllocatorLog{});\n  }\n\n  SECTION(\"only one pool\") {\n    resources.allocVariant();\n\n    resources.shrinkToFit();\n\n    REQUIRE(spyingAllocator.log() ==\n            AllocatorLog{\n                Allocate(sizeofPool()),\n                Reallocate(sizeofPool(), sizeofPool(1)),\n            });\n  }\n\n  SECTION(\"more pools than initial count\") {\n    for (size_t i = 0;\n         i < ARDUINOJSON_POOL_CAPACITY * ARDUINOJSON_INITIAL_POOL_COUNT + 1;\n         i++)\n      resources.allocVariant();\n    REQUIRE(spyingAllocator.log() ==\n            AllocatorLog{\n                Allocate(sizeofPool()) * ARDUINOJSON_INITIAL_POOL_COUNT,\n                Allocate(sizeofPoolList(ARDUINOJSON_INITIAL_POOL_COUNT * 2)),\n                Allocate(sizeofPool()),\n            });\n\n    spyingAllocator.clearLog();\n    resources.shrinkToFit();\n\n    REQUIRE(spyingAllocator.log() ==\n            AllocatorLog{\n                Reallocate(sizeofPool(), sizeofPool(1)),\n                Reallocate(sizeofPoolList(ARDUINOJSON_INITIAL_POOL_COUNT * 2),\n                           sizeofPoolList(ARDUINOJSON_INITIAL_POOL_COUNT + 1)),\n            });\n  }\n}\n"
  },
  {
    "path": "extras/tests/ResourceManager/size.cpp",
    "content": "// ArduinoJson - https://arduinojson.org\n// Copyright © 2014-2025, Benoit BLANCHON\n// MIT License\n\n#include <ArduinoJson/Memory/ResourceManager.hpp>\n\n#include <catch.hpp>\n\n#include \"Allocators.hpp\"\n\nusing namespace ArduinoJson::detail;\n\nTEST_CASE(\"ResourceManager::size()\") {\n  TimebombAllocator timebomb(0);\n  ResourceManager resources(&timebomb);\n\n  SECTION(\"Initial size is 0\") {\n    REQUIRE(0 == resources.size());\n  }\n\n  SECTION(\"Doesn't grow when allocation of second pool fails\") {\n    timebomb.setCountdown(1);\n    for (size_t i = 0; i < ARDUINOJSON_POOL_CAPACITY; i++)\n      resources.allocVariant();\n    size_t size = resources.size();\n\n    resources.allocVariant();\n\n    REQUIRE(size == resources.size());\n  }\n}\n"
  },
  {
    "path": "extras/tests/ResourceManager/swap.cpp",
    "content": "// ArduinoJson - https://arduinojson.org\n// Copyright © 2014-2025, Benoit BLANCHON\n// MIT License\n\n#include <ArduinoJson/Memory/Alignment.hpp>\n#include <ArduinoJson/Memory/ResourceManager.hpp>\n\n#include <catch.hpp>\n\n#include \"Allocators.hpp\"\n\nusing namespace ArduinoJson::detail;\n\nstatic void fullPreallocatedPools(ResourceManager& resources) {\n  for (int i = 0;\n       i < ARDUINOJSON_INITIAL_POOL_COUNT * ARDUINOJSON_POOL_CAPACITY; i++)\n    resources.allocVariant();\n}\n\nTEST_CASE(\"ResourceManager::swap()\") {\n  SECTION(\"Both using preallocated pool list\") {\n    SpyingAllocator spy;\n    ResourceManager a(&spy);\n    ResourceManager b(&spy);\n\n    auto a1 = a.allocVariant();\n    auto b1 = b.allocVariant();\n\n    swap(a, b);\n\n    REQUIRE(a1.ptr() == b.getVariant(a1.id()));\n    REQUIRE(b1.ptr() == a.getVariant(b1.id()));\n\n    REQUIRE(spy.log() == AllocatorLog{\n                             Allocate(sizeofPool()) * 2,\n                         });\n  }\n\n  SECTION(\"Only left using preallocated pool list\") {\n    SpyingAllocator spy;\n    ResourceManager a(&spy);\n    ResourceManager b(&spy);\n    fullPreallocatedPools(b);\n\n    auto a1 = a.allocVariant();\n    auto b1 = b.allocVariant();\n    swap(a, b);\n\n    REQUIRE(a1.ptr() == b.getVariant(a1.id()));\n    REQUIRE(b1.ptr() == a.getVariant(b1.id()));\n\n    REQUIRE(spy.log() ==\n            AllocatorLog{\n                Allocate(sizeofPool()) * (ARDUINOJSON_INITIAL_POOL_COUNT + 1),\n                Allocate(sizeofPoolList(ARDUINOJSON_INITIAL_POOL_COUNT * 2)),\n                Allocate(sizeofPool()),\n            });\n  }\n\n  SECTION(\"Only right using preallocated pool list\") {\n    SpyingAllocator spy;\n    ResourceManager a(&spy);\n    fullPreallocatedPools(a);\n    ResourceManager b(&spy);\n\n    auto a1 = a.allocVariant();\n    auto b1 = b.allocVariant();\n    swap(a, b);\n\n    REQUIRE(a1.ptr() == b.getVariant(a1.id()));\n    REQUIRE(b1.ptr() == a.getVariant(b1.id()));\n\n    REQUIRE(spy.log() ==\n            AllocatorLog{\n                Allocate(sizeofPool()) * ARDUINOJSON_INITIAL_POOL_COUNT,\n                Allocate(sizeofPoolList(ARDUINOJSON_INITIAL_POOL_COUNT * 2)),\n                Allocate(sizeofPool()) * 2,\n            });\n  }\n\n  SECTION(\"None is using preallocated pool list\") {\n    SpyingAllocator spy;\n    ResourceManager a(&spy);\n    fullPreallocatedPools(a);\n    ResourceManager b(&spy);\n    fullPreallocatedPools(b);\n\n    auto a1 = a.allocVariant();\n    auto b1 = b.allocVariant();\n\n    swap(a, b);\n\n    REQUIRE(a1.ptr() == b.getVariant(a1.id()));\n    REQUIRE(b1.ptr() == a.getVariant(b1.id()));\n  }\n}\n"
  },
  {
    "path": "extras/tests/TextFormatter/CMakeLists.txt",
    "content": "# ArduinoJson - https://arduinojson.org\n# Copyright © 2014-2025, Benoit BLANCHON\n# MIT License\n\nadd_executable(TextFormatterTests\n\twriteFloat.cpp\n\twriteInteger.cpp\n\twriteString.cpp\n)\n\nset_target_properties(TextFormatterTests PROPERTIES UNITY_BUILD OFF)\n\nadd_test(TextFormatter TextFormatterTests)\n\nset_tests_properties(TextFormatter\n\tPROPERTIES\n\t\tLABELS \"Catch\"\n)\n"
  },
  {
    "path": "extras/tests/TextFormatter/writeFloat.cpp",
    "content": "// ArduinoJson - https://arduinojson.org\n// Copyright © 2014-2025, Benoit BLANCHON\n// MIT License\n\n#include <catch.hpp>\n#include <limits>\n#include <string>\n\n#define ARDUINOJSON_ENABLE_NAN 1\n#define ARDUINOJSON_ENABLE_INFINITY 1\n#include <ArduinoJson/Json/TextFormatter.hpp>\n#include <ArduinoJson/Serialization/Writer.hpp>\n\nusing namespace ArduinoJson::detail;\n\ntemplate <typename TFloat>\nvoid check(TFloat input, const std::string& expected) {\n  std::string output;\n  Writer<std::string> sb(output);\n  TextFormatter<Writer<std::string>> writer(sb);\n  writer.writeFloat(input);\n  REQUIRE(writer.bytesWritten() == output.size());\n  CHECK(expected == output);\n}\n\nTEST_CASE(\"TextFormatter::writeFloat(double)\") {\n  SECTION(\"Pi\") {\n    check<double>(3.14159265359, \"3.141592654\");\n  }\n\n  SECTION(\"Signaling NaN\") {\n    double nan = std::numeric_limits<double>::signaling_NaN();\n    check<double>(nan, \"NaN\");\n  }\n\n  SECTION(\"Quiet NaN\") {\n    double nan = std::numeric_limits<double>::quiet_NaN();\n    check<double>(nan, \"NaN\");\n  }\n\n  SECTION(\"Infinity\") {\n    double inf = std::numeric_limits<double>::infinity();\n    check<double>(inf, \"Infinity\");\n    check<double>(-inf, \"-Infinity\");\n  }\n\n  SECTION(\"Zero\") {\n    check<double>(0.0, \"0\");\n    check<double>(-0.0, \"0\");\n  }\n\n  SECTION(\"Espilon\") {\n    check<double>(2.2250738585072014E-308, \"2.225073859e-308\");\n    check<double>(-2.2250738585072014E-308, \"-2.225073859e-308\");\n  }\n\n  SECTION(\"Max double\") {\n    check<double>(1.7976931348623157E+308, \"1.797693135e308\");\n    check<double>(-1.7976931348623157E+308, \"-1.797693135e308\");\n  }\n\n  SECTION(\"Big exponent\") {\n    // this test increases coverage of normalize()\n    check<double>(1e255, \"1e255\");\n    check<double>(1e-255, \"1e-255\");\n  }\n\n  SECTION(\"Exponentation when <= 1e-5\") {\n    check<double>(1e-4, \"0.0001\");\n    check<double>(1e-5, \"1e-5\");\n\n    check<double>(-1e-4, \"-0.0001\");\n    check<double>(-1e-5, \"-1e-5\");\n  }\n\n  SECTION(\"Exponentation when >= 1e7\") {\n    check<double>(9999999.999, \"9999999.999\");\n    check<double>(10000000.0, \"1e7\");\n\n    check<double>(-9999999.999, \"-9999999.999\");\n    check<double>(-10000000.0, \"-1e7\");\n  }\n\n  SECTION(\"Rounding when too many decimals\") {\n    check<double>(0.000099999999999, \"0.0001\");\n    check<double>(0.0000099999999999, \"1e-5\");\n    check<double>(0.9999999996, \"1\");\n  }\n\n  SECTION(\"9 decimal places\") {\n    check<double>(0.100000001, \"0.100000001\");\n    check<double>(0.999999999, \"0.999999999\");\n\n    check<double>(9.000000001, \"9.000000001\");\n    check<double>(9.999999999, \"9.999999999\");\n  }\n\n  SECTION(\"10 decimal places\") {\n    check<double>(0.1000000001, \"0.1\");\n    check<double>(0.9999999999, \"1\");\n\n    check<double>(9.0000000001, \"9\");\n    check<double>(9.9999999999, \"10\");\n  }\n}\n\nTEST_CASE(\"TextFormatter::writeFloat(float)\") {\n  SECTION(\"Pi\") {\n    check<float>(3.14159265359f, \"3.141593\");\n  }\n\n  SECTION(\"999.9\") {  // issue #543\n    check<float>(999.9f, \"999.9\");\n  }\n\n  SECTION(\"24.3\") {  // # issue #588\n    check<float>(24.3f, \"24.3\");\n  }\n}\n"
  },
  {
    "path": "extras/tests/TextFormatter/writeInteger.cpp",
    "content": "// ArduinoJson - https://arduinojson.org\n// Copyright © 2014-2025, Benoit BLANCHON\n// MIT License\n\n#include <catch.hpp>\n#include <limits>\n#include <string>\n\n#include <ArduinoJson/Json/TextFormatter.hpp>\n#include <ArduinoJson/Serialization/Writer.hpp>\n\nusing namespace ArduinoJson::detail;\n\ntemplate <typename T>\nvoid checkWriteInteger(T value, std::string expected) {\n  char output[64] = {0};\n  StaticStringWriter sb(output, sizeof(output));\n  TextFormatter<StaticStringWriter> writer(sb);\n  writer.writeInteger<T>(value);\n  REQUIRE(expected == output);\n  REQUIRE(writer.bytesWritten() == expected.size());\n}\n\nTEST_CASE(\"int8_t\") {\n  checkWriteInteger<int8_t>(0, \"0\");\n  checkWriteInteger<int8_t>(-128, \"-128\");\n  checkWriteInteger<int8_t>(127, \"127\");\n}\n\nTEST_CASE(\"uint8_t\") {\n  checkWriteInteger<uint8_t>(0, \"0\");\n  checkWriteInteger<uint8_t>(255, \"255\");\n}\n\nTEST_CASE(\"int16_t\") {\n  checkWriteInteger<int16_t>(0, \"0\");\n  checkWriteInteger<int16_t>(-32768, \"-32768\");\n  checkWriteInteger<int16_t>(32767, \"32767\");\n}\n\nTEST_CASE(\"uint16_t\") {\n  checkWriteInteger<uint16_t>(0, \"0\");\n  checkWriteInteger<uint16_t>(65535, \"65535\");\n}\n\nTEST_CASE(\"int32_t\") {\n  checkWriteInteger<int32_t>(0, \"0\");\n  checkWriteInteger<int32_t>(-2147483647 - 1, \"-2147483648\");\n  checkWriteInteger<int32_t>(2147483647, \"2147483647\");\n}\n\nTEST_CASE(\"uint32_t\") {\n  checkWriteInteger<uint32_t>(0, \"0\");\n  checkWriteInteger<uint32_t>(4294967295U, \"4294967295\");\n}\n"
  },
  {
    "path": "extras/tests/TextFormatter/writeString.cpp",
    "content": "// ArduinoJson - https://arduinojson.org\n// Copyright © 2014-2025, Benoit BLANCHON\n// MIT License\n\n#include <catch.hpp>\n\n#include <ArduinoJson/Json/TextFormatter.hpp>\n#include <ArduinoJson/Serialization/Writers/StaticStringWriter.hpp>\n\nusing namespace ArduinoJson::detail;\n\nvoid check(const char* input, std::string expected) {\n  char output[64] = {0};\n  StaticStringWriter sb(output, sizeof(output));\n  TextFormatter<StaticStringWriter> writer(sb);\n  writer.writeString(input);\n  REQUIRE(expected == output);\n  REQUIRE(writer.bytesWritten() == expected.size());\n}\n\nTEST_CASE(\"TextFormatter::writeString()\") {\n  SECTION(\"EmptyString\") {\n    check(\"\", \"\\\"\\\"\");\n  }\n\n  SECTION(\"QuotationMark\") {\n    check(\"\\\"\", \"\\\"\\\\\\\"\\\"\");\n  }\n\n  SECTION(\"ReverseSolidus\") {\n    check(\"\\\\\", \"\\\"\\\\\\\\\\\"\");\n  }\n\n  SECTION(\"Solidus\") {\n    check(\"/\", \"\\\"/\\\"\");  // but the JSON format allows \\/\n  }\n\n  SECTION(\"Backspace\") {\n    check(\"\\b\", \"\\\"\\\\b\\\"\");\n  }\n\n  SECTION(\"Formfeed\") {\n    check(\"\\f\", \"\\\"\\\\f\\\"\");\n  }\n\n  SECTION(\"Newline\") {\n    check(\"\\n\", \"\\\"\\\\n\\\"\");\n  }\n\n  SECTION(\"CarriageReturn\") {\n    check(\"\\r\", \"\\\"\\\\r\\\"\");\n  }\n\n  SECTION(\"HorizontalTab\") {\n    check(\"\\t\", \"\\\"\\\\t\\\"\");\n  }\n}\n"
  },
  {
    "path": "extras/tests/catch/.clang-format",
    "content": "DisableFormat: true\nSortIncludes: false\n"
  },
  {
    "path": "extras/tests/catch/CMakeLists.txt",
    "content": "# ArduinoJson - https://arduinojson.org\n# Copyright Benoit Blanchon 2014-2021\n# MIT License\n\nset(CMAKE_CXX_STANDARD 17)\nset(CMAKE_CXX_STANDARD_REQUIRED OFF)\n\nadd_library(catch\n\tcatch.hpp\n\tcatch.cpp\n)\n\ntarget_include_directories(catch\n\tPUBLIC\n\t\t${CMAKE_CURRENT_SOURCE_DIR}\n)\n\nif(MINGW)\n\t# prevent \"too many sections (32837)\" with MinGW\n\ttarget_compile_options(catch PRIVATE -Wa,-mbig-obj)\nendif()\n"
  },
  {
    "path": "extras/tests/catch/catch.cpp",
    "content": "// ArduinoJson - https://arduinojson.org\n// Copyright Benoit Blanchon 2014-2021\n// MIT License\n\n#define CATCH_CONFIG_MAIN\n#include \"catch.hpp\"\n"
  },
  {
    "path": "extras/tests/catch/catch.hpp",
    "content": "/*\n *  Catch v2.13.10\n *  Generated: 2022-10-16 11:01:23.452308\n *  ----------------------------------------------------------\n *  This file has been merged from multiple headers. Please don't edit it directly\n *  Copyright (c) 2022 Two Blue Cubes Ltd. All rights reserved.\n *\n *  Distributed under the Boost Software License, Version 1.0. (See accompanying\n *  file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)\n */\n#ifndef TWOBLUECUBES_SINGLE_INCLUDE_CATCH_HPP_INCLUDED\n#define TWOBLUECUBES_SINGLE_INCLUDE_CATCH_HPP_INCLUDED\n// start catch.hpp\n\n\n#define CATCH_VERSION_MAJOR 2\n#define CATCH_VERSION_MINOR 13\n#define CATCH_VERSION_PATCH 10\n\n#ifdef __clang__\n#    pragma clang system_header\n#elif defined __GNUC__\n#    pragma GCC system_header\n#endif\n\n// start catch_suppress_warnings.h\n\n#ifdef __clang__\n#   ifdef __ICC // icpc defines the __clang__ macro\n#       pragma warning(push)\n#       pragma warning(disable: 161 1682)\n#   else // __ICC\n#       pragma clang diagnostic push\n#       pragma clang diagnostic ignored \"-Wpadded\"\n#       pragma clang diagnostic ignored \"-Wswitch-enum\"\n#       pragma clang diagnostic ignored \"-Wcovered-switch-default\"\n#    endif\n#elif defined __GNUC__\n     // Because REQUIREs trigger GCC's -Wparentheses, and because still\n     // supported version of g++ have only buggy support for _Pragmas,\n     // Wparentheses have to be suppressed globally.\n#    pragma GCC diagnostic ignored \"-Wparentheses\" // See #674 for details\n\n#    pragma GCC diagnostic push\n#    pragma GCC diagnostic ignored \"-Wunused-variable\"\n#    pragma GCC diagnostic ignored \"-Wpadded\"\n#endif\n// end catch_suppress_warnings.h\n#if defined(CATCH_CONFIG_MAIN) || defined(CATCH_CONFIG_RUNNER)\n#  define CATCH_IMPL\n#  define CATCH_CONFIG_ALL_PARTS\n#endif\n\n// In the impl file, we want to have access to all parts of the headers\n// Can also be used to sanely support PCHs\n#if defined(CATCH_CONFIG_ALL_PARTS)\n#  define CATCH_CONFIG_EXTERNAL_INTERFACES\n#  if defined(CATCH_CONFIG_DISABLE_MATCHERS)\n#    undef CATCH_CONFIG_DISABLE_MATCHERS\n#  endif\n#  if !defined(CATCH_CONFIG_ENABLE_CHRONO_STRINGMAKER)\n#    define CATCH_CONFIG_ENABLE_CHRONO_STRINGMAKER\n#  endif\n#endif\n\n#if !defined(CATCH_CONFIG_IMPL_ONLY)\n// start catch_platform.h\n\n// See e.g.:\n// https://opensource.apple.com/source/CarbonHeaders/CarbonHeaders-18.1/TargetConditionals.h.auto.html\n#ifdef __APPLE__\n#  include <TargetConditionals.h>\n#  if (defined(TARGET_OS_OSX) && TARGET_OS_OSX == 1) || \\\n      (defined(TARGET_OS_MAC) && TARGET_OS_MAC == 1)\n#    define CATCH_PLATFORM_MAC\n#  elif (defined(TARGET_OS_IPHONE) && TARGET_OS_IPHONE == 1)\n#    define CATCH_PLATFORM_IPHONE\n#  endif\n\n#elif defined(linux) || defined(__linux) || defined(__linux__)\n#  define CATCH_PLATFORM_LINUX\n\n#elif defined(WIN32) || defined(__WIN32__) || defined(_WIN32) || defined(_MSC_VER) || defined(__MINGW32__)\n#  define CATCH_PLATFORM_WINDOWS\n#endif\n\n// end catch_platform.h\n\n#ifdef CATCH_IMPL\n#  ifndef CLARA_CONFIG_MAIN\n#    define CLARA_CONFIG_MAIN_NOT_DEFINED\n#    define CLARA_CONFIG_MAIN\n#  endif\n#endif\n\n// start catch_user_interfaces.h\n\nnamespace Catch {\n    unsigned int rngSeed();\n}\n\n// end catch_user_interfaces.h\n// start catch_tag_alias_autoregistrar.h\n\n// start catch_common.h\n\n// start catch_compiler_capabilities.h\n\n// Detect a number of compiler features - by compiler\n// The following features are defined:\n//\n// CATCH_CONFIG_COUNTER : is the __COUNTER__ macro supported?\n// CATCH_CONFIG_WINDOWS_SEH : is Windows SEH supported?\n// CATCH_CONFIG_POSIX_SIGNALS : are POSIX signals supported?\n// CATCH_CONFIG_DISABLE_EXCEPTIONS : Are exceptions enabled?\n// ****************\n// Note to maintainers: if new toggles are added please document them\n// in configuration.md, too\n// ****************\n\n// In general each macro has a _NO_<feature name> form\n// (e.g. CATCH_CONFIG_NO_POSIX_SIGNALS) which disables the feature.\n// Many features, at point of detection, define an _INTERNAL_ macro, so they\n// can be combined, en-mass, with the _NO_ forms later.\n\n#ifdef __cplusplus\n\n#  if (__cplusplus >= 201402L) || (defined(_MSVC_LANG) && _MSVC_LANG >= 201402L)\n#    define CATCH_CPP14_OR_GREATER\n#  endif\n\n#  if (__cplusplus >= 201703L) || (defined(_MSVC_LANG) && _MSVC_LANG >= 201703L)\n#    define CATCH_CPP17_OR_GREATER\n#  endif\n\n#endif\n\n// Only GCC compiler should be used in this block, so other compilers trying to\n// mask themselves as GCC should be ignored.\n#if defined(__GNUC__) && !defined(__clang__) && !defined(__ICC) && !defined(__CUDACC__) && !defined(__LCC__)\n#    define CATCH_INTERNAL_START_WARNINGS_SUPPRESSION _Pragma( \"GCC diagnostic push\" )\n#    define CATCH_INTERNAL_STOP_WARNINGS_SUPPRESSION  _Pragma( \"GCC diagnostic pop\" )\n\n#    define CATCH_INTERNAL_IGNORE_BUT_WARN(...) (void)__builtin_constant_p(__VA_ARGS__)\n\n#endif\n\n#if defined(__clang__)\n\n#    define CATCH_INTERNAL_START_WARNINGS_SUPPRESSION _Pragma( \"clang diagnostic push\" )\n#    define CATCH_INTERNAL_STOP_WARNINGS_SUPPRESSION  _Pragma( \"clang diagnostic pop\" )\n\n// As of this writing, IBM XL's implementation of __builtin_constant_p has a bug\n// which results in calls to destructors being emitted for each temporary,\n// without a matching initialization. In practice, this can result in something\n// like `std::string::~string` being called on an uninitialized value.\n//\n// For example, this code will likely segfault under IBM XL:\n// ```\n// REQUIRE(std::string(\"12\") + \"34\" == \"1234\")\n// ```\n//\n// Therefore, `CATCH_INTERNAL_IGNORE_BUT_WARN` is not implemented.\n#  if !defined(__ibmxl__) && !defined(__CUDACC__)\n#    define CATCH_INTERNAL_IGNORE_BUT_WARN(...) (void)__builtin_constant_p(__VA_ARGS__) /* NOLINT(cppcoreguidelines-pro-type-vararg, hicpp-vararg) */\n#  endif\n\n#    define CATCH_INTERNAL_SUPPRESS_GLOBALS_WARNINGS \\\n         _Pragma( \"clang diagnostic ignored \\\"-Wexit-time-destructors\\\"\" ) \\\n         _Pragma( \"clang diagnostic ignored \\\"-Wglobal-constructors\\\"\")\n\n#    define CATCH_INTERNAL_SUPPRESS_PARENTHESES_WARNINGS \\\n         _Pragma( \"clang diagnostic ignored \\\"-Wparentheses\\\"\" )\n\n#    define CATCH_INTERNAL_SUPPRESS_UNUSED_WARNINGS \\\n         _Pragma( \"clang diagnostic ignored \\\"-Wunused-variable\\\"\" )\n\n#    define CATCH_INTERNAL_SUPPRESS_ZERO_VARIADIC_WARNINGS \\\n         _Pragma( \"clang diagnostic ignored \\\"-Wgnu-zero-variadic-macro-arguments\\\"\" )\n\n#    define CATCH_INTERNAL_SUPPRESS_UNUSED_TEMPLATE_WARNINGS \\\n         _Pragma( \"clang diagnostic ignored \\\"-Wunused-template\\\"\" )\n\n#endif // __clang__\n\n////////////////////////////////////////////////////////////////////////////////\n// Assume that non-Windows platforms support posix signals by default\n#if !defined(CATCH_PLATFORM_WINDOWS)\n    #define CATCH_INTERNAL_CONFIG_POSIX_SIGNALS\n#endif\n\n////////////////////////////////////////////////////////////////////////////////\n// We know some environments not to support full POSIX signals\n#if defined(__CYGWIN__) || defined(__QNX__) || defined(__EMSCRIPTEN__) || defined(__DJGPP__)\n    #define CATCH_INTERNAL_CONFIG_NO_POSIX_SIGNALS\n#endif\n\n#ifdef __OS400__\n#       define CATCH_INTERNAL_CONFIG_NO_POSIX_SIGNALS\n#       define CATCH_CONFIG_COLOUR_NONE\n#endif\n\n////////////////////////////////////////////////////////////////////////////////\n// Android somehow still does not support std::to_string\n#if defined(__ANDROID__)\n#    define CATCH_INTERNAL_CONFIG_NO_CPP11_TO_STRING\n#    define CATCH_INTERNAL_CONFIG_ANDROID_LOGWRITE\n#endif\n\n////////////////////////////////////////////////////////////////////////////////\n// Not all Windows environments support SEH properly\n#if defined(__MINGW32__)\n#    define CATCH_INTERNAL_CONFIG_NO_WINDOWS_SEH\n#endif\n\n////////////////////////////////////////////////////////////////////////////////\n// PS4\n#if defined(__ORBIS__)\n#    define CATCH_INTERNAL_CONFIG_NO_NEW_CAPTURE\n#endif\n\n////////////////////////////////////////////////////////////////////////////////\n// Cygwin\n#ifdef __CYGWIN__\n\n// Required for some versions of Cygwin to declare gettimeofday\n// see: http://stackoverflow.com/questions/36901803/gettimeofday-not-declared-in-this-scope-cygwin\n#   define _BSD_SOURCE\n// some versions of cygwin (most) do not support std::to_string. Use the libstd check.\n// https://gcc.gnu.org/onlinedocs/gcc-4.8.2/libstdc++/api/a01053_source.html line 2812-2813\n# if !((__cplusplus >= 201103L) && defined(_GLIBCXX_USE_C99) \\\n           && !defined(_GLIBCXX_HAVE_BROKEN_VSWPRINTF))\n\n#    define CATCH_INTERNAL_CONFIG_NO_CPP11_TO_STRING\n\n# endif\n#endif // __CYGWIN__\n\n////////////////////////////////////////////////////////////////////////////////\n// Visual C++\n#if defined(_MSC_VER)\n\n// Universal Windows platform does not support SEH\n// Or console colours (or console at all...)\n#  if defined(WINAPI_FAMILY) && (WINAPI_FAMILY == WINAPI_FAMILY_APP)\n#    define CATCH_CONFIG_COLOUR_NONE\n#  else\n#    define CATCH_INTERNAL_CONFIG_WINDOWS_SEH\n#  endif\n\n#  if !defined(__clang__) // Handle Clang masquerading for msvc\n\n// MSVC traditional preprocessor needs some workaround for __VA_ARGS__\n// _MSVC_TRADITIONAL == 0 means new conformant preprocessor\n// _MSVC_TRADITIONAL == 1 means old traditional non-conformant preprocessor\n#    if !defined(_MSVC_TRADITIONAL) || (defined(_MSVC_TRADITIONAL) && _MSVC_TRADITIONAL)\n#      define CATCH_INTERNAL_CONFIG_TRADITIONAL_MSVC_PREPROCESSOR\n#    endif // MSVC_TRADITIONAL\n\n// Only do this if we're not using clang on Windows, which uses `diagnostic push` & `diagnostic pop`\n#    define CATCH_INTERNAL_START_WARNINGS_SUPPRESSION __pragma( warning(push) )\n#    define CATCH_INTERNAL_STOP_WARNINGS_SUPPRESSION  __pragma( warning(pop) )\n#  endif // __clang__\n\n#endif // _MSC_VER\n\n#if defined(_REENTRANT) || defined(_MSC_VER)\n// Enable async processing, as -pthread is specified or no additional linking is required\n# define CATCH_INTERNAL_CONFIG_USE_ASYNC\n#endif // _MSC_VER\n\n////////////////////////////////////////////////////////////////////////////////\n// Check if we are compiled with -fno-exceptions or equivalent\n#if defined(__EXCEPTIONS) || defined(__cpp_exceptions) || defined(_CPPUNWIND)\n#  define CATCH_INTERNAL_CONFIG_EXCEPTIONS_ENABLED\n#endif\n\n////////////////////////////////////////////////////////////////////////////////\n// DJGPP\n#ifdef __DJGPP__\n#  define CATCH_INTERNAL_CONFIG_NO_WCHAR\n#endif // __DJGPP__\n\n////////////////////////////////////////////////////////////////////////////////\n// Embarcadero C++Build\n#if defined(__BORLANDC__)\n    #define CATCH_INTERNAL_CONFIG_POLYFILL_ISNAN\n#endif\n\n////////////////////////////////////////////////////////////////////////////////\n\n// Use of __COUNTER__ is suppressed during code analysis in\n// CLion/AppCode 2017.2.x and former, because __COUNTER__ is not properly\n// handled by it.\n// Otherwise all supported compilers support COUNTER macro,\n// but user still might want to turn it off\n#if ( !defined(__JETBRAINS_IDE__) || __JETBRAINS_IDE__ >= 20170300L )\n    #define CATCH_INTERNAL_CONFIG_COUNTER\n#endif\n\n////////////////////////////////////////////////////////////////////////////////\n\n// RTX is a special version of Windows that is real time.\n// This means that it is detected as Windows, but does not provide\n// the same set of capabilities as real Windows does.\n#if defined(UNDER_RTSS) || defined(RTX64_BUILD)\n    #define CATCH_INTERNAL_CONFIG_NO_WINDOWS_SEH\n    #define CATCH_INTERNAL_CONFIG_NO_ASYNC\n    #define CATCH_CONFIG_COLOUR_NONE\n#endif\n\n#if !defined(_GLIBCXX_USE_C99_MATH_TR1)\n#define CATCH_INTERNAL_CONFIG_GLOBAL_NEXTAFTER\n#endif\n\n// Various stdlib support checks that require __has_include\n#if defined(__has_include)\n  // Check if string_view is available and usable\n  #if __has_include(<string_view>) && defined(CATCH_CPP17_OR_GREATER)\n  #    define CATCH_INTERNAL_CONFIG_CPP17_STRING_VIEW\n  #endif\n\n  // Check if optional is available and usable\n  #  if __has_include(<optional>) && defined(CATCH_CPP17_OR_GREATER)\n  #    define CATCH_INTERNAL_CONFIG_CPP17_OPTIONAL\n  #  endif // __has_include(<optional>) && defined(CATCH_CPP17_OR_GREATER)\n\n  // Check if byte is available and usable\n  #  if __has_include(<cstddef>) && defined(CATCH_CPP17_OR_GREATER)\n  #    include <cstddef>\n  #    if defined(__cpp_lib_byte) && (__cpp_lib_byte > 0)\n  #      define CATCH_INTERNAL_CONFIG_CPP17_BYTE\n  #    endif\n  #  endif // __has_include(<cstddef>) && defined(CATCH_CPP17_OR_GREATER)\n\n  // Check if variant is available and usable\n  #  if __has_include(<variant>) && defined(CATCH_CPP17_OR_GREATER)\n  #    if defined(__clang__) && (__clang_major__ < 8)\n         // work around clang bug with libstdc++ https://bugs.llvm.org/show_bug.cgi?id=31852\n         // fix should be in clang 8, workaround in libstdc++ 8.2\n  #      include <ciso646>\n  #      if defined(__GLIBCXX__) && defined(_GLIBCXX_RELEASE) && (_GLIBCXX_RELEASE < 9)\n  #        define CATCH_CONFIG_NO_CPP17_VARIANT\n  #      else\n  #        define CATCH_INTERNAL_CONFIG_CPP17_VARIANT\n  #      endif // defined(__GLIBCXX__) && defined(_GLIBCXX_RELEASE) && (_GLIBCXX_RELEASE < 9)\n  #    else\n  #      define CATCH_INTERNAL_CONFIG_CPP17_VARIANT\n  #    endif // defined(__clang__) && (__clang_major__ < 8)\n  #  endif // __has_include(<variant>) && defined(CATCH_CPP17_OR_GREATER)\n#endif // defined(__has_include)\n\n#if defined(CATCH_INTERNAL_CONFIG_COUNTER) && !defined(CATCH_CONFIG_NO_COUNTER) && !defined(CATCH_CONFIG_COUNTER)\n#   define CATCH_CONFIG_COUNTER\n#endif\n#if defined(CATCH_INTERNAL_CONFIG_WINDOWS_SEH) && !defined(CATCH_CONFIG_NO_WINDOWS_SEH) && !defined(CATCH_CONFIG_WINDOWS_SEH) && !defined(CATCH_INTERNAL_CONFIG_NO_WINDOWS_SEH)\n#   define CATCH_CONFIG_WINDOWS_SEH\n#endif\n// This is set by default, because we assume that unix compilers are posix-signal-compatible by default.\n#if defined(CATCH_INTERNAL_CONFIG_POSIX_SIGNALS) && !defined(CATCH_INTERNAL_CONFIG_NO_POSIX_SIGNALS) && !defined(CATCH_CONFIG_NO_POSIX_SIGNALS) && !defined(CATCH_CONFIG_POSIX_SIGNALS)\n#   define CATCH_CONFIG_POSIX_SIGNALS\n#endif\n// This is set by default, because we assume that compilers with no wchar_t support are just rare exceptions.\n#if !defined(CATCH_INTERNAL_CONFIG_NO_WCHAR) && !defined(CATCH_CONFIG_NO_WCHAR) && !defined(CATCH_CONFIG_WCHAR)\n#   define CATCH_CONFIG_WCHAR\n#endif\n\n#if !defined(CATCH_INTERNAL_CONFIG_NO_CPP11_TO_STRING) && !defined(CATCH_CONFIG_NO_CPP11_TO_STRING) && !defined(CATCH_CONFIG_CPP11_TO_STRING)\n#    define CATCH_CONFIG_CPP11_TO_STRING\n#endif\n\n#if defined(CATCH_INTERNAL_CONFIG_CPP17_OPTIONAL) && !defined(CATCH_CONFIG_NO_CPP17_OPTIONAL) && !defined(CATCH_CONFIG_CPP17_OPTIONAL)\n#  define CATCH_CONFIG_CPP17_OPTIONAL\n#endif\n\n#if defined(CATCH_INTERNAL_CONFIG_CPP17_STRING_VIEW) && !defined(CATCH_CONFIG_NO_CPP17_STRING_VIEW) && !defined(CATCH_CONFIG_CPP17_STRING_VIEW)\n#  define CATCH_CONFIG_CPP17_STRING_VIEW\n#endif\n\n#if defined(CATCH_INTERNAL_CONFIG_CPP17_VARIANT) && !defined(CATCH_CONFIG_NO_CPP17_VARIANT) && !defined(CATCH_CONFIG_CPP17_VARIANT)\n#  define CATCH_CONFIG_CPP17_VARIANT\n#endif\n\n#if defined(CATCH_INTERNAL_CONFIG_CPP17_BYTE) && !defined(CATCH_CONFIG_NO_CPP17_BYTE) && !defined(CATCH_CONFIG_CPP17_BYTE)\n#  define CATCH_CONFIG_CPP17_BYTE\n#endif\n\n#if defined(CATCH_CONFIG_EXPERIMENTAL_REDIRECT)\n#  define CATCH_INTERNAL_CONFIG_NEW_CAPTURE\n#endif\n\n#if defined(CATCH_INTERNAL_CONFIG_NEW_CAPTURE) && !defined(CATCH_INTERNAL_CONFIG_NO_NEW_CAPTURE) && !defined(CATCH_CONFIG_NO_NEW_CAPTURE) && !defined(CATCH_CONFIG_NEW_CAPTURE)\n#  define CATCH_CONFIG_NEW_CAPTURE\n#endif\n\n#if !defined(CATCH_INTERNAL_CONFIG_EXCEPTIONS_ENABLED) && !defined(CATCH_CONFIG_DISABLE_EXCEPTIONS)\n#  define CATCH_CONFIG_DISABLE_EXCEPTIONS\n#endif\n\n#if defined(CATCH_INTERNAL_CONFIG_POLYFILL_ISNAN) && !defined(CATCH_CONFIG_NO_POLYFILL_ISNAN) && !defined(CATCH_CONFIG_POLYFILL_ISNAN)\n#  define CATCH_CONFIG_POLYFILL_ISNAN\n#endif\n\n#if defined(CATCH_INTERNAL_CONFIG_USE_ASYNC)  && !defined(CATCH_INTERNAL_CONFIG_NO_ASYNC) && !defined(CATCH_CONFIG_NO_USE_ASYNC) && !defined(CATCH_CONFIG_USE_ASYNC)\n#  define CATCH_CONFIG_USE_ASYNC\n#endif\n\n#if defined(CATCH_INTERNAL_CONFIG_ANDROID_LOGWRITE) && !defined(CATCH_CONFIG_NO_ANDROID_LOGWRITE) && !defined(CATCH_CONFIG_ANDROID_LOGWRITE)\n#  define CATCH_CONFIG_ANDROID_LOGWRITE\n#endif\n\n#if defined(CATCH_INTERNAL_CONFIG_GLOBAL_NEXTAFTER) && !defined(CATCH_CONFIG_NO_GLOBAL_NEXTAFTER) && !defined(CATCH_CONFIG_GLOBAL_NEXTAFTER)\n#  define CATCH_CONFIG_GLOBAL_NEXTAFTER\n#endif\n\n// Even if we do not think the compiler has that warning, we still have\n// to provide a macro that can be used by the code.\n#if !defined(CATCH_INTERNAL_START_WARNINGS_SUPPRESSION)\n#   define CATCH_INTERNAL_START_WARNINGS_SUPPRESSION\n#endif\n#if !defined(CATCH_INTERNAL_STOP_WARNINGS_SUPPRESSION)\n#   define CATCH_INTERNAL_STOP_WARNINGS_SUPPRESSION\n#endif\n#if !defined(CATCH_INTERNAL_SUPPRESS_PARENTHESES_WARNINGS)\n#   define CATCH_INTERNAL_SUPPRESS_PARENTHESES_WARNINGS\n#endif\n#if !defined(CATCH_INTERNAL_SUPPRESS_GLOBALS_WARNINGS)\n#   define CATCH_INTERNAL_SUPPRESS_GLOBALS_WARNINGS\n#endif\n#if !defined(CATCH_INTERNAL_SUPPRESS_UNUSED_WARNINGS)\n#   define CATCH_INTERNAL_SUPPRESS_UNUSED_WARNINGS\n#endif\n#if !defined(CATCH_INTERNAL_SUPPRESS_ZERO_VARIADIC_WARNINGS)\n#   define CATCH_INTERNAL_SUPPRESS_ZERO_VARIADIC_WARNINGS\n#endif\n\n// The goal of this macro is to avoid evaluation of the arguments, but\n// still have the compiler warn on problems inside...\n#if !defined(CATCH_INTERNAL_IGNORE_BUT_WARN)\n#   define CATCH_INTERNAL_IGNORE_BUT_WARN(...)\n#endif\n\n#if defined(__APPLE__) && defined(__apple_build_version__) && (__clang_major__ < 10)\n#   undef CATCH_INTERNAL_SUPPRESS_UNUSED_TEMPLATE_WARNINGS\n#elif defined(__clang__) && (__clang_major__ < 5)\n#   undef CATCH_INTERNAL_SUPPRESS_UNUSED_TEMPLATE_WARNINGS\n#endif\n\n#if !defined(CATCH_INTERNAL_SUPPRESS_UNUSED_TEMPLATE_WARNINGS)\n#   define CATCH_INTERNAL_SUPPRESS_UNUSED_TEMPLATE_WARNINGS\n#endif\n\n#if defined(CATCH_CONFIG_DISABLE_EXCEPTIONS)\n#define CATCH_TRY if ((true))\n#define CATCH_CATCH_ALL if ((false))\n#define CATCH_CATCH_ANON(type) if ((false))\n#else\n#define CATCH_TRY try\n#define CATCH_CATCH_ALL catch (...)\n#define CATCH_CATCH_ANON(type) catch (type)\n#endif\n\n#if defined(CATCH_INTERNAL_CONFIG_TRADITIONAL_MSVC_PREPROCESSOR) && !defined(CATCH_CONFIG_NO_TRADITIONAL_MSVC_PREPROCESSOR) && !defined(CATCH_CONFIG_TRADITIONAL_MSVC_PREPROCESSOR)\n#define CATCH_CONFIG_TRADITIONAL_MSVC_PREPROCESSOR\n#endif\n\n// end catch_compiler_capabilities.h\n#define INTERNAL_CATCH_UNIQUE_NAME_LINE2( name, line ) name##line\n#define INTERNAL_CATCH_UNIQUE_NAME_LINE( name, line ) INTERNAL_CATCH_UNIQUE_NAME_LINE2( name, line )\n#ifdef CATCH_CONFIG_COUNTER\n#  define INTERNAL_CATCH_UNIQUE_NAME( name ) INTERNAL_CATCH_UNIQUE_NAME_LINE( name, __COUNTER__ )\n#else\n#  define INTERNAL_CATCH_UNIQUE_NAME( name ) INTERNAL_CATCH_UNIQUE_NAME_LINE( name, __LINE__ )\n#endif\n\n#include <iosfwd>\n#include <string>\n#include <cstdint>\n\n// We need a dummy global operator<< so we can bring it into Catch namespace later\nstruct Catch_global_namespace_dummy {};\nstd::ostream& operator<<(std::ostream&, Catch_global_namespace_dummy);\n\nnamespace Catch {\n\n    struct CaseSensitive { enum Choice {\n        Yes,\n        No\n    }; };\n\n    class NonCopyable {\n        NonCopyable( NonCopyable const& )              = delete;\n        NonCopyable( NonCopyable && )                  = delete;\n        NonCopyable& operator = ( NonCopyable const& ) = delete;\n        NonCopyable& operator = ( NonCopyable && )     = delete;\n\n    protected:\n        NonCopyable();\n        virtual ~NonCopyable();\n    };\n\n    struct SourceLineInfo {\n\n        SourceLineInfo() = delete;\n        SourceLineInfo( char const* _file, std::size_t _line ) noexcept\n        :   file( _file ),\n            line( _line )\n        {}\n\n        SourceLineInfo( SourceLineInfo const& other )            = default;\n        SourceLineInfo& operator = ( SourceLineInfo const& )     = default;\n        SourceLineInfo( SourceLineInfo&& )              noexcept = default;\n        SourceLineInfo& operator = ( SourceLineInfo&& ) noexcept = default;\n\n        bool empty() const noexcept { return file[0] == '\\0'; }\n        bool operator == ( SourceLineInfo const& other ) const noexcept;\n        bool operator < ( SourceLineInfo const& other ) const noexcept;\n\n        char const* file;\n        std::size_t line;\n    };\n\n    std::ostream& operator << ( std::ostream& os, SourceLineInfo const& info );\n\n    // Bring in operator<< from global namespace into Catch namespace\n    // This is necessary because the overload of operator<< above makes\n    // lookup stop at namespace Catch\n    using ::operator<<;\n\n    // Use this in variadic streaming macros to allow\n    //    >> +StreamEndStop\n    // as well as\n    //    >> stuff +StreamEndStop\n    struct StreamEndStop {\n        std::string operator+() const;\n    };\n    template<typename T>\n    T const& operator + ( T const& value, StreamEndStop ) {\n        return value;\n    }\n}\n\n#define CATCH_INTERNAL_LINEINFO \\\n    ::Catch::SourceLineInfo( __FILE__, static_cast<std::size_t>( __LINE__ ) )\n\n// end catch_common.h\nnamespace Catch {\n\n    struct RegistrarForTagAliases {\n        RegistrarForTagAliases( char const* alias, char const* tag, SourceLineInfo const& lineInfo );\n    };\n\n} // end namespace Catch\n\n#define CATCH_REGISTER_TAG_ALIAS( alias, spec ) \\\n    CATCH_INTERNAL_START_WARNINGS_SUPPRESSION \\\n    CATCH_INTERNAL_SUPPRESS_GLOBALS_WARNINGS \\\n    namespace{ Catch::RegistrarForTagAliases INTERNAL_CATCH_UNIQUE_NAME( AutoRegisterTagAlias )( alias, spec, CATCH_INTERNAL_LINEINFO ); } \\\n    CATCH_INTERNAL_STOP_WARNINGS_SUPPRESSION\n\n// end catch_tag_alias_autoregistrar.h\n// start catch_test_registry.h\n\n// start catch_interfaces_testcase.h\n\n#include <vector>\n\nnamespace Catch {\n\n    class TestSpec;\n\n    struct ITestInvoker {\n        virtual void invoke () const = 0;\n        virtual ~ITestInvoker();\n    };\n\n    class TestCase;\n    struct IConfig;\n\n    struct ITestCaseRegistry {\n        virtual ~ITestCaseRegistry();\n        virtual std::vector<TestCase> const& getAllTests() const = 0;\n        virtual std::vector<TestCase> const& getAllTestsSorted( IConfig const& config ) const = 0;\n    };\n\n    bool isThrowSafe( TestCase const& testCase, IConfig const& config );\n    bool matchTest( TestCase const& testCase, TestSpec const& testSpec, IConfig const& config );\n    std::vector<TestCase> filterTests( std::vector<TestCase> const& testCases, TestSpec const& testSpec, IConfig const& config );\n    std::vector<TestCase> const& getAllTestCasesSorted( IConfig const& config );\n\n}\n\n// end catch_interfaces_testcase.h\n// start catch_stringref.h\n\n#include <cstddef>\n#include <string>\n#include <iosfwd>\n#include <cassert>\n\nnamespace Catch {\n\n    /// A non-owning string class (similar to the forthcoming std::string_view)\n    /// Note that, because a StringRef may be a substring of another string,\n    /// it may not be null terminated.\n    class StringRef {\n    public:\n        using size_type = std::size_t;\n        using const_iterator = const char*;\n\n    private:\n        static constexpr char const* const s_empty = \"\";\n\n        char const* m_start = s_empty;\n        size_type m_size = 0;\n\n    public: // construction\n        constexpr StringRef() noexcept = default;\n\n        StringRef( char const* rawChars ) noexcept;\n\n        constexpr StringRef( char const* rawChars, size_type size ) noexcept\n        :   m_start( rawChars ),\n            m_size( size )\n        {}\n\n        StringRef( std::string const& stdString ) noexcept\n        :   m_start( stdString.c_str() ),\n            m_size( stdString.size() )\n        {}\n\n        explicit operator std::string() const {\n            return std::string(m_start, m_size);\n        }\n\n    public: // operators\n        auto operator == ( StringRef const& other ) const noexcept -> bool;\n        auto operator != (StringRef const& other) const noexcept -> bool {\n            return !(*this == other);\n        }\n\n        auto operator[] ( size_type index ) const noexcept -> char {\n            assert(index < m_size);\n            return m_start[index];\n        }\n\n    public: // named queries\n        constexpr auto empty() const noexcept -> bool {\n            return m_size == 0;\n        }\n        constexpr auto size() const noexcept -> size_type {\n            return m_size;\n        }\n\n        // Returns the current start pointer. If the StringRef is not\n        // null-terminated, throws std::domain_exception\n        auto c_str() const -> char const*;\n\n    public: // substrings and searches\n        // Returns a substring of [start, start + length).\n        // If start + length > size(), then the substring is [start, size()).\n        // If start > size(), then the substring is empty.\n        auto substr( size_type start, size_type length ) const noexcept -> StringRef;\n\n        // Returns the current start pointer. May not be null-terminated.\n        auto data() const noexcept -> char const*;\n\n        constexpr auto isNullTerminated() const noexcept -> bool {\n            return m_start[m_size] == '\\0';\n        }\n\n    public: // iterators\n        constexpr const_iterator begin() const { return m_start; }\n        constexpr const_iterator end() const { return m_start + m_size; }\n    };\n\n    auto operator += ( std::string& lhs, StringRef const& sr ) -> std::string&;\n    auto operator << ( std::ostream& os, StringRef const& sr ) -> std::ostream&;\n\n    constexpr auto operator \"\" _sr( char const* rawChars, std::size_t size ) noexcept -> StringRef {\n        return StringRef( rawChars, size );\n    }\n} // namespace Catch\n\nconstexpr auto operator \"\" _catch_sr( char const* rawChars, std::size_t size ) noexcept -> Catch::StringRef {\n    return Catch::StringRef( rawChars, size );\n}\n\n// end catch_stringref.h\n// start catch_preprocessor.hpp\n\n\n#define CATCH_RECURSION_LEVEL0(...) __VA_ARGS__\n#define CATCH_RECURSION_LEVEL1(...) CATCH_RECURSION_LEVEL0(CATCH_RECURSION_LEVEL0(CATCH_RECURSION_LEVEL0(__VA_ARGS__)))\n#define CATCH_RECURSION_LEVEL2(...) CATCH_RECURSION_LEVEL1(CATCH_RECURSION_LEVEL1(CATCH_RECURSION_LEVEL1(__VA_ARGS__)))\n#define CATCH_RECURSION_LEVEL3(...) CATCH_RECURSION_LEVEL2(CATCH_RECURSION_LEVEL2(CATCH_RECURSION_LEVEL2(__VA_ARGS__)))\n#define CATCH_RECURSION_LEVEL4(...) CATCH_RECURSION_LEVEL3(CATCH_RECURSION_LEVEL3(CATCH_RECURSION_LEVEL3(__VA_ARGS__)))\n#define CATCH_RECURSION_LEVEL5(...) CATCH_RECURSION_LEVEL4(CATCH_RECURSION_LEVEL4(CATCH_RECURSION_LEVEL4(__VA_ARGS__)))\n\n#ifdef CATCH_CONFIG_TRADITIONAL_MSVC_PREPROCESSOR\n#define INTERNAL_CATCH_EXPAND_VARGS(...) __VA_ARGS__\n// MSVC needs more evaluations\n#define CATCH_RECURSION_LEVEL6(...) CATCH_RECURSION_LEVEL5(CATCH_RECURSION_LEVEL5(CATCH_RECURSION_LEVEL5(__VA_ARGS__)))\n#define CATCH_RECURSE(...)  CATCH_RECURSION_LEVEL6(CATCH_RECURSION_LEVEL6(__VA_ARGS__))\n#else\n#define CATCH_RECURSE(...)  CATCH_RECURSION_LEVEL5(__VA_ARGS__)\n#endif\n\n#define CATCH_REC_END(...)\n#define CATCH_REC_OUT\n\n#define CATCH_EMPTY()\n#define CATCH_DEFER(id) id CATCH_EMPTY()\n\n#define CATCH_REC_GET_END2() 0, CATCH_REC_END\n#define CATCH_REC_GET_END1(...) CATCH_REC_GET_END2\n#define CATCH_REC_GET_END(...) CATCH_REC_GET_END1\n#define CATCH_REC_NEXT0(test, next, ...) next CATCH_REC_OUT\n#define CATCH_REC_NEXT1(test, next) CATCH_DEFER ( CATCH_REC_NEXT0 ) ( test, next, 0)\n#define CATCH_REC_NEXT(test, next)  CATCH_REC_NEXT1(CATCH_REC_GET_END test, next)\n\n#define CATCH_REC_LIST0(f, x, peek, ...) , f(x) CATCH_DEFER ( CATCH_REC_NEXT(peek, CATCH_REC_LIST1) ) ( f, peek, __VA_ARGS__ )\n#define CATCH_REC_LIST1(f, x, peek, ...) , f(x) CATCH_DEFER ( CATCH_REC_NEXT(peek, CATCH_REC_LIST0) ) ( f, peek, __VA_ARGS__ )\n#define CATCH_REC_LIST2(f, x, peek, ...)   f(x) CATCH_DEFER ( CATCH_REC_NEXT(peek, CATCH_REC_LIST1) ) ( f, peek, __VA_ARGS__ )\n\n#define CATCH_REC_LIST0_UD(f, userdata, x, peek, ...) , f(userdata, x) CATCH_DEFER ( CATCH_REC_NEXT(peek, CATCH_REC_LIST1_UD) ) ( f, userdata, peek, __VA_ARGS__ )\n#define CATCH_REC_LIST1_UD(f, userdata, x, peek, ...) , f(userdata, x) CATCH_DEFER ( CATCH_REC_NEXT(peek, CATCH_REC_LIST0_UD) ) ( f, userdata, peek, __VA_ARGS__ )\n#define CATCH_REC_LIST2_UD(f, userdata, x, peek, ...)   f(userdata, x) CATCH_DEFER ( CATCH_REC_NEXT(peek, CATCH_REC_LIST1_UD) ) ( f, userdata, peek, __VA_ARGS__ )\n\n// Applies the function macro `f` to each of the remaining parameters, inserts commas between the results,\n// and passes userdata as the first parameter to each invocation,\n// e.g. CATCH_REC_LIST_UD(f, x, a, b, c) evaluates to f(x, a), f(x, b), f(x, c)\n#define CATCH_REC_LIST_UD(f, userdata, ...) CATCH_RECURSE(CATCH_REC_LIST2_UD(f, userdata, __VA_ARGS__, ()()(), ()()(), ()()(), 0))\n\n#define CATCH_REC_LIST(f, ...) CATCH_RECURSE(CATCH_REC_LIST2(f, __VA_ARGS__, ()()(), ()()(), ()()(), 0))\n\n#define INTERNAL_CATCH_EXPAND1(param) INTERNAL_CATCH_EXPAND2(param)\n#define INTERNAL_CATCH_EXPAND2(...) INTERNAL_CATCH_NO## __VA_ARGS__\n#define INTERNAL_CATCH_DEF(...) INTERNAL_CATCH_DEF __VA_ARGS__\n#define INTERNAL_CATCH_NOINTERNAL_CATCH_DEF\n#define INTERNAL_CATCH_STRINGIZE(...) INTERNAL_CATCH_STRINGIZE2(__VA_ARGS__)\n#ifndef CATCH_CONFIG_TRADITIONAL_MSVC_PREPROCESSOR\n#define INTERNAL_CATCH_STRINGIZE2(...) #__VA_ARGS__\n#define INTERNAL_CATCH_STRINGIZE_WITHOUT_PARENS(param) INTERNAL_CATCH_STRINGIZE(INTERNAL_CATCH_REMOVE_PARENS(param))\n#else\n// MSVC is adding extra space and needs another indirection to expand INTERNAL_CATCH_NOINTERNAL_CATCH_DEF\n#define INTERNAL_CATCH_STRINGIZE2(...) INTERNAL_CATCH_STRINGIZE3(__VA_ARGS__)\n#define INTERNAL_CATCH_STRINGIZE3(...) #__VA_ARGS__\n#define INTERNAL_CATCH_STRINGIZE_WITHOUT_PARENS(param) (INTERNAL_CATCH_STRINGIZE(INTERNAL_CATCH_REMOVE_PARENS(param)) + 1)\n#endif\n\n#define INTERNAL_CATCH_MAKE_NAMESPACE2(...) ns_##__VA_ARGS__\n#define INTERNAL_CATCH_MAKE_NAMESPACE(name) INTERNAL_CATCH_MAKE_NAMESPACE2(name)\n\n#define INTERNAL_CATCH_REMOVE_PARENS(...) INTERNAL_CATCH_EXPAND1(INTERNAL_CATCH_DEF __VA_ARGS__)\n\n#ifndef CATCH_CONFIG_TRADITIONAL_MSVC_PREPROCESSOR\n#define INTERNAL_CATCH_MAKE_TYPE_LIST2(...) decltype(get_wrapper<INTERNAL_CATCH_REMOVE_PARENS_GEN(__VA_ARGS__)>())\n#define INTERNAL_CATCH_MAKE_TYPE_LIST(...) INTERNAL_CATCH_MAKE_TYPE_LIST2(INTERNAL_CATCH_REMOVE_PARENS(__VA_ARGS__))\n#else\n#define INTERNAL_CATCH_MAKE_TYPE_LIST2(...) INTERNAL_CATCH_EXPAND_VARGS(decltype(get_wrapper<INTERNAL_CATCH_REMOVE_PARENS_GEN(__VA_ARGS__)>()))\n#define INTERNAL_CATCH_MAKE_TYPE_LIST(...) INTERNAL_CATCH_EXPAND_VARGS(INTERNAL_CATCH_MAKE_TYPE_LIST2(INTERNAL_CATCH_REMOVE_PARENS(__VA_ARGS__)))\n#endif\n\n#define INTERNAL_CATCH_MAKE_TYPE_LISTS_FROM_TYPES(...)\\\n    CATCH_REC_LIST(INTERNAL_CATCH_MAKE_TYPE_LIST,__VA_ARGS__)\n\n#define INTERNAL_CATCH_REMOVE_PARENS_1_ARG(_0) INTERNAL_CATCH_REMOVE_PARENS(_0)\n#define INTERNAL_CATCH_REMOVE_PARENS_2_ARG(_0, _1) INTERNAL_CATCH_REMOVE_PARENS(_0), INTERNAL_CATCH_REMOVE_PARENS_1_ARG(_1)\n#define INTERNAL_CATCH_REMOVE_PARENS_3_ARG(_0, _1, _2) INTERNAL_CATCH_REMOVE_PARENS(_0), INTERNAL_CATCH_REMOVE_PARENS_2_ARG(_1, _2)\n#define INTERNAL_CATCH_REMOVE_PARENS_4_ARG(_0, _1, _2, _3) INTERNAL_CATCH_REMOVE_PARENS(_0), INTERNAL_CATCH_REMOVE_PARENS_3_ARG(_1, _2, _3)\n#define INTERNAL_CATCH_REMOVE_PARENS_5_ARG(_0, _1, _2, _3, _4) INTERNAL_CATCH_REMOVE_PARENS(_0), INTERNAL_CATCH_REMOVE_PARENS_4_ARG(_1, _2, _3, _4)\n#define INTERNAL_CATCH_REMOVE_PARENS_6_ARG(_0, _1, _2, _3, _4, _5) INTERNAL_CATCH_REMOVE_PARENS(_0), INTERNAL_CATCH_REMOVE_PARENS_5_ARG(_1, _2, _3, _4, _5)\n#define INTERNAL_CATCH_REMOVE_PARENS_7_ARG(_0, _1, _2, _3, _4, _5, _6) INTERNAL_CATCH_REMOVE_PARENS(_0), INTERNAL_CATCH_REMOVE_PARENS_6_ARG(_1, _2, _3, _4, _5, _6)\n#define INTERNAL_CATCH_REMOVE_PARENS_8_ARG(_0, _1, _2, _3, _4, _5, _6, _7) INTERNAL_CATCH_REMOVE_PARENS(_0), INTERNAL_CATCH_REMOVE_PARENS_7_ARG(_1, _2, _3, _4, _5, _6, _7)\n#define INTERNAL_CATCH_REMOVE_PARENS_9_ARG(_0, _1, _2, _3, _4, _5, _6, _7, _8) INTERNAL_CATCH_REMOVE_PARENS(_0), INTERNAL_CATCH_REMOVE_PARENS_8_ARG(_1, _2, _3, _4, _5, _6, _7, _8)\n#define INTERNAL_CATCH_REMOVE_PARENS_10_ARG(_0, _1, _2, _3, _4, _5, _6, _7, _8, _9) INTERNAL_CATCH_REMOVE_PARENS(_0), INTERNAL_CATCH_REMOVE_PARENS_9_ARG(_1, _2, _3, _4, _5, _6, _7, _8, _9)\n#define INTERNAL_CATCH_REMOVE_PARENS_11_ARG(_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10) INTERNAL_CATCH_REMOVE_PARENS(_0), INTERNAL_CATCH_REMOVE_PARENS_10_ARG(_1, _2, _3, _4, _5, _6, _7, _8, _9, _10)\n\n#define INTERNAL_CATCH_VA_NARGS_IMPL(_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, N, ...) N\n\n#define INTERNAL_CATCH_TYPE_GEN\\\n    template<typename...> struct TypeList {};\\\n    template<typename...Ts>\\\n    constexpr auto get_wrapper() noexcept -> TypeList<Ts...> { return {}; }\\\n    template<template<typename...> class...> struct TemplateTypeList{};\\\n    template<template<typename...> class...Cs>\\\n    constexpr auto get_wrapper() noexcept -> TemplateTypeList<Cs...> { return {}; }\\\n    template<typename...>\\\n    struct append;\\\n    template<typename...>\\\n    struct rewrap;\\\n    template<template<typename...> class, typename...>\\\n    struct create;\\\n    template<template<typename...> class, typename>\\\n    struct convert;\\\n    \\\n    template<typename T> \\\n    struct append<T> { using type = T; };\\\n    template< template<typename...> class L1, typename...E1, template<typename...> class L2, typename...E2, typename...Rest>\\\n    struct append<L1<E1...>, L2<E2...>, Rest...> { using type = typename append<L1<E1...,E2...>, Rest...>::type; };\\\n    template< template<typename...> class L1, typename...E1, typename...Rest>\\\n    struct append<L1<E1...>, TypeList<mpl_::na>, Rest...> { using type = L1<E1...>; };\\\n    \\\n    template< template<typename...> class Container, template<typename...> class List, typename...elems>\\\n    struct rewrap<TemplateTypeList<Container>, List<elems...>> { using type = TypeList<Container<elems...>>; };\\\n    template< template<typename...> class Container, template<typename...> class List, class...Elems, typename...Elements>\\\n    struct rewrap<TemplateTypeList<Container>, List<Elems...>, Elements...> { using type = typename append<TypeList<Container<Elems...>>, typename rewrap<TemplateTypeList<Container>, Elements...>::type>::type; };\\\n    \\\n    template<template <typename...> class Final, template< typename...> class...Containers, typename...Types>\\\n    struct create<Final, TemplateTypeList<Containers...>, TypeList<Types...>> { using type = typename append<Final<>, typename rewrap<TemplateTypeList<Containers>, Types...>::type...>::type; };\\\n    template<template <typename...> class Final, template <typename...> class List, typename...Ts>\\\n    struct convert<Final, List<Ts...>> { using type = typename append<Final<>,TypeList<Ts>...>::type; };\n\n#define INTERNAL_CATCH_NTTP_1(signature, ...)\\\n    template<INTERNAL_CATCH_REMOVE_PARENS(signature)> struct Nttp{};\\\n    template<INTERNAL_CATCH_REMOVE_PARENS(signature)>\\\n    constexpr auto get_wrapper() noexcept -> Nttp<__VA_ARGS__> { return {}; } \\\n    template<template<INTERNAL_CATCH_REMOVE_PARENS(signature)> class...> struct NttpTemplateTypeList{};\\\n    template<template<INTERNAL_CATCH_REMOVE_PARENS(signature)> class...Cs>\\\n    constexpr auto get_wrapper() noexcept -> NttpTemplateTypeList<Cs...> { return {}; } \\\n    \\\n    template< template<INTERNAL_CATCH_REMOVE_PARENS(signature)> class Container, template<INTERNAL_CATCH_REMOVE_PARENS(signature)> class List, INTERNAL_CATCH_REMOVE_PARENS(signature)>\\\n    struct rewrap<NttpTemplateTypeList<Container>, List<__VA_ARGS__>> { using type = TypeList<Container<__VA_ARGS__>>; };\\\n    template< template<INTERNAL_CATCH_REMOVE_PARENS(signature)> class Container, template<INTERNAL_CATCH_REMOVE_PARENS(signature)> class List, INTERNAL_CATCH_REMOVE_PARENS(signature), typename...Elements>\\\n    struct rewrap<NttpTemplateTypeList<Container>, List<__VA_ARGS__>, Elements...> { using type = typename append<TypeList<Container<__VA_ARGS__>>, typename rewrap<NttpTemplateTypeList<Container>, Elements...>::type>::type; };\\\n    template<template <typename...> class Final, template<INTERNAL_CATCH_REMOVE_PARENS(signature)> class...Containers, typename...Types>\\\n    struct create<Final, NttpTemplateTypeList<Containers...>, TypeList<Types...>> { using type = typename append<Final<>, typename rewrap<NttpTemplateTypeList<Containers>, Types...>::type...>::type; };\n\n#define INTERNAL_CATCH_DECLARE_SIG_TEST0(TestName)\n#define INTERNAL_CATCH_DECLARE_SIG_TEST1(TestName, signature)\\\n    template<INTERNAL_CATCH_REMOVE_PARENS(signature)>\\\n    static void TestName()\n#define INTERNAL_CATCH_DECLARE_SIG_TEST_X(TestName, signature, ...)\\\n    template<INTERNAL_CATCH_REMOVE_PARENS(signature)>\\\n    static void TestName()\n\n#define INTERNAL_CATCH_DEFINE_SIG_TEST0(TestName)\n#define INTERNAL_CATCH_DEFINE_SIG_TEST1(TestName, signature)\\\n    template<INTERNAL_CATCH_REMOVE_PARENS(signature)>\\\n    static void TestName()\n#define INTERNAL_CATCH_DEFINE_SIG_TEST_X(TestName, signature,...)\\\n    template<INTERNAL_CATCH_REMOVE_PARENS(signature)>\\\n    static void TestName()\n\n#define INTERNAL_CATCH_NTTP_REGISTER0(TestFunc, signature)\\\n    template<typename Type>\\\n    void reg_test(TypeList<Type>, Catch::NameAndTags nameAndTags)\\\n    {\\\n        Catch::AutoReg( Catch::makeTestInvoker(&TestFunc<Type>), CATCH_INTERNAL_LINEINFO, Catch::StringRef(), nameAndTags);\\\n    }\n\n#define INTERNAL_CATCH_NTTP_REGISTER(TestFunc, signature, ...)\\\n    template<INTERNAL_CATCH_REMOVE_PARENS(signature)>\\\n    void reg_test(Nttp<__VA_ARGS__>, Catch::NameAndTags nameAndTags)\\\n    {\\\n        Catch::AutoReg( Catch::makeTestInvoker(&TestFunc<__VA_ARGS__>), CATCH_INTERNAL_LINEINFO, Catch::StringRef(), nameAndTags);\\\n    }\n\n#define INTERNAL_CATCH_NTTP_REGISTER_METHOD0(TestName, signature, ...)\\\n    template<typename Type>\\\n    void reg_test(TypeList<Type>, Catch::StringRef className, Catch::NameAndTags nameAndTags)\\\n    {\\\n        Catch::AutoReg( Catch::makeTestInvoker(&TestName<Type>::test), CATCH_INTERNAL_LINEINFO, className, nameAndTags);\\\n    }\n\n#define INTERNAL_CATCH_NTTP_REGISTER_METHOD(TestName, signature, ...)\\\n    template<INTERNAL_CATCH_REMOVE_PARENS(signature)>\\\n    void reg_test(Nttp<__VA_ARGS__>, Catch::StringRef className, Catch::NameAndTags nameAndTags)\\\n    {\\\n        Catch::AutoReg( Catch::makeTestInvoker(&TestName<__VA_ARGS__>::test), CATCH_INTERNAL_LINEINFO, className, nameAndTags);\\\n    }\n\n#define INTERNAL_CATCH_DECLARE_SIG_TEST_METHOD0(TestName, ClassName)\n#define INTERNAL_CATCH_DECLARE_SIG_TEST_METHOD1(TestName, ClassName, signature)\\\n    template<typename TestType> \\\n    struct TestName : INTERNAL_CATCH_REMOVE_PARENS(ClassName)<TestType> { \\\n        void test();\\\n    }\n\n#define INTERNAL_CATCH_DECLARE_SIG_TEST_METHOD_X(TestName, ClassName, signature, ...)\\\n    template<INTERNAL_CATCH_REMOVE_PARENS(signature)> \\\n    struct TestName : INTERNAL_CATCH_REMOVE_PARENS(ClassName)<__VA_ARGS__> { \\\n        void test();\\\n    }\n\n#define INTERNAL_CATCH_DEFINE_SIG_TEST_METHOD0(TestName)\n#define INTERNAL_CATCH_DEFINE_SIG_TEST_METHOD1(TestName, signature)\\\n    template<typename TestType> \\\n    void INTERNAL_CATCH_MAKE_NAMESPACE(TestName)::TestName<TestType>::test()\n#define INTERNAL_CATCH_DEFINE_SIG_TEST_METHOD_X(TestName, signature, ...)\\\n    template<INTERNAL_CATCH_REMOVE_PARENS(signature)> \\\n    void INTERNAL_CATCH_MAKE_NAMESPACE(TestName)::TestName<__VA_ARGS__>::test()\n\n#ifndef CATCH_CONFIG_TRADITIONAL_MSVC_PREPROCESSOR\n#define INTERNAL_CATCH_NTTP_0\n#define INTERNAL_CATCH_NTTP_GEN(...) INTERNAL_CATCH_VA_NARGS_IMPL(__VA_ARGS__, INTERNAL_CATCH_NTTP_1(__VA_ARGS__), INTERNAL_CATCH_NTTP_1(__VA_ARGS__), INTERNAL_CATCH_NTTP_1(__VA_ARGS__), INTERNAL_CATCH_NTTP_1(__VA_ARGS__), INTERNAL_CATCH_NTTP_1(__VA_ARGS__), INTERNAL_CATCH_NTTP_1( __VA_ARGS__), INTERNAL_CATCH_NTTP_1( __VA_ARGS__), INTERNAL_CATCH_NTTP_1( __VA_ARGS__), INTERNAL_CATCH_NTTP_1( __VA_ARGS__),INTERNAL_CATCH_NTTP_1( __VA_ARGS__), INTERNAL_CATCH_NTTP_0)\n#define INTERNAL_CATCH_DEFINE_SIG_TEST_METHOD(TestName, ...) INTERNAL_CATCH_VA_NARGS_IMPL( \"dummy\", __VA_ARGS__, INTERNAL_CATCH_DEFINE_SIG_TEST_METHOD_X,INTERNAL_CATCH_DEFINE_SIG_TEST_METHOD_X, INTERNAL_CATCH_DEFINE_SIG_TEST_METHOD_X, INTERNAL_CATCH_DEFINE_SIG_TEST_METHOD_X, INTERNAL_CATCH_DEFINE_SIG_TEST_METHOD_X, INTERNAL_CATCH_DEFINE_SIG_TEST_METHOD_X, INTERNAL_CATCH_DEFINE_SIG_TEST_METHOD_X,INTERNAL_CATCH_DEFINE_SIG_TEST_METHOD_X,INTERNAL_CATCH_DEFINE_SIG_TEST_METHOD_X, INTERNAL_CATCH_DEFINE_SIG_TEST_METHOD1, INTERNAL_CATCH_DEFINE_SIG_TEST_METHOD0)(TestName, __VA_ARGS__)\n#define INTERNAL_CATCH_DECLARE_SIG_TEST_METHOD(TestName, ClassName, ...) INTERNAL_CATCH_VA_NARGS_IMPL( \"dummy\", __VA_ARGS__, INTERNAL_CATCH_DECLARE_SIG_TEST_METHOD_X,INTERNAL_CATCH_DECLARE_SIG_TEST_METHOD_X, INTERNAL_CATCH_DECLARE_SIG_TEST_METHOD_X, INTERNAL_CATCH_DECLARE_SIG_TEST_METHOD_X, INTERNAL_CATCH_DECLARE_SIG_TEST_METHOD_X, INTERNAL_CATCH_DECLARE_SIG_TEST_METHOD_X, INTERNAL_CATCH_DECLARE_SIG_TEST_METHOD_X,INTERNAL_CATCH_DECLARE_SIG_TEST_METHOD_X,INTERNAL_CATCH_DECLARE_SIG_TEST_METHOD_X, INTERNAL_CATCH_DECLARE_SIG_TEST_METHOD1, INTERNAL_CATCH_DECLARE_SIG_TEST_METHOD0)(TestName, ClassName, __VA_ARGS__)\n#define INTERNAL_CATCH_NTTP_REG_METHOD_GEN(TestName, ...) INTERNAL_CATCH_VA_NARGS_IMPL( \"dummy\", __VA_ARGS__, INTERNAL_CATCH_NTTP_REGISTER_METHOD, INTERNAL_CATCH_NTTP_REGISTER_METHOD, INTERNAL_CATCH_NTTP_REGISTER_METHOD, INTERNAL_CATCH_NTTP_REGISTER_METHOD, INTERNAL_CATCH_NTTP_REGISTER_METHOD, INTERNAL_CATCH_NTTP_REGISTER_METHOD, INTERNAL_CATCH_NTTP_REGISTER_METHOD, INTERNAL_CATCH_NTTP_REGISTER_METHOD, INTERNAL_CATCH_NTTP_REGISTER_METHOD, INTERNAL_CATCH_NTTP_REGISTER_METHOD0, INTERNAL_CATCH_NTTP_REGISTER_METHOD0)(TestName, __VA_ARGS__)\n#define INTERNAL_CATCH_NTTP_REG_GEN(TestFunc, ...) INTERNAL_CATCH_VA_NARGS_IMPL( \"dummy\", __VA_ARGS__, INTERNAL_CATCH_NTTP_REGISTER, INTERNAL_CATCH_NTTP_REGISTER, INTERNAL_CATCH_NTTP_REGISTER, INTERNAL_CATCH_NTTP_REGISTER, INTERNAL_CATCH_NTTP_REGISTER, INTERNAL_CATCH_NTTP_REGISTER, INTERNAL_CATCH_NTTP_REGISTER, INTERNAL_CATCH_NTTP_REGISTER, INTERNAL_CATCH_NTTP_REGISTER, INTERNAL_CATCH_NTTP_REGISTER0, INTERNAL_CATCH_NTTP_REGISTER0)(TestFunc, __VA_ARGS__)\n#define INTERNAL_CATCH_DEFINE_SIG_TEST(TestName, ...) INTERNAL_CATCH_VA_NARGS_IMPL( \"dummy\", __VA_ARGS__, INTERNAL_CATCH_DEFINE_SIG_TEST_X, INTERNAL_CATCH_DEFINE_SIG_TEST_X, INTERNAL_CATCH_DEFINE_SIG_TEST_X, INTERNAL_CATCH_DEFINE_SIG_TEST_X, INTERNAL_CATCH_DEFINE_SIG_TEST_X, INTERNAL_CATCH_DEFINE_SIG_TEST_X, INTERNAL_CATCH_DEFINE_SIG_TEST_X, INTERNAL_CATCH_DEFINE_SIG_TEST_X,INTERNAL_CATCH_DEFINE_SIG_TEST_X,INTERNAL_CATCH_DEFINE_SIG_TEST1, INTERNAL_CATCH_DEFINE_SIG_TEST0)(TestName, __VA_ARGS__)\n#define INTERNAL_CATCH_DECLARE_SIG_TEST(TestName, ...) INTERNAL_CATCH_VA_NARGS_IMPL( \"dummy\", __VA_ARGS__, INTERNAL_CATCH_DECLARE_SIG_TEST_X,INTERNAL_CATCH_DECLARE_SIG_TEST_X, INTERNAL_CATCH_DECLARE_SIG_TEST_X, INTERNAL_CATCH_DECLARE_SIG_TEST_X, INTERNAL_CATCH_DECLARE_SIG_TEST_X, INTERNAL_CATCH_DECLARE_SIG_TEST_X, INTERNAL_CATCH_DEFINE_SIG_TEST_X,INTERNAL_CATCH_DECLARE_SIG_TEST_X,INTERNAL_CATCH_DECLARE_SIG_TEST_X, INTERNAL_CATCH_DECLARE_SIG_TEST1, INTERNAL_CATCH_DECLARE_SIG_TEST0)(TestName, __VA_ARGS__)\n#define INTERNAL_CATCH_REMOVE_PARENS_GEN(...) INTERNAL_CATCH_VA_NARGS_IMPL(__VA_ARGS__, INTERNAL_CATCH_REMOVE_PARENS_11_ARG,INTERNAL_CATCH_REMOVE_PARENS_10_ARG,INTERNAL_CATCH_REMOVE_PARENS_9_ARG,INTERNAL_CATCH_REMOVE_PARENS_8_ARG,INTERNAL_CATCH_REMOVE_PARENS_7_ARG,INTERNAL_CATCH_REMOVE_PARENS_6_ARG,INTERNAL_CATCH_REMOVE_PARENS_5_ARG,INTERNAL_CATCH_REMOVE_PARENS_4_ARG,INTERNAL_CATCH_REMOVE_PARENS_3_ARG,INTERNAL_CATCH_REMOVE_PARENS_2_ARG,INTERNAL_CATCH_REMOVE_PARENS_1_ARG)(__VA_ARGS__)\n#else\n#define INTERNAL_CATCH_NTTP_0(signature)\n#define INTERNAL_CATCH_NTTP_GEN(...) INTERNAL_CATCH_EXPAND_VARGS(INTERNAL_CATCH_VA_NARGS_IMPL(__VA_ARGS__, INTERNAL_CATCH_NTTP_1, INTERNAL_CATCH_NTTP_1, INTERNAL_CATCH_NTTP_1, INTERNAL_CATCH_NTTP_1, INTERNAL_CATCH_NTTP_1, INTERNAL_CATCH_NTTP_1, INTERNAL_CATCH_NTTP_1, INTERNAL_CATCH_NTTP_1, INTERNAL_CATCH_NTTP_1,INTERNAL_CATCH_NTTP_1, INTERNAL_CATCH_NTTP_0)( __VA_ARGS__))\n#define INTERNAL_CATCH_DEFINE_SIG_TEST_METHOD(TestName, ...) INTERNAL_CATCH_EXPAND_VARGS(INTERNAL_CATCH_VA_NARGS_IMPL( \"dummy\", __VA_ARGS__, INTERNAL_CATCH_DEFINE_SIG_TEST_METHOD_X,INTERNAL_CATCH_DEFINE_SIG_TEST_METHOD_X, INTERNAL_CATCH_DEFINE_SIG_TEST_METHOD_X, INTERNAL_CATCH_DEFINE_SIG_TEST_METHOD_X, INTERNAL_CATCH_DEFINE_SIG_TEST_METHOD_X, INTERNAL_CATCH_DEFINE_SIG_TEST_METHOD_X, INTERNAL_CATCH_DEFINE_SIG_TEST_METHOD_X,INTERNAL_CATCH_DEFINE_SIG_TEST_METHOD_X,INTERNAL_CATCH_DEFINE_SIG_TEST_METHOD_X, INTERNAL_CATCH_DEFINE_SIG_TEST_METHOD1, INTERNAL_CATCH_DEFINE_SIG_TEST_METHOD0)(TestName, __VA_ARGS__))\n#define INTERNAL_CATCH_DECLARE_SIG_TEST_METHOD(TestName, ClassName, ...) INTERNAL_CATCH_EXPAND_VARGS(INTERNAL_CATCH_VA_NARGS_IMPL( \"dummy\", __VA_ARGS__, INTERNAL_CATCH_DECLARE_SIG_TEST_METHOD_X,INTERNAL_CATCH_DECLARE_SIG_TEST_METHOD_X, INTERNAL_CATCH_DECLARE_SIG_TEST_METHOD_X, INTERNAL_CATCH_DECLARE_SIG_TEST_METHOD_X, INTERNAL_CATCH_DECLARE_SIG_TEST_METHOD_X, INTERNAL_CATCH_DECLARE_SIG_TEST_METHOD_X, INTERNAL_CATCH_DECLARE_SIG_TEST_METHOD_X,INTERNAL_CATCH_DECLARE_SIG_TEST_METHOD_X,INTERNAL_CATCH_DECLARE_SIG_TEST_METHOD_X, INTERNAL_CATCH_DECLARE_SIG_TEST_METHOD1, INTERNAL_CATCH_DECLARE_SIG_TEST_METHOD0)(TestName, ClassName, __VA_ARGS__))\n#define INTERNAL_CATCH_NTTP_REG_METHOD_GEN(TestName, ...) INTERNAL_CATCH_EXPAND_VARGS(INTERNAL_CATCH_VA_NARGS_IMPL( \"dummy\", __VA_ARGS__, INTERNAL_CATCH_NTTP_REGISTER_METHOD, INTERNAL_CATCH_NTTP_REGISTER_METHOD, INTERNAL_CATCH_NTTP_REGISTER_METHOD, INTERNAL_CATCH_NTTP_REGISTER_METHOD, INTERNAL_CATCH_NTTP_REGISTER_METHOD, INTERNAL_CATCH_NTTP_REGISTER_METHOD, INTERNAL_CATCH_NTTP_REGISTER_METHOD, INTERNAL_CATCH_NTTP_REGISTER_METHOD, INTERNAL_CATCH_NTTP_REGISTER_METHOD, INTERNAL_CATCH_NTTP_REGISTER_METHOD0, INTERNAL_CATCH_NTTP_REGISTER_METHOD0)(TestName, __VA_ARGS__))\n#define INTERNAL_CATCH_NTTP_REG_GEN(TestFunc, ...) INTERNAL_CATCH_EXPAND_VARGS(INTERNAL_CATCH_VA_NARGS_IMPL( \"dummy\", __VA_ARGS__, INTERNAL_CATCH_NTTP_REGISTER, INTERNAL_CATCH_NTTP_REGISTER, INTERNAL_CATCH_NTTP_REGISTER, INTERNAL_CATCH_NTTP_REGISTER, INTERNAL_CATCH_NTTP_REGISTER, INTERNAL_CATCH_NTTP_REGISTER, INTERNAL_CATCH_NTTP_REGISTER, INTERNAL_CATCH_NTTP_REGISTER, INTERNAL_CATCH_NTTP_REGISTER, INTERNAL_CATCH_NTTP_REGISTER0, INTERNAL_CATCH_NTTP_REGISTER0)(TestFunc, __VA_ARGS__))\n#define INTERNAL_CATCH_DEFINE_SIG_TEST(TestName, ...) INTERNAL_CATCH_EXPAND_VARGS(INTERNAL_CATCH_VA_NARGS_IMPL( \"dummy\", __VA_ARGS__, INTERNAL_CATCH_DEFINE_SIG_TEST_X, INTERNAL_CATCH_DEFINE_SIG_TEST_X, INTERNAL_CATCH_DEFINE_SIG_TEST_X, INTERNAL_CATCH_DEFINE_SIG_TEST_X, INTERNAL_CATCH_DEFINE_SIG_TEST_X, INTERNAL_CATCH_DEFINE_SIG_TEST_X, INTERNAL_CATCH_DEFINE_SIG_TEST_X, INTERNAL_CATCH_DEFINE_SIG_TEST_X,INTERNAL_CATCH_DEFINE_SIG_TEST_X,INTERNAL_CATCH_DEFINE_SIG_TEST1, INTERNAL_CATCH_DEFINE_SIG_TEST0)(TestName, __VA_ARGS__))\n#define INTERNAL_CATCH_DECLARE_SIG_TEST(TestName, ...) INTERNAL_CATCH_EXPAND_VARGS(INTERNAL_CATCH_VA_NARGS_IMPL( \"dummy\", __VA_ARGS__, INTERNAL_CATCH_DECLARE_SIG_TEST_X,INTERNAL_CATCH_DECLARE_SIG_TEST_X, INTERNAL_CATCH_DECLARE_SIG_TEST_X, INTERNAL_CATCH_DECLARE_SIG_TEST_X, INTERNAL_CATCH_DECLARE_SIG_TEST_X, INTERNAL_CATCH_DECLARE_SIG_TEST_X, INTERNAL_CATCH_DEFINE_SIG_TEST_X,INTERNAL_CATCH_DECLARE_SIG_TEST_X,INTERNAL_CATCH_DECLARE_SIG_TEST_X, INTERNAL_CATCH_DECLARE_SIG_TEST1, INTERNAL_CATCH_DECLARE_SIG_TEST0)(TestName, __VA_ARGS__))\n#define INTERNAL_CATCH_REMOVE_PARENS_GEN(...) INTERNAL_CATCH_EXPAND_VARGS(INTERNAL_CATCH_VA_NARGS_IMPL(__VA_ARGS__, INTERNAL_CATCH_REMOVE_PARENS_11_ARG,INTERNAL_CATCH_REMOVE_PARENS_10_ARG,INTERNAL_CATCH_REMOVE_PARENS_9_ARG,INTERNAL_CATCH_REMOVE_PARENS_8_ARG,INTERNAL_CATCH_REMOVE_PARENS_7_ARG,INTERNAL_CATCH_REMOVE_PARENS_6_ARG,INTERNAL_CATCH_REMOVE_PARENS_5_ARG,INTERNAL_CATCH_REMOVE_PARENS_4_ARG,INTERNAL_CATCH_REMOVE_PARENS_3_ARG,INTERNAL_CATCH_REMOVE_PARENS_2_ARG,INTERNAL_CATCH_REMOVE_PARENS_1_ARG)(__VA_ARGS__))\n#endif\n\n// end catch_preprocessor.hpp\n// start catch_meta.hpp\n\n\n#include <type_traits>\n\nnamespace Catch {\n    template<typename T>\n    struct always_false : std::false_type {};\n\n    template <typename> struct true_given : std::true_type {};\n    struct is_callable_tester {\n        template <typename Fun, typename... Args>\n        true_given<decltype(std::declval<Fun>()(std::declval<Args>()...))> static test(int);\n        template <typename...>\n        std::false_type static test(...);\n    };\n\n    template <typename T>\n    struct is_callable;\n\n    template <typename Fun, typename... Args>\n    struct is_callable<Fun(Args...)> : decltype(is_callable_tester::test<Fun, Args...>(0)) {};\n\n#if defined(__cpp_lib_is_invocable) && __cpp_lib_is_invocable >= 201703\n    // std::result_of is deprecated in C++17 and removed in C++20. Hence, it is\n    // replaced with std::invoke_result here.\n    template <typename Func, typename... U>\n    using FunctionReturnType = std::remove_reference_t<std::remove_cv_t<std::invoke_result_t<Func, U...>>>;\n#else\n    // Keep ::type here because we still support C++11\n    template <typename Func, typename... U>\n    using FunctionReturnType = typename std::remove_reference<typename std::remove_cv<typename std::result_of<Func(U...)>::type>::type>::type;\n#endif\n\n} // namespace Catch\n\nnamespace mpl_{\n    struct na;\n}\n\n// end catch_meta.hpp\nnamespace Catch {\n\ntemplate<typename C>\nclass TestInvokerAsMethod : public ITestInvoker {\n    void (C::*m_testAsMethod)();\npublic:\n    TestInvokerAsMethod( void (C::*testAsMethod)() ) noexcept : m_testAsMethod( testAsMethod ) {}\n\n    void invoke() const override {\n        C obj;\n        (obj.*m_testAsMethod)();\n    }\n};\n\nauto makeTestInvoker( void(*testAsFunction)() ) noexcept -> ITestInvoker*;\n\ntemplate<typename C>\nauto makeTestInvoker( void (C::*testAsMethod)() ) noexcept -> ITestInvoker* {\n    return new(std::nothrow) TestInvokerAsMethod<C>( testAsMethod );\n}\n\nstruct NameAndTags {\n    NameAndTags( StringRef const& name_ = StringRef(), StringRef const& tags_ = StringRef() ) noexcept;\n    StringRef name;\n    StringRef tags;\n};\n\nstruct AutoReg : NonCopyable {\n    AutoReg( ITestInvoker* invoker, SourceLineInfo const& lineInfo, StringRef const& classOrMethod, NameAndTags const& nameAndTags ) noexcept;\n    ~AutoReg();\n};\n\n} // end namespace Catch\n\n#if defined(CATCH_CONFIG_DISABLE)\n    #define INTERNAL_CATCH_TESTCASE_NO_REGISTRATION( TestName, ... ) \\\n        static void TestName()\n    #define INTERNAL_CATCH_TESTCASE_METHOD_NO_REGISTRATION( TestName, ClassName, ... ) \\\n        namespace{                        \\\n            struct TestName : INTERNAL_CATCH_REMOVE_PARENS(ClassName) { \\\n                void test();              \\\n            };                            \\\n        }                                 \\\n        void TestName::test()\n    #define INTERNAL_CATCH_TEMPLATE_TEST_CASE_NO_REGISTRATION_2( TestName, TestFunc, Name, Tags, Signature, ... )  \\\n        INTERNAL_CATCH_DEFINE_SIG_TEST(TestFunc, INTERNAL_CATCH_REMOVE_PARENS(Signature))\n    #define INTERNAL_CATCH_TEMPLATE_TEST_CASE_METHOD_NO_REGISTRATION_2( TestNameClass, TestName, ClassName, Name, Tags, Signature, ... )    \\\n        namespace{                                                                                  \\\n            namespace INTERNAL_CATCH_MAKE_NAMESPACE(TestName) {                                      \\\n            INTERNAL_CATCH_DECLARE_SIG_TEST_METHOD(TestName, ClassName, INTERNAL_CATCH_REMOVE_PARENS(Signature));\\\n        }                                                                                           \\\n        }                                                                                           \\\n        INTERNAL_CATCH_DEFINE_SIG_TEST_METHOD(TestName, INTERNAL_CATCH_REMOVE_PARENS(Signature))\n\n    #ifndef CATCH_CONFIG_TRADITIONAL_MSVC_PREPROCESSOR\n        #define INTERNAL_CATCH_TEMPLATE_TEST_CASE_NO_REGISTRATION(Name, Tags, ...) \\\n            INTERNAL_CATCH_TEMPLATE_TEST_CASE_NO_REGISTRATION_2( INTERNAL_CATCH_UNIQUE_NAME( C_A_T_C_H_T_E_M_P_L_A_T_E_T_E_S_T_ ), INTERNAL_CATCH_UNIQUE_NAME( C_A_T_C_H_T_E_M_P_L_A_T_E_T_E_S_T_F_U_N_C_ ), Name, Tags, typename TestType, __VA_ARGS__ )\n    #else\n        #define INTERNAL_CATCH_TEMPLATE_TEST_CASE_NO_REGISTRATION(Name, Tags, ...) \\\n            INTERNAL_CATCH_EXPAND_VARGS( INTERNAL_CATCH_TEMPLATE_TEST_CASE_NO_REGISTRATION_2( INTERNAL_CATCH_UNIQUE_NAME( C_A_T_C_H_T_E_M_P_L_A_T_E_T_E_S_T_ ), INTERNAL_CATCH_UNIQUE_NAME( C_A_T_C_H_T_E_M_P_L_A_T_E_T_E_S_T_F_U_N_C_ ), Name, Tags, typename TestType, __VA_ARGS__ ) )\n    #endif\n\n    #ifndef CATCH_CONFIG_TRADITIONAL_MSVC_PREPROCESSOR\n        #define INTERNAL_CATCH_TEMPLATE_TEST_CASE_SIG_NO_REGISTRATION(Name, Tags, Signature, ...) \\\n            INTERNAL_CATCH_TEMPLATE_TEST_CASE_NO_REGISTRATION_2( INTERNAL_CATCH_UNIQUE_NAME( C_A_T_C_H_T_E_M_P_L_A_T_E_T_E_S_T_ ), INTERNAL_CATCH_UNIQUE_NAME( C_A_T_C_H_T_E_M_P_L_A_T_E_T_E_S_T_F_U_N_C_ ), Name, Tags, Signature, __VA_ARGS__ )\n    #else\n        #define INTERNAL_CATCH_TEMPLATE_TEST_CASE_SIG_NO_REGISTRATION(Name, Tags, Signature, ...) \\\n            INTERNAL_CATCH_EXPAND_VARGS( INTERNAL_CATCH_TEMPLATE_TEST_CASE_NO_REGISTRATION_2( INTERNAL_CATCH_UNIQUE_NAME( C_A_T_C_H_T_E_M_P_L_A_T_E_T_E_S_T_ ), INTERNAL_CATCH_UNIQUE_NAME( C_A_T_C_H_T_E_M_P_L_A_T_E_T_E_S_T_F_U_N_C_ ), Name, Tags, Signature, __VA_ARGS__ ) )\n    #endif\n\n    #ifndef CATCH_CONFIG_TRADITIONAL_MSVC_PREPROCESSOR\n        #define INTERNAL_CATCH_TEMPLATE_TEST_CASE_METHOD_NO_REGISTRATION( ClassName, Name, Tags,... ) \\\n            INTERNAL_CATCH_TEMPLATE_TEST_CASE_METHOD_NO_REGISTRATION_2( INTERNAL_CATCH_UNIQUE_NAME( C_A_T_C_H_T_E_M_P_L_A_T_E_T_E_S_T_C_L_A_S_S_ ), INTERNAL_CATCH_UNIQUE_NAME( C_A_T_C_H_T_E_M_P_L_A_T_E_T_E_S_T_ ) , ClassName, Name, Tags, typename T, __VA_ARGS__ )\n    #else\n        #define INTERNAL_CATCH_TEMPLATE_TEST_CASE_METHOD_NO_REGISTRATION( ClassName, Name, Tags,... ) \\\n            INTERNAL_CATCH_EXPAND_VARGS( INTERNAL_CATCH_TEMPLATE_TEST_CASE_METHOD_NO_REGISTRATION_2( INTERNAL_CATCH_UNIQUE_NAME( C_A_T_C_H_T_E_M_P_L_A_T_E_T_E_S_T_C_L_A_S_S_ ), INTERNAL_CATCH_UNIQUE_NAME( C_A_T_C_H_T_E_M_P_L_A_T_E_T_E_S_T_ ) , ClassName, Name, Tags, typename T, __VA_ARGS__ ) )\n    #endif\n\n    #ifndef CATCH_CONFIG_TRADITIONAL_MSVC_PREPROCESSOR\n        #define INTERNAL_CATCH_TEMPLATE_TEST_CASE_METHOD_SIG_NO_REGISTRATION( ClassName, Name, Tags, Signature, ... ) \\\n            INTERNAL_CATCH_TEMPLATE_TEST_CASE_METHOD_NO_REGISTRATION_2( INTERNAL_CATCH_UNIQUE_NAME( C_A_T_C_H_T_E_M_P_L_A_T_E_T_E_S_T_C_L_A_S_S_ ), INTERNAL_CATCH_UNIQUE_NAME( C_A_T_C_H_T_E_M_P_L_A_T_E_T_E_S_T_ ) , ClassName, Name, Tags, Signature, __VA_ARGS__ )\n    #else\n        #define INTERNAL_CATCH_TEMPLATE_TEST_CASE_METHOD_SIG_NO_REGISTRATION( ClassName, Name, Tags, Signature, ... ) \\\n            INTERNAL_CATCH_EXPAND_VARGS( INTERNAL_CATCH_TEMPLATE_TEST_CASE_METHOD_NO_REGISTRATION_2( INTERNAL_CATCH_UNIQUE_NAME( C_A_T_C_H_T_E_M_P_L_A_T_E_T_E_S_T_C_L_A_S_S_ ), INTERNAL_CATCH_UNIQUE_NAME( C_A_T_C_H_T_E_M_P_L_A_T_E_T_E_S_T_ ) , ClassName, Name, Tags, Signature, __VA_ARGS__ ) )\n    #endif\n#endif\n\n    ///////////////////////////////////////////////////////////////////////////////\n    #define INTERNAL_CATCH_TESTCASE2( TestName, ... ) \\\n        static void TestName(); \\\n        CATCH_INTERNAL_START_WARNINGS_SUPPRESSION \\\n        CATCH_INTERNAL_SUPPRESS_GLOBALS_WARNINGS \\\n        namespace{ Catch::AutoReg INTERNAL_CATCH_UNIQUE_NAME( autoRegistrar )( Catch::makeTestInvoker( &TestName ), CATCH_INTERNAL_LINEINFO, Catch::StringRef(), Catch::NameAndTags{ __VA_ARGS__ } ); } /* NOLINT */ \\\n        CATCH_INTERNAL_STOP_WARNINGS_SUPPRESSION \\\n        static void TestName()\n    #define INTERNAL_CATCH_TESTCASE( ... ) \\\n        INTERNAL_CATCH_TESTCASE2( INTERNAL_CATCH_UNIQUE_NAME( C_A_T_C_H_T_E_S_T_ ), __VA_ARGS__ )\n\n    ///////////////////////////////////////////////////////////////////////////////\n    #define INTERNAL_CATCH_METHOD_AS_TEST_CASE( QualifiedMethod, ... ) \\\n        CATCH_INTERNAL_START_WARNINGS_SUPPRESSION \\\n        CATCH_INTERNAL_SUPPRESS_GLOBALS_WARNINGS \\\n        namespace{ Catch::AutoReg INTERNAL_CATCH_UNIQUE_NAME( autoRegistrar )( Catch::makeTestInvoker( &QualifiedMethod ), CATCH_INTERNAL_LINEINFO, \"&\" #QualifiedMethod, Catch::NameAndTags{ __VA_ARGS__ } ); } /* NOLINT */ \\\n        CATCH_INTERNAL_STOP_WARNINGS_SUPPRESSION\n\n    ///////////////////////////////////////////////////////////////////////////////\n    #define INTERNAL_CATCH_TEST_CASE_METHOD2( TestName, ClassName, ... )\\\n        CATCH_INTERNAL_START_WARNINGS_SUPPRESSION \\\n        CATCH_INTERNAL_SUPPRESS_GLOBALS_WARNINGS \\\n        namespace{ \\\n            struct TestName : INTERNAL_CATCH_REMOVE_PARENS(ClassName) { \\\n                void test(); \\\n            }; \\\n            Catch::AutoReg INTERNAL_CATCH_UNIQUE_NAME( autoRegistrar ) ( Catch::makeTestInvoker( &TestName::test ), CATCH_INTERNAL_LINEINFO, #ClassName, Catch::NameAndTags{ __VA_ARGS__ } ); /* NOLINT */ \\\n        } \\\n        CATCH_INTERNAL_STOP_WARNINGS_SUPPRESSION \\\n        void TestName::test()\n    #define INTERNAL_CATCH_TEST_CASE_METHOD( ClassName, ... ) \\\n        INTERNAL_CATCH_TEST_CASE_METHOD2( INTERNAL_CATCH_UNIQUE_NAME( C_A_T_C_H_T_E_S_T_ ), ClassName, __VA_ARGS__ )\n\n    ///////////////////////////////////////////////////////////////////////////////\n    #define INTERNAL_CATCH_REGISTER_TESTCASE( Function, ... ) \\\n        CATCH_INTERNAL_START_WARNINGS_SUPPRESSION \\\n        CATCH_INTERNAL_SUPPRESS_GLOBALS_WARNINGS \\\n        Catch::AutoReg INTERNAL_CATCH_UNIQUE_NAME( autoRegistrar )( Catch::makeTestInvoker( Function ), CATCH_INTERNAL_LINEINFO, Catch::StringRef(), Catch::NameAndTags{ __VA_ARGS__ } ); /* NOLINT */ \\\n        CATCH_INTERNAL_STOP_WARNINGS_SUPPRESSION\n\n    ///////////////////////////////////////////////////////////////////////////////\n    #define INTERNAL_CATCH_TEMPLATE_TEST_CASE_2(TestName, TestFunc, Name, Tags, Signature, ... )\\\n        CATCH_INTERNAL_START_WARNINGS_SUPPRESSION \\\n        CATCH_INTERNAL_SUPPRESS_GLOBALS_WARNINGS \\\n        CATCH_INTERNAL_SUPPRESS_ZERO_VARIADIC_WARNINGS \\\n        CATCH_INTERNAL_SUPPRESS_UNUSED_TEMPLATE_WARNINGS \\\n        INTERNAL_CATCH_DECLARE_SIG_TEST(TestFunc, INTERNAL_CATCH_REMOVE_PARENS(Signature));\\\n        namespace {\\\n        namespace INTERNAL_CATCH_MAKE_NAMESPACE(TestName){\\\n            INTERNAL_CATCH_TYPE_GEN\\\n            INTERNAL_CATCH_NTTP_GEN(INTERNAL_CATCH_REMOVE_PARENS(Signature))\\\n            INTERNAL_CATCH_NTTP_REG_GEN(TestFunc,INTERNAL_CATCH_REMOVE_PARENS(Signature))\\\n            template<typename...Types> \\\n            struct TestName{\\\n                TestName(){\\\n                    int index = 0;                                    \\\n                    constexpr char const* tmpl_types[] = {CATCH_REC_LIST(INTERNAL_CATCH_STRINGIZE_WITHOUT_PARENS, __VA_ARGS__)};\\\n                    using expander = int[];\\\n                    (void)expander{(reg_test(Types{}, Catch::NameAndTags{ Name \" - \" + std::string(tmpl_types[index]), Tags } ), index++)... };/* NOLINT */ \\\n                }\\\n            };\\\n            static int INTERNAL_CATCH_UNIQUE_NAME( globalRegistrar ) = [](){\\\n            TestName<INTERNAL_CATCH_MAKE_TYPE_LISTS_FROM_TYPES(__VA_ARGS__)>();\\\n            return 0;\\\n        }();\\\n        }\\\n        }\\\n        CATCH_INTERNAL_STOP_WARNINGS_SUPPRESSION \\\n        INTERNAL_CATCH_DEFINE_SIG_TEST(TestFunc,INTERNAL_CATCH_REMOVE_PARENS(Signature))\n\n#ifndef CATCH_CONFIG_TRADITIONAL_MSVC_PREPROCESSOR\n    #define INTERNAL_CATCH_TEMPLATE_TEST_CASE(Name, Tags, ...) \\\n        INTERNAL_CATCH_TEMPLATE_TEST_CASE_2( INTERNAL_CATCH_UNIQUE_NAME( C_A_T_C_H_T_E_M_P_L_A_T_E_T_E_S_T_ ), INTERNAL_CATCH_UNIQUE_NAME( C_A_T_C_H_T_E_M_P_L_A_T_E_T_E_S_T_F_U_N_C_ ), Name, Tags, typename TestType, __VA_ARGS__ )\n#else\n    #define INTERNAL_CATCH_TEMPLATE_TEST_CASE(Name, Tags, ...) \\\n        INTERNAL_CATCH_EXPAND_VARGS( INTERNAL_CATCH_TEMPLATE_TEST_CASE_2( INTERNAL_CATCH_UNIQUE_NAME( C_A_T_C_H_T_E_M_P_L_A_T_E_T_E_S_T_ ), INTERNAL_CATCH_UNIQUE_NAME( C_A_T_C_H_T_E_M_P_L_A_T_E_T_E_S_T_F_U_N_C_ ), Name, Tags, typename TestType, __VA_ARGS__ ) )\n#endif\n\n#ifndef CATCH_CONFIG_TRADITIONAL_MSVC_PREPROCESSOR\n    #define INTERNAL_CATCH_TEMPLATE_TEST_CASE_SIG(Name, Tags, Signature, ...) \\\n        INTERNAL_CATCH_TEMPLATE_TEST_CASE_2( INTERNAL_CATCH_UNIQUE_NAME( C_A_T_C_H_T_E_M_P_L_A_T_E_T_E_S_T_ ), INTERNAL_CATCH_UNIQUE_NAME( C_A_T_C_H_T_E_M_P_L_A_T_E_T_E_S_T_F_U_N_C_ ), Name, Tags, Signature, __VA_ARGS__ )\n#else\n    #define INTERNAL_CATCH_TEMPLATE_TEST_CASE_SIG(Name, Tags, Signature, ...) \\\n        INTERNAL_CATCH_EXPAND_VARGS( INTERNAL_CATCH_TEMPLATE_TEST_CASE_2( INTERNAL_CATCH_UNIQUE_NAME( C_A_T_C_H_T_E_M_P_L_A_T_E_T_E_S_T_ ), INTERNAL_CATCH_UNIQUE_NAME( C_A_T_C_H_T_E_M_P_L_A_T_E_T_E_S_T_F_U_N_C_ ), Name, Tags, Signature, __VA_ARGS__ ) )\n#endif\n\n    #define INTERNAL_CATCH_TEMPLATE_PRODUCT_TEST_CASE2(TestName, TestFuncName, Name, Tags, Signature, TmplTypes, TypesList) \\\n        CATCH_INTERNAL_START_WARNINGS_SUPPRESSION                      \\\n        CATCH_INTERNAL_SUPPRESS_GLOBALS_WARNINGS                      \\\n        CATCH_INTERNAL_SUPPRESS_ZERO_VARIADIC_WARNINGS                \\\n        CATCH_INTERNAL_SUPPRESS_UNUSED_TEMPLATE_WARNINGS              \\\n        template<typename TestType> static void TestFuncName();       \\\n        namespace {\\\n        namespace INTERNAL_CATCH_MAKE_NAMESPACE(TestName) {                                     \\\n            INTERNAL_CATCH_TYPE_GEN                                                  \\\n            INTERNAL_CATCH_NTTP_GEN(INTERNAL_CATCH_REMOVE_PARENS(Signature))         \\\n            template<typename... Types>                               \\\n            struct TestName {                                         \\\n                void reg_tests() {                                          \\\n                    int index = 0;                                    \\\n                    using expander = int[];                           \\\n                    constexpr char const* tmpl_types[] = {CATCH_REC_LIST(INTERNAL_CATCH_STRINGIZE_WITHOUT_PARENS, INTERNAL_CATCH_REMOVE_PARENS(TmplTypes))};\\\n                    constexpr char const* types_list[] = {CATCH_REC_LIST(INTERNAL_CATCH_STRINGIZE_WITHOUT_PARENS, INTERNAL_CATCH_REMOVE_PARENS(TypesList))};\\\n                    constexpr auto num_types = sizeof(types_list) / sizeof(types_list[0]);\\\n                    (void)expander{(Catch::AutoReg( Catch::makeTestInvoker( &TestFuncName<Types> ), CATCH_INTERNAL_LINEINFO, Catch::StringRef(), Catch::NameAndTags{ Name \" - \" + std::string(tmpl_types[index / num_types]) + \"<\" + std::string(types_list[index % num_types]) + \">\", Tags } ), index++)... };/* NOLINT */\\\n                }                                                     \\\n            };                                                        \\\n            static int INTERNAL_CATCH_UNIQUE_NAME( globalRegistrar ) = [](){ \\\n                using TestInit = typename create<TestName, decltype(get_wrapper<INTERNAL_CATCH_REMOVE_PARENS(TmplTypes)>()), TypeList<INTERNAL_CATCH_MAKE_TYPE_LISTS_FROM_TYPES(INTERNAL_CATCH_REMOVE_PARENS(TypesList))>>::type; \\\n                TestInit t;                                           \\\n                t.reg_tests();                                        \\\n                return 0;                                             \\\n            }();                                                      \\\n        }                                                             \\\n        }                                                             \\\n        CATCH_INTERNAL_STOP_WARNINGS_SUPPRESSION                       \\\n        template<typename TestType>                                   \\\n        static void TestFuncName()\n\n#ifndef CATCH_CONFIG_TRADITIONAL_MSVC_PREPROCESSOR\n    #define INTERNAL_CATCH_TEMPLATE_PRODUCT_TEST_CASE(Name, Tags, ...)\\\n        INTERNAL_CATCH_TEMPLATE_PRODUCT_TEST_CASE2(INTERNAL_CATCH_UNIQUE_NAME( C_A_T_C_H_T_E_M_P_L_A_T_E_T_E_S_T_ ), INTERNAL_CATCH_UNIQUE_NAME( C_A_T_C_H_T_E_M_P_L_A_T_E_T_E_S_T_F_U_N_C_ ), Name, Tags, typename T,__VA_ARGS__)\n#else\n    #define INTERNAL_CATCH_TEMPLATE_PRODUCT_TEST_CASE(Name, Tags, ...)\\\n        INTERNAL_CATCH_EXPAND_VARGS( INTERNAL_CATCH_TEMPLATE_PRODUCT_TEST_CASE2( INTERNAL_CATCH_UNIQUE_NAME( C_A_T_C_H_T_E_M_P_L_A_T_E_T_E_S_T_ ), INTERNAL_CATCH_UNIQUE_NAME( C_A_T_C_H_T_E_M_P_L_A_T_E_T_E_S_T_F_U_N_C_ ), Name, Tags, typename T, __VA_ARGS__ ) )\n#endif\n\n#ifndef CATCH_CONFIG_TRADITIONAL_MSVC_PREPROCESSOR\n    #define INTERNAL_CATCH_TEMPLATE_PRODUCT_TEST_CASE_SIG(Name, Tags, Signature, ...)\\\n        INTERNAL_CATCH_TEMPLATE_PRODUCT_TEST_CASE2(INTERNAL_CATCH_UNIQUE_NAME( C_A_T_C_H_T_E_M_P_L_A_T_E_T_E_S_T_ ), INTERNAL_CATCH_UNIQUE_NAME( C_A_T_C_H_T_E_M_P_L_A_T_E_T_E_S_T_F_U_N_C_ ), Name, Tags, Signature, __VA_ARGS__)\n#else\n    #define INTERNAL_CATCH_TEMPLATE_PRODUCT_TEST_CASE_SIG(Name, Tags, Signature, ...)\\\n        INTERNAL_CATCH_EXPAND_VARGS( INTERNAL_CATCH_TEMPLATE_PRODUCT_TEST_CASE2( INTERNAL_CATCH_UNIQUE_NAME( C_A_T_C_H_T_E_M_P_L_A_T_E_T_E_S_T_ ), INTERNAL_CATCH_UNIQUE_NAME( C_A_T_C_H_T_E_M_P_L_A_T_E_T_E_S_T_F_U_N_C_ ), Name, Tags, Signature, __VA_ARGS__ ) )\n#endif\n\n    #define INTERNAL_CATCH_TEMPLATE_LIST_TEST_CASE_2(TestName, TestFunc, Name, Tags, TmplList)\\\n        CATCH_INTERNAL_START_WARNINGS_SUPPRESSION \\\n        CATCH_INTERNAL_SUPPRESS_GLOBALS_WARNINGS \\\n        CATCH_INTERNAL_SUPPRESS_UNUSED_TEMPLATE_WARNINGS \\\n        template<typename TestType> static void TestFunc();       \\\n        namespace {\\\n        namespace INTERNAL_CATCH_MAKE_NAMESPACE(TestName){\\\n        INTERNAL_CATCH_TYPE_GEN\\\n        template<typename... Types>                               \\\n        struct TestName {                                         \\\n            void reg_tests() {                                          \\\n                int index = 0;                                    \\\n                using expander = int[];                           \\\n                (void)expander{(Catch::AutoReg( Catch::makeTestInvoker( &TestFunc<Types> ), CATCH_INTERNAL_LINEINFO, Catch::StringRef(), Catch::NameAndTags{ Name \" - \" + std::string(INTERNAL_CATCH_STRINGIZE(TmplList)) + \" - \" + std::to_string(index), Tags } ), index++)... };/* NOLINT */\\\n            }                                                     \\\n        };\\\n        static int INTERNAL_CATCH_UNIQUE_NAME( globalRegistrar ) = [](){ \\\n                using TestInit = typename convert<TestName, TmplList>::type; \\\n                TestInit t;                                           \\\n                t.reg_tests();                                        \\\n                return 0;                                             \\\n            }();                                                      \\\n        }}\\\n        CATCH_INTERNAL_STOP_WARNINGS_SUPPRESSION                       \\\n        template<typename TestType>                                   \\\n        static void TestFunc()\n\n    #define INTERNAL_CATCH_TEMPLATE_LIST_TEST_CASE(Name, Tags, TmplList) \\\n        INTERNAL_CATCH_TEMPLATE_LIST_TEST_CASE_2( INTERNAL_CATCH_UNIQUE_NAME( C_A_T_C_H_T_E_M_P_L_A_T_E_T_E_S_T_ ), INTERNAL_CATCH_UNIQUE_NAME( C_A_T_C_H_T_E_M_P_L_A_T_E_T_E_S_T_F_U_N_C_ ), Name, Tags, TmplList )\n\n    #define INTERNAL_CATCH_TEMPLATE_TEST_CASE_METHOD_2( TestNameClass, TestName, ClassName, Name, Tags, Signature, ... ) \\\n        CATCH_INTERNAL_START_WARNINGS_SUPPRESSION \\\n        CATCH_INTERNAL_SUPPRESS_GLOBALS_WARNINGS \\\n        CATCH_INTERNAL_SUPPRESS_ZERO_VARIADIC_WARNINGS \\\n        CATCH_INTERNAL_SUPPRESS_UNUSED_TEMPLATE_WARNINGS \\\n        namespace {\\\n        namespace INTERNAL_CATCH_MAKE_NAMESPACE(TestName){ \\\n            INTERNAL_CATCH_TYPE_GEN\\\n            INTERNAL_CATCH_NTTP_GEN(INTERNAL_CATCH_REMOVE_PARENS(Signature))\\\n            INTERNAL_CATCH_DECLARE_SIG_TEST_METHOD(TestName, ClassName, INTERNAL_CATCH_REMOVE_PARENS(Signature));\\\n            INTERNAL_CATCH_NTTP_REG_METHOD_GEN(TestName, INTERNAL_CATCH_REMOVE_PARENS(Signature))\\\n            template<typename...Types> \\\n            struct TestNameClass{\\\n                TestNameClass(){\\\n                    int index = 0;                                    \\\n                    constexpr char const* tmpl_types[] = {CATCH_REC_LIST(INTERNAL_CATCH_STRINGIZE_WITHOUT_PARENS, __VA_ARGS__)};\\\n                    using expander = int[];\\\n                    (void)expander{(reg_test(Types{}, #ClassName, Catch::NameAndTags{ Name \" - \" + std::string(tmpl_types[index]), Tags } ), index++)... };/* NOLINT */ \\\n                }\\\n            };\\\n            static int INTERNAL_CATCH_UNIQUE_NAME( globalRegistrar ) = [](){\\\n                TestNameClass<INTERNAL_CATCH_MAKE_TYPE_LISTS_FROM_TYPES(__VA_ARGS__)>();\\\n                return 0;\\\n        }();\\\n        }\\\n        }\\\n        CATCH_INTERNAL_STOP_WARNINGS_SUPPRESSION \\\n        INTERNAL_CATCH_DEFINE_SIG_TEST_METHOD(TestName, INTERNAL_CATCH_REMOVE_PARENS(Signature))\n\n#ifndef CATCH_CONFIG_TRADITIONAL_MSVC_PREPROCESSOR\n    #define INTERNAL_CATCH_TEMPLATE_TEST_CASE_METHOD( ClassName, Name, Tags,... ) \\\n        INTERNAL_CATCH_TEMPLATE_TEST_CASE_METHOD_2( INTERNAL_CATCH_UNIQUE_NAME( C_A_T_C_H_T_E_M_P_L_A_T_E_T_E_S_T_C_L_A_S_S_ ), INTERNAL_CATCH_UNIQUE_NAME( C_A_T_C_H_T_E_M_P_L_A_T_E_T_E_S_T_ ) , ClassName, Name, Tags, typename T, __VA_ARGS__ )\n#else\n    #define INTERNAL_CATCH_TEMPLATE_TEST_CASE_METHOD( ClassName, Name, Tags,... ) \\\n        INTERNAL_CATCH_EXPAND_VARGS( INTERNAL_CATCH_TEMPLATE_TEST_CASE_METHOD_2( INTERNAL_CATCH_UNIQUE_NAME( C_A_T_C_H_T_E_M_P_L_A_T_E_T_E_S_T_C_L_A_S_S_ ), INTERNAL_CATCH_UNIQUE_NAME( C_A_T_C_H_T_E_M_P_L_A_T_E_T_E_S_T_ ) , ClassName, Name, Tags, typename T, __VA_ARGS__ ) )\n#endif\n\n#ifndef CATCH_CONFIG_TRADITIONAL_MSVC_PREPROCESSOR\n    #define INTERNAL_CATCH_TEMPLATE_TEST_CASE_METHOD_SIG( ClassName, Name, Tags, Signature, ... ) \\\n        INTERNAL_CATCH_TEMPLATE_TEST_CASE_METHOD_2( INTERNAL_CATCH_UNIQUE_NAME( C_A_T_C_H_T_E_M_P_L_A_T_E_T_E_S_T_C_L_A_S_S_ ), INTERNAL_CATCH_UNIQUE_NAME( C_A_T_C_H_T_E_M_P_L_A_T_E_T_E_S_T_ ) , ClassName, Name, Tags, Signature, __VA_ARGS__ )\n#else\n    #define INTERNAL_CATCH_TEMPLATE_TEST_CASE_METHOD_SIG( ClassName, Name, Tags, Signature, ... ) \\\n        INTERNAL_CATCH_EXPAND_VARGS( INTERNAL_CATCH_TEMPLATE_TEST_CASE_METHOD_2( INTERNAL_CATCH_UNIQUE_NAME( C_A_T_C_H_T_E_M_P_L_A_T_E_T_E_S_T_C_L_A_S_S_ ), INTERNAL_CATCH_UNIQUE_NAME( C_A_T_C_H_T_E_M_P_L_A_T_E_T_E_S_T_ ) , ClassName, Name, Tags, Signature, __VA_ARGS__ ) )\n#endif\n\n    #define INTERNAL_CATCH_TEMPLATE_PRODUCT_TEST_CASE_METHOD_2(TestNameClass, TestName, ClassName, Name, Tags, Signature, TmplTypes, TypesList)\\\n        CATCH_INTERNAL_START_WARNINGS_SUPPRESSION \\\n        CATCH_INTERNAL_SUPPRESS_GLOBALS_WARNINGS \\\n        CATCH_INTERNAL_SUPPRESS_ZERO_VARIADIC_WARNINGS \\\n        CATCH_INTERNAL_SUPPRESS_UNUSED_TEMPLATE_WARNINGS \\\n        template<typename TestType> \\\n            struct TestName : INTERNAL_CATCH_REMOVE_PARENS(ClassName <TestType>) { \\\n                void test();\\\n            };\\\n        namespace {\\\n        namespace INTERNAL_CATCH_MAKE_NAMESPACE(TestNameClass) {\\\n            INTERNAL_CATCH_TYPE_GEN                  \\\n            INTERNAL_CATCH_NTTP_GEN(INTERNAL_CATCH_REMOVE_PARENS(Signature))\\\n            template<typename...Types>\\\n            struct TestNameClass{\\\n                void reg_tests(){\\\n                    int index = 0;\\\n                    using expander = int[];\\\n                    constexpr char const* tmpl_types[] = {CATCH_REC_LIST(INTERNAL_CATCH_STRINGIZE_WITHOUT_PARENS, INTERNAL_CATCH_REMOVE_PARENS(TmplTypes))};\\\n                    constexpr char const* types_list[] = {CATCH_REC_LIST(INTERNAL_CATCH_STRINGIZE_WITHOUT_PARENS, INTERNAL_CATCH_REMOVE_PARENS(TypesList))};\\\n                    constexpr auto num_types = sizeof(types_list) / sizeof(types_list[0]);\\\n                    (void)expander{(Catch::AutoReg( Catch::makeTestInvoker( &TestName<Types>::test ), CATCH_INTERNAL_LINEINFO, #ClassName, Catch::NameAndTags{ Name \" - \" + std::string(tmpl_types[index / num_types]) + \"<\" + std::string(types_list[index % num_types]) + \">\", Tags } ), index++)... };/* NOLINT */ \\\n                }\\\n            };\\\n            static int INTERNAL_CATCH_UNIQUE_NAME( globalRegistrar ) = [](){\\\n                using TestInit = typename create<TestNameClass, decltype(get_wrapper<INTERNAL_CATCH_REMOVE_PARENS(TmplTypes)>()), TypeList<INTERNAL_CATCH_MAKE_TYPE_LISTS_FROM_TYPES(INTERNAL_CATCH_REMOVE_PARENS(TypesList))>>::type;\\\n                TestInit t;\\\n                t.reg_tests();\\\n                return 0;\\\n            }(); \\\n        }\\\n        }\\\n        CATCH_INTERNAL_STOP_WARNINGS_SUPPRESSION \\\n        template<typename TestType> \\\n        void TestName<TestType>::test()\n\n#ifndef CATCH_CONFIG_TRADITIONAL_MSVC_PREPROCESSOR\n    #define INTERNAL_CATCH_TEMPLATE_PRODUCT_TEST_CASE_METHOD( ClassName, Name, Tags, ... )\\\n        INTERNAL_CATCH_TEMPLATE_PRODUCT_TEST_CASE_METHOD_2( INTERNAL_CATCH_UNIQUE_NAME( C_A_T_C_H_T_E_M_P_L_A_T_E_T_E_S_T_ ), INTERNAL_CATCH_UNIQUE_NAME( C_A_T_C_H_T_E_M_P_L_A_T_E_T_E_S_T_F_U_N_C_ ), ClassName, Name, Tags, typename T, __VA_ARGS__ )\n#else\n    #define INTERNAL_CATCH_TEMPLATE_PRODUCT_TEST_CASE_METHOD( ClassName, Name, Tags, ... )\\\n        INTERNAL_CATCH_EXPAND_VARGS( INTERNAL_CATCH_TEMPLATE_PRODUCT_TEST_CASE_METHOD_2( INTERNAL_CATCH_UNIQUE_NAME( C_A_T_C_H_T_E_M_P_L_A_T_E_T_E_S_T_ ), INTERNAL_CATCH_UNIQUE_NAME( C_A_T_C_H_T_E_M_P_L_A_T_E_T_E_S_T_F_U_N_C_ ), ClassName, Name, Tags, typename T,__VA_ARGS__ ) )\n#endif\n\n#ifndef CATCH_CONFIG_TRADITIONAL_MSVC_PREPROCESSOR\n    #define INTERNAL_CATCH_TEMPLATE_PRODUCT_TEST_CASE_METHOD_SIG( ClassName, Name, Tags, Signature, ... )\\\n        INTERNAL_CATCH_TEMPLATE_PRODUCT_TEST_CASE_METHOD_2( INTERNAL_CATCH_UNIQUE_NAME( C_A_T_C_H_T_E_M_P_L_A_T_E_T_E_S_T_ ), INTERNAL_CATCH_UNIQUE_NAME( C_A_T_C_H_T_E_M_P_L_A_T_E_T_E_S_T_F_U_N_C_ ), ClassName, Name, Tags, Signature, __VA_ARGS__ )\n#else\n    #define INTERNAL_CATCH_TEMPLATE_PRODUCT_TEST_CASE_METHOD_SIG( ClassName, Name, Tags, Signature, ... )\\\n        INTERNAL_CATCH_EXPAND_VARGS( INTERNAL_CATCH_TEMPLATE_PRODUCT_TEST_CASE_METHOD_2( INTERNAL_CATCH_UNIQUE_NAME( C_A_T_C_H_T_E_M_P_L_A_T_E_T_E_S_T_ ), INTERNAL_CATCH_UNIQUE_NAME( C_A_T_C_H_T_E_M_P_L_A_T_E_T_E_S_T_F_U_N_C_ ), ClassName, Name, Tags, Signature,__VA_ARGS__ ) )\n#endif\n\n    #define INTERNAL_CATCH_TEMPLATE_LIST_TEST_CASE_METHOD_2( TestNameClass, TestName, ClassName, Name, Tags, TmplList) \\\n        CATCH_INTERNAL_START_WARNINGS_SUPPRESSION \\\n        CATCH_INTERNAL_SUPPRESS_GLOBALS_WARNINGS \\\n        CATCH_INTERNAL_SUPPRESS_UNUSED_TEMPLATE_WARNINGS \\\n        template<typename TestType> \\\n        struct TestName : INTERNAL_CATCH_REMOVE_PARENS(ClassName <TestType>) { \\\n            void test();\\\n        };\\\n        namespace {\\\n        namespace INTERNAL_CATCH_MAKE_NAMESPACE(TestName){ \\\n            INTERNAL_CATCH_TYPE_GEN\\\n            template<typename...Types>\\\n            struct TestNameClass{\\\n                void reg_tests(){\\\n                    int index = 0;\\\n                    using expander = int[];\\\n                    (void)expander{(Catch::AutoReg( Catch::makeTestInvoker( &TestName<Types>::test ), CATCH_INTERNAL_LINEINFO, #ClassName, Catch::NameAndTags{ Name \" - \" + std::string(INTERNAL_CATCH_STRINGIZE(TmplList)) + \" - \" + std::to_string(index), Tags } ), index++)... };/* NOLINT */ \\\n                }\\\n            };\\\n            static int INTERNAL_CATCH_UNIQUE_NAME( globalRegistrar ) = [](){\\\n                using TestInit = typename convert<TestNameClass, TmplList>::type;\\\n                TestInit t;\\\n                t.reg_tests();\\\n                return 0;\\\n            }(); \\\n        }}\\\n        CATCH_INTERNAL_STOP_WARNINGS_SUPPRESSION \\\n        template<typename TestType> \\\n        void TestName<TestType>::test()\n\n#define INTERNAL_CATCH_TEMPLATE_LIST_TEST_CASE_METHOD(ClassName, Name, Tags, TmplList) \\\n        INTERNAL_CATCH_TEMPLATE_LIST_TEST_CASE_METHOD_2( INTERNAL_CATCH_UNIQUE_NAME( C_A_T_C_H_T_E_M_P_L_A_T_E_T_E_S_T_ ), INTERNAL_CATCH_UNIQUE_NAME( C_A_T_C_H_T_E_M_P_L_A_T_E_T_E_S_T_F_U_N_C_ ), ClassName, Name, Tags, TmplList )\n\n// end catch_test_registry.h\n// start catch_capture.hpp\n\n// start catch_assertionhandler.h\n\n// start catch_assertioninfo.h\n\n// start catch_result_type.h\n\nnamespace Catch {\n\n    // ResultWas::OfType enum\n    struct ResultWas { enum OfType {\n        Unknown = -1,\n        Ok = 0,\n        Info = 1,\n        Warning = 2,\n\n        FailureBit = 0x10,\n\n        ExpressionFailed = FailureBit | 1,\n        ExplicitFailure = FailureBit | 2,\n\n        Exception = 0x100 | FailureBit,\n\n        ThrewException = Exception | 1,\n        DidntThrowException = Exception | 2,\n\n        FatalErrorCondition = 0x200 | FailureBit\n\n    }; };\n\n    bool isOk( ResultWas::OfType resultType );\n    bool isJustInfo( int flags );\n\n    // ResultDisposition::Flags enum\n    struct ResultDisposition { enum Flags {\n        Normal = 0x01,\n\n        ContinueOnFailure = 0x02,   // Failures fail test, but execution continues\n        FalseTest = 0x04,           // Prefix expression with !\n        SuppressFail = 0x08         // Failures are reported but do not fail the test\n    }; };\n\n    ResultDisposition::Flags operator | ( ResultDisposition::Flags lhs, ResultDisposition::Flags rhs );\n\n    bool shouldContinueOnFailure( int flags );\n    inline bool isFalseTest( int flags ) { return ( flags & ResultDisposition::FalseTest ) != 0; }\n    bool shouldSuppressFailure( int flags );\n\n} // end namespace Catch\n\n// end catch_result_type.h\nnamespace Catch {\n\n    struct AssertionInfo\n    {\n        StringRef macroName;\n        SourceLineInfo lineInfo;\n        StringRef capturedExpression;\n        ResultDisposition::Flags resultDisposition;\n\n        // We want to delete this constructor but a compiler bug in 4.8 means\n        // the struct is then treated as non-aggregate\n        //AssertionInfo() = delete;\n    };\n\n} // end namespace Catch\n\n// end catch_assertioninfo.h\n// start catch_decomposer.h\n\n// start catch_tostring.h\n\n#include <vector>\n#include <cstddef>\n#include <type_traits>\n#include <string>\n// start catch_stream.h\n\n#include <iosfwd>\n#include <cstddef>\n#include <ostream>\n\nnamespace Catch {\n\n    std::ostream& cout();\n    std::ostream& cerr();\n    std::ostream& clog();\n\n    class StringRef;\n\n    struct IStream {\n        virtual ~IStream();\n        virtual std::ostream& stream() const = 0;\n    };\n\n    auto makeStream( StringRef const &filename ) -> IStream const*;\n\n    class ReusableStringStream : NonCopyable {\n        std::size_t m_index;\n        std::ostream* m_oss;\n    public:\n        ReusableStringStream();\n        ~ReusableStringStream();\n\n        auto str() const -> std::string;\n\n        template<typename T>\n        auto operator << ( T const& value ) -> ReusableStringStream& {\n            *m_oss << value;\n            return *this;\n        }\n        auto get() -> std::ostream& { return *m_oss; }\n    };\n}\n\n// end catch_stream.h\n// start catch_interfaces_enum_values_registry.h\n\n#include <vector>\n\nnamespace Catch {\n\n    namespace Detail {\n        struct EnumInfo {\n            StringRef m_name;\n            std::vector<std::pair<int, StringRef>> m_values;\n\n            ~EnumInfo();\n\n            StringRef lookup( int value ) const;\n        };\n    } // namespace Detail\n\n    struct IMutableEnumValuesRegistry {\n        virtual ~IMutableEnumValuesRegistry();\n\n        virtual Detail::EnumInfo const& registerEnum( StringRef enumName, StringRef allEnums, std::vector<int> const& values ) = 0;\n\n        template<typename E>\n        Detail::EnumInfo const& registerEnum( StringRef enumName, StringRef allEnums, std::initializer_list<E> values ) {\n            static_assert(sizeof(int) >= sizeof(E), \"Cannot serialize enum to int\");\n            std::vector<int> intValues;\n            intValues.reserve( values.size() );\n            for( auto enumValue : values )\n                intValues.push_back( static_cast<int>( enumValue ) );\n            return registerEnum( enumName, allEnums, intValues );\n        }\n    };\n\n} // Catch\n\n// end catch_interfaces_enum_values_registry.h\n\n#ifdef CATCH_CONFIG_CPP17_STRING_VIEW\n#include <string_view>\n#endif\n\n#ifdef __OBJC__\n// start catch_objc_arc.hpp\n\n#import <Foundation/Foundation.h>\n\n#ifdef __has_feature\n#define CATCH_ARC_ENABLED __has_feature(objc_arc)\n#else\n#define CATCH_ARC_ENABLED 0\n#endif\n\nvoid arcSafeRelease( NSObject* obj );\nid performOptionalSelector( id obj, SEL sel );\n\n#if !CATCH_ARC_ENABLED\ninline void arcSafeRelease( NSObject* obj ) {\n    [obj release];\n}\ninline id performOptionalSelector( id obj, SEL sel ) {\n    if( [obj respondsToSelector: sel] )\n        return [obj performSelector: sel];\n    return nil;\n}\n#define CATCH_UNSAFE_UNRETAINED\n#define CATCH_ARC_STRONG\n#else\ninline void arcSafeRelease( NSObject* ){}\ninline id performOptionalSelector( id obj, SEL sel ) {\n#ifdef __clang__\n#pragma clang diagnostic push\n#pragma clang diagnostic ignored \"-Warc-performSelector-leaks\"\n#endif\n    if( [obj respondsToSelector: sel] )\n        return [obj performSelector: sel];\n#ifdef __clang__\n#pragma clang diagnostic pop\n#endif\n    return nil;\n}\n#define CATCH_UNSAFE_UNRETAINED __unsafe_unretained\n#define CATCH_ARC_STRONG __strong\n#endif\n\n// end catch_objc_arc.hpp\n#endif\n\n#ifdef _MSC_VER\n#pragma warning(push)\n#pragma warning(disable:4180) // We attempt to stream a function (address) by const&, which MSVC complains about but is harmless\n#endif\n\nnamespace Catch {\n    namespace Detail {\n\n        extern const std::string unprintableString;\n\n        std::string rawMemoryToString( const void *object, std::size_t size );\n\n        template<typename T>\n        std::string rawMemoryToString( const T& object ) {\n          return rawMemoryToString( &object, sizeof(object) );\n        }\n\n        template<typename T>\n        class IsStreamInsertable {\n            template<typename Stream, typename U>\n            static auto test(int)\n                -> decltype(std::declval<Stream&>() << std::declval<U>(), std::true_type());\n\n            template<typename, typename>\n            static auto test(...)->std::false_type;\n\n        public:\n            static const bool value = decltype(test<std::ostream, const T&>(0))::value;\n        };\n\n        template<typename E>\n        std::string convertUnknownEnumToString( E e );\n\n        template<typename T>\n        typename std::enable_if<\n            !std::is_enum<T>::value && !std::is_base_of<std::exception, T>::value,\n        std::string>::type convertUnstreamable( T const& ) {\n            return Detail::unprintableString;\n        }\n        template<typename T>\n        typename std::enable_if<\n            !std::is_enum<T>::value && std::is_base_of<std::exception, T>::value,\n         std::string>::type convertUnstreamable(T const& ex) {\n            return ex.what();\n        }\n\n        template<typename T>\n        typename std::enable_if<\n            std::is_enum<T>::value\n        , std::string>::type convertUnstreamable( T const& value ) {\n            return convertUnknownEnumToString( value );\n        }\n\n#if defined(_MANAGED)\n        //! Convert a CLR string to a utf8 std::string\n        template<typename T>\n        std::string clrReferenceToString( T^ ref ) {\n            if (ref == nullptr)\n                return std::string(\"null\");\n            auto bytes = System::Text::Encoding::UTF8->GetBytes(ref->ToString());\n            cli::pin_ptr<System::Byte> p = &bytes[0];\n            return std::string(reinterpret_cast<char const *>(p), bytes->Length);\n        }\n#endif\n\n    } // namespace Detail\n\n    // If we decide for C++14, change these to enable_if_ts\n    template <typename T, typename = void>\n    struct StringMaker {\n        template <typename Fake = T>\n        static\n        typename std::enable_if<::Catch::Detail::IsStreamInsertable<Fake>::value, std::string>::type\n            convert(const Fake& value) {\n                ReusableStringStream rss;\n                // NB: call using the function-like syntax to avoid ambiguity with\n                // user-defined templated operator<< under clang.\n                rss.operator<<(value);\n                return rss.str();\n        }\n\n        template <typename Fake = T>\n        static\n        typename std::enable_if<!::Catch::Detail::IsStreamInsertable<Fake>::value, std::string>::type\n            convert( const Fake& value ) {\n#if !defined(CATCH_CONFIG_FALLBACK_STRINGIFIER)\n            return Detail::convertUnstreamable(value);\n#else\n            return CATCH_CONFIG_FALLBACK_STRINGIFIER(value);\n#endif\n        }\n    };\n\n    namespace Detail {\n\n        // This function dispatches all stringification requests inside of Catch.\n        // Should be preferably called fully qualified, like ::Catch::Detail::stringify\n        template <typename T>\n        std::string stringify(const T& e) {\n            return ::Catch::StringMaker<typename std::remove_cv<typename std::remove_reference<T>::type>::type>::convert(e);\n        }\n\n        template<typename E>\n        std::string convertUnknownEnumToString( E e ) {\n            return ::Catch::Detail::stringify(static_cast<typename std::underlying_type<E>::type>(e));\n        }\n\n#if defined(_MANAGED)\n        template <typename T>\n        std::string stringify( T^ e ) {\n            return ::Catch::StringMaker<T^>::convert(e);\n        }\n#endif\n\n    } // namespace Detail\n\n    // Some predefined specializations\n\n    template<>\n    struct StringMaker<std::string> {\n        static std::string convert(const std::string& str);\n    };\n\n#ifdef CATCH_CONFIG_CPP17_STRING_VIEW\n    template<>\n    struct StringMaker<std::string_view> {\n        static std::string convert(std::string_view str);\n    };\n#endif\n\n    template<>\n    struct StringMaker<char const *> {\n        static std::string convert(char const * str);\n    };\n    template<>\n    struct StringMaker<char *> {\n        static std::string convert(char * str);\n    };\n\n#ifdef CATCH_CONFIG_WCHAR\n    template<>\n    struct StringMaker<std::wstring> {\n        static std::string convert(const std::wstring& wstr);\n    };\n\n# ifdef CATCH_CONFIG_CPP17_STRING_VIEW\n    template<>\n    struct StringMaker<std::wstring_view> {\n        static std::string convert(std::wstring_view str);\n    };\n# endif\n\n    template<>\n    struct StringMaker<wchar_t const *> {\n        static std::string convert(wchar_t const * str);\n    };\n    template<>\n    struct StringMaker<wchar_t *> {\n        static std::string convert(wchar_t * str);\n    };\n#endif\n\n    // TBD: Should we use `strnlen` to ensure that we don't go out of the buffer,\n    //      while keeping string semantics?\n    template<int SZ>\n    struct StringMaker<char[SZ]> {\n        static std::string convert(char const* str) {\n            return ::Catch::Detail::stringify(std::string{ str });\n        }\n    };\n    template<int SZ>\n    struct StringMaker<signed char[SZ]> {\n        static std::string convert(signed char const* str) {\n            return ::Catch::Detail::stringify(std::string{ reinterpret_cast<char const *>(str) });\n        }\n    };\n    template<int SZ>\n    struct StringMaker<unsigned char[SZ]> {\n        static std::string convert(unsigned char const* str) {\n            return ::Catch::Detail::stringify(std::string{ reinterpret_cast<char const *>(str) });\n        }\n    };\n\n#if defined(CATCH_CONFIG_CPP17_BYTE)\n    template<>\n    struct StringMaker<std::byte> {\n        static std::string convert(std::byte value);\n    };\n#endif // defined(CATCH_CONFIG_CPP17_BYTE)\n    template<>\n    struct StringMaker<int> {\n        static std::string convert(int value);\n    };\n    template<>\n    struct StringMaker<long> {\n        static std::string convert(long value);\n    };\n    template<>\n    struct StringMaker<long long> {\n        static std::string convert(long long value);\n    };\n    template<>\n    struct StringMaker<unsigned int> {\n        static std::string convert(unsigned int value);\n    };\n    template<>\n    struct StringMaker<unsigned long> {\n        static std::string convert(unsigned long value);\n    };\n    template<>\n    struct StringMaker<unsigned long long> {\n        static std::string convert(unsigned long long value);\n    };\n\n    template<>\n    struct StringMaker<bool> {\n        static std::string convert(bool b);\n    };\n\n    template<>\n    struct StringMaker<char> {\n        static std::string convert(char c);\n    };\n    template<>\n    struct StringMaker<signed char> {\n        static std::string convert(signed char c);\n    };\n    template<>\n    struct StringMaker<unsigned char> {\n        static std::string convert(unsigned char c);\n    };\n\n    template<>\n    struct StringMaker<std::nullptr_t> {\n        static std::string convert(std::nullptr_t);\n    };\n\n    template<>\n    struct StringMaker<float> {\n        static std::string convert(float value);\n        static int precision;\n    };\n\n    template<>\n    struct StringMaker<double> {\n        static std::string convert(double value);\n        static int precision;\n    };\n\n    template <typename T>\n    struct StringMaker<T*> {\n        template <typename U>\n        static std::string convert(U* p) {\n            if (p) {\n                return ::Catch::Detail::rawMemoryToString(p);\n            } else {\n                return \"nullptr\";\n            }\n        }\n    };\n\n    template <typename R, typename C>\n    struct StringMaker<R C::*> {\n        static std::string convert(R C::* p) {\n            if (p) {\n                return ::Catch::Detail::rawMemoryToString(p);\n            } else {\n                return \"nullptr\";\n            }\n        }\n    };\n\n#if defined(_MANAGED)\n    template <typename T>\n    struct StringMaker<T^> {\n        static std::string convert( T^ ref ) {\n            return ::Catch::Detail::clrReferenceToString(ref);\n        }\n    };\n#endif\n\n    namespace Detail {\n        template<typename InputIterator, typename Sentinel = InputIterator>\n        std::string rangeToString(InputIterator first, Sentinel last) {\n            ReusableStringStream rss;\n            rss << \"{ \";\n            if (first != last) {\n                rss << ::Catch::Detail::stringify(*first);\n                for (++first; first != last; ++first)\n                    rss << \", \" << ::Catch::Detail::stringify(*first);\n            }\n            rss << \" }\";\n            return rss.str();\n        }\n    }\n\n#ifdef __OBJC__\n    template<>\n    struct StringMaker<NSString*> {\n        static std::string convert(NSString * nsstring) {\n            if (!nsstring)\n                return \"nil\";\n            return std::string(\"@\") + [nsstring UTF8String];\n        }\n    };\n    template<>\n    struct StringMaker<NSObject*> {\n        static std::string convert(NSObject* nsObject) {\n            return ::Catch::Detail::stringify([nsObject description]);\n        }\n\n    };\n    namespace Detail {\n        inline std::string stringify( NSString* nsstring ) {\n            return StringMaker<NSString*>::convert( nsstring );\n        }\n\n    } // namespace Detail\n#endif // __OBJC__\n\n} // namespace Catch\n\n//////////////////////////////////////////////////////\n// Separate std-lib types stringification, so it can be selectively enabled\n// This means that we do not bring in\n\n#if defined(CATCH_CONFIG_ENABLE_ALL_STRINGMAKERS)\n#  define CATCH_CONFIG_ENABLE_PAIR_STRINGMAKER\n#  define CATCH_CONFIG_ENABLE_TUPLE_STRINGMAKER\n#  define CATCH_CONFIG_ENABLE_VARIANT_STRINGMAKER\n#  define CATCH_CONFIG_ENABLE_CHRONO_STRINGMAKER\n#  define CATCH_CONFIG_ENABLE_OPTIONAL_STRINGMAKER\n#endif\n\n// Separate std::pair specialization\n#if defined(CATCH_CONFIG_ENABLE_PAIR_STRINGMAKER)\n#include <utility>\nnamespace Catch {\n    template<typename T1, typename T2>\n    struct StringMaker<std::pair<T1, T2> > {\n        static std::string convert(const std::pair<T1, T2>& pair) {\n            ReusableStringStream rss;\n            rss << \"{ \"\n                << ::Catch::Detail::stringify(pair.first)\n                << \", \"\n                << ::Catch::Detail::stringify(pair.second)\n                << \" }\";\n            return rss.str();\n        }\n    };\n}\n#endif // CATCH_CONFIG_ENABLE_PAIR_STRINGMAKER\n\n#if defined(CATCH_CONFIG_ENABLE_OPTIONAL_STRINGMAKER) && defined(CATCH_CONFIG_CPP17_OPTIONAL)\n#include <optional>\nnamespace Catch {\n    template<typename T>\n    struct StringMaker<std::optional<T> > {\n        static std::string convert(const std::optional<T>& optional) {\n            ReusableStringStream rss;\n            if (optional.has_value()) {\n                rss << ::Catch::Detail::stringify(*optional);\n            } else {\n                rss << \"{ }\";\n            }\n            return rss.str();\n        }\n    };\n}\n#endif // CATCH_CONFIG_ENABLE_OPTIONAL_STRINGMAKER\n\n// Separate std::tuple specialization\n#if defined(CATCH_CONFIG_ENABLE_TUPLE_STRINGMAKER)\n#include <tuple>\nnamespace Catch {\n    namespace Detail {\n        template<\n            typename Tuple,\n            std::size_t N = 0,\n            bool = (N < std::tuple_size<Tuple>::value)\n            >\n            struct TupleElementPrinter {\n            static void print(const Tuple& tuple, std::ostream& os) {\n                os << (N ? \", \" : \" \")\n                    << ::Catch::Detail::stringify(std::get<N>(tuple));\n                TupleElementPrinter<Tuple, N + 1>::print(tuple, os);\n            }\n        };\n\n        template<\n            typename Tuple,\n            std::size_t N\n        >\n            struct TupleElementPrinter<Tuple, N, false> {\n            static void print(const Tuple&, std::ostream&) {}\n        };\n\n    }\n\n    template<typename ...Types>\n    struct StringMaker<std::tuple<Types...>> {\n        static std::string convert(const std::tuple<Types...>& tuple) {\n            ReusableStringStream rss;\n            rss << '{';\n            Detail::TupleElementPrinter<std::tuple<Types...>>::print(tuple, rss.get());\n            rss << \" }\";\n            return rss.str();\n        }\n    };\n}\n#endif // CATCH_CONFIG_ENABLE_TUPLE_STRINGMAKER\n\n#if defined(CATCH_CONFIG_ENABLE_VARIANT_STRINGMAKER) && defined(CATCH_CONFIG_CPP17_VARIANT)\n#include <variant>\nnamespace Catch {\n    template<>\n    struct StringMaker<std::monostate> {\n        static std::string convert(const std::monostate&) {\n            return \"{ }\";\n        }\n    };\n\n    template<typename... Elements>\n    struct StringMaker<std::variant<Elements...>> {\n        static std::string convert(const std::variant<Elements...>& variant) {\n            if (variant.valueless_by_exception()) {\n                return \"{valueless variant}\";\n            } else {\n                return std::visit(\n                    [](const auto& value) {\n                        return ::Catch::Detail::stringify(value);\n                    },\n                    variant\n                );\n            }\n        }\n    };\n}\n#endif // CATCH_CONFIG_ENABLE_VARIANT_STRINGMAKER\n\nnamespace Catch {\n    // Import begin/ end from std here\n    using std::begin;\n    using std::end;\n\n    namespace detail {\n        template <typename...>\n        struct void_type {\n            using type = void;\n        };\n\n        template <typename T, typename = void>\n        struct is_range_impl : std::false_type {\n        };\n\n        template <typename T>\n        struct is_range_impl<T, typename void_type<decltype(begin(std::declval<T>()))>::type> : std::true_type {\n        };\n    } // namespace detail\n\n    template <typename T>\n    struct is_range : detail::is_range_impl<T> {\n    };\n\n#if defined(_MANAGED) // Managed types are never ranges\n    template <typename T>\n    struct is_range<T^> {\n        static const bool value = false;\n    };\n#endif\n\n    template<typename Range>\n    std::string rangeToString( Range const& range ) {\n        return ::Catch::Detail::rangeToString( begin( range ), end( range ) );\n    }\n\n    // Handle vector<bool> specially\n    template<typename Allocator>\n    std::string rangeToString( std::vector<bool, Allocator> const& v ) {\n        ReusableStringStream rss;\n        rss << \"{ \";\n        bool first = true;\n        for( bool b : v ) {\n            if( first )\n                first = false;\n            else\n                rss << \", \";\n            rss << ::Catch::Detail::stringify( b );\n        }\n        rss << \" }\";\n        return rss.str();\n    }\n\n    template<typename R>\n    struct StringMaker<R, typename std::enable_if<is_range<R>::value && !::Catch::Detail::IsStreamInsertable<R>::value>::type> {\n        static std::string convert( R const& range ) {\n            return rangeToString( range );\n        }\n    };\n\n    template <typename T, int SZ>\n    struct StringMaker<T[SZ]> {\n        static std::string convert(T const(&arr)[SZ]) {\n            return rangeToString(arr);\n        }\n    };\n\n} // namespace Catch\n\n// Separate std::chrono::duration specialization\n#if defined(CATCH_CONFIG_ENABLE_CHRONO_STRINGMAKER)\n#include <ctime>\n#include <ratio>\n#include <chrono>\n\nnamespace Catch {\n\ntemplate <class Ratio>\nstruct ratio_string {\n    static std::string symbol();\n};\n\ntemplate <class Ratio>\nstd::string ratio_string<Ratio>::symbol() {\n    Catch::ReusableStringStream rss;\n    rss << '[' << Ratio::num << '/'\n        << Ratio::den << ']';\n    return rss.str();\n}\ntemplate <>\nstruct ratio_string<std::atto> {\n    static std::string symbol();\n};\ntemplate <>\nstruct ratio_string<std::femto> {\n    static std::string symbol();\n};\ntemplate <>\nstruct ratio_string<std::pico> {\n    static std::string symbol();\n};\ntemplate <>\nstruct ratio_string<std::nano> {\n    static std::string symbol();\n};\ntemplate <>\nstruct ratio_string<std::micro> {\n    static std::string symbol();\n};\ntemplate <>\nstruct ratio_string<std::milli> {\n    static std::string symbol();\n};\n\n    ////////////\n    // std::chrono::duration specializations\n    template<typename Value, typename Ratio>\n    struct StringMaker<std::chrono::duration<Value, Ratio>> {\n        static std::string convert(std::chrono::duration<Value, Ratio> const& duration) {\n            ReusableStringStream rss;\n            rss << duration.count() << ' ' << ratio_string<Ratio>::symbol() << 's';\n            return rss.str();\n        }\n    };\n    template<typename Value>\n    struct StringMaker<std::chrono::duration<Value, std::ratio<1>>> {\n        static std::string convert(std::chrono::duration<Value, std::ratio<1>> const& duration) {\n            ReusableStringStream rss;\n            rss << duration.count() << \" s\";\n            return rss.str();\n        }\n    };\n    template<typename Value>\n    struct StringMaker<std::chrono::duration<Value, std::ratio<60>>> {\n        static std::string convert(std::chrono::duration<Value, std::ratio<60>> const& duration) {\n            ReusableStringStream rss;\n            rss << duration.count() << \" m\";\n            return rss.str();\n        }\n    };\n    template<typename Value>\n    struct StringMaker<std::chrono::duration<Value, std::ratio<3600>>> {\n        static std::string convert(std::chrono::duration<Value, std::ratio<3600>> const& duration) {\n            ReusableStringStream rss;\n            rss << duration.count() << \" h\";\n            return rss.str();\n        }\n    };\n\n    ////////////\n    // std::chrono::time_point specialization\n    // Generic time_point cannot be specialized, only std::chrono::time_point<system_clock>\n    template<typename Clock, typename Duration>\n    struct StringMaker<std::chrono::time_point<Clock, Duration>> {\n        static std::string convert(std::chrono::time_point<Clock, Duration> const& time_point) {\n            return ::Catch::Detail::stringify(time_point.time_since_epoch()) + \" since epoch\";\n        }\n    };\n    // std::chrono::time_point<system_clock> specialization\n    template<typename Duration>\n    struct StringMaker<std::chrono::time_point<std::chrono::system_clock, Duration>> {\n        static std::string convert(std::chrono::time_point<std::chrono::system_clock, Duration> const& time_point) {\n            auto converted = std::chrono::system_clock::to_time_t(time_point);\n\n#ifdef _MSC_VER\n            std::tm timeInfo = {};\n            gmtime_s(&timeInfo, &converted);\n#else\n            std::tm* timeInfo = std::gmtime(&converted);\n#endif\n\n            auto const timeStampSize = sizeof(\"2017-01-16T17:06:45Z\");\n            char timeStamp[timeStampSize];\n            const char * const fmt = \"%Y-%m-%dT%H:%M:%SZ\";\n\n#ifdef _MSC_VER\n            std::strftime(timeStamp, timeStampSize, fmt, &timeInfo);\n#else\n            std::strftime(timeStamp, timeStampSize, fmt, timeInfo);\n#endif\n            return std::string(timeStamp);\n        }\n    };\n}\n#endif // CATCH_CONFIG_ENABLE_CHRONO_STRINGMAKER\n\n#define INTERNAL_CATCH_REGISTER_ENUM( enumName, ... ) \\\nnamespace Catch { \\\n    template<> struct StringMaker<enumName> { \\\n        static std::string convert( enumName value ) { \\\n            static const auto& enumInfo = ::Catch::getMutableRegistryHub().getMutableEnumValuesRegistry().registerEnum( #enumName, #__VA_ARGS__, { __VA_ARGS__ } ); \\\n            return static_cast<std::string>(enumInfo.lookup( static_cast<int>( value ) )); \\\n        } \\\n    }; \\\n}\n\n#define CATCH_REGISTER_ENUM( enumName, ... ) INTERNAL_CATCH_REGISTER_ENUM( enumName, __VA_ARGS__ )\n\n#ifdef _MSC_VER\n#pragma warning(pop)\n#endif\n\n// end catch_tostring.h\n#include <iosfwd>\n\n#ifdef _MSC_VER\n#pragma warning(push)\n#pragma warning(disable:4389) // '==' : signed/unsigned mismatch\n#pragma warning(disable:4018) // more \"signed/unsigned mismatch\"\n#pragma warning(disable:4312) // Converting int to T* using reinterpret_cast (issue on x64 platform)\n#pragma warning(disable:4180) // qualifier applied to function type has no meaning\n#pragma warning(disable:4800) // Forcing result to true or false\n#endif\n\nnamespace Catch {\n\n    struct ITransientExpression {\n        auto isBinaryExpression() const -> bool { return m_isBinaryExpression; }\n        auto getResult() const -> bool { return m_result; }\n        virtual void streamReconstructedExpression( std::ostream &os ) const = 0;\n\n        ITransientExpression( bool isBinaryExpression, bool result )\n        :   m_isBinaryExpression( isBinaryExpression ),\n            m_result( result )\n        {}\n\n        // We don't actually need a virtual destructor, but many static analysers\n        // complain if it's not here :-(\n        virtual ~ITransientExpression();\n\n        bool m_isBinaryExpression;\n        bool m_result;\n\n    };\n\n    void formatReconstructedExpression( std::ostream &os, std::string const& lhs, StringRef op, std::string const& rhs );\n\n    template<typename LhsT, typename RhsT>\n    class BinaryExpr  : public ITransientExpression {\n        LhsT m_lhs;\n        StringRef m_op;\n        RhsT m_rhs;\n\n        void streamReconstructedExpression( std::ostream &os ) const override {\n            formatReconstructedExpression\n                    ( os, Catch::Detail::stringify( m_lhs ), m_op, Catch::Detail::stringify( m_rhs ) );\n        }\n\n    public:\n        BinaryExpr( bool comparisonResult, LhsT lhs, StringRef op, RhsT rhs )\n        :   ITransientExpression{ true, comparisonResult },\n            m_lhs( lhs ),\n            m_op( op ),\n            m_rhs( rhs )\n        {}\n\n        template<typename T>\n        auto operator && ( T ) const -> BinaryExpr<LhsT, RhsT const&> const {\n            static_assert(always_false<T>::value,\n            \"chained comparisons are not supported inside assertions, \"\n            \"wrap the expression inside parentheses, or decompose it\");\n        }\n\n        template<typename T>\n        auto operator || ( T ) const -> BinaryExpr<LhsT, RhsT const&> const {\n            static_assert(always_false<T>::value,\n            \"chained comparisons are not supported inside assertions, \"\n            \"wrap the expression inside parentheses, or decompose it\");\n        }\n\n        template<typename T>\n        auto operator == ( T ) const -> BinaryExpr<LhsT, RhsT const&> const {\n            static_assert(always_false<T>::value,\n            \"chained comparisons are not supported inside assertions, \"\n            \"wrap the expression inside parentheses, or decompose it\");\n        }\n\n        template<typename T>\n        auto operator != ( T ) const -> BinaryExpr<LhsT, RhsT const&> const {\n            static_assert(always_false<T>::value,\n            \"chained comparisons are not supported inside assertions, \"\n            \"wrap the expression inside parentheses, or decompose it\");\n        }\n\n        template<typename T>\n        auto operator > ( T ) const -> BinaryExpr<LhsT, RhsT const&> const {\n            static_assert(always_false<T>::value,\n            \"chained comparisons are not supported inside assertions, \"\n            \"wrap the expression inside parentheses, or decompose it\");\n        }\n\n        template<typename T>\n        auto operator < ( T ) const -> BinaryExpr<LhsT, RhsT const&> const {\n            static_assert(always_false<T>::value,\n            \"chained comparisons are not supported inside assertions, \"\n            \"wrap the expression inside parentheses, or decompose it\");\n        }\n\n        template<typename T>\n        auto operator >= ( T ) const -> BinaryExpr<LhsT, RhsT const&> const {\n            static_assert(always_false<T>::value,\n            \"chained comparisons are not supported inside assertions, \"\n            \"wrap the expression inside parentheses, or decompose it\");\n        }\n\n        template<typename T>\n        auto operator <= ( T ) const -> BinaryExpr<LhsT, RhsT const&> const {\n            static_assert(always_false<T>::value,\n            \"chained comparisons are not supported inside assertions, \"\n            \"wrap the expression inside parentheses, or decompose it\");\n        }\n    };\n\n    template<typename LhsT>\n    class UnaryExpr : public ITransientExpression {\n        LhsT m_lhs;\n\n        void streamReconstructedExpression( std::ostream &os ) const override {\n            os << Catch::Detail::stringify( m_lhs );\n        }\n\n    public:\n        explicit UnaryExpr( LhsT lhs )\n        :   ITransientExpression{ false, static_cast<bool>(lhs) },\n            m_lhs( lhs )\n        {}\n    };\n\n    // Specialised comparison functions to handle equality comparisons between ints and pointers (NULL deduces as an int)\n    template<typename LhsT, typename RhsT>\n    auto compareEqual( LhsT const& lhs, RhsT const& rhs ) -> bool { return static_cast<bool>(lhs == rhs); }\n    template<typename T>\n    auto compareEqual( T* const& lhs, int rhs ) -> bool { return lhs == reinterpret_cast<void const*>( rhs ); }\n    template<typename T>\n    auto compareEqual( T* const& lhs, long rhs ) -> bool { return lhs == reinterpret_cast<void const*>( rhs ); }\n    template<typename T>\n    auto compareEqual( int lhs, T* const& rhs ) -> bool { return reinterpret_cast<void const*>( lhs ) == rhs; }\n    template<typename T>\n    auto compareEqual( long lhs, T* const& rhs ) -> bool { return reinterpret_cast<void const*>( lhs ) == rhs; }\n\n    template<typename LhsT, typename RhsT>\n    auto compareNotEqual( LhsT const& lhs, RhsT&& rhs ) -> bool { return static_cast<bool>(lhs != rhs); }\n    template<typename T>\n    auto compareNotEqual( T* const& lhs, int rhs ) -> bool { return lhs != reinterpret_cast<void const*>( rhs ); }\n    template<typename T>\n    auto compareNotEqual( T* const& lhs, long rhs ) -> bool { return lhs != reinterpret_cast<void const*>( rhs ); }\n    template<typename T>\n    auto compareNotEqual( int lhs, T* const& rhs ) -> bool { return reinterpret_cast<void const*>( lhs ) != rhs; }\n    template<typename T>\n    auto compareNotEqual( long lhs, T* const& rhs ) -> bool { return reinterpret_cast<void const*>( lhs ) != rhs; }\n\n    template<typename LhsT>\n    class ExprLhs {\n        LhsT m_lhs;\n    public:\n        explicit ExprLhs( LhsT lhs ) : m_lhs( lhs ) {}\n\n        template<typename RhsT>\n        auto operator == ( RhsT const& rhs ) -> BinaryExpr<LhsT, RhsT const&> const {\n            return { compareEqual( m_lhs, rhs ), m_lhs, \"==\", rhs };\n        }\n        auto operator == ( bool rhs ) -> BinaryExpr<LhsT, bool> const {\n            return { m_lhs == rhs, m_lhs, \"==\", rhs };\n        }\n\n        template<typename RhsT>\n        auto operator != ( RhsT const& rhs ) -> BinaryExpr<LhsT, RhsT const&> const {\n            return { compareNotEqual( m_lhs, rhs ), m_lhs, \"!=\", rhs };\n        }\n        auto operator != ( bool rhs ) -> BinaryExpr<LhsT, bool> const {\n            return { m_lhs != rhs, m_lhs, \"!=\", rhs };\n        }\n\n        template<typename RhsT>\n        auto operator > ( RhsT const& rhs ) -> BinaryExpr<LhsT, RhsT const&> const {\n            return { static_cast<bool>(m_lhs > rhs), m_lhs, \">\", rhs };\n        }\n        template<typename RhsT>\n        auto operator < ( RhsT const& rhs ) -> BinaryExpr<LhsT, RhsT const&> const {\n            return { static_cast<bool>(m_lhs < rhs), m_lhs, \"<\", rhs };\n        }\n        template<typename RhsT>\n        auto operator >= ( RhsT const& rhs ) -> BinaryExpr<LhsT, RhsT const&> const {\n            return { static_cast<bool>(m_lhs >= rhs), m_lhs, \">=\", rhs };\n        }\n        template<typename RhsT>\n        auto operator <= ( RhsT const& rhs ) -> BinaryExpr<LhsT, RhsT const&> const {\n            return { static_cast<bool>(m_lhs <= rhs), m_lhs, \"<=\", rhs };\n        }\n        template <typename RhsT>\n        auto operator | (RhsT const& rhs) -> BinaryExpr<LhsT, RhsT const&> const {\n            return { static_cast<bool>(m_lhs | rhs), m_lhs, \"|\", rhs };\n        }\n        template <typename RhsT>\n        auto operator & (RhsT const& rhs) -> BinaryExpr<LhsT, RhsT const&> const {\n            return { static_cast<bool>(m_lhs & rhs), m_lhs, \"&\", rhs };\n        }\n        template <typename RhsT>\n        auto operator ^ (RhsT const& rhs) -> BinaryExpr<LhsT, RhsT const&> const {\n            return { static_cast<bool>(m_lhs ^ rhs), m_lhs, \"^\", rhs };\n        }\n\n        template<typename RhsT>\n        auto operator && ( RhsT const& ) -> BinaryExpr<LhsT, RhsT const&> const {\n            static_assert(always_false<RhsT>::value,\n            \"operator&& is not supported inside assertions, \"\n            \"wrap the expression inside parentheses, or decompose it\");\n        }\n\n        template<typename RhsT>\n        auto operator || ( RhsT const& ) -> BinaryExpr<LhsT, RhsT const&> const {\n            static_assert(always_false<RhsT>::value,\n            \"operator|| is not supported inside assertions, \"\n            \"wrap the expression inside parentheses, or decompose it\");\n        }\n\n        auto makeUnaryExpr() const -> UnaryExpr<LhsT> {\n            return UnaryExpr<LhsT>{ m_lhs };\n        }\n    };\n\n    void handleExpression( ITransientExpression const& expr );\n\n    template<typename T>\n    void handleExpression( ExprLhs<T> const& expr ) {\n        handleExpression( expr.makeUnaryExpr() );\n    }\n\n    struct Decomposer {\n        template<typename T>\n        auto operator <= ( T const& lhs ) -> ExprLhs<T const&> {\n            return ExprLhs<T const&>{ lhs };\n        }\n\n        auto operator <=( bool value ) -> ExprLhs<bool> {\n            return ExprLhs<bool>{ value };\n        }\n    };\n\n} // end namespace Catch\n\n#ifdef _MSC_VER\n#pragma warning(pop)\n#endif\n\n// end catch_decomposer.h\n// start catch_interfaces_capture.h\n\n#include <string>\n#include <chrono>\n\nnamespace Catch {\n\n    class AssertionResult;\n    struct AssertionInfo;\n    struct SectionInfo;\n    struct SectionEndInfo;\n    struct MessageInfo;\n    struct MessageBuilder;\n    struct Counts;\n    struct AssertionReaction;\n    struct SourceLineInfo;\n\n    struct ITransientExpression;\n    struct IGeneratorTracker;\n\n#if defined(CATCH_CONFIG_ENABLE_BENCHMARKING)\n    struct BenchmarkInfo;\n    template <typename Duration = std::chrono::duration<double, std::nano>>\n    struct BenchmarkStats;\n#endif // CATCH_CONFIG_ENABLE_BENCHMARKING\n\n    struct IResultCapture {\n\n        virtual ~IResultCapture();\n\n        virtual bool sectionStarted(    SectionInfo const& sectionInfo,\n                                        Counts& assertions ) = 0;\n        virtual void sectionEnded( SectionEndInfo const& endInfo ) = 0;\n        virtual void sectionEndedEarly( SectionEndInfo const& endInfo ) = 0;\n\n        virtual auto acquireGeneratorTracker( StringRef generatorName, SourceLineInfo const& lineInfo ) -> IGeneratorTracker& = 0;\n\n#if defined(CATCH_CONFIG_ENABLE_BENCHMARKING)\n        virtual void benchmarkPreparing( std::string const& name ) = 0;\n        virtual void benchmarkStarting( BenchmarkInfo const& info ) = 0;\n        virtual void benchmarkEnded( BenchmarkStats<> const& stats ) = 0;\n        virtual void benchmarkFailed( std::string const& error ) = 0;\n#endif // CATCH_CONFIG_ENABLE_BENCHMARKING\n\n        virtual void pushScopedMessage( MessageInfo const& message ) = 0;\n        virtual void popScopedMessage( MessageInfo const& message ) = 0;\n\n        virtual void emplaceUnscopedMessage( MessageBuilder const& builder ) = 0;\n\n        virtual void handleFatalErrorCondition( StringRef message ) = 0;\n\n        virtual void handleExpr\n                (   AssertionInfo const& info,\n                    ITransientExpression const& expr,\n                    AssertionReaction& reaction ) = 0;\n        virtual void handleMessage\n                (   AssertionInfo const& info,\n                    ResultWas::OfType resultType,\n                    StringRef const& message,\n                    AssertionReaction& reaction ) = 0;\n        virtual void handleUnexpectedExceptionNotThrown\n                (   AssertionInfo const& info,\n                    AssertionReaction& reaction ) = 0;\n        virtual void handleUnexpectedInflightException\n                (   AssertionInfo const& info,\n                    std::string const& message,\n                    AssertionReaction& reaction ) = 0;\n        virtual void handleIncomplete\n                (   AssertionInfo const& info ) = 0;\n        virtual void handleNonExpr\n                (   AssertionInfo const &info,\n                    ResultWas::OfType resultType,\n                    AssertionReaction &reaction ) = 0;\n\n        virtual bool lastAssertionPassed() = 0;\n        virtual void assertionPassed() = 0;\n\n        // Deprecated, do not use:\n        virtual std::string getCurrentTestName() const = 0;\n        virtual const AssertionResult* getLastResult() const = 0;\n        virtual void exceptionEarlyReported() = 0;\n    };\n\n    IResultCapture& getResultCapture();\n}\n\n// end catch_interfaces_capture.h\nnamespace Catch {\n\n    struct TestFailureException{};\n    struct AssertionResultData;\n    struct IResultCapture;\n    class RunContext;\n\n    class LazyExpression {\n        friend class AssertionHandler;\n        friend struct AssertionStats;\n        friend class RunContext;\n\n        ITransientExpression const* m_transientExpression = nullptr;\n        bool m_isNegated;\n    public:\n        LazyExpression( bool isNegated );\n        LazyExpression( LazyExpression const& other );\n        LazyExpression& operator = ( LazyExpression const& ) = delete;\n\n        explicit operator bool() const;\n\n        friend auto operator << ( std::ostream& os, LazyExpression const& lazyExpr ) -> std::ostream&;\n    };\n\n    struct AssertionReaction {\n        bool shouldDebugBreak = false;\n        bool shouldThrow = false;\n    };\n\n    class AssertionHandler {\n        AssertionInfo m_assertionInfo;\n        AssertionReaction m_reaction;\n        bool m_completed = false;\n        IResultCapture& m_resultCapture;\n\n    public:\n        AssertionHandler\n            (   StringRef const& macroName,\n                SourceLineInfo const& lineInfo,\n                StringRef capturedExpression,\n                ResultDisposition::Flags resultDisposition );\n        ~AssertionHandler() {\n            if ( !m_completed ) {\n                m_resultCapture.handleIncomplete( m_assertionInfo );\n            }\n        }\n\n        template<typename T>\n        void handleExpr( ExprLhs<T> const& expr ) {\n            handleExpr( expr.makeUnaryExpr() );\n        }\n        void handleExpr( ITransientExpression const& expr );\n\n        void handleMessage(ResultWas::OfType resultType, StringRef const& message);\n\n        void handleExceptionThrownAsExpected();\n        void handleUnexpectedExceptionNotThrown();\n        void handleExceptionNotThrownAsExpected();\n        void handleThrowingCallSkipped();\n        void handleUnexpectedInflightException();\n\n        void complete();\n        void setCompleted();\n\n        // query\n        auto allowThrows() const -> bool;\n    };\n\n    void handleExceptionMatchExpr( AssertionHandler& handler, std::string const& str, StringRef const& matcherString );\n\n} // namespace Catch\n\n// end catch_assertionhandler.h\n// start catch_message.h\n\n#include <string>\n#include <vector>\n\nnamespace Catch {\n\n    struct MessageInfo {\n        MessageInfo(    StringRef const& _macroName,\n                        SourceLineInfo const& _lineInfo,\n                        ResultWas::OfType _type );\n\n        StringRef macroName;\n        std::string message;\n        SourceLineInfo lineInfo;\n        ResultWas::OfType type;\n        unsigned int sequence;\n\n        bool operator == ( MessageInfo const& other ) const;\n        bool operator < ( MessageInfo const& other ) const;\n    private:\n        static unsigned int globalCount;\n    };\n\n    struct MessageStream {\n\n        template<typename T>\n        MessageStream& operator << ( T const& value ) {\n            m_stream << value;\n            return *this;\n        }\n\n        ReusableStringStream m_stream;\n    };\n\n    struct MessageBuilder : MessageStream {\n        MessageBuilder( StringRef const& macroName,\n                        SourceLineInfo const& lineInfo,\n                        ResultWas::OfType type );\n\n        template<typename T>\n        MessageBuilder& operator << ( T const& value ) {\n            m_stream << value;\n            return *this;\n        }\n\n        MessageInfo m_info;\n    };\n\n    class ScopedMessage {\n    public:\n        explicit ScopedMessage( MessageBuilder const& builder );\n        ScopedMessage( ScopedMessage& duplicate ) = delete;\n        ScopedMessage( ScopedMessage&& old );\n        ~ScopedMessage();\n\n        MessageInfo m_info;\n        bool m_moved;\n    };\n\n    class Capturer {\n        std::vector<MessageInfo> m_messages;\n        IResultCapture& m_resultCapture = getResultCapture();\n        size_t m_captured = 0;\n    public:\n        Capturer( StringRef macroName, SourceLineInfo const& lineInfo, ResultWas::OfType resultType, StringRef names );\n        ~Capturer();\n\n        void captureValue( size_t index, std::string const& value );\n\n        template<typename T>\n        void captureValues( size_t index, T const& value ) {\n            captureValue( index, Catch::Detail::stringify( value ) );\n        }\n\n        template<typename T, typename... Ts>\n        void captureValues( size_t index, T const& value, Ts const&... values ) {\n            captureValue( index, Catch::Detail::stringify(value) );\n            captureValues( index+1, values... );\n        }\n    };\n\n} // end namespace Catch\n\n// end catch_message.h\n#if !defined(CATCH_CONFIG_DISABLE)\n\n#if !defined(CATCH_CONFIG_DISABLE_STRINGIFICATION)\n  #define CATCH_INTERNAL_STRINGIFY(...) #__VA_ARGS__\n#else\n  #define CATCH_INTERNAL_STRINGIFY(...) \"Disabled by CATCH_CONFIG_DISABLE_STRINGIFICATION\"\n#endif\n\n#if defined(CATCH_CONFIG_FAST_COMPILE) || defined(CATCH_CONFIG_DISABLE_EXCEPTIONS)\n\n///////////////////////////////////////////////////////////////////////////////\n// Another way to speed-up compilation is to omit local try-catch for REQUIRE*\n// macros.\n#define INTERNAL_CATCH_TRY\n#define INTERNAL_CATCH_CATCH( capturer )\n\n#else // CATCH_CONFIG_FAST_COMPILE\n\n#define INTERNAL_CATCH_TRY try\n#define INTERNAL_CATCH_CATCH( handler ) catch(...) { handler.handleUnexpectedInflightException(); }\n\n#endif\n\n#define INTERNAL_CATCH_REACT( handler ) handler.complete();\n\n///////////////////////////////////////////////////////////////////////////////\n#define INTERNAL_CATCH_TEST( macroName, resultDisposition, ... ) \\\n    do { \\\n        CATCH_INTERNAL_IGNORE_BUT_WARN(__VA_ARGS__); \\\n        Catch::AssertionHandler catchAssertionHandler( macroName##_catch_sr, CATCH_INTERNAL_LINEINFO, CATCH_INTERNAL_STRINGIFY(__VA_ARGS__), resultDisposition ); \\\n        INTERNAL_CATCH_TRY { \\\n            CATCH_INTERNAL_START_WARNINGS_SUPPRESSION \\\n            CATCH_INTERNAL_SUPPRESS_PARENTHESES_WARNINGS \\\n            catchAssertionHandler.handleExpr( Catch::Decomposer() <= __VA_ARGS__ ); \\\n            CATCH_INTERNAL_STOP_WARNINGS_SUPPRESSION \\\n        } INTERNAL_CATCH_CATCH( catchAssertionHandler ) \\\n        INTERNAL_CATCH_REACT( catchAssertionHandler ) \\\n    } while( (void)0, (false) && static_cast<bool>( !!(__VA_ARGS__) ) )\n\n///////////////////////////////////////////////////////////////////////////////\n#define INTERNAL_CATCH_IF( macroName, resultDisposition, ... ) \\\n    INTERNAL_CATCH_TEST( macroName, resultDisposition, __VA_ARGS__ ); \\\n    if( Catch::getResultCapture().lastAssertionPassed() )\n\n///////////////////////////////////////////////////////////////////////////////\n#define INTERNAL_CATCH_ELSE( macroName, resultDisposition, ... ) \\\n    INTERNAL_CATCH_TEST( macroName, resultDisposition, __VA_ARGS__ ); \\\n    if( !Catch::getResultCapture().lastAssertionPassed() )\n\n///////////////////////////////////////////////////////////////////////////////\n#define INTERNAL_CATCH_NO_THROW( macroName, resultDisposition, ... ) \\\n    do { \\\n        Catch::AssertionHandler catchAssertionHandler( macroName##_catch_sr, CATCH_INTERNAL_LINEINFO, CATCH_INTERNAL_STRINGIFY(__VA_ARGS__), resultDisposition ); \\\n        try { \\\n            static_cast<void>(__VA_ARGS__); \\\n            catchAssertionHandler.handleExceptionNotThrownAsExpected(); \\\n        } \\\n        catch( ... ) { \\\n            catchAssertionHandler.handleUnexpectedInflightException(); \\\n        } \\\n        INTERNAL_CATCH_REACT( catchAssertionHandler ) \\\n    } while( false )\n\n///////////////////////////////////////////////////////////////////////////////\n#define INTERNAL_CATCH_THROWS( macroName, resultDisposition, ... ) \\\n    do { \\\n        Catch::AssertionHandler catchAssertionHandler( macroName##_catch_sr, CATCH_INTERNAL_LINEINFO, CATCH_INTERNAL_STRINGIFY(__VA_ARGS__), resultDisposition); \\\n        if( catchAssertionHandler.allowThrows() ) \\\n            try { \\\n                static_cast<void>(__VA_ARGS__); \\\n                catchAssertionHandler.handleUnexpectedExceptionNotThrown(); \\\n            } \\\n            catch( ... ) { \\\n                catchAssertionHandler.handleExceptionThrownAsExpected(); \\\n            } \\\n        else \\\n            catchAssertionHandler.handleThrowingCallSkipped(); \\\n        INTERNAL_CATCH_REACT( catchAssertionHandler ) \\\n    } while( false )\n\n///////////////////////////////////////////////////////////////////////////////\n#define INTERNAL_CATCH_THROWS_AS( macroName, exceptionType, resultDisposition, expr ) \\\n    do { \\\n        Catch::AssertionHandler catchAssertionHandler( macroName##_catch_sr, CATCH_INTERNAL_LINEINFO, CATCH_INTERNAL_STRINGIFY(expr) \", \" CATCH_INTERNAL_STRINGIFY(exceptionType), resultDisposition ); \\\n        if( catchAssertionHandler.allowThrows() ) \\\n            try { \\\n                static_cast<void>(expr); \\\n                catchAssertionHandler.handleUnexpectedExceptionNotThrown(); \\\n            } \\\n            catch( exceptionType const& ) { \\\n                catchAssertionHandler.handleExceptionThrownAsExpected(); \\\n            } \\\n            catch( ... ) { \\\n                catchAssertionHandler.handleUnexpectedInflightException(); \\\n            } \\\n        else \\\n            catchAssertionHandler.handleThrowingCallSkipped(); \\\n        INTERNAL_CATCH_REACT( catchAssertionHandler ) \\\n    } while( false )\n\n///////////////////////////////////////////////////////////////////////////////\n#define INTERNAL_CATCH_MSG( macroName, messageType, resultDisposition, ... ) \\\n    do { \\\n        Catch::AssertionHandler catchAssertionHandler( macroName##_catch_sr, CATCH_INTERNAL_LINEINFO, Catch::StringRef(), resultDisposition ); \\\n        catchAssertionHandler.handleMessage( messageType, ( Catch::MessageStream() << __VA_ARGS__ + ::Catch::StreamEndStop() ).m_stream.str() ); \\\n        INTERNAL_CATCH_REACT( catchAssertionHandler ) \\\n    } while( false )\n\n///////////////////////////////////////////////////////////////////////////////\n#define INTERNAL_CATCH_CAPTURE( varName, macroName, ... ) \\\n    auto varName = Catch::Capturer( macroName, CATCH_INTERNAL_LINEINFO, Catch::ResultWas::Info, #__VA_ARGS__ ); \\\n    varName.captureValues( 0, __VA_ARGS__ )\n\n///////////////////////////////////////////////////////////////////////////////\n#define INTERNAL_CATCH_INFO( macroName, log ) \\\n    Catch::ScopedMessage INTERNAL_CATCH_UNIQUE_NAME( scopedMessage )( Catch::MessageBuilder( macroName##_catch_sr, CATCH_INTERNAL_LINEINFO, Catch::ResultWas::Info ) << log );\n\n///////////////////////////////////////////////////////////////////////////////\n#define INTERNAL_CATCH_UNSCOPED_INFO( macroName, log ) \\\n    Catch::getResultCapture().emplaceUnscopedMessage( Catch::MessageBuilder( macroName##_catch_sr, CATCH_INTERNAL_LINEINFO, Catch::ResultWas::Info ) << log )\n\n///////////////////////////////////////////////////////////////////////////////\n// Although this is matcher-based, it can be used with just a string\n#define INTERNAL_CATCH_THROWS_STR_MATCHES( macroName, resultDisposition, matcher, ... ) \\\n    do { \\\n        Catch::AssertionHandler catchAssertionHandler( macroName##_catch_sr, CATCH_INTERNAL_LINEINFO, CATCH_INTERNAL_STRINGIFY(__VA_ARGS__) \", \" CATCH_INTERNAL_STRINGIFY(matcher), resultDisposition ); \\\n        if( catchAssertionHandler.allowThrows() ) \\\n            try { \\\n                static_cast<void>(__VA_ARGS__); \\\n                catchAssertionHandler.handleUnexpectedExceptionNotThrown(); \\\n            } \\\n            catch( ... ) { \\\n                Catch::handleExceptionMatchExpr( catchAssertionHandler, matcher, #matcher##_catch_sr ); \\\n            } \\\n        else \\\n            catchAssertionHandler.handleThrowingCallSkipped(); \\\n        INTERNAL_CATCH_REACT( catchAssertionHandler ) \\\n    } while( false )\n\n#endif // CATCH_CONFIG_DISABLE\n\n// end catch_capture.hpp\n// start catch_section.h\n\n// start catch_section_info.h\n\n// start catch_totals.h\n\n#include <cstddef>\n\nnamespace Catch {\n\n    struct Counts {\n        Counts operator - ( Counts const& other ) const;\n        Counts& operator += ( Counts const& other );\n\n        std::size_t total() const;\n        bool allPassed() const;\n        bool allOk() const;\n\n        std::size_t passed = 0;\n        std::size_t failed = 0;\n        std::size_t failedButOk = 0;\n    };\n\n    struct Totals {\n\n        Totals operator - ( Totals const& other ) const;\n        Totals& operator += ( Totals const& other );\n\n        Totals delta( Totals const& prevTotals ) const;\n\n        int error = 0;\n        Counts assertions;\n        Counts testCases;\n    };\n}\n\n// end catch_totals.h\n#include <string>\n\nnamespace Catch {\n\n    struct SectionInfo {\n        SectionInfo\n            (   SourceLineInfo const& _lineInfo,\n                std::string const& _name );\n\n        // Deprecated\n        SectionInfo\n            (   SourceLineInfo const& _lineInfo,\n                std::string const& _name,\n                std::string const& ) : SectionInfo( _lineInfo, _name ) {}\n\n        std::string name;\n        std::string description; // !Deprecated: this will always be empty\n        SourceLineInfo lineInfo;\n    };\n\n    struct SectionEndInfo {\n        SectionInfo sectionInfo;\n        Counts prevAssertions;\n        double durationInSeconds;\n    };\n\n} // end namespace Catch\n\n// end catch_section_info.h\n// start catch_timer.h\n\n#include <cstdint>\n\nnamespace Catch {\n\n    auto getCurrentNanosecondsSinceEpoch() -> uint64_t;\n    auto getEstimatedClockResolution() -> uint64_t;\n\n    class Timer {\n        uint64_t m_nanoseconds = 0;\n    public:\n        void start();\n        auto getElapsedNanoseconds() const -> uint64_t;\n        auto getElapsedMicroseconds() const -> uint64_t;\n        auto getElapsedMilliseconds() const -> unsigned int;\n        auto getElapsedSeconds() const -> double;\n    };\n\n} // namespace Catch\n\n// end catch_timer.h\n#include <string>\n\nnamespace Catch {\n\n    class Section : NonCopyable {\n    public:\n        Section( SectionInfo const& info );\n        ~Section();\n\n        // This indicates whether the section should be executed or not\n        explicit operator bool() const;\n\n    private:\n        SectionInfo m_info;\n\n        std::string m_name;\n        Counts m_assertions;\n        bool m_sectionIncluded;\n        Timer m_timer;\n    };\n\n} // end namespace Catch\n\n#define INTERNAL_CATCH_SECTION( ... ) \\\n    CATCH_INTERNAL_START_WARNINGS_SUPPRESSION \\\n    CATCH_INTERNAL_SUPPRESS_UNUSED_WARNINGS \\\n    if( Catch::Section const& INTERNAL_CATCH_UNIQUE_NAME( catch_internal_Section ) = Catch::SectionInfo( CATCH_INTERNAL_LINEINFO, __VA_ARGS__ ) ) \\\n    CATCH_INTERNAL_STOP_WARNINGS_SUPPRESSION\n\n#define INTERNAL_CATCH_DYNAMIC_SECTION( ... ) \\\n    CATCH_INTERNAL_START_WARNINGS_SUPPRESSION \\\n    CATCH_INTERNAL_SUPPRESS_UNUSED_WARNINGS \\\n    if( Catch::Section const& INTERNAL_CATCH_UNIQUE_NAME( catch_internal_Section ) = Catch::SectionInfo( CATCH_INTERNAL_LINEINFO, (Catch::ReusableStringStream() << __VA_ARGS__).str() ) ) \\\n    CATCH_INTERNAL_STOP_WARNINGS_SUPPRESSION\n\n// end catch_section.h\n// start catch_interfaces_exception.h\n\n// start catch_interfaces_registry_hub.h\n\n#include <string>\n#include <memory>\n\nnamespace Catch {\n\n    class TestCase;\n    struct ITestCaseRegistry;\n    struct IExceptionTranslatorRegistry;\n    struct IExceptionTranslator;\n    struct IReporterRegistry;\n    struct IReporterFactory;\n    struct ITagAliasRegistry;\n    struct IMutableEnumValuesRegistry;\n\n    class StartupExceptionRegistry;\n\n    using IReporterFactoryPtr = std::shared_ptr<IReporterFactory>;\n\n    struct IRegistryHub {\n        virtual ~IRegistryHub();\n\n        virtual IReporterRegistry const& getReporterRegistry() const = 0;\n        virtual ITestCaseRegistry const& getTestCaseRegistry() const = 0;\n        virtual ITagAliasRegistry const& getTagAliasRegistry() const = 0;\n        virtual IExceptionTranslatorRegistry const& getExceptionTranslatorRegistry() const = 0;\n\n        virtual StartupExceptionRegistry const& getStartupExceptionRegistry() const = 0;\n    };\n\n    struct IMutableRegistryHub {\n        virtual ~IMutableRegistryHub();\n        virtual void registerReporter( std::string const& name, IReporterFactoryPtr const& factory ) = 0;\n        virtual void registerListener( IReporterFactoryPtr const& factory ) = 0;\n        virtual void registerTest( TestCase const& testInfo ) = 0;\n        virtual void registerTranslator( const IExceptionTranslator* translator ) = 0;\n        virtual void registerTagAlias( std::string const& alias, std::string const& tag, SourceLineInfo const& lineInfo ) = 0;\n        virtual void registerStartupException() noexcept = 0;\n        virtual IMutableEnumValuesRegistry& getMutableEnumValuesRegistry() = 0;\n    };\n\n    IRegistryHub const& getRegistryHub();\n    IMutableRegistryHub& getMutableRegistryHub();\n    void cleanUp();\n    std::string translateActiveException();\n\n}\n\n// end catch_interfaces_registry_hub.h\n#if defined(CATCH_CONFIG_DISABLE)\n    #define INTERNAL_CATCH_TRANSLATE_EXCEPTION_NO_REG( translatorName, signature) \\\n        static std::string translatorName( signature )\n#endif\n\n#include <exception>\n#include <string>\n#include <vector>\n\nnamespace Catch {\n    using exceptionTranslateFunction = std::string(*)();\n\n    struct IExceptionTranslator;\n    using ExceptionTranslators = std::vector<std::unique_ptr<IExceptionTranslator const>>;\n\n    struct IExceptionTranslator {\n        virtual ~IExceptionTranslator();\n        virtual std::string translate( ExceptionTranslators::const_iterator it, ExceptionTranslators::const_iterator itEnd ) const = 0;\n    };\n\n    struct IExceptionTranslatorRegistry {\n        virtual ~IExceptionTranslatorRegistry();\n\n        virtual std::string translateActiveException() const = 0;\n    };\n\n    class ExceptionTranslatorRegistrar {\n        template<typename T>\n        class ExceptionTranslator : public IExceptionTranslator {\n        public:\n\n            ExceptionTranslator( std::string(*translateFunction)( T& ) )\n            : m_translateFunction( translateFunction )\n            {}\n\n            std::string translate( ExceptionTranslators::const_iterator it, ExceptionTranslators::const_iterator itEnd ) const override {\n#if defined(CATCH_CONFIG_DISABLE_EXCEPTIONS)\n                return \"\";\n#else\n                try {\n                    if( it == itEnd )\n                        std::rethrow_exception(std::current_exception());\n                    else\n                        return (*it)->translate( it+1, itEnd );\n                }\n                catch( T& ex ) {\n                    return m_translateFunction( ex );\n                }\n#endif\n            }\n\n        protected:\n            std::string(*m_translateFunction)( T& );\n        };\n\n    public:\n        template<typename T>\n        ExceptionTranslatorRegistrar( std::string(*translateFunction)( T& ) ) {\n            getMutableRegistryHub().registerTranslator\n                ( new ExceptionTranslator<T>( translateFunction ) );\n        }\n    };\n}\n\n///////////////////////////////////////////////////////////////////////////////\n#define INTERNAL_CATCH_TRANSLATE_EXCEPTION2( translatorName, signature ) \\\n    static std::string translatorName( signature ); \\\n    CATCH_INTERNAL_START_WARNINGS_SUPPRESSION \\\n    CATCH_INTERNAL_SUPPRESS_GLOBALS_WARNINGS \\\n    namespace{ Catch::ExceptionTranslatorRegistrar INTERNAL_CATCH_UNIQUE_NAME( catch_internal_ExceptionRegistrar )( &translatorName ); } \\\n    CATCH_INTERNAL_STOP_WARNINGS_SUPPRESSION \\\n    static std::string translatorName( signature )\n\n#define INTERNAL_CATCH_TRANSLATE_EXCEPTION( signature ) INTERNAL_CATCH_TRANSLATE_EXCEPTION2( INTERNAL_CATCH_UNIQUE_NAME( catch_internal_ExceptionTranslator ), signature )\n\n// end catch_interfaces_exception.h\n// start catch_approx.h\n\n#include <type_traits>\n\nnamespace Catch {\nnamespace Detail {\n\n    class Approx {\n    private:\n        bool equalityComparisonImpl(double other) const;\n        // Validates the new margin (margin >= 0)\n        // out-of-line to avoid including stdexcept in the header\n        void setMargin(double margin);\n        // Validates the new epsilon (0 < epsilon < 1)\n        // out-of-line to avoid including stdexcept in the header\n        void setEpsilon(double epsilon);\n\n    public:\n        explicit Approx ( double value );\n\n        static Approx custom();\n\n        Approx operator-() const;\n\n        template <typename T, typename = typename std::enable_if<std::is_constructible<double, T>::value>::type>\n        Approx operator()( T const& value ) const {\n            Approx approx( static_cast<double>(value) );\n            approx.m_epsilon = m_epsilon;\n            approx.m_margin = m_margin;\n            approx.m_scale = m_scale;\n            return approx;\n        }\n\n        template <typename T, typename = typename std::enable_if<std::is_constructible<double, T>::value>::type>\n        explicit Approx( T const& value ): Approx(static_cast<double>(value))\n        {}\n\n        template <typename T, typename = typename std::enable_if<std::is_constructible<double, T>::value>::type>\n        friend bool operator == ( const T& lhs, Approx const& rhs ) {\n            auto lhs_v = static_cast<double>(lhs);\n            return rhs.equalityComparisonImpl(lhs_v);\n        }\n\n        template <typename T, typename = typename std::enable_if<std::is_constructible<double, T>::value>::type>\n        friend bool operator == ( Approx const& lhs, const T& rhs ) {\n            return operator==( rhs, lhs );\n        }\n\n        template <typename T, typename = typename std::enable_if<std::is_constructible<double, T>::value>::type>\n        friend bool operator != ( T const& lhs, Approx const& rhs ) {\n            return !operator==( lhs, rhs );\n        }\n\n        template <typename T, typename = typename std::enable_if<std::is_constructible<double, T>::value>::type>\n        friend bool operator != ( Approx const& lhs, T const& rhs ) {\n            return !operator==( rhs, lhs );\n        }\n\n        template <typename T, typename = typename std::enable_if<std::is_constructible<double, T>::value>::type>\n        friend bool operator <= ( T const& lhs, Approx const& rhs ) {\n            return static_cast<double>(lhs) < rhs.m_value || lhs == rhs;\n        }\n\n        template <typename T, typename = typename std::enable_if<std::is_constructible<double, T>::value>::type>\n        friend bool operator <= ( Approx const& lhs, T const& rhs ) {\n            return lhs.m_value < static_cast<double>(rhs) || lhs == rhs;\n        }\n\n        template <typename T, typename = typename std::enable_if<std::is_constructible<double, T>::value>::type>\n        friend bool operator >= ( T const& lhs, Approx const& rhs ) {\n            return static_cast<double>(lhs) > rhs.m_value || lhs == rhs;\n        }\n\n        template <typename T, typename = typename std::enable_if<std::is_constructible<double, T>::value>::type>\n        friend bool operator >= ( Approx const& lhs, T const& rhs ) {\n            return lhs.m_value > static_cast<double>(rhs) || lhs == rhs;\n        }\n\n        template <typename T, typename = typename std::enable_if<std::is_constructible<double, T>::value>::type>\n        Approx& epsilon( T const& newEpsilon ) {\n            double epsilonAsDouble = static_cast<double>(newEpsilon);\n            setEpsilon(epsilonAsDouble);\n            return *this;\n        }\n\n        template <typename T, typename = typename std::enable_if<std::is_constructible<double, T>::value>::type>\n        Approx& margin( T const& newMargin ) {\n            double marginAsDouble = static_cast<double>(newMargin);\n            setMargin(marginAsDouble);\n            return *this;\n        }\n\n        template <typename T, typename = typename std::enable_if<std::is_constructible<double, T>::value>::type>\n        Approx& scale( T const& newScale ) {\n            m_scale = static_cast<double>(newScale);\n            return *this;\n        }\n\n        std::string toString() const;\n\n    private:\n        double m_epsilon;\n        double m_margin;\n        double m_scale;\n        double m_value;\n    };\n} // end namespace Detail\n\nnamespace literals {\n    Detail::Approx operator \"\" _a(long double val);\n    Detail::Approx operator \"\" _a(unsigned long long val);\n} // end namespace literals\n\ntemplate<>\nstruct StringMaker<Catch::Detail::Approx> {\n    static std::string convert(Catch::Detail::Approx const& value);\n};\n\n} // end namespace Catch\n\n// end catch_approx.h\n// start catch_string_manip.h\n\n#include <string>\n#include <iosfwd>\n#include <vector>\n\nnamespace Catch {\n\n    bool startsWith( std::string const& s, std::string const& prefix );\n    bool startsWith( std::string const& s, char prefix );\n    bool endsWith( std::string const& s, std::string const& suffix );\n    bool endsWith( std::string const& s, char suffix );\n    bool contains( std::string const& s, std::string const& infix );\n    void toLowerInPlace( std::string& s );\n    std::string toLower( std::string const& s );\n    //! Returns a new string without whitespace at the start/end\n    std::string trim( std::string const& str );\n    //! Returns a substring of the original ref without whitespace. Beware lifetimes!\n    StringRef trim(StringRef ref);\n\n    // !!! Be aware, returns refs into original string - make sure original string outlives them\n    std::vector<StringRef> splitStringRef( StringRef str, char delimiter );\n    bool replaceInPlace( std::string& str, std::string const& replaceThis, std::string const& withThis );\n\n    struct pluralise {\n        pluralise( std::size_t count, std::string const& label );\n\n        friend std::ostream& operator << ( std::ostream& os, pluralise const& pluraliser );\n\n        std::size_t m_count;\n        std::string m_label;\n    };\n}\n\n// end catch_string_manip.h\n#ifndef CATCH_CONFIG_DISABLE_MATCHERS\n// start catch_capture_matchers.h\n\n// start catch_matchers.h\n\n#include <string>\n#include <vector>\n\nnamespace Catch {\nnamespace Matchers {\n    namespace Impl {\n\n        template<typename ArgT> struct MatchAllOf;\n        template<typename ArgT> struct MatchAnyOf;\n        template<typename ArgT> struct MatchNotOf;\n\n        class MatcherUntypedBase {\n        public:\n            MatcherUntypedBase() = default;\n            MatcherUntypedBase ( MatcherUntypedBase const& ) = default;\n            MatcherUntypedBase& operator = ( MatcherUntypedBase const& ) = delete;\n            std::string toString() const;\n\n        protected:\n            virtual ~MatcherUntypedBase();\n            virtual std::string describe() const = 0;\n            mutable std::string m_cachedToString;\n        };\n\n#ifdef __clang__\n#    pragma clang diagnostic push\n#    pragma clang diagnostic ignored \"-Wnon-virtual-dtor\"\n#endif\n\n        template<typename ObjectT>\n        struct MatcherMethod {\n            virtual bool match( ObjectT const& arg ) const = 0;\n        };\n\n#if defined(__OBJC__)\n        // Hack to fix Catch GH issue #1661. Could use id for generic Object support.\n        // use of const for Object pointers is very uncommon and under ARC it causes some kind of signature mismatch that breaks compilation\n        template<>\n        struct MatcherMethod<NSString*> {\n            virtual bool match( NSString* arg ) const = 0;\n        };\n#endif\n\n#ifdef __clang__\n#    pragma clang diagnostic pop\n#endif\n\n        template<typename T>\n        struct MatcherBase : MatcherUntypedBase, MatcherMethod<T> {\n\n            MatchAllOf<T> operator && ( MatcherBase const& other ) const;\n            MatchAnyOf<T> operator || ( MatcherBase const& other ) const;\n            MatchNotOf<T> operator ! () const;\n        };\n\n        template<typename ArgT>\n        struct MatchAllOf : MatcherBase<ArgT> {\n            bool match( ArgT const& arg ) const override {\n                for( auto matcher : m_matchers ) {\n                    if (!matcher->match(arg))\n                        return false;\n                }\n                return true;\n            }\n            std::string describe() const override {\n                std::string description;\n                description.reserve( 4 + m_matchers.size()*32 );\n                description += \"( \";\n                bool first = true;\n                for( auto matcher : m_matchers ) {\n                    if( first )\n                        first = false;\n                    else\n                        description += \" and \";\n                    description += matcher->toString();\n                }\n                description += \" )\";\n                return description;\n            }\n\n            MatchAllOf<ArgT> operator && ( MatcherBase<ArgT> const& other ) {\n                auto copy(*this);\n                copy.m_matchers.push_back( &other );\n                return copy;\n            }\n\n            std::vector<MatcherBase<ArgT> const*> m_matchers;\n        };\n        template<typename ArgT>\n        struct MatchAnyOf : MatcherBase<ArgT> {\n\n            bool match( ArgT const& arg ) const override {\n                for( auto matcher : m_matchers ) {\n                    if (matcher->match(arg))\n                        return true;\n                }\n                return false;\n            }\n            std::string describe() const override {\n                std::string description;\n                description.reserve( 4 + m_matchers.size()*32 );\n                description += \"( \";\n                bool first = true;\n                for( auto matcher : m_matchers ) {\n                    if( first )\n                        first = false;\n                    else\n                        description += \" or \";\n                    description += matcher->toString();\n                }\n                description += \" )\";\n                return description;\n            }\n\n            MatchAnyOf<ArgT> operator || ( MatcherBase<ArgT> const& other ) {\n                auto copy(*this);\n                copy.m_matchers.push_back( &other );\n                return copy;\n            }\n\n            std::vector<MatcherBase<ArgT> const*> m_matchers;\n        };\n\n        template<typename ArgT>\n        struct MatchNotOf : MatcherBase<ArgT> {\n\n            MatchNotOf( MatcherBase<ArgT> const& underlyingMatcher ) : m_underlyingMatcher( underlyingMatcher ) {}\n\n            bool match( ArgT const& arg ) const override {\n                return !m_underlyingMatcher.match( arg );\n            }\n\n            std::string describe() const override {\n                return \"not \" + m_underlyingMatcher.toString();\n            }\n            MatcherBase<ArgT> const& m_underlyingMatcher;\n        };\n\n        template<typename T>\n        MatchAllOf<T> MatcherBase<T>::operator && ( MatcherBase const& other ) const {\n            return MatchAllOf<T>() && *this && other;\n        }\n        template<typename T>\n        MatchAnyOf<T> MatcherBase<T>::operator || ( MatcherBase const& other ) const {\n            return MatchAnyOf<T>() || *this || other;\n        }\n        template<typename T>\n        MatchNotOf<T> MatcherBase<T>::operator ! () const {\n            return MatchNotOf<T>( *this );\n        }\n\n    } // namespace Impl\n\n} // namespace Matchers\n\nusing namespace Matchers;\nusing Matchers::Impl::MatcherBase;\n\n} // namespace Catch\n\n// end catch_matchers.h\n// start catch_matchers_exception.hpp\n\nnamespace Catch {\nnamespace Matchers {\nnamespace Exception {\n\nclass ExceptionMessageMatcher : public MatcherBase<std::exception> {\n    std::string m_message;\npublic:\n\n    ExceptionMessageMatcher(std::string const& message):\n        m_message(message)\n    {}\n\n    bool match(std::exception const& ex) const override;\n\n    std::string describe() const override;\n};\n\n} // namespace Exception\n\nException::ExceptionMessageMatcher Message(std::string const& message);\n\n} // namespace Matchers\n} // namespace Catch\n\n// end catch_matchers_exception.hpp\n// start catch_matchers_floating.h\n\nnamespace Catch {\nnamespace Matchers {\n\n    namespace Floating {\n\n        enum class FloatingPointKind : uint8_t;\n\n        struct WithinAbsMatcher : MatcherBase<double> {\n            WithinAbsMatcher(double target, double margin);\n            bool match(double const& matchee) const override;\n            std::string describe() const override;\n        private:\n            double m_target;\n            double m_margin;\n        };\n\n        struct WithinUlpsMatcher : MatcherBase<double> {\n            WithinUlpsMatcher(double target, uint64_t ulps, FloatingPointKind baseType);\n            bool match(double const& matchee) const override;\n            std::string describe() const override;\n        private:\n            double m_target;\n            uint64_t m_ulps;\n            FloatingPointKind m_type;\n        };\n\n        // Given IEEE-754 format for floats and doubles, we can assume\n        // that float -> double promotion is lossless. Given this, we can\n        // assume that if we do the standard relative comparison of\n        // |lhs - rhs| <= epsilon * max(fabs(lhs), fabs(rhs)), then we get\n        // the same result if we do this for floats, as if we do this for\n        // doubles that were promoted from floats.\n        struct WithinRelMatcher : MatcherBase<double> {\n            WithinRelMatcher(double target, double epsilon);\n            bool match(double const& matchee) const override;\n            std::string describe() const override;\n        private:\n            double m_target;\n            double m_epsilon;\n        };\n\n    } // namespace Floating\n\n    // The following functions create the actual matcher objects.\n    // This allows the types to be inferred\n    Floating::WithinUlpsMatcher WithinULP(double target, uint64_t maxUlpDiff);\n    Floating::WithinUlpsMatcher WithinULP(float target, uint64_t maxUlpDiff);\n    Floating::WithinAbsMatcher WithinAbs(double target, double margin);\n    Floating::WithinRelMatcher WithinRel(double target, double eps);\n    // defaults epsilon to 100*numeric_limits<double>::epsilon()\n    Floating::WithinRelMatcher WithinRel(double target);\n    Floating::WithinRelMatcher WithinRel(float target, float eps);\n    // defaults epsilon to 100*numeric_limits<float>::epsilon()\n    Floating::WithinRelMatcher WithinRel(float target);\n\n} // namespace Matchers\n} // namespace Catch\n\n// end catch_matchers_floating.h\n// start catch_matchers_generic.hpp\n\n#include <functional>\n#include <string>\n\nnamespace Catch {\nnamespace Matchers {\nnamespace Generic {\n\nnamespace Detail {\n    std::string finalizeDescription(const std::string& desc);\n}\n\ntemplate <typename T>\nclass PredicateMatcher : public MatcherBase<T> {\n    std::function<bool(T const&)> m_predicate;\n    std::string m_description;\npublic:\n\n    PredicateMatcher(std::function<bool(T const&)> const& elem, std::string const& descr)\n        :m_predicate(std::move(elem)),\n        m_description(Detail::finalizeDescription(descr))\n    {}\n\n    bool match( T const& item ) const override {\n        return m_predicate(item);\n    }\n\n    std::string describe() const override {\n        return m_description;\n    }\n};\n\n} // namespace Generic\n\n    // The following functions create the actual matcher objects.\n    // The user has to explicitly specify type to the function, because\n    // inferring std::function<bool(T const&)> is hard (but possible) and\n    // requires a lot of TMP.\n    template<typename T>\n    Generic::PredicateMatcher<T> Predicate(std::function<bool(T const&)> const& predicate, std::string const& description = \"\") {\n        return Generic::PredicateMatcher<T>(predicate, description);\n    }\n\n} // namespace Matchers\n} // namespace Catch\n\n// end catch_matchers_generic.hpp\n// start catch_matchers_string.h\n\n#include <string>\n\nnamespace Catch {\nnamespace Matchers {\n\n    namespace StdString {\n\n        struct CasedString\n        {\n            CasedString( std::string const& str, CaseSensitive::Choice caseSensitivity );\n            std::string adjustString( std::string const& str ) const;\n            std::string caseSensitivitySuffix() const;\n\n            CaseSensitive::Choice m_caseSensitivity;\n            std::string m_str;\n        };\n\n        struct StringMatcherBase : MatcherBase<std::string> {\n            StringMatcherBase( std::string const& operation, CasedString const& comparator );\n            std::string describe() const override;\n\n            CasedString m_comparator;\n            std::string m_operation;\n        };\n\n        struct EqualsMatcher : StringMatcherBase {\n            EqualsMatcher( CasedString const& comparator );\n            bool match( std::string const& source ) const override;\n        };\n        struct ContainsMatcher : StringMatcherBase {\n            ContainsMatcher( CasedString const& comparator );\n            bool match( std::string const& source ) const override;\n        };\n        struct StartsWithMatcher : StringMatcherBase {\n            StartsWithMatcher( CasedString const& comparator );\n            bool match( std::string const& source ) const override;\n        };\n        struct EndsWithMatcher : StringMatcherBase {\n            EndsWithMatcher( CasedString const& comparator );\n            bool match( std::string const& source ) const override;\n        };\n\n        struct RegexMatcher : MatcherBase<std::string> {\n            RegexMatcher( std::string regex, CaseSensitive::Choice caseSensitivity );\n            bool match( std::string const& matchee ) const override;\n            std::string describe() const override;\n\n        private:\n            std::string m_regex;\n            CaseSensitive::Choice m_caseSensitivity;\n        };\n\n    } // namespace StdString\n\n    // The following functions create the actual matcher objects.\n    // This allows the types to be inferred\n\n    StdString::EqualsMatcher Equals( std::string const& str, CaseSensitive::Choice caseSensitivity = CaseSensitive::Yes );\n    StdString::ContainsMatcher Contains( std::string const& str, CaseSensitive::Choice caseSensitivity = CaseSensitive::Yes );\n    StdString::EndsWithMatcher EndsWith( std::string const& str, CaseSensitive::Choice caseSensitivity = CaseSensitive::Yes );\n    StdString::StartsWithMatcher StartsWith( std::string const& str, CaseSensitive::Choice caseSensitivity = CaseSensitive::Yes );\n    StdString::RegexMatcher Matches( std::string const& regex, CaseSensitive::Choice caseSensitivity = CaseSensitive::Yes );\n\n} // namespace Matchers\n} // namespace Catch\n\n// end catch_matchers_string.h\n// start catch_matchers_vector.h\n\n#include <algorithm>\n\nnamespace Catch {\nnamespace Matchers {\n\n    namespace Vector {\n        template<typename T, typename Alloc>\n        struct ContainsElementMatcher : MatcherBase<std::vector<T, Alloc>> {\n\n            ContainsElementMatcher(T const &comparator) : m_comparator( comparator) {}\n\n            bool match(std::vector<T, Alloc> const &v) const override {\n                for (auto const& el : v) {\n                    if (el == m_comparator) {\n                        return true;\n                    }\n                }\n                return false;\n            }\n\n            std::string describe() const override {\n                return \"Contains: \" + ::Catch::Detail::stringify( m_comparator );\n            }\n\n            T const& m_comparator;\n        };\n\n        template<typename T, typename AllocComp, typename AllocMatch>\n        struct ContainsMatcher : MatcherBase<std::vector<T, AllocMatch>> {\n\n            ContainsMatcher(std::vector<T, AllocComp> const &comparator) : m_comparator( comparator ) {}\n\n            bool match(std::vector<T, AllocMatch> const &v) const override {\n                // !TBD: see note in EqualsMatcher\n                if (m_comparator.size() > v.size())\n                    return false;\n                for (auto const& comparator : m_comparator) {\n                    auto present = false;\n                    for (const auto& el : v) {\n                        if (el == comparator) {\n                            present = true;\n                            break;\n                        }\n                    }\n                    if (!present) {\n                        return false;\n                    }\n                }\n                return true;\n            }\n            std::string describe() const override {\n                return \"Contains: \" + ::Catch::Detail::stringify( m_comparator );\n            }\n\n            std::vector<T, AllocComp> const& m_comparator;\n        };\n\n        template<typename T, typename AllocComp, typename AllocMatch>\n        struct EqualsMatcher : MatcherBase<std::vector<T, AllocMatch>> {\n\n            EqualsMatcher(std::vector<T, AllocComp> const &comparator) : m_comparator( comparator ) {}\n\n            bool match(std::vector<T, AllocMatch> const &v) const override {\n                // !TBD: This currently works if all elements can be compared using !=\n                // - a more general approach would be via a compare template that defaults\n                // to using !=. but could be specialised for, e.g. std::vector<T, Alloc> etc\n                // - then just call that directly\n                if (m_comparator.size() != v.size())\n                    return false;\n                for (std::size_t i = 0; i < v.size(); ++i)\n                    if (m_comparator[i] != v[i])\n                        return false;\n                return true;\n            }\n            std::string describe() const override {\n                return \"Equals: \" + ::Catch::Detail::stringify( m_comparator );\n            }\n            std::vector<T, AllocComp> const& m_comparator;\n        };\n\n        template<typename T, typename AllocComp, typename AllocMatch>\n        struct ApproxMatcher : MatcherBase<std::vector<T, AllocMatch>> {\n\n            ApproxMatcher(std::vector<T, AllocComp> const& comparator) : m_comparator( comparator ) {}\n\n            bool match(std::vector<T, AllocMatch> const &v) const override {\n                if (m_comparator.size() != v.size())\n                    return false;\n                for (std::size_t i = 0; i < v.size(); ++i)\n                    if (m_comparator[i] != approx(v[i]))\n                        return false;\n                return true;\n            }\n            std::string describe() const override {\n                return \"is approx: \" + ::Catch::Detail::stringify( m_comparator );\n            }\n            template <typename = typename std::enable_if<std::is_constructible<double, T>::value>::type>\n            ApproxMatcher& epsilon( T const& newEpsilon ) {\n                approx.epsilon(newEpsilon);\n                return *this;\n            }\n            template <typename = typename std::enable_if<std::is_constructible<double, T>::value>::type>\n            ApproxMatcher& margin( T const& newMargin ) {\n                approx.margin(newMargin);\n                return *this;\n            }\n            template <typename = typename std::enable_if<std::is_constructible<double, T>::value>::type>\n            ApproxMatcher& scale( T const& newScale ) {\n                approx.scale(newScale);\n                return *this;\n            }\n\n            std::vector<T, AllocComp> const& m_comparator;\n            mutable Catch::Detail::Approx approx = Catch::Detail::Approx::custom();\n        };\n\n        template<typename T, typename AllocComp, typename AllocMatch>\n        struct UnorderedEqualsMatcher : MatcherBase<std::vector<T, AllocMatch>> {\n            UnorderedEqualsMatcher(std::vector<T, AllocComp> const& target) : m_target(target) {}\n            bool match(std::vector<T, AllocMatch> const& vec) const override {\n                if (m_target.size() != vec.size()) {\n                    return false;\n                }\n                return std::is_permutation(m_target.begin(), m_target.end(), vec.begin());\n            }\n\n            std::string describe() const override {\n                return \"UnorderedEquals: \" + ::Catch::Detail::stringify(m_target);\n            }\n        private:\n            std::vector<T, AllocComp> const& m_target;\n        };\n\n    } // namespace Vector\n\n    // The following functions create the actual matcher objects.\n    // This allows the types to be inferred\n\n    template<typename T, typename AllocComp = std::allocator<T>, typename AllocMatch = AllocComp>\n    Vector::ContainsMatcher<T, AllocComp, AllocMatch> Contains( std::vector<T, AllocComp> const& comparator ) {\n        return Vector::ContainsMatcher<T, AllocComp, AllocMatch>( comparator );\n    }\n\n    template<typename T, typename Alloc = std::allocator<T>>\n    Vector::ContainsElementMatcher<T, Alloc> VectorContains( T const& comparator ) {\n        return Vector::ContainsElementMatcher<T, Alloc>( comparator );\n    }\n\n    template<typename T, typename AllocComp = std::allocator<T>, typename AllocMatch = AllocComp>\n    Vector::EqualsMatcher<T, AllocComp, AllocMatch> Equals( std::vector<T, AllocComp> const& comparator ) {\n        return Vector::EqualsMatcher<T, AllocComp, AllocMatch>( comparator );\n    }\n\n    template<typename T, typename AllocComp = std::allocator<T>, typename AllocMatch = AllocComp>\n    Vector::ApproxMatcher<T, AllocComp, AllocMatch> Approx( std::vector<T, AllocComp> const& comparator ) {\n        return Vector::ApproxMatcher<T, AllocComp, AllocMatch>( comparator );\n    }\n\n    template<typename T, typename AllocComp = std::allocator<T>, typename AllocMatch = AllocComp>\n    Vector::UnorderedEqualsMatcher<T, AllocComp, AllocMatch> UnorderedEquals(std::vector<T, AllocComp> const& target) {\n        return Vector::UnorderedEqualsMatcher<T, AllocComp, AllocMatch>( target );\n    }\n\n} // namespace Matchers\n} // namespace Catch\n\n// end catch_matchers_vector.h\nnamespace Catch {\n\n    template<typename ArgT, typename MatcherT>\n    class MatchExpr : public ITransientExpression {\n        ArgT const& m_arg;\n        MatcherT m_matcher;\n        StringRef m_matcherString;\n    public:\n        MatchExpr( ArgT const& arg, MatcherT const& matcher, StringRef const& matcherString )\n        :   ITransientExpression{ true, matcher.match( arg ) },\n            m_arg( arg ),\n            m_matcher( matcher ),\n            m_matcherString( matcherString )\n        {}\n\n        void streamReconstructedExpression( std::ostream &os ) const override {\n            auto matcherAsString = m_matcher.toString();\n            os << Catch::Detail::stringify( m_arg ) << ' ';\n            if( matcherAsString == Detail::unprintableString )\n                os << m_matcherString;\n            else\n                os << matcherAsString;\n        }\n    };\n\n    using StringMatcher = Matchers::Impl::MatcherBase<std::string>;\n\n    void handleExceptionMatchExpr( AssertionHandler& handler, StringMatcher const& matcher, StringRef const& matcherString  );\n\n    template<typename ArgT, typename MatcherT>\n    auto makeMatchExpr( ArgT const& arg, MatcherT const& matcher, StringRef const& matcherString  ) -> MatchExpr<ArgT, MatcherT> {\n        return MatchExpr<ArgT, MatcherT>( arg, matcher, matcherString );\n    }\n\n} // namespace Catch\n\n///////////////////////////////////////////////////////////////////////////////\n#define INTERNAL_CHECK_THAT( macroName, matcher, resultDisposition, arg ) \\\n    do { \\\n        Catch::AssertionHandler catchAssertionHandler( macroName##_catch_sr, CATCH_INTERNAL_LINEINFO, CATCH_INTERNAL_STRINGIFY(arg) \", \" CATCH_INTERNAL_STRINGIFY(matcher), resultDisposition ); \\\n        INTERNAL_CATCH_TRY { \\\n            catchAssertionHandler.handleExpr( Catch::makeMatchExpr( arg, matcher, #matcher##_catch_sr ) ); \\\n        } INTERNAL_CATCH_CATCH( catchAssertionHandler ) \\\n        INTERNAL_CATCH_REACT( catchAssertionHandler ) \\\n    } while( false )\n\n///////////////////////////////////////////////////////////////////////////////\n#define INTERNAL_CATCH_THROWS_MATCHES( macroName, exceptionType, resultDisposition, matcher, ... ) \\\n    do { \\\n        Catch::AssertionHandler catchAssertionHandler( macroName##_catch_sr, CATCH_INTERNAL_LINEINFO, CATCH_INTERNAL_STRINGIFY(__VA_ARGS__) \", \" CATCH_INTERNAL_STRINGIFY(exceptionType) \", \" CATCH_INTERNAL_STRINGIFY(matcher), resultDisposition ); \\\n        if( catchAssertionHandler.allowThrows() ) \\\n            try { \\\n                static_cast<void>(__VA_ARGS__ ); \\\n                catchAssertionHandler.handleUnexpectedExceptionNotThrown(); \\\n            } \\\n            catch( exceptionType const& ex ) { \\\n                catchAssertionHandler.handleExpr( Catch::makeMatchExpr( ex, matcher, #matcher##_catch_sr ) ); \\\n            } \\\n            catch( ... ) { \\\n                catchAssertionHandler.handleUnexpectedInflightException(); \\\n            } \\\n        else \\\n            catchAssertionHandler.handleThrowingCallSkipped(); \\\n        INTERNAL_CATCH_REACT( catchAssertionHandler ) \\\n    } while( false )\n\n// end catch_capture_matchers.h\n#endif\n// start catch_generators.hpp\n\n// start catch_interfaces_generatortracker.h\n\n\n#include <memory>\n\nnamespace Catch {\n\n    namespace Generators {\n        class GeneratorUntypedBase {\n        public:\n            GeneratorUntypedBase() = default;\n            virtual ~GeneratorUntypedBase();\n            // Attempts to move the generator to the next element\n             //\n             // Returns true iff the move succeeded (and a valid element\n             // can be retrieved).\n            virtual bool next() = 0;\n        };\n        using GeneratorBasePtr = std::unique_ptr<GeneratorUntypedBase>;\n\n    } // namespace Generators\n\n    struct IGeneratorTracker {\n        virtual ~IGeneratorTracker();\n        virtual auto hasGenerator() const -> bool = 0;\n        virtual auto getGenerator() const -> Generators::GeneratorBasePtr const& = 0;\n        virtual void setGenerator( Generators::GeneratorBasePtr&& generator ) = 0;\n    };\n\n} // namespace Catch\n\n// end catch_interfaces_generatortracker.h\n// start catch_enforce.h\n\n#include <exception>\n\nnamespace Catch {\n#if !defined(CATCH_CONFIG_DISABLE_EXCEPTIONS)\n    template <typename Ex>\n    [[noreturn]]\n    void throw_exception(Ex const& e) {\n        throw e;\n    }\n#else // ^^ Exceptions are enabled //  Exceptions are disabled vv\n    [[noreturn]]\n    void throw_exception(std::exception const& e);\n#endif\n\n    [[noreturn]]\n    void throw_logic_error(std::string const& msg);\n    [[noreturn]]\n    void throw_domain_error(std::string const& msg);\n    [[noreturn]]\n    void throw_runtime_error(std::string const& msg);\n\n} // namespace Catch;\n\n#define CATCH_MAKE_MSG(...) \\\n    (Catch::ReusableStringStream() << __VA_ARGS__).str()\n\n#define CATCH_INTERNAL_ERROR(...) \\\n    Catch::throw_logic_error(CATCH_MAKE_MSG( CATCH_INTERNAL_LINEINFO << \": Internal Catch2 error: \" << __VA_ARGS__))\n\n#define CATCH_ERROR(...) \\\n    Catch::throw_domain_error(CATCH_MAKE_MSG( __VA_ARGS__ ))\n\n#define CATCH_RUNTIME_ERROR(...) \\\n    Catch::throw_runtime_error(CATCH_MAKE_MSG( __VA_ARGS__ ))\n\n#define CATCH_ENFORCE( condition, ... ) \\\n    do{ if( !(condition) ) CATCH_ERROR( __VA_ARGS__ ); } while(false)\n\n// end catch_enforce.h\n#include <memory>\n#include <vector>\n#include <cassert>\n\n#include <utility>\n#include <exception>\n\nnamespace Catch {\n\nclass GeneratorException : public std::exception {\n    const char* const m_msg = \"\";\n\npublic:\n    GeneratorException(const char* msg):\n        m_msg(msg)\n    {}\n\n    const char* what() const noexcept override final;\n};\n\nnamespace Generators {\n\n    // !TBD move this into its own location?\n    namespace pf{\n        template<typename T, typename... Args>\n        std::unique_ptr<T> make_unique( Args&&... args ) {\n            return std::unique_ptr<T>(new T(std::forward<Args>(args)...));\n        }\n    }\n\n    template<typename T>\n    struct IGenerator : GeneratorUntypedBase {\n        virtual ~IGenerator() = default;\n\n        // Returns the current element of the generator\n        //\n        // \\Precondition The generator is either freshly constructed,\n        // or the last call to `next()` returned true\n        virtual T const& get() const = 0;\n        using type = T;\n    };\n\n    template<typename T>\n    class SingleValueGenerator final : public IGenerator<T> {\n        T m_value;\n    public:\n        SingleValueGenerator(T&& value) : m_value(std::move(value)) {}\n\n        T const& get() const override {\n            return m_value;\n        }\n        bool next() override {\n            return false;\n        }\n    };\n\n    template<typename T>\n    class FixedValuesGenerator final : public IGenerator<T> {\n        static_assert(!std::is_same<T, bool>::value,\n            \"FixedValuesGenerator does not support bools because of std::vector<bool>\"\n            \"specialization, use SingleValue Generator instead.\");\n        std::vector<T> m_values;\n        size_t m_idx = 0;\n    public:\n        FixedValuesGenerator( std::initializer_list<T> values ) : m_values( values ) {}\n\n        T const& get() const override {\n            return m_values[m_idx];\n        }\n        bool next() override {\n            ++m_idx;\n            return m_idx < m_values.size();\n        }\n    };\n\n    template <typename T>\n    class GeneratorWrapper final {\n        std::unique_ptr<IGenerator<T>> m_generator;\n    public:\n        GeneratorWrapper(std::unique_ptr<IGenerator<T>> generator):\n            m_generator(std::move(generator))\n        {}\n        T const& get() const {\n            return m_generator->get();\n        }\n        bool next() {\n            return m_generator->next();\n        }\n    };\n\n    template <typename T>\n    GeneratorWrapper<T> value(T&& value) {\n        return GeneratorWrapper<T>(pf::make_unique<SingleValueGenerator<T>>(std::forward<T>(value)));\n    }\n    template <typename T>\n    GeneratorWrapper<T> values(std::initializer_list<T> values) {\n        return GeneratorWrapper<T>(pf::make_unique<FixedValuesGenerator<T>>(values));\n    }\n\n    template<typename T>\n    class Generators : public IGenerator<T> {\n        std::vector<GeneratorWrapper<T>> m_generators;\n        size_t m_current = 0;\n\n        void populate(GeneratorWrapper<T>&& generator) {\n            m_generators.emplace_back(std::move(generator));\n        }\n        void populate(T&& val) {\n            m_generators.emplace_back(value(std::forward<T>(val)));\n        }\n        template<typename U>\n        void populate(U&& val) {\n            populate(T(std::forward<U>(val)));\n        }\n        template<typename U, typename... Gs>\n        void populate(U&& valueOrGenerator, Gs &&... moreGenerators) {\n            populate(std::forward<U>(valueOrGenerator));\n            populate(std::forward<Gs>(moreGenerators)...);\n        }\n\n    public:\n        template <typename... Gs>\n        Generators(Gs &&... moreGenerators) {\n            m_generators.reserve(sizeof...(Gs));\n            populate(std::forward<Gs>(moreGenerators)...);\n        }\n\n        T const& get() const override {\n            return m_generators[m_current].get();\n        }\n\n        bool next() override {\n            if (m_current >= m_generators.size()) {\n                return false;\n            }\n            const bool current_status = m_generators[m_current].next();\n            if (!current_status) {\n                ++m_current;\n            }\n            return m_current < m_generators.size();\n        }\n    };\n\n    template<typename... Ts>\n    GeneratorWrapper<std::tuple<Ts...>> table( std::initializer_list<std::tuple<typename std::decay<Ts>::type...>> tuples ) {\n        return values<std::tuple<Ts...>>( tuples );\n    }\n\n    // Tag type to signal that a generator sequence should convert arguments to a specific type\n    template <typename T>\n    struct as {};\n\n    template<typename T, typename... Gs>\n    auto makeGenerators( GeneratorWrapper<T>&& generator, Gs &&... moreGenerators ) -> Generators<T> {\n        return Generators<T>(std::move(generator), std::forward<Gs>(moreGenerators)...);\n    }\n    template<typename T>\n    auto makeGenerators( GeneratorWrapper<T>&& generator ) -> Generators<T> {\n        return Generators<T>(std::move(generator));\n    }\n    template<typename T, typename... Gs>\n    auto makeGenerators( T&& val, Gs &&... moreGenerators ) -> Generators<T> {\n        return makeGenerators( value( std::forward<T>( val ) ), std::forward<Gs>( moreGenerators )... );\n    }\n    template<typename T, typename U, typename... Gs>\n    auto makeGenerators( as<T>, U&& val, Gs &&... moreGenerators ) -> Generators<T> {\n        return makeGenerators( value( T( std::forward<U>( val ) ) ), std::forward<Gs>( moreGenerators )... );\n    }\n\n    auto acquireGeneratorTracker( StringRef generatorName, SourceLineInfo const& lineInfo ) -> IGeneratorTracker&;\n\n    template<typename L>\n    // Note: The type after -> is weird, because VS2015 cannot parse\n    //       the expression used in the typedef inside, when it is in\n    //       return type. Yeah.\n    auto generate( StringRef generatorName, SourceLineInfo const& lineInfo, L const& generatorExpression ) -> decltype(std::declval<decltype(generatorExpression())>().get()) {\n        using UnderlyingType = typename decltype(generatorExpression())::type;\n\n        IGeneratorTracker& tracker = acquireGeneratorTracker( generatorName, lineInfo );\n        if (!tracker.hasGenerator()) {\n            tracker.setGenerator(pf::make_unique<Generators<UnderlyingType>>(generatorExpression()));\n        }\n\n        auto const& generator = static_cast<IGenerator<UnderlyingType> const&>( *tracker.getGenerator() );\n        return generator.get();\n    }\n\n} // namespace Generators\n} // namespace Catch\n\n#define GENERATE( ... ) \\\n    Catch::Generators::generate( INTERNAL_CATCH_STRINGIZE(INTERNAL_CATCH_UNIQUE_NAME(generator)), \\\n                                 CATCH_INTERNAL_LINEINFO, \\\n                                 [ ]{ using namespace Catch::Generators; return makeGenerators( __VA_ARGS__ ); } ) //NOLINT(google-build-using-namespace)\n#define GENERATE_COPY( ... ) \\\n    Catch::Generators::generate( INTERNAL_CATCH_STRINGIZE(INTERNAL_CATCH_UNIQUE_NAME(generator)), \\\n                                 CATCH_INTERNAL_LINEINFO, \\\n                                 [=]{ using namespace Catch::Generators; return makeGenerators( __VA_ARGS__ ); } ) //NOLINT(google-build-using-namespace)\n#define GENERATE_REF( ... ) \\\n    Catch::Generators::generate( INTERNAL_CATCH_STRINGIZE(INTERNAL_CATCH_UNIQUE_NAME(generator)), \\\n                                 CATCH_INTERNAL_LINEINFO, \\\n                                 [&]{ using namespace Catch::Generators; return makeGenerators( __VA_ARGS__ ); } ) //NOLINT(google-build-using-namespace)\n\n// end catch_generators.hpp\n// start catch_generators_generic.hpp\n\nnamespace Catch {\nnamespace Generators {\n\n    template <typename T>\n    class TakeGenerator : public IGenerator<T> {\n        GeneratorWrapper<T> m_generator;\n        size_t m_returned = 0;\n        size_t m_target;\n    public:\n        TakeGenerator(size_t target, GeneratorWrapper<T>&& generator):\n            m_generator(std::move(generator)),\n            m_target(target)\n        {\n            assert(target != 0 && \"Empty generators are not allowed\");\n        }\n        T const& get() const override {\n            return m_generator.get();\n        }\n        bool next() override {\n            ++m_returned;\n            if (m_returned >= m_target) {\n                return false;\n            }\n\n            const auto success = m_generator.next();\n            // If the underlying generator does not contain enough values\n            // then we cut short as well\n            if (!success) {\n                m_returned = m_target;\n            }\n            return success;\n        }\n    };\n\n    template <typename T>\n    GeneratorWrapper<T> take(size_t target, GeneratorWrapper<T>&& generator) {\n        return GeneratorWrapper<T>(pf::make_unique<TakeGenerator<T>>(target, std::move(generator)));\n    }\n\n    template <typename T, typename Predicate>\n    class FilterGenerator : public IGenerator<T> {\n        GeneratorWrapper<T> m_generator;\n        Predicate m_predicate;\n    public:\n        template <typename P = Predicate>\n        FilterGenerator(P&& pred, GeneratorWrapper<T>&& generator):\n            m_generator(std::move(generator)),\n            m_predicate(std::forward<P>(pred))\n        {\n            if (!m_predicate(m_generator.get())) {\n                // It might happen that there are no values that pass the\n                // filter. In that case we throw an exception.\n                auto has_initial_value = nextImpl();\n                if (!has_initial_value) {\n                    Catch::throw_exception(GeneratorException(\"No valid value found in filtered generator\"));\n                }\n            }\n        }\n\n        T const& get() const override {\n            return m_generator.get();\n        }\n\n        bool next() override {\n            return nextImpl();\n        }\n\n    private:\n        bool nextImpl() {\n            bool success = m_generator.next();\n            if (!success) {\n                return false;\n            }\n            while (!m_predicate(m_generator.get()) && (success = m_generator.next()) == true);\n            return success;\n        }\n    };\n\n    template <typename T, typename Predicate>\n    GeneratorWrapper<T> filter(Predicate&& pred, GeneratorWrapper<T>&& generator) {\n        return GeneratorWrapper<T>(std::unique_ptr<IGenerator<T>>(pf::make_unique<FilterGenerator<T, Predicate>>(std::forward<Predicate>(pred), std::move(generator))));\n    }\n\n    template <typename T>\n    class RepeatGenerator : public IGenerator<T> {\n        static_assert(!std::is_same<T, bool>::value,\n            \"RepeatGenerator currently does not support bools\"\n            \"because of std::vector<bool> specialization\");\n        GeneratorWrapper<T> m_generator;\n        mutable std::vector<T> m_returned;\n        size_t m_target_repeats;\n        size_t m_current_repeat = 0;\n        size_t m_repeat_index = 0;\n    public:\n        RepeatGenerator(size_t repeats, GeneratorWrapper<T>&& generator):\n            m_generator(std::move(generator)),\n            m_target_repeats(repeats)\n        {\n            assert(m_target_repeats > 0 && \"Repeat generator must repeat at least once\");\n        }\n\n        T const& get() const override {\n            if (m_current_repeat == 0) {\n                m_returned.push_back(m_generator.get());\n                return m_returned.back();\n            }\n            return m_returned[m_repeat_index];\n        }\n\n        bool next() override {\n            // There are 2 basic cases:\n            // 1) We are still reading the generator\n            // 2) We are reading our own cache\n\n            // In the first case, we need to poke the underlying generator.\n            // If it happily moves, we are left in that state, otherwise it is time to start reading from our cache\n            if (m_current_repeat == 0) {\n                const auto success = m_generator.next();\n                if (!success) {\n                    ++m_current_repeat;\n                }\n                return m_current_repeat < m_target_repeats;\n            }\n\n            // In the second case, we need to move indices forward and check that we haven't run up against the end\n            ++m_repeat_index;\n            if (m_repeat_index == m_returned.size()) {\n                m_repeat_index = 0;\n                ++m_current_repeat;\n            }\n            return m_current_repeat < m_target_repeats;\n        }\n    };\n\n    template <typename T>\n    GeneratorWrapper<T> repeat(size_t repeats, GeneratorWrapper<T>&& generator) {\n        return GeneratorWrapper<T>(pf::make_unique<RepeatGenerator<T>>(repeats, std::move(generator)));\n    }\n\n    template <typename T, typename U, typename Func>\n    class MapGenerator : public IGenerator<T> {\n        // TBD: provide static assert for mapping function, for friendly error message\n        GeneratorWrapper<U> m_generator;\n        Func m_function;\n        // To avoid returning dangling reference, we have to save the values\n        T m_cache;\n    public:\n        template <typename F2 = Func>\n        MapGenerator(F2&& function, GeneratorWrapper<U>&& generator) :\n            m_generator(std::move(generator)),\n            m_function(std::forward<F2>(function)),\n            m_cache(m_function(m_generator.get()))\n        {}\n\n        T const& get() const override {\n            return m_cache;\n        }\n        bool next() override {\n            const auto success = m_generator.next();\n            if (success) {\n                m_cache = m_function(m_generator.get());\n            }\n            return success;\n        }\n    };\n\n    template <typename Func, typename U, typename T = FunctionReturnType<Func, U>>\n    GeneratorWrapper<T> map(Func&& function, GeneratorWrapper<U>&& generator) {\n        return GeneratorWrapper<T>(\n            pf::make_unique<MapGenerator<T, U, Func>>(std::forward<Func>(function), std::move(generator))\n        );\n    }\n\n    template <typename T, typename U, typename Func>\n    GeneratorWrapper<T> map(Func&& function, GeneratorWrapper<U>&& generator) {\n        return GeneratorWrapper<T>(\n            pf::make_unique<MapGenerator<T, U, Func>>(std::forward<Func>(function), std::move(generator))\n        );\n    }\n\n    template <typename T>\n    class ChunkGenerator final : public IGenerator<std::vector<T>> {\n        std::vector<T> m_chunk;\n        size_t m_chunk_size;\n        GeneratorWrapper<T> m_generator;\n        bool m_used_up = false;\n    public:\n        ChunkGenerator(size_t size, GeneratorWrapper<T> generator) :\n            m_chunk_size(size), m_generator(std::move(generator))\n        {\n            m_chunk.reserve(m_chunk_size);\n            if (m_chunk_size != 0) {\n                m_chunk.push_back(m_generator.get());\n                for (size_t i = 1; i < m_chunk_size; ++i) {\n                    if (!m_generator.next()) {\n                        Catch::throw_exception(GeneratorException(\"Not enough values to initialize the first chunk\"));\n                    }\n                    m_chunk.push_back(m_generator.get());\n                }\n            }\n        }\n        std::vector<T> const& get() const override {\n            return m_chunk;\n        }\n        bool next() override {\n            m_chunk.clear();\n            for (size_t idx = 0; idx < m_chunk_size; ++idx) {\n                if (!m_generator.next()) {\n                    return false;\n                }\n                m_chunk.push_back(m_generator.get());\n            }\n            return true;\n        }\n    };\n\n    template <typename T>\n    GeneratorWrapper<std::vector<T>> chunk(size_t size, GeneratorWrapper<T>&& generator) {\n        return GeneratorWrapper<std::vector<T>>(\n            pf::make_unique<ChunkGenerator<T>>(size, std::move(generator))\n        );\n    }\n\n} // namespace Generators\n} // namespace Catch\n\n// end catch_generators_generic.hpp\n// start catch_generators_specific.hpp\n\n// start catch_context.h\n\n#include <memory>\n\nnamespace Catch {\n\n    struct IResultCapture;\n    struct IRunner;\n    struct IConfig;\n    struct IMutableContext;\n\n    using IConfigPtr = std::shared_ptr<IConfig const>;\n\n    struct IContext\n    {\n        virtual ~IContext();\n\n        virtual IResultCapture* getResultCapture() = 0;\n        virtual IRunner* getRunner() = 0;\n        virtual IConfigPtr const& getConfig() const = 0;\n    };\n\n    struct IMutableContext : IContext\n    {\n        virtual ~IMutableContext();\n        virtual void setResultCapture( IResultCapture* resultCapture ) = 0;\n        virtual void setRunner( IRunner* runner ) = 0;\n        virtual void setConfig( IConfigPtr const& config ) = 0;\n\n    private:\n        static IMutableContext *currentContext;\n        friend IMutableContext& getCurrentMutableContext();\n        friend void cleanUpContext();\n        static void createContext();\n    };\n\n    inline IMutableContext& getCurrentMutableContext()\n    {\n        if( !IMutableContext::currentContext )\n            IMutableContext::createContext();\n        // NOLINTNEXTLINE(clang-analyzer-core.uninitialized.UndefReturn)\n        return *IMutableContext::currentContext;\n    }\n\n    inline IContext& getCurrentContext()\n    {\n        return getCurrentMutableContext();\n    }\n\n    void cleanUpContext();\n\n    class SimplePcg32;\n    SimplePcg32& rng();\n}\n\n// end catch_context.h\n// start catch_interfaces_config.h\n\n// start catch_option.hpp\n\nnamespace Catch {\n\n    // An optional type\n    template<typename T>\n    class Option {\n    public:\n        Option() : nullableValue( nullptr ) {}\n        Option( T const& _value )\n        : nullableValue( new( storage ) T( _value ) )\n        {}\n        Option( Option const& _other )\n        : nullableValue( _other ? new( storage ) T( *_other ) : nullptr )\n        {}\n\n        ~Option() {\n            reset();\n        }\n\n        Option& operator= ( Option const& _other ) {\n            if( &_other != this ) {\n                reset();\n                if( _other )\n                    nullableValue = new( storage ) T( *_other );\n            }\n            return *this;\n        }\n        Option& operator = ( T const& _value ) {\n            reset();\n            nullableValue = new( storage ) T( _value );\n            return *this;\n        }\n\n        void reset() {\n            if( nullableValue )\n                nullableValue->~T();\n            nullableValue = nullptr;\n        }\n\n        T& operator*() { return *nullableValue; }\n        T const& operator*() const { return *nullableValue; }\n        T* operator->() { return nullableValue; }\n        const T* operator->() const { return nullableValue; }\n\n        T valueOr( T const& defaultValue ) const {\n            return nullableValue ? *nullableValue : defaultValue;\n        }\n\n        bool some() const { return nullableValue != nullptr; }\n        bool none() const { return nullableValue == nullptr; }\n\n        bool operator !() const { return nullableValue == nullptr; }\n        explicit operator bool() const {\n            return some();\n        }\n\n    private:\n        T *nullableValue;\n        alignas(alignof(T)) char storage[sizeof(T)];\n    };\n\n} // end namespace Catch\n\n// end catch_option.hpp\n#include <chrono>\n#include <iosfwd>\n#include <string>\n#include <vector>\n#include <memory>\n\nnamespace Catch {\n\n    enum class Verbosity {\n        Quiet = 0,\n        Normal,\n        High\n    };\n\n    struct WarnAbout { enum What {\n        Nothing = 0x00,\n        NoAssertions = 0x01,\n        NoTests = 0x02\n    }; };\n\n    struct ShowDurations { enum OrNot {\n        DefaultForReporter,\n        Always,\n        Never\n    }; };\n    struct RunTests { enum InWhatOrder {\n        InDeclarationOrder,\n        InLexicographicalOrder,\n        InRandomOrder\n    }; };\n    struct UseColour { enum YesOrNo {\n        Auto,\n        Yes,\n        No\n    }; };\n    struct WaitForKeypress { enum When {\n        Never,\n        BeforeStart = 1,\n        BeforeExit = 2,\n        BeforeStartAndExit = BeforeStart | BeforeExit\n    }; };\n\n    class TestSpec;\n\n    struct IConfig : NonCopyable {\n\n        virtual ~IConfig();\n\n        virtual bool allowThrows() const = 0;\n        virtual std::ostream& stream() const = 0;\n        virtual std::string name() const = 0;\n        virtual bool includeSuccessfulResults() const = 0;\n        virtual bool shouldDebugBreak() const = 0;\n        virtual bool warnAboutMissingAssertions() const = 0;\n        virtual bool warnAboutNoTests() const = 0;\n        virtual int abortAfter() const = 0;\n        virtual bool showInvisibles() const = 0;\n        virtual ShowDurations::OrNot showDurations() const = 0;\n        virtual double minDuration() const = 0;\n        virtual TestSpec const& testSpec() const = 0;\n        virtual bool hasTestFilters() const = 0;\n        virtual std::vector<std::string> const& getTestsOrTags() const = 0;\n        virtual RunTests::InWhatOrder runOrder() const = 0;\n        virtual unsigned int rngSeed() const = 0;\n        virtual UseColour::YesOrNo useColour() const = 0;\n        virtual std::vector<std::string> const& getSectionsToRun() const = 0;\n        virtual Verbosity verbosity() const = 0;\n\n        virtual bool benchmarkNoAnalysis() const = 0;\n        virtual int benchmarkSamples() const = 0;\n        virtual double benchmarkConfidenceInterval() const = 0;\n        virtual unsigned int benchmarkResamples() const = 0;\n        virtual std::chrono::milliseconds benchmarkWarmupTime() const = 0;\n    };\n\n    using IConfigPtr = std::shared_ptr<IConfig const>;\n}\n\n// end catch_interfaces_config.h\n// start catch_random_number_generator.h\n\n#include <cstdint>\n\nnamespace Catch {\n\n    // This is a simple implementation of C++11 Uniform Random Number\n    // Generator. It does not provide all operators, because Catch2\n    // does not use it, but it should behave as expected inside stdlib's\n    // distributions.\n    // The implementation is based on the PCG family (http://pcg-random.org)\n    class SimplePcg32 {\n        using state_type = std::uint64_t;\n    public:\n        using result_type = std::uint32_t;\n        static constexpr result_type (min)() {\n            return 0;\n        }\n        static constexpr result_type (max)() {\n            return static_cast<result_type>(-1);\n        }\n\n        // Provide some default initial state for the default constructor\n        SimplePcg32():SimplePcg32(0xed743cc4U) {}\n\n        explicit SimplePcg32(result_type seed_);\n\n        void seed(result_type seed_);\n        void discard(uint64_t skip);\n\n        result_type operator()();\n\n    private:\n        friend bool operator==(SimplePcg32 const& lhs, SimplePcg32 const& rhs);\n        friend bool operator!=(SimplePcg32 const& lhs, SimplePcg32 const& rhs);\n\n        // In theory we also need operator<< and operator>>\n        // In practice we do not use them, so we will skip them for now\n\n        std::uint64_t m_state;\n        // This part of the state determines which \"stream\" of the numbers\n        // is chosen -- we take it as a constant for Catch2, so we only\n        // need to deal with seeding the main state.\n        // Picked by reading 8 bytes from `/dev/random` :-)\n        static const std::uint64_t s_inc = (0x13ed0cc53f939476ULL << 1ULL) | 1ULL;\n    };\n\n} // end namespace Catch\n\n// end catch_random_number_generator.h\n#include <random>\n\nnamespace Catch {\nnamespace Generators {\n\ntemplate <typename Float>\nclass RandomFloatingGenerator final : public IGenerator<Float> {\n    Catch::SimplePcg32& m_rng;\n    std::uniform_real_distribution<Float> m_dist;\n    Float m_current_number;\npublic:\n\n    RandomFloatingGenerator(Float a, Float b):\n        m_rng(rng()),\n        m_dist(a, b) {\n        static_cast<void>(next());\n    }\n\n    Float const& get() const override {\n        return m_current_number;\n    }\n    bool next() override {\n        m_current_number = m_dist(m_rng);\n        return true;\n    }\n};\n\ntemplate <typename Integer>\nclass RandomIntegerGenerator final : public IGenerator<Integer> {\n    Catch::SimplePcg32& m_rng;\n    std::uniform_int_distribution<Integer> m_dist;\n    Integer m_current_number;\npublic:\n\n    RandomIntegerGenerator(Integer a, Integer b):\n        m_rng(rng()),\n        m_dist(a, b) {\n        static_cast<void>(next());\n    }\n\n    Integer const& get() const override {\n        return m_current_number;\n    }\n    bool next() override {\n        m_current_number = m_dist(m_rng);\n        return true;\n    }\n};\n\n// TODO: Ideally this would be also constrained against the various char types,\n//       but I don't expect users to run into that in practice.\ntemplate <typename T>\ntypename std::enable_if<std::is_integral<T>::value && !std::is_same<T, bool>::value,\nGeneratorWrapper<T>>::type\nrandom(T a, T b) {\n    return GeneratorWrapper<T>(\n        pf::make_unique<RandomIntegerGenerator<T>>(a, b)\n    );\n}\n\ntemplate <typename T>\ntypename std::enable_if<std::is_floating_point<T>::value,\nGeneratorWrapper<T>>::type\nrandom(T a, T b) {\n    return GeneratorWrapper<T>(\n        pf::make_unique<RandomFloatingGenerator<T>>(a, b)\n    );\n}\n\ntemplate <typename T>\nclass RangeGenerator final : public IGenerator<T> {\n    T m_current;\n    T m_end;\n    T m_step;\n    bool m_positive;\n\npublic:\n    RangeGenerator(T const& start, T const& end, T const& step):\n        m_current(start),\n        m_end(end),\n        m_step(step),\n        m_positive(m_step > T(0))\n    {\n        assert(m_current != m_end && \"Range start and end cannot be equal\");\n        assert(m_step != T(0) && \"Step size cannot be zero\");\n        assert(((m_positive && m_current <= m_end) || (!m_positive && m_current >= m_end)) && \"Step moves away from end\");\n    }\n\n    RangeGenerator(T const& start, T const& end):\n        RangeGenerator(start, end, (start < end) ? T(1) : T(-1))\n    {}\n\n    T const& get() const override {\n        return m_current;\n    }\n\n    bool next() override {\n        m_current += m_step;\n        return (m_positive) ? (m_current < m_end) : (m_current > m_end);\n    }\n};\n\ntemplate <typename T>\nGeneratorWrapper<T> range(T const& start, T const& end, T const& step) {\n    static_assert(std::is_arithmetic<T>::value && !std::is_same<T, bool>::value, \"Type must be numeric\");\n    return GeneratorWrapper<T>(pf::make_unique<RangeGenerator<T>>(start, end, step));\n}\n\ntemplate <typename T>\nGeneratorWrapper<T> range(T const& start, T const& end) {\n    static_assert(std::is_integral<T>::value && !std::is_same<T, bool>::value, \"Type must be an integer\");\n    return GeneratorWrapper<T>(pf::make_unique<RangeGenerator<T>>(start, end));\n}\n\ntemplate <typename T>\nclass IteratorGenerator final : public IGenerator<T> {\n    static_assert(!std::is_same<T, bool>::value,\n        \"IteratorGenerator currently does not support bools\"\n        \"because of std::vector<bool> specialization\");\n\n    std::vector<T> m_elems;\n    size_t m_current = 0;\npublic:\n    template <typename InputIterator, typename InputSentinel>\n    IteratorGenerator(InputIterator first, InputSentinel last):m_elems(first, last) {\n        if (m_elems.empty()) {\n            Catch::throw_exception(GeneratorException(\"IteratorGenerator received no valid values\"));\n        }\n    }\n\n    T const& get() const override {\n        return m_elems[m_current];\n    }\n\n    bool next() override {\n        ++m_current;\n        return m_current != m_elems.size();\n    }\n};\n\ntemplate <typename InputIterator,\n          typename InputSentinel,\n          typename ResultType = typename std::iterator_traits<InputIterator>::value_type>\nGeneratorWrapper<ResultType> from_range(InputIterator from, InputSentinel to) {\n    return GeneratorWrapper<ResultType>(pf::make_unique<IteratorGenerator<ResultType>>(from, to));\n}\n\ntemplate <typename Container,\n          typename ResultType = typename Container::value_type>\nGeneratorWrapper<ResultType> from_range(Container const& cnt) {\n    return GeneratorWrapper<ResultType>(pf::make_unique<IteratorGenerator<ResultType>>(cnt.begin(), cnt.end()));\n}\n\n} // namespace Generators\n} // namespace Catch\n\n// end catch_generators_specific.hpp\n\n// These files are included here so the single_include script doesn't put them\n// in the conditionally compiled sections\n// start catch_test_case_info.h\n\n#include <string>\n#include <vector>\n#include <memory>\n\n#ifdef __clang__\n#pragma clang diagnostic push\n#pragma clang diagnostic ignored \"-Wpadded\"\n#endif\n\nnamespace Catch {\n\n    struct ITestInvoker;\n\n    struct TestCaseInfo {\n        enum SpecialProperties{\n            None = 0,\n            IsHidden = 1 << 1,\n            ShouldFail = 1 << 2,\n            MayFail = 1 << 3,\n            Throws = 1 << 4,\n            NonPortable = 1 << 5,\n            Benchmark = 1 << 6\n        };\n\n        TestCaseInfo(   std::string const& _name,\n                        std::string const& _className,\n                        std::string const& _description,\n                        std::vector<std::string> const& _tags,\n                        SourceLineInfo const& _lineInfo );\n\n        friend void setTags( TestCaseInfo& testCaseInfo, std::vector<std::string> tags );\n\n        bool isHidden() const;\n        bool throws() const;\n        bool okToFail() const;\n        bool expectedToFail() const;\n\n        std::string tagsAsString() const;\n\n        std::string name;\n        std::string className;\n        std::string description;\n        std::vector<std::string> tags;\n        std::vector<std::string> lcaseTags;\n        SourceLineInfo lineInfo;\n        SpecialProperties properties;\n    };\n\n    class TestCase : public TestCaseInfo {\n    public:\n\n        TestCase( ITestInvoker* testCase, TestCaseInfo&& info );\n\n        TestCase withName( std::string const& _newName ) const;\n\n        void invoke() const;\n\n        TestCaseInfo const& getTestCaseInfo() const;\n\n        bool operator == ( TestCase const& other ) const;\n        bool operator < ( TestCase const& other ) const;\n\n    private:\n        std::shared_ptr<ITestInvoker> test;\n    };\n\n    TestCase makeTestCase(  ITestInvoker* testCase,\n                            std::string const& className,\n                            NameAndTags const& nameAndTags,\n                            SourceLineInfo const& lineInfo );\n}\n\n#ifdef __clang__\n#pragma clang diagnostic pop\n#endif\n\n// end catch_test_case_info.h\n// start catch_interfaces_runner.h\n\nnamespace Catch {\n\n    struct IRunner {\n        virtual ~IRunner();\n        virtual bool aborting() const = 0;\n    };\n}\n\n// end catch_interfaces_runner.h\n\n#ifdef __OBJC__\n// start catch_objc.hpp\n\n#import <objc/runtime.h>\n\n#include <string>\n\n// NB. Any general catch headers included here must be included\n// in catch.hpp first to make sure they are included by the single\n// header for non obj-usage\n\n///////////////////////////////////////////////////////////////////////////////\n// This protocol is really only here for (self) documenting purposes, since\n// all its methods are optional.\n@protocol OcFixture\n\n@optional\n\n-(void) setUp;\n-(void) tearDown;\n\n@end\n\nnamespace Catch {\n\n    class OcMethod : public ITestInvoker {\n\n    public:\n        OcMethod( Class cls, SEL sel ) : m_cls( cls ), m_sel( sel ) {}\n\n        virtual void invoke() const {\n            id obj = [[m_cls alloc] init];\n\n            performOptionalSelector( obj, @selector(setUp)  );\n            performOptionalSelector( obj, m_sel );\n            performOptionalSelector( obj, @selector(tearDown)  );\n\n            arcSafeRelease( obj );\n        }\n    private:\n        virtual ~OcMethod() {}\n\n        Class m_cls;\n        SEL m_sel;\n    };\n\n    namespace Detail{\n\n        inline std::string getAnnotation(   Class cls,\n                                            std::string const& annotationName,\n                                            std::string const& testCaseName ) {\n            NSString* selStr = [[NSString alloc] initWithFormat:@\"Catch_%s_%s\", annotationName.c_str(), testCaseName.c_str()];\n            SEL sel = NSSelectorFromString( selStr );\n            arcSafeRelease( selStr );\n            id value = performOptionalSelector( cls, sel );\n            if( value )\n                return [(NSString*)value UTF8String];\n            return \"\";\n        }\n    }\n\n    inline std::size_t registerTestMethods() {\n        std::size_t noTestMethods = 0;\n        int noClasses = objc_getClassList( nullptr, 0 );\n\n        Class* classes = (CATCH_UNSAFE_UNRETAINED Class *)malloc( sizeof(Class) * noClasses);\n        objc_getClassList( classes, noClasses );\n\n        for( int c = 0; c < noClasses; c++ ) {\n            Class cls = classes[c];\n            {\n                u_int count;\n                Method* methods = class_copyMethodList( cls, &count );\n                for( u_int m = 0; m < count ; m++ ) {\n                    SEL selector = method_getName(methods[m]);\n                    std::string methodName = sel_getName(selector);\n                    if( startsWith( methodName, \"Catch_TestCase_\" ) ) {\n                        std::string testCaseName = methodName.substr( 15 );\n                        std::string name = Detail::getAnnotation( cls, \"Name\", testCaseName );\n                        std::string desc = Detail::getAnnotation( cls, \"Description\", testCaseName );\n                        const char* className = class_getName( cls );\n\n                        getMutableRegistryHub().registerTest( makeTestCase( new OcMethod( cls, selector ), className, NameAndTags( name.c_str(), desc.c_str() ), SourceLineInfo(\"\",0) ) );\n                        noTestMethods++;\n                    }\n                }\n                free(methods);\n            }\n        }\n        return noTestMethods;\n    }\n\n#if !defined(CATCH_CONFIG_DISABLE_MATCHERS)\n\n    namespace Matchers {\n        namespace Impl {\n        namespace NSStringMatchers {\n\n            struct StringHolder : MatcherBase<NSString*>{\n                StringHolder( NSString* substr ) : m_substr( [substr copy] ){}\n                StringHolder( StringHolder const& other ) : m_substr( [other.m_substr copy] ){}\n                StringHolder() {\n                    arcSafeRelease( m_substr );\n                }\n\n                bool match( NSString* str ) const override {\n                    return false;\n                }\n\n                NSString* CATCH_ARC_STRONG m_substr;\n            };\n\n            struct Equals : StringHolder {\n                Equals( NSString* substr ) : StringHolder( substr ){}\n\n                bool match( NSString* str ) const override {\n                    return  (str != nil || m_substr == nil ) &&\n                            [str isEqualToString:m_substr];\n                }\n\n                std::string describe() const override {\n                    return \"equals string: \" + Catch::Detail::stringify( m_substr );\n                }\n            };\n\n            struct Contains : StringHolder {\n                Contains( NSString* substr ) : StringHolder( substr ){}\n\n                bool match( NSString* str ) const override {\n                    return  (str != nil || m_substr == nil ) &&\n                            [str rangeOfString:m_substr].location != NSNotFound;\n                }\n\n                std::string describe() const override {\n                    return \"contains string: \" + Catch::Detail::stringify( m_substr );\n                }\n            };\n\n            struct StartsWith : StringHolder {\n                StartsWith( NSString* substr ) : StringHolder( substr ){}\n\n                bool match( NSString* str ) const override {\n                    return  (str != nil || m_substr == nil ) &&\n                            [str rangeOfString:m_substr].location == 0;\n                }\n\n                std::string describe() const override {\n                    return \"starts with: \" + Catch::Detail::stringify( m_substr );\n                }\n            };\n            struct EndsWith : StringHolder {\n                EndsWith( NSString* substr ) : StringHolder( substr ){}\n\n                bool match( NSString* str ) const override {\n                    return  (str != nil || m_substr == nil ) &&\n                            [str rangeOfString:m_substr].location == [str length] - [m_substr length];\n                }\n\n                std::string describe() const override {\n                    return \"ends with: \" + Catch::Detail::stringify( m_substr );\n                }\n            };\n\n        } // namespace NSStringMatchers\n        } // namespace Impl\n\n        inline Impl::NSStringMatchers::Equals\n            Equals( NSString* substr ){ return Impl::NSStringMatchers::Equals( substr ); }\n\n        inline Impl::NSStringMatchers::Contains\n            Contains( NSString* substr ){ return Impl::NSStringMatchers::Contains( substr ); }\n\n        inline Impl::NSStringMatchers::StartsWith\n            StartsWith( NSString* substr ){ return Impl::NSStringMatchers::StartsWith( substr ); }\n\n        inline Impl::NSStringMatchers::EndsWith\n            EndsWith( NSString* substr ){ return Impl::NSStringMatchers::EndsWith( substr ); }\n\n    } // namespace Matchers\n\n    using namespace Matchers;\n\n#endif // CATCH_CONFIG_DISABLE_MATCHERS\n\n} // namespace Catch\n\n///////////////////////////////////////////////////////////////////////////////\n#define OC_MAKE_UNIQUE_NAME( root, uniqueSuffix ) root##uniqueSuffix\n#define OC_TEST_CASE2( name, desc, uniqueSuffix ) \\\n+(NSString*) OC_MAKE_UNIQUE_NAME( Catch_Name_test_, uniqueSuffix ) \\\n{ \\\nreturn @ name; \\\n} \\\n+(NSString*) OC_MAKE_UNIQUE_NAME( Catch_Description_test_, uniqueSuffix ) \\\n{ \\\nreturn @ desc; \\\n} \\\n-(void) OC_MAKE_UNIQUE_NAME( Catch_TestCase_test_, uniqueSuffix )\n\n#define OC_TEST_CASE( name, desc ) OC_TEST_CASE2( name, desc, __LINE__ )\n\n// end catch_objc.hpp\n#endif\n\n// Benchmarking needs the externally-facing parts of reporters to work\n#if defined(CATCH_CONFIG_EXTERNAL_INTERFACES) || defined(CATCH_CONFIG_ENABLE_BENCHMARKING)\n// start catch_external_interfaces.h\n\n// start catch_reporter_bases.hpp\n\n// start catch_interfaces_reporter.h\n\n// start catch_config.hpp\n\n// start catch_test_spec_parser.h\n\n#ifdef __clang__\n#pragma clang diagnostic push\n#pragma clang diagnostic ignored \"-Wpadded\"\n#endif\n\n// start catch_test_spec.h\n\n#ifdef __clang__\n#pragma clang diagnostic push\n#pragma clang diagnostic ignored \"-Wpadded\"\n#endif\n\n// start catch_wildcard_pattern.h\n\nnamespace Catch\n{\n    class WildcardPattern {\n        enum WildcardPosition {\n            NoWildcard = 0,\n            WildcardAtStart = 1,\n            WildcardAtEnd = 2,\n            WildcardAtBothEnds = WildcardAtStart | WildcardAtEnd\n        };\n\n    public:\n\n        WildcardPattern( std::string const& pattern, CaseSensitive::Choice caseSensitivity );\n        virtual ~WildcardPattern() = default;\n        virtual bool matches( std::string const& str ) const;\n\n    private:\n        std::string normaliseString( std::string const& str ) const;\n        CaseSensitive::Choice m_caseSensitivity;\n        WildcardPosition m_wildcard = NoWildcard;\n        std::string m_pattern;\n    };\n}\n\n// end catch_wildcard_pattern.h\n#include <string>\n#include <vector>\n#include <memory>\n\nnamespace Catch {\n\n    struct IConfig;\n\n    class TestSpec {\n        class Pattern {\n        public:\n            explicit Pattern( std::string const& name );\n            virtual ~Pattern();\n            virtual bool matches( TestCaseInfo const& testCase ) const = 0;\n            std::string const& name() const;\n        private:\n            std::string const m_name;\n        };\n        using PatternPtr = std::shared_ptr<Pattern>;\n\n        class NamePattern : public Pattern {\n        public:\n            explicit NamePattern( std::string const& name, std::string const& filterString );\n            bool matches( TestCaseInfo const& testCase ) const override;\n        private:\n            WildcardPattern m_wildcardPattern;\n        };\n\n        class TagPattern : public Pattern {\n        public:\n            explicit TagPattern( std::string const& tag, std::string const& filterString );\n            bool matches( TestCaseInfo const& testCase ) const override;\n        private:\n            std::string m_tag;\n        };\n\n        class ExcludedPattern : public Pattern {\n        public:\n            explicit ExcludedPattern( PatternPtr const& underlyingPattern );\n            bool matches( TestCaseInfo const& testCase ) const override;\n        private:\n            PatternPtr m_underlyingPattern;\n        };\n\n        struct Filter {\n            std::vector<PatternPtr> m_patterns;\n\n            bool matches( TestCaseInfo const& testCase ) const;\n            std::string name() const;\n        };\n\n    public:\n        struct FilterMatch {\n            std::string name;\n            std::vector<TestCase const*> tests;\n        };\n        using Matches = std::vector<FilterMatch>;\n        using vectorStrings = std::vector<std::string>;\n\n        bool hasFilters() const;\n        bool matches( TestCaseInfo const& testCase ) const;\n        Matches matchesByFilter( std::vector<TestCase> const& testCases, IConfig const& config ) const;\n        const vectorStrings & getInvalidArgs() const;\n\n    private:\n        std::vector<Filter> m_filters;\n        std::vector<std::string> m_invalidArgs;\n        friend class TestSpecParser;\n    };\n}\n\n#ifdef __clang__\n#pragma clang diagnostic pop\n#endif\n\n// end catch_test_spec.h\n// start catch_interfaces_tag_alias_registry.h\n\n#include <string>\n\nnamespace Catch {\n\n    struct TagAlias;\n\n    struct ITagAliasRegistry {\n        virtual ~ITagAliasRegistry();\n        // Nullptr if not present\n        virtual TagAlias const* find( std::string const& alias ) const = 0;\n        virtual std::string expandAliases( std::string const& unexpandedTestSpec ) const = 0;\n\n        static ITagAliasRegistry const& get();\n    };\n\n} // end namespace Catch\n\n// end catch_interfaces_tag_alias_registry.h\nnamespace Catch {\n\n    class TestSpecParser {\n        enum Mode{ None, Name, QuotedName, Tag, EscapedName };\n        Mode m_mode = None;\n        Mode lastMode = None;\n        bool m_exclusion = false;\n        std::size_t m_pos = 0;\n        std::size_t m_realPatternPos = 0;\n        std::string m_arg;\n        std::string m_substring;\n        std::string m_patternName;\n        std::vector<std::size_t> m_escapeChars;\n        TestSpec::Filter m_currentFilter;\n        TestSpec m_testSpec;\n        ITagAliasRegistry const* m_tagAliases = nullptr;\n\n    public:\n        TestSpecParser( ITagAliasRegistry const& tagAliases );\n\n        TestSpecParser& parse( std::string const& arg );\n        TestSpec testSpec();\n\n    private:\n        bool visitChar( char c );\n        void startNewMode( Mode mode );\n        bool processNoneChar( char c );\n        void processNameChar( char c );\n        bool processOtherChar( char c );\n        void endMode();\n        void escape();\n        bool isControlChar( char c ) const;\n        void saveLastMode();\n        void revertBackToLastMode();\n        void addFilter();\n        bool separate();\n\n        // Handles common preprocessing of the pattern for name/tag patterns\n        std::string preprocessPattern();\n        // Adds the current pattern as a test name\n        void addNamePattern();\n        // Adds the current pattern as a tag\n        void addTagPattern();\n\n        inline void addCharToPattern(char c) {\n            m_substring += c;\n            m_patternName += c;\n            m_realPatternPos++;\n        }\n\n    };\n    TestSpec parseTestSpec( std::string const& arg );\n\n} // namespace Catch\n\n#ifdef __clang__\n#pragma clang diagnostic pop\n#endif\n\n// end catch_test_spec_parser.h\n// Libstdc++ doesn't like incomplete classes for unique_ptr\n\n#include <memory>\n#include <vector>\n#include <string>\n\n#ifndef CATCH_CONFIG_CONSOLE_WIDTH\n#define CATCH_CONFIG_CONSOLE_WIDTH 80\n#endif\n\nnamespace Catch {\n\n    struct IStream;\n\n    struct ConfigData {\n        bool listTests = false;\n        bool listTags = false;\n        bool listReporters = false;\n        bool listTestNamesOnly = false;\n\n        bool showSuccessfulTests = false;\n        bool shouldDebugBreak = false;\n        bool noThrow = false;\n        bool showHelp = false;\n        bool showInvisibles = false;\n        bool filenamesAsTags = false;\n        bool libIdentify = false;\n\n        int abortAfter = -1;\n        unsigned int rngSeed = 0;\n\n        bool benchmarkNoAnalysis = false;\n        unsigned int benchmarkSamples = 100;\n        double benchmarkConfidenceInterval = 0.95;\n        unsigned int benchmarkResamples = 100000;\n        std::chrono::milliseconds::rep benchmarkWarmupTime = 100;\n\n        Verbosity verbosity = Verbosity::Normal;\n        WarnAbout::What warnings = WarnAbout::Nothing;\n        ShowDurations::OrNot showDurations = ShowDurations::DefaultForReporter;\n        double minDuration = -1;\n        RunTests::InWhatOrder runOrder = RunTests::InDeclarationOrder;\n        UseColour::YesOrNo useColour = UseColour::Auto;\n        WaitForKeypress::When waitForKeypress = WaitForKeypress::Never;\n\n        std::string outputFilename;\n        std::string name;\n        std::string processName;\n#ifndef CATCH_CONFIG_DEFAULT_REPORTER\n#define CATCH_CONFIG_DEFAULT_REPORTER \"console\"\n#endif\n        std::string reporterName = CATCH_CONFIG_DEFAULT_REPORTER;\n#undef CATCH_CONFIG_DEFAULT_REPORTER\n\n        std::vector<std::string> testsOrTags;\n        std::vector<std::string> sectionsToRun;\n    };\n\n    class Config : public IConfig {\n    public:\n\n        Config() = default;\n        Config( ConfigData const& data );\n        virtual ~Config() = default;\n\n        std::string const& getFilename() const;\n\n        bool listTests() const;\n        bool listTestNamesOnly() const;\n        bool listTags() const;\n        bool listReporters() const;\n\n        std::string getProcessName() const;\n        std::string const& getReporterName() const;\n\n        std::vector<std::string> const& getTestsOrTags() const override;\n        std::vector<std::string> const& getSectionsToRun() const override;\n\n        TestSpec const& testSpec() const override;\n        bool hasTestFilters() const override;\n\n        bool showHelp() const;\n\n        // IConfig interface\n        bool allowThrows() const override;\n        std::ostream& stream() const override;\n        std::string name() const override;\n        bool includeSuccessfulResults() const override;\n        bool warnAboutMissingAssertions() const override;\n        bool warnAboutNoTests() const override;\n        ShowDurations::OrNot showDurations() const override;\n        double minDuration() const override;\n        RunTests::InWhatOrder runOrder() const override;\n        unsigned int rngSeed() const override;\n        UseColour::YesOrNo useColour() const override;\n        bool shouldDebugBreak() const override;\n        int abortAfter() const override;\n        bool showInvisibles() const override;\n        Verbosity verbosity() const override;\n        bool benchmarkNoAnalysis() const override;\n        int benchmarkSamples() const override;\n        double benchmarkConfidenceInterval() const override;\n        unsigned int benchmarkResamples() const override;\n        std::chrono::milliseconds benchmarkWarmupTime() const override;\n\n    private:\n\n        IStream const* openStream();\n        ConfigData m_data;\n\n        std::unique_ptr<IStream const> m_stream;\n        TestSpec m_testSpec;\n        bool m_hasTestFilters = false;\n    };\n\n} // end namespace Catch\n\n// end catch_config.hpp\n// start catch_assertionresult.h\n\n#include <string>\n\nnamespace Catch {\n\n    struct AssertionResultData\n    {\n        AssertionResultData() = delete;\n\n        AssertionResultData( ResultWas::OfType _resultType, LazyExpression const& _lazyExpression );\n\n        std::string message;\n        mutable std::string reconstructedExpression;\n        LazyExpression lazyExpression;\n        ResultWas::OfType resultType;\n\n        std::string reconstructExpression() const;\n    };\n\n    class AssertionResult {\n    public:\n        AssertionResult() = delete;\n        AssertionResult( AssertionInfo const& info, AssertionResultData const& data );\n\n        bool isOk() const;\n        bool succeeded() const;\n        ResultWas::OfType getResultType() const;\n        bool hasExpression() const;\n        bool hasMessage() const;\n        std::string getExpression() const;\n        std::string getExpressionInMacro() const;\n        bool hasExpandedExpression() const;\n        std::string getExpandedExpression() const;\n        std::string getMessage() const;\n        SourceLineInfo getSourceInfo() const;\n        StringRef getTestMacroName() const;\n\n    //protected:\n        AssertionInfo m_info;\n        AssertionResultData m_resultData;\n    };\n\n} // end namespace Catch\n\n// end catch_assertionresult.h\n#if defined(CATCH_CONFIG_ENABLE_BENCHMARKING)\n// start catch_estimate.hpp\n\n // Statistics estimates\n\n\nnamespace Catch {\n    namespace Benchmark {\n        template <typename Duration>\n        struct Estimate {\n            Duration point;\n            Duration lower_bound;\n            Duration upper_bound;\n            double confidence_interval;\n\n            template <typename Duration2>\n            operator Estimate<Duration2>() const {\n                return { point, lower_bound, upper_bound, confidence_interval };\n            }\n        };\n    } // namespace Benchmark\n} // namespace Catch\n\n// end catch_estimate.hpp\n// start catch_outlier_classification.hpp\n\n// Outlier information\n\nnamespace Catch {\n    namespace Benchmark {\n        struct OutlierClassification {\n            int samples_seen = 0;\n            int low_severe = 0;     // more than 3 times IQR below Q1\n            int low_mild = 0;       // 1.5 to 3 times IQR below Q1\n            int high_mild = 0;      // 1.5 to 3 times IQR above Q3\n            int high_severe = 0;    // more than 3 times IQR above Q3\n\n            int total() const {\n                return low_severe + low_mild + high_mild + high_severe;\n            }\n        };\n    } // namespace Benchmark\n} // namespace Catch\n\n// end catch_outlier_classification.hpp\n\n#include <iterator>\n#endif // CATCH_CONFIG_ENABLE_BENCHMARKING\n\n#include <string>\n#include <iosfwd>\n#include <map>\n#include <set>\n#include <memory>\n#include <algorithm>\n\nnamespace Catch {\n\n    struct ReporterConfig {\n        explicit ReporterConfig( IConfigPtr const& _fullConfig );\n\n        ReporterConfig( IConfigPtr const& _fullConfig, std::ostream& _stream );\n\n        std::ostream& stream() const;\n        IConfigPtr fullConfig() const;\n\n    private:\n        std::ostream* m_stream;\n        IConfigPtr m_fullConfig;\n    };\n\n    struct ReporterPreferences {\n        bool shouldRedirectStdOut = false;\n        bool shouldReportAllAssertions = false;\n    };\n\n    template<typename T>\n    struct LazyStat : Option<T> {\n        LazyStat& operator=( T const& _value ) {\n            Option<T>::operator=( _value );\n            used = false;\n            return *this;\n        }\n        void reset() {\n            Option<T>::reset();\n            used = false;\n        }\n        bool used = false;\n    };\n\n    struct TestRunInfo {\n        TestRunInfo( std::string const& _name );\n        std::string name;\n    };\n    struct GroupInfo {\n        GroupInfo(  std::string const& _name,\n                    std::size_t _groupIndex,\n                    std::size_t _groupsCount );\n\n        std::string name;\n        std::size_t groupIndex;\n        std::size_t groupsCounts;\n    };\n\n    struct AssertionStats {\n        AssertionStats( AssertionResult const& _assertionResult,\n                        std::vector<MessageInfo> const& _infoMessages,\n                        Totals const& _totals );\n\n        AssertionStats( AssertionStats const& )              = default;\n        AssertionStats( AssertionStats && )                  = default;\n        AssertionStats& operator = ( AssertionStats const& ) = delete;\n        AssertionStats& operator = ( AssertionStats && )     = delete;\n        virtual ~AssertionStats();\n\n        AssertionResult assertionResult;\n        std::vector<MessageInfo> infoMessages;\n        Totals totals;\n    };\n\n    struct SectionStats {\n        SectionStats(   SectionInfo const& _sectionInfo,\n                        Counts const& _assertions,\n                        double _durationInSeconds,\n                        bool _missingAssertions );\n        SectionStats( SectionStats const& )              = default;\n        SectionStats( SectionStats && )                  = default;\n        SectionStats& operator = ( SectionStats const& ) = default;\n        SectionStats& operator = ( SectionStats && )     = default;\n        virtual ~SectionStats();\n\n        SectionInfo sectionInfo;\n        Counts assertions;\n        double durationInSeconds;\n        bool missingAssertions;\n    };\n\n    struct TestCaseStats {\n        TestCaseStats(  TestCaseInfo const& _testInfo,\n                        Totals const& _totals,\n                        std::string const& _stdOut,\n                        std::string const& _stdErr,\n                        bool _aborting );\n\n        TestCaseStats( TestCaseStats const& )              = default;\n        TestCaseStats( TestCaseStats && )                  = default;\n        TestCaseStats& operator = ( TestCaseStats const& ) = default;\n        TestCaseStats& operator = ( TestCaseStats && )     = default;\n        virtual ~TestCaseStats();\n\n        TestCaseInfo testInfo;\n        Totals totals;\n        std::string stdOut;\n        std::string stdErr;\n        bool aborting;\n    };\n\n    struct TestGroupStats {\n        TestGroupStats( GroupInfo const& _groupInfo,\n                        Totals const& _totals,\n                        bool _aborting );\n        TestGroupStats( GroupInfo const& _groupInfo );\n\n        TestGroupStats( TestGroupStats const& )              = default;\n        TestGroupStats( TestGroupStats && )                  = default;\n        TestGroupStats& operator = ( TestGroupStats const& ) = default;\n        TestGroupStats& operator = ( TestGroupStats && )     = default;\n        virtual ~TestGroupStats();\n\n        GroupInfo groupInfo;\n        Totals totals;\n        bool aborting;\n    };\n\n    struct TestRunStats {\n        TestRunStats(   TestRunInfo const& _runInfo,\n                        Totals const& _totals,\n                        bool _aborting );\n\n        TestRunStats( TestRunStats const& )              = default;\n        TestRunStats( TestRunStats && )                  = default;\n        TestRunStats& operator = ( TestRunStats const& ) = default;\n        TestRunStats& operator = ( TestRunStats && )     = default;\n        virtual ~TestRunStats();\n\n        TestRunInfo runInfo;\n        Totals totals;\n        bool aborting;\n    };\n\n#if defined(CATCH_CONFIG_ENABLE_BENCHMARKING)\n    struct BenchmarkInfo {\n        std::string name;\n        double estimatedDuration;\n        int iterations;\n        int samples;\n        unsigned int resamples;\n        double clockResolution;\n        double clockCost;\n    };\n\n    template <class Duration>\n    struct BenchmarkStats {\n        BenchmarkInfo info;\n\n        std::vector<Duration> samples;\n        Benchmark::Estimate<Duration> mean;\n        Benchmark::Estimate<Duration> standardDeviation;\n        Benchmark::OutlierClassification outliers;\n        double outlierVariance;\n\n        template <typename Duration2>\n        operator BenchmarkStats<Duration2>() const {\n            std::vector<Duration2> samples2;\n            samples2.reserve(samples.size());\n            std::transform(samples.begin(), samples.end(), std::back_inserter(samples2), [](Duration d) { return Duration2(d); });\n            return {\n                info,\n                std::move(samples2),\n                mean,\n                standardDeviation,\n                outliers,\n                outlierVariance,\n            };\n        }\n    };\n#endif // CATCH_CONFIG_ENABLE_BENCHMARKING\n\n    struct IStreamingReporter {\n        virtual ~IStreamingReporter() = default;\n\n        // Implementing class must also provide the following static methods:\n        // static std::string getDescription();\n        // static std::set<Verbosity> getSupportedVerbosities()\n\n        virtual ReporterPreferences getPreferences() const = 0;\n\n        virtual void noMatchingTestCases( std::string const& spec ) = 0;\n\n        virtual void reportInvalidArguments(std::string const&) {}\n\n        virtual void testRunStarting( TestRunInfo const& testRunInfo ) = 0;\n        virtual void testGroupStarting( GroupInfo const& groupInfo ) = 0;\n\n        virtual void testCaseStarting( TestCaseInfo const& testInfo ) = 0;\n        virtual void sectionStarting( SectionInfo const& sectionInfo ) = 0;\n\n#if defined(CATCH_CONFIG_ENABLE_BENCHMARKING)\n        virtual void benchmarkPreparing( std::string const& ) {}\n        virtual void benchmarkStarting( BenchmarkInfo const& ) {}\n        virtual void benchmarkEnded( BenchmarkStats<> const& ) {}\n        virtual void benchmarkFailed( std::string const& ) {}\n#endif // CATCH_CONFIG_ENABLE_BENCHMARKING\n\n        virtual void assertionStarting( AssertionInfo const& assertionInfo ) = 0;\n\n        // The return value indicates if the messages buffer should be cleared:\n        virtual bool assertionEnded( AssertionStats const& assertionStats ) = 0;\n\n        virtual void sectionEnded( SectionStats const& sectionStats ) = 0;\n        virtual void testCaseEnded( TestCaseStats const& testCaseStats ) = 0;\n        virtual void testGroupEnded( TestGroupStats const& testGroupStats ) = 0;\n        virtual void testRunEnded( TestRunStats const& testRunStats ) = 0;\n\n        virtual void skipTest( TestCaseInfo const& testInfo ) = 0;\n\n        // Default empty implementation provided\n        virtual void fatalErrorEncountered( StringRef name );\n\n        virtual bool isMulti() const;\n    };\n    using IStreamingReporterPtr = std::unique_ptr<IStreamingReporter>;\n\n    struct IReporterFactory {\n        virtual ~IReporterFactory();\n        virtual IStreamingReporterPtr create( ReporterConfig const& config ) const = 0;\n        virtual std::string getDescription() const = 0;\n    };\n    using IReporterFactoryPtr = std::shared_ptr<IReporterFactory>;\n\n    struct IReporterRegistry {\n        using FactoryMap = std::map<std::string, IReporterFactoryPtr>;\n        using Listeners = std::vector<IReporterFactoryPtr>;\n\n        virtual ~IReporterRegistry();\n        virtual IStreamingReporterPtr create( std::string const& name, IConfigPtr const& config ) const = 0;\n        virtual FactoryMap const& getFactories() const = 0;\n        virtual Listeners const& getListeners() const = 0;\n    };\n\n} // end namespace Catch\n\n// end catch_interfaces_reporter.h\n#include <algorithm>\n#include <cstring>\n#include <cfloat>\n#include <cstdio>\n#include <cassert>\n#include <memory>\n#include <ostream>\n\nnamespace Catch {\n    void prepareExpandedExpression(AssertionResult& result);\n\n    // Returns double formatted as %.3f (format expected on output)\n    std::string getFormattedDuration( double duration );\n\n    //! Should the reporter show\n    bool shouldShowDuration( IConfig const& config, double duration );\n\n    std::string serializeFilters( std::vector<std::string> const& container );\n\n    template<typename DerivedT>\n    struct StreamingReporterBase : IStreamingReporter {\n\n        StreamingReporterBase( ReporterConfig const& _config )\n        :   m_config( _config.fullConfig() ),\n            stream( _config.stream() )\n        {\n            m_reporterPrefs.shouldRedirectStdOut = false;\n            if( !DerivedT::getSupportedVerbosities().count( m_config->verbosity() ) )\n                CATCH_ERROR( \"Verbosity level not supported by this reporter\" );\n        }\n\n        ReporterPreferences getPreferences() const override {\n            return m_reporterPrefs;\n        }\n\n        static std::set<Verbosity> getSupportedVerbosities() {\n            return { Verbosity::Normal };\n        }\n\n        ~StreamingReporterBase() override = default;\n\n        void noMatchingTestCases(std::string const&) override {}\n\n        void reportInvalidArguments(std::string const&) override {}\n\n        void testRunStarting(TestRunInfo const& _testRunInfo) override {\n            currentTestRunInfo = _testRunInfo;\n        }\n\n        void testGroupStarting(GroupInfo const& _groupInfo) override {\n            currentGroupInfo = _groupInfo;\n        }\n\n        void testCaseStarting(TestCaseInfo const& _testInfo) override  {\n            currentTestCaseInfo = _testInfo;\n        }\n        void sectionStarting(SectionInfo const& _sectionInfo) override {\n            m_sectionStack.push_back(_sectionInfo);\n        }\n\n        void sectionEnded(SectionStats const& /* _sectionStats */) override {\n            m_sectionStack.pop_back();\n        }\n        void testCaseEnded(TestCaseStats const& /* _testCaseStats */) override {\n            currentTestCaseInfo.reset();\n        }\n        void testGroupEnded(TestGroupStats const& /* _testGroupStats */) override {\n            currentGroupInfo.reset();\n        }\n        void testRunEnded(TestRunStats const& /* _testRunStats */) override {\n            currentTestCaseInfo.reset();\n            currentGroupInfo.reset();\n            currentTestRunInfo.reset();\n        }\n\n        void skipTest(TestCaseInfo const&) override {\n            // Don't do anything with this by default.\n            // It can optionally be overridden in the derived class.\n        }\n\n        IConfigPtr m_config;\n        std::ostream& stream;\n\n        LazyStat<TestRunInfo> currentTestRunInfo;\n        LazyStat<GroupInfo> currentGroupInfo;\n        LazyStat<TestCaseInfo> currentTestCaseInfo;\n\n        std::vector<SectionInfo> m_sectionStack;\n        ReporterPreferences m_reporterPrefs;\n    };\n\n    template<typename DerivedT>\n    struct CumulativeReporterBase : IStreamingReporter {\n        template<typename T, typename ChildNodeT>\n        struct Node {\n            explicit Node( T const& _value ) : value( _value ) {}\n            virtual ~Node() {}\n\n            using ChildNodes = std::vector<std::shared_ptr<ChildNodeT>>;\n            T value;\n            ChildNodes children;\n        };\n        struct SectionNode {\n            explicit SectionNode(SectionStats const& _stats) : stats(_stats) {}\n            virtual ~SectionNode() = default;\n\n            bool operator == (SectionNode const& other) const {\n                return stats.sectionInfo.lineInfo == other.stats.sectionInfo.lineInfo;\n            }\n            bool operator == (std::shared_ptr<SectionNode> const& other) const {\n                return operator==(*other);\n            }\n\n            SectionStats stats;\n            using ChildSections = std::vector<std::shared_ptr<SectionNode>>;\n            using Assertions = std::vector<AssertionStats>;\n            ChildSections childSections;\n            Assertions assertions;\n            std::string stdOut;\n            std::string stdErr;\n        };\n\n        struct BySectionInfo {\n            BySectionInfo( SectionInfo const& other ) : m_other( other ) {}\n            BySectionInfo( BySectionInfo const& other ) : m_other( other.m_other ) {}\n            bool operator() (std::shared_ptr<SectionNode> const& node) const {\n                return ((node->stats.sectionInfo.name == m_other.name) &&\n                        (node->stats.sectionInfo.lineInfo == m_other.lineInfo));\n            }\n            void operator=(BySectionInfo const&) = delete;\n\n        private:\n            SectionInfo const& m_other;\n        };\n\n        using TestCaseNode = Node<TestCaseStats, SectionNode>;\n        using TestGroupNode = Node<TestGroupStats, TestCaseNode>;\n        using TestRunNode = Node<TestRunStats, TestGroupNode>;\n\n        CumulativeReporterBase( ReporterConfig const& _config )\n        :   m_config( _config.fullConfig() ),\n            stream( _config.stream() )\n        {\n            m_reporterPrefs.shouldRedirectStdOut = false;\n            if( !DerivedT::getSupportedVerbosities().count( m_config->verbosity() ) )\n                CATCH_ERROR( \"Verbosity level not supported by this reporter\" );\n        }\n        ~CumulativeReporterBase() override = default;\n\n        ReporterPreferences getPreferences() const override {\n            return m_reporterPrefs;\n        }\n\n        static std::set<Verbosity> getSupportedVerbosities() {\n            return { Verbosity::Normal };\n        }\n\n        void testRunStarting( TestRunInfo const& ) override {}\n        void testGroupStarting( GroupInfo const& ) override {}\n\n        void testCaseStarting( TestCaseInfo const& ) override {}\n\n        void sectionStarting( SectionInfo const& sectionInfo ) override {\n            SectionStats incompleteStats( sectionInfo, Counts(), 0, false );\n            std::shared_ptr<SectionNode> node;\n            if( m_sectionStack.empty() ) {\n                if( !m_rootSection )\n                    m_rootSection = std::make_shared<SectionNode>( incompleteStats );\n                node = m_rootSection;\n            }\n            else {\n                SectionNode& parentNode = *m_sectionStack.back();\n                auto it =\n                    std::find_if(   parentNode.childSections.begin(),\n                                    parentNode.childSections.end(),\n                                    BySectionInfo( sectionInfo ) );\n                if( it == parentNode.childSections.end() ) {\n                    node = std::make_shared<SectionNode>( incompleteStats );\n                    parentNode.childSections.push_back( node );\n                }\n                else\n                    node = *it;\n            }\n            m_sectionStack.push_back( node );\n            m_deepestSection = std::move(node);\n        }\n\n        void assertionStarting(AssertionInfo const&) override {}\n\n        bool assertionEnded(AssertionStats const& assertionStats) override {\n            assert(!m_sectionStack.empty());\n            // AssertionResult holds a pointer to a temporary DecomposedExpression,\n            // which getExpandedExpression() calls to build the expression string.\n            // Our section stack copy of the assertionResult will likely outlive the\n            // temporary, so it must be expanded or discarded now to avoid calling\n            // a destroyed object later.\n            prepareExpandedExpression(const_cast<AssertionResult&>( assertionStats.assertionResult ) );\n            SectionNode& sectionNode = *m_sectionStack.back();\n            sectionNode.assertions.push_back(assertionStats);\n            return true;\n        }\n        void sectionEnded(SectionStats const& sectionStats) override {\n            assert(!m_sectionStack.empty());\n            SectionNode& node = *m_sectionStack.back();\n            node.stats = sectionStats;\n            m_sectionStack.pop_back();\n        }\n        void testCaseEnded(TestCaseStats const& testCaseStats) override {\n            auto node = std::make_shared<TestCaseNode>(testCaseStats);\n            assert(m_sectionStack.size() == 0);\n            node->children.push_back(m_rootSection);\n            m_testCases.push_back(node);\n            m_rootSection.reset();\n\n            assert(m_deepestSection);\n            m_deepestSection->stdOut = testCaseStats.stdOut;\n            m_deepestSection->stdErr = testCaseStats.stdErr;\n        }\n        void testGroupEnded(TestGroupStats const& testGroupStats) override {\n            auto node = std::make_shared<TestGroupNode>(testGroupStats);\n            node->children.swap(m_testCases);\n            m_testGroups.push_back(node);\n        }\n        void testRunEnded(TestRunStats const& testRunStats) override {\n            auto node = std::make_shared<TestRunNode>(testRunStats);\n            node->children.swap(m_testGroups);\n            m_testRuns.push_back(node);\n            testRunEndedCumulative();\n        }\n        virtual void testRunEndedCumulative() = 0;\n\n        void skipTest(TestCaseInfo const&) override {}\n\n        IConfigPtr m_config;\n        std::ostream& stream;\n        std::vector<AssertionStats> m_assertions;\n        std::vector<std::vector<std::shared_ptr<SectionNode>>> m_sections;\n        std::vector<std::shared_ptr<TestCaseNode>> m_testCases;\n        std::vector<std::shared_ptr<TestGroupNode>> m_testGroups;\n\n        std::vector<std::shared_ptr<TestRunNode>> m_testRuns;\n\n        std::shared_ptr<SectionNode> m_rootSection;\n        std::shared_ptr<SectionNode> m_deepestSection;\n        std::vector<std::shared_ptr<SectionNode>> m_sectionStack;\n        ReporterPreferences m_reporterPrefs;\n    };\n\n    template<char C>\n    char const* getLineOfChars() {\n        static char line[CATCH_CONFIG_CONSOLE_WIDTH] = {0};\n        if( !*line ) {\n            std::memset( line, C, CATCH_CONFIG_CONSOLE_WIDTH-1 );\n            line[CATCH_CONFIG_CONSOLE_WIDTH-1] = 0;\n        }\n        return line;\n    }\n\n    struct TestEventListenerBase : StreamingReporterBase<TestEventListenerBase> {\n        TestEventListenerBase( ReporterConfig const& _config );\n\n        static std::set<Verbosity> getSupportedVerbosities();\n\n        void assertionStarting(AssertionInfo const&) override;\n        bool assertionEnded(AssertionStats const&) override;\n    };\n\n} // end namespace Catch\n\n// end catch_reporter_bases.hpp\n// start catch_console_colour.h\n\nnamespace Catch {\n\n    struct Colour {\n        enum Code {\n            None = 0,\n\n            White,\n            Red,\n            Green,\n            Blue,\n            Cyan,\n            Yellow,\n            Grey,\n\n            Bright = 0x10,\n\n            BrightRed = Bright | Red,\n            BrightGreen = Bright | Green,\n            LightGrey = Bright | Grey,\n            BrightWhite = Bright | White,\n            BrightYellow = Bright | Yellow,\n\n            // By intention\n            FileName = LightGrey,\n            Warning = BrightYellow,\n            ResultError = BrightRed,\n            ResultSuccess = BrightGreen,\n            ResultExpectedFailure = Warning,\n\n            Error = BrightRed,\n            Success = Green,\n\n            OriginalExpression = Cyan,\n            ReconstructedExpression = BrightYellow,\n\n            SecondaryText = LightGrey,\n            Headers = White\n        };\n\n        // Use constructed object for RAII guard\n        Colour( Code _colourCode );\n        Colour( Colour&& other ) noexcept;\n        Colour& operator=( Colour&& other ) noexcept;\n        ~Colour();\n\n        // Use static method for one-shot changes\n        static void use( Code _colourCode );\n\n    private:\n        bool m_moved = false;\n    };\n\n    std::ostream& operator << ( std::ostream& os, Colour const& );\n\n} // end namespace Catch\n\n// end catch_console_colour.h\n// start catch_reporter_registrars.hpp\n\n\nnamespace Catch {\n\n    template<typename T>\n    class ReporterRegistrar {\n\n        class ReporterFactory : public IReporterFactory {\n\n            IStreamingReporterPtr create( ReporterConfig const& config ) const override {\n                return std::unique_ptr<T>( new T( config ) );\n            }\n\n            std::string getDescription() const override {\n                return T::getDescription();\n            }\n        };\n\n    public:\n\n        explicit ReporterRegistrar( std::string const& name ) {\n            getMutableRegistryHub().registerReporter( name, std::make_shared<ReporterFactory>() );\n        }\n    };\n\n    template<typename T>\n    class ListenerRegistrar {\n\n        class ListenerFactory : public IReporterFactory {\n\n            IStreamingReporterPtr create( ReporterConfig const& config ) const override {\n                return std::unique_ptr<T>( new T( config ) );\n            }\n            std::string getDescription() const override {\n                return std::string();\n            }\n        };\n\n    public:\n\n        ListenerRegistrar() {\n            getMutableRegistryHub().registerListener( std::make_shared<ListenerFactory>() );\n        }\n    };\n}\n\n#if !defined(CATCH_CONFIG_DISABLE)\n\n#define CATCH_REGISTER_REPORTER( name, reporterType ) \\\n    CATCH_INTERNAL_START_WARNINGS_SUPPRESSION         \\\n    CATCH_INTERNAL_SUPPRESS_GLOBALS_WARNINGS          \\\n    namespace{ Catch::ReporterRegistrar<reporterType> catch_internal_RegistrarFor##reporterType( name ); } \\\n    CATCH_INTERNAL_STOP_WARNINGS_SUPPRESSION\n\n#define CATCH_REGISTER_LISTENER( listenerType ) \\\n    CATCH_INTERNAL_START_WARNINGS_SUPPRESSION   \\\n    CATCH_INTERNAL_SUPPRESS_GLOBALS_WARNINGS    \\\n    namespace{ Catch::ListenerRegistrar<listenerType> catch_internal_RegistrarFor##listenerType; } \\\n    CATCH_INTERNAL_STOP_WARNINGS_SUPPRESSION\n#else // CATCH_CONFIG_DISABLE\n\n#define CATCH_REGISTER_REPORTER(name, reporterType)\n#define CATCH_REGISTER_LISTENER(listenerType)\n\n#endif // CATCH_CONFIG_DISABLE\n\n// end catch_reporter_registrars.hpp\n// Allow users to base their work off existing reporters\n// start catch_reporter_compact.h\n\nnamespace Catch {\n\n    struct CompactReporter : StreamingReporterBase<CompactReporter> {\n\n        using StreamingReporterBase::StreamingReporterBase;\n\n        ~CompactReporter() override;\n\n        static std::string getDescription();\n\n        void noMatchingTestCases(std::string const& spec) override;\n\n        void assertionStarting(AssertionInfo const&) override;\n\n        bool assertionEnded(AssertionStats const& _assertionStats) override;\n\n        void sectionEnded(SectionStats const& _sectionStats) override;\n\n        void testRunEnded(TestRunStats const& _testRunStats) override;\n\n    };\n\n} // end namespace Catch\n\n// end catch_reporter_compact.h\n// start catch_reporter_console.h\n\n#if defined(_MSC_VER)\n#pragma warning(push)\n#pragma warning(disable:4061) // Not all labels are EXPLICITLY handled in switch\n                              // Note that 4062 (not all labels are handled\n                              // and default is missing) is enabled\n#endif\n\nnamespace Catch {\n    // Fwd decls\n    struct SummaryColumn;\n    class TablePrinter;\n\n    struct ConsoleReporter : StreamingReporterBase<ConsoleReporter> {\n        std::unique_ptr<TablePrinter> m_tablePrinter;\n\n        ConsoleReporter(ReporterConfig const& config);\n        ~ConsoleReporter() override;\n        static std::string getDescription();\n\n        void noMatchingTestCases(std::string const& spec) override;\n\n        void reportInvalidArguments(std::string const&arg) override;\n\n        void assertionStarting(AssertionInfo const&) override;\n\n        bool assertionEnded(AssertionStats const& _assertionStats) override;\n\n        void sectionStarting(SectionInfo const& _sectionInfo) override;\n        void sectionEnded(SectionStats const& _sectionStats) override;\n\n#if defined(CATCH_CONFIG_ENABLE_BENCHMARKING)\n        void benchmarkPreparing(std::string const& name) override;\n        void benchmarkStarting(BenchmarkInfo const& info) override;\n        void benchmarkEnded(BenchmarkStats<> const& stats) override;\n        void benchmarkFailed(std::string const& error) override;\n#endif // CATCH_CONFIG_ENABLE_BENCHMARKING\n\n        void testCaseEnded(TestCaseStats const& _testCaseStats) override;\n        void testGroupEnded(TestGroupStats const& _testGroupStats) override;\n        void testRunEnded(TestRunStats const& _testRunStats) override;\n        void testRunStarting(TestRunInfo const& _testRunInfo) override;\n    private:\n\n        void lazyPrint();\n\n        void lazyPrintWithoutClosingBenchmarkTable();\n        void lazyPrintRunInfo();\n        void lazyPrintGroupInfo();\n        void printTestCaseAndSectionHeader();\n\n        void printClosedHeader(std::string const& _name);\n        void printOpenHeader(std::string const& _name);\n\n        // if string has a : in first line will set indent to follow it on\n        // subsequent lines\n        void printHeaderString(std::string const& _string, std::size_t indent = 0);\n\n        void printTotals(Totals const& totals);\n        void printSummaryRow(std::string const& label, std::vector<SummaryColumn> const& cols, std::size_t row);\n\n        void printTotalsDivider(Totals const& totals);\n        void printSummaryDivider();\n        void printTestFilters();\n\n    private:\n        bool m_headerPrinted = false;\n    };\n\n} // end namespace Catch\n\n#if defined(_MSC_VER)\n#pragma warning(pop)\n#endif\n\n// end catch_reporter_console.h\n// start catch_reporter_junit.h\n\n// start catch_xmlwriter.h\n\n#include <vector>\n\nnamespace Catch {\n    enum class XmlFormatting {\n        None = 0x00,\n        Indent = 0x01,\n        Newline = 0x02,\n    };\n\n    XmlFormatting operator | (XmlFormatting lhs, XmlFormatting rhs);\n    XmlFormatting operator & (XmlFormatting lhs, XmlFormatting rhs);\n\n    class XmlEncode {\n    public:\n        enum ForWhat { ForTextNodes, ForAttributes };\n\n        XmlEncode( std::string const& str, ForWhat forWhat = ForTextNodes );\n\n        void encodeTo( std::ostream& os ) const;\n\n        friend std::ostream& operator << ( std::ostream& os, XmlEncode const& xmlEncode );\n\n    private:\n        std::string m_str;\n        ForWhat m_forWhat;\n    };\n\n    class XmlWriter {\n    public:\n\n        class ScopedElement {\n        public:\n            ScopedElement( XmlWriter* writer, XmlFormatting fmt );\n\n            ScopedElement( ScopedElement&& other ) noexcept;\n            ScopedElement& operator=( ScopedElement&& other ) noexcept;\n\n            ~ScopedElement();\n\n            ScopedElement& writeText( std::string const& text, XmlFormatting fmt = XmlFormatting::Newline | XmlFormatting::Indent );\n\n            template<typename T>\n            ScopedElement& writeAttribute( std::string const& name, T const& attribute ) {\n                m_writer->writeAttribute( name, attribute );\n                return *this;\n            }\n\n        private:\n            mutable XmlWriter* m_writer = nullptr;\n            XmlFormatting m_fmt;\n        };\n\n        XmlWriter( std::ostream& os = Catch::cout() );\n        ~XmlWriter();\n\n        XmlWriter( XmlWriter const& ) = delete;\n        XmlWriter& operator=( XmlWriter const& ) = delete;\n\n        XmlWriter& startElement( std::string const& name, XmlFormatting fmt = XmlFormatting::Newline | XmlFormatting::Indent);\n\n        ScopedElement scopedElement( std::string const& name, XmlFormatting fmt = XmlFormatting::Newline | XmlFormatting::Indent);\n\n        XmlWriter& endElement(XmlFormatting fmt = XmlFormatting::Newline | XmlFormatting::Indent);\n\n        XmlWriter& writeAttribute( std::string const& name, std::string const& attribute );\n\n        XmlWriter& writeAttribute( std::string const& name, bool attribute );\n\n        template<typename T>\n        XmlWriter& writeAttribute( std::string const& name, T const& attribute ) {\n            ReusableStringStream rss;\n            rss << attribute;\n            return writeAttribute( name, rss.str() );\n        }\n\n        XmlWriter& writeText( std::string const& text, XmlFormatting fmt = XmlFormatting::Newline | XmlFormatting::Indent);\n\n        XmlWriter& writeComment(std::string const& text, XmlFormatting fmt = XmlFormatting::Newline | XmlFormatting::Indent);\n\n        void writeStylesheetRef( std::string const& url );\n\n        XmlWriter& writeBlankLine();\n\n        void ensureTagClosed();\n\n    private:\n\n        void applyFormatting(XmlFormatting fmt);\n\n        void writeDeclaration();\n\n        void newlineIfNecessary();\n\n        bool m_tagIsOpen = false;\n        bool m_needsNewline = false;\n        std::vector<std::string> m_tags;\n        std::string m_indent;\n        std::ostream& m_os;\n    };\n\n}\n\n// end catch_xmlwriter.h\nnamespace Catch {\n\n    class JunitReporter : public CumulativeReporterBase<JunitReporter> {\n    public:\n        JunitReporter(ReporterConfig const& _config);\n\n        ~JunitReporter() override;\n\n        static std::string getDescription();\n\n        void noMatchingTestCases(std::string const& /*spec*/) override;\n\n        void testRunStarting(TestRunInfo const& runInfo) override;\n\n        void testGroupStarting(GroupInfo const& groupInfo) override;\n\n        void testCaseStarting(TestCaseInfo const& testCaseInfo) override;\n        bool assertionEnded(AssertionStats const& assertionStats) override;\n\n        void testCaseEnded(TestCaseStats const& testCaseStats) override;\n\n        void testGroupEnded(TestGroupStats const& testGroupStats) override;\n\n        void testRunEndedCumulative() override;\n\n        void writeGroup(TestGroupNode const& groupNode, double suiteTime);\n\n        void writeTestCase(TestCaseNode const& testCaseNode);\n\n        void writeSection( std::string const& className,\n                           std::string const& rootName,\n                           SectionNode const& sectionNode,\n                           bool testOkToFail );\n\n        void writeAssertions(SectionNode const& sectionNode);\n        void writeAssertion(AssertionStats const& stats);\n\n        XmlWriter xml;\n        Timer suiteTimer;\n        std::string stdOutForSuite;\n        std::string stdErrForSuite;\n        unsigned int unexpectedExceptions = 0;\n        bool m_okToFail = false;\n    };\n\n} // end namespace Catch\n\n// end catch_reporter_junit.h\n// start catch_reporter_xml.h\n\nnamespace Catch {\n    class XmlReporter : public StreamingReporterBase<XmlReporter> {\n    public:\n        XmlReporter(ReporterConfig const& _config);\n\n        ~XmlReporter() override;\n\n        static std::string getDescription();\n\n        virtual std::string getStylesheetRef() const;\n\n        void writeSourceInfo(SourceLineInfo const& sourceInfo);\n\n    public: // StreamingReporterBase\n\n        void noMatchingTestCases(std::string const& s) override;\n\n        void testRunStarting(TestRunInfo const& testInfo) override;\n\n        void testGroupStarting(GroupInfo const& groupInfo) override;\n\n        void testCaseStarting(TestCaseInfo const& testInfo) override;\n\n        void sectionStarting(SectionInfo const& sectionInfo) override;\n\n        void assertionStarting(AssertionInfo const&) override;\n\n        bool assertionEnded(AssertionStats const& assertionStats) override;\n\n        void sectionEnded(SectionStats const& sectionStats) override;\n\n        void testCaseEnded(TestCaseStats const& testCaseStats) override;\n\n        void testGroupEnded(TestGroupStats const& testGroupStats) override;\n\n        void testRunEnded(TestRunStats const& testRunStats) override;\n\n#if defined(CATCH_CONFIG_ENABLE_BENCHMARKING)\n        void benchmarkPreparing(std::string const& name) override;\n        void benchmarkStarting(BenchmarkInfo const&) override;\n        void benchmarkEnded(BenchmarkStats<> const&) override;\n        void benchmarkFailed(std::string const&) override;\n#endif // CATCH_CONFIG_ENABLE_BENCHMARKING\n\n    private:\n        Timer m_testCaseTimer;\n        XmlWriter m_xml;\n        int m_sectionDepth = 0;\n    };\n\n} // end namespace Catch\n\n// end catch_reporter_xml.h\n\n// end catch_external_interfaces.h\n#endif\n\n#if defined(CATCH_CONFIG_ENABLE_BENCHMARKING)\n// start catch_benchmarking_all.hpp\n\n// A proxy header that includes all of the benchmarking headers to allow\n// concise include of the benchmarking features. You should prefer the\n// individual includes in standard use.\n\n// start catch_benchmark.hpp\n\n // Benchmark\n\n// start catch_chronometer.hpp\n\n// User-facing chronometer\n\n\n// start catch_clock.hpp\n\n// Clocks\n\n\n#include <chrono>\n#include <ratio>\n\nnamespace Catch {\n    namespace Benchmark {\n        template <typename Clock>\n        using ClockDuration = typename Clock::duration;\n        template <typename Clock>\n        using FloatDuration = std::chrono::duration<double, typename Clock::period>;\n\n        template <typename Clock>\n        using TimePoint = typename Clock::time_point;\n\n        using default_clock = std::chrono::steady_clock;\n\n        template <typename Clock>\n        struct now {\n            TimePoint<Clock> operator()() const {\n                return Clock::now();\n            }\n        };\n\n        using fp_seconds = std::chrono::duration<double, std::ratio<1>>;\n    } // namespace Benchmark\n} // namespace Catch\n\n// end catch_clock.hpp\n// start catch_optimizer.hpp\n\n // Hinting the optimizer\n\n\n#if defined(_MSC_VER)\n#   include <atomic> // atomic_thread_fence\n#endif\n\nnamespace Catch {\n    namespace Benchmark {\n#if defined(__GNUC__) || defined(__clang__)\n        template <typename T>\n        inline void keep_memory(T* p) {\n            asm volatile(\"\" : : \"g\"(p) : \"memory\");\n        }\n        inline void keep_memory() {\n            asm volatile(\"\" : : : \"memory\");\n        }\n\n        namespace Detail {\n            inline void optimizer_barrier() { keep_memory(); }\n        } // namespace Detail\n#elif defined(_MSC_VER)\n\n#pragma optimize(\"\", off)\n        template <typename T>\n        inline void keep_memory(T* p) {\n            // thanks @milleniumbug\n            *reinterpret_cast<char volatile*>(p) = *reinterpret_cast<char const volatile*>(p);\n        }\n        // TODO equivalent keep_memory()\n#pragma optimize(\"\", on)\n\n        namespace Detail {\n            inline void optimizer_barrier() {\n                std::atomic_thread_fence(std::memory_order_seq_cst);\n            }\n        } // namespace Detail\n\n#endif\n\n        template <typename T>\n        inline void deoptimize_value(T&& x) {\n            keep_memory(&x);\n        }\n\n        template <typename Fn, typename... Args>\n        inline auto invoke_deoptimized(Fn&& fn, Args&&... args) -> typename std::enable_if<!std::is_same<void, decltype(fn(args...))>::value>::type {\n            deoptimize_value(std::forward<Fn>(fn) (std::forward<Args...>(args...)));\n        }\n\n        template <typename Fn, typename... Args>\n        inline auto invoke_deoptimized(Fn&& fn, Args&&... args) -> typename std::enable_if<std::is_same<void, decltype(fn(args...))>::value>::type {\n            std::forward<Fn>(fn) (std::forward<Args...>(args...));\n        }\n    } // namespace Benchmark\n} // namespace Catch\n\n// end catch_optimizer.hpp\n// start catch_complete_invoke.hpp\n\n// Invoke with a special case for void\n\n\n#include <type_traits>\n#include <utility>\n\nnamespace Catch {\n    namespace Benchmark {\n        namespace Detail {\n            template <typename T>\n            struct CompleteType { using type = T; };\n            template <>\n            struct CompleteType<void> { struct type {}; };\n\n            template <typename T>\n            using CompleteType_t = typename CompleteType<T>::type;\n\n            template <typename Result>\n            struct CompleteInvoker {\n                template <typename Fun, typename... Args>\n                static Result invoke(Fun&& fun, Args&&... args) {\n                    return std::forward<Fun>(fun)(std::forward<Args>(args)...);\n                }\n            };\n            template <>\n            struct CompleteInvoker<void> {\n                template <typename Fun, typename... Args>\n                static CompleteType_t<void> invoke(Fun&& fun, Args&&... args) {\n                    std::forward<Fun>(fun)(std::forward<Args>(args)...);\n                    return {};\n                }\n            };\n\n            // invoke and not return void :(\n            template <typename Fun, typename... Args>\n            CompleteType_t<FunctionReturnType<Fun, Args...>> complete_invoke(Fun&& fun, Args&&... args) {\n                return CompleteInvoker<FunctionReturnType<Fun, Args...>>::invoke(std::forward<Fun>(fun), std::forward<Args>(args)...);\n            }\n\n            const std::string benchmarkErrorMsg = \"a benchmark failed to run successfully\";\n        } // namespace Detail\n\n        template <typename Fun>\n        Detail::CompleteType_t<FunctionReturnType<Fun>> user_code(Fun&& fun) {\n            CATCH_TRY{\n                return Detail::complete_invoke(std::forward<Fun>(fun));\n            } CATCH_CATCH_ALL{\n                getResultCapture().benchmarkFailed(translateActiveException());\n                CATCH_RUNTIME_ERROR(Detail::benchmarkErrorMsg);\n            }\n        }\n    } // namespace Benchmark\n} // namespace Catch\n\n// end catch_complete_invoke.hpp\nnamespace Catch {\n    namespace Benchmark {\n        namespace Detail {\n            struct ChronometerConcept {\n                virtual void start() = 0;\n                virtual void finish() = 0;\n                virtual ~ChronometerConcept() = default;\n            };\n            template <typename Clock>\n            struct ChronometerModel final : public ChronometerConcept {\n                void start() override { started = Clock::now(); }\n                void finish() override { finished = Clock::now(); }\n\n                ClockDuration<Clock> elapsed() const { return finished - started; }\n\n                TimePoint<Clock> started;\n                TimePoint<Clock> finished;\n            };\n        } // namespace Detail\n\n        struct Chronometer {\n        public:\n            template <typename Fun>\n            void measure(Fun&& fun) { measure(std::forward<Fun>(fun), is_callable<Fun(int)>()); }\n\n            int runs() const { return k; }\n\n            Chronometer(Detail::ChronometerConcept& meter, int k)\n                : impl(&meter)\n                , k(k) {}\n\n        private:\n            template <typename Fun>\n            void measure(Fun&& fun, std::false_type) {\n                measure([&fun](int) { return fun(); }, std::true_type());\n            }\n\n            template <typename Fun>\n            void measure(Fun&& fun, std::true_type) {\n                Detail::optimizer_barrier();\n                impl->start();\n                for (int i = 0; i < k; ++i) invoke_deoptimized(fun, i);\n                impl->finish();\n                Detail::optimizer_barrier();\n            }\n\n            Detail::ChronometerConcept* impl;\n            int k;\n        };\n    } // namespace Benchmark\n} // namespace Catch\n\n// end catch_chronometer.hpp\n// start catch_environment.hpp\n\n// Environment information\n\n\nnamespace Catch {\n    namespace Benchmark {\n        template <typename Duration>\n        struct EnvironmentEstimate {\n            Duration mean;\n            OutlierClassification outliers;\n\n            template <typename Duration2>\n            operator EnvironmentEstimate<Duration2>() const {\n                return { mean, outliers };\n            }\n        };\n        template <typename Clock>\n        struct Environment {\n            using clock_type = Clock;\n            EnvironmentEstimate<FloatDuration<Clock>> clock_resolution;\n            EnvironmentEstimate<FloatDuration<Clock>> clock_cost;\n        };\n    } // namespace Benchmark\n} // namespace Catch\n\n// end catch_environment.hpp\n// start catch_execution_plan.hpp\n\n // Execution plan\n\n\n// start catch_benchmark_function.hpp\n\n // Dumb std::function implementation for consistent call overhead\n\n\n#include <cassert>\n#include <type_traits>\n#include <utility>\n#include <memory>\n\nnamespace Catch {\n    namespace Benchmark {\n        namespace Detail {\n            template <typename T>\n            using Decay = typename std::decay<T>::type;\n            template <typename T, typename U>\n            struct is_related\n                : std::is_same<Decay<T>, Decay<U>> {};\n\n            /// We need to reinvent std::function because every piece of code that might add overhead\n            /// in a measurement context needs to have consistent performance characteristics so that we\n            /// can account for it in the measurement.\n            /// Implementations of std::function with optimizations that aren't always applicable, like\n            /// small buffer optimizations, are not uncommon.\n            /// This is effectively an implementation of std::function without any such optimizations;\n            /// it may be slow, but it is consistently slow.\n            struct BenchmarkFunction {\n            private:\n                struct callable {\n                    virtual void call(Chronometer meter) const = 0;\n                    virtual callable* clone() const = 0;\n                    virtual ~callable() = default;\n                };\n                template <typename Fun>\n                struct model : public callable {\n                    model(Fun&& fun) : fun(std::move(fun)) {}\n                    model(Fun const& fun) : fun(fun) {}\n\n                    model<Fun>* clone() const override { return new model<Fun>(*this); }\n\n                    void call(Chronometer meter) const override {\n                        call(meter, is_callable<Fun(Chronometer)>());\n                    }\n                    void call(Chronometer meter, std::true_type) const {\n                        fun(meter);\n                    }\n                    void call(Chronometer meter, std::false_type) const {\n                        meter.measure(fun);\n                    }\n\n                    Fun fun;\n                };\n\n                struct do_nothing { void operator()() const {} };\n\n                template <typename T>\n                BenchmarkFunction(model<T>* c) : f(c) {}\n\n            public:\n                BenchmarkFunction()\n                    : f(new model<do_nothing>{ {} }) {}\n\n                template <typename Fun,\n                    typename std::enable_if<!is_related<Fun, BenchmarkFunction>::value, int>::type = 0>\n                    BenchmarkFunction(Fun&& fun)\n                    : f(new model<typename std::decay<Fun>::type>(std::forward<Fun>(fun))) {}\n\n                BenchmarkFunction(BenchmarkFunction&& that)\n                    : f(std::move(that.f)) {}\n\n                BenchmarkFunction(BenchmarkFunction const& that)\n                    : f(that.f->clone()) {}\n\n                BenchmarkFunction& operator=(BenchmarkFunction&& that) {\n                    f = std::move(that.f);\n                    return *this;\n                }\n\n                BenchmarkFunction& operator=(BenchmarkFunction const& that) {\n                    f.reset(that.f->clone());\n                    return *this;\n                }\n\n                void operator()(Chronometer meter) const { f->call(meter); }\n\n            private:\n                std::unique_ptr<callable> f;\n            };\n        } // namespace Detail\n    } // namespace Benchmark\n} // namespace Catch\n\n// end catch_benchmark_function.hpp\n// start catch_repeat.hpp\n\n// repeat algorithm\n\n\n#include <type_traits>\n#include <utility>\n\nnamespace Catch {\n    namespace Benchmark {\n        namespace Detail {\n            template <typename Fun>\n            struct repeater {\n                void operator()(int k) const {\n                    for (int i = 0; i < k; ++i) {\n                        fun();\n                    }\n                }\n                Fun fun;\n            };\n            template <typename Fun>\n            repeater<typename std::decay<Fun>::type> repeat(Fun&& fun) {\n                return { std::forward<Fun>(fun) };\n            }\n        } // namespace Detail\n    } // namespace Benchmark\n} // namespace Catch\n\n// end catch_repeat.hpp\n// start catch_run_for_at_least.hpp\n\n// Run a function for a minimum amount of time\n\n\n// start catch_measure.hpp\n\n// Measure\n\n\n// start catch_timing.hpp\n\n// Timing\n\n\n#include <tuple>\n#include <type_traits>\n\nnamespace Catch {\n    namespace Benchmark {\n        template <typename Duration, typename Result>\n        struct Timing {\n            Duration elapsed;\n            Result result;\n            int iterations;\n        };\n        template <typename Clock, typename Func, typename... Args>\n        using TimingOf = Timing<ClockDuration<Clock>, Detail::CompleteType_t<FunctionReturnType<Func, Args...>>>;\n    } // namespace Benchmark\n} // namespace Catch\n\n// end catch_timing.hpp\n#include <utility>\n\nnamespace Catch {\n    namespace Benchmark {\n        namespace Detail {\n            template <typename Clock, typename Fun, typename... Args>\n            TimingOf<Clock, Fun, Args...> measure(Fun&& fun, Args&&... args) {\n                auto start = Clock::now();\n                auto&& r = Detail::complete_invoke(fun, std::forward<Args>(args)...);\n                auto end = Clock::now();\n                auto delta = end - start;\n                return { delta, std::forward<decltype(r)>(r), 1 };\n            }\n        } // namespace Detail\n    } // namespace Benchmark\n} // namespace Catch\n\n// end catch_measure.hpp\n#include <utility>\n#include <type_traits>\n\nnamespace Catch {\n    namespace Benchmark {\n        namespace Detail {\n            template <typename Clock, typename Fun>\n            TimingOf<Clock, Fun, int> measure_one(Fun&& fun, int iters, std::false_type) {\n                return Detail::measure<Clock>(fun, iters);\n            }\n            template <typename Clock, typename Fun>\n            TimingOf<Clock, Fun, Chronometer> measure_one(Fun&& fun, int iters, std::true_type) {\n                Detail::ChronometerModel<Clock> meter;\n                auto&& result = Detail::complete_invoke(fun, Chronometer(meter, iters));\n\n                return { meter.elapsed(), std::move(result), iters };\n            }\n\n            template <typename Clock, typename Fun>\n            using run_for_at_least_argument_t = typename std::conditional<is_callable<Fun(Chronometer)>::value, Chronometer, int>::type;\n\n            struct optimized_away_error : std::exception {\n                const char* what() const noexcept override {\n                    return \"could not measure benchmark, maybe it was optimized away\";\n                }\n            };\n\n            template <typename Clock, typename Fun>\n            TimingOf<Clock, Fun, run_for_at_least_argument_t<Clock, Fun>> run_for_at_least(ClockDuration<Clock> how_long, int seed, Fun&& fun) {\n                auto iters = seed;\n                while (iters < (1 << 30)) {\n                    auto&& Timing = measure_one<Clock>(fun, iters, is_callable<Fun(Chronometer)>());\n\n                    if (Timing.elapsed >= how_long) {\n                        return { Timing.elapsed, std::move(Timing.result), iters };\n                    }\n                    iters *= 2;\n                }\n                Catch::throw_exception(optimized_away_error{});\n            }\n        } // namespace Detail\n    } // namespace Benchmark\n} // namespace Catch\n\n// end catch_run_for_at_least.hpp\n#include <algorithm>\n#include <iterator>\n\nnamespace Catch {\n    namespace Benchmark {\n        template <typename Duration>\n        struct ExecutionPlan {\n            int iterations_per_sample;\n            Duration estimated_duration;\n            Detail::BenchmarkFunction benchmark;\n            Duration warmup_time;\n            int warmup_iterations;\n\n            template <typename Duration2>\n            operator ExecutionPlan<Duration2>() const {\n                return { iterations_per_sample, estimated_duration, benchmark, warmup_time, warmup_iterations };\n            }\n\n            template <typename Clock>\n            std::vector<FloatDuration<Clock>> run(const IConfig &cfg, Environment<FloatDuration<Clock>> env) const {\n                // warmup a bit\n                Detail::run_for_at_least<Clock>(std::chrono::duration_cast<ClockDuration<Clock>>(warmup_time), warmup_iterations, Detail::repeat(now<Clock>{}));\n\n                std::vector<FloatDuration<Clock>> times;\n                times.reserve(cfg.benchmarkSamples());\n                std::generate_n(std::back_inserter(times), cfg.benchmarkSamples(), [this, env] {\n                    Detail::ChronometerModel<Clock> model;\n                    this->benchmark(Chronometer(model, iterations_per_sample));\n                    auto sample_time = model.elapsed() - env.clock_cost.mean;\n                    if (sample_time < FloatDuration<Clock>::zero()) sample_time = FloatDuration<Clock>::zero();\n                    return sample_time / iterations_per_sample;\n                });\n                return times;\n            }\n        };\n    } // namespace Benchmark\n} // namespace Catch\n\n// end catch_execution_plan.hpp\n// start catch_estimate_clock.hpp\n\n // Environment measurement\n\n\n// start catch_stats.hpp\n\n// Statistical analysis tools\n\n\n#include <algorithm>\n#include <functional>\n#include <vector>\n#include <iterator>\n#include <numeric>\n#include <tuple>\n#include <cmath>\n#include <utility>\n#include <cstddef>\n#include <random>\n\nnamespace Catch {\n    namespace Benchmark {\n        namespace Detail {\n            using sample = std::vector<double>;\n\n            double weighted_average_quantile(int k, int q, std::vector<double>::iterator first, std::vector<double>::iterator last);\n\n            template <typename Iterator>\n            OutlierClassification classify_outliers(Iterator first, Iterator last) {\n                std::vector<double> copy(first, last);\n\n                auto q1 = weighted_average_quantile(1, 4, copy.begin(), copy.end());\n                auto q3 = weighted_average_quantile(3, 4, copy.begin(), copy.end());\n                auto iqr = q3 - q1;\n                auto los = q1 - (iqr * 3.);\n                auto lom = q1 - (iqr * 1.5);\n                auto him = q3 + (iqr * 1.5);\n                auto his = q3 + (iqr * 3.);\n\n                OutlierClassification o;\n                for (; first != last; ++first) {\n                    auto&& t = *first;\n                    if (t < los) ++o.low_severe;\n                    else if (t < lom) ++o.low_mild;\n                    else if (t > his) ++o.high_severe;\n                    else if (t > him) ++o.high_mild;\n                    ++o.samples_seen;\n                }\n                return o;\n            }\n\n            template <typename Iterator>\n            double mean(Iterator first, Iterator last) {\n                auto count = last - first;\n                double sum = std::accumulate(first, last, 0.);\n                return sum / count;\n            }\n\n            template <typename URng, typename Iterator, typename Estimator>\n            sample resample(URng& rng, int resamples, Iterator first, Iterator last, Estimator& estimator) {\n                auto n = last - first;\n                std::uniform_int_distribution<decltype(n)> dist(0, n - 1);\n\n                sample out;\n                out.reserve(resamples);\n                std::generate_n(std::back_inserter(out), resamples, [n, first, &estimator, &dist, &rng] {\n                    std::vector<double> resampled;\n                    resampled.reserve(n);\n                    std::generate_n(std::back_inserter(resampled), n, [first, &dist, &rng] { return first[dist(rng)]; });\n                    return estimator(resampled.begin(), resampled.end());\n                });\n                std::sort(out.begin(), out.end());\n                return out;\n            }\n\n            template <typename Estimator, typename Iterator>\n            sample jackknife(Estimator&& estimator, Iterator first, Iterator last) {\n                auto n = last - first;\n                auto second = std::next(first);\n                sample results;\n                results.reserve(n);\n\n                for (auto it = first; it != last; ++it) {\n                    std::iter_swap(it, first);\n                    results.push_back(estimator(second, last));\n                }\n\n                return results;\n            }\n\n            inline double normal_cdf(double x) {\n                return std::erfc(-x / std::sqrt(2.0)) / 2.0;\n            }\n\n            double erfc_inv(double x);\n\n            double normal_quantile(double p);\n\n            template <typename Iterator, typename Estimator>\n            Estimate<double> bootstrap(double confidence_level, Iterator first, Iterator last, sample const& resample, Estimator&& estimator) {\n                auto n_samples = last - first;\n\n                double point = estimator(first, last);\n                // Degenerate case with a single sample\n                if (n_samples == 1) return { point, point, point, confidence_level };\n\n                sample jack = jackknife(estimator, first, last);\n                double jack_mean = mean(jack.begin(), jack.end());\n                double sum_squares, sum_cubes;\n                std::tie(sum_squares, sum_cubes) = std::accumulate(jack.begin(), jack.end(), std::make_pair(0., 0.), [jack_mean](std::pair<double, double> sqcb, double x) -> std::pair<double, double> {\n                    auto d = jack_mean - x;\n                    auto d2 = d * d;\n                    auto d3 = d2 * d;\n                    return { sqcb.first + d2, sqcb.second + d3 };\n                });\n\n                double accel = sum_cubes / (6 * std::pow(sum_squares, 1.5));\n                int n = static_cast<int>(resample.size());\n                double prob_n = std::count_if(resample.begin(), resample.end(), [point](double x) { return x < point; }) / (double)n;\n                // degenerate case with uniform samples\n                if (prob_n == 0) return { point, point, point, confidence_level };\n\n                double bias = normal_quantile(prob_n);\n                double z1 = normal_quantile((1. - confidence_level) / 2.);\n\n                auto cumn = [n](double x) -> int {\n                    return std::lround(normal_cdf(x) * n); };\n                auto a = [bias, accel](double b) { return bias + b / (1. - accel * b); };\n                double b1 = bias + z1;\n                double b2 = bias - z1;\n                double a1 = a(b1);\n                double a2 = a(b2);\n                auto lo = (std::max)(cumn(a1), 0);\n                auto hi = (std::min)(cumn(a2), n - 1);\n\n                return { point, resample[lo], resample[hi], confidence_level };\n            }\n\n            double outlier_variance(Estimate<double> mean, Estimate<double> stddev, int n);\n\n            struct bootstrap_analysis {\n                Estimate<double> mean;\n                Estimate<double> standard_deviation;\n                double outlier_variance;\n            };\n\n            bootstrap_analysis analyse_samples(double confidence_level, int n_resamples, std::vector<double>::iterator first, std::vector<double>::iterator last);\n        } // namespace Detail\n    } // namespace Benchmark\n} // namespace Catch\n\n// end catch_stats.hpp\n#include <algorithm>\n#include <iterator>\n#include <tuple>\n#include <vector>\n#include <cmath>\n\nnamespace Catch {\n    namespace Benchmark {\n        namespace Detail {\n            template <typename Clock>\n            std::vector<double> resolution(int k) {\n                std::vector<TimePoint<Clock>> times;\n                times.reserve(k + 1);\n                std::generate_n(std::back_inserter(times), k + 1, now<Clock>{});\n\n                std::vector<double> deltas;\n                deltas.reserve(k);\n                std::transform(std::next(times.begin()), times.end(), times.begin(),\n                    std::back_inserter(deltas),\n                    [](TimePoint<Clock> a, TimePoint<Clock> b) { return static_cast<double>((a - b).count()); });\n\n                return deltas;\n            }\n\n            const auto warmup_iterations = 10000;\n            const auto warmup_time = std::chrono::milliseconds(100);\n            const auto minimum_ticks = 1000;\n            const auto warmup_seed = 10000;\n            const auto clock_resolution_estimation_time = std::chrono::milliseconds(500);\n            const auto clock_cost_estimation_time_limit = std::chrono::seconds(1);\n            const auto clock_cost_estimation_tick_limit = 100000;\n            const auto clock_cost_estimation_time = std::chrono::milliseconds(10);\n            const auto clock_cost_estimation_iterations = 10000;\n\n            template <typename Clock>\n            int warmup() {\n                return run_for_at_least<Clock>(std::chrono::duration_cast<ClockDuration<Clock>>(warmup_time), warmup_seed, &resolution<Clock>)\n                    .iterations;\n            }\n            template <typename Clock>\n            EnvironmentEstimate<FloatDuration<Clock>> estimate_clock_resolution(int iterations) {\n                auto r = run_for_at_least<Clock>(std::chrono::duration_cast<ClockDuration<Clock>>(clock_resolution_estimation_time), iterations, &resolution<Clock>)\n                    .result;\n                return {\n                    FloatDuration<Clock>(mean(r.begin(), r.end())),\n                    classify_outliers(r.begin(), r.end()),\n                };\n            }\n            template <typename Clock>\n            EnvironmentEstimate<FloatDuration<Clock>> estimate_clock_cost(FloatDuration<Clock> resolution) {\n                auto time_limit = (std::min)(\n                    resolution * clock_cost_estimation_tick_limit,\n                    FloatDuration<Clock>(clock_cost_estimation_time_limit));\n                auto time_clock = [](int k) {\n                    return Detail::measure<Clock>([k] {\n                        for (int i = 0; i < k; ++i) {\n                            volatile auto ignored = Clock::now();\n                            (void)ignored;\n                        }\n                    }).elapsed;\n                };\n                time_clock(1);\n                int iters = clock_cost_estimation_iterations;\n                auto&& r = run_for_at_least<Clock>(std::chrono::duration_cast<ClockDuration<Clock>>(clock_cost_estimation_time), iters, time_clock);\n                std::vector<double> times;\n                int nsamples = static_cast<int>(std::ceil(time_limit / r.elapsed));\n                times.reserve(nsamples);\n                std::generate_n(std::back_inserter(times), nsamples, [time_clock, &r] {\n                    return static_cast<double>((time_clock(r.iterations) / r.iterations).count());\n                });\n                return {\n                    FloatDuration<Clock>(mean(times.begin(), times.end())),\n                    classify_outliers(times.begin(), times.end()),\n                };\n            }\n\n            template <typename Clock>\n            Environment<FloatDuration<Clock>> measure_environment() {\n                static Environment<FloatDuration<Clock>>* env = nullptr;\n                if (env) {\n                    return *env;\n                }\n\n                auto iters = Detail::warmup<Clock>();\n                auto resolution = Detail::estimate_clock_resolution<Clock>(iters);\n                auto cost = Detail::estimate_clock_cost<Clock>(resolution.mean);\n\n                env = new Environment<FloatDuration<Clock>>{ resolution, cost };\n                return *env;\n            }\n        } // namespace Detail\n    } // namespace Benchmark\n} // namespace Catch\n\n// end catch_estimate_clock.hpp\n// start catch_analyse.hpp\n\n // Run and analyse one benchmark\n\n\n// start catch_sample_analysis.hpp\n\n// Benchmark results\n\n\n#include <algorithm>\n#include <vector>\n#include <string>\n#include <iterator>\n\nnamespace Catch {\n    namespace Benchmark {\n        template <typename Duration>\n        struct SampleAnalysis {\n            std::vector<Duration> samples;\n            Estimate<Duration> mean;\n            Estimate<Duration> standard_deviation;\n            OutlierClassification outliers;\n            double outlier_variance;\n\n            template <typename Duration2>\n            operator SampleAnalysis<Duration2>() const {\n                std::vector<Duration2> samples2;\n                samples2.reserve(samples.size());\n                std::transform(samples.begin(), samples.end(), std::back_inserter(samples2), [](Duration d) { return Duration2(d); });\n                return {\n                    std::move(samples2),\n                    mean,\n                    standard_deviation,\n                    outliers,\n                    outlier_variance,\n                };\n            }\n        };\n    } // namespace Benchmark\n} // namespace Catch\n\n// end catch_sample_analysis.hpp\n#include <algorithm>\n#include <iterator>\n#include <vector>\n\nnamespace Catch {\n    namespace Benchmark {\n        namespace Detail {\n            template <typename Duration, typename Iterator>\n            SampleAnalysis<Duration> analyse(const IConfig &cfg, Environment<Duration>, Iterator first, Iterator last) {\n                if (!cfg.benchmarkNoAnalysis()) {\n                    std::vector<double> samples;\n                    samples.reserve(last - first);\n                    std::transform(first, last, std::back_inserter(samples), [](Duration d) { return d.count(); });\n\n                    auto analysis = Catch::Benchmark::Detail::analyse_samples(cfg.benchmarkConfidenceInterval(), cfg.benchmarkResamples(), samples.begin(), samples.end());\n                    auto outliers = Catch::Benchmark::Detail::classify_outliers(samples.begin(), samples.end());\n\n                    auto wrap_estimate = [](Estimate<double> e) {\n                        return Estimate<Duration> {\n                            Duration(e.point),\n                                Duration(e.lower_bound),\n                                Duration(e.upper_bound),\n                                e.confidence_interval,\n                        };\n                    };\n                    std::vector<Duration> samples2;\n                    samples2.reserve(samples.size());\n                    std::transform(samples.begin(), samples.end(), std::back_inserter(samples2), [](double d) { return Duration(d); });\n                    return {\n                        std::move(samples2),\n                        wrap_estimate(analysis.mean),\n                        wrap_estimate(analysis.standard_deviation),\n                        outliers,\n                        analysis.outlier_variance,\n                    };\n                } else {\n                    std::vector<Duration> samples;\n                    samples.reserve(last - first);\n\n                    Duration mean = Duration(0);\n                    int i = 0;\n                    for (auto it = first; it < last; ++it, ++i) {\n                        samples.push_back(Duration(*it));\n                        mean += Duration(*it);\n                    }\n                    mean /= i;\n\n                    return {\n                        std::move(samples),\n                        Estimate<Duration>{mean, mean, mean, 0.0},\n                        Estimate<Duration>{Duration(0), Duration(0), Duration(0), 0.0},\n                        OutlierClassification{},\n                        0.0\n                    };\n                }\n            }\n        } // namespace Detail\n    } // namespace Benchmark\n} // namespace Catch\n\n// end catch_analyse.hpp\n#include <algorithm>\n#include <functional>\n#include <string>\n#include <vector>\n#include <cmath>\n\nnamespace Catch {\n    namespace Benchmark {\n        struct Benchmark {\n            Benchmark(std::string &&name)\n                : name(std::move(name)) {}\n\n            template <class FUN>\n            Benchmark(std::string &&name, FUN &&func)\n                : fun(std::move(func)), name(std::move(name)) {}\n\n            template <typename Clock>\n            ExecutionPlan<FloatDuration<Clock>> prepare(const IConfig &cfg, Environment<FloatDuration<Clock>> env) const {\n                auto min_time = env.clock_resolution.mean * Detail::minimum_ticks;\n                auto run_time = std::max(min_time, std::chrono::duration_cast<decltype(min_time)>(cfg.benchmarkWarmupTime()));\n                auto&& test = Detail::run_for_at_least<Clock>(std::chrono::duration_cast<ClockDuration<Clock>>(run_time), 1, fun);\n                int new_iters = static_cast<int>(std::ceil(min_time * test.iterations / test.elapsed));\n                return { new_iters, test.elapsed / test.iterations * new_iters * cfg.benchmarkSamples(), fun, std::chrono::duration_cast<FloatDuration<Clock>>(cfg.benchmarkWarmupTime()), Detail::warmup_iterations };\n            }\n\n            template <typename Clock = default_clock>\n            void run() {\n                IConfigPtr cfg = getCurrentContext().getConfig();\n\n                auto env = Detail::measure_environment<Clock>();\n\n                getResultCapture().benchmarkPreparing(name);\n                CATCH_TRY{\n                    auto plan = user_code([&] {\n                        return prepare<Clock>(*cfg, env);\n                    });\n\n                    BenchmarkInfo info {\n                        name,\n                        plan.estimated_duration.count(),\n                        plan.iterations_per_sample,\n                        cfg->benchmarkSamples(),\n                        cfg->benchmarkResamples(),\n                        env.clock_resolution.mean.count(),\n                        env.clock_cost.mean.count()\n                    };\n\n                    getResultCapture().benchmarkStarting(info);\n\n                    auto samples = user_code([&] {\n                        return plan.template run<Clock>(*cfg, env);\n                    });\n\n                    auto analysis = Detail::analyse(*cfg, env, samples.begin(), samples.end());\n                    BenchmarkStats<FloatDuration<Clock>> stats{ info, analysis.samples, analysis.mean, analysis.standard_deviation, analysis.outliers, analysis.outlier_variance };\n                    getResultCapture().benchmarkEnded(stats);\n\n                } CATCH_CATCH_ALL{\n                    if (translateActiveException() != Detail::benchmarkErrorMsg) // benchmark errors have been reported, otherwise rethrow.\n                        std::rethrow_exception(std::current_exception());\n                }\n            }\n\n            // sets lambda to be used in fun *and* executes benchmark!\n            template <typename Fun,\n                typename std::enable_if<!Detail::is_related<Fun, Benchmark>::value, int>::type = 0>\n                Benchmark & operator=(Fun func) {\n                fun = Detail::BenchmarkFunction(func);\n                run();\n                return *this;\n            }\n\n            explicit operator bool() {\n                return true;\n            }\n\n        private:\n            Detail::BenchmarkFunction fun;\n            std::string name;\n        };\n    }\n} // namespace Catch\n\n#define INTERNAL_CATCH_GET_1_ARG(arg1, arg2, ...) arg1\n#define INTERNAL_CATCH_GET_2_ARG(arg1, arg2, ...) arg2\n\n#define INTERNAL_CATCH_BENCHMARK(BenchmarkName, name, benchmarkIndex)\\\n    if( Catch::Benchmark::Benchmark BenchmarkName{name} ) \\\n        BenchmarkName = [&](int benchmarkIndex)\n\n#define INTERNAL_CATCH_BENCHMARK_ADVANCED(BenchmarkName, name)\\\n    if( Catch::Benchmark::Benchmark BenchmarkName{name} ) \\\n        BenchmarkName = [&]\n\n// end catch_benchmark.hpp\n// start catch_constructor.hpp\n\n// Constructor and destructor helpers\n\n\n#include <type_traits>\n\nnamespace Catch {\n    namespace Benchmark {\n        namespace Detail {\n            template <typename T, bool Destruct>\n            struct ObjectStorage\n            {\n                ObjectStorage() : data() {}\n\n                ObjectStorage(const ObjectStorage& other)\n                {\n                    new(&data) T(other.stored_object());\n                }\n\n                ObjectStorage(ObjectStorage&& other)\n                {\n                    new(&data) T(std::move(other.stored_object()));\n                }\n\n                ~ObjectStorage() { destruct_on_exit<T>(); }\n\n                template <typename... Args>\n                void construct(Args&&... args)\n                {\n                    new (&data) T(std::forward<Args>(args)...);\n                }\n\n                template <bool AllowManualDestruction = !Destruct>\n                typename std::enable_if<AllowManualDestruction>::type destruct()\n                {\n                    stored_object().~T();\n                }\n\n            private:\n                // If this is a constructor benchmark, destruct the underlying object\n                template <typename U>\n                void destruct_on_exit(typename std::enable_if<Destruct, U>::type* = 0) { destruct<true>(); }\n                // Otherwise, don't\n                template <typename U>\n                void destruct_on_exit(typename std::enable_if<!Destruct, U>::type* = 0) { }\n\n                T& stored_object() {\n                    return *static_cast<T*>(static_cast<void*>(&data));\n                }\n\n                T const& stored_object() const {\n                    return *static_cast<T*>(static_cast<void*>(&data));\n                }\n\n                struct { alignas(T) unsigned char data[sizeof(T)]; }  data;\n            };\n        }\n\n        template <typename T>\n        using storage_for = Detail::ObjectStorage<T, true>;\n\n        template <typename T>\n        using destructable_object = Detail::ObjectStorage<T, false>;\n    }\n}\n\n// end catch_constructor.hpp\n// end catch_benchmarking_all.hpp\n#endif\n\n#endif // ! CATCH_CONFIG_IMPL_ONLY\n\n#ifdef CATCH_IMPL\n// start catch_impl.hpp\n\n#ifdef __clang__\n#pragma clang diagnostic push\n#pragma clang diagnostic ignored \"-Wweak-vtables\"\n#endif\n\n// Keep these here for external reporters\n// start catch_test_case_tracker.h\n\n#include <string>\n#include <vector>\n#include <memory>\n\nnamespace Catch {\nnamespace TestCaseTracking {\n\n    struct NameAndLocation {\n        std::string name;\n        SourceLineInfo location;\n\n        NameAndLocation( std::string const& _name, SourceLineInfo const& _location );\n        friend bool operator==(NameAndLocation const& lhs, NameAndLocation const& rhs) {\n            return lhs.name == rhs.name\n                && lhs.location == rhs.location;\n        }\n    };\n\n    class ITracker;\n\n    using ITrackerPtr = std::shared_ptr<ITracker>;\n\n    class  ITracker {\n        NameAndLocation m_nameAndLocation;\n\n    public:\n        ITracker(NameAndLocation const& nameAndLoc) :\n            m_nameAndLocation(nameAndLoc)\n        {}\n\n        // static queries\n        NameAndLocation const& nameAndLocation() const {\n            return m_nameAndLocation;\n        }\n\n        virtual ~ITracker();\n\n        // dynamic queries\n        virtual bool isComplete() const = 0; // Successfully completed or failed\n        virtual bool isSuccessfullyCompleted() const = 0;\n        virtual bool isOpen() const = 0; // Started but not complete\n        virtual bool hasChildren() const = 0;\n        virtual bool hasStarted() const = 0;\n\n        virtual ITracker& parent() = 0;\n\n        // actions\n        virtual void close() = 0; // Successfully complete\n        virtual void fail() = 0;\n        virtual void markAsNeedingAnotherRun() = 0;\n\n        virtual void addChild( ITrackerPtr const& child ) = 0;\n        virtual ITrackerPtr findChild( NameAndLocation const& nameAndLocation ) = 0;\n        virtual void openChild() = 0;\n\n        // Debug/ checking\n        virtual bool isSectionTracker() const = 0;\n        virtual bool isGeneratorTracker() const = 0;\n    };\n\n    class TrackerContext {\n\n        enum RunState {\n            NotStarted,\n            Executing,\n            CompletedCycle\n        };\n\n        ITrackerPtr m_rootTracker;\n        ITracker* m_currentTracker = nullptr;\n        RunState m_runState = NotStarted;\n\n    public:\n\n        ITracker& startRun();\n        void endRun();\n\n        void startCycle();\n        void completeCycle();\n\n        bool completedCycle() const;\n        ITracker& currentTracker();\n        void setCurrentTracker( ITracker* tracker );\n    };\n\n    class TrackerBase : public ITracker {\n    protected:\n        enum CycleState {\n            NotStarted,\n            Executing,\n            ExecutingChildren,\n            NeedsAnotherRun,\n            CompletedSuccessfully,\n            Failed\n        };\n\n        using Children = std::vector<ITrackerPtr>;\n        TrackerContext& m_ctx;\n        ITracker* m_parent;\n        Children m_children;\n        CycleState m_runState = NotStarted;\n\n    public:\n        TrackerBase( NameAndLocation const& nameAndLocation, TrackerContext& ctx, ITracker* parent );\n\n        bool isComplete() const override;\n        bool isSuccessfullyCompleted() const override;\n        bool isOpen() const override;\n        bool hasChildren() const override;\n        bool hasStarted() const override {\n            return m_runState != NotStarted;\n        }\n\n        void addChild( ITrackerPtr const& child ) override;\n\n        ITrackerPtr findChild( NameAndLocation const& nameAndLocation ) override;\n        ITracker& parent() override;\n\n        void openChild() override;\n\n        bool isSectionTracker() const override;\n        bool isGeneratorTracker() const override;\n\n        void open();\n\n        void close() override;\n        void fail() override;\n        void markAsNeedingAnotherRun() override;\n\n    private:\n        void moveToParent();\n        void moveToThis();\n    };\n\n    class SectionTracker : public TrackerBase {\n        std::vector<std::string> m_filters;\n        std::string m_trimmed_name;\n    public:\n        SectionTracker( NameAndLocation const& nameAndLocation, TrackerContext& ctx, ITracker* parent );\n\n        bool isSectionTracker() const override;\n\n        bool isComplete() const override;\n\n        static SectionTracker& acquire( TrackerContext& ctx, NameAndLocation const& nameAndLocation );\n\n        void tryOpen();\n\n        void addInitialFilters( std::vector<std::string> const& filters );\n        void addNextFilters( std::vector<std::string> const& filters );\n        //! Returns filters active in this tracker\n        std::vector<std::string> const& getFilters() const;\n        //! Returns whitespace-trimmed name of the tracked section\n        std::string const& trimmedName() const;\n    };\n\n} // namespace TestCaseTracking\n\nusing TestCaseTracking::ITracker;\nusing TestCaseTracking::TrackerContext;\nusing TestCaseTracking::SectionTracker;\n\n} // namespace Catch\n\n// end catch_test_case_tracker.h\n\n// start catch_leak_detector.h\n\nnamespace Catch {\n\n    struct LeakDetector {\n        LeakDetector();\n        ~LeakDetector();\n    };\n\n}\n// end catch_leak_detector.h\n// Cpp files will be included in the single-header file here\n// start catch_stats.cpp\n\n// Statistical analysis tools\n\n#if defined(CATCH_CONFIG_ENABLE_BENCHMARKING)\n\n#include <cassert>\n#include <random>\n\n#if defined(CATCH_CONFIG_USE_ASYNC)\n#include <future>\n#endif\n\nnamespace {\n    double erf_inv(double x) {\n        // Code accompanying the article \"Approximating the erfinv function\" in GPU Computing Gems, Volume 2\n        double w, p;\n\n        w = -log((1.0 - x) * (1.0 + x));\n\n        if (w < 6.250000) {\n            w = w - 3.125000;\n            p = -3.6444120640178196996e-21;\n            p = -1.685059138182016589e-19 + p * w;\n            p = 1.2858480715256400167e-18 + p * w;\n            p = 1.115787767802518096e-17 + p * w;\n            p = -1.333171662854620906e-16 + p * w;\n            p = 2.0972767875968561637e-17 + p * w;\n            p = 6.6376381343583238325e-15 + p * w;\n            p = -4.0545662729752068639e-14 + p * w;\n            p = -8.1519341976054721522e-14 + p * w;\n            p = 2.6335093153082322977e-12 + p * w;\n            p = -1.2975133253453532498e-11 + p * w;\n            p = -5.4154120542946279317e-11 + p * w;\n            p = 1.051212273321532285e-09 + p * w;\n            p = -4.1126339803469836976e-09 + p * w;\n            p = -2.9070369957882005086e-08 + p * w;\n            p = 4.2347877827932403518e-07 + p * w;\n            p = -1.3654692000834678645e-06 + p * w;\n            p = -1.3882523362786468719e-05 + p * w;\n            p = 0.0001867342080340571352 + p * w;\n            p = -0.00074070253416626697512 + p * w;\n            p = -0.0060336708714301490533 + p * w;\n            p = 0.24015818242558961693 + p * w;\n            p = 1.6536545626831027356 + p * w;\n        } else if (w < 16.000000) {\n            w = sqrt(w) - 3.250000;\n            p = 2.2137376921775787049e-09;\n            p = 9.0756561938885390979e-08 + p * w;\n            p = -2.7517406297064545428e-07 + p * w;\n            p = 1.8239629214389227755e-08 + p * w;\n            p = 1.5027403968909827627e-06 + p * w;\n            p = -4.013867526981545969e-06 + p * w;\n            p = 2.9234449089955446044e-06 + p * w;\n            p = 1.2475304481671778723e-05 + p * w;\n            p = -4.7318229009055733981e-05 + p * w;\n            p = 6.8284851459573175448e-05 + p * w;\n            p = 2.4031110387097893999e-05 + p * w;\n            p = -0.0003550375203628474796 + p * w;\n            p = 0.00095328937973738049703 + p * w;\n            p = -0.0016882755560235047313 + p * w;\n            p = 0.0024914420961078508066 + p * w;\n            p = -0.0037512085075692412107 + p * w;\n            p = 0.005370914553590063617 + p * w;\n            p = 1.0052589676941592334 + p * w;\n            p = 3.0838856104922207635 + p * w;\n        } else {\n            w = sqrt(w) - 5.000000;\n            p = -2.7109920616438573243e-11;\n            p = -2.5556418169965252055e-10 + p * w;\n            p = 1.5076572693500548083e-09 + p * w;\n            p = -3.7894654401267369937e-09 + p * w;\n            p = 7.6157012080783393804e-09 + p * w;\n            p = -1.4960026627149240478e-08 + p * w;\n            p = 2.9147953450901080826e-08 + p * w;\n            p = -6.7711997758452339498e-08 + p * w;\n            p = 2.2900482228026654717e-07 + p * w;\n            p = -9.9298272942317002539e-07 + p * w;\n            p = 4.5260625972231537039e-06 + p * w;\n            p = -1.9681778105531670567e-05 + p * w;\n            p = 7.5995277030017761139e-05 + p * w;\n            p = -0.00021503011930044477347 + p * w;\n            p = -0.00013871931833623122026 + p * w;\n            p = 1.0103004648645343977 + p * w;\n            p = 4.8499064014085844221 + p * w;\n        }\n        return p * x;\n    }\n\n    double standard_deviation(std::vector<double>::iterator first, std::vector<double>::iterator last) {\n        auto m = Catch::Benchmark::Detail::mean(first, last);\n        double variance = std::accumulate(first, last, 0., [m](double a, double b) {\n            double diff = b - m;\n            return a + diff * diff;\n            }) / (last - first);\n            return std::sqrt(variance);\n    }\n\n}\n\nnamespace Catch {\n    namespace Benchmark {\n        namespace Detail {\n\n            double weighted_average_quantile(int k, int q, std::vector<double>::iterator first, std::vector<double>::iterator last) {\n                auto count = last - first;\n                double idx = (count - 1) * k / static_cast<double>(q);\n                int j = static_cast<int>(idx);\n                double g = idx - j;\n                std::nth_element(first, first + j, last);\n                auto xj = first[j];\n                if (g == 0) return xj;\n\n                auto xj1 = *std::min_element(first + (j + 1), last);\n                return xj + g * (xj1 - xj);\n            }\n\n            double erfc_inv(double x) {\n                return erf_inv(1.0 - x);\n            }\n\n            double normal_quantile(double p) {\n                static const double ROOT_TWO = std::sqrt(2.0);\n\n                double result = 0.0;\n                assert(p >= 0 && p <= 1);\n                if (p < 0 || p > 1) {\n                    return result;\n                }\n\n                result = -erfc_inv(2.0 * p);\n                // result *= normal distribution standard deviation (1.0) * sqrt(2)\n                result *= /*sd * */ ROOT_TWO;\n                // result += normal disttribution mean (0)\n                return result;\n            }\n\n            double outlier_variance(Estimate<double> mean, Estimate<double> stddev, int n) {\n                double sb = stddev.point;\n                double mn = mean.point / n;\n                double mg_min = mn / 2.;\n                double sg = (std::min)(mg_min / 4., sb / std::sqrt(n));\n                double sg2 = sg * sg;\n                double sb2 = sb * sb;\n\n                auto c_max = [n, mn, sb2, sg2](double x) -> double {\n                    double k = mn - x;\n                    double d = k * k;\n                    double nd = n * d;\n                    double k0 = -n * nd;\n                    double k1 = sb2 - n * sg2 + nd;\n                    double det = k1 * k1 - 4 * sg2 * k0;\n                    return (int)(-2. * k0 / (k1 + std::sqrt(det)));\n                };\n\n                auto var_out = [n, sb2, sg2](double c) {\n                    double nc = n - c;\n                    return (nc / n) * (sb2 - nc * sg2);\n                };\n\n                return (std::min)(var_out(1), var_out((std::min)(c_max(0.), c_max(mg_min)))) / sb2;\n            }\n\n            bootstrap_analysis analyse_samples(double confidence_level, int n_resamples, std::vector<double>::iterator first, std::vector<double>::iterator last) {\n                CATCH_INTERNAL_START_WARNINGS_SUPPRESSION\n                CATCH_INTERNAL_SUPPRESS_GLOBALS_WARNINGS\n                static std::random_device entropy;\n                CATCH_INTERNAL_STOP_WARNINGS_SUPPRESSION\n\n                auto n = static_cast<int>(last - first); // seriously, one can't use integral types without hell in C++\n\n                auto mean = &Detail::mean<std::vector<double>::iterator>;\n                auto stddev = &standard_deviation;\n\n#if defined(CATCH_CONFIG_USE_ASYNC)\n                auto Estimate = [=](double(*f)(std::vector<double>::iterator, std::vector<double>::iterator)) {\n                    auto seed = entropy();\n                    return std::async(std::launch::async, [=] {\n                        std::mt19937 rng(seed);\n                        auto resampled = resample(rng, n_resamples, first, last, f);\n                        return bootstrap(confidence_level, first, last, resampled, f);\n                    });\n                };\n\n                auto mean_future = Estimate(mean);\n                auto stddev_future = Estimate(stddev);\n\n                auto mean_estimate = mean_future.get();\n                auto stddev_estimate = stddev_future.get();\n#else\n                auto Estimate = [=](double(*f)(std::vector<double>::iterator, std::vector<double>::iterator)) {\n                    auto seed = entropy();\n                    std::mt19937 rng(seed);\n                    auto resampled = resample(rng, n_resamples, first, last, f);\n                    return bootstrap(confidence_level, first, last, resampled, f);\n                };\n\n                auto mean_estimate = Estimate(mean);\n                auto stddev_estimate = Estimate(stddev);\n#endif // CATCH_USE_ASYNC\n\n                double outlier_variance = Detail::outlier_variance(mean_estimate, stddev_estimate, n);\n\n                return { mean_estimate, stddev_estimate, outlier_variance };\n            }\n        } // namespace Detail\n    } // namespace Benchmark\n} // namespace Catch\n\n#endif // CATCH_CONFIG_ENABLE_BENCHMARKING\n// end catch_stats.cpp\n// start catch_approx.cpp\n\n#include <cmath>\n#include <limits>\n\nnamespace {\n\n// Performs equivalent check of std::fabs(lhs - rhs) <= margin\n// But without the subtraction to allow for INFINITY in comparison\nbool marginComparison(double lhs, double rhs, double margin) {\n    return (lhs + margin >= rhs) && (rhs + margin >= lhs);\n}\n\n}\n\nnamespace Catch {\nnamespace Detail {\n\n    Approx::Approx ( double value )\n    :   m_epsilon( std::numeric_limits<float>::epsilon()*100 ),\n        m_margin( 0.0 ),\n        m_scale( 0.0 ),\n        m_value( value )\n    {}\n\n    Approx Approx::custom() {\n        return Approx( 0 );\n    }\n\n    Approx Approx::operator-() const {\n        auto temp(*this);\n        temp.m_value = -temp.m_value;\n        return temp;\n    }\n\n    std::string Approx::toString() const {\n        ReusableStringStream rss;\n        rss << \"Approx( \" << ::Catch::Detail::stringify( m_value ) << \" )\";\n        return rss.str();\n    }\n\n    bool Approx::equalityComparisonImpl(const double other) const {\n        // First try with fixed margin, then compute margin based on epsilon, scale and Approx's value\n        // Thanks to Richard Harris for his help refining the scaled margin value\n        return marginComparison(m_value, other, m_margin)\n            || marginComparison(m_value, other, m_epsilon * (m_scale + std::fabs(std::isinf(m_value)? 0 : m_value)));\n    }\n\n    void Approx::setMargin(double newMargin) {\n        CATCH_ENFORCE(newMargin >= 0,\n            \"Invalid Approx::margin: \" << newMargin << '.'\n            << \" Approx::Margin has to be non-negative.\");\n        m_margin = newMargin;\n    }\n\n    void Approx::setEpsilon(double newEpsilon) {\n        CATCH_ENFORCE(newEpsilon >= 0 && newEpsilon <= 1.0,\n            \"Invalid Approx::epsilon: \" << newEpsilon << '.'\n            << \" Approx::epsilon has to be in [0, 1]\");\n        m_epsilon = newEpsilon;\n    }\n\n} // end namespace Detail\n\nnamespace literals {\n    Detail::Approx operator \"\" _a(long double val) {\n        return Detail::Approx(val);\n    }\n    Detail::Approx operator \"\" _a(unsigned long long val) {\n        return Detail::Approx(val);\n    }\n} // end namespace literals\n\nstd::string StringMaker<Catch::Detail::Approx>::convert(Catch::Detail::Approx const& value) {\n    return value.toString();\n}\n\n} // end namespace Catch\n// end catch_approx.cpp\n// start catch_assertionhandler.cpp\n\n// start catch_debugger.h\n\nnamespace Catch {\n    bool isDebuggerActive();\n}\n\n#ifdef CATCH_PLATFORM_MAC\n\n    #if defined(__i386__) || defined(__x86_64__)\n        #define CATCH_TRAP() __asm__(\"int $3\\n\" : : ) /* NOLINT */\n    #elif defined(__aarch64__)\n        #define CATCH_TRAP()  __asm__(\".inst 0xd43e0000\")\n    #endif\n\n#elif defined(CATCH_PLATFORM_IPHONE)\n\n    // use inline assembler\n    #if defined(__i386__) || defined(__x86_64__)\n        #define CATCH_TRAP()  __asm__(\"int $3\")\n    #elif defined(__aarch64__)\n        #define CATCH_TRAP()  __asm__(\".inst 0xd4200000\")\n    #elif defined(__arm__) && !defined(__thumb__)\n        #define CATCH_TRAP()  __asm__(\".inst 0xe7f001f0\")\n    #elif defined(__arm__) &&  defined(__thumb__)\n        #define CATCH_TRAP()  __asm__(\".inst 0xde01\")\n    #endif\n\n#elif defined(CATCH_PLATFORM_LINUX)\n    // If we can use inline assembler, do it because this allows us to break\n    // directly at the location of the failing check instead of breaking inside\n    // raise() called from it, i.e. one stack frame below.\n    #if defined(__GNUC__) && (defined(__i386) || defined(__x86_64))\n        #define CATCH_TRAP() asm volatile (\"int $3\") /* NOLINT */\n    #else // Fall back to the generic way.\n        #include <signal.h>\n\n        #define CATCH_TRAP() raise(SIGTRAP)\n    #endif\n#elif defined(_MSC_VER)\n    #define CATCH_TRAP() __debugbreak()\n#elif defined(__MINGW32__)\n    extern \"C\" __declspec(dllimport) void __stdcall DebugBreak();\n    #define CATCH_TRAP() DebugBreak()\n#endif\n\n#ifndef CATCH_BREAK_INTO_DEBUGGER\n    #ifdef CATCH_TRAP\n        #define CATCH_BREAK_INTO_DEBUGGER() []{ if( Catch::isDebuggerActive() ) { CATCH_TRAP(); } }()\n    #else\n        #define CATCH_BREAK_INTO_DEBUGGER() []{}()\n    #endif\n#endif\n\n// end catch_debugger.h\n// start catch_run_context.h\n\n// start catch_fatal_condition.h\n\n#include <cassert>\n\nnamespace Catch {\n\n    // Wrapper for platform-specific fatal error (signals/SEH) handlers\n    //\n    // Tries to be cooperative with other handlers, and not step over\n    // other handlers. This means that unknown structured exceptions\n    // are passed on, previous signal handlers are called, and so on.\n    //\n    // Can only be instantiated once, and assumes that once a signal\n    // is caught, the binary will end up terminating. Thus, there\n    class FatalConditionHandler {\n        bool m_started = false;\n\n        // Install/disengage implementation for specific platform.\n        // Should be if-defed to work on current platform, can assume\n        // engage-disengage 1:1 pairing.\n        void engage_platform();\n        void disengage_platform();\n    public:\n        // Should also have platform-specific implementations as needed\n        FatalConditionHandler();\n        ~FatalConditionHandler();\n\n        void engage() {\n            assert(!m_started && \"Handler cannot be installed twice.\");\n            m_started = true;\n            engage_platform();\n        }\n\n        void disengage() {\n            assert(m_started && \"Handler cannot be uninstalled without being installed first\");\n            m_started = false;\n            disengage_platform();\n        }\n    };\n\n    //! Simple RAII guard for (dis)engaging the FatalConditionHandler\n    class FatalConditionHandlerGuard {\n        FatalConditionHandler* m_handler;\n    public:\n        FatalConditionHandlerGuard(FatalConditionHandler* handler):\n            m_handler(handler) {\n            m_handler->engage();\n        }\n        ~FatalConditionHandlerGuard() {\n            m_handler->disengage();\n        }\n    };\n\n} // end namespace Catch\n\n// end catch_fatal_condition.h\n#include <string>\n\nnamespace Catch {\n\n    struct IMutableContext;\n\n    ///////////////////////////////////////////////////////////////////////////\n\n    class RunContext : public IResultCapture, public IRunner {\n\n    public:\n        RunContext( RunContext const& ) = delete;\n        RunContext& operator =( RunContext const& ) = delete;\n\n        explicit RunContext( IConfigPtr const& _config, IStreamingReporterPtr&& reporter );\n\n        ~RunContext() override;\n\n        void testGroupStarting( std::string const& testSpec, std::size_t groupIndex, std::size_t groupsCount );\n        void testGroupEnded( std::string const& testSpec, Totals const& totals, std::size_t groupIndex, std::size_t groupsCount );\n\n        Totals runTest(TestCase const& testCase);\n\n        IConfigPtr config() const;\n        IStreamingReporter& reporter() const;\n\n    public: // IResultCapture\n\n        // Assertion handlers\n        void handleExpr\n                (   AssertionInfo const& info,\n                    ITransientExpression const& expr,\n                    AssertionReaction& reaction ) override;\n        void handleMessage\n                (   AssertionInfo const& info,\n                    ResultWas::OfType resultType,\n                    StringRef const& message,\n                    AssertionReaction& reaction ) override;\n        void handleUnexpectedExceptionNotThrown\n                (   AssertionInfo const& info,\n                    AssertionReaction& reaction ) override;\n        void handleUnexpectedInflightException\n                (   AssertionInfo const& info,\n                    std::string const& message,\n                    AssertionReaction& reaction ) override;\n        void handleIncomplete\n                (   AssertionInfo const& info ) override;\n        void handleNonExpr\n                (   AssertionInfo const &info,\n                    ResultWas::OfType resultType,\n                    AssertionReaction &reaction ) override;\n\n        bool sectionStarted( SectionInfo const& sectionInfo, Counts& assertions ) override;\n\n        void sectionEnded( SectionEndInfo const& endInfo ) override;\n        void sectionEndedEarly( SectionEndInfo const& endInfo ) override;\n\n        auto acquireGeneratorTracker( StringRef generatorName, SourceLineInfo const& lineInfo ) -> IGeneratorTracker& override;\n\n#if defined(CATCH_CONFIG_ENABLE_BENCHMARKING)\n        void benchmarkPreparing( std::string const& name ) override;\n        void benchmarkStarting( BenchmarkInfo const& info ) override;\n        void benchmarkEnded( BenchmarkStats<> const& stats ) override;\n        void benchmarkFailed( std::string const& error ) override;\n#endif // CATCH_CONFIG_ENABLE_BENCHMARKING\n\n        void pushScopedMessage( MessageInfo const& message ) override;\n        void popScopedMessage( MessageInfo const& message ) override;\n\n        void emplaceUnscopedMessage( MessageBuilder const& builder ) override;\n\n        std::string getCurrentTestName() const override;\n\n        const AssertionResult* getLastResult() const override;\n\n        void exceptionEarlyReported() override;\n\n        void handleFatalErrorCondition( StringRef message ) override;\n\n        bool lastAssertionPassed() override;\n\n        void assertionPassed() override;\n\n    public:\n        // !TBD We need to do this another way!\n        bool aborting() const final;\n\n    private:\n\n        void runCurrentTest( std::string& redirectedCout, std::string& redirectedCerr );\n        void invokeActiveTestCase();\n\n        void resetAssertionInfo();\n        bool testForMissingAssertions( Counts& assertions );\n\n        void assertionEnded( AssertionResult const& result );\n        void reportExpr\n                (   AssertionInfo const &info,\n                    ResultWas::OfType resultType,\n                    ITransientExpression const *expr,\n                    bool negated );\n\n        void populateReaction( AssertionReaction& reaction );\n\n    private:\n\n        void handleUnfinishedSections();\n\n        TestRunInfo m_runInfo;\n        IMutableContext& m_context;\n        TestCase const* m_activeTestCase = nullptr;\n        ITracker* m_testCaseTracker = nullptr;\n        Option<AssertionResult> m_lastResult;\n\n        IConfigPtr m_config;\n        Totals m_totals;\n        IStreamingReporterPtr m_reporter;\n        std::vector<MessageInfo> m_messages;\n        std::vector<ScopedMessage> m_messageScopes; /* Keeps owners of so-called unscoped messages. */\n        AssertionInfo m_lastAssertionInfo;\n        std::vector<SectionEndInfo> m_unfinishedSections;\n        std::vector<ITracker*> m_activeSections;\n        TrackerContext m_trackerContext;\n        FatalConditionHandler m_fatalConditionhandler;\n        bool m_lastAssertionPassed = false;\n        bool m_shouldReportUnexpected = true;\n        bool m_includeSuccessfulResults;\n    };\n\n    void seedRng(IConfig const& config);\n    unsigned int rngSeed();\n} // end namespace Catch\n\n// end catch_run_context.h\nnamespace Catch {\n\n    namespace {\n        auto operator <<( std::ostream& os, ITransientExpression const& expr ) -> std::ostream& {\n            expr.streamReconstructedExpression( os );\n            return os;\n        }\n    }\n\n    LazyExpression::LazyExpression( bool isNegated )\n    :   m_isNegated( isNegated )\n    {}\n\n    LazyExpression::LazyExpression( LazyExpression const& other ) : m_isNegated( other.m_isNegated ) {}\n\n    LazyExpression::operator bool() const {\n        return m_transientExpression != nullptr;\n    }\n\n    auto operator << ( std::ostream& os, LazyExpression const& lazyExpr ) -> std::ostream& {\n        if( lazyExpr.m_isNegated )\n            os << \"!\";\n\n        if( lazyExpr ) {\n            if( lazyExpr.m_isNegated && lazyExpr.m_transientExpression->isBinaryExpression() )\n                os << \"(\" << *lazyExpr.m_transientExpression << \")\";\n            else\n                os << *lazyExpr.m_transientExpression;\n        }\n        else {\n            os << \"{** error - unchecked empty expression requested **}\";\n        }\n        return os;\n    }\n\n    AssertionHandler::AssertionHandler\n        (   StringRef const& macroName,\n            SourceLineInfo const& lineInfo,\n            StringRef capturedExpression,\n            ResultDisposition::Flags resultDisposition )\n    :   m_assertionInfo{ macroName, lineInfo, capturedExpression, resultDisposition },\n        m_resultCapture( getResultCapture() )\n    {}\n\n    void AssertionHandler::handleExpr( ITransientExpression const& expr ) {\n        m_resultCapture.handleExpr( m_assertionInfo, expr, m_reaction );\n    }\n    void AssertionHandler::handleMessage(ResultWas::OfType resultType, StringRef const& message) {\n        m_resultCapture.handleMessage( m_assertionInfo, resultType, message, m_reaction );\n    }\n\n    auto AssertionHandler::allowThrows() const -> bool {\n        return getCurrentContext().getConfig()->allowThrows();\n    }\n\n    void AssertionHandler::complete() {\n        setCompleted();\n        if( m_reaction.shouldDebugBreak ) {\n\n            // If you find your debugger stopping you here then go one level up on the\n            // call-stack for the code that caused it (typically a failed assertion)\n\n            // (To go back to the test and change execution, jump over the throw, next)\n            CATCH_BREAK_INTO_DEBUGGER();\n        }\n        if (m_reaction.shouldThrow) {\n#if !defined(CATCH_CONFIG_DISABLE_EXCEPTIONS)\n            throw Catch::TestFailureException();\n#else\n            CATCH_ERROR( \"Test failure requires aborting test!\" );\n#endif\n        }\n    }\n    void AssertionHandler::setCompleted() {\n        m_completed = true;\n    }\n\n    void AssertionHandler::handleUnexpectedInflightException() {\n        m_resultCapture.handleUnexpectedInflightException( m_assertionInfo, Catch::translateActiveException(), m_reaction );\n    }\n\n    void AssertionHandler::handleExceptionThrownAsExpected() {\n        m_resultCapture.handleNonExpr(m_assertionInfo, ResultWas::Ok, m_reaction);\n    }\n    void AssertionHandler::handleExceptionNotThrownAsExpected() {\n        m_resultCapture.handleNonExpr(m_assertionInfo, ResultWas::Ok, m_reaction);\n    }\n\n    void AssertionHandler::handleUnexpectedExceptionNotThrown() {\n        m_resultCapture.handleUnexpectedExceptionNotThrown( m_assertionInfo, m_reaction );\n    }\n\n    void AssertionHandler::handleThrowingCallSkipped() {\n        m_resultCapture.handleNonExpr(m_assertionInfo, ResultWas::Ok, m_reaction);\n    }\n\n    // This is the overload that takes a string and infers the Equals matcher from it\n    // The more general overload, that takes any string matcher, is in catch_capture_matchers.cpp\n    void handleExceptionMatchExpr( AssertionHandler& handler, std::string const& str, StringRef const& matcherString  ) {\n        handleExceptionMatchExpr( handler, Matchers::Equals( str ), matcherString );\n    }\n\n} // namespace Catch\n// end catch_assertionhandler.cpp\n// start catch_assertionresult.cpp\n\nnamespace Catch {\n    AssertionResultData::AssertionResultData(ResultWas::OfType _resultType, LazyExpression const & _lazyExpression):\n        lazyExpression(_lazyExpression),\n        resultType(_resultType) {}\n\n    std::string AssertionResultData::reconstructExpression() const {\n\n        if( reconstructedExpression.empty() ) {\n            if( lazyExpression ) {\n                ReusableStringStream rss;\n                rss << lazyExpression;\n                reconstructedExpression = rss.str();\n            }\n        }\n        return reconstructedExpression;\n    }\n\n    AssertionResult::AssertionResult( AssertionInfo const& info, AssertionResultData const& data )\n    :   m_info( info ),\n        m_resultData( data )\n    {}\n\n    // Result was a success\n    bool AssertionResult::succeeded() const {\n        return Catch::isOk( m_resultData.resultType );\n    }\n\n    // Result was a success, or failure is suppressed\n    bool AssertionResult::isOk() const {\n        return Catch::isOk( m_resultData.resultType ) || shouldSuppressFailure( m_info.resultDisposition );\n    }\n\n    ResultWas::OfType AssertionResult::getResultType() const {\n        return m_resultData.resultType;\n    }\n\n    bool AssertionResult::hasExpression() const {\n        return !m_info.capturedExpression.empty();\n    }\n\n    bool AssertionResult::hasMessage() const {\n        return !m_resultData.message.empty();\n    }\n\n    std::string AssertionResult::getExpression() const {\n        // Possibly overallocating by 3 characters should be basically free\n        std::string expr; expr.reserve(m_info.capturedExpression.size() + 3);\n        if (isFalseTest(m_info.resultDisposition)) {\n            expr += \"!(\";\n        }\n        expr += m_info.capturedExpression;\n        if (isFalseTest(m_info.resultDisposition)) {\n            expr += ')';\n        }\n        return expr;\n    }\n\n    std::string AssertionResult::getExpressionInMacro() const {\n        std::string expr;\n        if( m_info.macroName.empty() )\n            expr = static_cast<std::string>(m_info.capturedExpression);\n        else {\n            expr.reserve( m_info.macroName.size() + m_info.capturedExpression.size() + 4 );\n            expr += m_info.macroName;\n            expr += \"( \";\n            expr += m_info.capturedExpression;\n            expr += \" )\";\n        }\n        return expr;\n    }\n\n    bool AssertionResult::hasExpandedExpression() const {\n        return hasExpression() && getExpandedExpression() != getExpression();\n    }\n\n    std::string AssertionResult::getExpandedExpression() const {\n        std::string expr = m_resultData.reconstructExpression();\n        return expr.empty()\n                ? getExpression()\n                : expr;\n    }\n\n    std::string AssertionResult::getMessage() const {\n        return m_resultData.message;\n    }\n    SourceLineInfo AssertionResult::getSourceInfo() const {\n        return m_info.lineInfo;\n    }\n\n    StringRef AssertionResult::getTestMacroName() const {\n        return m_info.macroName;\n    }\n\n} // end namespace Catch\n// end catch_assertionresult.cpp\n// start catch_capture_matchers.cpp\n\nnamespace Catch {\n\n    using StringMatcher = Matchers::Impl::MatcherBase<std::string>;\n\n    // This is the general overload that takes a any string matcher\n    // There is another overload, in catch_assertionhandler.h/.cpp, that only takes a string and infers\n    // the Equals matcher (so the header does not mention matchers)\n    void handleExceptionMatchExpr( AssertionHandler& handler, StringMatcher const& matcher, StringRef const& matcherString  ) {\n        std::string exceptionMessage = Catch::translateActiveException();\n        MatchExpr<std::string, StringMatcher const&> expr( exceptionMessage, matcher, matcherString );\n        handler.handleExpr( expr );\n    }\n\n} // namespace Catch\n// end catch_capture_matchers.cpp\n// start catch_commandline.cpp\n\n// start catch_commandline.h\n\n// start catch_clara.h\n\n// Use Catch's value for console width (store Clara's off to the side, if present)\n#ifdef CLARA_CONFIG_CONSOLE_WIDTH\n#define CATCH_TEMP_CLARA_CONFIG_CONSOLE_WIDTH CATCH_CLARA_TEXTFLOW_CONFIG_CONSOLE_WIDTH\n#undef CATCH_CLARA_TEXTFLOW_CONFIG_CONSOLE_WIDTH\n#endif\n#define CATCH_CLARA_TEXTFLOW_CONFIG_CONSOLE_WIDTH CATCH_CONFIG_CONSOLE_WIDTH-1\n\n#ifdef __clang__\n#pragma clang diagnostic push\n#pragma clang diagnostic ignored \"-Wweak-vtables\"\n#pragma clang diagnostic ignored \"-Wexit-time-destructors\"\n#pragma clang diagnostic ignored \"-Wshadow\"\n#endif\n\n// start clara.hpp\n// Copyright 2017 Two Blue Cubes Ltd. All rights reserved.\n//\n// Distributed under the Boost Software License, Version 1.0. (See accompanying\n// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)\n//\n// See https://github.com/philsquared/Clara for more details\n\n// Clara v1.1.5\n\n\n#ifndef CATCH_CLARA_CONFIG_CONSOLE_WIDTH\n#define CATCH_CLARA_CONFIG_CONSOLE_WIDTH 80\n#endif\n\n#ifndef CATCH_CLARA_TEXTFLOW_CONFIG_CONSOLE_WIDTH\n#define CATCH_CLARA_TEXTFLOW_CONFIG_CONSOLE_WIDTH CATCH_CLARA_CONFIG_CONSOLE_WIDTH\n#endif\n\n#ifndef CLARA_CONFIG_OPTIONAL_TYPE\n#ifdef __has_include\n#if __has_include(<optional>) && __cplusplus >= 201703L\n#include <optional>\n#define CLARA_CONFIG_OPTIONAL_TYPE std::optional\n#endif\n#endif\n#endif\n\n// ----------- #included from clara_textflow.hpp -----------\n\n// TextFlowCpp\n//\n// A single-header library for wrapping and laying out basic text, by Phil Nash\n//\n// Distributed under the Boost Software License, Version 1.0. (See accompanying\n// file LICENSE.txt or copy at http://www.boost.org/LICENSE_1_0.txt)\n//\n// This project is hosted at https://github.com/philsquared/textflowcpp\n\n\n#include <cassert>\n#include <ostream>\n#include <sstream>\n#include <vector>\n\n#ifndef CATCH_CLARA_TEXTFLOW_CONFIG_CONSOLE_WIDTH\n#define CATCH_CLARA_TEXTFLOW_CONFIG_CONSOLE_WIDTH 80\n#endif\n\nnamespace Catch {\nnamespace clara {\nnamespace TextFlow {\n\ninline auto isWhitespace(char c) -> bool {\n\tstatic std::string chars = \" \\t\\n\\r\";\n\treturn chars.find(c) != std::string::npos;\n}\ninline auto isBreakableBefore(char c) -> bool {\n\tstatic std::string chars = \"[({<|\";\n\treturn chars.find(c) != std::string::npos;\n}\ninline auto isBreakableAfter(char c) -> bool {\n\tstatic std::string chars = \"])}>.,:;*+-=&/\\\\\";\n\treturn chars.find(c) != std::string::npos;\n}\n\nclass Columns;\n\nclass Column {\n\tstd::vector<std::string> m_strings;\n\tsize_t m_width = CATCH_CLARA_TEXTFLOW_CONFIG_CONSOLE_WIDTH;\n\tsize_t m_indent = 0;\n\tsize_t m_initialIndent = std::string::npos;\n\npublic:\n\tclass iterator {\n\t\tfriend Column;\n\n\t\tColumn const& m_column;\n\t\tsize_t m_stringIndex = 0;\n\t\tsize_t m_pos = 0;\n\n\t\tsize_t m_len = 0;\n\t\tsize_t m_end = 0;\n\t\tbool m_suffix = false;\n\n\t\titerator(Column const& column, size_t stringIndex)\n\t\t\t: m_column(column),\n\t\t\tm_stringIndex(stringIndex) {}\n\n\t\tauto line() const -> std::string const& { return m_column.m_strings[m_stringIndex]; }\n\n\t\tauto isBoundary(size_t at) const -> bool {\n\t\t\tassert(at > 0);\n\t\t\tassert(at <= line().size());\n\n\t\t\treturn at == line().size() ||\n\t\t\t\t(isWhitespace(line()[at]) && !isWhitespace(line()[at - 1])) ||\n\t\t\t\tisBreakableBefore(line()[at]) ||\n\t\t\t\tisBreakableAfter(line()[at - 1]);\n\t\t}\n\n\t\tvoid calcLength() {\n\t\t\tassert(m_stringIndex < m_column.m_strings.size());\n\n\t\t\tm_suffix = false;\n\t\t\tauto width = m_column.m_width - indent();\n\t\t\tm_end = m_pos;\n\t\t\tif (line()[m_pos] == '\\n') {\n\t\t\t\t++m_end;\n\t\t\t}\n\t\t\twhile (m_end < line().size() && line()[m_end] != '\\n')\n\t\t\t\t++m_end;\n\n\t\t\tif (m_end < m_pos + width) {\n\t\t\t\tm_len = m_end - m_pos;\n\t\t\t} else {\n\t\t\t\tsize_t len = width;\n\t\t\t\twhile (len > 0 && !isBoundary(m_pos + len))\n\t\t\t\t\t--len;\n\t\t\t\twhile (len > 0 && isWhitespace(line()[m_pos + len - 1]))\n\t\t\t\t\t--len;\n\n\t\t\t\tif (len > 0) {\n\t\t\t\t\tm_len = len;\n\t\t\t\t} else {\n\t\t\t\t\tm_suffix = true;\n\t\t\t\t\tm_len = width - 1;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tauto indent() const -> size_t {\n\t\t\tauto initial = m_pos == 0 && m_stringIndex == 0 ? m_column.m_initialIndent : std::string::npos;\n\t\t\treturn initial == std::string::npos ? m_column.m_indent : initial;\n\t\t}\n\n\t\tauto addIndentAndSuffix(std::string const &plain) const -> std::string {\n\t\t\treturn std::string(indent(), ' ') + (m_suffix ? plain + \"-\" : plain);\n\t\t}\n\n\tpublic:\n\t\tusing difference_type = std::ptrdiff_t;\n\t\tusing value_type = std::string;\n\t\tusing pointer = value_type * ;\n\t\tusing reference = value_type & ;\n\t\tusing iterator_category = std::forward_iterator_tag;\n\n\t\texplicit iterator(Column const& column) : m_column(column) {\n\t\t\tassert(m_column.m_width > m_column.m_indent);\n\t\t\tassert(m_column.m_initialIndent == std::string::npos || m_column.m_width > m_column.m_initialIndent);\n\t\t\tcalcLength();\n\t\t\tif (m_len == 0)\n\t\t\t\tm_stringIndex++; // Empty string\n\t\t}\n\n\t\tauto operator *() const -> std::string {\n\t\t\tassert(m_stringIndex < m_column.m_strings.size());\n\t\t\tassert(m_pos <= m_end);\n\t\t\treturn addIndentAndSuffix(line().substr(m_pos, m_len));\n\t\t}\n\n\t\tauto operator ++() -> iterator& {\n\t\t\tm_pos += m_len;\n\t\t\tif (m_pos < line().size() && line()[m_pos] == '\\n')\n\t\t\t\tm_pos += 1;\n\t\t\telse\n\t\t\t\twhile (m_pos < line().size() && isWhitespace(line()[m_pos]))\n\t\t\t\t\t++m_pos;\n\n\t\t\tif (m_pos == line().size()) {\n\t\t\t\tm_pos = 0;\n\t\t\t\t++m_stringIndex;\n\t\t\t}\n\t\t\tif (m_stringIndex < m_column.m_strings.size())\n\t\t\t\tcalcLength();\n\t\t\treturn *this;\n\t\t}\n\t\tauto operator ++(int) -> iterator {\n\t\t\titerator prev(*this);\n\t\t\toperator++();\n\t\t\treturn prev;\n\t\t}\n\n\t\tauto operator ==(iterator const& other) const -> bool {\n\t\t\treturn\n\t\t\t\tm_pos == other.m_pos &&\n\t\t\t\tm_stringIndex == other.m_stringIndex &&\n\t\t\t\t&m_column == &other.m_column;\n\t\t}\n\t\tauto operator !=(iterator const& other) const -> bool {\n\t\t\treturn !operator==(other);\n\t\t}\n\t};\n\tusing const_iterator = iterator;\n\n\texplicit Column(std::string const& text) { m_strings.push_back(text); }\n\n\tauto width(size_t newWidth) -> Column& {\n\t\tassert(newWidth > 0);\n\t\tm_width = newWidth;\n\t\treturn *this;\n\t}\n\tauto indent(size_t newIndent) -> Column& {\n\t\tm_indent = newIndent;\n\t\treturn *this;\n\t}\n\tauto initialIndent(size_t newIndent) -> Column& {\n\t\tm_initialIndent = newIndent;\n\t\treturn *this;\n\t}\n\n\tauto width() const -> size_t { return m_width; }\n\tauto begin() const -> iterator { return iterator(*this); }\n\tauto end() const -> iterator { return { *this, m_strings.size() }; }\n\n\tinline friend std::ostream& operator << (std::ostream& os, Column const& col) {\n\t\tbool first = true;\n\t\tfor (auto line : col) {\n\t\t\tif (first)\n\t\t\t\tfirst = false;\n\t\t\telse\n\t\t\t\tos << \"\\n\";\n\t\t\tos << line;\n\t\t}\n\t\treturn os;\n\t}\n\n\tauto operator + (Column const& other)->Columns;\n\n\tauto toString() const -> std::string {\n\t\tstd::ostringstream oss;\n\t\toss << *this;\n\t\treturn oss.str();\n\t}\n};\n\nclass Spacer : public Column {\n\npublic:\n\texplicit Spacer(size_t spaceWidth) : Column(\"\") {\n\t\twidth(spaceWidth);\n\t}\n};\n\nclass Columns {\n\tstd::vector<Column> m_columns;\n\npublic:\n\n\tclass iterator {\n\t\tfriend Columns;\n\t\tstruct EndTag {};\n\n\t\tstd::vector<Column> const& m_columns;\n\t\tstd::vector<Column::iterator> m_iterators;\n\t\tsize_t m_activeIterators;\n\n\t\titerator(Columns const& columns, EndTag)\n\t\t\t: m_columns(columns.m_columns),\n\t\t\tm_activeIterators(0) {\n\t\t\tm_iterators.reserve(m_columns.size());\n\n\t\t\tfor (auto const& col : m_columns)\n\t\t\t\tm_iterators.push_back(col.end());\n\t\t}\n\n\tpublic:\n\t\tusing difference_type = std::ptrdiff_t;\n\t\tusing value_type = std::string;\n\t\tusing pointer = value_type * ;\n\t\tusing reference = value_type & ;\n\t\tusing iterator_category = std::forward_iterator_tag;\n\n\t\texplicit iterator(Columns const& columns)\n\t\t\t: m_columns(columns.m_columns),\n\t\t\tm_activeIterators(m_columns.size()) {\n\t\t\tm_iterators.reserve(m_columns.size());\n\n\t\t\tfor (auto const& col : m_columns)\n\t\t\t\tm_iterators.push_back(col.begin());\n\t\t}\n\n\t\tauto operator ==(iterator const& other) const -> bool {\n\t\t\treturn m_iterators == other.m_iterators;\n\t\t}\n\t\tauto operator !=(iterator const& other) const -> bool {\n\t\t\treturn m_iterators != other.m_iterators;\n\t\t}\n\t\tauto operator *() const -> std::string {\n\t\t\tstd::string row, padding;\n\n\t\t\tfor (size_t i = 0; i < m_columns.size(); ++i) {\n\t\t\t\tauto width = m_columns[i].width();\n\t\t\t\tif (m_iterators[i] != m_columns[i].end()) {\n\t\t\t\t\tstd::string col = *m_iterators[i];\n\t\t\t\t\trow += padding + col;\n\t\t\t\t\tif (col.size() < width)\n\t\t\t\t\t\tpadding = std::string(width - col.size(), ' ');\n\t\t\t\t\telse\n\t\t\t\t\t\tpadding = \"\";\n\t\t\t\t} else {\n\t\t\t\t\tpadding += std::string(width, ' ');\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn row;\n\t\t}\n\t\tauto operator ++() -> iterator& {\n\t\t\tfor (size_t i = 0; i < m_columns.size(); ++i) {\n\t\t\t\tif (m_iterators[i] != m_columns[i].end())\n\t\t\t\t\t++m_iterators[i];\n\t\t\t}\n\t\t\treturn *this;\n\t\t}\n\t\tauto operator ++(int) -> iterator {\n\t\t\titerator prev(*this);\n\t\t\toperator++();\n\t\t\treturn prev;\n\t\t}\n\t};\n\tusing const_iterator = iterator;\n\n\tauto begin() const -> iterator { return iterator(*this); }\n\tauto end() const -> iterator { return { *this, iterator::EndTag() }; }\n\n\tauto operator += (Column const& col) -> Columns& {\n\t\tm_columns.push_back(col);\n\t\treturn *this;\n\t}\n\tauto operator + (Column const& col) -> Columns {\n\t\tColumns combined = *this;\n\t\tcombined += col;\n\t\treturn combined;\n\t}\n\n\tinline friend std::ostream& operator << (std::ostream& os, Columns const& cols) {\n\n\t\tbool first = true;\n\t\tfor (auto line : cols) {\n\t\t\tif (first)\n\t\t\t\tfirst = false;\n\t\t\telse\n\t\t\t\tos << \"\\n\";\n\t\t\tos << line;\n\t\t}\n\t\treturn os;\n\t}\n\n\tauto toString() const -> std::string {\n\t\tstd::ostringstream oss;\n\t\toss << *this;\n\t\treturn oss.str();\n\t}\n};\n\ninline auto Column::operator + (Column const& other) -> Columns {\n\tColumns cols;\n\tcols += *this;\n\tcols += other;\n\treturn cols;\n}\n}\n\n}\n}\n\n// ----------- end of #include from clara_textflow.hpp -----------\n// ........... back in clara.hpp\n\n#include <cctype>\n#include <string>\n#include <memory>\n#include <set>\n#include <algorithm>\n\n#if !defined(CATCH_PLATFORM_WINDOWS) && ( defined(WIN32) || defined(__WIN32__) || defined(_WIN32) || defined(_MSC_VER) )\n#define CATCH_PLATFORM_WINDOWS\n#endif\n\nnamespace Catch { namespace clara {\nnamespace detail {\n\n    // Traits for extracting arg and return type of lambdas (for single argument lambdas)\n    template<typename L>\n    struct UnaryLambdaTraits : UnaryLambdaTraits<decltype( &L::operator() )> {};\n\n    template<typename ClassT, typename ReturnT, typename... Args>\n    struct UnaryLambdaTraits<ReturnT( ClassT::* )( Args... ) const> {\n        static const bool isValid = false;\n    };\n\n    template<typename ClassT, typename ReturnT, typename ArgT>\n    struct UnaryLambdaTraits<ReturnT( ClassT::* )( ArgT ) const> {\n        static const bool isValid = true;\n        using ArgType = typename std::remove_const<typename std::remove_reference<ArgT>::type>::type;\n        using ReturnType = ReturnT;\n    };\n\n    class TokenStream;\n\n    // Transport for raw args (copied from main args, or supplied via init list for testing)\n    class Args {\n        friend TokenStream;\n        std::string m_exeName;\n        std::vector<std::string> m_args;\n\n    public:\n        Args( int argc, char const* const* argv )\n            : m_exeName(argv[0]),\n              m_args(argv + 1, argv + argc) {}\n\n        Args( std::initializer_list<std::string> args )\n        :   m_exeName( *args.begin() ),\n            m_args( args.begin()+1, args.end() )\n        {}\n\n        auto exeName() const -> std::string {\n            return m_exeName;\n        }\n    };\n\n    // Wraps a token coming from a token stream. These may not directly correspond to strings as a single string\n    // may encode an option + its argument if the : or = form is used\n    enum class TokenType {\n        Option, Argument\n    };\n    struct Token {\n        TokenType type;\n        std::string token;\n    };\n\n    inline auto isOptPrefix( char c ) -> bool {\n        return c == '-'\n#ifdef CATCH_PLATFORM_WINDOWS\n            || c == '/'\n#endif\n        ;\n    }\n\n    // Abstracts iterators into args as a stream of tokens, with option arguments uniformly handled\n    class TokenStream {\n        using Iterator = std::vector<std::string>::const_iterator;\n        Iterator it;\n        Iterator itEnd;\n        std::vector<Token> m_tokenBuffer;\n\n        void loadBuffer() {\n            m_tokenBuffer.resize( 0 );\n\n            // Skip any empty strings\n            while( it != itEnd && it->empty() )\n                ++it;\n\n            if( it != itEnd ) {\n                auto const &next = *it;\n                if( isOptPrefix( next[0] ) ) {\n                    auto delimiterPos = next.find_first_of( \" :=\" );\n                    if( delimiterPos != std::string::npos ) {\n                        m_tokenBuffer.push_back( { TokenType::Option, next.substr( 0, delimiterPos ) } );\n                        m_tokenBuffer.push_back( { TokenType::Argument, next.substr( delimiterPos + 1 ) } );\n                    } else {\n                        if( next[1] != '-' && next.size() > 2 ) {\n                            std::string opt = \"- \";\n                            for( size_t i = 1; i < next.size(); ++i ) {\n                                opt[1] = next[i];\n                                m_tokenBuffer.push_back( { TokenType::Option, opt } );\n                            }\n                        } else {\n                            m_tokenBuffer.push_back( { TokenType::Option, next } );\n                        }\n                    }\n                } else {\n                    m_tokenBuffer.push_back( { TokenType::Argument, next } );\n                }\n            }\n        }\n\n    public:\n        explicit TokenStream( Args const &args ) : TokenStream( args.m_args.begin(), args.m_args.end() ) {}\n\n        TokenStream( Iterator it, Iterator itEnd ) : it( it ), itEnd( itEnd ) {\n            loadBuffer();\n        }\n\n        explicit operator bool() const {\n            return !m_tokenBuffer.empty() || it != itEnd;\n        }\n\n        auto count() const -> size_t { return m_tokenBuffer.size() + (itEnd - it); }\n\n        auto operator*() const -> Token {\n            assert( !m_tokenBuffer.empty() );\n            return m_tokenBuffer.front();\n        }\n\n        auto operator->() const -> Token const * {\n            assert( !m_tokenBuffer.empty() );\n            return &m_tokenBuffer.front();\n        }\n\n        auto operator++() -> TokenStream & {\n            if( m_tokenBuffer.size() >= 2 ) {\n                m_tokenBuffer.erase( m_tokenBuffer.begin() );\n            } else {\n                if( it != itEnd )\n                    ++it;\n                loadBuffer();\n            }\n            return *this;\n        }\n    };\n\n    class ResultBase {\n    public:\n        enum Type {\n            Ok, LogicError, RuntimeError\n        };\n\n    protected:\n        ResultBase( Type type ) : m_type( type ) {}\n        virtual ~ResultBase() = default;\n\n        virtual void enforceOk() const = 0;\n\n        Type m_type;\n    };\n\n    template<typename T>\n    class ResultValueBase : public ResultBase {\n    public:\n        auto value() const -> T const & {\n            enforceOk();\n            return m_value;\n        }\n\n    protected:\n        ResultValueBase( Type type ) : ResultBase( type ) {}\n\n        ResultValueBase( ResultValueBase const &other ) : ResultBase( other ) {\n            if( m_type == ResultBase::Ok )\n                new( &m_value ) T( other.m_value );\n        }\n\n        ResultValueBase( Type, T const &value ) : ResultBase( Ok ) {\n            new( &m_value ) T( value );\n        }\n\n        auto operator=( ResultValueBase const &other ) -> ResultValueBase & {\n            if( m_type == ResultBase::Ok )\n                m_value.~T();\n            ResultBase::operator=(other);\n            if( m_type == ResultBase::Ok )\n                new( &m_value ) T( other.m_value );\n            return *this;\n        }\n\n        ~ResultValueBase() override {\n            if( m_type == Ok )\n                m_value.~T();\n        }\n\n        union {\n            T m_value;\n        };\n    };\n\n    template<>\n    class ResultValueBase<void> : public ResultBase {\n    protected:\n        using ResultBase::ResultBase;\n    };\n\n    template<typename T = void>\n    class BasicResult : public ResultValueBase<T> {\n    public:\n        template<typename U>\n        explicit BasicResult( BasicResult<U> const &other )\n        :   ResultValueBase<T>( other.type() ),\n            m_errorMessage( other.errorMessage() )\n        {\n            assert( type() != ResultBase::Ok );\n        }\n\n        template<typename U>\n        static auto ok( U const &value ) -> BasicResult { return { ResultBase::Ok, value }; }\n        static auto ok() -> BasicResult { return { ResultBase::Ok }; }\n        static auto logicError( std::string const &message ) -> BasicResult { return { ResultBase::LogicError, message }; }\n        static auto runtimeError( std::string const &message ) -> BasicResult { return { ResultBase::RuntimeError, message }; }\n\n        explicit operator bool() const { return m_type == ResultBase::Ok; }\n        auto type() const -> ResultBase::Type { return m_type; }\n        auto errorMessage() const -> std::string { return m_errorMessage; }\n\n    protected:\n        void enforceOk() const override {\n\n            // Errors shouldn't reach this point, but if they do\n            // the actual error message will be in m_errorMessage\n            assert( m_type != ResultBase::LogicError );\n            assert( m_type != ResultBase::RuntimeError );\n            if( m_type != ResultBase::Ok )\n                std::abort();\n        }\n\n        std::string m_errorMessage; // Only populated if resultType is an error\n\n        BasicResult( ResultBase::Type type, std::string const &message )\n        :   ResultValueBase<T>(type),\n            m_errorMessage(message)\n        {\n            assert( m_type != ResultBase::Ok );\n        }\n\n        using ResultValueBase<T>::ResultValueBase;\n        using ResultBase::m_type;\n    };\n\n    enum class ParseResultType {\n        Matched, NoMatch, ShortCircuitAll, ShortCircuitSame\n    };\n\n    class ParseState {\n    public:\n\n        ParseState( ParseResultType type, TokenStream const &remainingTokens )\n        : m_type(type),\n          m_remainingTokens( remainingTokens )\n        {}\n\n        auto type() const -> ParseResultType { return m_type; }\n        auto remainingTokens() const -> TokenStream { return m_remainingTokens; }\n\n    private:\n        ParseResultType m_type;\n        TokenStream m_remainingTokens;\n    };\n\n    using Result = BasicResult<void>;\n    using ParserResult = BasicResult<ParseResultType>;\n    using InternalParseResult = BasicResult<ParseState>;\n\n    struct HelpColumns {\n        std::string left;\n        std::string right;\n    };\n\n    template<typename T>\n    inline auto convertInto( std::string const &source, T& target ) -> ParserResult {\n        std::stringstream ss;\n        ss << source;\n        ss >> target;\n        if( ss.fail() )\n            return ParserResult::runtimeError( \"Unable to convert '\" + source + \"' to destination type\" );\n        else\n            return ParserResult::ok( ParseResultType::Matched );\n    }\n    inline auto convertInto( std::string const &source, std::string& target ) -> ParserResult {\n        target = source;\n        return ParserResult::ok( ParseResultType::Matched );\n    }\n    inline auto convertInto( std::string const &source, bool &target ) -> ParserResult {\n        std::string srcLC = source;\n        std::transform( srcLC.begin(), srcLC.end(), srcLC.begin(), []( unsigned char c ) { return static_cast<char>( std::tolower(c) ); } );\n        if (srcLC == \"y\" || srcLC == \"1\" || srcLC == \"true\" || srcLC == \"yes\" || srcLC == \"on\")\n            target = true;\n        else if (srcLC == \"n\" || srcLC == \"0\" || srcLC == \"false\" || srcLC == \"no\" || srcLC == \"off\")\n            target = false;\n        else\n            return ParserResult::runtimeError( \"Expected a boolean value but did not recognise: '\" + source + \"'\" );\n        return ParserResult::ok( ParseResultType::Matched );\n    }\n#ifdef CLARA_CONFIG_OPTIONAL_TYPE\n    template<typename T>\n    inline auto convertInto( std::string const &source, CLARA_CONFIG_OPTIONAL_TYPE<T>& target ) -> ParserResult {\n        T temp;\n        auto result = convertInto( source, temp );\n        if( result )\n            target = std::move(temp);\n        return result;\n    }\n#endif // CLARA_CONFIG_OPTIONAL_TYPE\n\n    struct NonCopyable {\n        NonCopyable() = default;\n        NonCopyable( NonCopyable const & ) = delete;\n        NonCopyable( NonCopyable && ) = delete;\n        NonCopyable &operator=( NonCopyable const & ) = delete;\n        NonCopyable &operator=( NonCopyable && ) = delete;\n    };\n\n    struct BoundRef : NonCopyable {\n        virtual ~BoundRef() = default;\n        virtual auto isContainer() const -> bool { return false; }\n        virtual auto isFlag() const -> bool { return false; }\n    };\n    struct BoundValueRefBase : BoundRef {\n        virtual auto setValue( std::string const &arg ) -> ParserResult = 0;\n    };\n    struct BoundFlagRefBase : BoundRef {\n        virtual auto setFlag( bool flag ) -> ParserResult = 0;\n        virtual auto isFlag() const -> bool { return true; }\n    };\n\n    template<typename T>\n    struct BoundValueRef : BoundValueRefBase {\n        T &m_ref;\n\n        explicit BoundValueRef( T &ref ) : m_ref( ref ) {}\n\n        auto setValue( std::string const &arg ) -> ParserResult override {\n            return convertInto( arg, m_ref );\n        }\n    };\n\n    template<typename T>\n    struct BoundValueRef<std::vector<T>> : BoundValueRefBase {\n        std::vector<T> &m_ref;\n\n        explicit BoundValueRef( std::vector<T> &ref ) : m_ref( ref ) {}\n\n        auto isContainer() const -> bool override { return true; }\n\n        auto setValue( std::string const &arg ) -> ParserResult override {\n            T temp;\n            auto result = convertInto( arg, temp );\n            if( result )\n                m_ref.push_back( temp );\n            return result;\n        }\n    };\n\n    struct BoundFlagRef : BoundFlagRefBase {\n        bool &m_ref;\n\n        explicit BoundFlagRef( bool &ref ) : m_ref( ref ) {}\n\n        auto setFlag( bool flag ) -> ParserResult override {\n            m_ref = flag;\n            return ParserResult::ok( ParseResultType::Matched );\n        }\n    };\n\n    template<typename ReturnType>\n    struct LambdaInvoker {\n        static_assert( std::is_same<ReturnType, ParserResult>::value, \"Lambda must return void or clara::ParserResult\" );\n\n        template<typename L, typename ArgType>\n        static auto invoke( L const &lambda, ArgType const &arg ) -> ParserResult {\n            return lambda( arg );\n        }\n    };\n\n    template<>\n    struct LambdaInvoker<void> {\n        template<typename L, typename ArgType>\n        static auto invoke( L const &lambda, ArgType const &arg ) -> ParserResult {\n            lambda( arg );\n            return ParserResult::ok( ParseResultType::Matched );\n        }\n    };\n\n    template<typename ArgType, typename L>\n    inline auto invokeLambda( L const &lambda, std::string const &arg ) -> ParserResult {\n        ArgType temp{};\n        auto result = convertInto( arg, temp );\n        return !result\n           ? result\n           : LambdaInvoker<typename UnaryLambdaTraits<L>::ReturnType>::invoke( lambda, temp );\n    }\n\n    template<typename L>\n    struct BoundLambda : BoundValueRefBase {\n        L m_lambda;\n\n        static_assert( UnaryLambdaTraits<L>::isValid, \"Supplied lambda must take exactly one argument\" );\n        explicit BoundLambda( L const &lambda ) : m_lambda( lambda ) {}\n\n        auto setValue( std::string const &arg ) -> ParserResult override {\n            return invokeLambda<typename UnaryLambdaTraits<L>::ArgType>( m_lambda, arg );\n        }\n    };\n\n    template<typename L>\n    struct BoundFlagLambda : BoundFlagRefBase {\n        L m_lambda;\n\n        static_assert( UnaryLambdaTraits<L>::isValid, \"Supplied lambda must take exactly one argument\" );\n        static_assert( std::is_same<typename UnaryLambdaTraits<L>::ArgType, bool>::value, \"flags must be boolean\" );\n\n        explicit BoundFlagLambda( L const &lambda ) : m_lambda( lambda ) {}\n\n        auto setFlag( bool flag ) -> ParserResult override {\n            return LambdaInvoker<typename UnaryLambdaTraits<L>::ReturnType>::invoke( m_lambda, flag );\n        }\n    };\n\n    enum class Optionality { Optional, Required };\n\n    struct Parser;\n\n    class ParserBase {\n    public:\n        virtual ~ParserBase() = default;\n        virtual auto validate() const -> Result { return Result::ok(); }\n        virtual auto parse( std::string const& exeName, TokenStream const &tokens) const -> InternalParseResult  = 0;\n        virtual auto cardinality() const -> size_t { return 1; }\n\n        auto parse( Args const &args ) const -> InternalParseResult {\n            return parse( args.exeName(), TokenStream( args ) );\n        }\n    };\n\n    template<typename DerivedT>\n    class ComposableParserImpl : public ParserBase {\n    public:\n        template<typename T>\n        auto operator|( T const &other ) const -> Parser;\n\n\t\ttemplate<typename T>\n        auto operator+( T const &other ) const -> Parser;\n    };\n\n    // Common code and state for Args and Opts\n    template<typename DerivedT>\n    class ParserRefImpl : public ComposableParserImpl<DerivedT> {\n    protected:\n        Optionality m_optionality = Optionality::Optional;\n        std::shared_ptr<BoundRef> m_ref;\n        std::string m_hint;\n        std::string m_description;\n\n        explicit ParserRefImpl( std::shared_ptr<BoundRef> const &ref ) : m_ref( ref ) {}\n\n    public:\n        template<typename T>\n        ParserRefImpl( T &ref, std::string const &hint )\n        :   m_ref( std::make_shared<BoundValueRef<T>>( ref ) ),\n            m_hint( hint )\n        {}\n\n        template<typename LambdaT>\n        ParserRefImpl( LambdaT const &ref, std::string const &hint )\n        :   m_ref( std::make_shared<BoundLambda<LambdaT>>( ref ) ),\n            m_hint(hint)\n        {}\n\n        auto operator()( std::string const &description ) -> DerivedT & {\n            m_description = description;\n            return static_cast<DerivedT &>( *this );\n        }\n\n        auto optional() -> DerivedT & {\n            m_optionality = Optionality::Optional;\n            return static_cast<DerivedT &>( *this );\n        };\n\n        auto required() -> DerivedT & {\n            m_optionality = Optionality::Required;\n            return static_cast<DerivedT &>( *this );\n        };\n\n        auto isOptional() const -> bool {\n            return m_optionality == Optionality::Optional;\n        }\n\n        auto cardinality() const -> size_t override {\n            if( m_ref->isContainer() )\n                return 0;\n            else\n                return 1;\n        }\n\n        auto hint() const -> std::string { return m_hint; }\n    };\n\n    class ExeName : public ComposableParserImpl<ExeName> {\n        std::shared_ptr<std::string> m_name;\n        std::shared_ptr<BoundValueRefBase> m_ref;\n\n        template<typename LambdaT>\n        static auto makeRef(LambdaT const &lambda) -> std::shared_ptr<BoundValueRefBase> {\n            return std::make_shared<BoundLambda<LambdaT>>( lambda) ;\n        }\n\n    public:\n        ExeName() : m_name( std::make_shared<std::string>( \"<executable>\" ) ) {}\n\n        explicit ExeName( std::string &ref ) : ExeName() {\n            m_ref = std::make_shared<BoundValueRef<std::string>>( ref );\n        }\n\n        template<typename LambdaT>\n        explicit ExeName( LambdaT const& lambda ) : ExeName() {\n            m_ref = std::make_shared<BoundLambda<LambdaT>>( lambda );\n        }\n\n        // The exe name is not parsed out of the normal tokens, but is handled specially\n        auto parse( std::string const&, TokenStream const &tokens ) const -> InternalParseResult override {\n            return InternalParseResult::ok( ParseState( ParseResultType::NoMatch, tokens ) );\n        }\n\n        auto name() const -> std::string { return *m_name; }\n        auto set( std::string const& newName ) -> ParserResult {\n\n            auto lastSlash = newName.find_last_of( \"\\\\/\" );\n            auto filename = ( lastSlash == std::string::npos )\n                    ? newName\n                    : newName.substr( lastSlash+1 );\n\n            *m_name = filename;\n            if( m_ref )\n                return m_ref->setValue( filename );\n            else\n                return ParserResult::ok( ParseResultType::Matched );\n        }\n    };\n\n    class Arg : public ParserRefImpl<Arg> {\n    public:\n        using ParserRefImpl::ParserRefImpl;\n\n        auto parse( std::string const &, TokenStream const &tokens ) const -> InternalParseResult override {\n            auto validationResult = validate();\n            if( !validationResult )\n                return InternalParseResult( validationResult );\n\n            auto remainingTokens = tokens;\n            auto const &token = *remainingTokens;\n            if( token.type != TokenType::Argument )\n                return InternalParseResult::ok( ParseState( ParseResultType::NoMatch, remainingTokens ) );\n\n            assert( !m_ref->isFlag() );\n            auto valueRef = static_cast<detail::BoundValueRefBase*>( m_ref.get() );\n\n            auto result = valueRef->setValue( remainingTokens->token );\n            if( !result )\n                return InternalParseResult( result );\n            else\n                return InternalParseResult::ok( ParseState( ParseResultType::Matched, ++remainingTokens ) );\n        }\n    };\n\n    inline auto normaliseOpt( std::string const &optName ) -> std::string {\n#ifdef CATCH_PLATFORM_WINDOWS\n        if( optName[0] == '/' )\n            return \"-\" + optName.substr( 1 );\n        else\n#endif\n            return optName;\n    }\n\n    class Opt : public ParserRefImpl<Opt> {\n    protected:\n        std::vector<std::string> m_optNames;\n\n    public:\n        template<typename LambdaT>\n        explicit Opt( LambdaT const &ref ) : ParserRefImpl( std::make_shared<BoundFlagLambda<LambdaT>>( ref ) ) {}\n\n        explicit Opt( bool &ref ) : ParserRefImpl( std::make_shared<BoundFlagRef>( ref ) ) {}\n\n        template<typename LambdaT>\n        Opt( LambdaT const &ref, std::string const &hint ) : ParserRefImpl( ref, hint ) {}\n\n        template<typename T>\n        Opt( T &ref, std::string const &hint ) : ParserRefImpl( ref, hint ) {}\n\n        auto operator[]( std::string const &optName ) -> Opt & {\n            m_optNames.push_back( optName );\n            return *this;\n        }\n\n        auto getHelpColumns() const -> std::vector<HelpColumns> {\n            std::ostringstream oss;\n            bool first = true;\n            for( auto const &opt : m_optNames ) {\n                if (first)\n                    first = false;\n                else\n                    oss << \", \";\n                oss << opt;\n            }\n            if( !m_hint.empty() )\n                oss << \" <\" << m_hint << \">\";\n            return { { oss.str(), m_description } };\n        }\n\n        auto isMatch( std::string const &optToken ) const -> bool {\n            auto normalisedToken = normaliseOpt( optToken );\n            for( auto const &name : m_optNames ) {\n                if( normaliseOpt( name ) == normalisedToken )\n                    return true;\n            }\n            return false;\n        }\n\n        using ParserBase::parse;\n\n        auto parse( std::string const&, TokenStream const &tokens ) const -> InternalParseResult override {\n            auto validationResult = validate();\n            if( !validationResult )\n                return InternalParseResult( validationResult );\n\n            auto remainingTokens = tokens;\n            if( remainingTokens && remainingTokens->type == TokenType::Option ) {\n                auto const &token = *remainingTokens;\n                if( isMatch(token.token ) ) {\n                    if( m_ref->isFlag() ) {\n                        auto flagRef = static_cast<detail::BoundFlagRefBase*>( m_ref.get() );\n                        auto result = flagRef->setFlag( true );\n                        if( !result )\n                            return InternalParseResult( result );\n                        if( result.value() == ParseResultType::ShortCircuitAll )\n                            return InternalParseResult::ok( ParseState( result.value(), remainingTokens ) );\n                    } else {\n                        auto valueRef = static_cast<detail::BoundValueRefBase*>( m_ref.get() );\n                        ++remainingTokens;\n                        if( !remainingTokens )\n                            return InternalParseResult::runtimeError( \"Expected argument following \" + token.token );\n                        auto const &argToken = *remainingTokens;\n                        if( argToken.type != TokenType::Argument )\n                            return InternalParseResult::runtimeError( \"Expected argument following \" + token.token );\n                        auto result = valueRef->setValue( argToken.token );\n                        if( !result )\n                            return InternalParseResult( result );\n                        if( result.value() == ParseResultType::ShortCircuitAll )\n                            return InternalParseResult::ok( ParseState( result.value(), remainingTokens ) );\n                    }\n                    return InternalParseResult::ok( ParseState( ParseResultType::Matched, ++remainingTokens ) );\n                }\n            }\n            return InternalParseResult::ok( ParseState( ParseResultType::NoMatch, remainingTokens ) );\n        }\n\n        auto validate() const -> Result override {\n            if( m_optNames.empty() )\n                return Result::logicError( \"No options supplied to Opt\" );\n            for( auto const &name : m_optNames ) {\n                if( name.empty() )\n                    return Result::logicError( \"Option name cannot be empty\" );\n#ifdef CATCH_PLATFORM_WINDOWS\n                if( name[0] != '-' && name[0] != '/' )\n                    return Result::logicError( \"Option name must begin with '-' or '/'\" );\n#else\n                if( name[0] != '-' )\n                    return Result::logicError( \"Option name must begin with '-'\" );\n#endif\n            }\n            return ParserRefImpl::validate();\n        }\n    };\n\n    struct Help : Opt {\n        Help( bool &showHelpFlag )\n        :   Opt([&]( bool flag ) {\n                showHelpFlag = flag;\n                return ParserResult::ok( ParseResultType::ShortCircuitAll );\n            })\n        {\n            static_cast<Opt &>( *this )\n                    (\"display usage information\")\n                    [\"-?\"][\"-h\"][\"--help\"]\n                    .optional();\n        }\n    };\n\n    struct Parser : ParserBase {\n\n        mutable ExeName m_exeName;\n        std::vector<Opt> m_options;\n        std::vector<Arg> m_args;\n\n        auto operator|=( ExeName const &exeName ) -> Parser & {\n            m_exeName = exeName;\n            return *this;\n        }\n\n        auto operator|=( Arg const &arg ) -> Parser & {\n            m_args.push_back(arg);\n            return *this;\n        }\n\n        auto operator|=( Opt const &opt ) -> Parser & {\n            m_options.push_back(opt);\n            return *this;\n        }\n\n        auto operator|=( Parser const &other ) -> Parser & {\n            m_options.insert(m_options.end(), other.m_options.begin(), other.m_options.end());\n            m_args.insert(m_args.end(), other.m_args.begin(), other.m_args.end());\n            return *this;\n        }\n\n        template<typename T>\n        auto operator|( T const &other ) const -> Parser {\n            return Parser( *this ) |= other;\n        }\n\n        // Forward deprecated interface with '+' instead of '|'\n        template<typename T>\n        auto operator+=( T const &other ) -> Parser & { return operator|=( other ); }\n        template<typename T>\n        auto operator+( T const &other ) const -> Parser { return operator|( other ); }\n\n        auto getHelpColumns() const -> std::vector<HelpColumns> {\n            std::vector<HelpColumns> cols;\n            for (auto const &o : m_options) {\n                auto childCols = o.getHelpColumns();\n                cols.insert( cols.end(), childCols.begin(), childCols.end() );\n            }\n            return cols;\n        }\n\n        void writeToStream( std::ostream &os ) const {\n            if (!m_exeName.name().empty()) {\n                os << \"usage:\\n\" << \"  \" << m_exeName.name() << \" \";\n                bool required = true, first = true;\n                for( auto const &arg : m_args ) {\n                    if (first)\n                        first = false;\n                    else\n                        os << \" \";\n                    if( arg.isOptional() && required ) {\n                        os << \"[\";\n                        required = false;\n                    }\n                    os << \"<\" << arg.hint() << \">\";\n                    if( arg.cardinality() == 0 )\n                        os << \" ... \";\n                }\n                if( !required )\n                    os << \"]\";\n                if( !m_options.empty() )\n                    os << \" options\";\n                os << \"\\n\\nwhere options are:\" << std::endl;\n            }\n\n            auto rows = getHelpColumns();\n            size_t consoleWidth = CATCH_CLARA_CONFIG_CONSOLE_WIDTH;\n            size_t optWidth = 0;\n            for( auto const &cols : rows )\n                optWidth = (std::max)(optWidth, cols.left.size() + 2);\n\n            optWidth = (std::min)(optWidth, consoleWidth/2);\n\n            for( auto const &cols : rows ) {\n                auto row =\n                        TextFlow::Column( cols.left ).width( optWidth ).indent( 2 ) +\n                        TextFlow::Spacer(4) +\n                        TextFlow::Column( cols.right ).width( consoleWidth - 7 - optWidth );\n                os << row << std::endl;\n            }\n        }\n\n        friend auto operator<<( std::ostream &os, Parser const &parser ) -> std::ostream& {\n            parser.writeToStream( os );\n            return os;\n        }\n\n        auto validate() const -> Result override {\n            for( auto const &opt : m_options ) {\n                auto result = opt.validate();\n                if( !result )\n                    return result;\n            }\n            for( auto const &arg : m_args ) {\n                auto result = arg.validate();\n                if( !result )\n                    return result;\n            }\n            return Result::ok();\n        }\n\n        using ParserBase::parse;\n\n        auto parse( std::string const& exeName, TokenStream const &tokens ) const -> InternalParseResult override {\n\n            struct ParserInfo {\n                ParserBase const* parser = nullptr;\n                size_t count = 0;\n            };\n            const size_t totalParsers = m_options.size() + m_args.size();\n            assert( totalParsers < 512 );\n            // ParserInfo parseInfos[totalParsers]; // <-- this is what we really want to do\n            ParserInfo parseInfos[512];\n\n            {\n                size_t i = 0;\n                for (auto const &opt : m_options) parseInfos[i++].parser = &opt;\n                for (auto const &arg : m_args) parseInfos[i++].parser = &arg;\n            }\n\n            m_exeName.set( exeName );\n\n            auto result = InternalParseResult::ok( ParseState( ParseResultType::NoMatch, tokens ) );\n            while( result.value().remainingTokens() ) {\n                bool tokenParsed = false;\n\n                for( size_t i = 0; i < totalParsers; ++i ) {\n                    auto&  parseInfo = parseInfos[i];\n                    if( parseInfo.parser->cardinality() == 0 || parseInfo.count < parseInfo.parser->cardinality() ) {\n                        result = parseInfo.parser->parse(exeName, result.value().remainingTokens());\n                        if (!result)\n                            return result;\n                        if (result.value().type() != ParseResultType::NoMatch) {\n                            tokenParsed = true;\n                            ++parseInfo.count;\n                            break;\n                        }\n                    }\n                }\n\n                if( result.value().type() == ParseResultType::ShortCircuitAll )\n                    return result;\n                if( !tokenParsed )\n                    return InternalParseResult::runtimeError( \"Unrecognised token: \" + result.value().remainingTokens()->token );\n            }\n            // !TBD Check missing required options\n            return result;\n        }\n    };\n\n    template<typename DerivedT>\n    template<typename T>\n    auto ComposableParserImpl<DerivedT>::operator|( T const &other ) const -> Parser {\n        return Parser() | static_cast<DerivedT const &>( *this ) | other;\n    }\n} // namespace detail\n\n// A Combined parser\nusing detail::Parser;\n\n// A parser for options\nusing detail::Opt;\n\n// A parser for arguments\nusing detail::Arg;\n\n// Wrapper for argc, argv from main()\nusing detail::Args;\n\n// Specifies the name of the executable\nusing detail::ExeName;\n\n// Convenience wrapper for option parser that specifies the help option\nusing detail::Help;\n\n// enum of result types from a parse\nusing detail::ParseResultType;\n\n// Result type for parser operation\nusing detail::ParserResult;\n\n}} // namespace Catch::clara\n\n// end clara.hpp\n#ifdef __clang__\n#pragma clang diagnostic pop\n#endif\n\n// Restore Clara's value for console width, if present\n#ifdef CATCH_TEMP_CLARA_CONFIG_CONSOLE_WIDTH\n#define CATCH_CLARA_TEXTFLOW_CONFIG_CONSOLE_WIDTH CATCH_TEMP_CLARA_CONFIG_CONSOLE_WIDTH\n#undef CATCH_TEMP_CLARA_CONFIG_CONSOLE_WIDTH\n#endif\n\n// end catch_clara.h\nnamespace Catch {\n\n    clara::Parser makeCommandLineParser( ConfigData& config );\n\n} // end namespace Catch\n\n// end catch_commandline.h\n#include <fstream>\n#include <ctime>\n\nnamespace Catch {\n\n    clara::Parser makeCommandLineParser( ConfigData& config ) {\n\n        using namespace clara;\n\n        auto const setWarning = [&]( std::string const& warning ) {\n                auto warningSet = [&]() {\n                    if( warning == \"NoAssertions\" )\n                        return WarnAbout::NoAssertions;\n\n                    if ( warning == \"NoTests\" )\n                        return WarnAbout::NoTests;\n\n                    return WarnAbout::Nothing;\n                }();\n\n                if (warningSet == WarnAbout::Nothing)\n                    return ParserResult::runtimeError( \"Unrecognised warning: '\" + warning + \"'\" );\n                config.warnings = static_cast<WarnAbout::What>( config.warnings | warningSet );\n                return ParserResult::ok( ParseResultType::Matched );\n            };\n        auto const loadTestNamesFromFile = [&]( std::string const& filename ) {\n                std::ifstream f( filename.c_str() );\n                if( !f.is_open() )\n                    return ParserResult::runtimeError( \"Unable to load input file: '\" + filename + \"'\" );\n\n                std::string line;\n                while( std::getline( f, line ) ) {\n                    line = trim(line);\n                    if( !line.empty() && !startsWith( line, '#' ) ) {\n                        if( !startsWith( line, '\"' ) )\n                            line = '\"' + line + '\"';\n                        config.testsOrTags.push_back( line );\n                        config.testsOrTags.emplace_back( \",\" );\n                    }\n                }\n                //Remove comma in the end\n                if(!config.testsOrTags.empty())\n                    config.testsOrTags.erase( config.testsOrTags.end()-1 );\n\n                return ParserResult::ok( ParseResultType::Matched );\n            };\n        auto const setTestOrder = [&]( std::string const& order ) {\n                if( startsWith( \"declared\", order ) )\n                    config.runOrder = RunTests::InDeclarationOrder;\n                else if( startsWith( \"lexical\", order ) )\n                    config.runOrder = RunTests::InLexicographicalOrder;\n                else if( startsWith( \"random\", order ) )\n                    config.runOrder = RunTests::InRandomOrder;\n                else\n                    return clara::ParserResult::runtimeError( \"Unrecognised ordering: '\" + order + \"'\" );\n                return ParserResult::ok( ParseResultType::Matched );\n            };\n        auto const setRngSeed = [&]( std::string const& seed ) {\n                if( seed != \"time\" )\n                    return clara::detail::convertInto( seed, config.rngSeed );\n                config.rngSeed = static_cast<unsigned int>( std::time(nullptr) );\n                return ParserResult::ok( ParseResultType::Matched );\n            };\n        auto const setColourUsage = [&]( std::string const& useColour ) {\n                    auto mode = toLower( useColour );\n\n                    if( mode == \"yes\" )\n                        config.useColour = UseColour::Yes;\n                    else if( mode == \"no\" )\n                        config.useColour = UseColour::No;\n                    else if( mode == \"auto\" )\n                        config.useColour = UseColour::Auto;\n                    else\n                        return ParserResult::runtimeError( \"colour mode must be one of: auto, yes or no. '\" + useColour + \"' not recognised\" );\n                return ParserResult::ok( ParseResultType::Matched );\n            };\n        auto const setWaitForKeypress = [&]( std::string const& keypress ) {\n                auto keypressLc = toLower( keypress );\n                if (keypressLc == \"never\")\n                    config.waitForKeypress = WaitForKeypress::Never;\n                else if( keypressLc == \"start\" )\n                    config.waitForKeypress = WaitForKeypress::BeforeStart;\n                else if( keypressLc == \"exit\" )\n                    config.waitForKeypress = WaitForKeypress::BeforeExit;\n                else if( keypressLc == \"both\" )\n                    config.waitForKeypress = WaitForKeypress::BeforeStartAndExit;\n                else\n                    return ParserResult::runtimeError( \"keypress argument must be one of: never, start, exit or both. '\" + keypress + \"' not recognised\" );\n            return ParserResult::ok( ParseResultType::Matched );\n            };\n        auto const setVerbosity = [&]( std::string const& verbosity ) {\n            auto lcVerbosity = toLower( verbosity );\n            if( lcVerbosity == \"quiet\" )\n                config.verbosity = Verbosity::Quiet;\n            else if( lcVerbosity == \"normal\" )\n                config.verbosity = Verbosity::Normal;\n            else if( lcVerbosity == \"high\" )\n                config.verbosity = Verbosity::High;\n            else\n                return ParserResult::runtimeError( \"Unrecognised verbosity, '\" + verbosity + \"'\" );\n            return ParserResult::ok( ParseResultType::Matched );\n        };\n        auto const setReporter = [&]( std::string const& reporter ) {\n            IReporterRegistry::FactoryMap const& factories = getRegistryHub().getReporterRegistry().getFactories();\n\n            auto lcReporter = toLower( reporter );\n            auto result = factories.find( lcReporter );\n\n            if( factories.end() != result )\n                config.reporterName = lcReporter;\n            else\n                return ParserResult::runtimeError( \"Unrecognized reporter, '\" + reporter + \"'. Check available with --list-reporters\" );\n            return ParserResult::ok( ParseResultType::Matched );\n        };\n\n        auto cli\n            = ExeName( config.processName )\n            | Help( config.showHelp )\n            | Opt( config.listTests )\n                [\"-l\"][\"--list-tests\"]\n                ( \"list all/matching test cases\" )\n            | Opt( config.listTags )\n                [\"-t\"][\"--list-tags\"]\n                ( \"list all/matching tags\" )\n            | Opt( config.showSuccessfulTests )\n                [\"-s\"][\"--success\"]\n                ( \"include successful tests in output\" )\n            | Opt( config.shouldDebugBreak )\n                [\"-b\"][\"--break\"]\n                ( \"break into debugger on failure\" )\n            | Opt( config.noThrow )\n                [\"-e\"][\"--nothrow\"]\n                ( \"skip exception tests\" )\n            | Opt( config.showInvisibles )\n                [\"-i\"][\"--invisibles\"]\n                ( \"show invisibles (tabs, newlines)\" )\n            | Opt( config.outputFilename, \"filename\" )\n                [\"-o\"][\"--out\"]\n                ( \"output filename\" )\n            | Opt( setReporter, \"name\" )\n                [\"-r\"][\"--reporter\"]\n                ( \"reporter to use (defaults to console)\" )\n            | Opt( config.name, \"name\" )\n                [\"-n\"][\"--name\"]\n                ( \"suite name\" )\n            | Opt( [&]( bool ){ config.abortAfter = 1; } )\n                [\"-a\"][\"--abort\"]\n                ( \"abort at first failure\" )\n            | Opt( [&]( int x ){ config.abortAfter = x; }, \"no. failures\" )\n                [\"-x\"][\"--abortx\"]\n                ( \"abort after x failures\" )\n            | Opt( setWarning, \"warning name\" )\n                [\"-w\"][\"--warn\"]\n                ( \"enable warnings\" )\n            | Opt( [&]( bool flag ) { config.showDurations = flag ? ShowDurations::Always : ShowDurations::Never; }, \"yes|no\" )\n                [\"-d\"][\"--durations\"]\n                ( \"show test durations\" )\n            | Opt( config.minDuration, \"seconds\" )\n                [\"-D\"][\"--min-duration\"]\n                ( \"show test durations for tests taking at least the given number of seconds\" )\n            | Opt( loadTestNamesFromFile, \"filename\" )\n                [\"-f\"][\"--input-file\"]\n                ( \"load test names to run from a file\" )\n            | Opt( config.filenamesAsTags )\n                [\"-#\"][\"--filenames-as-tags\"]\n                ( \"adds a tag for the filename\" )\n            | Opt( config.sectionsToRun, \"section name\" )\n                [\"-c\"][\"--section\"]\n                ( \"specify section to run\" )\n            | Opt( setVerbosity, \"quiet|normal|high\" )\n                [\"-v\"][\"--verbosity\"]\n                ( \"set output verbosity\" )\n            | Opt( config.listTestNamesOnly )\n                [\"--list-test-names-only\"]\n                ( \"list all/matching test cases names only\" )\n            | Opt( config.listReporters )\n                [\"--list-reporters\"]\n                ( \"list all reporters\" )\n            | Opt( setTestOrder, \"decl|lex|rand\" )\n                [\"--order\"]\n                ( \"test case order (defaults to decl)\" )\n            | Opt( setRngSeed, \"'time'|number\" )\n                [\"--rng-seed\"]\n                ( \"set a specific seed for random numbers\" )\n            | Opt( setColourUsage, \"yes|no\" )\n                [\"--use-colour\"]\n                ( \"should output be colourised\" )\n            | Opt( config.libIdentify )\n                [\"--libidentify\"]\n                ( \"report name and version according to libidentify standard\" )\n            | Opt( setWaitForKeypress, \"never|start|exit|both\" )\n                [\"--wait-for-keypress\"]\n                ( \"waits for a keypress before exiting\" )\n            | Opt( config.benchmarkSamples, \"samples\" )\n                [\"--benchmark-samples\"]\n                ( \"number of samples to collect (default: 100)\" )\n            | Opt( config.benchmarkResamples, \"resamples\" )\n                [\"--benchmark-resamples\"]\n                ( \"number of resamples for the bootstrap (default: 100000)\" )\n            | Opt( config.benchmarkConfidenceInterval, \"confidence interval\" )\n                [\"--benchmark-confidence-interval\"]\n                ( \"confidence interval for the bootstrap (between 0 and 1, default: 0.95)\" )\n            | Opt( config.benchmarkNoAnalysis )\n                [\"--benchmark-no-analysis\"]\n                ( \"perform only measurements; do not perform any analysis\" )\n            | Opt( config.benchmarkWarmupTime, \"benchmarkWarmupTime\" )\n                [\"--benchmark-warmup-time\"]\n                ( \"amount of time in milliseconds spent on warming up each test (default: 100)\" )\n            | Arg( config.testsOrTags, \"test name|pattern|tags\" )\n                ( \"which test or tests to use\" );\n\n        return cli;\n    }\n\n} // end namespace Catch\n// end catch_commandline.cpp\n// start catch_common.cpp\n\n#include <cstring>\n#include <ostream>\n\nnamespace Catch {\n\n    bool SourceLineInfo::operator == ( SourceLineInfo const& other ) const noexcept {\n        return line == other.line && (file == other.file || std::strcmp(file, other.file) == 0);\n    }\n    bool SourceLineInfo::operator < ( SourceLineInfo const& other ) const noexcept {\n        // We can assume that the same file will usually have the same pointer.\n        // Thus, if the pointers are the same, there is no point in calling the strcmp\n        return line < other.line || ( line == other.line && file != other.file && (std::strcmp(file, other.file) < 0));\n    }\n\n    std::ostream& operator << ( std::ostream& os, SourceLineInfo const& info ) {\n#ifndef __GNUG__\n        os << info.file << '(' << info.line << ')';\n#else\n        os << info.file << ':' << info.line;\n#endif\n        return os;\n    }\n\n    std::string StreamEndStop::operator+() const {\n        return std::string();\n    }\n\n    NonCopyable::NonCopyable() = default;\n    NonCopyable::~NonCopyable() = default;\n\n}\n// end catch_common.cpp\n// start catch_config.cpp\n\nnamespace Catch {\n\n    Config::Config( ConfigData const& data )\n    :   m_data( data ),\n        m_stream( openStream() )\n    {\n        // We need to trim filter specs to avoid trouble with superfluous\n        // whitespace (esp. important for bdd macros, as those are manually\n        // aligned with whitespace).\n\n        for (auto& elem : m_data.testsOrTags) {\n            elem = trim(elem);\n        }\n        for (auto& elem : m_data.sectionsToRun) {\n            elem = trim(elem);\n        }\n\n        TestSpecParser parser(ITagAliasRegistry::get());\n        if (!m_data.testsOrTags.empty()) {\n            m_hasTestFilters = true;\n            for (auto const& testOrTags : m_data.testsOrTags) {\n                parser.parse(testOrTags);\n            }\n        }\n        m_testSpec = parser.testSpec();\n    }\n\n    std::string const& Config::getFilename() const {\n        return m_data.outputFilename ;\n    }\n\n    bool Config::listTests() const          { return m_data.listTests; }\n    bool Config::listTestNamesOnly() const  { return m_data.listTestNamesOnly; }\n    bool Config::listTags() const           { return m_data.listTags; }\n    bool Config::listReporters() const      { return m_data.listReporters; }\n\n    std::string Config::getProcessName() const { return m_data.processName; }\n    std::string const& Config::getReporterName() const { return m_data.reporterName; }\n\n    std::vector<std::string> const& Config::getTestsOrTags() const { return m_data.testsOrTags; }\n    std::vector<std::string> const& Config::getSectionsToRun() const { return m_data.sectionsToRun; }\n\n    TestSpec const& Config::testSpec() const { return m_testSpec; }\n    bool Config::hasTestFilters() const { return m_hasTestFilters; }\n\n    bool Config::showHelp() const { return m_data.showHelp; }\n\n    // IConfig interface\n    bool Config::allowThrows() const                   { return !m_data.noThrow; }\n    std::ostream& Config::stream() const               { return m_stream->stream(); }\n    std::string Config::name() const                   { return m_data.name.empty() ? m_data.processName : m_data.name; }\n    bool Config::includeSuccessfulResults() const      { return m_data.showSuccessfulTests; }\n    bool Config::warnAboutMissingAssertions() const    { return !!(m_data.warnings & WarnAbout::NoAssertions); }\n    bool Config::warnAboutNoTests() const              { return !!(m_data.warnings & WarnAbout::NoTests); }\n    ShowDurations::OrNot Config::showDurations() const { return m_data.showDurations; }\n    double Config::minDuration() const                 { return m_data.minDuration; }\n    RunTests::InWhatOrder Config::runOrder() const     { return m_data.runOrder; }\n    unsigned int Config::rngSeed() const               { return m_data.rngSeed; }\n    UseColour::YesOrNo Config::useColour() const       { return m_data.useColour; }\n    bool Config::shouldDebugBreak() const              { return m_data.shouldDebugBreak; }\n    int Config::abortAfter() const                     { return m_data.abortAfter; }\n    bool Config::showInvisibles() const                { return m_data.showInvisibles; }\n    Verbosity Config::verbosity() const                { return m_data.verbosity; }\n\n    bool Config::benchmarkNoAnalysis() const                      { return m_data.benchmarkNoAnalysis; }\n    int Config::benchmarkSamples() const                          { return m_data.benchmarkSamples; }\n    double Config::benchmarkConfidenceInterval() const            { return m_data.benchmarkConfidenceInterval; }\n    unsigned int Config::benchmarkResamples() const               { return m_data.benchmarkResamples; }\n    std::chrono::milliseconds Config::benchmarkWarmupTime() const { return std::chrono::milliseconds(m_data.benchmarkWarmupTime); }\n\n    IStream const* Config::openStream() {\n        return Catch::makeStream(m_data.outputFilename);\n    }\n\n} // end namespace Catch\n// end catch_config.cpp\n// start catch_console_colour.cpp\n\n#if defined(__clang__)\n#    pragma clang diagnostic push\n#    pragma clang diagnostic ignored \"-Wexit-time-destructors\"\n#endif\n\n// start catch_errno_guard.h\n\nnamespace Catch {\n\n    class ErrnoGuard {\n    public:\n        ErrnoGuard();\n        ~ErrnoGuard();\n    private:\n        int m_oldErrno;\n    };\n\n}\n\n// end catch_errno_guard.h\n// start catch_windows_h_proxy.h\n\n\n#if defined(CATCH_PLATFORM_WINDOWS)\n\n#if !defined(NOMINMAX) && !defined(CATCH_CONFIG_NO_NOMINMAX)\n#  define CATCH_DEFINED_NOMINMAX\n#  define NOMINMAX\n#endif\n#if !defined(WIN32_LEAN_AND_MEAN) && !defined(CATCH_CONFIG_NO_WIN32_LEAN_AND_MEAN)\n#  define CATCH_DEFINED_WIN32_LEAN_AND_MEAN\n#  define WIN32_LEAN_AND_MEAN\n#endif\n\n#ifdef __AFXDLL\n#include <AfxWin.h>\n#else\n#include <windows.h>\n#endif\n\n#ifdef CATCH_DEFINED_NOMINMAX\n#  undef NOMINMAX\n#endif\n#ifdef CATCH_DEFINED_WIN32_LEAN_AND_MEAN\n#  undef WIN32_LEAN_AND_MEAN\n#endif\n\n#endif // defined(CATCH_PLATFORM_WINDOWS)\n\n// end catch_windows_h_proxy.h\n#include <sstream>\n\nnamespace Catch {\n    namespace {\n\n        struct IColourImpl {\n            virtual ~IColourImpl() = default;\n            virtual void use( Colour::Code _colourCode ) = 0;\n        };\n\n        struct NoColourImpl : IColourImpl {\n            void use( Colour::Code ) override {}\n\n            static IColourImpl* instance() {\n                static NoColourImpl s_instance;\n                return &s_instance;\n            }\n        };\n\n    } // anon namespace\n} // namespace Catch\n\n#if !defined( CATCH_CONFIG_COLOUR_NONE ) && !defined( CATCH_CONFIG_COLOUR_WINDOWS ) && !defined( CATCH_CONFIG_COLOUR_ANSI )\n#   ifdef CATCH_PLATFORM_WINDOWS\n#       define CATCH_CONFIG_COLOUR_WINDOWS\n#   else\n#       define CATCH_CONFIG_COLOUR_ANSI\n#   endif\n#endif\n\n#if defined ( CATCH_CONFIG_COLOUR_WINDOWS ) /////////////////////////////////////////\n\nnamespace Catch {\nnamespace {\n\n    class Win32ColourImpl : public IColourImpl {\n    public:\n        Win32ColourImpl() : stdoutHandle( GetStdHandle(STD_OUTPUT_HANDLE) )\n        {\n            CONSOLE_SCREEN_BUFFER_INFO csbiInfo;\n            GetConsoleScreenBufferInfo( stdoutHandle, &csbiInfo );\n            originalForegroundAttributes = csbiInfo.wAttributes & ~( BACKGROUND_GREEN | BACKGROUND_RED | BACKGROUND_BLUE | BACKGROUND_INTENSITY );\n            originalBackgroundAttributes = csbiInfo.wAttributes & ~( FOREGROUND_GREEN | FOREGROUND_RED | FOREGROUND_BLUE | FOREGROUND_INTENSITY );\n        }\n\n        void use( Colour::Code _colourCode ) override {\n            switch( _colourCode ) {\n                case Colour::None:      return setTextAttribute( originalForegroundAttributes );\n                case Colour::White:     return setTextAttribute( FOREGROUND_GREEN | FOREGROUND_RED | FOREGROUND_BLUE );\n                case Colour::Red:       return setTextAttribute( FOREGROUND_RED );\n                case Colour::Green:     return setTextAttribute( FOREGROUND_GREEN );\n                case Colour::Blue:      return setTextAttribute( FOREGROUND_BLUE );\n                case Colour::Cyan:      return setTextAttribute( FOREGROUND_BLUE | FOREGROUND_GREEN );\n                case Colour::Yellow:    return setTextAttribute( FOREGROUND_RED | FOREGROUND_GREEN );\n                case Colour::Grey:      return setTextAttribute( 0 );\n\n                case Colour::LightGrey:     return setTextAttribute( FOREGROUND_INTENSITY );\n                case Colour::BrightRed:     return setTextAttribute( FOREGROUND_INTENSITY | FOREGROUND_RED );\n                case Colour::BrightGreen:   return setTextAttribute( FOREGROUND_INTENSITY | FOREGROUND_GREEN );\n                case Colour::BrightWhite:   return setTextAttribute( FOREGROUND_INTENSITY | FOREGROUND_GREEN | FOREGROUND_RED | FOREGROUND_BLUE );\n                case Colour::BrightYellow:  return setTextAttribute( FOREGROUND_INTENSITY | FOREGROUND_RED | FOREGROUND_GREEN );\n\n                case Colour::Bright: CATCH_INTERNAL_ERROR( \"not a colour\" );\n\n                default:\n                    CATCH_ERROR( \"Unknown colour requested\" );\n            }\n        }\n\n    private:\n        void setTextAttribute( WORD _textAttribute ) {\n            SetConsoleTextAttribute( stdoutHandle, _textAttribute | originalBackgroundAttributes );\n        }\n        HANDLE stdoutHandle;\n        WORD originalForegroundAttributes;\n        WORD originalBackgroundAttributes;\n    };\n\n    IColourImpl* platformColourInstance() {\n        static Win32ColourImpl s_instance;\n\n        IConfigPtr config = getCurrentContext().getConfig();\n        UseColour::YesOrNo colourMode = config\n            ? config->useColour()\n            : UseColour::Auto;\n        if( colourMode == UseColour::Auto )\n            colourMode = UseColour::Yes;\n        return colourMode == UseColour::Yes\n            ? &s_instance\n            : NoColourImpl::instance();\n    }\n\n} // end anon namespace\n} // end namespace Catch\n\n#elif defined( CATCH_CONFIG_COLOUR_ANSI ) //////////////////////////////////////\n\n#include <unistd.h>\n\nnamespace Catch {\nnamespace {\n\n    // use POSIX/ ANSI console terminal codes\n    // Thanks to Adam Strzelecki for original contribution\n    // (http://github.com/nanoant)\n    // https://github.com/philsquared/Catch/pull/131\n    class PosixColourImpl : public IColourImpl {\n    public:\n        void use( Colour::Code _colourCode ) override {\n            switch( _colourCode ) {\n                case Colour::None:\n                case Colour::White:     return setColour( \"[0m\" );\n                case Colour::Red:       return setColour( \"[0;31m\" );\n                case Colour::Green:     return setColour( \"[0;32m\" );\n                case Colour::Blue:      return setColour( \"[0;34m\" );\n                case Colour::Cyan:      return setColour( \"[0;36m\" );\n                case Colour::Yellow:    return setColour( \"[0;33m\" );\n                case Colour::Grey:      return setColour( \"[1;30m\" );\n\n                case Colour::LightGrey:     return setColour( \"[0;37m\" );\n                case Colour::BrightRed:     return setColour( \"[1;31m\" );\n                case Colour::BrightGreen:   return setColour( \"[1;32m\" );\n                case Colour::BrightWhite:   return setColour( \"[1;37m\" );\n                case Colour::BrightYellow:  return setColour( \"[1;33m\" );\n\n                case Colour::Bright: CATCH_INTERNAL_ERROR( \"not a colour\" );\n                default: CATCH_INTERNAL_ERROR( \"Unknown colour requested\" );\n            }\n        }\n        static IColourImpl* instance() {\n            static PosixColourImpl s_instance;\n            return &s_instance;\n        }\n\n    private:\n        void setColour( const char* _escapeCode ) {\n            getCurrentContext().getConfig()->stream()\n                << '\\033' << _escapeCode;\n        }\n    };\n\n    bool useColourOnPlatform() {\n        return\n#if defined(CATCH_PLATFORM_MAC) || defined(CATCH_PLATFORM_IPHONE)\n            !isDebuggerActive() &&\n#endif\n#if !(defined(__DJGPP__) && defined(__STRICT_ANSI__))\n            isatty(STDOUT_FILENO)\n#else\n            false\n#endif\n            ;\n    }\n    IColourImpl* platformColourInstance() {\n        ErrnoGuard guard;\n        IConfigPtr config = getCurrentContext().getConfig();\n        UseColour::YesOrNo colourMode = config\n            ? config->useColour()\n            : UseColour::Auto;\n        if( colourMode == UseColour::Auto )\n            colourMode = useColourOnPlatform()\n                ? UseColour::Yes\n                : UseColour::No;\n        return colourMode == UseColour::Yes\n            ? PosixColourImpl::instance()\n            : NoColourImpl::instance();\n    }\n\n} // end anon namespace\n} // end namespace Catch\n\n#else  // not Windows or ANSI ///////////////////////////////////////////////\n\nnamespace Catch {\n\n    static IColourImpl* platformColourInstance() { return NoColourImpl::instance(); }\n\n} // end namespace Catch\n\n#endif // Windows/ ANSI/ None\n\nnamespace Catch {\n\n    Colour::Colour( Code _colourCode ) { use( _colourCode ); }\n    Colour::Colour( Colour&& other ) noexcept {\n        m_moved = other.m_moved;\n        other.m_moved = true;\n    }\n    Colour& Colour::operator=( Colour&& other ) noexcept {\n        m_moved = other.m_moved;\n        other.m_moved  = true;\n        return *this;\n    }\n\n    Colour::~Colour(){ if( !m_moved ) use( None ); }\n\n    void Colour::use( Code _colourCode ) {\n        static IColourImpl* impl = platformColourInstance();\n        // Strictly speaking, this cannot possibly happen.\n        // However, under some conditions it does happen (see #1626),\n        // and this change is small enough that we can let practicality\n        // triumph over purity in this case.\n        if (impl != nullptr) {\n            impl->use( _colourCode );\n        }\n    }\n\n    std::ostream& operator << ( std::ostream& os, Colour const& ) {\n        return os;\n    }\n\n} // end namespace Catch\n\n#if defined(__clang__)\n#    pragma clang diagnostic pop\n#endif\n\n// end catch_console_colour.cpp\n// start catch_context.cpp\n\nnamespace Catch {\n\n    class Context : public IMutableContext, NonCopyable {\n\n    public: // IContext\n        IResultCapture* getResultCapture() override {\n            return m_resultCapture;\n        }\n        IRunner* getRunner() override {\n            return m_runner;\n        }\n\n        IConfigPtr const& getConfig() const override {\n            return m_config;\n        }\n\n        ~Context() override;\n\n    public: // IMutableContext\n        void setResultCapture( IResultCapture* resultCapture ) override {\n            m_resultCapture = resultCapture;\n        }\n        void setRunner( IRunner* runner ) override {\n            m_runner = runner;\n        }\n        void setConfig( IConfigPtr const& config ) override {\n            m_config = config;\n        }\n\n        friend IMutableContext& getCurrentMutableContext();\n\n    private:\n        IConfigPtr m_config;\n        IRunner* m_runner = nullptr;\n        IResultCapture* m_resultCapture = nullptr;\n    };\n\n    IMutableContext *IMutableContext::currentContext = nullptr;\n\n    void IMutableContext::createContext()\n    {\n        currentContext = new Context();\n    }\n\n    void cleanUpContext() {\n        delete IMutableContext::currentContext;\n        IMutableContext::currentContext = nullptr;\n    }\n    IContext::~IContext() = default;\n    IMutableContext::~IMutableContext() = default;\n    Context::~Context() = default;\n\n    SimplePcg32& rng() {\n        static SimplePcg32 s_rng;\n        return s_rng;\n    }\n\n}\n// end catch_context.cpp\n// start catch_debug_console.cpp\n\n// start catch_debug_console.h\n\n#include <string>\n\nnamespace Catch {\n    void writeToDebugConsole( std::string const& text );\n}\n\n// end catch_debug_console.h\n#if defined(CATCH_CONFIG_ANDROID_LOGWRITE)\n#include <android/log.h>\n\n    namespace Catch {\n        void writeToDebugConsole( std::string const& text ) {\n            __android_log_write( ANDROID_LOG_DEBUG, \"Catch\", text.c_str() );\n        }\n    }\n\n#elif defined(CATCH_PLATFORM_WINDOWS)\n\n    namespace Catch {\n        void writeToDebugConsole( std::string const& text ) {\n            ::OutputDebugStringA( text.c_str() );\n        }\n    }\n\n#else\n\n    namespace Catch {\n        void writeToDebugConsole( std::string const& text ) {\n            // !TBD: Need a version for Mac/ XCode and other IDEs\n            Catch::cout() << text;\n        }\n    }\n\n#endif // Platform\n// end catch_debug_console.cpp\n// start catch_debugger.cpp\n\n#if defined(CATCH_PLATFORM_MAC) || defined(CATCH_PLATFORM_IPHONE)\n\n#  include <cassert>\n#  include <sys/types.h>\n#  include <unistd.h>\n#  include <cstddef>\n#  include <ostream>\n\n#ifdef __apple_build_version__\n    // These headers will only compile with AppleClang (XCode)\n    // For other compilers (Clang, GCC, ... ) we need to exclude them\n#  include <sys/sysctl.h>\n#endif\n\n    namespace Catch {\n        #ifdef __apple_build_version__\n        // The following function is taken directly from the following technical note:\n        // https://developer.apple.com/library/archive/qa/qa1361/_index.html\n\n        // Returns true if the current process is being debugged (either\n        // running under the debugger or has a debugger attached post facto).\n        bool isDebuggerActive(){\n            int                 mib[4];\n            struct kinfo_proc   info;\n            std::size_t         size;\n\n            // Initialize the flags so that, if sysctl fails for some bizarre\n            // reason, we get a predictable result.\n\n            info.kp_proc.p_flag = 0;\n\n            // Initialize mib, which tells sysctl the info we want, in this case\n            // we're looking for information about a specific process ID.\n\n            mib[0] = CTL_KERN;\n            mib[1] = KERN_PROC;\n            mib[2] = KERN_PROC_PID;\n            mib[3] = getpid();\n\n            // Call sysctl.\n\n            size = sizeof(info);\n            if( sysctl(mib, sizeof(mib) / sizeof(*mib), &info, &size, nullptr, 0) != 0 ) {\n                Catch::cerr() << \"\\n** Call to sysctl failed - unable to determine if debugger is active **\\n\" << std::endl;\n                return false;\n            }\n\n            // We're being debugged if the P_TRACED flag is set.\n\n            return ( (info.kp_proc.p_flag & P_TRACED) != 0 );\n        }\n        #else\n        bool isDebuggerActive() {\n            // We need to find another way to determine this for non-appleclang compilers on macOS\n            return false;\n        }\n        #endif\n    } // namespace Catch\n\n#elif defined(CATCH_PLATFORM_LINUX)\n    #include <fstream>\n    #include <string>\n\n    namespace Catch{\n        // The standard POSIX way of detecting a debugger is to attempt to\n        // ptrace() the process, but this needs to be done from a child and not\n        // this process itself to still allow attaching to this process later\n        // if wanted, so is rather heavy. Under Linux we have the PID of the\n        // \"debugger\" (which doesn't need to be gdb, of course, it could also\n        // be strace, for example) in /proc/$PID/status, so just get it from\n        // there instead.\n        bool isDebuggerActive(){\n            // Libstdc++ has a bug, where std::ifstream sets errno to 0\n            // This way our users can properly assert over errno values\n            ErrnoGuard guard;\n            std::ifstream in(\"/proc/self/status\");\n            for( std::string line; std::getline(in, line); ) {\n                static const int PREFIX_LEN = 11;\n                if( line.compare(0, PREFIX_LEN, \"TracerPid:\\t\") == 0 ) {\n                    // We're traced if the PID is not 0 and no other PID starts\n                    // with 0 digit, so it's enough to check for just a single\n                    // character.\n                    return line.length() > PREFIX_LEN && line[PREFIX_LEN] != '0';\n                }\n            }\n\n            return false;\n        }\n    } // namespace Catch\n#elif defined(_MSC_VER)\n    extern \"C\" __declspec(dllimport) int __stdcall IsDebuggerPresent();\n    namespace Catch {\n        bool isDebuggerActive() {\n            return IsDebuggerPresent() != 0;\n        }\n    }\n#elif defined(__MINGW32__)\n    extern \"C\" __declspec(dllimport) int __stdcall IsDebuggerPresent();\n    namespace Catch {\n        bool isDebuggerActive() {\n            return IsDebuggerPresent() != 0;\n        }\n    }\n#else\n    namespace Catch {\n       bool isDebuggerActive() { return false; }\n    }\n#endif // Platform\n// end catch_debugger.cpp\n// start catch_decomposer.cpp\n\nnamespace Catch {\n\n    ITransientExpression::~ITransientExpression() = default;\n\n    void formatReconstructedExpression( std::ostream &os, std::string const& lhs, StringRef op, std::string const& rhs ) {\n        if( lhs.size() + rhs.size() < 40 &&\n                lhs.find('\\n') == std::string::npos &&\n                rhs.find('\\n') == std::string::npos )\n            os << lhs << \" \" << op << \" \" << rhs;\n        else\n            os << lhs << \"\\n\" << op << \"\\n\" << rhs;\n    }\n}\n// end catch_decomposer.cpp\n// start catch_enforce.cpp\n\n#include <stdexcept>\n\nnamespace Catch {\n#if defined(CATCH_CONFIG_DISABLE_EXCEPTIONS) && !defined(CATCH_CONFIG_DISABLE_EXCEPTIONS_CUSTOM_HANDLER)\n    [[noreturn]]\n    void throw_exception(std::exception const& e) {\n        Catch::cerr() << \"Catch will terminate because it needed to throw an exception.\\n\"\n                      << \"The message was: \" << e.what() << '\\n';\n        std::terminate();\n    }\n#endif\n\n    [[noreturn]]\n    void throw_logic_error(std::string const& msg) {\n        throw_exception(std::logic_error(msg));\n    }\n\n    [[noreturn]]\n    void throw_domain_error(std::string const& msg) {\n        throw_exception(std::domain_error(msg));\n    }\n\n    [[noreturn]]\n    void throw_runtime_error(std::string const& msg) {\n        throw_exception(std::runtime_error(msg));\n    }\n\n} // namespace Catch;\n// end catch_enforce.cpp\n// start catch_enum_values_registry.cpp\n// start catch_enum_values_registry.h\n\n#include <vector>\n#include <memory>\n\nnamespace Catch {\n\n    namespace Detail {\n\n        std::unique_ptr<EnumInfo> makeEnumInfo( StringRef enumName, StringRef allValueNames, std::vector<int> const& values );\n\n        class EnumValuesRegistry : public IMutableEnumValuesRegistry {\n\n            std::vector<std::unique_ptr<EnumInfo>> m_enumInfos;\n\n            EnumInfo const& registerEnum( StringRef enumName, StringRef allEnums, std::vector<int> const& values) override;\n        };\n\n        std::vector<StringRef> parseEnums( StringRef enums );\n\n    } // Detail\n\n} // Catch\n\n// end catch_enum_values_registry.h\n\n#include <map>\n#include <cassert>\n\nnamespace Catch {\n\n    IMutableEnumValuesRegistry::~IMutableEnumValuesRegistry() {}\n\n    namespace Detail {\n\n        namespace {\n            // Extracts the actual name part of an enum instance\n            // In other words, it returns the Blue part of Bikeshed::Colour::Blue\n            StringRef extractInstanceName(StringRef enumInstance) {\n                // Find last occurrence of \":\"\n                size_t name_start = enumInstance.size();\n                while (name_start > 0 && enumInstance[name_start - 1] != ':') {\n                    --name_start;\n                }\n                return enumInstance.substr(name_start, enumInstance.size() - name_start);\n            }\n        }\n\n        std::vector<StringRef> parseEnums( StringRef enums ) {\n            auto enumValues = splitStringRef( enums, ',' );\n            std::vector<StringRef> parsed;\n            parsed.reserve( enumValues.size() );\n            for( auto const& enumValue : enumValues ) {\n                parsed.push_back(trim(extractInstanceName(enumValue)));\n            }\n            return parsed;\n        }\n\n        EnumInfo::~EnumInfo() {}\n\n        StringRef EnumInfo::lookup( int value ) const {\n            for( auto const& valueToName : m_values ) {\n                if( valueToName.first == value )\n                    return valueToName.second;\n            }\n            return \"{** unexpected enum value **}\"_sr;\n        }\n\n        std::unique_ptr<EnumInfo> makeEnumInfo( StringRef enumName, StringRef allValueNames, std::vector<int> const& values ) {\n            std::unique_ptr<EnumInfo> enumInfo( new EnumInfo );\n            enumInfo->m_name = enumName;\n            enumInfo->m_values.reserve( values.size() );\n\n            const auto valueNames = Catch::Detail::parseEnums( allValueNames );\n            assert( valueNames.size() == values.size() );\n            std::size_t i = 0;\n            for( auto value : values )\n                enumInfo->m_values.emplace_back(value, valueNames[i++]);\n\n            return enumInfo;\n        }\n\n        EnumInfo const& EnumValuesRegistry::registerEnum( StringRef enumName, StringRef allValueNames, std::vector<int> const& values ) {\n            m_enumInfos.push_back(makeEnumInfo(enumName, allValueNames, values));\n            return *m_enumInfos.back();\n        }\n\n    } // Detail\n} // Catch\n\n// end catch_enum_values_registry.cpp\n// start catch_errno_guard.cpp\n\n#include <cerrno>\n\nnamespace Catch {\n        ErrnoGuard::ErrnoGuard():m_oldErrno(errno){}\n        ErrnoGuard::~ErrnoGuard() { errno = m_oldErrno; }\n}\n// end catch_errno_guard.cpp\n// start catch_exception_translator_registry.cpp\n\n// start catch_exception_translator_registry.h\n\n#include <vector>\n#include <string>\n#include <memory>\n\nnamespace Catch {\n\n    class ExceptionTranslatorRegistry : public IExceptionTranslatorRegistry {\n    public:\n        ~ExceptionTranslatorRegistry();\n        virtual void registerTranslator( const IExceptionTranslator* translator );\n        std::string translateActiveException() const override;\n        std::string tryTranslators() const;\n\n    private:\n        std::vector<std::unique_ptr<IExceptionTranslator const>> m_translators;\n    };\n}\n\n// end catch_exception_translator_registry.h\n#ifdef __OBJC__\n#import \"Foundation/Foundation.h\"\n#endif\n\nnamespace Catch {\n\n    ExceptionTranslatorRegistry::~ExceptionTranslatorRegistry() {\n    }\n\n    void ExceptionTranslatorRegistry::registerTranslator( const IExceptionTranslator* translator ) {\n        m_translators.push_back( std::unique_ptr<const IExceptionTranslator>( translator ) );\n    }\n\n#if !defined(CATCH_CONFIG_DISABLE_EXCEPTIONS)\n    std::string ExceptionTranslatorRegistry::translateActiveException() const {\n        try {\n#ifdef __OBJC__\n            // In Objective-C try objective-c exceptions first\n            @try {\n                return tryTranslators();\n            }\n            @catch (NSException *exception) {\n                return Catch::Detail::stringify( [exception description] );\n            }\n#else\n            // Compiling a mixed mode project with MSVC means that CLR\n            // exceptions will be caught in (...) as well. However, these\n            // do not fill-in std::current_exception and thus lead to crash\n            // when attempting rethrow.\n            // /EHa switch also causes structured exceptions to be caught\n            // here, but they fill-in current_exception properly, so\n            // at worst the output should be a little weird, instead of\n            // causing a crash.\n            if (std::current_exception() == nullptr) {\n                return \"Non C++ exception. Possibly a CLR exception.\";\n            }\n            return tryTranslators();\n#endif\n        }\n        catch( TestFailureException& ) {\n            std::rethrow_exception(std::current_exception());\n        }\n        catch( std::exception& ex ) {\n            return ex.what();\n        }\n        catch( std::string& msg ) {\n            return msg;\n        }\n        catch( const char* msg ) {\n            return msg;\n        }\n        catch(...) {\n            return \"Unknown exception\";\n        }\n    }\n\n    std::string ExceptionTranslatorRegistry::tryTranslators() const {\n        if (m_translators.empty()) {\n            std::rethrow_exception(std::current_exception());\n        } else {\n            return m_translators[0]->translate(m_translators.begin() + 1, m_translators.end());\n        }\n    }\n\n#else // ^^ Exceptions are enabled // Exceptions are disabled vv\n    std::string ExceptionTranslatorRegistry::translateActiveException() const {\n        CATCH_INTERNAL_ERROR(\"Attempted to translate active exception under CATCH_CONFIG_DISABLE_EXCEPTIONS!\");\n    }\n\n    std::string ExceptionTranslatorRegistry::tryTranslators() const {\n        CATCH_INTERNAL_ERROR(\"Attempted to use exception translators under CATCH_CONFIG_DISABLE_EXCEPTIONS!\");\n    }\n#endif\n\n}\n// end catch_exception_translator_registry.cpp\n// start catch_fatal_condition.cpp\n\n#include <algorithm>\n\n#if !defined( CATCH_CONFIG_WINDOWS_SEH ) && !defined( CATCH_CONFIG_POSIX_SIGNALS )\n\nnamespace Catch {\n\n    // If neither SEH nor signal handling is required, the handler impls\n    // do not have to do anything, and can be empty.\n    void FatalConditionHandler::engage_platform() {}\n    void FatalConditionHandler::disengage_platform() {}\n    FatalConditionHandler::FatalConditionHandler() = default;\n    FatalConditionHandler::~FatalConditionHandler() = default;\n\n} // end namespace Catch\n\n#endif // !CATCH_CONFIG_WINDOWS_SEH && !CATCH_CONFIG_POSIX_SIGNALS\n\n#if defined( CATCH_CONFIG_WINDOWS_SEH ) && defined( CATCH_CONFIG_POSIX_SIGNALS )\n#error \"Inconsistent configuration: Windows' SEH handling and POSIX signals cannot be enabled at the same time\"\n#endif // CATCH_CONFIG_WINDOWS_SEH && CATCH_CONFIG_POSIX_SIGNALS\n\n#if defined( CATCH_CONFIG_WINDOWS_SEH ) || defined( CATCH_CONFIG_POSIX_SIGNALS )\n\nnamespace {\n    //! Signals fatal error message to the run context\n    void reportFatal( char const * const message ) {\n        Catch::getCurrentContext().getResultCapture()->handleFatalErrorCondition( message );\n    }\n\n    //! Minimal size Catch2 needs for its own fatal error handling.\n    //! Picked anecdotally, so it might not be sufficient on all\n    //! platforms, and for all configurations.\n    constexpr std::size_t minStackSizeForErrors = 32 * 1024;\n} // end unnamed namespace\n\n#endif // CATCH_CONFIG_WINDOWS_SEH || CATCH_CONFIG_POSIX_SIGNALS\n\n#if defined( CATCH_CONFIG_WINDOWS_SEH )\n\nnamespace Catch {\n\n    struct SignalDefs { DWORD id; const char* name; };\n\n    // There is no 1-1 mapping between signals and windows exceptions.\n    // Windows can easily distinguish between SO and SigSegV,\n    // but SigInt, SigTerm, etc are handled differently.\n    static SignalDefs signalDefs[] = {\n        { static_cast<DWORD>(EXCEPTION_ILLEGAL_INSTRUCTION),  \"SIGILL - Illegal instruction signal\" },\n        { static_cast<DWORD>(EXCEPTION_STACK_OVERFLOW), \"SIGSEGV - Stack overflow\" },\n        { static_cast<DWORD>(EXCEPTION_ACCESS_VIOLATION), \"SIGSEGV - Segmentation violation signal\" },\n        { static_cast<DWORD>(EXCEPTION_INT_DIVIDE_BY_ZERO), \"Divide by zero error\" },\n    };\n\n    static LONG CALLBACK handleVectoredException(PEXCEPTION_POINTERS ExceptionInfo) {\n        for (auto const& def : signalDefs) {\n            if (ExceptionInfo->ExceptionRecord->ExceptionCode == def.id) {\n                reportFatal(def.name);\n            }\n        }\n        // If its not an exception we care about, pass it along.\n        // This stops us from eating debugger breaks etc.\n        return EXCEPTION_CONTINUE_SEARCH;\n    }\n\n    // Since we do not support multiple instantiations, we put these\n    // into global variables and rely on cleaning them up in outlined\n    // constructors/destructors\n    static PVOID exceptionHandlerHandle = nullptr;\n\n    // For MSVC, we reserve part of the stack memory for handling\n    // memory overflow structured exception.\n    FatalConditionHandler::FatalConditionHandler() {\n        ULONG guaranteeSize = static_cast<ULONG>(minStackSizeForErrors);\n        if (!SetThreadStackGuarantee(&guaranteeSize)) {\n            // We do not want to fully error out, because needing\n            // the stack reserve should be rare enough anyway.\n            Catch::cerr()\n                << \"Failed to reserve piece of stack.\"\n                << \" Stack overflows will not be reported successfully.\";\n        }\n    }\n\n    // We do not attempt to unset the stack guarantee, because\n    // Windows does not support lowering the stack size guarantee.\n    FatalConditionHandler::~FatalConditionHandler() = default;\n\n    void FatalConditionHandler::engage_platform() {\n        // Register as first handler in current chain\n        exceptionHandlerHandle = AddVectoredExceptionHandler(1, handleVectoredException);\n        if (!exceptionHandlerHandle) {\n            CATCH_RUNTIME_ERROR(\"Could not register vectored exception handler\");\n        }\n    }\n\n    void FatalConditionHandler::disengage_platform() {\n        if (!RemoveVectoredExceptionHandler(exceptionHandlerHandle)) {\n            CATCH_RUNTIME_ERROR(\"Could not unregister vectored exception handler\");\n        }\n        exceptionHandlerHandle = nullptr;\n    }\n\n} // end namespace Catch\n\n#endif // CATCH_CONFIG_WINDOWS_SEH\n\n#if defined( CATCH_CONFIG_POSIX_SIGNALS )\n\n#include <signal.h>\n\nnamespace Catch {\n\n    struct SignalDefs {\n        int id;\n        const char* name;\n    };\n\n    static SignalDefs signalDefs[] = {\n        { SIGINT,  \"SIGINT - Terminal interrupt signal\" },\n        { SIGILL,  \"SIGILL - Illegal instruction signal\" },\n        { SIGFPE,  \"SIGFPE - Floating point error signal\" },\n        { SIGSEGV, \"SIGSEGV - Segmentation violation signal\" },\n        { SIGTERM, \"SIGTERM - Termination request signal\" },\n        { SIGABRT, \"SIGABRT - Abort (abnormal termination) signal\" }\n    };\n\n// Older GCCs trigger -Wmissing-field-initializers for T foo = {}\n// which is zero initialization, but not explicit. We want to avoid\n// that.\n#if defined(__GNUC__)\n#    pragma GCC diagnostic push\n#    pragma GCC diagnostic ignored \"-Wmissing-field-initializers\"\n#endif\n\n    static char* altStackMem = nullptr;\n    static std::size_t altStackSize = 0;\n    static stack_t oldSigStack{};\n    static struct sigaction oldSigActions[sizeof(signalDefs) / sizeof(SignalDefs)]{};\n\n    static void restorePreviousSignalHandlers() {\n        // We set signal handlers back to the previous ones. Hopefully\n        // nobody overwrote them in the meantime, and doesn't expect\n        // their signal handlers to live past ours given that they\n        // installed them after ours..\n        for (std::size_t i = 0; i < sizeof(signalDefs) / sizeof(SignalDefs); ++i) {\n            sigaction(signalDefs[i].id, &oldSigActions[i], nullptr);\n        }\n        // Return the old stack\n        sigaltstack(&oldSigStack, nullptr);\n    }\n\n    static void handleSignal( int sig ) {\n        char const * name = \"<unknown signal>\";\n        for (auto const& def : signalDefs) {\n            if (sig == def.id) {\n                name = def.name;\n                break;\n            }\n        }\n        // We need to restore previous signal handlers and let them do\n        // their thing, so that the users can have the debugger break\n        // when a signal is raised, and so on.\n        restorePreviousSignalHandlers();\n        reportFatal( name );\n        raise( sig );\n    }\n\n    FatalConditionHandler::FatalConditionHandler() {\n        assert(!altStackMem && \"Cannot initialize POSIX signal handler when one already exists\");\n        if (altStackSize == 0) {\n            altStackSize = std::max(static_cast<size_t>(SIGSTKSZ), minStackSizeForErrors);\n        }\n        altStackMem = new char[altStackSize]();\n    }\n\n    FatalConditionHandler::~FatalConditionHandler() {\n        delete[] altStackMem;\n        // We signal that another instance can be constructed by zeroing\n        // out the pointer.\n        altStackMem = nullptr;\n    }\n\n    void FatalConditionHandler::engage_platform() {\n        stack_t sigStack;\n        sigStack.ss_sp = altStackMem;\n        sigStack.ss_size = altStackSize;\n        sigStack.ss_flags = 0;\n        sigaltstack(&sigStack, &oldSigStack);\n        struct sigaction sa = { };\n\n        sa.sa_handler = handleSignal;\n        sa.sa_flags = SA_ONSTACK;\n        for (std::size_t i = 0; i < sizeof(signalDefs)/sizeof(SignalDefs); ++i) {\n            sigaction(signalDefs[i].id, &sa, &oldSigActions[i]);\n        }\n    }\n\n#if defined(__GNUC__)\n#    pragma GCC diagnostic pop\n#endif\n\n    void FatalConditionHandler::disengage_platform() {\n        restorePreviousSignalHandlers();\n    }\n\n} // end namespace Catch\n\n#endif // CATCH_CONFIG_POSIX_SIGNALS\n// end catch_fatal_condition.cpp\n// start catch_generators.cpp\n\n#include <limits>\n#include <set>\n\nnamespace Catch {\n\nIGeneratorTracker::~IGeneratorTracker() {}\n\nconst char* GeneratorException::what() const noexcept {\n    return m_msg;\n}\n\nnamespace Generators {\n\n    GeneratorUntypedBase::~GeneratorUntypedBase() {}\n\n    auto acquireGeneratorTracker( StringRef generatorName, SourceLineInfo const& lineInfo ) -> IGeneratorTracker& {\n        return getResultCapture().acquireGeneratorTracker( generatorName, lineInfo );\n    }\n\n} // namespace Generators\n} // namespace Catch\n// end catch_generators.cpp\n// start catch_interfaces_capture.cpp\n\nnamespace Catch {\n    IResultCapture::~IResultCapture() = default;\n}\n// end catch_interfaces_capture.cpp\n// start catch_interfaces_config.cpp\n\nnamespace Catch {\n    IConfig::~IConfig() = default;\n}\n// end catch_interfaces_config.cpp\n// start catch_interfaces_exception.cpp\n\nnamespace Catch {\n    IExceptionTranslator::~IExceptionTranslator() = default;\n    IExceptionTranslatorRegistry::~IExceptionTranslatorRegistry() = default;\n}\n// end catch_interfaces_exception.cpp\n// start catch_interfaces_registry_hub.cpp\n\nnamespace Catch {\n    IRegistryHub::~IRegistryHub() = default;\n    IMutableRegistryHub::~IMutableRegistryHub() = default;\n}\n// end catch_interfaces_registry_hub.cpp\n// start catch_interfaces_reporter.cpp\n\n// start catch_reporter_listening.h\n\nnamespace Catch {\n\n    class ListeningReporter : public IStreamingReporter {\n        using Reporters = std::vector<IStreamingReporterPtr>;\n        Reporters m_listeners;\n        IStreamingReporterPtr m_reporter = nullptr;\n        ReporterPreferences m_preferences;\n\n    public:\n        ListeningReporter();\n\n        void addListener( IStreamingReporterPtr&& listener );\n        void addReporter( IStreamingReporterPtr&& reporter );\n\n    public: // IStreamingReporter\n\n        ReporterPreferences getPreferences() const override;\n\n        void noMatchingTestCases( std::string const& spec ) override;\n\n        void reportInvalidArguments(std::string const&arg) override;\n\n        static std::set<Verbosity> getSupportedVerbosities();\n\n#if defined(CATCH_CONFIG_ENABLE_BENCHMARKING)\n        void benchmarkPreparing(std::string const& name) override;\n        void benchmarkStarting( BenchmarkInfo const& benchmarkInfo ) override;\n        void benchmarkEnded( BenchmarkStats<> const& benchmarkStats ) override;\n        void benchmarkFailed(std::string const&) override;\n#endif // CATCH_CONFIG_ENABLE_BENCHMARKING\n\n        void testRunStarting( TestRunInfo const& testRunInfo ) override;\n        void testGroupStarting( GroupInfo const& groupInfo ) override;\n        void testCaseStarting( TestCaseInfo const& testInfo ) override;\n        void sectionStarting( SectionInfo const& sectionInfo ) override;\n        void assertionStarting( AssertionInfo const& assertionInfo ) override;\n\n        // The return value indicates if the messages buffer should be cleared:\n        bool assertionEnded( AssertionStats const& assertionStats ) override;\n        void sectionEnded( SectionStats const& sectionStats ) override;\n        void testCaseEnded( TestCaseStats const& testCaseStats ) override;\n        void testGroupEnded( TestGroupStats const& testGroupStats ) override;\n        void testRunEnded( TestRunStats const& testRunStats ) override;\n\n        void skipTest( TestCaseInfo const& testInfo ) override;\n        bool isMulti() const override;\n\n    };\n\n} // end namespace Catch\n\n// end catch_reporter_listening.h\nnamespace Catch {\n\n    ReporterConfig::ReporterConfig( IConfigPtr const& _fullConfig )\n    :   m_stream( &_fullConfig->stream() ), m_fullConfig( _fullConfig ) {}\n\n    ReporterConfig::ReporterConfig( IConfigPtr const& _fullConfig, std::ostream& _stream )\n    :   m_stream( &_stream ), m_fullConfig( _fullConfig ) {}\n\n    std::ostream& ReporterConfig::stream() const { return *m_stream; }\n    IConfigPtr ReporterConfig::fullConfig() const { return m_fullConfig; }\n\n    TestRunInfo::TestRunInfo( std::string const& _name ) : name( _name ) {}\n\n    GroupInfo::GroupInfo(  std::string const& _name,\n                           std::size_t _groupIndex,\n                           std::size_t _groupsCount )\n    :   name( _name ),\n        groupIndex( _groupIndex ),\n        groupsCounts( _groupsCount )\n    {}\n\n     AssertionStats::AssertionStats( AssertionResult const& _assertionResult,\n                                     std::vector<MessageInfo> const& _infoMessages,\n                                     Totals const& _totals )\n    :   assertionResult( _assertionResult ),\n        infoMessages( _infoMessages ),\n        totals( _totals )\n    {\n        assertionResult.m_resultData.lazyExpression.m_transientExpression = _assertionResult.m_resultData.lazyExpression.m_transientExpression;\n\n        if( assertionResult.hasMessage() ) {\n            // Copy message into messages list.\n            // !TBD This should have been done earlier, somewhere\n            MessageBuilder builder( assertionResult.getTestMacroName(), assertionResult.getSourceInfo(), assertionResult.getResultType() );\n            builder << assertionResult.getMessage();\n            builder.m_info.message = builder.m_stream.str();\n\n            infoMessages.push_back( builder.m_info );\n        }\n    }\n\n     AssertionStats::~AssertionStats() = default;\n\n    SectionStats::SectionStats(  SectionInfo const& _sectionInfo,\n                                 Counts const& _assertions,\n                                 double _durationInSeconds,\n                                 bool _missingAssertions )\n    :   sectionInfo( _sectionInfo ),\n        assertions( _assertions ),\n        durationInSeconds( _durationInSeconds ),\n        missingAssertions( _missingAssertions )\n    {}\n\n    SectionStats::~SectionStats() = default;\n\n    TestCaseStats::TestCaseStats(  TestCaseInfo const& _testInfo,\n                                   Totals const& _totals,\n                                   std::string const& _stdOut,\n                                   std::string const& _stdErr,\n                                   bool _aborting )\n    : testInfo( _testInfo ),\n        totals( _totals ),\n        stdOut( _stdOut ),\n        stdErr( _stdErr ),\n        aborting( _aborting )\n    {}\n\n    TestCaseStats::~TestCaseStats() = default;\n\n    TestGroupStats::TestGroupStats( GroupInfo const& _groupInfo,\n                                    Totals const& _totals,\n                                    bool _aborting )\n    :   groupInfo( _groupInfo ),\n        totals( _totals ),\n        aborting( _aborting )\n    {}\n\n    TestGroupStats::TestGroupStats( GroupInfo const& _groupInfo )\n    :   groupInfo( _groupInfo ),\n        aborting( false )\n    {}\n\n    TestGroupStats::~TestGroupStats() = default;\n\n    TestRunStats::TestRunStats(   TestRunInfo const& _runInfo,\n                    Totals const& _totals,\n                    bool _aborting )\n    :   runInfo( _runInfo ),\n        totals( _totals ),\n        aborting( _aborting )\n    {}\n\n    TestRunStats::~TestRunStats() = default;\n\n    void IStreamingReporter::fatalErrorEncountered( StringRef ) {}\n    bool IStreamingReporter::isMulti() const { return false; }\n\n    IReporterFactory::~IReporterFactory() = default;\n    IReporterRegistry::~IReporterRegistry() = default;\n\n} // end namespace Catch\n// end catch_interfaces_reporter.cpp\n// start catch_interfaces_runner.cpp\n\nnamespace Catch {\n    IRunner::~IRunner() = default;\n}\n// end catch_interfaces_runner.cpp\n// start catch_interfaces_testcase.cpp\n\nnamespace Catch {\n    ITestInvoker::~ITestInvoker() = default;\n    ITestCaseRegistry::~ITestCaseRegistry() = default;\n}\n// end catch_interfaces_testcase.cpp\n// start catch_leak_detector.cpp\n\n#ifdef CATCH_CONFIG_WINDOWS_CRTDBG\n#include <crtdbg.h>\n\nnamespace Catch {\n\n    LeakDetector::LeakDetector() {\n        int flag = _CrtSetDbgFlag(_CRTDBG_REPORT_FLAG);\n        flag |= _CRTDBG_LEAK_CHECK_DF;\n        flag |= _CRTDBG_ALLOC_MEM_DF;\n        _CrtSetDbgFlag(flag);\n        _CrtSetReportMode(_CRT_WARN, _CRTDBG_MODE_FILE | _CRTDBG_MODE_DEBUG);\n        _CrtSetReportFile(_CRT_WARN, _CRTDBG_FILE_STDERR);\n        // Change this to leaking allocation's number to break there\n        _CrtSetBreakAlloc(-1);\n    }\n}\n\n#else\n\n    Catch::LeakDetector::LeakDetector() {}\n\n#endif\n\nCatch::LeakDetector::~LeakDetector() {\n    Catch::cleanUp();\n}\n// end catch_leak_detector.cpp\n// start catch_list.cpp\n\n// start catch_list.h\n\n#include <set>\n\nnamespace Catch {\n\n    std::size_t listTests( Config const& config );\n\n    std::size_t listTestsNamesOnly( Config const& config );\n\n    struct TagInfo {\n        void add( std::string const& spelling );\n        std::string all() const;\n\n        std::set<std::string> spellings;\n        std::size_t count = 0;\n    };\n\n    std::size_t listTags( Config const& config );\n\n    std::size_t listReporters();\n\n    Option<std::size_t> list( std::shared_ptr<Config> const& config );\n\n} // end namespace Catch\n\n// end catch_list.h\n// start catch_text.h\n\nnamespace Catch {\n    using namespace clara::TextFlow;\n}\n\n// end catch_text.h\n#include <limits>\n#include <algorithm>\n#include <iomanip>\n\nnamespace Catch {\n\n    std::size_t listTests( Config const& config ) {\n        TestSpec const& testSpec = config.testSpec();\n        if( config.hasTestFilters() )\n            Catch::cout() << \"Matching test cases:\\n\";\n        else {\n            Catch::cout() << \"All available test cases:\\n\";\n        }\n\n        auto matchedTestCases = filterTests( getAllTestCasesSorted( config ), testSpec, config );\n        for( auto const& testCaseInfo : matchedTestCases ) {\n            Colour::Code colour = testCaseInfo.isHidden()\n                ? Colour::SecondaryText\n                : Colour::None;\n            Colour colourGuard( colour );\n\n            Catch::cout() << Column( testCaseInfo.name ).initialIndent( 2 ).indent( 4 ) << \"\\n\";\n            if( config.verbosity() >= Verbosity::High ) {\n                Catch::cout() << Column( Catch::Detail::stringify( testCaseInfo.lineInfo ) ).indent(4) << std::endl;\n                std::string description = testCaseInfo.description;\n                if( description.empty() )\n                    description = \"(NO DESCRIPTION)\";\n                Catch::cout() << Column( description ).indent(4) << std::endl;\n            }\n            if( !testCaseInfo.tags.empty() )\n                Catch::cout() << Column( testCaseInfo.tagsAsString() ).indent( 6 ) << \"\\n\";\n        }\n\n        if( !config.hasTestFilters() )\n            Catch::cout() << pluralise( matchedTestCases.size(), \"test case\" ) << '\\n' << std::endl;\n        else\n            Catch::cout() << pluralise( matchedTestCases.size(), \"matching test case\" ) << '\\n' << std::endl;\n        return matchedTestCases.size();\n    }\n\n    std::size_t listTestsNamesOnly( Config const& config ) {\n        TestSpec const& testSpec = config.testSpec();\n        std::size_t matchedTests = 0;\n        std::vector<TestCase> matchedTestCases = filterTests( getAllTestCasesSorted( config ), testSpec, config );\n        for( auto const& testCaseInfo : matchedTestCases ) {\n            matchedTests++;\n            if( startsWith( testCaseInfo.name, '#' ) )\n               Catch::cout() << '\"' << testCaseInfo.name << '\"';\n            else\n               Catch::cout() << testCaseInfo.name;\n            if ( config.verbosity() >= Verbosity::High )\n                Catch::cout() << \"\\t@\" << testCaseInfo.lineInfo;\n            Catch::cout() << std::endl;\n        }\n        return matchedTests;\n    }\n\n    void TagInfo::add( std::string const& spelling ) {\n        ++count;\n        spellings.insert( spelling );\n    }\n\n    std::string TagInfo::all() const {\n        size_t size = 0;\n        for (auto const& spelling : spellings) {\n            // Add 2 for the brackes\n            size += spelling.size() + 2;\n        }\n\n        std::string out; out.reserve(size);\n        for (auto const& spelling : spellings) {\n            out += '[';\n            out += spelling;\n            out += ']';\n        }\n        return out;\n    }\n\n    std::size_t listTags( Config const& config ) {\n        TestSpec const& testSpec = config.testSpec();\n        if( config.hasTestFilters() )\n            Catch::cout() << \"Tags for matching test cases:\\n\";\n        else {\n            Catch::cout() << \"All available tags:\\n\";\n        }\n\n        std::map<std::string, TagInfo> tagCounts;\n\n        std::vector<TestCase> matchedTestCases = filterTests( getAllTestCasesSorted( config ), testSpec, config );\n        for( auto const& testCase : matchedTestCases ) {\n            for( auto const& tagName : testCase.getTestCaseInfo().tags ) {\n                std::string lcaseTagName = toLower( tagName );\n                auto countIt = tagCounts.find( lcaseTagName );\n                if( countIt == tagCounts.end() )\n                    countIt = tagCounts.insert( std::make_pair( lcaseTagName, TagInfo() ) ).first;\n                countIt->second.add( tagName );\n            }\n        }\n\n        for( auto const& tagCount : tagCounts ) {\n            ReusableStringStream rss;\n            rss << \"  \" << std::setw(2) << tagCount.second.count << \"  \";\n            auto str = rss.str();\n            auto wrapper = Column( tagCount.second.all() )\n                                                    .initialIndent( 0 )\n                                                    .indent( str.size() )\n                                                    .width( CATCH_CONFIG_CONSOLE_WIDTH-10 );\n            Catch::cout() << str << wrapper << '\\n';\n        }\n        Catch::cout() << pluralise( tagCounts.size(), \"tag\" ) << '\\n' << std::endl;\n        return tagCounts.size();\n    }\n\n    std::size_t listReporters() {\n        Catch::cout() << \"Available reporters:\\n\";\n        IReporterRegistry::FactoryMap const& factories = getRegistryHub().getReporterRegistry().getFactories();\n        std::size_t maxNameLen = 0;\n        for( auto const& factoryKvp : factories )\n            maxNameLen = (std::max)( maxNameLen, factoryKvp.first.size() );\n\n        for( auto const& factoryKvp : factories ) {\n            Catch::cout()\n                    << Column( factoryKvp.first + \":\" )\n                            .indent(2)\n                            .width( 5+maxNameLen )\n                    +  Column( factoryKvp.second->getDescription() )\n                            .initialIndent(0)\n                            .indent(2)\n                            .width( CATCH_CONFIG_CONSOLE_WIDTH - maxNameLen-8 )\n                    << \"\\n\";\n        }\n        Catch::cout() << std::endl;\n        return factories.size();\n    }\n\n    Option<std::size_t> list( std::shared_ptr<Config> const& config ) {\n        Option<std::size_t> listedCount;\n        getCurrentMutableContext().setConfig( config );\n        if( config->listTests() )\n            listedCount = listedCount.valueOr(0) + listTests( *config );\n        if( config->listTestNamesOnly() )\n            listedCount = listedCount.valueOr(0) + listTestsNamesOnly( *config );\n        if( config->listTags() )\n            listedCount = listedCount.valueOr(0) + listTags( *config );\n        if( config->listReporters() )\n            listedCount = listedCount.valueOr(0) + listReporters();\n        return listedCount;\n    }\n\n} // end namespace Catch\n// end catch_list.cpp\n// start catch_matchers.cpp\n\nnamespace Catch {\nnamespace Matchers {\n    namespace Impl {\n\n        std::string MatcherUntypedBase::toString() const {\n            if( m_cachedToString.empty() )\n                m_cachedToString = describe();\n            return m_cachedToString;\n        }\n\n        MatcherUntypedBase::~MatcherUntypedBase() = default;\n\n    } // namespace Impl\n} // namespace Matchers\n\nusing namespace Matchers;\nusing Matchers::Impl::MatcherBase;\n\n} // namespace Catch\n// end catch_matchers.cpp\n// start catch_matchers_exception.cpp\n\nnamespace Catch {\nnamespace Matchers {\nnamespace Exception {\n\nbool ExceptionMessageMatcher::match(std::exception const& ex) const {\n    return ex.what() == m_message;\n}\n\nstd::string ExceptionMessageMatcher::describe() const {\n    return \"exception message matches \\\"\" + m_message + \"\\\"\";\n}\n\n}\nException::ExceptionMessageMatcher Message(std::string const& message) {\n    return Exception::ExceptionMessageMatcher(message);\n}\n\n// namespace Exception\n} // namespace Matchers\n} // namespace Catch\n// end catch_matchers_exception.cpp\n// start catch_matchers_floating.cpp\n\n// start catch_polyfills.hpp\n\nnamespace Catch {\n    bool isnan(float f);\n    bool isnan(double d);\n}\n\n// end catch_polyfills.hpp\n// start catch_to_string.hpp\n\n#include <string>\n\nnamespace Catch {\n    template <typename T>\n    std::string to_string(T const& t) {\n#if defined(CATCH_CONFIG_CPP11_TO_STRING)\n        return std::to_string(t);\n#else\n        ReusableStringStream rss;\n        rss << t;\n        return rss.str();\n#endif\n    }\n} // end namespace Catch\n\n// end catch_to_string.hpp\n#include <algorithm>\n#include <cmath>\n#include <cstdlib>\n#include <cstdint>\n#include <cstring>\n#include <sstream>\n#include <type_traits>\n#include <iomanip>\n#include <limits>\n\nnamespace Catch {\nnamespace {\n\n    int32_t convert(float f) {\n        static_assert(sizeof(float) == sizeof(int32_t), \"Important ULP matcher assumption violated\");\n        int32_t i;\n        std::memcpy(&i, &f, sizeof(f));\n        return i;\n    }\n\n    int64_t convert(double d) {\n        static_assert(sizeof(double) == sizeof(int64_t), \"Important ULP matcher assumption violated\");\n        int64_t i;\n        std::memcpy(&i, &d, sizeof(d));\n        return i;\n    }\n\n    template <typename FP>\n    bool almostEqualUlps(FP lhs, FP rhs, uint64_t maxUlpDiff) {\n        // Comparison with NaN should always be false.\n        // This way we can rule it out before getting into the ugly details\n        if (Catch::isnan(lhs) || Catch::isnan(rhs)) {\n            return false;\n        }\n\n        auto lc = convert(lhs);\n        auto rc = convert(rhs);\n\n        if ((lc < 0) != (rc < 0)) {\n            // Potentially we can have +0 and -0\n            return lhs == rhs;\n        }\n\n        // static cast as a workaround for IBM XLC\n        auto ulpDiff = std::abs(static_cast<FP>(lc - rc));\n        return static_cast<uint64_t>(ulpDiff) <= maxUlpDiff;\n    }\n\n#if defined(CATCH_CONFIG_GLOBAL_NEXTAFTER)\n\n    float nextafter(float x, float y) {\n        return ::nextafterf(x, y);\n    }\n\n    double nextafter(double x, double y) {\n        return ::nextafter(x, y);\n    }\n\n#endif // ^^^ CATCH_CONFIG_GLOBAL_NEXTAFTER ^^^\n\ntemplate <typename FP>\nFP step(FP start, FP direction, uint64_t steps) {\n    for (uint64_t i = 0; i < steps; ++i) {\n#if defined(CATCH_CONFIG_GLOBAL_NEXTAFTER)\n        start = Catch::nextafter(start, direction);\n#else\n        start = std::nextafter(start, direction);\n#endif\n    }\n    return start;\n}\n\n// Performs equivalent check of std::fabs(lhs - rhs) <= margin\n// But without the subtraction to allow for INFINITY in comparison\nbool marginComparison(double lhs, double rhs, double margin) {\n    return (lhs + margin >= rhs) && (rhs + margin >= lhs);\n}\n\ntemplate <typename FloatingPoint>\nvoid write(std::ostream& out, FloatingPoint num) {\n    out << std::scientific\n        << std::setprecision(std::numeric_limits<FloatingPoint>::max_digits10 - 1)\n        << num;\n}\n\n} // end anonymous namespace\n\nnamespace Matchers {\nnamespace Floating {\n\n    enum class FloatingPointKind : uint8_t {\n        Float,\n        Double\n    };\n\n    WithinAbsMatcher::WithinAbsMatcher(double target, double margin)\n        :m_target{ target }, m_margin{ margin } {\n        CATCH_ENFORCE(margin >= 0, \"Invalid margin: \" << margin << '.'\n            << \" Margin has to be non-negative.\");\n    }\n\n    // Performs equivalent check of std::fabs(lhs - rhs) <= margin\n    // But without the subtraction to allow for INFINITY in comparison\n    bool WithinAbsMatcher::match(double const& matchee) const {\n        return (matchee + m_margin >= m_target) && (m_target + m_margin >= matchee);\n    }\n\n    std::string WithinAbsMatcher::describe() const {\n        return \"is within \" + ::Catch::Detail::stringify(m_margin) + \" of \" + ::Catch::Detail::stringify(m_target);\n    }\n\n    WithinUlpsMatcher::WithinUlpsMatcher(double target, uint64_t ulps, FloatingPointKind baseType)\n        :m_target{ target }, m_ulps{ ulps }, m_type{ baseType } {\n        CATCH_ENFORCE(m_type == FloatingPointKind::Double\n                   || m_ulps < (std::numeric_limits<uint32_t>::max)(),\n            \"Provided ULP is impossibly large for a float comparison.\");\n    }\n\n#if defined(__clang__)\n#pragma clang diagnostic push\n// Clang <3.5 reports on the default branch in the switch below\n#pragma clang diagnostic ignored \"-Wunreachable-code\"\n#endif\n\n    bool WithinUlpsMatcher::match(double const& matchee) const {\n        switch (m_type) {\n        case FloatingPointKind::Float:\n            return almostEqualUlps<float>(static_cast<float>(matchee), static_cast<float>(m_target), m_ulps);\n        case FloatingPointKind::Double:\n            return almostEqualUlps<double>(matchee, m_target, m_ulps);\n        default:\n            CATCH_INTERNAL_ERROR( \"Unknown FloatingPointKind value\" );\n        }\n    }\n\n#if defined(__clang__)\n#pragma clang diagnostic pop\n#endif\n\n    std::string WithinUlpsMatcher::describe() const {\n        std::stringstream ret;\n\n        ret << \"is within \" << m_ulps << \" ULPs of \";\n\n        if (m_type == FloatingPointKind::Float) {\n            write(ret, static_cast<float>(m_target));\n            ret << 'f';\n        } else {\n            write(ret, m_target);\n        }\n\n        ret << \" ([\";\n        if (m_type == FloatingPointKind::Double) {\n            write(ret, step(m_target, static_cast<double>(-INFINITY), m_ulps));\n            ret << \", \";\n            write(ret, step(m_target, static_cast<double>( INFINITY), m_ulps));\n        } else {\n            // We have to cast INFINITY to float because of MinGW, see #1782\n            write(ret, step(static_cast<float>(m_target), static_cast<float>(-INFINITY), m_ulps));\n            ret << \", \";\n            write(ret, step(static_cast<float>(m_target), static_cast<float>( INFINITY), m_ulps));\n        }\n        ret << \"])\";\n\n        return ret.str();\n    }\n\n    WithinRelMatcher::WithinRelMatcher(double target, double epsilon):\n        m_target(target),\n        m_epsilon(epsilon){\n        CATCH_ENFORCE(m_epsilon >= 0., \"Relative comparison with epsilon <  0 does not make sense.\");\n        CATCH_ENFORCE(m_epsilon  < 1., \"Relative comparison with epsilon >= 1 does not make sense.\");\n    }\n\n    bool WithinRelMatcher::match(double const& matchee) const {\n        const auto relMargin = m_epsilon * (std::max)(std::fabs(matchee), std::fabs(m_target));\n        return marginComparison(matchee, m_target,\n                                std::isinf(relMargin)? 0 : relMargin);\n    }\n\n    std::string WithinRelMatcher::describe() const {\n        Catch::ReusableStringStream sstr;\n        sstr << \"and \" << m_target << \" are within \" << m_epsilon * 100. << \"% of each other\";\n        return sstr.str();\n    }\n\n}// namespace Floating\n\nFloating::WithinUlpsMatcher WithinULP(double target, uint64_t maxUlpDiff) {\n    return Floating::WithinUlpsMatcher(target, maxUlpDiff, Floating::FloatingPointKind::Double);\n}\n\nFloating::WithinUlpsMatcher WithinULP(float target, uint64_t maxUlpDiff) {\n    return Floating::WithinUlpsMatcher(target, maxUlpDiff, Floating::FloatingPointKind::Float);\n}\n\nFloating::WithinAbsMatcher WithinAbs(double target, double margin) {\n    return Floating::WithinAbsMatcher(target, margin);\n}\n\nFloating::WithinRelMatcher WithinRel(double target, double eps) {\n    return Floating::WithinRelMatcher(target, eps);\n}\n\nFloating::WithinRelMatcher WithinRel(double target) {\n    return Floating::WithinRelMatcher(target, std::numeric_limits<double>::epsilon() * 100);\n}\n\nFloating::WithinRelMatcher WithinRel(float target, float eps) {\n    return Floating::WithinRelMatcher(target, eps);\n}\n\nFloating::WithinRelMatcher WithinRel(float target) {\n    return Floating::WithinRelMatcher(target, std::numeric_limits<float>::epsilon() * 100);\n}\n\n} // namespace Matchers\n} // namespace Catch\n// end catch_matchers_floating.cpp\n// start catch_matchers_generic.cpp\n\nstd::string Catch::Matchers::Generic::Detail::finalizeDescription(const std::string& desc) {\n    if (desc.empty()) {\n        return \"matches undescribed predicate\";\n    } else {\n        return \"matches predicate: \\\"\" + desc + '\"';\n    }\n}\n// end catch_matchers_generic.cpp\n// start catch_matchers_string.cpp\n\n#include <regex>\n\nnamespace Catch {\nnamespace Matchers {\n\n    namespace StdString {\n\n        CasedString::CasedString( std::string const& str, CaseSensitive::Choice caseSensitivity )\n        :   m_caseSensitivity( caseSensitivity ),\n            m_str( adjustString( str ) )\n        {}\n        std::string CasedString::adjustString( std::string const& str ) const {\n            return m_caseSensitivity == CaseSensitive::No\n                   ? toLower( str )\n                   : str;\n        }\n        std::string CasedString::caseSensitivitySuffix() const {\n            return m_caseSensitivity == CaseSensitive::No\n                   ? \" (case insensitive)\"\n                   : std::string();\n        }\n\n        StringMatcherBase::StringMatcherBase( std::string const& operation, CasedString const& comparator )\n        : m_comparator( comparator ),\n          m_operation( operation ) {\n        }\n\n        std::string StringMatcherBase::describe() const {\n            std::string description;\n            description.reserve(5 + m_operation.size() + m_comparator.m_str.size() +\n                                        m_comparator.caseSensitivitySuffix().size());\n            description += m_operation;\n            description += \": \\\"\";\n            description += m_comparator.m_str;\n            description += \"\\\"\";\n            description += m_comparator.caseSensitivitySuffix();\n            return description;\n        }\n\n        EqualsMatcher::EqualsMatcher( CasedString const& comparator ) : StringMatcherBase( \"equals\", comparator ) {}\n\n        bool EqualsMatcher::match( std::string const& source ) const {\n            return m_comparator.adjustString( source ) == m_comparator.m_str;\n        }\n\n        ContainsMatcher::ContainsMatcher( CasedString const& comparator ) : StringMatcherBase( \"contains\", comparator ) {}\n\n        bool ContainsMatcher::match( std::string const& source ) const {\n            return contains( m_comparator.adjustString( source ), m_comparator.m_str );\n        }\n\n        StartsWithMatcher::StartsWithMatcher( CasedString const& comparator ) : StringMatcherBase( \"starts with\", comparator ) {}\n\n        bool StartsWithMatcher::match( std::string const& source ) const {\n            return startsWith( m_comparator.adjustString( source ), m_comparator.m_str );\n        }\n\n        EndsWithMatcher::EndsWithMatcher( CasedString const& comparator ) : StringMatcherBase( \"ends with\", comparator ) {}\n\n        bool EndsWithMatcher::match( std::string const& source ) const {\n            return endsWith( m_comparator.adjustString( source ), m_comparator.m_str );\n        }\n\n        RegexMatcher::RegexMatcher(std::string regex, CaseSensitive::Choice caseSensitivity): m_regex(std::move(regex)), m_caseSensitivity(caseSensitivity) {}\n\n        bool RegexMatcher::match(std::string const& matchee) const {\n            auto flags = std::regex::ECMAScript; // ECMAScript is the default syntax option anyway\n            if (m_caseSensitivity == CaseSensitive::Choice::No) {\n                flags |= std::regex::icase;\n            }\n            auto reg = std::regex(m_regex, flags);\n            return std::regex_match(matchee, reg);\n        }\n\n        std::string RegexMatcher::describe() const {\n            return \"matches \" + ::Catch::Detail::stringify(m_regex) + ((m_caseSensitivity == CaseSensitive::Choice::Yes)? \" case sensitively\" : \" case insensitively\");\n        }\n\n    } // namespace StdString\n\n    StdString::EqualsMatcher Equals( std::string const& str, CaseSensitive::Choice caseSensitivity ) {\n        return StdString::EqualsMatcher( StdString::CasedString( str, caseSensitivity) );\n    }\n    StdString::ContainsMatcher Contains( std::string const& str, CaseSensitive::Choice caseSensitivity ) {\n        return StdString::ContainsMatcher( StdString::CasedString( str, caseSensitivity) );\n    }\n    StdString::EndsWithMatcher EndsWith( std::string const& str, CaseSensitive::Choice caseSensitivity ) {\n        return StdString::EndsWithMatcher( StdString::CasedString( str, caseSensitivity) );\n    }\n    StdString::StartsWithMatcher StartsWith( std::string const& str, CaseSensitive::Choice caseSensitivity ) {\n        return StdString::StartsWithMatcher( StdString::CasedString( str, caseSensitivity) );\n    }\n\n    StdString::RegexMatcher Matches(std::string const& regex, CaseSensitive::Choice caseSensitivity) {\n        return StdString::RegexMatcher(regex, caseSensitivity);\n    }\n\n} // namespace Matchers\n} // namespace Catch\n// end catch_matchers_string.cpp\n// start catch_message.cpp\n\n// start catch_uncaught_exceptions.h\n\nnamespace Catch {\n    bool uncaught_exceptions();\n} // end namespace Catch\n\n// end catch_uncaught_exceptions.h\n#include <cassert>\n#include <stack>\n\nnamespace Catch {\n\n    MessageInfo::MessageInfo(   StringRef const& _macroName,\n                                SourceLineInfo const& _lineInfo,\n                                ResultWas::OfType _type )\n    :   macroName( _macroName ),\n        lineInfo( _lineInfo ),\n        type( _type ),\n        sequence( ++globalCount )\n    {}\n\n    bool MessageInfo::operator==( MessageInfo const& other ) const {\n        return sequence == other.sequence;\n    }\n\n    bool MessageInfo::operator<( MessageInfo const& other ) const {\n        return sequence < other.sequence;\n    }\n\n    // This may need protecting if threading support is added\n    unsigned int MessageInfo::globalCount = 0;\n\n    ////////////////////////////////////////////////////////////////////////////\n\n    Catch::MessageBuilder::MessageBuilder( StringRef const& macroName,\n                                           SourceLineInfo const& lineInfo,\n                                           ResultWas::OfType type )\n        :m_info(macroName, lineInfo, type) {}\n\n    ////////////////////////////////////////////////////////////////////////////\n\n    ScopedMessage::ScopedMessage( MessageBuilder const& builder )\n    : m_info( builder.m_info ), m_moved()\n    {\n        m_info.message = builder.m_stream.str();\n        getResultCapture().pushScopedMessage( m_info );\n    }\n\n    ScopedMessage::ScopedMessage( ScopedMessage&& old )\n    : m_info( old.m_info ), m_moved()\n    {\n        old.m_moved = true;\n    }\n\n    ScopedMessage::~ScopedMessage() {\n        if ( !uncaught_exceptions() && !m_moved ){\n            getResultCapture().popScopedMessage(m_info);\n        }\n    }\n\n    Capturer::Capturer( StringRef macroName, SourceLineInfo const& lineInfo, ResultWas::OfType resultType, StringRef names ) {\n        auto trimmed = [&] (size_t start, size_t end) {\n            while (names[start] == ',' || isspace(static_cast<unsigned char>(names[start]))) {\n                ++start;\n            }\n            while (names[end] == ',' || isspace(static_cast<unsigned char>(names[end]))) {\n                --end;\n            }\n            return names.substr(start, end - start + 1);\n        };\n        auto skipq = [&] (size_t start, char quote) {\n            for (auto i = start + 1; i < names.size() ; ++i) {\n                if (names[i] == quote)\n                    return i;\n                if (names[i] == '\\\\')\n                    ++i;\n            }\n            CATCH_INTERNAL_ERROR(\"CAPTURE parsing encountered unmatched quote\");\n        };\n\n        size_t start = 0;\n        std::stack<char> openings;\n        for (size_t pos = 0; pos < names.size(); ++pos) {\n            char c = names[pos];\n            switch (c) {\n            case '[':\n            case '{':\n            case '(':\n            // It is basically impossible to disambiguate between\n            // comparison and start of template args in this context\n//            case '<':\n                openings.push(c);\n                break;\n            case ']':\n            case '}':\n            case ')':\n//           case '>':\n                openings.pop();\n                break;\n            case '\"':\n            case '\\'':\n                pos = skipq(pos, c);\n                break;\n            case ',':\n                if (start != pos && openings.empty()) {\n                    m_messages.emplace_back(macroName, lineInfo, resultType);\n                    m_messages.back().message = static_cast<std::string>(trimmed(start, pos));\n                    m_messages.back().message += \" := \";\n                    start = pos;\n                }\n            }\n        }\n        assert(openings.empty() && \"Mismatched openings\");\n        m_messages.emplace_back(macroName, lineInfo, resultType);\n        m_messages.back().message = static_cast<std::string>(trimmed(start, names.size() - 1));\n        m_messages.back().message += \" := \";\n    }\n    Capturer::~Capturer() {\n        if ( !uncaught_exceptions() ){\n            assert( m_captured == m_messages.size() );\n            for( size_t i = 0; i < m_captured; ++i  )\n                m_resultCapture.popScopedMessage( m_messages[i] );\n        }\n    }\n\n    void Capturer::captureValue( size_t index, std::string const& value ) {\n        assert( index < m_messages.size() );\n        m_messages[index].message += value;\n        m_resultCapture.pushScopedMessage( m_messages[index] );\n        m_captured++;\n    }\n\n} // end namespace Catch\n// end catch_message.cpp\n// start catch_output_redirect.cpp\n\n// start catch_output_redirect.h\n#ifndef TWOBLUECUBES_CATCH_OUTPUT_REDIRECT_H\n#define TWOBLUECUBES_CATCH_OUTPUT_REDIRECT_H\n\n#include <cstdio>\n#include <iosfwd>\n#include <string>\n\nnamespace Catch {\n\n    class RedirectedStream {\n        std::ostream& m_originalStream;\n        std::ostream& m_redirectionStream;\n        std::streambuf* m_prevBuf;\n\n    public:\n        RedirectedStream( std::ostream& originalStream, std::ostream& redirectionStream );\n        ~RedirectedStream();\n    };\n\n    class RedirectedStdOut {\n        ReusableStringStream m_rss;\n        RedirectedStream m_cout;\n    public:\n        RedirectedStdOut();\n        auto str() const -> std::string;\n    };\n\n    // StdErr has two constituent streams in C++, std::cerr and std::clog\n    // This means that we need to redirect 2 streams into 1 to keep proper\n    // order of writes\n    class RedirectedStdErr {\n        ReusableStringStream m_rss;\n        RedirectedStream m_cerr;\n        RedirectedStream m_clog;\n    public:\n        RedirectedStdErr();\n        auto str() const -> std::string;\n    };\n\n    class RedirectedStreams {\n    public:\n        RedirectedStreams(RedirectedStreams const&) = delete;\n        RedirectedStreams& operator=(RedirectedStreams const&) = delete;\n        RedirectedStreams(RedirectedStreams&&) = delete;\n        RedirectedStreams& operator=(RedirectedStreams&&) = delete;\n\n        RedirectedStreams(std::string& redirectedCout, std::string& redirectedCerr);\n        ~RedirectedStreams();\n    private:\n        std::string& m_redirectedCout;\n        std::string& m_redirectedCerr;\n        RedirectedStdOut m_redirectedStdOut;\n        RedirectedStdErr m_redirectedStdErr;\n    };\n\n#if defined(CATCH_CONFIG_NEW_CAPTURE)\n\n    // Windows's implementation of std::tmpfile is terrible (it tries\n    // to create a file inside system folder, thus requiring elevated\n    // privileges for the binary), so we have to use tmpnam(_s) and\n    // create the file ourselves there.\n    class TempFile {\n    public:\n        TempFile(TempFile const&) = delete;\n        TempFile& operator=(TempFile const&) = delete;\n        TempFile(TempFile&&) = delete;\n        TempFile& operator=(TempFile&&) = delete;\n\n        TempFile();\n        ~TempFile();\n\n        std::FILE* getFile();\n        std::string getContents();\n\n    private:\n        std::FILE* m_file = nullptr;\n    #if defined(_MSC_VER)\n        char m_buffer[L_tmpnam] = { 0 };\n    #endif\n    };\n\n    class OutputRedirect {\n    public:\n        OutputRedirect(OutputRedirect const&) = delete;\n        OutputRedirect& operator=(OutputRedirect const&) = delete;\n        OutputRedirect(OutputRedirect&&) = delete;\n        OutputRedirect& operator=(OutputRedirect&&) = delete;\n\n        OutputRedirect(std::string& stdout_dest, std::string& stderr_dest);\n        ~OutputRedirect();\n\n    private:\n        int m_originalStdout = -1;\n        int m_originalStderr = -1;\n        TempFile m_stdoutFile;\n        TempFile m_stderrFile;\n        std::string& m_stdoutDest;\n        std::string& m_stderrDest;\n    };\n\n#endif\n\n} // end namespace Catch\n\n#endif // TWOBLUECUBES_CATCH_OUTPUT_REDIRECT_H\n// end catch_output_redirect.h\n#include <cstdio>\n#include <cstring>\n#include <fstream>\n#include <sstream>\n#include <stdexcept>\n\n#if defined(CATCH_CONFIG_NEW_CAPTURE)\n    #if defined(_MSC_VER)\n    #include <io.h>      //_dup and _dup2\n    #define dup _dup\n    #define dup2 _dup2\n    #define fileno _fileno\n    #else\n    #include <unistd.h>  // dup and dup2\n    #endif\n#endif\n\nnamespace Catch {\n\n    RedirectedStream::RedirectedStream( std::ostream& originalStream, std::ostream& redirectionStream )\n    :   m_originalStream( originalStream ),\n        m_redirectionStream( redirectionStream ),\n        m_prevBuf( m_originalStream.rdbuf() )\n    {\n        m_originalStream.rdbuf( m_redirectionStream.rdbuf() );\n    }\n\n    RedirectedStream::~RedirectedStream() {\n        m_originalStream.rdbuf( m_prevBuf );\n    }\n\n    RedirectedStdOut::RedirectedStdOut() : m_cout( Catch::cout(), m_rss.get() ) {}\n    auto RedirectedStdOut::str() const -> std::string { return m_rss.str(); }\n\n    RedirectedStdErr::RedirectedStdErr()\n    :   m_cerr( Catch::cerr(), m_rss.get() ),\n        m_clog( Catch::clog(), m_rss.get() )\n    {}\n    auto RedirectedStdErr::str() const -> std::string { return m_rss.str(); }\n\n    RedirectedStreams::RedirectedStreams(std::string& redirectedCout, std::string& redirectedCerr)\n    :   m_redirectedCout(redirectedCout),\n        m_redirectedCerr(redirectedCerr)\n    {}\n\n    RedirectedStreams::~RedirectedStreams() {\n        m_redirectedCout += m_redirectedStdOut.str();\n        m_redirectedCerr += m_redirectedStdErr.str();\n    }\n\n#if defined(CATCH_CONFIG_NEW_CAPTURE)\n\n#if defined(_MSC_VER)\n    TempFile::TempFile() {\n        if (tmpnam_s(m_buffer)) {\n            CATCH_RUNTIME_ERROR(\"Could not get a temp filename\");\n        }\n        if (fopen_s(&m_file, m_buffer, \"w+\")) {\n            char buffer[100];\n            if (strerror_s(buffer, errno)) {\n                CATCH_RUNTIME_ERROR(\"Could not translate errno to a string\");\n            }\n            CATCH_RUNTIME_ERROR(\"Could not open the temp file: '\" << m_buffer << \"' because: \" << buffer);\n        }\n    }\n#else\n    TempFile::TempFile() {\n        m_file = std::tmpfile();\n        if (!m_file) {\n            CATCH_RUNTIME_ERROR(\"Could not create a temp file.\");\n        }\n    }\n\n#endif\n\n    TempFile::~TempFile() {\n         // TBD: What to do about errors here?\n         std::fclose(m_file);\n         // We manually create the file on Windows only, on Linux\n         // it will be autodeleted\n#if defined(_MSC_VER)\n         std::remove(m_buffer);\n#endif\n    }\n\n    FILE* TempFile::getFile() {\n        return m_file;\n    }\n\n    std::string TempFile::getContents() {\n        std::stringstream sstr;\n        char buffer[100] = {};\n        std::rewind(m_file);\n        while (std::fgets(buffer, sizeof(buffer), m_file)) {\n            sstr << buffer;\n        }\n        return sstr.str();\n    }\n\n    OutputRedirect::OutputRedirect(std::string& stdout_dest, std::string& stderr_dest) :\n        m_originalStdout(dup(1)),\n        m_originalStderr(dup(2)),\n        m_stdoutDest(stdout_dest),\n        m_stderrDest(stderr_dest) {\n        dup2(fileno(m_stdoutFile.getFile()), 1);\n        dup2(fileno(m_stderrFile.getFile()), 2);\n    }\n\n    OutputRedirect::~OutputRedirect() {\n        Catch::cout() << std::flush;\n        fflush(stdout);\n        // Since we support overriding these streams, we flush cerr\n        // even though std::cerr is unbuffered\n        Catch::cerr() << std::flush;\n        Catch::clog() << std::flush;\n        fflush(stderr);\n\n        dup2(m_originalStdout, 1);\n        dup2(m_originalStderr, 2);\n\n        m_stdoutDest += m_stdoutFile.getContents();\n        m_stderrDest += m_stderrFile.getContents();\n    }\n\n#endif // CATCH_CONFIG_NEW_CAPTURE\n\n} // namespace Catch\n\n#if defined(CATCH_CONFIG_NEW_CAPTURE)\n    #if defined(_MSC_VER)\n    #undef dup\n    #undef dup2\n    #undef fileno\n    #endif\n#endif\n// end catch_output_redirect.cpp\n// start catch_polyfills.cpp\n\n#include <cmath>\n\nnamespace Catch {\n\n#if !defined(CATCH_CONFIG_POLYFILL_ISNAN)\n    bool isnan(float f) {\n        return std::isnan(f);\n    }\n    bool isnan(double d) {\n        return std::isnan(d);\n    }\n#else\n    // For now we only use this for embarcadero\n    bool isnan(float f) {\n        return std::_isnan(f);\n    }\n    bool isnan(double d) {\n        return std::_isnan(d);\n    }\n#endif\n\n} // end namespace Catch\n// end catch_polyfills.cpp\n// start catch_random_number_generator.cpp\n\nnamespace Catch {\n\nnamespace {\n\n#if defined(_MSC_VER)\n#pragma warning(push)\n#pragma warning(disable:4146) // we negate uint32 during the rotate\n#endif\n        // Safe rotr implementation thanks to John Regehr\n        uint32_t rotate_right(uint32_t val, uint32_t count) {\n            const uint32_t mask = 31;\n            count &= mask;\n            return (val >> count) | (val << (-count & mask));\n        }\n\n#if defined(_MSC_VER)\n#pragma warning(pop)\n#endif\n\n}\n\n    SimplePcg32::SimplePcg32(result_type seed_) {\n        seed(seed_);\n    }\n\n    void SimplePcg32::seed(result_type seed_) {\n        m_state = 0;\n        (*this)();\n        m_state += seed_;\n        (*this)();\n    }\n\n    void SimplePcg32::discard(uint64_t skip) {\n        // We could implement this to run in O(log n) steps, but this\n        // should suffice for our use case.\n        for (uint64_t s = 0; s < skip; ++s) {\n            static_cast<void>((*this)());\n        }\n    }\n\n    SimplePcg32::result_type SimplePcg32::operator()() {\n        // prepare the output value\n        const uint32_t xorshifted = static_cast<uint32_t>(((m_state >> 18u) ^ m_state) >> 27u);\n        const auto output = rotate_right(xorshifted, m_state >> 59u);\n\n        // advance state\n        m_state = m_state * 6364136223846793005ULL + s_inc;\n\n        return output;\n    }\n\n    bool operator==(SimplePcg32 const& lhs, SimplePcg32 const& rhs) {\n        return lhs.m_state == rhs.m_state;\n    }\n\n    bool operator!=(SimplePcg32 const& lhs, SimplePcg32 const& rhs) {\n        return lhs.m_state != rhs.m_state;\n    }\n}\n// end catch_random_number_generator.cpp\n// start catch_registry_hub.cpp\n\n// start catch_test_case_registry_impl.h\n\n#include <vector>\n#include <set>\n#include <algorithm>\n#include <ios>\n\nnamespace Catch {\n\n    class TestCase;\n    struct IConfig;\n\n    std::vector<TestCase> sortTests( IConfig const& config, std::vector<TestCase> const& unsortedTestCases );\n\n    bool isThrowSafe( TestCase const& testCase, IConfig const& config );\n    bool matchTest( TestCase const& testCase, TestSpec const& testSpec, IConfig const& config );\n\n    void enforceNoDuplicateTestCases( std::vector<TestCase> const& functions );\n\n    std::vector<TestCase> filterTests( std::vector<TestCase> const& testCases, TestSpec const& testSpec, IConfig const& config );\n    std::vector<TestCase> const& getAllTestCasesSorted( IConfig const& config );\n\n    class TestRegistry : public ITestCaseRegistry {\n    public:\n        virtual ~TestRegistry() = default;\n\n        virtual void registerTest( TestCase const& testCase );\n\n        std::vector<TestCase> const& getAllTests() const override;\n        std::vector<TestCase> const& getAllTestsSorted( IConfig const& config ) const override;\n\n    private:\n        std::vector<TestCase> m_functions;\n        mutable RunTests::InWhatOrder m_currentSortOrder = RunTests::InDeclarationOrder;\n        mutable std::vector<TestCase> m_sortedFunctions;\n        std::size_t m_unnamedCount = 0;\n        std::ios_base::Init m_ostreamInit; // Forces cout/ cerr to be initialised\n    };\n\n    ///////////////////////////////////////////////////////////////////////////\n\n    class TestInvokerAsFunction : public ITestInvoker {\n        void(*m_testAsFunction)();\n    public:\n        TestInvokerAsFunction( void(*testAsFunction)() ) noexcept;\n\n        void invoke() const override;\n    };\n\n    std::string extractClassName( StringRef const& classOrQualifiedMethodName );\n\n    ///////////////////////////////////////////////////////////////////////////\n\n} // end namespace Catch\n\n// end catch_test_case_registry_impl.h\n// start catch_reporter_registry.h\n\n#include <map>\n\nnamespace Catch {\n\n    class ReporterRegistry : public IReporterRegistry {\n\n    public:\n\n        ~ReporterRegistry() override;\n\n        IStreamingReporterPtr create( std::string const& name, IConfigPtr const& config ) const override;\n\n        void registerReporter( std::string const& name, IReporterFactoryPtr const& factory );\n        void registerListener( IReporterFactoryPtr const& factory );\n\n        FactoryMap const& getFactories() const override;\n        Listeners const& getListeners() const override;\n\n    private:\n        FactoryMap m_factories;\n        Listeners m_listeners;\n    };\n}\n\n// end catch_reporter_registry.h\n// start catch_tag_alias_registry.h\n\n// start catch_tag_alias.h\n\n#include <string>\n\nnamespace Catch {\n\n    struct TagAlias {\n        TagAlias(std::string const& _tag, SourceLineInfo _lineInfo);\n\n        std::string tag;\n        SourceLineInfo lineInfo;\n    };\n\n} // end namespace Catch\n\n// end catch_tag_alias.h\n#include <map>\n\nnamespace Catch {\n\n    class TagAliasRegistry : public ITagAliasRegistry {\n    public:\n        ~TagAliasRegistry() override;\n        TagAlias const* find( std::string const& alias ) const override;\n        std::string expandAliases( std::string const& unexpandedTestSpec ) const override;\n        void add( std::string const& alias, std::string const& tag, SourceLineInfo const& lineInfo );\n\n    private:\n        std::map<std::string, TagAlias> m_registry;\n    };\n\n} // end namespace Catch\n\n// end catch_tag_alias_registry.h\n// start catch_startup_exception_registry.h\n\n#include <vector>\n#include <exception>\n\nnamespace Catch {\n\n    class StartupExceptionRegistry {\n#if !defined(CATCH_CONFIG_DISABLE_EXCEPTIONS)\n    public:\n        void add(std::exception_ptr const& exception) noexcept;\n        std::vector<std::exception_ptr> const& getExceptions() const noexcept;\n    private:\n        std::vector<std::exception_ptr> m_exceptions;\n#endif\n    };\n\n} // end namespace Catch\n\n// end catch_startup_exception_registry.h\n// start catch_singletons.hpp\n\nnamespace Catch {\n\n    struct ISingleton {\n        virtual ~ISingleton();\n    };\n\n    void addSingleton( ISingleton* singleton );\n    void cleanupSingletons();\n\n    template<typename SingletonImplT, typename InterfaceT = SingletonImplT, typename MutableInterfaceT = InterfaceT>\n    class Singleton : SingletonImplT, public ISingleton {\n\n        static auto getInternal() -> Singleton* {\n            static Singleton* s_instance = nullptr;\n            if( !s_instance ) {\n                s_instance = new Singleton;\n                addSingleton( s_instance );\n            }\n            return s_instance;\n        }\n\n    public:\n        static auto get() -> InterfaceT const& {\n            return *getInternal();\n        }\n        static auto getMutable() -> MutableInterfaceT& {\n            return *getInternal();\n        }\n    };\n\n} // namespace Catch\n\n// end catch_singletons.hpp\nnamespace Catch {\n\n    namespace {\n\n        class RegistryHub : public IRegistryHub, public IMutableRegistryHub,\n                            private NonCopyable {\n\n        public: // IRegistryHub\n            RegistryHub() = default;\n            IReporterRegistry const& getReporterRegistry() const override {\n                return m_reporterRegistry;\n            }\n            ITestCaseRegistry const& getTestCaseRegistry() const override {\n                return m_testCaseRegistry;\n            }\n            IExceptionTranslatorRegistry const& getExceptionTranslatorRegistry() const override {\n                return m_exceptionTranslatorRegistry;\n            }\n            ITagAliasRegistry const& getTagAliasRegistry() const override {\n                return m_tagAliasRegistry;\n            }\n            StartupExceptionRegistry const& getStartupExceptionRegistry() const override {\n                return m_exceptionRegistry;\n            }\n\n        public: // IMutableRegistryHub\n            void registerReporter( std::string const& name, IReporterFactoryPtr const& factory ) override {\n                m_reporterRegistry.registerReporter( name, factory );\n            }\n            void registerListener( IReporterFactoryPtr const& factory ) override {\n                m_reporterRegistry.registerListener( factory );\n            }\n            void registerTest( TestCase const& testInfo ) override {\n                m_testCaseRegistry.registerTest( testInfo );\n            }\n            void registerTranslator( const IExceptionTranslator* translator ) override {\n                m_exceptionTranslatorRegistry.registerTranslator( translator );\n            }\n            void registerTagAlias( std::string const& alias, std::string const& tag, SourceLineInfo const& lineInfo ) override {\n                m_tagAliasRegistry.add( alias, tag, lineInfo );\n            }\n            void registerStartupException() noexcept override {\n#if !defined(CATCH_CONFIG_DISABLE_EXCEPTIONS)\n                m_exceptionRegistry.add(std::current_exception());\n#else\n                CATCH_INTERNAL_ERROR(\"Attempted to register active exception under CATCH_CONFIG_DISABLE_EXCEPTIONS!\");\n#endif\n            }\n            IMutableEnumValuesRegistry& getMutableEnumValuesRegistry() override {\n                return m_enumValuesRegistry;\n            }\n\n        private:\n            TestRegistry m_testCaseRegistry;\n            ReporterRegistry m_reporterRegistry;\n            ExceptionTranslatorRegistry m_exceptionTranslatorRegistry;\n            TagAliasRegistry m_tagAliasRegistry;\n            StartupExceptionRegistry m_exceptionRegistry;\n            Detail::EnumValuesRegistry m_enumValuesRegistry;\n        };\n    }\n\n    using RegistryHubSingleton = Singleton<RegistryHub, IRegistryHub, IMutableRegistryHub>;\n\n    IRegistryHub const& getRegistryHub() {\n        return RegistryHubSingleton::get();\n    }\n    IMutableRegistryHub& getMutableRegistryHub() {\n        return RegistryHubSingleton::getMutable();\n    }\n    void cleanUp() {\n        cleanupSingletons();\n        cleanUpContext();\n    }\n    std::string translateActiveException() {\n        return getRegistryHub().getExceptionTranslatorRegistry().translateActiveException();\n    }\n\n} // end namespace Catch\n// end catch_registry_hub.cpp\n// start catch_reporter_registry.cpp\n\nnamespace Catch {\n\n    ReporterRegistry::~ReporterRegistry() = default;\n\n    IStreamingReporterPtr ReporterRegistry::create( std::string const& name, IConfigPtr const& config ) const {\n        auto it =  m_factories.find( name );\n        if( it == m_factories.end() )\n            return nullptr;\n        return it->second->create( ReporterConfig( config ) );\n    }\n\n    void ReporterRegistry::registerReporter( std::string const& name, IReporterFactoryPtr const& factory ) {\n        m_factories.emplace(name, factory);\n    }\n    void ReporterRegistry::registerListener( IReporterFactoryPtr const& factory ) {\n        m_listeners.push_back( factory );\n    }\n\n    IReporterRegistry::FactoryMap const& ReporterRegistry::getFactories() const {\n        return m_factories;\n    }\n    IReporterRegistry::Listeners const& ReporterRegistry::getListeners() const {\n        return m_listeners;\n    }\n\n}\n// end catch_reporter_registry.cpp\n// start catch_result_type.cpp\n\nnamespace Catch {\n\n    bool isOk( ResultWas::OfType resultType ) {\n        return ( resultType & ResultWas::FailureBit ) == 0;\n    }\n    bool isJustInfo( int flags ) {\n        return flags == ResultWas::Info;\n    }\n\n    ResultDisposition::Flags operator | ( ResultDisposition::Flags lhs, ResultDisposition::Flags rhs ) {\n        return static_cast<ResultDisposition::Flags>( static_cast<int>( lhs ) | static_cast<int>( rhs ) );\n    }\n\n    bool shouldContinueOnFailure( int flags )    { return ( flags & ResultDisposition::ContinueOnFailure ) != 0; }\n    bool shouldSuppressFailure( int flags )      { return ( flags & ResultDisposition::SuppressFail ) != 0; }\n\n} // end namespace Catch\n// end catch_result_type.cpp\n// start catch_run_context.cpp\n\n#include <cassert>\n#include <algorithm>\n#include <sstream>\n\nnamespace Catch {\n\n    namespace Generators {\n        struct GeneratorTracker : TestCaseTracking::TrackerBase, IGeneratorTracker {\n            GeneratorBasePtr m_generator;\n\n            GeneratorTracker( TestCaseTracking::NameAndLocation const& nameAndLocation, TrackerContext& ctx, ITracker* parent )\n            :   TrackerBase( nameAndLocation, ctx, parent )\n            {}\n            ~GeneratorTracker();\n\n            static GeneratorTracker& acquire( TrackerContext& ctx, TestCaseTracking::NameAndLocation const& nameAndLocation ) {\n                std::shared_ptr<GeneratorTracker> tracker;\n\n                ITracker& currentTracker = ctx.currentTracker();\n                // Under specific circumstances, the generator we want\n                // to acquire is also the current tracker. If this is\n                // the case, we have to avoid looking through current\n                // tracker's children, and instead return the current\n                // tracker.\n                // A case where this check is important is e.g.\n                //     for (int i = 0; i < 5; ++i) {\n                //         int n = GENERATE(1, 2);\n                //     }\n                //\n                // without it, the code above creates 5 nested generators.\n                if (currentTracker.nameAndLocation() == nameAndLocation) {\n                    auto thisTracker = currentTracker.parent().findChild(nameAndLocation);\n                    assert(thisTracker);\n                    assert(thisTracker->isGeneratorTracker());\n                    tracker = std::static_pointer_cast<GeneratorTracker>(thisTracker);\n                } else if ( TestCaseTracking::ITrackerPtr childTracker = currentTracker.findChild( nameAndLocation ) ) {\n                    assert( childTracker );\n                    assert( childTracker->isGeneratorTracker() );\n                    tracker = std::static_pointer_cast<GeneratorTracker>( childTracker );\n                } else {\n                    tracker = std::make_shared<GeneratorTracker>( nameAndLocation, ctx, &currentTracker );\n                    currentTracker.addChild( tracker );\n                }\n\n                if( !tracker->isComplete() ) {\n                    tracker->open();\n                }\n\n                return *tracker;\n            }\n\n            // TrackerBase interface\n            bool isGeneratorTracker() const override { return true; }\n            auto hasGenerator() const -> bool override {\n                return !!m_generator;\n            }\n            void close() override {\n                TrackerBase::close();\n                // If a generator has a child (it is followed by a section)\n                // and none of its children have started, then we must wait\n                // until later to start consuming its values.\n                // This catches cases where `GENERATE` is placed between two\n                // `SECTION`s.\n                // **The check for m_children.empty cannot be removed**.\n                // doing so would break `GENERATE` _not_ followed by `SECTION`s.\n                const bool should_wait_for_child = [&]() {\n                    // No children -> nobody to wait for\n                    if ( m_children.empty() ) {\n                        return false;\n                    }\n                    // If at least one child started executing, don't wait\n                    if ( std::find_if(\n                             m_children.begin(),\n                             m_children.end(),\n                             []( TestCaseTracking::ITrackerPtr tracker ) {\n                                 return tracker->hasStarted();\n                             } ) != m_children.end() ) {\n                        return false;\n                    }\n\n                    // No children have started. We need to check if they _can_\n                    // start, and thus we should wait for them, or they cannot\n                    // start (due to filters), and we shouldn't wait for them\n                    auto* parent = m_parent;\n                    // This is safe: there is always at least one section\n                    // tracker in a test case tracking tree\n                    while ( !parent->isSectionTracker() ) {\n                        parent = &( parent->parent() );\n                    }\n                    assert( parent &&\n                            \"Missing root (test case) level section\" );\n\n                    auto const& parentSection =\n                        static_cast<SectionTracker&>( *parent );\n                    auto const& filters = parentSection.getFilters();\n                    // No filters -> no restrictions on running sections\n                    if ( filters.empty() ) {\n                        return true;\n                    }\n\n                    for ( auto const& child : m_children ) {\n                        if ( child->isSectionTracker() &&\n                             std::find( filters.begin(),\n                                        filters.end(),\n                                        static_cast<SectionTracker&>( *child )\n                                            .trimmedName() ) !=\n                                 filters.end() ) {\n                            return true;\n                        }\n                    }\n                    return false;\n                }();\n\n                // This check is a bit tricky, because m_generator->next()\n                // has a side-effect, where it consumes generator's current\n                // value, but we do not want to invoke the side-effect if\n                // this generator is still waiting for any child to start.\n                if ( should_wait_for_child ||\n                     ( m_runState == CompletedSuccessfully &&\n                       m_generator->next() ) ) {\n                    m_children.clear();\n                    m_runState = Executing;\n                }\n            }\n\n            // IGeneratorTracker interface\n            auto getGenerator() const -> GeneratorBasePtr const& override {\n                return m_generator;\n            }\n            void setGenerator( GeneratorBasePtr&& generator ) override {\n                m_generator = std::move( generator );\n            }\n        };\n        GeneratorTracker::~GeneratorTracker() {}\n    }\n\n    RunContext::RunContext(IConfigPtr const& _config, IStreamingReporterPtr&& reporter)\n    :   m_runInfo(_config->name()),\n        m_context(getCurrentMutableContext()),\n        m_config(_config),\n        m_reporter(std::move(reporter)),\n        m_lastAssertionInfo{ StringRef(), SourceLineInfo(\"\",0), StringRef(), ResultDisposition::Normal },\n        m_includeSuccessfulResults( m_config->includeSuccessfulResults() || m_reporter->getPreferences().shouldReportAllAssertions )\n    {\n        m_context.setRunner(this);\n        m_context.setConfig(m_config);\n        m_context.setResultCapture(this);\n        m_reporter->testRunStarting(m_runInfo);\n    }\n\n    RunContext::~RunContext() {\n        m_reporter->testRunEnded(TestRunStats(m_runInfo, m_totals, aborting()));\n    }\n\n    void RunContext::testGroupStarting(std::string const& testSpec, std::size_t groupIndex, std::size_t groupsCount) {\n        m_reporter->testGroupStarting(GroupInfo(testSpec, groupIndex, groupsCount));\n    }\n\n    void RunContext::testGroupEnded(std::string const& testSpec, Totals const& totals, std::size_t groupIndex, std::size_t groupsCount) {\n        m_reporter->testGroupEnded(TestGroupStats(GroupInfo(testSpec, groupIndex, groupsCount), totals, aborting()));\n    }\n\n    Totals RunContext::runTest(TestCase const& testCase) {\n        Totals prevTotals = m_totals;\n\n        std::string redirectedCout;\n        std::string redirectedCerr;\n\n        auto const& testInfo = testCase.getTestCaseInfo();\n\n        m_reporter->testCaseStarting(testInfo);\n\n        m_activeTestCase = &testCase;\n\n        ITracker& rootTracker = m_trackerContext.startRun();\n        assert(rootTracker.isSectionTracker());\n        static_cast<SectionTracker&>(rootTracker).addInitialFilters(m_config->getSectionsToRun());\n        do {\n            m_trackerContext.startCycle();\n            m_testCaseTracker = &SectionTracker::acquire(m_trackerContext, TestCaseTracking::NameAndLocation(testInfo.name, testInfo.lineInfo));\n            runCurrentTest(redirectedCout, redirectedCerr);\n        } while (!m_testCaseTracker->isSuccessfullyCompleted() && !aborting());\n\n        Totals deltaTotals = m_totals.delta(prevTotals);\n        if (testInfo.expectedToFail() && deltaTotals.testCases.passed > 0) {\n            deltaTotals.assertions.failed++;\n            deltaTotals.testCases.passed--;\n            deltaTotals.testCases.failed++;\n        }\n        m_totals.testCases += deltaTotals.testCases;\n        m_reporter->testCaseEnded(TestCaseStats(testInfo,\n                                  deltaTotals,\n                                  redirectedCout,\n                                  redirectedCerr,\n                                  aborting()));\n\n        m_activeTestCase = nullptr;\n        m_testCaseTracker = nullptr;\n\n        return deltaTotals;\n    }\n\n    IConfigPtr RunContext::config() const {\n        return m_config;\n    }\n\n    IStreamingReporter& RunContext::reporter() const {\n        return *m_reporter;\n    }\n\n    void RunContext::assertionEnded(AssertionResult const & result) {\n        if (result.getResultType() == ResultWas::Ok) {\n            m_totals.assertions.passed++;\n            m_lastAssertionPassed = true;\n        } else if (!result.isOk()) {\n            m_lastAssertionPassed = false;\n            if( m_activeTestCase->getTestCaseInfo().okToFail() )\n                m_totals.assertions.failedButOk++;\n            else\n                m_totals.assertions.failed++;\n        }\n        else {\n            m_lastAssertionPassed = true;\n        }\n\n        // We have no use for the return value (whether messages should be cleared), because messages were made scoped\n        // and should be let to clear themselves out.\n        static_cast<void>(m_reporter->assertionEnded(AssertionStats(result, m_messages, m_totals)));\n\n        if (result.getResultType() != ResultWas::Warning)\n            m_messageScopes.clear();\n\n        // Reset working state\n        resetAssertionInfo();\n        m_lastResult = result;\n    }\n    void RunContext::resetAssertionInfo() {\n        m_lastAssertionInfo.macroName = StringRef();\n        m_lastAssertionInfo.capturedExpression = \"{Unknown expression after the reported line}\"_sr;\n    }\n\n    bool RunContext::sectionStarted(SectionInfo const & sectionInfo, Counts & assertions) {\n        ITracker& sectionTracker = SectionTracker::acquire(m_trackerContext, TestCaseTracking::NameAndLocation(sectionInfo.name, sectionInfo.lineInfo));\n        if (!sectionTracker.isOpen())\n            return false;\n        m_activeSections.push_back(&sectionTracker);\n\n        m_lastAssertionInfo.lineInfo = sectionInfo.lineInfo;\n\n        m_reporter->sectionStarting(sectionInfo);\n\n        assertions = m_totals.assertions;\n\n        return true;\n    }\n    auto RunContext::acquireGeneratorTracker( StringRef generatorName, SourceLineInfo const& lineInfo ) -> IGeneratorTracker& {\n        using namespace Generators;\n        GeneratorTracker& tracker = GeneratorTracker::acquire(m_trackerContext,\n                                                              TestCaseTracking::NameAndLocation( static_cast<std::string>(generatorName), lineInfo ) );\n        m_lastAssertionInfo.lineInfo = lineInfo;\n        return tracker;\n    }\n\n    bool RunContext::testForMissingAssertions(Counts& assertions) {\n        if (assertions.total() != 0)\n            return false;\n        if (!m_config->warnAboutMissingAssertions())\n            return false;\n        if (m_trackerContext.currentTracker().hasChildren())\n            return false;\n        m_totals.assertions.failed++;\n        assertions.failed++;\n        return true;\n    }\n\n    void RunContext::sectionEnded(SectionEndInfo const & endInfo) {\n        Counts assertions = m_totals.assertions - endInfo.prevAssertions;\n        bool missingAssertions = testForMissingAssertions(assertions);\n\n        if (!m_activeSections.empty()) {\n            m_activeSections.back()->close();\n            m_activeSections.pop_back();\n        }\n\n        m_reporter->sectionEnded(SectionStats(endInfo.sectionInfo, assertions, endInfo.durationInSeconds, missingAssertions));\n        m_messages.clear();\n        m_messageScopes.clear();\n    }\n\n    void RunContext::sectionEndedEarly(SectionEndInfo const & endInfo) {\n        if (m_unfinishedSections.empty())\n            m_activeSections.back()->fail();\n        else\n            m_activeSections.back()->close();\n        m_activeSections.pop_back();\n\n        m_unfinishedSections.push_back(endInfo);\n    }\n\n#if defined(CATCH_CONFIG_ENABLE_BENCHMARKING)\n    void RunContext::benchmarkPreparing(std::string const& name) {\n        m_reporter->benchmarkPreparing(name);\n    }\n    void RunContext::benchmarkStarting( BenchmarkInfo const& info ) {\n        m_reporter->benchmarkStarting( info );\n    }\n    void RunContext::benchmarkEnded( BenchmarkStats<> const& stats ) {\n        m_reporter->benchmarkEnded( stats );\n    }\n    void RunContext::benchmarkFailed(std::string const & error) {\n        m_reporter->benchmarkFailed(error);\n    }\n#endif // CATCH_CONFIG_ENABLE_BENCHMARKING\n\n    void RunContext::pushScopedMessage(MessageInfo const & message) {\n        m_messages.push_back(message);\n    }\n\n    void RunContext::popScopedMessage(MessageInfo const & message) {\n        m_messages.erase(std::remove(m_messages.begin(), m_messages.end(), message), m_messages.end());\n    }\n\n    void RunContext::emplaceUnscopedMessage( MessageBuilder const& builder ) {\n        m_messageScopes.emplace_back( builder );\n    }\n\n    std::string RunContext::getCurrentTestName() const {\n        return m_activeTestCase\n            ? m_activeTestCase->getTestCaseInfo().name\n            : std::string();\n    }\n\n    const AssertionResult * RunContext::getLastResult() const {\n        return &(*m_lastResult);\n    }\n\n    void RunContext::exceptionEarlyReported() {\n        m_shouldReportUnexpected = false;\n    }\n\n    void RunContext::handleFatalErrorCondition( StringRef message ) {\n        // First notify reporter that bad things happened\n        m_reporter->fatalErrorEncountered(message);\n\n        // Don't rebuild the result -- the stringification itself can cause more fatal errors\n        // Instead, fake a result data.\n        AssertionResultData tempResult( ResultWas::FatalErrorCondition, { false } );\n        tempResult.message = static_cast<std::string>(message);\n        AssertionResult result(m_lastAssertionInfo, tempResult);\n\n        assertionEnded(result);\n\n        handleUnfinishedSections();\n\n        // Recreate section for test case (as we will lose the one that was in scope)\n        auto const& testCaseInfo = m_activeTestCase->getTestCaseInfo();\n        SectionInfo testCaseSection(testCaseInfo.lineInfo, testCaseInfo.name);\n\n        Counts assertions;\n        assertions.failed = 1;\n        SectionStats testCaseSectionStats(testCaseSection, assertions, 0, false);\n        m_reporter->sectionEnded(testCaseSectionStats);\n\n        auto const& testInfo = m_activeTestCase->getTestCaseInfo();\n\n        Totals deltaTotals;\n        deltaTotals.testCases.failed = 1;\n        deltaTotals.assertions.failed = 1;\n        m_reporter->testCaseEnded(TestCaseStats(testInfo,\n                                  deltaTotals,\n                                  std::string(),\n                                  std::string(),\n                                  false));\n        m_totals.testCases.failed++;\n        testGroupEnded(std::string(), m_totals, 1, 1);\n        m_reporter->testRunEnded(TestRunStats(m_runInfo, m_totals, false));\n    }\n\n    bool RunContext::lastAssertionPassed() {\n         return m_lastAssertionPassed;\n    }\n\n    void RunContext::assertionPassed() {\n        m_lastAssertionPassed = true;\n        ++m_totals.assertions.passed;\n        resetAssertionInfo();\n        m_messageScopes.clear();\n    }\n\n    bool RunContext::aborting() const {\n        return m_totals.assertions.failed >= static_cast<std::size_t>(m_config->abortAfter());\n    }\n\n    void RunContext::runCurrentTest(std::string & redirectedCout, std::string & redirectedCerr) {\n        auto const& testCaseInfo = m_activeTestCase->getTestCaseInfo();\n        SectionInfo testCaseSection(testCaseInfo.lineInfo, testCaseInfo.name);\n        m_reporter->sectionStarting(testCaseSection);\n        Counts prevAssertions = m_totals.assertions;\n        double duration = 0;\n        m_shouldReportUnexpected = true;\n        m_lastAssertionInfo = { \"TEST_CASE\"_sr, testCaseInfo.lineInfo, StringRef(), ResultDisposition::Normal };\n\n        seedRng(*m_config);\n\n        Timer timer;\n        CATCH_TRY {\n            if (m_reporter->getPreferences().shouldRedirectStdOut) {\n#if !defined(CATCH_CONFIG_EXPERIMENTAL_REDIRECT)\n                RedirectedStreams redirectedStreams(redirectedCout, redirectedCerr);\n\n                timer.start();\n                invokeActiveTestCase();\n#else\n                OutputRedirect r(redirectedCout, redirectedCerr);\n                timer.start();\n                invokeActiveTestCase();\n#endif\n            } else {\n                timer.start();\n                invokeActiveTestCase();\n            }\n            duration = timer.getElapsedSeconds();\n        } CATCH_CATCH_ANON (TestFailureException&) {\n            // This just means the test was aborted due to failure\n        } CATCH_CATCH_ALL {\n            // Under CATCH_CONFIG_FAST_COMPILE, unexpected exceptions under REQUIRE assertions\n            // are reported without translation at the point of origin.\n            if( m_shouldReportUnexpected ) {\n                AssertionReaction dummyReaction;\n                handleUnexpectedInflightException( m_lastAssertionInfo, translateActiveException(), dummyReaction );\n            }\n        }\n        Counts assertions = m_totals.assertions - prevAssertions;\n        bool missingAssertions = testForMissingAssertions(assertions);\n\n        m_testCaseTracker->close();\n        handleUnfinishedSections();\n        m_messages.clear();\n        m_messageScopes.clear();\n\n        SectionStats testCaseSectionStats(testCaseSection, assertions, duration, missingAssertions);\n        m_reporter->sectionEnded(testCaseSectionStats);\n    }\n\n    void RunContext::invokeActiveTestCase() {\n        FatalConditionHandlerGuard _(&m_fatalConditionhandler);\n        m_activeTestCase->invoke();\n    }\n\n    void RunContext::handleUnfinishedSections() {\n        // If sections ended prematurely due to an exception we stored their\n        // infos here so we can tear them down outside the unwind process.\n        for (auto it = m_unfinishedSections.rbegin(),\n             itEnd = m_unfinishedSections.rend();\n             it != itEnd;\n             ++it)\n            sectionEnded(*it);\n        m_unfinishedSections.clear();\n    }\n\n    void RunContext::handleExpr(\n        AssertionInfo const& info,\n        ITransientExpression const& expr,\n        AssertionReaction& reaction\n    ) {\n        m_reporter->assertionStarting( info );\n\n        bool negated = isFalseTest( info.resultDisposition );\n        bool result = expr.getResult() != negated;\n\n        if( result ) {\n            if (!m_includeSuccessfulResults) {\n                assertionPassed();\n            }\n            else {\n                reportExpr(info, ResultWas::Ok, &expr, negated);\n            }\n        }\n        else {\n            reportExpr(info, ResultWas::ExpressionFailed, &expr, negated );\n            populateReaction( reaction );\n        }\n    }\n    void RunContext::reportExpr(\n            AssertionInfo const &info,\n            ResultWas::OfType resultType,\n            ITransientExpression const *expr,\n            bool negated ) {\n\n        m_lastAssertionInfo = info;\n        AssertionResultData data( resultType, LazyExpression( negated ) );\n\n        AssertionResult assertionResult{ info, data };\n        assertionResult.m_resultData.lazyExpression.m_transientExpression = expr;\n\n        assertionEnded( assertionResult );\n    }\n\n    void RunContext::handleMessage(\n            AssertionInfo const& info,\n            ResultWas::OfType resultType,\n            StringRef const& message,\n            AssertionReaction& reaction\n    ) {\n        m_reporter->assertionStarting( info );\n\n        m_lastAssertionInfo = info;\n\n        AssertionResultData data( resultType, LazyExpression( false ) );\n        data.message = static_cast<std::string>(message);\n        AssertionResult assertionResult{ m_lastAssertionInfo, data };\n        assertionEnded( assertionResult );\n        if( !assertionResult.isOk() )\n            populateReaction( reaction );\n    }\n    void RunContext::handleUnexpectedExceptionNotThrown(\n            AssertionInfo const& info,\n            AssertionReaction& reaction\n    ) {\n        handleNonExpr(info, Catch::ResultWas::DidntThrowException, reaction);\n    }\n\n    void RunContext::handleUnexpectedInflightException(\n            AssertionInfo const& info,\n            std::string const& message,\n            AssertionReaction& reaction\n    ) {\n        m_lastAssertionInfo = info;\n\n        AssertionResultData data( ResultWas::ThrewException, LazyExpression( false ) );\n        data.message = message;\n        AssertionResult assertionResult{ info, data };\n        assertionEnded( assertionResult );\n        populateReaction( reaction );\n    }\n\n    void RunContext::populateReaction( AssertionReaction& reaction ) {\n        reaction.shouldDebugBreak = m_config->shouldDebugBreak();\n        reaction.shouldThrow = aborting() || (m_lastAssertionInfo.resultDisposition & ResultDisposition::Normal);\n    }\n\n    void RunContext::handleIncomplete(\n            AssertionInfo const& info\n    ) {\n        m_lastAssertionInfo = info;\n\n        AssertionResultData data( ResultWas::ThrewException, LazyExpression( false ) );\n        data.message = \"Exception translation was disabled by CATCH_CONFIG_FAST_COMPILE\";\n        AssertionResult assertionResult{ info, data };\n        assertionEnded( assertionResult );\n    }\n    void RunContext::handleNonExpr(\n            AssertionInfo const &info,\n            ResultWas::OfType resultType,\n            AssertionReaction &reaction\n    ) {\n        m_lastAssertionInfo = info;\n\n        AssertionResultData data( resultType, LazyExpression( false ) );\n        AssertionResult assertionResult{ info, data };\n        assertionEnded( assertionResult );\n\n        if( !assertionResult.isOk() )\n            populateReaction( reaction );\n    }\n\n    IResultCapture& getResultCapture() {\n        if (auto* capture = getCurrentContext().getResultCapture())\n            return *capture;\n        else\n            CATCH_INTERNAL_ERROR(\"No result capture instance\");\n    }\n\n    void seedRng(IConfig const& config) {\n        if (config.rngSeed() != 0) {\n            std::srand(config.rngSeed());\n            rng().seed(config.rngSeed());\n        }\n    }\n\n    unsigned int rngSeed() {\n        return getCurrentContext().getConfig()->rngSeed();\n    }\n\n}\n// end catch_run_context.cpp\n// start catch_section.cpp\n\nnamespace Catch {\n\n    Section::Section( SectionInfo const& info )\n    :   m_info( info ),\n        m_sectionIncluded( getResultCapture().sectionStarted( m_info, m_assertions ) )\n    {\n        m_timer.start();\n    }\n\n    Section::~Section() {\n        if( m_sectionIncluded ) {\n            SectionEndInfo endInfo{ m_info, m_assertions, m_timer.getElapsedSeconds() };\n            if( uncaught_exceptions() )\n                getResultCapture().sectionEndedEarly( endInfo );\n            else\n                getResultCapture().sectionEnded( endInfo );\n        }\n    }\n\n    // This indicates whether the section should be executed or not\n    Section::operator bool() const {\n        return m_sectionIncluded;\n    }\n\n} // end namespace Catch\n// end catch_section.cpp\n// start catch_section_info.cpp\n\nnamespace Catch {\n\n    SectionInfo::SectionInfo\n        (   SourceLineInfo const& _lineInfo,\n            std::string const& _name )\n    :   name( _name ),\n        lineInfo( _lineInfo )\n    {}\n\n} // end namespace Catch\n// end catch_section_info.cpp\n// start catch_session.cpp\n\n// start catch_session.h\n\n#include <memory>\n\nnamespace Catch {\n\n    class Session : NonCopyable {\n    public:\n\n        Session();\n        ~Session() override;\n\n        void showHelp() const;\n        void libIdentify();\n\n        int applyCommandLine( int argc, char const * const * argv );\n    #if defined(CATCH_CONFIG_WCHAR) && defined(_WIN32) && defined(UNICODE)\n        int applyCommandLine( int argc, wchar_t const * const * argv );\n    #endif\n\n        void useConfigData( ConfigData const& configData );\n\n        template<typename CharT>\n        int run(int argc, CharT const * const argv[]) {\n            if (m_startupExceptions)\n                return 1;\n            int returnCode = applyCommandLine(argc, argv);\n            if (returnCode == 0)\n                returnCode = run();\n            return returnCode;\n        }\n\n        int run();\n\n        clara::Parser const& cli() const;\n        void cli( clara::Parser const& newParser );\n        ConfigData& configData();\n        Config& config();\n    private:\n        int runInternal();\n\n        clara::Parser m_cli;\n        ConfigData m_configData;\n        std::shared_ptr<Config> m_config;\n        bool m_startupExceptions = false;\n    };\n\n} // end namespace Catch\n\n// end catch_session.h\n// start catch_version.h\n\n#include <iosfwd>\n\nnamespace Catch {\n\n    // Versioning information\n    struct Version {\n        Version( Version const& ) = delete;\n        Version& operator=( Version const& ) = delete;\n        Version(    unsigned int _majorVersion,\n                    unsigned int _minorVersion,\n                    unsigned int _patchNumber,\n                    char const * const _branchName,\n                    unsigned int _buildNumber );\n\n        unsigned int const majorVersion;\n        unsigned int const minorVersion;\n        unsigned int const patchNumber;\n\n        // buildNumber is only used if branchName is not null\n        char const * const branchName;\n        unsigned int const buildNumber;\n\n        friend std::ostream& operator << ( std::ostream& os, Version const& version );\n    };\n\n    Version const& libraryVersion();\n}\n\n// end catch_version.h\n#include <cstdlib>\n#include <iomanip>\n#include <set>\n#include <iterator>\n\nnamespace Catch {\n\n    namespace {\n        const int MaxExitCode = 255;\n\n        IStreamingReporterPtr createReporter(std::string const& reporterName, IConfigPtr const& config) {\n            auto reporter = Catch::getRegistryHub().getReporterRegistry().create(reporterName, config);\n            CATCH_ENFORCE(reporter, \"No reporter registered with name: '\" << reporterName << \"'\");\n\n            return reporter;\n        }\n\n        IStreamingReporterPtr makeReporter(std::shared_ptr<Config> const& config) {\n            if (Catch::getRegistryHub().getReporterRegistry().getListeners().empty()) {\n                return createReporter(config->getReporterName(), config);\n            }\n\n            // On older platforms, returning std::unique_ptr<ListeningReporter>\n            // when the return type is std::unique_ptr<IStreamingReporter>\n            // doesn't compile without a std::move call. However, this causes\n            // a warning on newer platforms. Thus, we have to work around\n            // it a bit and downcast the pointer manually.\n            auto ret = std::unique_ptr<IStreamingReporter>(new ListeningReporter);\n            auto& multi = static_cast<ListeningReporter&>(*ret);\n            auto const& listeners = Catch::getRegistryHub().getReporterRegistry().getListeners();\n            for (auto const& listener : listeners) {\n                multi.addListener(listener->create(Catch::ReporterConfig(config)));\n            }\n            multi.addReporter(createReporter(config->getReporterName(), config));\n            return ret;\n        }\n\n        class TestGroup {\n        public:\n            explicit TestGroup(std::shared_ptr<Config> const& config)\n            : m_config{config}\n            , m_context{config, makeReporter(config)}\n            {\n                auto const& allTestCases = getAllTestCasesSorted(*m_config);\n                m_matches = m_config->testSpec().matchesByFilter(allTestCases, *m_config);\n                auto const& invalidArgs = m_config->testSpec().getInvalidArgs();\n\n                if (m_matches.empty() && invalidArgs.empty()) {\n                    for (auto const& test : allTestCases)\n                        if (!test.isHidden())\n                            m_tests.emplace(&test);\n                } else {\n                    for (auto const& match : m_matches)\n                        m_tests.insert(match.tests.begin(), match.tests.end());\n                }\n            }\n\n            Totals execute() {\n                auto const& invalidArgs = m_config->testSpec().getInvalidArgs();\n                Totals totals;\n                m_context.testGroupStarting(m_config->name(), 1, 1);\n                for (auto const& testCase : m_tests) {\n                    if (!m_context.aborting())\n                        totals += m_context.runTest(*testCase);\n                    else\n                        m_context.reporter().skipTest(*testCase);\n                }\n\n                for (auto const& match : m_matches) {\n                    if (match.tests.empty()) {\n                        m_context.reporter().noMatchingTestCases(match.name);\n                        totals.error = -1;\n                    }\n                }\n\n                if (!invalidArgs.empty()) {\n                    for (auto const& invalidArg: invalidArgs)\n                         m_context.reporter().reportInvalidArguments(invalidArg);\n                }\n\n                m_context.testGroupEnded(m_config->name(), totals, 1, 1);\n                return totals;\n            }\n\n        private:\n            using Tests = std::set<TestCase const*>;\n\n            std::shared_ptr<Config> m_config;\n            RunContext m_context;\n            Tests m_tests;\n            TestSpec::Matches m_matches;\n        };\n\n        void applyFilenamesAsTags(Catch::IConfig const& config) {\n            auto& tests = const_cast<std::vector<TestCase>&>(getAllTestCasesSorted(config));\n            for (auto& testCase : tests) {\n                auto tags = testCase.tags;\n\n                std::string filename = testCase.lineInfo.file;\n                auto lastSlash = filename.find_last_of(\"\\\\/\");\n                if (lastSlash != std::string::npos) {\n                    filename.erase(0, lastSlash);\n                    filename[0] = '#';\n                }\n                else\n                {\n                    filename.insert(0, \"#\");\n                }\n\n                auto lastDot = filename.find_last_of('.');\n                if (lastDot != std::string::npos) {\n                    filename.erase(lastDot);\n                }\n\n                tags.push_back(std::move(filename));\n                setTags(testCase, tags);\n            }\n        }\n\n    } // anon namespace\n\n    Session::Session() {\n        static bool alreadyInstantiated = false;\n        if( alreadyInstantiated ) {\n            CATCH_TRY { CATCH_INTERNAL_ERROR( \"Only one instance of Catch::Session can ever be used\" ); }\n            CATCH_CATCH_ALL { getMutableRegistryHub().registerStartupException(); }\n        }\n\n        // There cannot be exceptions at startup in no-exception mode.\n#if !defined(CATCH_CONFIG_DISABLE_EXCEPTIONS)\n        const auto& exceptions = getRegistryHub().getStartupExceptionRegistry().getExceptions();\n        if ( !exceptions.empty() ) {\n            config();\n            getCurrentMutableContext().setConfig(m_config);\n\n            m_startupExceptions = true;\n            Colour colourGuard( Colour::Red );\n            Catch::cerr() << \"Errors occurred during startup!\" << '\\n';\n            // iterate over all exceptions and notify user\n            for ( const auto& ex_ptr : exceptions ) {\n                try {\n                    std::rethrow_exception(ex_ptr);\n                } catch ( std::exception const& ex ) {\n                    Catch::cerr() << Column( ex.what() ).indent(2) << '\\n';\n                }\n            }\n        }\n#endif\n\n        alreadyInstantiated = true;\n        m_cli = makeCommandLineParser( m_configData );\n    }\n    Session::~Session() {\n        Catch::cleanUp();\n    }\n\n    void Session::showHelp() const {\n        Catch::cout()\n                << \"\\nCatch v\" << libraryVersion() << \"\\n\"\n                << m_cli << std::endl\n                << \"For more detailed usage please see the project docs\\n\" << std::endl;\n    }\n    void Session::libIdentify() {\n        Catch::cout()\n                << std::left << std::setw(16) << \"description: \" << \"A Catch2 test executable\\n\"\n                << std::left << std::setw(16) << \"category: \" << \"testframework\\n\"\n                << std::left << std::setw(16) << \"framework: \" << \"Catch Test\\n\"\n                << std::left << std::setw(16) << \"version: \" << libraryVersion() << std::endl;\n    }\n\n    int Session::applyCommandLine( int argc, char const * const * argv ) {\n        if( m_startupExceptions )\n            return 1;\n\n        auto result = m_cli.parse( clara::Args( argc, argv ) );\n        if( !result ) {\n            config();\n            getCurrentMutableContext().setConfig(m_config);\n            Catch::cerr()\n                << Colour( Colour::Red )\n                << \"\\nError(s) in input:\\n\"\n                << Column( result.errorMessage() ).indent( 2 )\n                << \"\\n\\n\";\n            Catch::cerr() << \"Run with -? for usage\\n\" << std::endl;\n            return MaxExitCode;\n        }\n\n        if( m_configData.showHelp )\n            showHelp();\n        if( m_configData.libIdentify )\n            libIdentify();\n        m_config.reset();\n        return 0;\n    }\n\n#if defined(CATCH_CONFIG_WCHAR) && defined(_WIN32) && defined(UNICODE)\n    int Session::applyCommandLine( int argc, wchar_t const * const * argv ) {\n\n        char **utf8Argv = new char *[ argc ];\n\n        for ( int i = 0; i < argc; ++i ) {\n            int bufSize = WideCharToMultiByte( CP_UTF8, 0, argv[i], -1, nullptr, 0, nullptr, nullptr );\n\n            utf8Argv[ i ] = new char[ bufSize ];\n\n            WideCharToMultiByte( CP_UTF8, 0, argv[i], -1, utf8Argv[i], bufSize, nullptr, nullptr );\n        }\n\n        int returnCode = applyCommandLine( argc, utf8Argv );\n\n        for ( int i = 0; i < argc; ++i )\n            delete [] utf8Argv[ i ];\n\n        delete [] utf8Argv;\n\n        return returnCode;\n    }\n#endif\n\n    void Session::useConfigData( ConfigData const& configData ) {\n        m_configData = configData;\n        m_config.reset();\n    }\n\n    int Session::run() {\n        if( ( m_configData.waitForKeypress & WaitForKeypress::BeforeStart ) != 0 ) {\n            Catch::cout() << \"...waiting for enter/ return before starting\" << std::endl;\n            static_cast<void>(std::getchar());\n        }\n        int exitCode = runInternal();\n        if( ( m_configData.waitForKeypress & WaitForKeypress::BeforeExit ) != 0 ) {\n            Catch::cout() << \"...waiting for enter/ return before exiting, with code: \" << exitCode << std::endl;\n            static_cast<void>(std::getchar());\n        }\n        return exitCode;\n    }\n\n    clara::Parser const& Session::cli() const {\n        return m_cli;\n    }\n    void Session::cli( clara::Parser const& newParser ) {\n        m_cli = newParser;\n    }\n    ConfigData& Session::configData() {\n        return m_configData;\n    }\n    Config& Session::config() {\n        if( !m_config )\n            m_config = std::make_shared<Config>( m_configData );\n        return *m_config;\n    }\n\n    int Session::runInternal() {\n        if( m_startupExceptions )\n            return 1;\n\n        if (m_configData.showHelp || m_configData.libIdentify) {\n            return 0;\n        }\n\n        CATCH_TRY {\n            config(); // Force config to be constructed\n\n            seedRng( *m_config );\n\n            if( m_configData.filenamesAsTags )\n                applyFilenamesAsTags( *m_config );\n\n            // Handle list request\n            if( Option<std::size_t> listed = list( m_config ) )\n                return (std::min) (MaxExitCode, static_cast<int>(*listed));\n\n            TestGroup tests { m_config };\n            auto const totals = tests.execute();\n\n            if( m_config->warnAboutNoTests() && totals.error == -1 )\n                return 2;\n\n            // Note that on unices only the lower 8 bits are usually used, clamping\n            // the return value to 255 prevents false negative when some multiple\n            // of 256 tests has failed\n            return (std::min) (MaxExitCode, (std::max) (totals.error, static_cast<int>(totals.assertions.failed)));\n        }\n#if !defined(CATCH_CONFIG_DISABLE_EXCEPTIONS)\n        catch( std::exception& ex ) {\n            Catch::cerr() << ex.what() << std::endl;\n            return MaxExitCode;\n        }\n#endif\n    }\n\n} // end namespace Catch\n// end catch_session.cpp\n// start catch_singletons.cpp\n\n#include <vector>\n\nnamespace Catch {\n\n    namespace {\n        static auto getSingletons() -> std::vector<ISingleton*>*& {\n            static std::vector<ISingleton*>* g_singletons = nullptr;\n            if( !g_singletons )\n                g_singletons = new std::vector<ISingleton*>();\n            return g_singletons;\n        }\n    }\n\n    ISingleton::~ISingleton() {}\n\n    void addSingleton(ISingleton* singleton ) {\n        getSingletons()->push_back( singleton );\n    }\n    void cleanupSingletons() {\n        auto& singletons = getSingletons();\n        for( auto singleton : *singletons )\n            delete singleton;\n        delete singletons;\n        singletons = nullptr;\n    }\n\n} // namespace Catch\n// end catch_singletons.cpp\n// start catch_startup_exception_registry.cpp\n\n#if !defined(CATCH_CONFIG_DISABLE_EXCEPTIONS)\nnamespace Catch {\nvoid StartupExceptionRegistry::add( std::exception_ptr const& exception ) noexcept {\n        CATCH_TRY {\n            m_exceptions.push_back(exception);\n        } CATCH_CATCH_ALL {\n            // If we run out of memory during start-up there's really not a lot more we can do about it\n            std::terminate();\n        }\n    }\n\n    std::vector<std::exception_ptr> const& StartupExceptionRegistry::getExceptions() const noexcept {\n        return m_exceptions;\n    }\n\n} // end namespace Catch\n#endif\n// end catch_startup_exception_registry.cpp\n// start catch_stream.cpp\n\n#include <cstdio>\n#include <iostream>\n#include <fstream>\n#include <sstream>\n#include <vector>\n#include <memory>\n\nnamespace Catch {\n\n    Catch::IStream::~IStream() = default;\n\n    namespace Detail { namespace {\n        template<typename WriterF, std::size_t bufferSize=256>\n        class StreamBufImpl : public std::streambuf {\n            char data[bufferSize];\n            WriterF m_writer;\n\n        public:\n            StreamBufImpl() {\n                setp( data, data + sizeof(data) );\n            }\n\n            ~StreamBufImpl() noexcept {\n                StreamBufImpl::sync();\n            }\n\n        private:\n            int overflow( int c ) override {\n                sync();\n\n                if( c != EOF ) {\n                    if( pbase() == epptr() )\n                        m_writer( std::string( 1, static_cast<char>( c ) ) );\n                    else\n                        sputc( static_cast<char>( c ) );\n                }\n                return 0;\n            }\n\n            int sync() override {\n                if( pbase() != pptr() ) {\n                    m_writer( std::string( pbase(), static_cast<std::string::size_type>( pptr() - pbase() ) ) );\n                    setp( pbase(), epptr() );\n                }\n                return 0;\n            }\n        };\n\n        ///////////////////////////////////////////////////////////////////////////\n\n        struct OutputDebugWriter {\n\n            void operator()( std::string const&str ) {\n                writeToDebugConsole( str );\n            }\n        };\n\n        ///////////////////////////////////////////////////////////////////////////\n\n        class FileStream : public IStream {\n            mutable std::ofstream m_ofs;\n        public:\n            FileStream( StringRef filename ) {\n                m_ofs.open( filename.c_str() );\n                CATCH_ENFORCE( !m_ofs.fail(), \"Unable to open file: '\" << filename << \"'\" );\n            }\n            ~FileStream() override = default;\n        public: // IStream\n            std::ostream& stream() const override {\n                return m_ofs;\n            }\n        };\n\n        ///////////////////////////////////////////////////////////////////////////\n\n        class CoutStream : public IStream {\n            mutable std::ostream m_os;\n        public:\n            // Store the streambuf from cout up-front because\n            // cout may get redirected when running tests\n            CoutStream() : m_os( Catch::cout().rdbuf() ) {}\n            ~CoutStream() override = default;\n\n        public: // IStream\n            std::ostream& stream() const override { return m_os; }\n        };\n\n        ///////////////////////////////////////////////////////////////////////////\n\n        class DebugOutStream : public IStream {\n            std::unique_ptr<StreamBufImpl<OutputDebugWriter>> m_streamBuf;\n            mutable std::ostream m_os;\n        public:\n            DebugOutStream()\n            :   m_streamBuf( new StreamBufImpl<OutputDebugWriter>() ),\n                m_os( m_streamBuf.get() )\n            {}\n\n            ~DebugOutStream() override = default;\n\n        public: // IStream\n            std::ostream& stream() const override { return m_os; }\n        };\n\n    }} // namespace anon::detail\n\n    ///////////////////////////////////////////////////////////////////////////\n\n    auto makeStream( StringRef const &filename ) -> IStream const* {\n        if( filename.empty() )\n            return new Detail::CoutStream();\n        else if( filename[0] == '%' ) {\n            if( filename == \"%debug\" )\n                return new Detail::DebugOutStream();\n            else\n                CATCH_ERROR( \"Unrecognised stream: '\" << filename << \"'\" );\n        }\n        else\n            return new Detail::FileStream( filename );\n    }\n\n    // This class encapsulates the idea of a pool of ostringstreams that can be reused.\n    struct StringStreams {\n        std::vector<std::unique_ptr<std::ostringstream>> m_streams;\n        std::vector<std::size_t> m_unused;\n        std::ostringstream m_referenceStream; // Used for copy state/ flags from\n\n        auto add() -> std::size_t {\n            if( m_unused.empty() ) {\n                m_streams.push_back( std::unique_ptr<std::ostringstream>( new std::ostringstream ) );\n                return m_streams.size()-1;\n            }\n            else {\n                auto index = m_unused.back();\n                m_unused.pop_back();\n                return index;\n            }\n        }\n\n        void release( std::size_t index ) {\n            m_streams[index]->copyfmt( m_referenceStream ); // Restore initial flags and other state\n            m_unused.push_back(index);\n        }\n    };\n\n    ReusableStringStream::ReusableStringStream()\n    :   m_index( Singleton<StringStreams>::getMutable().add() ),\n        m_oss( Singleton<StringStreams>::getMutable().m_streams[m_index].get() )\n    {}\n\n    ReusableStringStream::~ReusableStringStream() {\n        static_cast<std::ostringstream*>( m_oss )->str(\"\");\n        m_oss->clear();\n        Singleton<StringStreams>::getMutable().release( m_index );\n    }\n\n    auto ReusableStringStream::str() const -> std::string {\n        return static_cast<std::ostringstream*>( m_oss )->str();\n    }\n\n    ///////////////////////////////////////////////////////////////////////////\n\n#ifndef CATCH_CONFIG_NOSTDOUT // If you #define this you must implement these functions\n    std::ostream& cout() { return std::cout; }\n    std::ostream& cerr() { return std::cerr; }\n    std::ostream& clog() { return std::clog; }\n#endif\n}\n// end catch_stream.cpp\n// start catch_string_manip.cpp\n\n#include <algorithm>\n#include <ostream>\n#include <cstring>\n#include <cctype>\n#include <vector>\n\nnamespace Catch {\n\n    namespace {\n        char toLowerCh(char c) {\n            return static_cast<char>( std::tolower( static_cast<unsigned char>(c) ) );\n        }\n    }\n\n    bool startsWith( std::string const& s, std::string const& prefix ) {\n        return s.size() >= prefix.size() && std::equal(prefix.begin(), prefix.end(), s.begin());\n    }\n    bool startsWith( std::string const& s, char prefix ) {\n        return !s.empty() && s[0] == prefix;\n    }\n    bool endsWith( std::string const& s, std::string const& suffix ) {\n        return s.size() >= suffix.size() && std::equal(suffix.rbegin(), suffix.rend(), s.rbegin());\n    }\n    bool endsWith( std::string const& s, char suffix ) {\n        return !s.empty() && s[s.size()-1] == suffix;\n    }\n    bool contains( std::string const& s, std::string const& infix ) {\n        return s.find( infix ) != std::string::npos;\n    }\n    void toLowerInPlace( std::string& s ) {\n        std::transform( s.begin(), s.end(), s.begin(), toLowerCh );\n    }\n    std::string toLower( std::string const& s ) {\n        std::string lc = s;\n        toLowerInPlace( lc );\n        return lc;\n    }\n    std::string trim( std::string const& str ) {\n        static char const* whitespaceChars = \"\\n\\r\\t \";\n        std::string::size_type start = str.find_first_not_of( whitespaceChars );\n        std::string::size_type end = str.find_last_not_of( whitespaceChars );\n\n        return start != std::string::npos ? str.substr( start, 1+end-start ) : std::string();\n    }\n\n    StringRef trim(StringRef ref) {\n        const auto is_ws = [](char c) {\n            return c == ' ' || c == '\\t' || c == '\\n' || c == '\\r';\n        };\n        size_t real_begin = 0;\n        while (real_begin < ref.size() && is_ws(ref[real_begin])) { ++real_begin; }\n        size_t real_end = ref.size();\n        while (real_end > real_begin && is_ws(ref[real_end - 1])) { --real_end; }\n\n        return ref.substr(real_begin, real_end - real_begin);\n    }\n\n    bool replaceInPlace( std::string& str, std::string const& replaceThis, std::string const& withThis ) {\n        bool replaced = false;\n        std::size_t i = str.find( replaceThis );\n        while( i != std::string::npos ) {\n            replaced = true;\n            str = str.substr( 0, i ) + withThis + str.substr( i+replaceThis.size() );\n            if( i < str.size()-withThis.size() )\n                i = str.find( replaceThis, i+withThis.size() );\n            else\n                i = std::string::npos;\n        }\n        return replaced;\n    }\n\n    std::vector<StringRef> splitStringRef( StringRef str, char delimiter ) {\n        std::vector<StringRef> subStrings;\n        std::size_t start = 0;\n        for(std::size_t pos = 0; pos < str.size(); ++pos ) {\n            if( str[pos] == delimiter ) {\n                if( pos - start > 1 )\n                    subStrings.push_back( str.substr( start, pos-start ) );\n                start = pos+1;\n            }\n        }\n        if( start < str.size() )\n            subStrings.push_back( str.substr( start, str.size()-start ) );\n        return subStrings;\n    }\n\n    pluralise::pluralise( std::size_t count, std::string const& label )\n    :   m_count( count ),\n        m_label( label )\n    {}\n\n    std::ostream& operator << ( std::ostream& os, pluralise const& pluraliser ) {\n        os << pluraliser.m_count << ' ' << pluraliser.m_label;\n        if( pluraliser.m_count != 1 )\n            os << 's';\n        return os;\n    }\n\n}\n// end catch_string_manip.cpp\n// start catch_stringref.cpp\n\n#include <algorithm>\n#include <ostream>\n#include <cstring>\n#include <cstdint>\n\nnamespace Catch {\n    StringRef::StringRef( char const* rawChars ) noexcept\n    : StringRef( rawChars, static_cast<StringRef::size_type>(std::strlen(rawChars) ) )\n    {}\n\n    auto StringRef::c_str() const -> char const* {\n        CATCH_ENFORCE(isNullTerminated(), \"Called StringRef::c_str() on a non-null-terminated instance\");\n        return m_start;\n    }\n    auto StringRef::data() const noexcept -> char const* {\n        return m_start;\n    }\n\n    auto StringRef::substr( size_type start, size_type size ) const noexcept -> StringRef {\n        if (start < m_size) {\n            return StringRef(m_start + start, (std::min)(m_size - start, size));\n        } else {\n            return StringRef();\n        }\n    }\n    auto StringRef::operator == ( StringRef const& other ) const noexcept -> bool {\n        return m_size == other.m_size\n            && (std::memcmp( m_start, other.m_start, m_size ) == 0);\n    }\n\n    auto operator << ( std::ostream& os, StringRef const& str ) -> std::ostream& {\n        return os.write(str.data(), str.size());\n    }\n\n    auto operator+=( std::string& lhs, StringRef const& rhs ) -> std::string& {\n        lhs.append(rhs.data(), rhs.size());\n        return lhs;\n    }\n\n} // namespace Catch\n// end catch_stringref.cpp\n// start catch_tag_alias.cpp\n\nnamespace Catch {\n    TagAlias::TagAlias(std::string const & _tag, SourceLineInfo _lineInfo): tag(_tag), lineInfo(_lineInfo) {}\n}\n// end catch_tag_alias.cpp\n// start catch_tag_alias_autoregistrar.cpp\n\nnamespace Catch {\n\n    RegistrarForTagAliases::RegistrarForTagAliases(char const* alias, char const* tag, SourceLineInfo const& lineInfo) {\n        CATCH_TRY {\n            getMutableRegistryHub().registerTagAlias(alias, tag, lineInfo);\n        } CATCH_CATCH_ALL {\n            // Do not throw when constructing global objects, instead register the exception to be processed later\n            getMutableRegistryHub().registerStartupException();\n        }\n    }\n\n}\n// end catch_tag_alias_autoregistrar.cpp\n// start catch_tag_alias_registry.cpp\n\n#include <sstream>\n\nnamespace Catch {\n\n    TagAliasRegistry::~TagAliasRegistry() {}\n\n    TagAlias const* TagAliasRegistry::find( std::string const& alias ) const {\n        auto it = m_registry.find( alias );\n        if( it != m_registry.end() )\n            return &(it->second);\n        else\n            return nullptr;\n    }\n\n    std::string TagAliasRegistry::expandAliases( std::string const& unexpandedTestSpec ) const {\n        std::string expandedTestSpec = unexpandedTestSpec;\n        for( auto const& registryKvp : m_registry ) {\n            std::size_t pos = expandedTestSpec.find( registryKvp.first );\n            if( pos != std::string::npos ) {\n                expandedTestSpec =  expandedTestSpec.substr( 0, pos ) +\n                                    registryKvp.second.tag +\n                                    expandedTestSpec.substr( pos + registryKvp.first.size() );\n            }\n        }\n        return expandedTestSpec;\n    }\n\n    void TagAliasRegistry::add( std::string const& alias, std::string const& tag, SourceLineInfo const& lineInfo ) {\n        CATCH_ENFORCE( startsWith(alias, \"[@\") && endsWith(alias, ']'),\n                      \"error: tag alias, '\" << alias << \"' is not of the form [@alias name].\\n\" << lineInfo );\n\n        CATCH_ENFORCE( m_registry.insert(std::make_pair(alias, TagAlias(tag, lineInfo))).second,\n                      \"error: tag alias, '\" << alias << \"' already registered.\\n\"\n                      << \"\\tFirst seen at: \" << find(alias)->lineInfo << \"\\n\"\n                      << \"\\tRedefined at: \" << lineInfo );\n    }\n\n    ITagAliasRegistry::~ITagAliasRegistry() {}\n\n    ITagAliasRegistry const& ITagAliasRegistry::get() {\n        return getRegistryHub().getTagAliasRegistry();\n    }\n\n} // end namespace Catch\n// end catch_tag_alias_registry.cpp\n// start catch_test_case_info.cpp\n\n#include <cctype>\n#include <exception>\n#include <algorithm>\n#include <sstream>\n\nnamespace Catch {\n\n    namespace {\n        TestCaseInfo::SpecialProperties parseSpecialTag( std::string const& tag ) {\n            if( startsWith( tag, '.' ) ||\n                tag == \"!hide\" )\n                return TestCaseInfo::IsHidden;\n            else if( tag == \"!throws\" )\n                return TestCaseInfo::Throws;\n            else if( tag == \"!shouldfail\" )\n                return TestCaseInfo::ShouldFail;\n            else if( tag == \"!mayfail\" )\n                return TestCaseInfo::MayFail;\n            else if( tag == \"!nonportable\" )\n                return TestCaseInfo::NonPortable;\n            else if( tag == \"!benchmark\" )\n                return static_cast<TestCaseInfo::SpecialProperties>( TestCaseInfo::Benchmark | TestCaseInfo::IsHidden );\n            else\n                return TestCaseInfo::None;\n        }\n        bool isReservedTag( std::string const& tag ) {\n            return parseSpecialTag( tag ) == TestCaseInfo::None && tag.size() > 0 && !std::isalnum( static_cast<unsigned char>(tag[0]) );\n        }\n        void enforceNotReservedTag( std::string const& tag, SourceLineInfo const& _lineInfo ) {\n            CATCH_ENFORCE( !isReservedTag(tag),\n                          \"Tag name: [\" << tag << \"] is not allowed.\\n\"\n                          << \"Tag names starting with non alphanumeric characters are reserved\\n\"\n                          << _lineInfo );\n        }\n    }\n\n    TestCase makeTestCase(  ITestInvoker* _testCase,\n                            std::string const& _className,\n                            NameAndTags const& nameAndTags,\n                            SourceLineInfo const& _lineInfo )\n    {\n        bool isHidden = false;\n\n        // Parse out tags\n        std::vector<std::string> tags;\n        std::string desc, tag;\n        bool inTag = false;\n        for (char c : nameAndTags.tags) {\n            if( !inTag ) {\n                if( c == '[' )\n                    inTag = true;\n                else\n                    desc += c;\n            }\n            else {\n                if( c == ']' ) {\n                    TestCaseInfo::SpecialProperties prop = parseSpecialTag( tag );\n                    if( ( prop & TestCaseInfo::IsHidden ) != 0 )\n                        isHidden = true;\n                    else if( prop == TestCaseInfo::None )\n                        enforceNotReservedTag( tag, _lineInfo );\n\n                    // Merged hide tags like `[.approvals]` should be added as\n                    // `[.][approvals]`. The `[.]` is added at later point, so\n                    // we only strip the prefix\n                    if (startsWith(tag, '.') && tag.size() > 1) {\n                        tag.erase(0, 1);\n                    }\n                    tags.push_back( tag );\n                    tag.clear();\n                    inTag = false;\n                }\n                else\n                    tag += c;\n            }\n        }\n        if( isHidden ) {\n            // Add all \"hidden\" tags to make them behave identically\n            tags.insert( tags.end(), { \".\", \"!hide\" } );\n        }\n\n        TestCaseInfo info( static_cast<std::string>(nameAndTags.name), _className, desc, tags, _lineInfo );\n        return TestCase( _testCase, std::move(info) );\n    }\n\n    void setTags( TestCaseInfo& testCaseInfo, std::vector<std::string> tags ) {\n        std::sort(begin(tags), end(tags));\n        tags.erase(std::unique(begin(tags), end(tags)), end(tags));\n        testCaseInfo.lcaseTags.clear();\n\n        for( auto const& tag : tags ) {\n            std::string lcaseTag = toLower( tag );\n            testCaseInfo.properties = static_cast<TestCaseInfo::SpecialProperties>( testCaseInfo.properties | parseSpecialTag( lcaseTag ) );\n            testCaseInfo.lcaseTags.push_back( lcaseTag );\n        }\n        testCaseInfo.tags = std::move(tags);\n    }\n\n    TestCaseInfo::TestCaseInfo( std::string const& _name,\n                                std::string const& _className,\n                                std::string const& _description,\n                                std::vector<std::string> const& _tags,\n                                SourceLineInfo const& _lineInfo )\n    :   name( _name ),\n        className( _className ),\n        description( _description ),\n        lineInfo( _lineInfo ),\n        properties( None )\n    {\n        setTags( *this, _tags );\n    }\n\n    bool TestCaseInfo::isHidden() const {\n        return ( properties & IsHidden ) != 0;\n    }\n    bool TestCaseInfo::throws() const {\n        return ( properties & Throws ) != 0;\n    }\n    bool TestCaseInfo::okToFail() const {\n        return ( properties & (ShouldFail | MayFail ) ) != 0;\n    }\n    bool TestCaseInfo::expectedToFail() const {\n        return ( properties & (ShouldFail ) ) != 0;\n    }\n\n    std::string TestCaseInfo::tagsAsString() const {\n        std::string ret;\n        // '[' and ']' per tag\n        std::size_t full_size = 2 * tags.size();\n        for (const auto& tag : tags) {\n            full_size += tag.size();\n        }\n        ret.reserve(full_size);\n        for (const auto& tag : tags) {\n            ret.push_back('[');\n            ret.append(tag);\n            ret.push_back(']');\n        }\n\n        return ret;\n    }\n\n    TestCase::TestCase( ITestInvoker* testCase, TestCaseInfo&& info ) : TestCaseInfo( std::move(info) ), test( testCase ) {}\n\n    TestCase TestCase::withName( std::string const& _newName ) const {\n        TestCase other( *this );\n        other.name = _newName;\n        return other;\n    }\n\n    void TestCase::invoke() const {\n        test->invoke();\n    }\n\n    bool TestCase::operator == ( TestCase const& other ) const {\n        return  test.get() == other.test.get() &&\n                name == other.name &&\n                className == other.className;\n    }\n\n    bool TestCase::operator < ( TestCase const& other ) const {\n        return name < other.name;\n    }\n\n    TestCaseInfo const& TestCase::getTestCaseInfo() const\n    {\n        return *this;\n    }\n\n} // end namespace Catch\n// end catch_test_case_info.cpp\n// start catch_test_case_registry_impl.cpp\n\n#include <algorithm>\n#include <sstream>\n\nnamespace Catch {\n\n    namespace {\n        struct TestHasher {\n            using hash_t = uint64_t;\n\n            explicit TestHasher( hash_t hashSuffix ):\n                m_hashSuffix{ hashSuffix } {}\n\n            uint32_t operator()( TestCase const& t ) const {\n                // FNV-1a hash with multiplication fold.\n                const hash_t prime = 1099511628211u;\n                hash_t hash = 14695981039346656037u;\n                for ( const char c : t.name ) {\n                    hash ^= c;\n                    hash *= prime;\n                }\n                hash ^= m_hashSuffix;\n                hash *= prime;\n                const uint32_t low{ static_cast<uint32_t>( hash ) };\n                const uint32_t high{ static_cast<uint32_t>( hash >> 32 ) };\n                return low * high;\n            }\n\n        private:\n            hash_t m_hashSuffix;\n        };\n    } // end unnamed namespace\n\n    std::vector<TestCase> sortTests( IConfig const& config, std::vector<TestCase> const& unsortedTestCases ) {\n        switch( config.runOrder() ) {\n            case RunTests::InDeclarationOrder:\n                // already in declaration order\n                break;\n\n            case RunTests::InLexicographicalOrder: {\n                std::vector<TestCase> sorted = unsortedTestCases;\n                std::sort( sorted.begin(), sorted.end() );\n                return sorted;\n            }\n\n            case RunTests::InRandomOrder: {\n                seedRng( config );\n                TestHasher h{ config.rngSeed() };\n\n                using hashedTest = std::pair<TestHasher::hash_t, TestCase const*>;\n                std::vector<hashedTest> indexed_tests;\n                indexed_tests.reserve( unsortedTestCases.size() );\n\n                for (auto const& testCase : unsortedTestCases) {\n                    indexed_tests.emplace_back(h(testCase), &testCase);\n                }\n\n                std::sort(indexed_tests.begin(), indexed_tests.end(),\n                          [](hashedTest const& lhs, hashedTest const& rhs) {\n                          if (lhs.first == rhs.first) {\n                              return lhs.second->name < rhs.second->name;\n                          }\n                          return lhs.first < rhs.first;\n                });\n\n                std::vector<TestCase> sorted;\n                sorted.reserve( indexed_tests.size() );\n\n                for (auto const& hashed : indexed_tests) {\n                    sorted.emplace_back(*hashed.second);\n                }\n\n                return sorted;\n            }\n        }\n        return unsortedTestCases;\n    }\n\n    bool isThrowSafe( TestCase const& testCase, IConfig const& config ) {\n        return !testCase.throws() || config.allowThrows();\n    }\n\n    bool matchTest( TestCase const& testCase, TestSpec const& testSpec, IConfig const& config ) {\n        return testSpec.matches( testCase ) && isThrowSafe( testCase, config );\n    }\n\n    void enforceNoDuplicateTestCases( std::vector<TestCase> const& functions ) {\n        std::set<TestCase> seenFunctions;\n        for( auto const& function : functions ) {\n            auto prev = seenFunctions.insert( function );\n            CATCH_ENFORCE( prev.second,\n                    \"error: TEST_CASE( \\\"\" << function.name << \"\\\" ) already defined.\\n\"\n                    << \"\\tFirst seen at \" << prev.first->getTestCaseInfo().lineInfo << \"\\n\"\n                    << \"\\tRedefined at \" << function.getTestCaseInfo().lineInfo );\n        }\n    }\n\n    std::vector<TestCase> filterTests( std::vector<TestCase> const& testCases, TestSpec const& testSpec, IConfig const& config ) {\n        std::vector<TestCase> filtered;\n        filtered.reserve( testCases.size() );\n        for (auto const& testCase : testCases) {\n            if ((!testSpec.hasFilters() && !testCase.isHidden()) ||\n                (testSpec.hasFilters() && matchTest(testCase, testSpec, config))) {\n                filtered.push_back(testCase);\n            }\n        }\n        return filtered;\n    }\n    std::vector<TestCase> const& getAllTestCasesSorted( IConfig const& config ) {\n        return getRegistryHub().getTestCaseRegistry().getAllTestsSorted( config );\n    }\n\n    void TestRegistry::registerTest( TestCase const& testCase ) {\n        std::string name = testCase.getTestCaseInfo().name;\n        if( name.empty() ) {\n            ReusableStringStream rss;\n            rss << \"Anonymous test case \" << ++m_unnamedCount;\n            return registerTest( testCase.withName( rss.str() ) );\n        }\n        m_functions.push_back( testCase );\n    }\n\n    std::vector<TestCase> const& TestRegistry::getAllTests() const {\n        return m_functions;\n    }\n    std::vector<TestCase> const& TestRegistry::getAllTestsSorted( IConfig const& config ) const {\n        if( m_sortedFunctions.empty() )\n            enforceNoDuplicateTestCases( m_functions );\n\n        if(  m_currentSortOrder != config.runOrder() || m_sortedFunctions.empty() ) {\n            m_sortedFunctions = sortTests( config, m_functions );\n            m_currentSortOrder = config.runOrder();\n        }\n        return m_sortedFunctions;\n    }\n\n    ///////////////////////////////////////////////////////////////////////////\n    TestInvokerAsFunction::TestInvokerAsFunction( void(*testAsFunction)() ) noexcept : m_testAsFunction( testAsFunction ) {}\n\n    void TestInvokerAsFunction::invoke() const {\n        m_testAsFunction();\n    }\n\n    std::string extractClassName( StringRef const& classOrQualifiedMethodName ) {\n        std::string className(classOrQualifiedMethodName);\n        if( startsWith( className, '&' ) )\n        {\n            std::size_t lastColons = className.rfind( \"::\" );\n            std::size_t penultimateColons = className.rfind( \"::\", lastColons-1 );\n            if( penultimateColons == std::string::npos )\n                penultimateColons = 1;\n            className = className.substr( penultimateColons, lastColons-penultimateColons );\n        }\n        return className;\n    }\n\n} // end namespace Catch\n// end catch_test_case_registry_impl.cpp\n// start catch_test_case_tracker.cpp\n\n#include <algorithm>\n#include <cassert>\n#include <stdexcept>\n#include <memory>\n#include <sstream>\n\n#if defined(__clang__)\n#    pragma clang diagnostic push\n#    pragma clang diagnostic ignored \"-Wexit-time-destructors\"\n#endif\n\nnamespace Catch {\nnamespace TestCaseTracking {\n\n    NameAndLocation::NameAndLocation( std::string const& _name, SourceLineInfo const& _location )\n    :   name( _name ),\n        location( _location )\n    {}\n\n    ITracker::~ITracker() = default;\n\n    ITracker& TrackerContext::startRun() {\n        m_rootTracker = std::make_shared<SectionTracker>( NameAndLocation( \"{root}\", CATCH_INTERNAL_LINEINFO ), *this, nullptr );\n        m_currentTracker = nullptr;\n        m_runState = Executing;\n        return *m_rootTracker;\n    }\n\n    void TrackerContext::endRun() {\n        m_rootTracker.reset();\n        m_currentTracker = nullptr;\n        m_runState = NotStarted;\n    }\n\n    void TrackerContext::startCycle() {\n        m_currentTracker = m_rootTracker.get();\n        m_runState = Executing;\n    }\n    void TrackerContext::completeCycle() {\n        m_runState = CompletedCycle;\n    }\n\n    bool TrackerContext::completedCycle() const {\n        return m_runState == CompletedCycle;\n    }\n    ITracker& TrackerContext::currentTracker() {\n        return *m_currentTracker;\n    }\n    void TrackerContext::setCurrentTracker( ITracker* tracker ) {\n        m_currentTracker = tracker;\n    }\n\n    TrackerBase::TrackerBase( NameAndLocation const& nameAndLocation, TrackerContext& ctx, ITracker* parent ):\n        ITracker(nameAndLocation),\n        m_ctx( ctx ),\n        m_parent( parent )\n    {}\n\n    bool TrackerBase::isComplete() const {\n        return m_runState == CompletedSuccessfully || m_runState == Failed;\n    }\n    bool TrackerBase::isSuccessfullyCompleted() const {\n        return m_runState == CompletedSuccessfully;\n    }\n    bool TrackerBase::isOpen() const {\n        return m_runState != NotStarted && !isComplete();\n    }\n    bool TrackerBase::hasChildren() const {\n        return !m_children.empty();\n    }\n\n    void TrackerBase::addChild( ITrackerPtr const& child ) {\n        m_children.push_back( child );\n    }\n\n    ITrackerPtr TrackerBase::findChild( NameAndLocation const& nameAndLocation ) {\n        auto it = std::find_if( m_children.begin(), m_children.end(),\n            [&nameAndLocation]( ITrackerPtr const& tracker ){\n                return\n                    tracker->nameAndLocation().location == nameAndLocation.location &&\n                    tracker->nameAndLocation().name == nameAndLocation.name;\n            } );\n        return( it != m_children.end() )\n            ? *it\n            : nullptr;\n    }\n    ITracker& TrackerBase::parent() {\n        assert( m_parent ); // Should always be non-null except for root\n        return *m_parent;\n    }\n\n    void TrackerBase::openChild() {\n        if( m_runState != ExecutingChildren ) {\n            m_runState = ExecutingChildren;\n            if( m_parent )\n                m_parent->openChild();\n        }\n    }\n\n    bool TrackerBase::isSectionTracker() const { return false; }\n    bool TrackerBase::isGeneratorTracker() const { return false; }\n\n    void TrackerBase::open() {\n        m_runState = Executing;\n        moveToThis();\n        if( m_parent )\n            m_parent->openChild();\n    }\n\n    void TrackerBase::close() {\n\n        // Close any still open children (e.g. generators)\n        while( &m_ctx.currentTracker() != this )\n            m_ctx.currentTracker().close();\n\n        switch( m_runState ) {\n            case NeedsAnotherRun:\n                break;\n\n            case Executing:\n                m_runState = CompletedSuccessfully;\n                break;\n            case ExecutingChildren:\n                if( std::all_of(m_children.begin(), m_children.end(), [](ITrackerPtr const& t){ return t->isComplete(); }) )\n                    m_runState = CompletedSuccessfully;\n                break;\n\n            case NotStarted:\n            case CompletedSuccessfully:\n            case Failed:\n                CATCH_INTERNAL_ERROR( \"Illogical state: \" << m_runState );\n\n            default:\n                CATCH_INTERNAL_ERROR( \"Unknown state: \" << m_runState );\n        }\n        moveToParent();\n        m_ctx.completeCycle();\n    }\n    void TrackerBase::fail() {\n        m_runState = Failed;\n        if( m_parent )\n            m_parent->markAsNeedingAnotherRun();\n        moveToParent();\n        m_ctx.completeCycle();\n    }\n    void TrackerBase::markAsNeedingAnotherRun() {\n        m_runState = NeedsAnotherRun;\n    }\n\n    void TrackerBase::moveToParent() {\n        assert( m_parent );\n        m_ctx.setCurrentTracker( m_parent );\n    }\n    void TrackerBase::moveToThis() {\n        m_ctx.setCurrentTracker( this );\n    }\n\n    SectionTracker::SectionTracker( NameAndLocation const& nameAndLocation, TrackerContext& ctx, ITracker* parent )\n    :   TrackerBase( nameAndLocation, ctx, parent ),\n        m_trimmed_name(trim(nameAndLocation.name))\n    {\n        if( parent ) {\n            while( !parent->isSectionTracker() )\n                parent = &parent->parent();\n\n            SectionTracker& parentSection = static_cast<SectionTracker&>( *parent );\n            addNextFilters( parentSection.m_filters );\n        }\n    }\n\n    bool SectionTracker::isComplete() const {\n        bool complete = true;\n\n        if (m_filters.empty()\n            || m_filters[0] == \"\"\n            || std::find(m_filters.begin(), m_filters.end(), m_trimmed_name) != m_filters.end()) {\n            complete = TrackerBase::isComplete();\n        }\n        return complete;\n    }\n\n    bool SectionTracker::isSectionTracker() const { return true; }\n\n    SectionTracker& SectionTracker::acquire( TrackerContext& ctx, NameAndLocation const& nameAndLocation ) {\n        std::shared_ptr<SectionTracker> section;\n\n        ITracker& currentTracker = ctx.currentTracker();\n        if( ITrackerPtr childTracker = currentTracker.findChild( nameAndLocation ) ) {\n            assert( childTracker );\n            assert( childTracker->isSectionTracker() );\n            section = std::static_pointer_cast<SectionTracker>( childTracker );\n        }\n        else {\n            section = std::make_shared<SectionTracker>( nameAndLocation, ctx, &currentTracker );\n            currentTracker.addChild( section );\n        }\n        if( !ctx.completedCycle() )\n            section->tryOpen();\n        return *section;\n    }\n\n    void SectionTracker::tryOpen() {\n        if( !isComplete() )\n            open();\n    }\n\n    void SectionTracker::addInitialFilters( std::vector<std::string> const& filters ) {\n        if( !filters.empty() ) {\n            m_filters.reserve( m_filters.size() + filters.size() + 2 );\n            m_filters.emplace_back(\"\"); // Root - should never be consulted\n            m_filters.emplace_back(\"\"); // Test Case - not a section filter\n            m_filters.insert( m_filters.end(), filters.begin(), filters.end() );\n        }\n    }\n    void SectionTracker::addNextFilters( std::vector<std::string> const& filters ) {\n        if( filters.size() > 1 )\n            m_filters.insert( m_filters.end(), filters.begin()+1, filters.end() );\n    }\n\n    std::vector<std::string> const& SectionTracker::getFilters() const {\n        return m_filters;\n    }\n\n    std::string const& SectionTracker::trimmedName() const {\n        return m_trimmed_name;\n    }\n\n} // namespace TestCaseTracking\n\nusing TestCaseTracking::ITracker;\nusing TestCaseTracking::TrackerContext;\nusing TestCaseTracking::SectionTracker;\n\n} // namespace Catch\n\n#if defined(__clang__)\n#    pragma clang diagnostic pop\n#endif\n// end catch_test_case_tracker.cpp\n// start catch_test_registry.cpp\n\nnamespace Catch {\n\n    auto makeTestInvoker( void(*testAsFunction)() ) noexcept -> ITestInvoker* {\n        return new(std::nothrow) TestInvokerAsFunction( testAsFunction );\n    }\n\n    NameAndTags::NameAndTags( StringRef const& name_ , StringRef const& tags_ ) noexcept : name( name_ ), tags( tags_ ) {}\n\n    AutoReg::AutoReg( ITestInvoker* invoker, SourceLineInfo const& lineInfo, StringRef const& classOrMethod, NameAndTags const& nameAndTags ) noexcept {\n        CATCH_TRY {\n            getMutableRegistryHub()\n                    .registerTest(\n                        makeTestCase(\n                            invoker,\n                            extractClassName( classOrMethod ),\n                            nameAndTags,\n                            lineInfo));\n        } CATCH_CATCH_ALL {\n            // Do not throw when constructing global objects, instead register the exception to be processed later\n            getMutableRegistryHub().registerStartupException();\n        }\n    }\n\n    AutoReg::~AutoReg() = default;\n}\n// end catch_test_registry.cpp\n// start catch_test_spec.cpp\n\n#include <algorithm>\n#include <string>\n#include <vector>\n#include <memory>\n\nnamespace Catch {\n\n    TestSpec::Pattern::Pattern( std::string const& name )\n    : m_name( name )\n    {}\n\n    TestSpec::Pattern::~Pattern() = default;\n\n    std::string const& TestSpec::Pattern::name() const {\n        return m_name;\n    }\n\n    TestSpec::NamePattern::NamePattern( std::string const& name, std::string const& filterString )\n    : Pattern( filterString )\n    , m_wildcardPattern( toLower( name ), CaseSensitive::No )\n    {}\n\n    bool TestSpec::NamePattern::matches( TestCaseInfo const& testCase ) const {\n        return m_wildcardPattern.matches( testCase.name );\n    }\n\n    TestSpec::TagPattern::TagPattern( std::string const& tag, std::string const& filterString )\n    : Pattern( filterString )\n    , m_tag( toLower( tag ) )\n    {}\n\n    bool TestSpec::TagPattern::matches( TestCaseInfo const& testCase ) const {\n        return std::find(begin(testCase.lcaseTags),\n                         end(testCase.lcaseTags),\n                         m_tag) != end(testCase.lcaseTags);\n    }\n\n    TestSpec::ExcludedPattern::ExcludedPattern( PatternPtr const& underlyingPattern )\n    : Pattern( underlyingPattern->name() )\n    , m_underlyingPattern( underlyingPattern )\n    {}\n\n    bool TestSpec::ExcludedPattern::matches( TestCaseInfo const& testCase ) const {\n        return !m_underlyingPattern->matches( testCase );\n    }\n\n    bool TestSpec::Filter::matches( TestCaseInfo const& testCase ) const {\n        return std::all_of( m_patterns.begin(), m_patterns.end(), [&]( PatternPtr const& p ){ return p->matches( testCase ); } );\n    }\n\n    std::string TestSpec::Filter::name() const {\n        std::string name;\n        for( auto const& p : m_patterns )\n            name += p->name();\n        return name;\n    }\n\n    bool TestSpec::hasFilters() const {\n        return !m_filters.empty();\n    }\n\n    bool TestSpec::matches( TestCaseInfo const& testCase ) const {\n        return std::any_of( m_filters.begin(), m_filters.end(), [&]( Filter const& f ){ return f.matches( testCase ); } );\n    }\n\n    TestSpec::Matches TestSpec::matchesByFilter( std::vector<TestCase> const& testCases, IConfig const& config ) const\n    {\n        Matches matches( m_filters.size() );\n        std::transform( m_filters.begin(), m_filters.end(), matches.begin(), [&]( Filter const& filter ){\n            std::vector<TestCase const*> currentMatches;\n            for( auto const& test : testCases )\n                if( isThrowSafe( test, config ) && filter.matches( test ) )\n                    currentMatches.emplace_back( &test );\n            return FilterMatch{ filter.name(), currentMatches };\n        } );\n        return matches;\n    }\n\n    const TestSpec::vectorStrings& TestSpec::getInvalidArgs() const{\n        return  (m_invalidArgs);\n    }\n\n}\n// end catch_test_spec.cpp\n// start catch_test_spec_parser.cpp\n\nnamespace Catch {\n\n    TestSpecParser::TestSpecParser( ITagAliasRegistry const& tagAliases ) : m_tagAliases( &tagAliases ) {}\n\n    TestSpecParser& TestSpecParser::parse( std::string const& arg ) {\n        m_mode = None;\n        m_exclusion = false;\n        m_arg = m_tagAliases->expandAliases( arg );\n        m_escapeChars.clear();\n        m_substring.reserve(m_arg.size());\n        m_patternName.reserve(m_arg.size());\n        m_realPatternPos = 0;\n\n        for( m_pos = 0; m_pos < m_arg.size(); ++m_pos )\n          //if visitChar fails\n           if( !visitChar( m_arg[m_pos] ) ){\n               m_testSpec.m_invalidArgs.push_back(arg);\n               break;\n           }\n        endMode();\n        return *this;\n    }\n    TestSpec TestSpecParser::testSpec() {\n        addFilter();\n        return m_testSpec;\n    }\n    bool TestSpecParser::visitChar( char c ) {\n        if( (m_mode != EscapedName) && (c == '\\\\') ) {\n            escape();\n            addCharToPattern(c);\n            return true;\n        }else if((m_mode != EscapedName) && (c == ',') )  {\n            return separate();\n        }\n\n        switch( m_mode ) {\n        case None:\n            if( processNoneChar( c ) )\n                return true;\n            break;\n        case Name:\n            processNameChar( c );\n            break;\n        case EscapedName:\n            endMode();\n            addCharToPattern(c);\n            return true;\n        default:\n        case Tag:\n        case QuotedName:\n            if( processOtherChar( c ) )\n                return true;\n            break;\n        }\n\n        m_substring += c;\n        if( !isControlChar( c ) ) {\n            m_patternName += c;\n            m_realPatternPos++;\n        }\n        return true;\n    }\n    // Two of the processing methods return true to signal the caller to return\n    // without adding the given character to the current pattern strings\n    bool TestSpecParser::processNoneChar( char c ) {\n        switch( c ) {\n        case ' ':\n            return true;\n        case '~':\n            m_exclusion = true;\n            return false;\n        case '[':\n            startNewMode( Tag );\n            return false;\n        case '\"':\n            startNewMode( QuotedName );\n            return false;\n        default:\n            startNewMode( Name );\n            return false;\n        }\n    }\n    void TestSpecParser::processNameChar( char c ) {\n        if( c == '[' ) {\n            if( m_substring == \"exclude:\" )\n                m_exclusion = true;\n            else\n                endMode();\n            startNewMode( Tag );\n        }\n    }\n    bool TestSpecParser::processOtherChar( char c ) {\n        if( !isControlChar( c ) )\n            return false;\n        m_substring += c;\n        endMode();\n        return true;\n    }\n    void TestSpecParser::startNewMode( Mode mode ) {\n        m_mode = mode;\n    }\n    void TestSpecParser::endMode() {\n        switch( m_mode ) {\n        case Name:\n        case QuotedName:\n            return addNamePattern();\n        case Tag:\n            return addTagPattern();\n        case EscapedName:\n            revertBackToLastMode();\n            return;\n        case None:\n        default:\n            return startNewMode( None );\n        }\n    }\n    void TestSpecParser::escape() {\n        saveLastMode();\n        m_mode = EscapedName;\n        m_escapeChars.push_back(m_realPatternPos);\n    }\n    bool TestSpecParser::isControlChar( char c ) const {\n        switch( m_mode ) {\n            default:\n                return false;\n            case None:\n                return c == '~';\n            case Name:\n                return c == '[';\n            case EscapedName:\n                return true;\n            case QuotedName:\n                return c == '\"';\n            case Tag:\n                return c == '[' || c == ']';\n        }\n    }\n\n    void TestSpecParser::addFilter() {\n        if( !m_currentFilter.m_patterns.empty() ) {\n            m_testSpec.m_filters.push_back( m_currentFilter );\n            m_currentFilter = TestSpec::Filter();\n        }\n    }\n\n    void TestSpecParser::saveLastMode() {\n      lastMode = m_mode;\n    }\n\n    void TestSpecParser::revertBackToLastMode() {\n      m_mode = lastMode;\n    }\n\n    bool TestSpecParser::separate() {\n      if( (m_mode==QuotedName) || (m_mode==Tag) ){\n         //invalid argument, signal failure to previous scope.\n         m_mode = None;\n         m_pos = m_arg.size();\n         m_substring.clear();\n         m_patternName.clear();\n         m_realPatternPos = 0;\n         return false;\n      }\n      endMode();\n      addFilter();\n      return true; //success\n    }\n\n    std::string TestSpecParser::preprocessPattern() {\n        std::string token = m_patternName;\n        for (std::size_t i = 0; i < m_escapeChars.size(); ++i)\n            token = token.substr(0, m_escapeChars[i] - i) + token.substr(m_escapeChars[i] - i + 1);\n        m_escapeChars.clear();\n        if (startsWith(token, \"exclude:\")) {\n            m_exclusion = true;\n            token = token.substr(8);\n        }\n\n        m_patternName.clear();\n        m_realPatternPos = 0;\n\n        return token;\n    }\n\n    void TestSpecParser::addNamePattern() {\n        auto token = preprocessPattern();\n\n        if (!token.empty()) {\n            TestSpec::PatternPtr pattern = std::make_shared<TestSpec::NamePattern>(token, m_substring);\n            if (m_exclusion)\n                pattern = std::make_shared<TestSpec::ExcludedPattern>(pattern);\n            m_currentFilter.m_patterns.push_back(pattern);\n        }\n        m_substring.clear();\n        m_exclusion = false;\n        m_mode = None;\n    }\n\n    void TestSpecParser::addTagPattern() {\n        auto token = preprocessPattern();\n\n        if (!token.empty()) {\n            // If the tag pattern is the \"hide and tag\" shorthand (e.g. [.foo])\n            // we have to create a separate hide tag and shorten the real one\n            if (token.size() > 1 && token[0] == '.') {\n                token.erase(token.begin());\n                TestSpec::PatternPtr pattern = std::make_shared<TestSpec::TagPattern>(\".\", m_substring);\n                if (m_exclusion) {\n                    pattern = std::make_shared<TestSpec::ExcludedPattern>(pattern);\n                }\n                m_currentFilter.m_patterns.push_back(pattern);\n            }\n\n            TestSpec::PatternPtr pattern = std::make_shared<TestSpec::TagPattern>(token, m_substring);\n\n            if (m_exclusion) {\n                pattern = std::make_shared<TestSpec::ExcludedPattern>(pattern);\n            }\n            m_currentFilter.m_patterns.push_back(pattern);\n        }\n        m_substring.clear();\n        m_exclusion = false;\n        m_mode = None;\n    }\n\n    TestSpec parseTestSpec( std::string const& arg ) {\n        return TestSpecParser( ITagAliasRegistry::get() ).parse( arg ).testSpec();\n    }\n\n} // namespace Catch\n// end catch_test_spec_parser.cpp\n// start catch_timer.cpp\n\n#include <chrono>\n\nstatic const uint64_t nanosecondsInSecond = 1000000000;\n\nnamespace Catch {\n\n    auto getCurrentNanosecondsSinceEpoch() -> uint64_t {\n        return std::chrono::duration_cast<std::chrono::nanoseconds>( std::chrono::high_resolution_clock::now().time_since_epoch() ).count();\n    }\n\n    namespace {\n        auto estimateClockResolution() -> uint64_t {\n            uint64_t sum = 0;\n            static const uint64_t iterations = 1000000;\n\n            auto startTime = getCurrentNanosecondsSinceEpoch();\n\n            for( std::size_t i = 0; i < iterations; ++i ) {\n\n                uint64_t ticks;\n                uint64_t baseTicks = getCurrentNanosecondsSinceEpoch();\n                do {\n                    ticks = getCurrentNanosecondsSinceEpoch();\n                } while( ticks == baseTicks );\n\n                auto delta = ticks - baseTicks;\n                sum += delta;\n\n                // If we have been calibrating for over 3 seconds -- the clock\n                // is terrible and we should move on.\n                // TBD: How to signal that the measured resolution is probably wrong?\n                if (ticks > startTime + 3 * nanosecondsInSecond) {\n                    return sum / ( i + 1u );\n                }\n            }\n\n            // We're just taking the mean, here. To do better we could take the std. dev and exclude outliers\n            // - and potentially do more iterations if there's a high variance.\n            return sum/iterations;\n        }\n    }\n    auto getEstimatedClockResolution() -> uint64_t {\n        static auto s_resolution = estimateClockResolution();\n        return s_resolution;\n    }\n\n    void Timer::start() {\n       m_nanoseconds = getCurrentNanosecondsSinceEpoch();\n    }\n    auto Timer::getElapsedNanoseconds() const -> uint64_t {\n        return getCurrentNanosecondsSinceEpoch() - m_nanoseconds;\n    }\n    auto Timer::getElapsedMicroseconds() const -> uint64_t {\n        return getElapsedNanoseconds()/1000;\n    }\n    auto Timer::getElapsedMilliseconds() const -> unsigned int {\n        return static_cast<unsigned int>(getElapsedMicroseconds()/1000);\n    }\n    auto Timer::getElapsedSeconds() const -> double {\n        return getElapsedMicroseconds()/1000000.0;\n    }\n\n} // namespace Catch\n// end catch_timer.cpp\n// start catch_tostring.cpp\n\n#if defined(__clang__)\n#    pragma clang diagnostic push\n#    pragma clang diagnostic ignored \"-Wexit-time-destructors\"\n#    pragma clang diagnostic ignored \"-Wglobal-constructors\"\n#endif\n\n// Enable specific decls locally\n#if !defined(CATCH_CONFIG_ENABLE_CHRONO_STRINGMAKER)\n#define CATCH_CONFIG_ENABLE_CHRONO_STRINGMAKER\n#endif\n\n#include <cmath>\n#include <iomanip>\n\nnamespace Catch {\n\nnamespace Detail {\n\n    const std::string unprintableString = \"{?}\";\n\n    namespace {\n        const int hexThreshold = 255;\n\n        struct Endianness {\n            enum Arch { Big, Little };\n\n            static Arch which() {\n                int one = 1;\n                // If the lowest byte we read is non-zero, we can assume\n                // that little endian format is used.\n                auto value = *reinterpret_cast<char*>(&one);\n                return value ? Little : Big;\n            }\n        };\n    }\n\n    std::string rawMemoryToString( const void *object, std::size_t size ) {\n        // Reverse order for little endian architectures\n        int i = 0, end = static_cast<int>( size ), inc = 1;\n        if( Endianness::which() == Endianness::Little ) {\n            i = end-1;\n            end = inc = -1;\n        }\n\n        unsigned char const *bytes = static_cast<unsigned char const *>(object);\n        ReusableStringStream rss;\n        rss << \"0x\" << std::setfill('0') << std::hex;\n        for( ; i != end; i += inc )\n             rss << std::setw(2) << static_cast<unsigned>(bytes[i]);\n       return rss.str();\n    }\n}\n\ntemplate<typename T>\nstd::string fpToString( T value, int precision ) {\n    if (Catch::isnan(value)) {\n        return \"nan\";\n    }\n\n    ReusableStringStream rss;\n    rss << std::setprecision( precision )\n        << std::fixed\n        << value;\n    std::string d = rss.str();\n    std::size_t i = d.find_last_not_of( '0' );\n    if( i != std::string::npos && i != d.size()-1 ) {\n        if( d[i] == '.' )\n            i++;\n        d = d.substr( 0, i+1 );\n    }\n    return d;\n}\n\n//// ======================================================= ////\n//\n//   Out-of-line defs for full specialization of StringMaker\n//\n//// ======================================================= ////\n\nstd::string StringMaker<std::string>::convert(const std::string& str) {\n    if (!getCurrentContext().getConfig()->showInvisibles()) {\n        return '\"' + str + '\"';\n    }\n\n    std::string s(\"\\\"\");\n    for (char c : str) {\n        switch (c) {\n        case '\\n':\n            s.append(\"\\\\n\");\n            break;\n        case '\\t':\n            s.append(\"\\\\t\");\n            break;\n        default:\n            s.push_back(c);\n            break;\n        }\n    }\n    s.append(\"\\\"\");\n    return s;\n}\n\n#ifdef CATCH_CONFIG_CPP17_STRING_VIEW\nstd::string StringMaker<std::string_view>::convert(std::string_view str) {\n    return ::Catch::Detail::stringify(std::string{ str });\n}\n#endif\n\nstd::string StringMaker<char const*>::convert(char const* str) {\n    if (str) {\n        return ::Catch::Detail::stringify(std::string{ str });\n    } else {\n        return{ \"{null string}\" };\n    }\n}\nstd::string StringMaker<char*>::convert(char* str) {\n    if (str) {\n        return ::Catch::Detail::stringify(std::string{ str });\n    } else {\n        return{ \"{null string}\" };\n    }\n}\n\n#ifdef CATCH_CONFIG_WCHAR\nstd::string StringMaker<std::wstring>::convert(const std::wstring& wstr) {\n    std::string s;\n    s.reserve(wstr.size());\n    for (auto c : wstr) {\n        s += (c <= 0xff) ? static_cast<char>(c) : '?';\n    }\n    return ::Catch::Detail::stringify(s);\n}\n\n# ifdef CATCH_CONFIG_CPP17_STRING_VIEW\nstd::string StringMaker<std::wstring_view>::convert(std::wstring_view str) {\n    return StringMaker<std::wstring>::convert(std::wstring(str));\n}\n# endif\n\nstd::string StringMaker<wchar_t const*>::convert(wchar_t const * str) {\n    if (str) {\n        return ::Catch::Detail::stringify(std::wstring{ str });\n    } else {\n        return{ \"{null string}\" };\n    }\n}\nstd::string StringMaker<wchar_t *>::convert(wchar_t * str) {\n    if (str) {\n        return ::Catch::Detail::stringify(std::wstring{ str });\n    } else {\n        return{ \"{null string}\" };\n    }\n}\n#endif\n\n#if defined(CATCH_CONFIG_CPP17_BYTE)\n#include <cstddef>\nstd::string StringMaker<std::byte>::convert(std::byte value) {\n    return ::Catch::Detail::stringify(std::to_integer<unsigned long long>(value));\n}\n#endif // defined(CATCH_CONFIG_CPP17_BYTE)\n\nstd::string StringMaker<int>::convert(int value) {\n    return ::Catch::Detail::stringify(static_cast<long long>(value));\n}\nstd::string StringMaker<long>::convert(long value) {\n    return ::Catch::Detail::stringify(static_cast<long long>(value));\n}\nstd::string StringMaker<long long>::convert(long long value) {\n    ReusableStringStream rss;\n    rss << value;\n    if (value > Detail::hexThreshold) {\n        rss << \" (0x\" << std::hex << value << ')';\n    }\n    return rss.str();\n}\n\nstd::string StringMaker<unsigned int>::convert(unsigned int value) {\n    return ::Catch::Detail::stringify(static_cast<unsigned long long>(value));\n}\nstd::string StringMaker<unsigned long>::convert(unsigned long value) {\n    return ::Catch::Detail::stringify(static_cast<unsigned long long>(value));\n}\nstd::string StringMaker<unsigned long long>::convert(unsigned long long value) {\n    ReusableStringStream rss;\n    rss << value;\n    if (value > Detail::hexThreshold) {\n        rss << \" (0x\" << std::hex << value << ')';\n    }\n    return rss.str();\n}\n\nstd::string StringMaker<bool>::convert(bool b) {\n    return b ? \"true\" : \"false\";\n}\n\nstd::string StringMaker<signed char>::convert(signed char value) {\n    if (value == '\\r') {\n        return \"'\\\\r'\";\n    } else if (value == '\\f') {\n        return \"'\\\\f'\";\n    } else if (value == '\\n') {\n        return \"'\\\\n'\";\n    } else if (value == '\\t') {\n        return \"'\\\\t'\";\n    } else if ('\\0' <= value && value < ' ') {\n        return ::Catch::Detail::stringify(static_cast<unsigned int>(value));\n    } else {\n        char chstr[] = \"' '\";\n        chstr[1] = value;\n        return chstr;\n    }\n}\nstd::string StringMaker<char>::convert(char c) {\n    return ::Catch::Detail::stringify(static_cast<signed char>(c));\n}\nstd::string StringMaker<unsigned char>::convert(unsigned char c) {\n    return ::Catch::Detail::stringify(static_cast<char>(c));\n}\n\nstd::string StringMaker<std::nullptr_t>::convert(std::nullptr_t) {\n    return \"nullptr\";\n}\n\nint StringMaker<float>::precision = 5;\n\nstd::string StringMaker<float>::convert(float value) {\n    return fpToString(value, precision) + 'f';\n}\n\nint StringMaker<double>::precision = 10;\n\nstd::string StringMaker<double>::convert(double value) {\n    return fpToString(value, precision);\n}\n\nstd::string ratio_string<std::atto>::symbol() { return \"a\"; }\nstd::string ratio_string<std::femto>::symbol() { return \"f\"; }\nstd::string ratio_string<std::pico>::symbol() { return \"p\"; }\nstd::string ratio_string<std::nano>::symbol() { return \"n\"; }\nstd::string ratio_string<std::micro>::symbol() { return \"u\"; }\nstd::string ratio_string<std::milli>::symbol() { return \"m\"; }\n\n} // end namespace Catch\n\n#if defined(__clang__)\n#    pragma clang diagnostic pop\n#endif\n\n// end catch_tostring.cpp\n// start catch_totals.cpp\n\nnamespace Catch {\n\n    Counts Counts::operator - ( Counts const& other ) const {\n        Counts diff;\n        diff.passed = passed - other.passed;\n        diff.failed = failed - other.failed;\n        diff.failedButOk = failedButOk - other.failedButOk;\n        return diff;\n    }\n\n    Counts& Counts::operator += ( Counts const& other ) {\n        passed += other.passed;\n        failed += other.failed;\n        failedButOk += other.failedButOk;\n        return *this;\n    }\n\n    std::size_t Counts::total() const {\n        return passed + failed + failedButOk;\n    }\n    bool Counts::allPassed() const {\n        return failed == 0 && failedButOk == 0;\n    }\n    bool Counts::allOk() const {\n        return failed == 0;\n    }\n\n    Totals Totals::operator - ( Totals const& other ) const {\n        Totals diff;\n        diff.assertions = assertions - other.assertions;\n        diff.testCases = testCases - other.testCases;\n        return diff;\n    }\n\n    Totals& Totals::operator += ( Totals const& other ) {\n        assertions += other.assertions;\n        testCases += other.testCases;\n        return *this;\n    }\n\n    Totals Totals::delta( Totals const& prevTotals ) const {\n        Totals diff = *this - prevTotals;\n        if( diff.assertions.failed > 0 )\n            ++diff.testCases.failed;\n        else if( diff.assertions.failedButOk > 0 )\n            ++diff.testCases.failedButOk;\n        else\n            ++diff.testCases.passed;\n        return diff;\n    }\n\n}\n// end catch_totals.cpp\n// start catch_uncaught_exceptions.cpp\n\n// start catch_config_uncaught_exceptions.hpp\n\n//              Copyright Catch2 Authors\n// Distributed under the Boost Software License, Version 1.0.\n//   (See accompanying file LICENSE_1_0.txt or copy at\n//        https://www.boost.org/LICENSE_1_0.txt)\n\n// SPDX-License-Identifier: BSL-1.0\n\n#ifndef CATCH_CONFIG_UNCAUGHT_EXCEPTIONS_HPP\n#define CATCH_CONFIG_UNCAUGHT_EXCEPTIONS_HPP\n\n#if defined(_MSC_VER)\n#  if _MSC_VER >= 1900 // Visual Studio 2015 or newer\n#    define CATCH_INTERNAL_CONFIG_CPP17_UNCAUGHT_EXCEPTIONS\n#  endif\n#endif\n\n#include <exception>\n\n#if defined(__cpp_lib_uncaught_exceptions) \\\n    && !defined(CATCH_INTERNAL_CONFIG_CPP17_UNCAUGHT_EXCEPTIONS)\n\n#  define CATCH_INTERNAL_CONFIG_CPP17_UNCAUGHT_EXCEPTIONS\n#endif // __cpp_lib_uncaught_exceptions\n\n#if defined(CATCH_INTERNAL_CONFIG_CPP17_UNCAUGHT_EXCEPTIONS) \\\n    && !defined(CATCH_CONFIG_NO_CPP17_UNCAUGHT_EXCEPTIONS) \\\n    && !defined(CATCH_CONFIG_CPP17_UNCAUGHT_EXCEPTIONS)\n\n#  define CATCH_CONFIG_CPP17_UNCAUGHT_EXCEPTIONS\n#endif\n\n#endif // CATCH_CONFIG_UNCAUGHT_EXCEPTIONS_HPP\n// end catch_config_uncaught_exceptions.hpp\n#include <exception>\n\nnamespace Catch {\n    bool uncaught_exceptions() {\n#if defined(CATCH_CONFIG_DISABLE_EXCEPTIONS)\n        return false;\n#elif defined(CATCH_CONFIG_CPP17_UNCAUGHT_EXCEPTIONS)\n        return std::uncaught_exceptions() > 0;\n#else\n        return std::uncaught_exception();\n#endif\n  }\n} // end namespace Catch\n// end catch_uncaught_exceptions.cpp\n// start catch_version.cpp\n\n#include <ostream>\n\nnamespace Catch {\n\n    Version::Version\n        (   unsigned int _majorVersion,\n            unsigned int _minorVersion,\n            unsigned int _patchNumber,\n            char const * const _branchName,\n            unsigned int _buildNumber )\n    :   majorVersion( _majorVersion ),\n        minorVersion( _minorVersion ),\n        patchNumber( _patchNumber ),\n        branchName( _branchName ),\n        buildNumber( _buildNumber )\n    {}\n\n    std::ostream& operator << ( std::ostream& os, Version const& version ) {\n        os  << version.majorVersion << '.'\n            << version.minorVersion << '.'\n            << version.patchNumber;\n        // branchName is never null -> 0th char is \\0 if it is empty\n        if (version.branchName[0]) {\n            os << '-' << version.branchName\n               << '.' << version.buildNumber;\n        }\n        return os;\n    }\n\n    Version const& libraryVersion() {\n        static Version version( 2, 13, 10, \"\", 0 );\n        return version;\n    }\n\n}\n// end catch_version.cpp\n// start catch_wildcard_pattern.cpp\n\nnamespace Catch {\n\n    WildcardPattern::WildcardPattern( std::string const& pattern,\n                                      CaseSensitive::Choice caseSensitivity )\n    :   m_caseSensitivity( caseSensitivity ),\n        m_pattern( normaliseString( pattern ) )\n    {\n        if( startsWith( m_pattern, '*' ) ) {\n            m_pattern = m_pattern.substr( 1 );\n            m_wildcard = WildcardAtStart;\n        }\n        if( endsWith( m_pattern, '*' ) ) {\n            m_pattern = m_pattern.substr( 0, m_pattern.size()-1 );\n            m_wildcard = static_cast<WildcardPosition>( m_wildcard | WildcardAtEnd );\n        }\n    }\n\n    bool WildcardPattern::matches( std::string const& str ) const {\n        switch( m_wildcard ) {\n            case NoWildcard:\n                return m_pattern == normaliseString( str );\n            case WildcardAtStart:\n                return endsWith( normaliseString( str ), m_pattern );\n            case WildcardAtEnd:\n                return startsWith( normaliseString( str ), m_pattern );\n            case WildcardAtBothEnds:\n                return contains( normaliseString( str ), m_pattern );\n            default:\n                CATCH_INTERNAL_ERROR( \"Unknown enum\" );\n        }\n    }\n\n    std::string WildcardPattern::normaliseString( std::string const& str ) const {\n        return trim( m_caseSensitivity == CaseSensitive::No ? toLower( str ) : str );\n    }\n}\n// end catch_wildcard_pattern.cpp\n// start catch_xmlwriter.cpp\n\n#include <iomanip>\n#include <type_traits>\n\nnamespace Catch {\n\nnamespace {\n\n    size_t trailingBytes(unsigned char c) {\n        if ((c & 0xE0) == 0xC0) {\n            return 2;\n        }\n        if ((c & 0xF0) == 0xE0) {\n            return 3;\n        }\n        if ((c & 0xF8) == 0xF0) {\n            return 4;\n        }\n        CATCH_INTERNAL_ERROR(\"Invalid multibyte utf-8 start byte encountered\");\n    }\n\n    uint32_t headerValue(unsigned char c) {\n        if ((c & 0xE0) == 0xC0) {\n            return c & 0x1F;\n        }\n        if ((c & 0xF0) == 0xE0) {\n            return c & 0x0F;\n        }\n        if ((c & 0xF8) == 0xF0) {\n            return c & 0x07;\n        }\n        CATCH_INTERNAL_ERROR(\"Invalid multibyte utf-8 start byte encountered\");\n    }\n\n    void hexEscapeChar(std::ostream& os, unsigned char c) {\n        std::ios_base::fmtflags f(os.flags());\n        os << \"\\\\x\"\n            << std::uppercase << std::hex << std::setfill('0') << std::setw(2)\n            << static_cast<int>(c);\n        os.flags(f);\n    }\n\n    bool shouldNewline(XmlFormatting fmt) {\n        return !!(static_cast<std::underlying_type<XmlFormatting>::type>(fmt & XmlFormatting::Newline));\n    }\n\n    bool shouldIndent(XmlFormatting fmt) {\n        return !!(static_cast<std::underlying_type<XmlFormatting>::type>(fmt & XmlFormatting::Indent));\n    }\n\n} // anonymous namespace\n\n    XmlFormatting operator | (XmlFormatting lhs, XmlFormatting rhs) {\n        return static_cast<XmlFormatting>(\n            static_cast<std::underlying_type<XmlFormatting>::type>(lhs) |\n            static_cast<std::underlying_type<XmlFormatting>::type>(rhs)\n        );\n    }\n\n    XmlFormatting operator & (XmlFormatting lhs, XmlFormatting rhs) {\n        return static_cast<XmlFormatting>(\n            static_cast<std::underlying_type<XmlFormatting>::type>(lhs) &\n            static_cast<std::underlying_type<XmlFormatting>::type>(rhs)\n        );\n    }\n\n    XmlEncode::XmlEncode( std::string const& str, ForWhat forWhat )\n    :   m_str( str ),\n        m_forWhat( forWhat )\n    {}\n\n    void XmlEncode::encodeTo( std::ostream& os ) const {\n        // Apostrophe escaping not necessary if we always use \" to write attributes\n        // (see: http://www.w3.org/TR/xml/#syntax)\n\n        for( std::size_t idx = 0; idx < m_str.size(); ++ idx ) {\n            unsigned char c = m_str[idx];\n            switch (c) {\n            case '<':   os << \"&lt;\"; break;\n            case '&':   os << \"&amp;\"; break;\n\n            case '>':\n                // See: http://www.w3.org/TR/xml/#syntax\n                if (idx > 2 && m_str[idx - 1] == ']' && m_str[idx - 2] == ']')\n                    os << \"&gt;\";\n                else\n                    os << c;\n                break;\n\n            case '\\\"':\n                if (m_forWhat == ForAttributes)\n                    os << \"&quot;\";\n                else\n                    os << c;\n                break;\n\n            default:\n                // Check for control characters and invalid utf-8\n\n                // Escape control characters in standard ascii\n                // see http://stackoverflow.com/questions/404107/why-are-control-characters-illegal-in-xml-1-0\n                if (c < 0x09 || (c > 0x0D && c < 0x20) || c == 0x7F) {\n                    hexEscapeChar(os, c);\n                    break;\n                }\n\n                // Plain ASCII: Write it to stream\n                if (c < 0x7F) {\n                    os << c;\n                    break;\n                }\n\n                // UTF-8 territory\n                // Check if the encoding is valid and if it is not, hex escape bytes.\n                // Important: We do not check the exact decoded values for validity, only the encoding format\n                // First check that this bytes is a valid lead byte:\n                // This means that it is not encoded as 1111 1XXX\n                // Or as 10XX XXXX\n                if (c <  0xC0 ||\n                    c >= 0xF8) {\n                    hexEscapeChar(os, c);\n                    break;\n                }\n\n                auto encBytes = trailingBytes(c);\n                // Are there enough bytes left to avoid accessing out-of-bounds memory?\n                if (idx + encBytes - 1 >= m_str.size()) {\n                    hexEscapeChar(os, c);\n                    break;\n                }\n                // The header is valid, check data\n                // The next encBytes bytes must together be a valid utf-8\n                // This means: bitpattern 10XX XXXX and the extracted value is sane (ish)\n                bool valid = true;\n                uint32_t value = headerValue(c);\n                for (std::size_t n = 1; n < encBytes; ++n) {\n                    unsigned char nc = m_str[idx + n];\n                    valid &= ((nc & 0xC0) == 0x80);\n                    value = (value << 6) | (nc & 0x3F);\n                }\n\n                if (\n                    // Wrong bit pattern of following bytes\n                    (!valid) ||\n                    // Overlong encodings\n                    (value < 0x80) ||\n                    (0x80 <= value && value < 0x800   && encBytes > 2) ||\n                    (0x800 < value && value < 0x10000 && encBytes > 3) ||\n                    // Encoded value out of range\n                    (value >= 0x110000)\n                    ) {\n                    hexEscapeChar(os, c);\n                    break;\n                }\n\n                // If we got here, this is in fact a valid(ish) utf-8 sequence\n                for (std::size_t n = 0; n < encBytes; ++n) {\n                    os << m_str[idx + n];\n                }\n                idx += encBytes - 1;\n                break;\n            }\n        }\n    }\n\n    std::ostream& operator << ( std::ostream& os, XmlEncode const& xmlEncode ) {\n        xmlEncode.encodeTo( os );\n        return os;\n    }\n\n    XmlWriter::ScopedElement::ScopedElement( XmlWriter* writer, XmlFormatting fmt )\n    :   m_writer( writer ),\n        m_fmt(fmt)\n    {}\n\n    XmlWriter::ScopedElement::ScopedElement( ScopedElement&& other ) noexcept\n    :   m_writer( other.m_writer ),\n        m_fmt(other.m_fmt)\n    {\n        other.m_writer = nullptr;\n        other.m_fmt = XmlFormatting::None;\n    }\n    XmlWriter::ScopedElement& XmlWriter::ScopedElement::operator=( ScopedElement&& other ) noexcept {\n        if ( m_writer ) {\n            m_writer->endElement();\n        }\n        m_writer = other.m_writer;\n        other.m_writer = nullptr;\n        m_fmt = other.m_fmt;\n        other.m_fmt = XmlFormatting::None;\n        return *this;\n    }\n\n    XmlWriter::ScopedElement::~ScopedElement() {\n        if (m_writer) {\n            m_writer->endElement(m_fmt);\n        }\n    }\n\n    XmlWriter::ScopedElement& XmlWriter::ScopedElement::writeText( std::string const& text, XmlFormatting fmt ) {\n        m_writer->writeText( text, fmt );\n        return *this;\n    }\n\n    XmlWriter::XmlWriter( std::ostream& os ) : m_os( os )\n    {\n        writeDeclaration();\n    }\n\n    XmlWriter::~XmlWriter() {\n        while (!m_tags.empty()) {\n            endElement();\n        }\n        newlineIfNecessary();\n    }\n\n    XmlWriter& XmlWriter::startElement( std::string const& name, XmlFormatting fmt ) {\n        ensureTagClosed();\n        newlineIfNecessary();\n        if (shouldIndent(fmt)) {\n            m_os << m_indent;\n            m_indent += \"  \";\n        }\n        m_os << '<' << name;\n        m_tags.push_back( name );\n        m_tagIsOpen = true;\n        applyFormatting(fmt);\n        return *this;\n    }\n\n    XmlWriter::ScopedElement XmlWriter::scopedElement( std::string const& name, XmlFormatting fmt ) {\n        ScopedElement scoped( this, fmt );\n        startElement( name, fmt );\n        return scoped;\n    }\n\n    XmlWriter& XmlWriter::endElement(XmlFormatting fmt) {\n        m_indent = m_indent.substr(0, m_indent.size() - 2);\n\n        if( m_tagIsOpen ) {\n            m_os << \"/>\";\n            m_tagIsOpen = false;\n        } else {\n            newlineIfNecessary();\n            if (shouldIndent(fmt)) {\n                m_os << m_indent;\n            }\n            m_os << \"</\" << m_tags.back() << \">\";\n        }\n        m_os << std::flush;\n        applyFormatting(fmt);\n        m_tags.pop_back();\n        return *this;\n    }\n\n    XmlWriter& XmlWriter::writeAttribute( std::string const& name, std::string const& attribute ) {\n        if( !name.empty() && !attribute.empty() )\n            m_os << ' ' << name << \"=\\\"\" << XmlEncode( attribute, XmlEncode::ForAttributes ) << '\"';\n        return *this;\n    }\n\n    XmlWriter& XmlWriter::writeAttribute( std::string const& name, bool attribute ) {\n        m_os << ' ' << name << \"=\\\"\" << ( attribute ? \"true\" : \"false\" ) << '\"';\n        return *this;\n    }\n\n    XmlWriter& XmlWriter::writeText( std::string const& text, XmlFormatting fmt) {\n        if( !text.empty() ){\n            bool tagWasOpen = m_tagIsOpen;\n            ensureTagClosed();\n            if (tagWasOpen && shouldIndent(fmt)) {\n                m_os << m_indent;\n            }\n            m_os << XmlEncode( text );\n            applyFormatting(fmt);\n        }\n        return *this;\n    }\n\n    XmlWriter& XmlWriter::writeComment( std::string const& text, XmlFormatting fmt) {\n        ensureTagClosed();\n        if (shouldIndent(fmt)) {\n            m_os << m_indent;\n        }\n        m_os << \"<!--\" << text << \"-->\";\n        applyFormatting(fmt);\n        return *this;\n    }\n\n    void XmlWriter::writeStylesheetRef( std::string const& url ) {\n        m_os << \"<?xml-stylesheet type=\\\"text/xsl\\\" href=\\\"\" << url << \"\\\"?>\\n\";\n    }\n\n    XmlWriter& XmlWriter::writeBlankLine() {\n        ensureTagClosed();\n        m_os << '\\n';\n        return *this;\n    }\n\n    void XmlWriter::ensureTagClosed() {\n        if( m_tagIsOpen ) {\n            m_os << '>' << std::flush;\n            newlineIfNecessary();\n            m_tagIsOpen = false;\n        }\n    }\n\n    void XmlWriter::applyFormatting(XmlFormatting fmt) {\n        m_needsNewline = shouldNewline(fmt);\n    }\n\n    void XmlWriter::writeDeclaration() {\n        m_os << \"<?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\"?>\\n\";\n    }\n\n    void XmlWriter::newlineIfNecessary() {\n        if( m_needsNewline ) {\n            m_os << std::endl;\n            m_needsNewline = false;\n        }\n    }\n}\n// end catch_xmlwriter.cpp\n// start catch_reporter_bases.cpp\n\n#include <cstring>\n#include <cfloat>\n#include <cstdio>\n#include <cassert>\n#include <memory>\n\nnamespace Catch {\n    void prepareExpandedExpression(AssertionResult& result) {\n        result.getExpandedExpression();\n    }\n\n    // Because formatting using c++ streams is stateful, drop down to C is required\n    // Alternatively we could use stringstream, but its performance is... not good.\n    std::string getFormattedDuration( double duration ) {\n        // Max exponent + 1 is required to represent the whole part\n        // + 1 for decimal point\n        // + 3 for the 3 decimal places\n        // + 1 for null terminator\n        const std::size_t maxDoubleSize = DBL_MAX_10_EXP + 1 + 1 + 3 + 1;\n        char buffer[maxDoubleSize];\n\n        // Save previous errno, to prevent sprintf from overwriting it\n        ErrnoGuard guard;\n#ifdef _MSC_VER\n        sprintf_s(buffer, \"%.3f\", duration);\n#else\n        std::sprintf(buffer, \"%.3f\", duration);\n#endif\n        return std::string(buffer);\n    }\n\n    bool shouldShowDuration( IConfig const& config, double duration ) {\n        if ( config.showDurations() == ShowDurations::Always ) {\n            return true;\n        }\n        if ( config.showDurations() == ShowDurations::Never ) {\n            return false;\n        }\n        const double min = config.minDuration();\n        return min >= 0 && duration >= min;\n    }\n\n    std::string serializeFilters( std::vector<std::string> const& container ) {\n        ReusableStringStream oss;\n        bool first = true;\n        for (auto&& filter : container)\n        {\n            if (!first)\n                oss << ' ';\n            else\n                first = false;\n\n            oss << filter;\n        }\n        return oss.str();\n    }\n\n    TestEventListenerBase::TestEventListenerBase(ReporterConfig const & _config)\n        :StreamingReporterBase(_config) {}\n\n    std::set<Verbosity> TestEventListenerBase::getSupportedVerbosities() {\n        return { Verbosity::Quiet, Verbosity::Normal, Verbosity::High };\n    }\n\n    void TestEventListenerBase::assertionStarting(AssertionInfo const &) {}\n\n    bool TestEventListenerBase::assertionEnded(AssertionStats const &) {\n        return false;\n    }\n\n} // end namespace Catch\n// end catch_reporter_bases.cpp\n// start catch_reporter_compact.cpp\n\nnamespace {\n\n#ifdef CATCH_PLATFORM_MAC\n    const char* failedString() { return \"FAILED\"; }\n    const char* passedString() { return \"PASSED\"; }\n#else\n    const char* failedString() { return \"failed\"; }\n    const char* passedString() { return \"passed\"; }\n#endif\n\n    // Colour::LightGrey\n    Catch::Colour::Code dimColour() { return Catch::Colour::FileName; }\n\n    std::string bothOrAll( std::size_t count ) {\n        return count == 1 ? std::string() :\n               count == 2 ? \"both \" : \"all \" ;\n    }\n\n} // anon namespace\n\nnamespace Catch {\nnamespace {\n// Colour, message variants:\n// - white: No tests ran.\n// -   red: Failed [both/all] N test cases, failed [both/all] M assertions.\n// - white: Passed [both/all] N test cases (no assertions).\n// -   red: Failed N tests cases, failed M assertions.\n// - green: Passed [both/all] N tests cases with M assertions.\nvoid printTotals(std::ostream& out, const Totals& totals) {\n    if (totals.testCases.total() == 0) {\n        out << \"No tests ran.\";\n    } else if (totals.testCases.failed == totals.testCases.total()) {\n        Colour colour(Colour::ResultError);\n        const std::string qualify_assertions_failed =\n            totals.assertions.failed == totals.assertions.total() ?\n            bothOrAll(totals.assertions.failed) : std::string();\n        out <<\n            \"Failed \" << bothOrAll(totals.testCases.failed)\n            << pluralise(totals.testCases.failed, \"test case\") << \", \"\n            \"failed \" << qualify_assertions_failed <<\n            pluralise(totals.assertions.failed, \"assertion\") << '.';\n    } else if (totals.assertions.total() == 0) {\n        out <<\n            \"Passed \" << bothOrAll(totals.testCases.total())\n            << pluralise(totals.testCases.total(), \"test case\")\n            << \" (no assertions).\";\n    } else if (totals.assertions.failed) {\n        Colour colour(Colour::ResultError);\n        out <<\n            \"Failed \" << pluralise(totals.testCases.failed, \"test case\") << \", \"\n            \"failed \" << pluralise(totals.assertions.failed, \"assertion\") << '.';\n    } else {\n        Colour colour(Colour::ResultSuccess);\n        out <<\n            \"Passed \" << bothOrAll(totals.testCases.passed)\n            << pluralise(totals.testCases.passed, \"test case\") <<\n            \" with \" << pluralise(totals.assertions.passed, \"assertion\") << '.';\n    }\n}\n\n// Implementation of CompactReporter formatting\nclass AssertionPrinter {\npublic:\n    AssertionPrinter& operator= (AssertionPrinter const&) = delete;\n    AssertionPrinter(AssertionPrinter const&) = delete;\n    AssertionPrinter(std::ostream& _stream, AssertionStats const& _stats, bool _printInfoMessages)\n        : stream(_stream)\n        , result(_stats.assertionResult)\n        , messages(_stats.infoMessages)\n        , itMessage(_stats.infoMessages.begin())\n        , printInfoMessages(_printInfoMessages) {}\n\n    void print() {\n        printSourceInfo();\n\n        itMessage = messages.begin();\n\n        switch (result.getResultType()) {\n        case ResultWas::Ok:\n            printResultType(Colour::ResultSuccess, passedString());\n            printOriginalExpression();\n            printReconstructedExpression();\n            if (!result.hasExpression())\n                printRemainingMessages(Colour::None);\n            else\n                printRemainingMessages();\n            break;\n        case ResultWas::ExpressionFailed:\n            if (result.isOk())\n                printResultType(Colour::ResultSuccess, failedString() + std::string(\" - but was ok\"));\n            else\n                printResultType(Colour::Error, failedString());\n            printOriginalExpression();\n            printReconstructedExpression();\n            printRemainingMessages();\n            break;\n        case ResultWas::ThrewException:\n            printResultType(Colour::Error, failedString());\n            printIssue(\"unexpected exception with message:\");\n            printMessage();\n            printExpressionWas();\n            printRemainingMessages();\n            break;\n        case ResultWas::FatalErrorCondition:\n            printResultType(Colour::Error, failedString());\n            printIssue(\"fatal error condition with message:\");\n            printMessage();\n            printExpressionWas();\n            printRemainingMessages();\n            break;\n        case ResultWas::DidntThrowException:\n            printResultType(Colour::Error, failedString());\n            printIssue(\"expected exception, got none\");\n            printExpressionWas();\n            printRemainingMessages();\n            break;\n        case ResultWas::Info:\n            printResultType(Colour::None, \"info\");\n            printMessage();\n            printRemainingMessages();\n            break;\n        case ResultWas::Warning:\n            printResultType(Colour::None, \"warning\");\n            printMessage();\n            printRemainingMessages();\n            break;\n        case ResultWas::ExplicitFailure:\n            printResultType(Colour::Error, failedString());\n            printIssue(\"explicitly\");\n            printRemainingMessages(Colour::None);\n            break;\n            // These cases are here to prevent compiler warnings\n        case ResultWas::Unknown:\n        case ResultWas::FailureBit:\n        case ResultWas::Exception:\n            printResultType(Colour::Error, \"** internal error **\");\n            break;\n        }\n    }\n\nprivate:\n    void printSourceInfo() const {\n        Colour colourGuard(Colour::FileName);\n        stream << result.getSourceInfo() << ':';\n    }\n\n    void printResultType(Colour::Code colour, std::string const& passOrFail) const {\n        if (!passOrFail.empty()) {\n            {\n                Colour colourGuard(colour);\n                stream << ' ' << passOrFail;\n            }\n            stream << ':';\n        }\n    }\n\n    void printIssue(std::string const& issue) const {\n        stream << ' ' << issue;\n    }\n\n    void printExpressionWas() {\n        if (result.hasExpression()) {\n            stream << ';';\n            {\n                Colour colour(dimColour());\n                stream << \" expression was:\";\n            }\n            printOriginalExpression();\n        }\n    }\n\n    void printOriginalExpression() const {\n        if (result.hasExpression()) {\n            stream << ' ' << result.getExpression();\n        }\n    }\n\n    void printReconstructedExpression() const {\n        if (result.hasExpandedExpression()) {\n            {\n                Colour colour(dimColour());\n                stream << \" for: \";\n            }\n            stream << result.getExpandedExpression();\n        }\n    }\n\n    void printMessage() {\n        if (itMessage != messages.end()) {\n            stream << \" '\" << itMessage->message << '\\'';\n            ++itMessage;\n        }\n    }\n\n    void printRemainingMessages(Colour::Code colour = dimColour()) {\n        if (itMessage == messages.end())\n            return;\n\n        const auto itEnd = messages.cend();\n        const auto N = static_cast<std::size_t>(std::distance(itMessage, itEnd));\n\n        {\n            Colour colourGuard(colour);\n            stream << \" with \" << pluralise(N, \"message\") << ':';\n        }\n\n        while (itMessage != itEnd) {\n            // If this assertion is a warning ignore any INFO messages\n            if (printInfoMessages || itMessage->type != ResultWas::Info) {\n                printMessage();\n                if (itMessage != itEnd) {\n                    Colour colourGuard(dimColour());\n                    stream << \" and\";\n                }\n                continue;\n            }\n            ++itMessage;\n        }\n    }\n\nprivate:\n    std::ostream& stream;\n    AssertionResult const& result;\n    std::vector<MessageInfo> messages;\n    std::vector<MessageInfo>::const_iterator itMessage;\n    bool printInfoMessages;\n};\n\n} // anon namespace\n\n        std::string CompactReporter::getDescription() {\n            return \"Reports test results on a single line, suitable for IDEs\";\n        }\n\n        void CompactReporter::noMatchingTestCases( std::string const& spec ) {\n            stream << \"No test cases matched '\" << spec << '\\'' << std::endl;\n        }\n\n        void CompactReporter::assertionStarting( AssertionInfo const& ) {}\n\n        bool CompactReporter::assertionEnded( AssertionStats const& _assertionStats ) {\n            AssertionResult const& result = _assertionStats.assertionResult;\n\n            bool printInfoMessages = true;\n\n            // Drop out if result was successful and we're not printing those\n            if( !m_config->includeSuccessfulResults() && result.isOk() ) {\n                if( result.getResultType() != ResultWas::Warning )\n                    return false;\n                printInfoMessages = false;\n            }\n\n            AssertionPrinter printer( stream, _assertionStats, printInfoMessages );\n            printer.print();\n\n            stream << std::endl;\n            return true;\n        }\n\n        void CompactReporter::sectionEnded(SectionStats const& _sectionStats) {\n            double dur = _sectionStats.durationInSeconds;\n            if ( shouldShowDuration( *m_config, dur ) ) {\n                stream << getFormattedDuration( dur ) << \" s: \" << _sectionStats.sectionInfo.name << std::endl;\n            }\n        }\n\n        void CompactReporter::testRunEnded( TestRunStats const& _testRunStats ) {\n            printTotals( stream, _testRunStats.totals );\n            stream << '\\n' << std::endl;\n            StreamingReporterBase::testRunEnded( _testRunStats );\n        }\n\n        CompactReporter::~CompactReporter() {}\n\n    CATCH_REGISTER_REPORTER( \"compact\", CompactReporter )\n\n} // end namespace Catch\n// end catch_reporter_compact.cpp\n// start catch_reporter_console.cpp\n\n#include <cfloat>\n#include <cstdio>\n\n#if defined(_MSC_VER)\n#pragma warning(push)\n#pragma warning(disable:4061) // Not all labels are EXPLICITLY handled in switch\n // Note that 4062 (not all labels are handled and default is missing) is enabled\n#endif\n\n#if defined(__clang__)\n#  pragma clang diagnostic push\n// For simplicity, benchmarking-only helpers are always enabled\n#  pragma clang diagnostic ignored \"-Wunused-function\"\n#endif\n\nnamespace Catch {\n\nnamespace {\n\n// Formatter impl for ConsoleReporter\nclass ConsoleAssertionPrinter {\npublic:\n    ConsoleAssertionPrinter& operator= (ConsoleAssertionPrinter const&) = delete;\n    ConsoleAssertionPrinter(ConsoleAssertionPrinter const&) = delete;\n    ConsoleAssertionPrinter(std::ostream& _stream, AssertionStats const& _stats, bool _printInfoMessages)\n        : stream(_stream),\n        stats(_stats),\n        result(_stats.assertionResult),\n        colour(Colour::None),\n        message(result.getMessage()),\n        messages(_stats.infoMessages),\n        printInfoMessages(_printInfoMessages) {\n        switch (result.getResultType()) {\n        case ResultWas::Ok:\n            colour = Colour::Success;\n            passOrFail = \"PASSED\";\n            //if( result.hasMessage() )\n            if (_stats.infoMessages.size() == 1)\n                messageLabel = \"with message\";\n            if (_stats.infoMessages.size() > 1)\n                messageLabel = \"with messages\";\n            break;\n        case ResultWas::ExpressionFailed:\n            if (result.isOk()) {\n                colour = Colour::Success;\n                passOrFail = \"FAILED - but was ok\";\n            } else {\n                colour = Colour::Error;\n                passOrFail = \"FAILED\";\n            }\n            if (_stats.infoMessages.size() == 1)\n                messageLabel = \"with message\";\n            if (_stats.infoMessages.size() > 1)\n                messageLabel = \"with messages\";\n            break;\n        case ResultWas::ThrewException:\n            colour = Colour::Error;\n            passOrFail = \"FAILED\";\n            messageLabel = \"due to unexpected exception with \";\n            if (_stats.infoMessages.size() == 1)\n                messageLabel += \"message\";\n            if (_stats.infoMessages.size() > 1)\n                messageLabel += \"messages\";\n            break;\n        case ResultWas::FatalErrorCondition:\n            colour = Colour::Error;\n            passOrFail = \"FAILED\";\n            messageLabel = \"due to a fatal error condition\";\n            break;\n        case ResultWas::DidntThrowException:\n            colour = Colour::Error;\n            passOrFail = \"FAILED\";\n            messageLabel = \"because no exception was thrown where one was expected\";\n            break;\n        case ResultWas::Info:\n            messageLabel = \"info\";\n            break;\n        case ResultWas::Warning:\n            messageLabel = \"warning\";\n            break;\n        case ResultWas::ExplicitFailure:\n            passOrFail = \"FAILED\";\n            colour = Colour::Error;\n            if (_stats.infoMessages.size() == 1)\n                messageLabel = \"explicitly with message\";\n            if (_stats.infoMessages.size() > 1)\n                messageLabel = \"explicitly with messages\";\n            break;\n            // These cases are here to prevent compiler warnings\n        case ResultWas::Unknown:\n        case ResultWas::FailureBit:\n        case ResultWas::Exception:\n            passOrFail = \"** internal error **\";\n            colour = Colour::Error;\n            break;\n        }\n    }\n\n    void print() const {\n        printSourceInfo();\n        if (stats.totals.assertions.total() > 0) {\n            printResultType();\n            printOriginalExpression();\n            printReconstructedExpression();\n        } else {\n            stream << '\\n';\n        }\n        printMessage();\n    }\n\nprivate:\n    void printResultType() const {\n        if (!passOrFail.empty()) {\n            Colour colourGuard(colour);\n            stream << passOrFail << \":\\n\";\n        }\n    }\n    void printOriginalExpression() const {\n        if (result.hasExpression()) {\n            Colour colourGuard(Colour::OriginalExpression);\n            stream << \"  \";\n            stream << result.getExpressionInMacro();\n            stream << '\\n';\n        }\n    }\n    void printReconstructedExpression() const {\n        if (result.hasExpandedExpression()) {\n            stream << \"with expansion:\\n\";\n            Colour colourGuard(Colour::ReconstructedExpression);\n            stream << Column(result.getExpandedExpression()).indent(2) << '\\n';\n        }\n    }\n    void printMessage() const {\n        if (!messageLabel.empty())\n            stream << messageLabel << ':' << '\\n';\n        for (auto const& msg : messages) {\n            // If this assertion is a warning ignore any INFO messages\n            if (printInfoMessages || msg.type != ResultWas::Info)\n                stream << Column(msg.message).indent(2) << '\\n';\n        }\n    }\n    void printSourceInfo() const {\n        Colour colourGuard(Colour::FileName);\n        stream << result.getSourceInfo() << \": \";\n    }\n\n    std::ostream& stream;\n    AssertionStats const& stats;\n    AssertionResult const& result;\n    Colour::Code colour;\n    std::string passOrFail;\n    std::string messageLabel;\n    std::string message;\n    std::vector<MessageInfo> messages;\n    bool printInfoMessages;\n};\n\nstd::size_t makeRatio(std::size_t number, std::size_t total) {\n    std::size_t ratio = total > 0 ? CATCH_CONFIG_CONSOLE_WIDTH * number / total : 0;\n    return (ratio == 0 && number > 0) ? 1 : ratio;\n}\n\nstd::size_t& findMax(std::size_t& i, std::size_t& j, std::size_t& k) {\n    if (i > j && i > k)\n        return i;\n    else if (j > k)\n        return j;\n    else\n        return k;\n}\n\nstruct ColumnInfo {\n    enum Justification { Left, Right };\n    std::string name;\n    int width;\n    Justification justification;\n};\nstruct ColumnBreak {};\nstruct RowBreak {};\n\nclass Duration {\n    enum class Unit {\n        Auto,\n        Nanoseconds,\n        Microseconds,\n        Milliseconds,\n        Seconds,\n        Minutes\n    };\n    static const uint64_t s_nanosecondsInAMicrosecond = 1000;\n    static const uint64_t s_nanosecondsInAMillisecond = 1000 * s_nanosecondsInAMicrosecond;\n    static const uint64_t s_nanosecondsInASecond = 1000 * s_nanosecondsInAMillisecond;\n    static const uint64_t s_nanosecondsInAMinute = 60 * s_nanosecondsInASecond;\n\n    double m_inNanoseconds;\n    Unit m_units;\n\npublic:\n    explicit Duration(double inNanoseconds, Unit units = Unit::Auto)\n        : m_inNanoseconds(inNanoseconds),\n        m_units(units) {\n        if (m_units == Unit::Auto) {\n            if (m_inNanoseconds < s_nanosecondsInAMicrosecond)\n                m_units = Unit::Nanoseconds;\n            else if (m_inNanoseconds < s_nanosecondsInAMillisecond)\n                m_units = Unit::Microseconds;\n            else if (m_inNanoseconds < s_nanosecondsInASecond)\n                m_units = Unit::Milliseconds;\n            else if (m_inNanoseconds < s_nanosecondsInAMinute)\n                m_units = Unit::Seconds;\n            else\n                m_units = Unit::Minutes;\n        }\n\n    }\n\n    auto value() const -> double {\n        switch (m_units) {\n        case Unit::Microseconds:\n            return m_inNanoseconds / static_cast<double>(s_nanosecondsInAMicrosecond);\n        case Unit::Milliseconds:\n            return m_inNanoseconds / static_cast<double>(s_nanosecondsInAMillisecond);\n        case Unit::Seconds:\n            return m_inNanoseconds / static_cast<double>(s_nanosecondsInASecond);\n        case Unit::Minutes:\n            return m_inNanoseconds / static_cast<double>(s_nanosecondsInAMinute);\n        default:\n            return m_inNanoseconds;\n        }\n    }\n    auto unitsAsString() const -> std::string {\n        switch (m_units) {\n        case Unit::Nanoseconds:\n            return \"ns\";\n        case Unit::Microseconds:\n            return \"us\";\n        case Unit::Milliseconds:\n            return \"ms\";\n        case Unit::Seconds:\n            return \"s\";\n        case Unit::Minutes:\n            return \"m\";\n        default:\n            return \"** internal error **\";\n        }\n\n    }\n    friend auto operator << (std::ostream& os, Duration const& duration) -> std::ostream& {\n        return os << duration.value() << ' ' << duration.unitsAsString();\n    }\n};\n} // end anon namespace\n\nclass TablePrinter {\n    std::ostream& m_os;\n    std::vector<ColumnInfo> m_columnInfos;\n    std::ostringstream m_oss;\n    int m_currentColumn = -1;\n    bool m_isOpen = false;\n\npublic:\n    TablePrinter( std::ostream& os, std::vector<ColumnInfo> columnInfos )\n    :   m_os( os ),\n        m_columnInfos( std::move( columnInfos ) ) {}\n\n    auto columnInfos() const -> std::vector<ColumnInfo> const& {\n        return m_columnInfos;\n    }\n\n    void open() {\n        if (!m_isOpen) {\n            m_isOpen = true;\n            *this << RowBreak();\n\n\t\t\tColumns headerCols;\n\t\t\tSpacer spacer(2);\n\t\t\tfor (auto const& info : m_columnInfos) {\n\t\t\t\theaderCols += Column(info.name).width(static_cast<std::size_t>(info.width - 2));\n\t\t\t\theaderCols += spacer;\n\t\t\t}\n\t\t\tm_os << headerCols << '\\n';\n\n            m_os << Catch::getLineOfChars<'-'>() << '\\n';\n        }\n    }\n    void close() {\n        if (m_isOpen) {\n            *this << RowBreak();\n            m_os << std::endl;\n            m_isOpen = false;\n        }\n    }\n\n    template<typename T>\n    friend TablePrinter& operator << (TablePrinter& tp, T const& value) {\n        tp.m_oss << value;\n        return tp;\n    }\n\n    friend TablePrinter& operator << (TablePrinter& tp, ColumnBreak) {\n        auto colStr = tp.m_oss.str();\n        const auto strSize = colStr.size();\n        tp.m_oss.str(\"\");\n        tp.open();\n        if (tp.m_currentColumn == static_cast<int>(tp.m_columnInfos.size() - 1)) {\n            tp.m_currentColumn = -1;\n            tp.m_os << '\\n';\n        }\n        tp.m_currentColumn++;\n\n        auto colInfo = tp.m_columnInfos[tp.m_currentColumn];\n        auto padding = (strSize + 1 < static_cast<std::size_t>(colInfo.width))\n            ? std::string(colInfo.width - (strSize + 1), ' ')\n            : std::string();\n        if (colInfo.justification == ColumnInfo::Left)\n            tp.m_os << colStr << padding << ' ';\n        else\n            tp.m_os << padding << colStr << ' ';\n        return tp;\n    }\n\n    friend TablePrinter& operator << (TablePrinter& tp, RowBreak) {\n        if (tp.m_currentColumn > 0) {\n            tp.m_os << '\\n';\n            tp.m_currentColumn = -1;\n        }\n        return tp;\n    }\n};\n\nConsoleReporter::ConsoleReporter(ReporterConfig const& config)\n    : StreamingReporterBase(config),\n    m_tablePrinter(new TablePrinter(config.stream(),\n        [&config]() -> std::vector<ColumnInfo> {\n        if (config.fullConfig()->benchmarkNoAnalysis())\n        {\n            return{\n                { \"benchmark name\", CATCH_CONFIG_CONSOLE_WIDTH - 43, ColumnInfo::Left },\n                { \"     samples\", 14, ColumnInfo::Right },\n                { \"  iterations\", 14, ColumnInfo::Right },\n                { \"        mean\", 14, ColumnInfo::Right }\n            };\n        }\n        else\n        {\n            return{\n                { \"benchmark name\", CATCH_CONFIG_CONSOLE_WIDTH - 43, ColumnInfo::Left },\n                { \"samples      mean       std dev\", 14, ColumnInfo::Right },\n                { \"iterations   low mean   low std dev\", 14, ColumnInfo::Right },\n                { \"estimated    high mean  high std dev\", 14, ColumnInfo::Right }\n            };\n        }\n    }())) {}\nConsoleReporter::~ConsoleReporter() = default;\n\nstd::string ConsoleReporter::getDescription() {\n    return \"Reports test results as plain lines of text\";\n}\n\nvoid ConsoleReporter::noMatchingTestCases(std::string const& spec) {\n    stream << \"No test cases matched '\" << spec << '\\'' << std::endl;\n}\n\nvoid ConsoleReporter::reportInvalidArguments(std::string const&arg){\n    stream << \"Invalid Filter: \" << arg << std::endl;\n}\n\nvoid ConsoleReporter::assertionStarting(AssertionInfo const&) {}\n\nbool ConsoleReporter::assertionEnded(AssertionStats const& _assertionStats) {\n    AssertionResult const& result = _assertionStats.assertionResult;\n\n    bool includeResults = m_config->includeSuccessfulResults() || !result.isOk();\n\n    // Drop out if result was successful but we're not printing them.\n    if (!includeResults && result.getResultType() != ResultWas::Warning)\n        return false;\n\n    lazyPrint();\n\n    ConsoleAssertionPrinter printer(stream, _assertionStats, includeResults);\n    printer.print();\n    stream << std::endl;\n    return true;\n}\n\nvoid ConsoleReporter::sectionStarting(SectionInfo const& _sectionInfo) {\n    m_tablePrinter->close();\n    m_headerPrinted = false;\n    StreamingReporterBase::sectionStarting(_sectionInfo);\n}\nvoid ConsoleReporter::sectionEnded(SectionStats const& _sectionStats) {\n    m_tablePrinter->close();\n    if (_sectionStats.missingAssertions) {\n        lazyPrint();\n        Colour colour(Colour::ResultError);\n        if (m_sectionStack.size() > 1)\n            stream << \"\\nNo assertions in section\";\n        else\n            stream << \"\\nNo assertions in test case\";\n        stream << \" '\" << _sectionStats.sectionInfo.name << \"'\\n\" << std::endl;\n    }\n    double dur = _sectionStats.durationInSeconds;\n    if (shouldShowDuration(*m_config, dur)) {\n        stream << getFormattedDuration(dur) << \" s: \" << _sectionStats.sectionInfo.name << std::endl;\n    }\n    if (m_headerPrinted) {\n        m_headerPrinted = false;\n    }\n    StreamingReporterBase::sectionEnded(_sectionStats);\n}\n\n#if defined(CATCH_CONFIG_ENABLE_BENCHMARKING)\nvoid ConsoleReporter::benchmarkPreparing(std::string const& name) {\n\tlazyPrintWithoutClosingBenchmarkTable();\n\n\tauto nameCol = Column(name).width(static_cast<std::size_t>(m_tablePrinter->columnInfos()[0].width - 2));\n\n\tbool firstLine = true;\n\tfor (auto line : nameCol) {\n\t\tif (!firstLine)\n\t\t\t(*m_tablePrinter) << ColumnBreak() << ColumnBreak() << ColumnBreak();\n\t\telse\n\t\t\tfirstLine = false;\n\n\t\t(*m_tablePrinter) << line << ColumnBreak();\n\t}\n}\n\nvoid ConsoleReporter::benchmarkStarting(BenchmarkInfo const& info) {\n    (*m_tablePrinter) << info.samples << ColumnBreak()\n        << info.iterations << ColumnBreak();\n    if (!m_config->benchmarkNoAnalysis())\n        (*m_tablePrinter) << Duration(info.estimatedDuration) << ColumnBreak();\n}\nvoid ConsoleReporter::benchmarkEnded(BenchmarkStats<> const& stats) {\n    if (m_config->benchmarkNoAnalysis())\n    {\n        (*m_tablePrinter) << Duration(stats.mean.point.count()) << ColumnBreak();\n    }\n    else\n    {\n        (*m_tablePrinter) << ColumnBreak()\n            << Duration(stats.mean.point.count()) << ColumnBreak()\n            << Duration(stats.mean.lower_bound.count()) << ColumnBreak()\n            << Duration(stats.mean.upper_bound.count()) << ColumnBreak() << ColumnBreak()\n            << Duration(stats.standardDeviation.point.count()) << ColumnBreak()\n            << Duration(stats.standardDeviation.lower_bound.count()) << ColumnBreak()\n            << Duration(stats.standardDeviation.upper_bound.count()) << ColumnBreak() << ColumnBreak() << ColumnBreak() << ColumnBreak() << ColumnBreak();\n    }\n}\n\nvoid ConsoleReporter::benchmarkFailed(std::string const& error) {\n\tColour colour(Colour::Red);\n    (*m_tablePrinter)\n        << \"Benchmark failed (\" << error << ')'\n        << ColumnBreak() << RowBreak();\n}\n#endif // CATCH_CONFIG_ENABLE_BENCHMARKING\n\nvoid ConsoleReporter::testCaseEnded(TestCaseStats const& _testCaseStats) {\n    m_tablePrinter->close();\n    StreamingReporterBase::testCaseEnded(_testCaseStats);\n    m_headerPrinted = false;\n}\nvoid ConsoleReporter::testGroupEnded(TestGroupStats const& _testGroupStats) {\n    if (currentGroupInfo.used) {\n        printSummaryDivider();\n        stream << \"Summary for group '\" << _testGroupStats.groupInfo.name << \"':\\n\";\n        printTotals(_testGroupStats.totals);\n        stream << '\\n' << std::endl;\n    }\n    StreamingReporterBase::testGroupEnded(_testGroupStats);\n}\nvoid ConsoleReporter::testRunEnded(TestRunStats const& _testRunStats) {\n    printTotalsDivider(_testRunStats.totals);\n    printTotals(_testRunStats.totals);\n    stream << std::endl;\n    StreamingReporterBase::testRunEnded(_testRunStats);\n}\nvoid ConsoleReporter::testRunStarting(TestRunInfo const& _testInfo) {\n    StreamingReporterBase::testRunStarting(_testInfo);\n    printTestFilters();\n}\n\nvoid ConsoleReporter::lazyPrint() {\n\n    m_tablePrinter->close();\n    lazyPrintWithoutClosingBenchmarkTable();\n}\n\nvoid ConsoleReporter::lazyPrintWithoutClosingBenchmarkTable() {\n\n    if (!currentTestRunInfo.used)\n        lazyPrintRunInfo();\n    if (!currentGroupInfo.used)\n        lazyPrintGroupInfo();\n\n    if (!m_headerPrinted) {\n        printTestCaseAndSectionHeader();\n        m_headerPrinted = true;\n    }\n}\nvoid ConsoleReporter::lazyPrintRunInfo() {\n    stream << '\\n' << getLineOfChars<'~'>() << '\\n';\n    Colour colour(Colour::SecondaryText);\n    stream << currentTestRunInfo->name\n        << \" is a Catch v\" << libraryVersion() << \" host application.\\n\"\n        << \"Run with -? for options\\n\\n\";\n\n    if (m_config->rngSeed() != 0)\n        stream << \"Randomness seeded to: \" << m_config->rngSeed() << \"\\n\\n\";\n\n    currentTestRunInfo.used = true;\n}\nvoid ConsoleReporter::lazyPrintGroupInfo() {\n    if (!currentGroupInfo->name.empty() && currentGroupInfo->groupsCounts > 1) {\n        printClosedHeader(\"Group: \" + currentGroupInfo->name);\n        currentGroupInfo.used = true;\n    }\n}\nvoid ConsoleReporter::printTestCaseAndSectionHeader() {\n    assert(!m_sectionStack.empty());\n    printOpenHeader(currentTestCaseInfo->name);\n\n    if (m_sectionStack.size() > 1) {\n        Colour colourGuard(Colour::Headers);\n\n        auto\n            it = m_sectionStack.begin() + 1, // Skip first section (test case)\n            itEnd = m_sectionStack.end();\n        for (; it != itEnd; ++it)\n            printHeaderString(it->name, 2);\n    }\n\n    SourceLineInfo lineInfo = m_sectionStack.back().lineInfo;\n\n    stream << getLineOfChars<'-'>() << '\\n';\n    Colour colourGuard(Colour::FileName);\n    stream << lineInfo << '\\n';\n    stream << getLineOfChars<'.'>() << '\\n' << std::endl;\n}\n\nvoid ConsoleReporter::printClosedHeader(std::string const& _name) {\n    printOpenHeader(_name);\n    stream << getLineOfChars<'.'>() << '\\n';\n}\nvoid ConsoleReporter::printOpenHeader(std::string const& _name) {\n    stream << getLineOfChars<'-'>() << '\\n';\n    {\n        Colour colourGuard(Colour::Headers);\n        printHeaderString(_name);\n    }\n}\n\n// if string has a : in first line will set indent to follow it on\n// subsequent lines\nvoid ConsoleReporter::printHeaderString(std::string const& _string, std::size_t indent) {\n    std::size_t i = _string.find(\": \");\n    if (i != std::string::npos)\n        i += 2;\n    else\n        i = 0;\n    stream << Column(_string).indent(indent + i).initialIndent(indent) << '\\n';\n}\n\nstruct SummaryColumn {\n\n    SummaryColumn( std::string _label, Colour::Code _colour )\n    :   label( std::move( _label ) ),\n        colour( _colour ) {}\n    SummaryColumn addRow( std::size_t count ) {\n        ReusableStringStream rss;\n        rss << count;\n        std::string row = rss.str();\n        for (auto& oldRow : rows) {\n            while (oldRow.size() < row.size())\n                oldRow = ' ' + oldRow;\n            while (oldRow.size() > row.size())\n                row = ' ' + row;\n        }\n        rows.push_back(row);\n        return *this;\n    }\n\n    std::string label;\n    Colour::Code colour;\n    std::vector<std::string> rows;\n\n};\n\nvoid ConsoleReporter::printTotals( Totals const& totals ) {\n    if (totals.testCases.total() == 0) {\n        stream << Colour(Colour::Warning) << \"No tests ran\\n\";\n    } else if (totals.assertions.total() > 0 && totals.testCases.allPassed()) {\n        stream << Colour(Colour::ResultSuccess) << \"All tests passed\";\n        stream << \" (\"\n            << pluralise(totals.assertions.passed, \"assertion\") << \" in \"\n            << pluralise(totals.testCases.passed, \"test case\") << ')'\n            << '\\n';\n    } else {\n\n        std::vector<SummaryColumn> columns;\n        columns.push_back(SummaryColumn(\"\", Colour::None)\n                          .addRow(totals.testCases.total())\n                          .addRow(totals.assertions.total()));\n        columns.push_back(SummaryColumn(\"passed\", Colour::Success)\n                          .addRow(totals.testCases.passed)\n                          .addRow(totals.assertions.passed));\n        columns.push_back(SummaryColumn(\"failed\", Colour::ResultError)\n                          .addRow(totals.testCases.failed)\n                          .addRow(totals.assertions.failed));\n        columns.push_back(SummaryColumn(\"failed as expected\", Colour::ResultExpectedFailure)\n                          .addRow(totals.testCases.failedButOk)\n                          .addRow(totals.assertions.failedButOk));\n\n        printSummaryRow(\"test cases\", columns, 0);\n        printSummaryRow(\"assertions\", columns, 1);\n    }\n}\nvoid ConsoleReporter::printSummaryRow(std::string const& label, std::vector<SummaryColumn> const& cols, std::size_t row) {\n    for (auto col : cols) {\n        std::string value = col.rows[row];\n        if (col.label.empty()) {\n            stream << label << \": \";\n            if (value != \"0\")\n                stream << value;\n            else\n                stream << Colour(Colour::Warning) << \"- none -\";\n        } else if (value != \"0\") {\n            stream << Colour(Colour::LightGrey) << \" | \";\n            stream << Colour(col.colour)\n                << value << ' ' << col.label;\n        }\n    }\n    stream << '\\n';\n}\n\nvoid ConsoleReporter::printTotalsDivider(Totals const& totals) {\n    if (totals.testCases.total() > 0) {\n        std::size_t failedRatio = makeRatio(totals.testCases.failed, totals.testCases.total());\n        std::size_t failedButOkRatio = makeRatio(totals.testCases.failedButOk, totals.testCases.total());\n        std::size_t passedRatio = makeRatio(totals.testCases.passed, totals.testCases.total());\n        while (failedRatio + failedButOkRatio + passedRatio < CATCH_CONFIG_CONSOLE_WIDTH - 1)\n            findMax(failedRatio, failedButOkRatio, passedRatio)++;\n        while (failedRatio + failedButOkRatio + passedRatio > CATCH_CONFIG_CONSOLE_WIDTH - 1)\n            findMax(failedRatio, failedButOkRatio, passedRatio)--;\n\n        stream << Colour(Colour::Error) << std::string(failedRatio, '=');\n        stream << Colour(Colour::ResultExpectedFailure) << std::string(failedButOkRatio, '=');\n        if (totals.testCases.allPassed())\n            stream << Colour(Colour::ResultSuccess) << std::string(passedRatio, '=');\n        else\n            stream << Colour(Colour::Success) << std::string(passedRatio, '=');\n    } else {\n        stream << Colour(Colour::Warning) << std::string(CATCH_CONFIG_CONSOLE_WIDTH - 1, '=');\n    }\n    stream << '\\n';\n}\nvoid ConsoleReporter::printSummaryDivider() {\n    stream << getLineOfChars<'-'>() << '\\n';\n}\n\nvoid ConsoleReporter::printTestFilters() {\n    if (m_config->testSpec().hasFilters()) {\n        Colour guard(Colour::BrightYellow);\n        stream << \"Filters: \" << serializeFilters(m_config->getTestsOrTags()) << '\\n';\n    }\n}\n\nCATCH_REGISTER_REPORTER(\"console\", ConsoleReporter)\n\n} // end namespace Catch\n\n#if defined(_MSC_VER)\n#pragma warning(pop)\n#endif\n\n#if defined(__clang__)\n#  pragma clang diagnostic pop\n#endif\n// end catch_reporter_console.cpp\n// start catch_reporter_junit.cpp\n\n#include <cassert>\n#include <sstream>\n#include <ctime>\n#include <algorithm>\n#include <iomanip>\n\nnamespace Catch {\n\n    namespace {\n        std::string getCurrentTimestamp() {\n            // Beware, this is not reentrant because of backward compatibility issues\n            // Also, UTC only, again because of backward compatibility (%z is C++11)\n            time_t rawtime;\n            std::time(&rawtime);\n            auto const timeStampSize = sizeof(\"2017-01-16T17:06:45Z\");\n\n#ifdef _MSC_VER\n            std::tm timeInfo = {};\n            gmtime_s(&timeInfo, &rawtime);\n#else\n            std::tm* timeInfo;\n            timeInfo = std::gmtime(&rawtime);\n#endif\n\n            char timeStamp[timeStampSize];\n            const char * const fmt = \"%Y-%m-%dT%H:%M:%SZ\";\n\n#ifdef _MSC_VER\n            std::strftime(timeStamp, timeStampSize, fmt, &timeInfo);\n#else\n            std::strftime(timeStamp, timeStampSize, fmt, timeInfo);\n#endif\n            return std::string(timeStamp, timeStampSize-1);\n        }\n\n        std::string fileNameTag(const std::vector<std::string> &tags) {\n            auto it = std::find_if(begin(tags),\n                                   end(tags),\n                                   [] (std::string const& tag) {return tag.front() == '#'; });\n            if (it != tags.end())\n                return it->substr(1);\n            return std::string();\n        }\n\n        // Formats the duration in seconds to 3 decimal places.\n        // This is done because some genius defined Maven Surefire schema\n        // in a way that only accepts 3 decimal places, and tools like\n        // Jenkins use that schema for validation JUnit reporter output.\n        std::string formatDuration( double seconds ) {\n            ReusableStringStream rss;\n            rss << std::fixed << std::setprecision( 3 ) << seconds;\n            return rss.str();\n        }\n\n    } // anonymous namespace\n\n    JunitReporter::JunitReporter( ReporterConfig const& _config )\n        :   CumulativeReporterBase( _config ),\n            xml( _config.stream() )\n        {\n            m_reporterPrefs.shouldRedirectStdOut = true;\n            m_reporterPrefs.shouldReportAllAssertions = true;\n        }\n\n    JunitReporter::~JunitReporter() {}\n\n    std::string JunitReporter::getDescription() {\n        return \"Reports test results in an XML format that looks like Ant's junitreport target\";\n    }\n\n    void JunitReporter::noMatchingTestCases( std::string const& /*spec*/ ) {}\n\n    void JunitReporter::testRunStarting( TestRunInfo const& runInfo )  {\n        CumulativeReporterBase::testRunStarting( runInfo );\n        xml.startElement( \"testsuites\" );\n    }\n\n    void JunitReporter::testGroupStarting( GroupInfo const& groupInfo ) {\n        suiteTimer.start();\n        stdOutForSuite.clear();\n        stdErrForSuite.clear();\n        unexpectedExceptions = 0;\n        CumulativeReporterBase::testGroupStarting( groupInfo );\n    }\n\n    void JunitReporter::testCaseStarting( TestCaseInfo const& testCaseInfo ) {\n        m_okToFail = testCaseInfo.okToFail();\n    }\n\n    bool JunitReporter::assertionEnded( AssertionStats const& assertionStats ) {\n        if( assertionStats.assertionResult.getResultType() == ResultWas::ThrewException && !m_okToFail )\n            unexpectedExceptions++;\n        return CumulativeReporterBase::assertionEnded( assertionStats );\n    }\n\n    void JunitReporter::testCaseEnded( TestCaseStats const& testCaseStats ) {\n        stdOutForSuite += testCaseStats.stdOut;\n        stdErrForSuite += testCaseStats.stdErr;\n        CumulativeReporterBase::testCaseEnded( testCaseStats );\n    }\n\n    void JunitReporter::testGroupEnded( TestGroupStats const& testGroupStats ) {\n        double suiteTime = suiteTimer.getElapsedSeconds();\n        CumulativeReporterBase::testGroupEnded( testGroupStats );\n        writeGroup( *m_testGroups.back(), suiteTime );\n    }\n\n    void JunitReporter::testRunEndedCumulative() {\n        xml.endElement();\n    }\n\n    void JunitReporter::writeGroup( TestGroupNode const& groupNode, double suiteTime ) {\n        XmlWriter::ScopedElement e = xml.scopedElement( \"testsuite\" );\n\n        TestGroupStats const& stats = groupNode.value;\n        xml.writeAttribute( \"name\", stats.groupInfo.name );\n        xml.writeAttribute( \"errors\", unexpectedExceptions );\n        xml.writeAttribute( \"failures\", stats.totals.assertions.failed-unexpectedExceptions );\n        xml.writeAttribute( \"tests\", stats.totals.assertions.total() );\n        xml.writeAttribute( \"hostname\", \"tbd\" ); // !TBD\n        if( m_config->showDurations() == ShowDurations::Never )\n            xml.writeAttribute( \"time\", \"\" );\n        else\n            xml.writeAttribute( \"time\", formatDuration( suiteTime ) );\n        xml.writeAttribute( \"timestamp\", getCurrentTimestamp() );\n\n        // Write properties if there are any\n        if (m_config->hasTestFilters() || m_config->rngSeed() != 0) {\n            auto properties = xml.scopedElement(\"properties\");\n            if (m_config->hasTestFilters()) {\n                xml.scopedElement(\"property\")\n                    .writeAttribute(\"name\", \"filters\")\n                    .writeAttribute(\"value\", serializeFilters(m_config->getTestsOrTags()));\n            }\n            if (m_config->rngSeed() != 0) {\n                xml.scopedElement(\"property\")\n                    .writeAttribute(\"name\", \"random-seed\")\n                    .writeAttribute(\"value\", m_config->rngSeed());\n            }\n        }\n\n        // Write test cases\n        for( auto const& child : groupNode.children )\n            writeTestCase( *child );\n\n        xml.scopedElement( \"system-out\" ).writeText( trim( stdOutForSuite ), XmlFormatting::Newline );\n        xml.scopedElement( \"system-err\" ).writeText( trim( stdErrForSuite ), XmlFormatting::Newline );\n    }\n\n    void JunitReporter::writeTestCase( TestCaseNode const& testCaseNode ) {\n        TestCaseStats const& stats = testCaseNode.value;\n\n        // All test cases have exactly one section - which represents the\n        // test case itself. That section may have 0-n nested sections\n        assert( testCaseNode.children.size() == 1 );\n        SectionNode const& rootSection = *testCaseNode.children.front();\n\n        std::string className = stats.testInfo.className;\n\n        if( className.empty() ) {\n            className = fileNameTag(stats.testInfo.tags);\n            if ( className.empty() )\n                className = \"global\";\n        }\n\n        if ( !m_config->name().empty() )\n            className = m_config->name() + \".\" + className;\n\n        writeSection( className, \"\", rootSection, stats.testInfo.okToFail() );\n    }\n\n    void JunitReporter::writeSection( std::string const& className,\n                                      std::string const& rootName,\n                                      SectionNode const& sectionNode,\n                                      bool testOkToFail) {\n        std::string name = trim( sectionNode.stats.sectionInfo.name );\n        if( !rootName.empty() )\n            name = rootName + '/' + name;\n\n        if( !sectionNode.assertions.empty() ||\n            !sectionNode.stdOut.empty() ||\n            !sectionNode.stdErr.empty() ) {\n            XmlWriter::ScopedElement e = xml.scopedElement( \"testcase\" );\n            if( className.empty() ) {\n                xml.writeAttribute( \"classname\", name );\n                xml.writeAttribute( \"name\", \"root\" );\n            }\n            else {\n                xml.writeAttribute( \"classname\", className );\n                xml.writeAttribute( \"name\", name );\n            }\n            xml.writeAttribute( \"time\", formatDuration( sectionNode.stats.durationInSeconds ) );\n            // This is not ideal, but it should be enough to mimic gtest's\n            // junit output.\n            // Ideally the JUnit reporter would also handle `skipTest`\n            // events and write those out appropriately.\n            xml.writeAttribute( \"status\", \"run\" );\n\n            if (sectionNode.stats.assertions.failedButOk) {\n                xml.scopedElement(\"skipped\")\n                    .writeAttribute(\"message\", \"TEST_CASE tagged with !mayfail\");\n            }\n\n            writeAssertions( sectionNode );\n\n            if( !sectionNode.stdOut.empty() )\n                xml.scopedElement( \"system-out\" ).writeText( trim( sectionNode.stdOut ), XmlFormatting::Newline );\n            if( !sectionNode.stdErr.empty() )\n                xml.scopedElement( \"system-err\" ).writeText( trim( sectionNode.stdErr ), XmlFormatting::Newline );\n        }\n        for( auto const& childNode : sectionNode.childSections )\n            if( className.empty() )\n                writeSection( name, \"\", *childNode, testOkToFail );\n            else\n                writeSection( className, name, *childNode, testOkToFail );\n    }\n\n    void JunitReporter::writeAssertions( SectionNode const& sectionNode ) {\n        for( auto const& assertion : sectionNode.assertions )\n            writeAssertion( assertion );\n    }\n\n    void JunitReporter::writeAssertion( AssertionStats const& stats ) {\n        AssertionResult const& result = stats.assertionResult;\n        if( !result.isOk() ) {\n            std::string elementName;\n            switch( result.getResultType() ) {\n                case ResultWas::ThrewException:\n                case ResultWas::FatalErrorCondition:\n                    elementName = \"error\";\n                    break;\n                case ResultWas::ExplicitFailure:\n                case ResultWas::ExpressionFailed:\n                case ResultWas::DidntThrowException:\n                    elementName = \"failure\";\n                    break;\n\n                // We should never see these here:\n                case ResultWas::Info:\n                case ResultWas::Warning:\n                case ResultWas::Ok:\n                case ResultWas::Unknown:\n                case ResultWas::FailureBit:\n                case ResultWas::Exception:\n                    elementName = \"internalError\";\n                    break;\n            }\n\n            XmlWriter::ScopedElement e = xml.scopedElement( elementName );\n\n            xml.writeAttribute( \"message\", result.getExpression() );\n            xml.writeAttribute( \"type\", result.getTestMacroName() );\n\n            ReusableStringStream rss;\n            if (stats.totals.assertions.total() > 0) {\n                rss << \"FAILED\" << \":\\n\";\n                if (result.hasExpression()) {\n                    rss << \"  \";\n                    rss << result.getExpressionInMacro();\n                    rss << '\\n';\n                }\n                if (result.hasExpandedExpression()) {\n                    rss << \"with expansion:\\n\";\n                    rss << Column(result.getExpandedExpression()).indent(2) << '\\n';\n                }\n            } else {\n                rss << '\\n';\n            }\n\n            if( !result.getMessage().empty() )\n                rss << result.getMessage() << '\\n';\n            for( auto const& msg : stats.infoMessages )\n                if( msg.type == ResultWas::Info )\n                    rss << msg.message << '\\n';\n\n            rss << \"at \" << result.getSourceInfo();\n            xml.writeText( rss.str(), XmlFormatting::Newline );\n        }\n    }\n\n    CATCH_REGISTER_REPORTER( \"junit\", JunitReporter )\n\n} // end namespace Catch\n// end catch_reporter_junit.cpp\n// start catch_reporter_listening.cpp\n\n#include <cassert>\n\nnamespace Catch {\n\n    ListeningReporter::ListeningReporter() {\n        // We will assume that listeners will always want all assertions\n        m_preferences.shouldReportAllAssertions = true;\n    }\n\n    void ListeningReporter::addListener( IStreamingReporterPtr&& listener ) {\n        m_listeners.push_back( std::move( listener ) );\n    }\n\n    void ListeningReporter::addReporter(IStreamingReporterPtr&& reporter) {\n        assert(!m_reporter && \"Listening reporter can wrap only 1 real reporter\");\n        m_reporter = std::move( reporter );\n        m_preferences.shouldRedirectStdOut = m_reporter->getPreferences().shouldRedirectStdOut;\n    }\n\n    ReporterPreferences ListeningReporter::getPreferences() const {\n        return m_preferences;\n    }\n\n    std::set<Verbosity> ListeningReporter::getSupportedVerbosities() {\n        return std::set<Verbosity>{ };\n    }\n\n    void ListeningReporter::noMatchingTestCases( std::string const& spec ) {\n        for ( auto const& listener : m_listeners ) {\n            listener->noMatchingTestCases( spec );\n        }\n        m_reporter->noMatchingTestCases( spec );\n    }\n\n    void ListeningReporter::reportInvalidArguments(std::string const&arg){\n        for ( auto const& listener : m_listeners ) {\n            listener->reportInvalidArguments( arg );\n        }\n        m_reporter->reportInvalidArguments( arg );\n    }\n\n#if defined(CATCH_CONFIG_ENABLE_BENCHMARKING)\n    void ListeningReporter::benchmarkPreparing( std::string const& name ) {\n\t\tfor (auto const& listener : m_listeners) {\n\t\t\tlistener->benchmarkPreparing(name);\n\t\t}\n\t\tm_reporter->benchmarkPreparing(name);\n\t}\n    void ListeningReporter::benchmarkStarting( BenchmarkInfo const& benchmarkInfo ) {\n        for ( auto const& listener : m_listeners ) {\n            listener->benchmarkStarting( benchmarkInfo );\n        }\n        m_reporter->benchmarkStarting( benchmarkInfo );\n    }\n    void ListeningReporter::benchmarkEnded( BenchmarkStats<> const& benchmarkStats ) {\n        for ( auto const& listener : m_listeners ) {\n            listener->benchmarkEnded( benchmarkStats );\n        }\n        m_reporter->benchmarkEnded( benchmarkStats );\n    }\n\n\tvoid ListeningReporter::benchmarkFailed( std::string const& error ) {\n\t\tfor (auto const& listener : m_listeners) {\n\t\t\tlistener->benchmarkFailed(error);\n\t\t}\n\t\tm_reporter->benchmarkFailed(error);\n\t}\n#endif // CATCH_CONFIG_ENABLE_BENCHMARKING\n\n    void ListeningReporter::testRunStarting( TestRunInfo const& testRunInfo ) {\n        for ( auto const& listener : m_listeners ) {\n            listener->testRunStarting( testRunInfo );\n        }\n        m_reporter->testRunStarting( testRunInfo );\n    }\n\n    void ListeningReporter::testGroupStarting( GroupInfo const& groupInfo ) {\n        for ( auto const& listener : m_listeners ) {\n            listener->testGroupStarting( groupInfo );\n        }\n        m_reporter->testGroupStarting( groupInfo );\n    }\n\n    void ListeningReporter::testCaseStarting( TestCaseInfo const& testInfo ) {\n        for ( auto const& listener : m_listeners ) {\n            listener->testCaseStarting( testInfo );\n        }\n        m_reporter->testCaseStarting( testInfo );\n    }\n\n    void ListeningReporter::sectionStarting( SectionInfo const& sectionInfo ) {\n        for ( auto const& listener : m_listeners ) {\n            listener->sectionStarting( sectionInfo );\n        }\n        m_reporter->sectionStarting( sectionInfo );\n    }\n\n    void ListeningReporter::assertionStarting( AssertionInfo const& assertionInfo ) {\n        for ( auto const& listener : m_listeners ) {\n            listener->assertionStarting( assertionInfo );\n        }\n        m_reporter->assertionStarting( assertionInfo );\n    }\n\n    // The return value indicates if the messages buffer should be cleared:\n    bool ListeningReporter::assertionEnded( AssertionStats const& assertionStats ) {\n        for( auto const& listener : m_listeners ) {\n            static_cast<void>( listener->assertionEnded( assertionStats ) );\n        }\n        return m_reporter->assertionEnded( assertionStats );\n    }\n\n    void ListeningReporter::sectionEnded( SectionStats const& sectionStats ) {\n        for ( auto const& listener : m_listeners ) {\n            listener->sectionEnded( sectionStats );\n        }\n        m_reporter->sectionEnded( sectionStats );\n    }\n\n    void ListeningReporter::testCaseEnded( TestCaseStats const& testCaseStats ) {\n        for ( auto const& listener : m_listeners ) {\n            listener->testCaseEnded( testCaseStats );\n        }\n        m_reporter->testCaseEnded( testCaseStats );\n    }\n\n    void ListeningReporter::testGroupEnded( TestGroupStats const& testGroupStats ) {\n        for ( auto const& listener : m_listeners ) {\n            listener->testGroupEnded( testGroupStats );\n        }\n        m_reporter->testGroupEnded( testGroupStats );\n    }\n\n    void ListeningReporter::testRunEnded( TestRunStats const& testRunStats ) {\n        for ( auto const& listener : m_listeners ) {\n            listener->testRunEnded( testRunStats );\n        }\n        m_reporter->testRunEnded( testRunStats );\n    }\n\n    void ListeningReporter::skipTest( TestCaseInfo const& testInfo ) {\n        for ( auto const& listener : m_listeners ) {\n            listener->skipTest( testInfo );\n        }\n        m_reporter->skipTest( testInfo );\n    }\n\n    bool ListeningReporter::isMulti() const {\n        return true;\n    }\n\n} // end namespace Catch\n// end catch_reporter_listening.cpp\n// start catch_reporter_xml.cpp\n\n#if defined(_MSC_VER)\n#pragma warning(push)\n#pragma warning(disable:4061) // Not all labels are EXPLICITLY handled in switch\n                              // Note that 4062 (not all labels are handled\n                              // and default is missing) is enabled\n#endif\n\nnamespace Catch {\n    XmlReporter::XmlReporter( ReporterConfig const& _config )\n    :   StreamingReporterBase( _config ),\n        m_xml(_config.stream())\n    {\n        m_reporterPrefs.shouldRedirectStdOut = true;\n        m_reporterPrefs.shouldReportAllAssertions = true;\n    }\n\n    XmlReporter::~XmlReporter() = default;\n\n    std::string XmlReporter::getDescription() {\n        return \"Reports test results as an XML document\";\n    }\n\n    std::string XmlReporter::getStylesheetRef() const {\n        return std::string();\n    }\n\n    void XmlReporter::writeSourceInfo( SourceLineInfo const& sourceInfo ) {\n        m_xml\n            .writeAttribute( \"filename\", sourceInfo.file )\n            .writeAttribute( \"line\", sourceInfo.line );\n    }\n\n    void XmlReporter::noMatchingTestCases( std::string const& s ) {\n        StreamingReporterBase::noMatchingTestCases( s );\n    }\n\n    void XmlReporter::testRunStarting( TestRunInfo const& testInfo ) {\n        StreamingReporterBase::testRunStarting( testInfo );\n        std::string stylesheetRef = getStylesheetRef();\n        if( !stylesheetRef.empty() )\n            m_xml.writeStylesheetRef( stylesheetRef );\n        m_xml.startElement( \"Catch\" );\n        if( !m_config->name().empty() )\n            m_xml.writeAttribute( \"name\", m_config->name() );\n        if (m_config->testSpec().hasFilters())\n            m_xml.writeAttribute( \"filters\", serializeFilters( m_config->getTestsOrTags() ) );\n        if( m_config->rngSeed() != 0 )\n            m_xml.scopedElement( \"Randomness\" )\n                .writeAttribute( \"seed\", m_config->rngSeed() );\n    }\n\n    void XmlReporter::testGroupStarting( GroupInfo const& groupInfo ) {\n        StreamingReporterBase::testGroupStarting( groupInfo );\n        m_xml.startElement( \"Group\" )\n            .writeAttribute( \"name\", groupInfo.name );\n    }\n\n    void XmlReporter::testCaseStarting( TestCaseInfo const& testInfo ) {\n        StreamingReporterBase::testCaseStarting(testInfo);\n        m_xml.startElement( \"TestCase\" )\n            .writeAttribute( \"name\", trim( testInfo.name ) )\n            .writeAttribute( \"description\", testInfo.description )\n            .writeAttribute( \"tags\", testInfo.tagsAsString() );\n\n        writeSourceInfo( testInfo.lineInfo );\n\n        if ( m_config->showDurations() == ShowDurations::Always )\n            m_testCaseTimer.start();\n        m_xml.ensureTagClosed();\n    }\n\n    void XmlReporter::sectionStarting( SectionInfo const& sectionInfo ) {\n        StreamingReporterBase::sectionStarting( sectionInfo );\n        if( m_sectionDepth++ > 0 ) {\n            m_xml.startElement( \"Section\" )\n                .writeAttribute( \"name\", trim( sectionInfo.name ) );\n            writeSourceInfo( sectionInfo.lineInfo );\n            m_xml.ensureTagClosed();\n        }\n    }\n\n    void XmlReporter::assertionStarting( AssertionInfo const& ) { }\n\n    bool XmlReporter::assertionEnded( AssertionStats const& assertionStats ) {\n\n        AssertionResult const& result = assertionStats.assertionResult;\n\n        bool includeResults = m_config->includeSuccessfulResults() || !result.isOk();\n\n        if( includeResults || result.getResultType() == ResultWas::Warning ) {\n            // Print any info messages in <Info> tags.\n            for( auto const& msg : assertionStats.infoMessages ) {\n                if( msg.type == ResultWas::Info && includeResults ) {\n                    m_xml.scopedElement( \"Info\" )\n                            .writeText( msg.message );\n                } else if ( msg.type == ResultWas::Warning ) {\n                    m_xml.scopedElement( \"Warning\" )\n                            .writeText( msg.message );\n                }\n            }\n        }\n\n        // Drop out if result was successful but we're not printing them.\n        if( !includeResults && result.getResultType() != ResultWas::Warning )\n            return true;\n\n        // Print the expression if there is one.\n        if( result.hasExpression() ) {\n            m_xml.startElement( \"Expression\" )\n                .writeAttribute( \"success\", result.succeeded() )\n                .writeAttribute( \"type\", result.getTestMacroName() );\n\n            writeSourceInfo( result.getSourceInfo() );\n\n            m_xml.scopedElement( \"Original\" )\n                .writeText( result.getExpression() );\n            m_xml.scopedElement( \"Expanded\" )\n                .writeText( result.getExpandedExpression() );\n        }\n\n        // And... Print a result applicable to each result type.\n        switch( result.getResultType() ) {\n            case ResultWas::ThrewException:\n                m_xml.startElement( \"Exception\" );\n                writeSourceInfo( result.getSourceInfo() );\n                m_xml.writeText( result.getMessage() );\n                m_xml.endElement();\n                break;\n            case ResultWas::FatalErrorCondition:\n                m_xml.startElement( \"FatalErrorCondition\" );\n                writeSourceInfo( result.getSourceInfo() );\n                m_xml.writeText( result.getMessage() );\n                m_xml.endElement();\n                break;\n            case ResultWas::Info:\n                m_xml.scopedElement( \"Info\" )\n                    .writeText( result.getMessage() );\n                break;\n            case ResultWas::Warning:\n                // Warning will already have been written\n                break;\n            case ResultWas::ExplicitFailure:\n                m_xml.startElement( \"Failure\" );\n                writeSourceInfo( result.getSourceInfo() );\n                m_xml.writeText( result.getMessage() );\n                m_xml.endElement();\n                break;\n            default:\n                break;\n        }\n\n        if( result.hasExpression() )\n            m_xml.endElement();\n\n        return true;\n    }\n\n    void XmlReporter::sectionEnded( SectionStats const& sectionStats ) {\n        StreamingReporterBase::sectionEnded( sectionStats );\n        if( --m_sectionDepth > 0 ) {\n            XmlWriter::ScopedElement e = m_xml.scopedElement( \"OverallResults\" );\n            e.writeAttribute( \"successes\", sectionStats.assertions.passed );\n            e.writeAttribute( \"failures\", sectionStats.assertions.failed );\n            e.writeAttribute( \"expectedFailures\", sectionStats.assertions.failedButOk );\n\n            if ( m_config->showDurations() == ShowDurations::Always )\n                e.writeAttribute( \"durationInSeconds\", sectionStats.durationInSeconds );\n\n            m_xml.endElement();\n        }\n    }\n\n    void XmlReporter::testCaseEnded( TestCaseStats const& testCaseStats ) {\n        StreamingReporterBase::testCaseEnded( testCaseStats );\n        XmlWriter::ScopedElement e = m_xml.scopedElement( \"OverallResult\" );\n        e.writeAttribute( \"success\", testCaseStats.totals.assertions.allOk() );\n\n        if ( m_config->showDurations() == ShowDurations::Always )\n            e.writeAttribute( \"durationInSeconds\", m_testCaseTimer.getElapsedSeconds() );\n\n        if( !testCaseStats.stdOut.empty() )\n            m_xml.scopedElement( \"StdOut\" ).writeText( trim( testCaseStats.stdOut ), XmlFormatting::Newline );\n        if( !testCaseStats.stdErr.empty() )\n            m_xml.scopedElement( \"StdErr\" ).writeText( trim( testCaseStats.stdErr ), XmlFormatting::Newline );\n\n        m_xml.endElement();\n    }\n\n    void XmlReporter::testGroupEnded( TestGroupStats const& testGroupStats ) {\n        StreamingReporterBase::testGroupEnded( testGroupStats );\n        // TODO: Check testGroupStats.aborting and act accordingly.\n        m_xml.scopedElement( \"OverallResults\" )\n            .writeAttribute( \"successes\", testGroupStats.totals.assertions.passed )\n            .writeAttribute( \"failures\", testGroupStats.totals.assertions.failed )\n            .writeAttribute( \"expectedFailures\", testGroupStats.totals.assertions.failedButOk );\n        m_xml.scopedElement( \"OverallResultsCases\")\n            .writeAttribute( \"successes\", testGroupStats.totals.testCases.passed )\n            .writeAttribute( \"failures\", testGroupStats.totals.testCases.failed )\n            .writeAttribute( \"expectedFailures\", testGroupStats.totals.testCases.failedButOk );\n        m_xml.endElement();\n    }\n\n    void XmlReporter::testRunEnded( TestRunStats const& testRunStats ) {\n        StreamingReporterBase::testRunEnded( testRunStats );\n        m_xml.scopedElement( \"OverallResults\" )\n            .writeAttribute( \"successes\", testRunStats.totals.assertions.passed )\n            .writeAttribute( \"failures\", testRunStats.totals.assertions.failed )\n            .writeAttribute( \"expectedFailures\", testRunStats.totals.assertions.failedButOk );\n        m_xml.scopedElement( \"OverallResultsCases\")\n            .writeAttribute( \"successes\", testRunStats.totals.testCases.passed )\n            .writeAttribute( \"failures\", testRunStats.totals.testCases.failed )\n            .writeAttribute( \"expectedFailures\", testRunStats.totals.testCases.failedButOk );\n        m_xml.endElement();\n    }\n\n#if defined(CATCH_CONFIG_ENABLE_BENCHMARKING)\n    void XmlReporter::benchmarkPreparing(std::string const& name) {\n        m_xml.startElement(\"BenchmarkResults\")\n            .writeAttribute(\"name\", name);\n    }\n\n    void XmlReporter::benchmarkStarting(BenchmarkInfo const &info) {\n        m_xml.writeAttribute(\"samples\", info.samples)\n            .writeAttribute(\"resamples\", info.resamples)\n            .writeAttribute(\"iterations\", info.iterations)\n            .writeAttribute(\"clockResolution\", info.clockResolution)\n            .writeAttribute(\"estimatedDuration\", info.estimatedDuration)\n            .writeComment(\"All values in nano seconds\");\n    }\n\n    void XmlReporter::benchmarkEnded(BenchmarkStats<> const& benchmarkStats) {\n        m_xml.startElement(\"mean\")\n            .writeAttribute(\"value\", benchmarkStats.mean.point.count())\n            .writeAttribute(\"lowerBound\", benchmarkStats.mean.lower_bound.count())\n            .writeAttribute(\"upperBound\", benchmarkStats.mean.upper_bound.count())\n            .writeAttribute(\"ci\", benchmarkStats.mean.confidence_interval);\n        m_xml.endElement();\n        m_xml.startElement(\"standardDeviation\")\n            .writeAttribute(\"value\", benchmarkStats.standardDeviation.point.count())\n            .writeAttribute(\"lowerBound\", benchmarkStats.standardDeviation.lower_bound.count())\n            .writeAttribute(\"upperBound\", benchmarkStats.standardDeviation.upper_bound.count())\n            .writeAttribute(\"ci\", benchmarkStats.standardDeviation.confidence_interval);\n        m_xml.endElement();\n        m_xml.startElement(\"outliers\")\n            .writeAttribute(\"variance\", benchmarkStats.outlierVariance)\n            .writeAttribute(\"lowMild\", benchmarkStats.outliers.low_mild)\n            .writeAttribute(\"lowSevere\", benchmarkStats.outliers.low_severe)\n            .writeAttribute(\"highMild\", benchmarkStats.outliers.high_mild)\n            .writeAttribute(\"highSevere\", benchmarkStats.outliers.high_severe);\n        m_xml.endElement();\n        m_xml.endElement();\n    }\n\n    void XmlReporter::benchmarkFailed(std::string const &error) {\n        m_xml.scopedElement(\"failed\").\n            writeAttribute(\"message\", error);\n        m_xml.endElement();\n    }\n#endif // CATCH_CONFIG_ENABLE_BENCHMARKING\n\n    CATCH_REGISTER_REPORTER( \"xml\", XmlReporter )\n\n} // end namespace Catch\n\n#if defined(_MSC_VER)\n#pragma warning(pop)\n#endif\n// end catch_reporter_xml.cpp\n\nnamespace Catch {\n    LeakDetector leakDetector;\n}\n\n#ifdef __clang__\n#pragma clang diagnostic pop\n#endif\n\n// end catch_impl.hpp\n#endif\n\n#ifdef CATCH_CONFIG_MAIN\n// start catch_default_main.hpp\n\n#ifndef __OBJC__\n\n#ifndef CATCH_INTERNAL_CDECL\n#ifdef _MSC_VER\n#define CATCH_INTERNAL_CDECL __cdecl\n#else\n#define CATCH_INTERNAL_CDECL\n#endif\n#endif\n\n#if defined(CATCH_CONFIG_WCHAR) && defined(CATCH_PLATFORM_WINDOWS) && defined(_UNICODE) && !defined(DO_NOT_USE_WMAIN)\n// Standard C/C++ Win32 Unicode wmain entry point\nextern \"C\" int CATCH_INTERNAL_CDECL wmain (int argc, wchar_t * argv[], wchar_t * []) {\n#else\n// Standard C/C++ main entry point\nint CATCH_INTERNAL_CDECL main (int argc, char * argv[]) {\n#endif\n\n    return Catch::Session().run( argc, argv );\n}\n\n#else // __OBJC__\n\n// Objective-C entry point\nint main (int argc, char * const argv[]) {\n#if !CATCH_ARC_ENABLED\n    NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init];\n#endif\n\n    Catch::registerTestMethods();\n    int result = Catch::Session().run( argc, (char**)argv );\n\n#if !CATCH_ARC_ENABLED\n    [pool drain];\n#endif\n\n    return result;\n}\n\n#endif // __OBJC__\n\n// end catch_default_main.hpp\n#endif\n\n#if !defined(CATCH_CONFIG_IMPL_ONLY)\n\n#ifdef CLARA_CONFIG_MAIN_NOT_DEFINED\n#  undef CLARA_CONFIG_MAIN\n#endif\n\n#if !defined(CATCH_CONFIG_DISABLE)\n//////\n// If this config identifier is defined then all CATCH macros are prefixed with CATCH_\n#ifdef CATCH_CONFIG_PREFIX_ALL\n\n#define CATCH_REQUIRE( ... ) INTERNAL_CATCH_TEST( \"CATCH_REQUIRE\", Catch::ResultDisposition::Normal, __VA_ARGS__ )\n#define CATCH_REQUIRE_FALSE( ... ) INTERNAL_CATCH_TEST( \"CATCH_REQUIRE_FALSE\", Catch::ResultDisposition::Normal | Catch::ResultDisposition::FalseTest, __VA_ARGS__ )\n\n#define CATCH_REQUIRE_THROWS( ... ) INTERNAL_CATCH_THROWS( \"CATCH_REQUIRE_THROWS\", Catch::ResultDisposition::Normal, __VA_ARGS__ )\n#define CATCH_REQUIRE_THROWS_AS( expr, exceptionType ) INTERNAL_CATCH_THROWS_AS( \"CATCH_REQUIRE_THROWS_AS\", exceptionType, Catch::ResultDisposition::Normal, expr )\n#define CATCH_REQUIRE_THROWS_WITH( expr, matcher ) INTERNAL_CATCH_THROWS_STR_MATCHES( \"CATCH_REQUIRE_THROWS_WITH\", Catch::ResultDisposition::Normal, matcher, expr )\n#if !defined(CATCH_CONFIG_DISABLE_MATCHERS)\n#define CATCH_REQUIRE_THROWS_MATCHES( expr, exceptionType, matcher ) INTERNAL_CATCH_THROWS_MATCHES( \"CATCH_REQUIRE_THROWS_MATCHES\", exceptionType, Catch::ResultDisposition::Normal, matcher, expr )\n#endif// CATCH_CONFIG_DISABLE_MATCHERS\n#define CATCH_REQUIRE_NOTHROW( ... ) INTERNAL_CATCH_NO_THROW( \"CATCH_REQUIRE_NOTHROW\", Catch::ResultDisposition::Normal, __VA_ARGS__ )\n\n#define CATCH_CHECK( ... ) INTERNAL_CATCH_TEST( \"CATCH_CHECK\", Catch::ResultDisposition::ContinueOnFailure, __VA_ARGS__ )\n#define CATCH_CHECK_FALSE( ... ) INTERNAL_CATCH_TEST( \"CATCH_CHECK_FALSE\", Catch::ResultDisposition::ContinueOnFailure | Catch::ResultDisposition::FalseTest, __VA_ARGS__ )\n#define CATCH_CHECKED_IF( ... ) INTERNAL_CATCH_IF( \"CATCH_CHECKED_IF\", Catch::ResultDisposition::ContinueOnFailure, __VA_ARGS__ )\n#define CATCH_CHECKED_ELSE( ... ) INTERNAL_CATCH_ELSE( \"CATCH_CHECKED_ELSE\", Catch::ResultDisposition::ContinueOnFailure, __VA_ARGS__ )\n#define CATCH_CHECK_NOFAIL( ... ) INTERNAL_CATCH_TEST( \"CATCH_CHECK_NOFAIL\", Catch::ResultDisposition::ContinueOnFailure | Catch::ResultDisposition::SuppressFail, __VA_ARGS__ )\n\n#define CATCH_CHECK_THROWS( ... )  INTERNAL_CATCH_THROWS( \"CATCH_CHECK_THROWS\", Catch::ResultDisposition::ContinueOnFailure, __VA_ARGS__ )\n#define CATCH_CHECK_THROWS_AS( expr, exceptionType ) INTERNAL_CATCH_THROWS_AS( \"CATCH_CHECK_THROWS_AS\", exceptionType, Catch::ResultDisposition::ContinueOnFailure, expr )\n#define CATCH_CHECK_THROWS_WITH( expr, matcher ) INTERNAL_CATCH_THROWS_STR_MATCHES( \"CATCH_CHECK_THROWS_WITH\", Catch::ResultDisposition::ContinueOnFailure, matcher, expr )\n#if !defined(CATCH_CONFIG_DISABLE_MATCHERS)\n#define CATCH_CHECK_THROWS_MATCHES( expr, exceptionType, matcher ) INTERNAL_CATCH_THROWS_MATCHES( \"CATCH_CHECK_THROWS_MATCHES\", exceptionType, Catch::ResultDisposition::ContinueOnFailure, matcher, expr )\n#endif // CATCH_CONFIG_DISABLE_MATCHERS\n#define CATCH_CHECK_NOTHROW( ... ) INTERNAL_CATCH_NO_THROW( \"CATCH_CHECK_NOTHROW\", Catch::ResultDisposition::ContinueOnFailure, __VA_ARGS__ )\n\n#if !defined(CATCH_CONFIG_DISABLE_MATCHERS)\n#define CATCH_CHECK_THAT( arg, matcher ) INTERNAL_CHECK_THAT( \"CATCH_CHECK_THAT\", matcher, Catch::ResultDisposition::ContinueOnFailure, arg )\n\n#define CATCH_REQUIRE_THAT( arg, matcher ) INTERNAL_CHECK_THAT( \"CATCH_REQUIRE_THAT\", matcher, Catch::ResultDisposition::Normal, arg )\n#endif // CATCH_CONFIG_DISABLE_MATCHERS\n\n#define CATCH_INFO( msg ) INTERNAL_CATCH_INFO( \"CATCH_INFO\", msg )\n#define CATCH_UNSCOPED_INFO( msg ) INTERNAL_CATCH_UNSCOPED_INFO( \"CATCH_UNSCOPED_INFO\", msg )\n#define CATCH_WARN( msg ) INTERNAL_CATCH_MSG( \"CATCH_WARN\", Catch::ResultWas::Warning, Catch::ResultDisposition::ContinueOnFailure, msg )\n#define CATCH_CAPTURE( ... ) INTERNAL_CATCH_CAPTURE( INTERNAL_CATCH_UNIQUE_NAME(capturer), \"CATCH_CAPTURE\",__VA_ARGS__ )\n\n#define CATCH_TEST_CASE( ... ) INTERNAL_CATCH_TESTCASE( __VA_ARGS__ )\n#define CATCH_TEST_CASE_METHOD( className, ... ) INTERNAL_CATCH_TEST_CASE_METHOD( className, __VA_ARGS__ )\n#define CATCH_METHOD_AS_TEST_CASE( method, ... ) INTERNAL_CATCH_METHOD_AS_TEST_CASE( method, __VA_ARGS__ )\n#define CATCH_REGISTER_TEST_CASE( Function, ... ) INTERNAL_CATCH_REGISTER_TESTCASE( Function, __VA_ARGS__ )\n#define CATCH_SECTION( ... ) INTERNAL_CATCH_SECTION( __VA_ARGS__ )\n#define CATCH_DYNAMIC_SECTION( ... ) INTERNAL_CATCH_DYNAMIC_SECTION( __VA_ARGS__ )\n#define CATCH_FAIL( ... ) INTERNAL_CATCH_MSG( \"CATCH_FAIL\", Catch::ResultWas::ExplicitFailure, Catch::ResultDisposition::Normal, __VA_ARGS__ )\n#define CATCH_FAIL_CHECK( ... ) INTERNAL_CATCH_MSG( \"CATCH_FAIL_CHECK\", Catch::ResultWas::ExplicitFailure, Catch::ResultDisposition::ContinueOnFailure, __VA_ARGS__ )\n#define CATCH_SUCCEED( ... ) INTERNAL_CATCH_MSG( \"CATCH_SUCCEED\", Catch::ResultWas::Ok, Catch::ResultDisposition::ContinueOnFailure, __VA_ARGS__ )\n\n#define CATCH_ANON_TEST_CASE() INTERNAL_CATCH_TESTCASE()\n\n#ifndef CATCH_CONFIG_TRADITIONAL_MSVC_PREPROCESSOR\n#define CATCH_TEMPLATE_TEST_CASE( ... ) INTERNAL_CATCH_TEMPLATE_TEST_CASE( __VA_ARGS__ )\n#define CATCH_TEMPLATE_TEST_CASE_SIG( ... ) INTERNAL_CATCH_TEMPLATE_TEST_CASE_SIG( __VA_ARGS__ )\n#define CATCH_TEMPLATE_TEST_CASE_METHOD( className, ... ) INTERNAL_CATCH_TEMPLATE_TEST_CASE_METHOD( className, __VA_ARGS__ )\n#define CATCH_TEMPLATE_TEST_CASE_METHOD_SIG( className, ... ) INTERNAL_CATCH_TEMPLATE_TEST_CASE_METHOD_SIG( className, __VA_ARGS__ )\n#define CATCH_TEMPLATE_PRODUCT_TEST_CASE( ... ) INTERNAL_CATCH_TEMPLATE_PRODUCT_TEST_CASE( __VA_ARGS__ )\n#define CATCH_TEMPLATE_PRODUCT_TEST_CASE_SIG( ... ) INTERNAL_CATCH_TEMPLATE_PRODUCT_TEST_CASE_SIG( __VA_ARGS__ )\n#define CATCH_TEMPLATE_PRODUCT_TEST_CASE_METHOD( className, ... ) INTERNAL_CATCH_TEMPLATE_PRODUCT_TEST_CASE_METHOD( className, __VA_ARGS__ )\n#define CATCH_TEMPLATE_PRODUCT_TEST_CASE_METHOD_SIG( className, ... ) INTERNAL_CATCH_TEMPLATE_PRODUCT_TEST_CASE_METHOD_SIG( className, __VA_ARGS__ )\n#else\n#define CATCH_TEMPLATE_TEST_CASE( ... ) INTERNAL_CATCH_EXPAND_VARGS( INTERNAL_CATCH_TEMPLATE_TEST_CASE( __VA_ARGS__ ) )\n#define CATCH_TEMPLATE_TEST_CASE_SIG( ... ) INTERNAL_CATCH_EXPAND_VARGS( INTERNAL_CATCH_TEMPLATE_TEST_CASE_SIG( __VA_ARGS__ ) )\n#define CATCH_TEMPLATE_TEST_CASE_METHOD( className, ... ) INTERNAL_CATCH_EXPAND_VARGS( INTERNAL_CATCH_TEMPLATE_TEST_CASE_METHOD( className, __VA_ARGS__ ) )\n#define CATCH_TEMPLATE_TEST_CASE_METHOD_SIG( className, ... ) INTERNAL_CATCH_EXPAND_VARGS( INTERNAL_CATCH_TEMPLATE_TEST_CASE_METHOD_SIG( className, __VA_ARGS__ ) )\n#define CATCH_TEMPLATE_PRODUCT_TEST_CASE( ... ) INTERNAL_CATCH_EXPAND_VARGS( INTERNAL_CATCH_TEMPLATE_PRODUCT_TEST_CASE( __VA_ARGS__ ) )\n#define CATCH_TEMPLATE_PRODUCT_TEST_CASE_SIG( ... ) INTERNAL_CATCH_EXPAND_VARGS( INTERNAL_CATCH_TEMPLATE_PRODUCT_TEST_CASE_SIG( __VA_ARGS__ ) )\n#define CATCH_TEMPLATE_PRODUCT_TEST_CASE_METHOD( className, ... ) INTERNAL_CATCH_EXPAND_VARGS( INTERNAL_CATCH_TEMPLATE_PRODUCT_TEST_CASE_METHOD( className, __VA_ARGS__ ) )\n#define CATCH_TEMPLATE_PRODUCT_TEST_CASE_METHOD_SIG( className, ... ) INTERNAL_CATCH_EXPAND_VARGS( INTERNAL_CATCH_TEMPLATE_PRODUCT_TEST_CASE_METHOD_SIG( className, __VA_ARGS__ ) )\n#endif\n\n#if !defined(CATCH_CONFIG_RUNTIME_STATIC_REQUIRE)\n#define CATCH_STATIC_REQUIRE( ... )       static_assert(   __VA_ARGS__ ,      #__VA_ARGS__ );     CATCH_SUCCEED( #__VA_ARGS__ )\n#define CATCH_STATIC_REQUIRE_FALSE( ... ) static_assert( !(__VA_ARGS__), \"!(\" #__VA_ARGS__ \")\" ); CATCH_SUCCEED( #__VA_ARGS__ )\n#else\n#define CATCH_STATIC_REQUIRE( ... )       CATCH_REQUIRE( __VA_ARGS__ )\n#define CATCH_STATIC_REQUIRE_FALSE( ... ) CATCH_REQUIRE_FALSE( __VA_ARGS__ )\n#endif\n\n// \"BDD-style\" convenience wrappers\n#define CATCH_SCENARIO( ... ) CATCH_TEST_CASE( \"Scenario: \" __VA_ARGS__ )\n#define CATCH_SCENARIO_METHOD( className, ... ) INTERNAL_CATCH_TEST_CASE_METHOD( className, \"Scenario: \" __VA_ARGS__ )\n#define CATCH_GIVEN( desc )     INTERNAL_CATCH_DYNAMIC_SECTION( \"    Given: \" << desc )\n#define CATCH_AND_GIVEN( desc ) INTERNAL_CATCH_DYNAMIC_SECTION( \"And given: \" << desc )\n#define CATCH_WHEN( desc )      INTERNAL_CATCH_DYNAMIC_SECTION( \"     When: \" << desc )\n#define CATCH_AND_WHEN( desc )  INTERNAL_CATCH_DYNAMIC_SECTION( \" And when: \" << desc )\n#define CATCH_THEN( desc )      INTERNAL_CATCH_DYNAMIC_SECTION( \"     Then: \" << desc )\n#define CATCH_AND_THEN( desc )  INTERNAL_CATCH_DYNAMIC_SECTION( \"      And: \" << desc )\n\n#if defined(CATCH_CONFIG_ENABLE_BENCHMARKING)\n#define CATCH_BENCHMARK(...) \\\n    INTERNAL_CATCH_BENCHMARK(INTERNAL_CATCH_UNIQUE_NAME(C_A_T_C_H_B_E_N_C_H_), INTERNAL_CATCH_GET_1_ARG(__VA_ARGS__,,), INTERNAL_CATCH_GET_2_ARG(__VA_ARGS__,,))\n#define CATCH_BENCHMARK_ADVANCED(name) \\\n    INTERNAL_CATCH_BENCHMARK_ADVANCED(INTERNAL_CATCH_UNIQUE_NAME(C_A_T_C_H_B_E_N_C_H_), name)\n#endif // CATCH_CONFIG_ENABLE_BENCHMARKING\n\n// If CATCH_CONFIG_PREFIX_ALL is not defined then the CATCH_ prefix is not required\n#else\n\n#define REQUIRE( ... ) INTERNAL_CATCH_TEST( \"REQUIRE\", Catch::ResultDisposition::Normal, __VA_ARGS__  )\n#define REQUIRE_FALSE( ... ) INTERNAL_CATCH_TEST( \"REQUIRE_FALSE\", Catch::ResultDisposition::Normal | Catch::ResultDisposition::FalseTest, __VA_ARGS__ )\n\n#define REQUIRE_THROWS( ... ) INTERNAL_CATCH_THROWS( \"REQUIRE_THROWS\", Catch::ResultDisposition::Normal, __VA_ARGS__ )\n#define REQUIRE_THROWS_AS( expr, exceptionType ) INTERNAL_CATCH_THROWS_AS( \"REQUIRE_THROWS_AS\", exceptionType, Catch::ResultDisposition::Normal, expr )\n#define REQUIRE_THROWS_WITH( expr, matcher ) INTERNAL_CATCH_THROWS_STR_MATCHES( \"REQUIRE_THROWS_WITH\", Catch::ResultDisposition::Normal, matcher, expr )\n#if !defined(CATCH_CONFIG_DISABLE_MATCHERS)\n#define REQUIRE_THROWS_MATCHES( expr, exceptionType, matcher ) INTERNAL_CATCH_THROWS_MATCHES( \"REQUIRE_THROWS_MATCHES\", exceptionType, Catch::ResultDisposition::Normal, matcher, expr )\n#endif // CATCH_CONFIG_DISABLE_MATCHERS\n#define REQUIRE_NOTHROW( ... ) INTERNAL_CATCH_NO_THROW( \"REQUIRE_NOTHROW\", Catch::ResultDisposition::Normal, __VA_ARGS__ )\n\n#define CHECK( ... ) INTERNAL_CATCH_TEST( \"CHECK\", Catch::ResultDisposition::ContinueOnFailure, __VA_ARGS__ )\n#define CHECK_FALSE( ... ) INTERNAL_CATCH_TEST( \"CHECK_FALSE\", Catch::ResultDisposition::ContinueOnFailure | Catch::ResultDisposition::FalseTest, __VA_ARGS__ )\n#define CHECKED_IF( ... ) INTERNAL_CATCH_IF( \"CHECKED_IF\", Catch::ResultDisposition::ContinueOnFailure, __VA_ARGS__ )\n#define CHECKED_ELSE( ... ) INTERNAL_CATCH_ELSE( \"CHECKED_ELSE\", Catch::ResultDisposition::ContinueOnFailure, __VA_ARGS__ )\n#define CHECK_NOFAIL( ... ) INTERNAL_CATCH_TEST( \"CHECK_NOFAIL\", Catch::ResultDisposition::ContinueOnFailure | Catch::ResultDisposition::SuppressFail, __VA_ARGS__ )\n\n#define CHECK_THROWS( ... )  INTERNAL_CATCH_THROWS( \"CHECK_THROWS\", Catch::ResultDisposition::ContinueOnFailure, __VA_ARGS__ )\n#define CHECK_THROWS_AS( expr, exceptionType ) INTERNAL_CATCH_THROWS_AS( \"CHECK_THROWS_AS\", exceptionType, Catch::ResultDisposition::ContinueOnFailure, expr )\n#define CHECK_THROWS_WITH( expr, matcher ) INTERNAL_CATCH_THROWS_STR_MATCHES( \"CHECK_THROWS_WITH\", Catch::ResultDisposition::ContinueOnFailure, matcher, expr )\n#if !defined(CATCH_CONFIG_DISABLE_MATCHERS)\n#define CHECK_THROWS_MATCHES( expr, exceptionType, matcher ) INTERNAL_CATCH_THROWS_MATCHES( \"CHECK_THROWS_MATCHES\", exceptionType, Catch::ResultDisposition::ContinueOnFailure, matcher, expr )\n#endif // CATCH_CONFIG_DISABLE_MATCHERS\n#define CHECK_NOTHROW( ... ) INTERNAL_CATCH_NO_THROW( \"CHECK_NOTHROW\", Catch::ResultDisposition::ContinueOnFailure, __VA_ARGS__ )\n\n#if !defined(CATCH_CONFIG_DISABLE_MATCHERS)\n#define CHECK_THAT( arg, matcher ) INTERNAL_CHECK_THAT( \"CHECK_THAT\", matcher, Catch::ResultDisposition::ContinueOnFailure, arg )\n\n#define REQUIRE_THAT( arg, matcher ) INTERNAL_CHECK_THAT( \"REQUIRE_THAT\", matcher, Catch::ResultDisposition::Normal, arg )\n#endif // CATCH_CONFIG_DISABLE_MATCHERS\n\n#define INFO( msg ) INTERNAL_CATCH_INFO( \"INFO\", msg )\n#define UNSCOPED_INFO( msg ) INTERNAL_CATCH_UNSCOPED_INFO( \"UNSCOPED_INFO\", msg )\n#define WARN( msg ) INTERNAL_CATCH_MSG( \"WARN\", Catch::ResultWas::Warning, Catch::ResultDisposition::ContinueOnFailure, msg )\n#define CAPTURE( ... ) INTERNAL_CATCH_CAPTURE( INTERNAL_CATCH_UNIQUE_NAME(capturer), \"CAPTURE\",__VA_ARGS__ )\n\n#define TEST_CASE( ... ) INTERNAL_CATCH_TESTCASE( __VA_ARGS__ )\n#define TEST_CASE_METHOD( className, ... ) INTERNAL_CATCH_TEST_CASE_METHOD( className, __VA_ARGS__ )\n#define METHOD_AS_TEST_CASE( method, ... ) INTERNAL_CATCH_METHOD_AS_TEST_CASE( method, __VA_ARGS__ )\n#define REGISTER_TEST_CASE( Function, ... ) INTERNAL_CATCH_REGISTER_TESTCASE( Function, __VA_ARGS__ )\n#define SECTION( ... ) INTERNAL_CATCH_SECTION( __VA_ARGS__ )\n#define DYNAMIC_SECTION( ... ) INTERNAL_CATCH_DYNAMIC_SECTION( __VA_ARGS__ )\n#define FAIL( ... ) INTERNAL_CATCH_MSG( \"FAIL\", Catch::ResultWas::ExplicitFailure, Catch::ResultDisposition::Normal, __VA_ARGS__ )\n#define FAIL_CHECK( ... ) INTERNAL_CATCH_MSG( \"FAIL_CHECK\", Catch::ResultWas::ExplicitFailure, Catch::ResultDisposition::ContinueOnFailure, __VA_ARGS__ )\n#define SUCCEED( ... ) INTERNAL_CATCH_MSG( \"SUCCEED\", Catch::ResultWas::Ok, Catch::ResultDisposition::ContinueOnFailure, __VA_ARGS__ )\n#define ANON_TEST_CASE() INTERNAL_CATCH_TESTCASE()\n\n#ifndef CATCH_CONFIG_TRADITIONAL_MSVC_PREPROCESSOR\n#define TEMPLATE_TEST_CASE( ... ) INTERNAL_CATCH_TEMPLATE_TEST_CASE( __VA_ARGS__ )\n#define TEMPLATE_TEST_CASE_SIG( ... ) INTERNAL_CATCH_TEMPLATE_TEST_CASE_SIG( __VA_ARGS__ )\n#define TEMPLATE_TEST_CASE_METHOD( className, ... ) INTERNAL_CATCH_TEMPLATE_TEST_CASE_METHOD( className, __VA_ARGS__ )\n#define TEMPLATE_TEST_CASE_METHOD_SIG( className, ... ) INTERNAL_CATCH_TEMPLATE_TEST_CASE_METHOD_SIG( className, __VA_ARGS__ )\n#define TEMPLATE_PRODUCT_TEST_CASE( ... ) INTERNAL_CATCH_TEMPLATE_PRODUCT_TEST_CASE( __VA_ARGS__ )\n#define TEMPLATE_PRODUCT_TEST_CASE_SIG( ... ) INTERNAL_CATCH_TEMPLATE_PRODUCT_TEST_CASE_SIG( __VA_ARGS__ )\n#define TEMPLATE_PRODUCT_TEST_CASE_METHOD( className, ... ) INTERNAL_CATCH_TEMPLATE_PRODUCT_TEST_CASE_METHOD( className, __VA_ARGS__ )\n#define TEMPLATE_PRODUCT_TEST_CASE_METHOD_SIG( className, ... ) INTERNAL_CATCH_TEMPLATE_PRODUCT_TEST_CASE_METHOD_SIG( className, __VA_ARGS__ )\n#define TEMPLATE_LIST_TEST_CASE( ... ) INTERNAL_CATCH_TEMPLATE_LIST_TEST_CASE(__VA_ARGS__)\n#define TEMPLATE_LIST_TEST_CASE_METHOD( className, ... ) INTERNAL_CATCH_TEMPLATE_LIST_TEST_CASE_METHOD( className, __VA_ARGS__ )\n#else\n#define TEMPLATE_TEST_CASE( ... ) INTERNAL_CATCH_EXPAND_VARGS( INTERNAL_CATCH_TEMPLATE_TEST_CASE( __VA_ARGS__ ) )\n#define TEMPLATE_TEST_CASE_SIG( ... ) INTERNAL_CATCH_EXPAND_VARGS( INTERNAL_CATCH_TEMPLATE_TEST_CASE_SIG( __VA_ARGS__ ) )\n#define TEMPLATE_TEST_CASE_METHOD( className, ... ) INTERNAL_CATCH_EXPAND_VARGS( INTERNAL_CATCH_TEMPLATE_TEST_CASE_METHOD( className, __VA_ARGS__ ) )\n#define TEMPLATE_TEST_CASE_METHOD_SIG( className, ... ) INTERNAL_CATCH_EXPAND_VARGS( INTERNAL_CATCH_TEMPLATE_TEST_CASE_METHOD_SIG( className, __VA_ARGS__ ) )\n#define TEMPLATE_PRODUCT_TEST_CASE( ... ) INTERNAL_CATCH_EXPAND_VARGS( INTERNAL_CATCH_TEMPLATE_PRODUCT_TEST_CASE( __VA_ARGS__ ) )\n#define TEMPLATE_PRODUCT_TEST_CASE_SIG( ... ) INTERNAL_CATCH_EXPAND_VARGS( INTERNAL_CATCH_TEMPLATE_PRODUCT_TEST_CASE_SIG( __VA_ARGS__ ) )\n#define TEMPLATE_PRODUCT_TEST_CASE_METHOD( className, ... ) INTERNAL_CATCH_EXPAND_VARGS( INTERNAL_CATCH_TEMPLATE_PRODUCT_TEST_CASE_METHOD( className, __VA_ARGS__ ) )\n#define TEMPLATE_PRODUCT_TEST_CASE_METHOD_SIG( className, ... ) INTERNAL_CATCH_EXPAND_VARGS( INTERNAL_CATCH_TEMPLATE_PRODUCT_TEST_CASE_METHOD_SIG( className, __VA_ARGS__ ) )\n#define TEMPLATE_LIST_TEST_CASE( ... ) INTERNAL_CATCH_EXPAND_VARGS( INTERNAL_CATCH_TEMPLATE_LIST_TEST_CASE( __VA_ARGS__ ) )\n#define TEMPLATE_LIST_TEST_CASE_METHOD( className, ... ) INTERNAL_CATCH_EXPAND_VARGS( INTERNAL_CATCH_TEMPLATE_LIST_TEST_CASE_METHOD( className, __VA_ARGS__ ) )\n#endif\n\n#if !defined(CATCH_CONFIG_RUNTIME_STATIC_REQUIRE)\n#define STATIC_REQUIRE( ... )       static_assert(   __VA_ARGS__,  #__VA_ARGS__ ); SUCCEED( #__VA_ARGS__ )\n#define STATIC_REQUIRE_FALSE( ... ) static_assert( !(__VA_ARGS__), \"!(\" #__VA_ARGS__ \")\" ); SUCCEED( \"!(\" #__VA_ARGS__ \")\" )\n#else\n#define STATIC_REQUIRE( ... )       REQUIRE( __VA_ARGS__ )\n#define STATIC_REQUIRE_FALSE( ... ) REQUIRE_FALSE( __VA_ARGS__ )\n#endif\n\n#endif\n\n#define CATCH_TRANSLATE_EXCEPTION( signature ) INTERNAL_CATCH_TRANSLATE_EXCEPTION( signature )\n\n// \"BDD-style\" convenience wrappers\n#define SCENARIO( ... ) TEST_CASE( \"Scenario: \" __VA_ARGS__ )\n#define SCENARIO_METHOD( className, ... ) INTERNAL_CATCH_TEST_CASE_METHOD( className, \"Scenario: \" __VA_ARGS__ )\n\n#define GIVEN( desc )     INTERNAL_CATCH_DYNAMIC_SECTION( \"    Given: \" << desc )\n#define AND_GIVEN( desc ) INTERNAL_CATCH_DYNAMIC_SECTION( \"And given: \" << desc )\n#define WHEN( desc )      INTERNAL_CATCH_DYNAMIC_SECTION( \"     When: \" << desc )\n#define AND_WHEN( desc )  INTERNAL_CATCH_DYNAMIC_SECTION( \" And when: \" << desc )\n#define THEN( desc )      INTERNAL_CATCH_DYNAMIC_SECTION( \"     Then: \" << desc )\n#define AND_THEN( desc )  INTERNAL_CATCH_DYNAMIC_SECTION( \"      And: \" << desc )\n\n#if defined(CATCH_CONFIG_ENABLE_BENCHMARKING)\n#define BENCHMARK(...) \\\n    INTERNAL_CATCH_BENCHMARK(INTERNAL_CATCH_UNIQUE_NAME(C_A_T_C_H_B_E_N_C_H_), INTERNAL_CATCH_GET_1_ARG(__VA_ARGS__,,), INTERNAL_CATCH_GET_2_ARG(__VA_ARGS__,,))\n#define BENCHMARK_ADVANCED(name) \\\n    INTERNAL_CATCH_BENCHMARK_ADVANCED(INTERNAL_CATCH_UNIQUE_NAME(C_A_T_C_H_B_E_N_C_H_), name)\n#endif // CATCH_CONFIG_ENABLE_BENCHMARKING\n\nusing Catch::Detail::Approx;\n\n#else // CATCH_CONFIG_DISABLE\n\n//////\n// If this config identifier is defined then all CATCH macros are prefixed with CATCH_\n#ifdef CATCH_CONFIG_PREFIX_ALL\n\n#define CATCH_REQUIRE( ... )        (void)(0)\n#define CATCH_REQUIRE_FALSE( ... )  (void)(0)\n\n#define CATCH_REQUIRE_THROWS( ... ) (void)(0)\n#define CATCH_REQUIRE_THROWS_AS( expr, exceptionType ) (void)(0)\n#define CATCH_REQUIRE_THROWS_WITH( expr, matcher )     (void)(0)\n#if !defined(CATCH_CONFIG_DISABLE_MATCHERS)\n#define CATCH_REQUIRE_THROWS_MATCHES( expr, exceptionType, matcher ) (void)(0)\n#endif// CATCH_CONFIG_DISABLE_MATCHERS\n#define CATCH_REQUIRE_NOTHROW( ... ) (void)(0)\n\n#define CATCH_CHECK( ... )         (void)(0)\n#define CATCH_CHECK_FALSE( ... )   (void)(0)\n#define CATCH_CHECKED_IF( ... )    if (__VA_ARGS__)\n#define CATCH_CHECKED_ELSE( ... )  if (!(__VA_ARGS__))\n#define CATCH_CHECK_NOFAIL( ... )  (void)(0)\n\n#define CATCH_CHECK_THROWS( ... )  (void)(0)\n#define CATCH_CHECK_THROWS_AS( expr, exceptionType ) (void)(0)\n#define CATCH_CHECK_THROWS_WITH( expr, matcher )     (void)(0)\n#if !defined(CATCH_CONFIG_DISABLE_MATCHERS)\n#define CATCH_CHECK_THROWS_MATCHES( expr, exceptionType, matcher ) (void)(0)\n#endif // CATCH_CONFIG_DISABLE_MATCHERS\n#define CATCH_CHECK_NOTHROW( ... ) (void)(0)\n\n#if !defined(CATCH_CONFIG_DISABLE_MATCHERS)\n#define CATCH_CHECK_THAT( arg, matcher )   (void)(0)\n\n#define CATCH_REQUIRE_THAT( arg, matcher ) (void)(0)\n#endif // CATCH_CONFIG_DISABLE_MATCHERS\n\n#define CATCH_INFO( msg )          (void)(0)\n#define CATCH_UNSCOPED_INFO( msg ) (void)(0)\n#define CATCH_WARN( msg )          (void)(0)\n#define CATCH_CAPTURE( msg )       (void)(0)\n\n#define CATCH_TEST_CASE( ... ) INTERNAL_CATCH_TESTCASE_NO_REGISTRATION(INTERNAL_CATCH_UNIQUE_NAME( C_A_T_C_H_T_E_S_T_ ))\n#define CATCH_TEST_CASE_METHOD( className, ... ) INTERNAL_CATCH_TESTCASE_NO_REGISTRATION(INTERNAL_CATCH_UNIQUE_NAME( C_A_T_C_H_T_E_S_T_ ))\n#define CATCH_METHOD_AS_TEST_CASE( method, ... )\n#define CATCH_REGISTER_TEST_CASE( Function, ... ) (void)(0)\n#define CATCH_SECTION( ... )\n#define CATCH_DYNAMIC_SECTION( ... )\n#define CATCH_FAIL( ... ) (void)(0)\n#define CATCH_FAIL_CHECK( ... ) (void)(0)\n#define CATCH_SUCCEED( ... ) (void)(0)\n\n#define CATCH_ANON_TEST_CASE() INTERNAL_CATCH_TESTCASE_NO_REGISTRATION(INTERNAL_CATCH_UNIQUE_NAME( C_A_T_C_H_T_E_S_T_ ))\n\n#ifndef CATCH_CONFIG_TRADITIONAL_MSVC_PREPROCESSOR\n#define CATCH_TEMPLATE_TEST_CASE( ... ) INTERNAL_CATCH_TEMPLATE_TEST_CASE_NO_REGISTRATION(__VA_ARGS__)\n#define CATCH_TEMPLATE_TEST_CASE_SIG( ... ) INTERNAL_CATCH_TEMPLATE_TEST_CASE_SIG_NO_REGISTRATION(__VA_ARGS__)\n#define CATCH_TEMPLATE_TEST_CASE_METHOD( className, ... ) INTERNAL_CATCH_TEMPLATE_TEST_CASE_METHOD_NO_REGISTRATION(className, __VA_ARGS__)\n#define CATCH_TEMPLATE_TEST_CASE_METHOD_SIG( className, ... ) INTERNAL_CATCH_TEMPLATE_TEST_CASE_METHOD_SIG_NO_REGISTRATION(className, __VA_ARGS__ )\n#define CATCH_TEMPLATE_PRODUCT_TEST_CASE( ... ) CATCH_TEMPLATE_TEST_CASE( __VA_ARGS__ )\n#define CATCH_TEMPLATE_PRODUCT_TEST_CASE_SIG( ... ) CATCH_TEMPLATE_TEST_CASE( __VA_ARGS__ )\n#define CATCH_TEMPLATE_PRODUCT_TEST_CASE_METHOD( className, ... ) CATCH_TEMPLATE_TEST_CASE_METHOD( className, __VA_ARGS__ )\n#define CATCH_TEMPLATE_PRODUCT_TEST_CASE_METHOD_SIG( className, ... ) CATCH_TEMPLATE_TEST_CASE_METHOD( className, __VA_ARGS__ )\n#else\n#define CATCH_TEMPLATE_TEST_CASE( ... ) INTERNAL_CATCH_EXPAND_VARGS( INTERNAL_CATCH_TEMPLATE_TEST_CASE_NO_REGISTRATION(__VA_ARGS__) )\n#define CATCH_TEMPLATE_TEST_CASE_SIG( ... ) INTERNAL_CATCH_EXPAND_VARGS( INTERNAL_CATCH_TEMPLATE_TEST_CASE_SIG_NO_REGISTRATION(__VA_ARGS__) )\n#define CATCH_TEMPLATE_TEST_CASE_METHOD( className, ... ) INTERNAL_CATCH_EXPAND_VARGS( INTERNAL_CATCH_TEMPLATE_TEST_CASE_METHOD_NO_REGISTRATION(className, __VA_ARGS__ ) )\n#define CATCH_TEMPLATE_TEST_CASE_METHOD_SIG( className, ... ) INTERNAL_CATCH_EXPAND_VARGS( INTERNAL_CATCH_TEMPLATE_TEST_CASE_METHOD_SIG_NO_REGISTRATION(className, __VA_ARGS__ ) )\n#define CATCH_TEMPLATE_PRODUCT_TEST_CASE( ... ) CATCH_TEMPLATE_TEST_CASE( __VA_ARGS__ )\n#define CATCH_TEMPLATE_PRODUCT_TEST_CASE_SIG( ... ) CATCH_TEMPLATE_TEST_CASE( __VA_ARGS__ )\n#define CATCH_TEMPLATE_PRODUCT_TEST_CASE_METHOD( className, ... ) CATCH_TEMPLATE_TEST_CASE_METHOD( className, __VA_ARGS__ )\n#define CATCH_TEMPLATE_PRODUCT_TEST_CASE_METHOD_SIG( className, ... ) CATCH_TEMPLATE_TEST_CASE_METHOD( className, __VA_ARGS__ )\n#endif\n\n// \"BDD-style\" convenience wrappers\n#define CATCH_SCENARIO( ... ) INTERNAL_CATCH_TESTCASE_NO_REGISTRATION(INTERNAL_CATCH_UNIQUE_NAME( C_A_T_C_H_T_E_S_T_ ))\n#define CATCH_SCENARIO_METHOD( className, ... ) INTERNAL_CATCH_TESTCASE_METHOD_NO_REGISTRATION(INTERNAL_CATCH_UNIQUE_NAME( C_A_T_C_H_T_E_S_T_ ), className )\n#define CATCH_GIVEN( desc )\n#define CATCH_AND_GIVEN( desc )\n#define CATCH_WHEN( desc )\n#define CATCH_AND_WHEN( desc )\n#define CATCH_THEN( desc )\n#define CATCH_AND_THEN( desc )\n\n#define CATCH_STATIC_REQUIRE( ... )       (void)(0)\n#define CATCH_STATIC_REQUIRE_FALSE( ... ) (void)(0)\n\n// If CATCH_CONFIG_PREFIX_ALL is not defined then the CATCH_ prefix is not required\n#else\n\n#define REQUIRE( ... )       (void)(0)\n#define REQUIRE_FALSE( ... ) (void)(0)\n\n#define REQUIRE_THROWS( ... ) (void)(0)\n#define REQUIRE_THROWS_AS( expr, exceptionType ) (void)(0)\n#define REQUIRE_THROWS_WITH( expr, matcher ) (void)(0)\n#if !defined(CATCH_CONFIG_DISABLE_MATCHERS)\n#define REQUIRE_THROWS_MATCHES( expr, exceptionType, matcher ) (void)(0)\n#endif // CATCH_CONFIG_DISABLE_MATCHERS\n#define REQUIRE_NOTHROW( ... ) (void)(0)\n\n#define CHECK( ... ) (void)(0)\n#define CHECK_FALSE( ... ) (void)(0)\n#define CHECKED_IF( ... ) if (__VA_ARGS__)\n#define CHECKED_ELSE( ... ) if (!(__VA_ARGS__))\n#define CHECK_NOFAIL( ... ) (void)(0)\n\n#define CHECK_THROWS( ... )  (void)(0)\n#define CHECK_THROWS_AS( expr, exceptionType ) (void)(0)\n#define CHECK_THROWS_WITH( expr, matcher ) (void)(0)\n#if !defined(CATCH_CONFIG_DISABLE_MATCHERS)\n#define CHECK_THROWS_MATCHES( expr, exceptionType, matcher ) (void)(0)\n#endif // CATCH_CONFIG_DISABLE_MATCHERS\n#define CHECK_NOTHROW( ... ) (void)(0)\n\n#if !defined(CATCH_CONFIG_DISABLE_MATCHERS)\n#define CHECK_THAT( arg, matcher ) (void)(0)\n\n#define REQUIRE_THAT( arg, matcher ) (void)(0)\n#endif // CATCH_CONFIG_DISABLE_MATCHERS\n\n#define INFO( msg ) (void)(0)\n#define UNSCOPED_INFO( msg ) (void)(0)\n#define WARN( msg ) (void)(0)\n#define CAPTURE( ... ) (void)(0)\n\n#define TEST_CASE( ... )  INTERNAL_CATCH_TESTCASE_NO_REGISTRATION(INTERNAL_CATCH_UNIQUE_NAME( C_A_T_C_H_T_E_S_T_ ))\n#define TEST_CASE_METHOD( className, ... ) INTERNAL_CATCH_TESTCASE_NO_REGISTRATION(INTERNAL_CATCH_UNIQUE_NAME( C_A_T_C_H_T_E_S_T_ ))\n#define METHOD_AS_TEST_CASE( method, ... )\n#define REGISTER_TEST_CASE( Function, ... ) (void)(0)\n#define SECTION( ... )\n#define DYNAMIC_SECTION( ... )\n#define FAIL( ... ) (void)(0)\n#define FAIL_CHECK( ... ) (void)(0)\n#define SUCCEED( ... ) (void)(0)\n#define ANON_TEST_CASE() INTERNAL_CATCH_TESTCASE_NO_REGISTRATION(INTERNAL_CATCH_UNIQUE_NAME( C_A_T_C_H_T_E_S_T_ ))\n\n#ifndef CATCH_CONFIG_TRADITIONAL_MSVC_PREPROCESSOR\n#define TEMPLATE_TEST_CASE( ... ) INTERNAL_CATCH_TEMPLATE_TEST_CASE_NO_REGISTRATION(__VA_ARGS__)\n#define TEMPLATE_TEST_CASE_SIG( ... ) INTERNAL_CATCH_TEMPLATE_TEST_CASE_SIG_NO_REGISTRATION(__VA_ARGS__)\n#define TEMPLATE_TEST_CASE_METHOD( className, ... ) INTERNAL_CATCH_TEMPLATE_TEST_CASE_METHOD_NO_REGISTRATION(className, __VA_ARGS__)\n#define TEMPLATE_TEST_CASE_METHOD_SIG( className, ... ) INTERNAL_CATCH_TEMPLATE_TEST_CASE_METHOD_SIG_NO_REGISTRATION(className, __VA_ARGS__ )\n#define TEMPLATE_PRODUCT_TEST_CASE( ... ) TEMPLATE_TEST_CASE( __VA_ARGS__ )\n#define TEMPLATE_PRODUCT_TEST_CASE_SIG( ... ) TEMPLATE_TEST_CASE( __VA_ARGS__ )\n#define TEMPLATE_PRODUCT_TEST_CASE_METHOD( className, ... ) TEMPLATE_TEST_CASE_METHOD( className, __VA_ARGS__ )\n#define TEMPLATE_PRODUCT_TEST_CASE_METHOD_SIG( className, ... ) TEMPLATE_TEST_CASE_METHOD( className, __VA_ARGS__ )\n#else\n#define TEMPLATE_TEST_CASE( ... ) INTERNAL_CATCH_EXPAND_VARGS( INTERNAL_CATCH_TEMPLATE_TEST_CASE_NO_REGISTRATION(__VA_ARGS__) )\n#define TEMPLATE_TEST_CASE_SIG( ... ) INTERNAL_CATCH_EXPAND_VARGS( INTERNAL_CATCH_TEMPLATE_TEST_CASE_SIG_NO_REGISTRATION(__VA_ARGS__) )\n#define TEMPLATE_TEST_CASE_METHOD( className, ... ) INTERNAL_CATCH_EXPAND_VARGS( INTERNAL_CATCH_TEMPLATE_TEST_CASE_METHOD_NO_REGISTRATION(className, __VA_ARGS__ ) )\n#define TEMPLATE_TEST_CASE_METHOD_SIG( className, ... ) INTERNAL_CATCH_EXPAND_VARGS( INTERNAL_CATCH_TEMPLATE_TEST_CASE_METHOD_SIG_NO_REGISTRATION(className, __VA_ARGS__ ) )\n#define TEMPLATE_PRODUCT_TEST_CASE( ... ) TEMPLATE_TEST_CASE( __VA_ARGS__ )\n#define TEMPLATE_PRODUCT_TEST_CASE_SIG( ... ) TEMPLATE_TEST_CASE( __VA_ARGS__ )\n#define TEMPLATE_PRODUCT_TEST_CASE_METHOD( className, ... ) TEMPLATE_TEST_CASE_METHOD( className, __VA_ARGS__ )\n#define TEMPLATE_PRODUCT_TEST_CASE_METHOD_SIG( className, ... ) TEMPLATE_TEST_CASE_METHOD( className, __VA_ARGS__ )\n#endif\n\n#define STATIC_REQUIRE( ... )       (void)(0)\n#define STATIC_REQUIRE_FALSE( ... ) (void)(0)\n\n#endif\n\n#define CATCH_TRANSLATE_EXCEPTION( signature ) INTERNAL_CATCH_TRANSLATE_EXCEPTION_NO_REG( INTERNAL_CATCH_UNIQUE_NAME( catch_internal_ExceptionTranslator ), signature )\n\n// \"BDD-style\" convenience wrappers\n#define SCENARIO( ... ) INTERNAL_CATCH_TESTCASE_NO_REGISTRATION(INTERNAL_CATCH_UNIQUE_NAME( C_A_T_C_H_T_E_S_T_ ) )\n#define SCENARIO_METHOD( className, ... ) INTERNAL_CATCH_TESTCASE_METHOD_NO_REGISTRATION(INTERNAL_CATCH_UNIQUE_NAME( C_A_T_C_H_T_E_S_T_ ), className )\n\n#define GIVEN( desc )\n#define AND_GIVEN( desc )\n#define WHEN( desc )\n#define AND_WHEN( desc )\n#define THEN( desc )\n#define AND_THEN( desc )\n\nusing Catch::Detail::Approx;\n\n#endif\n\n#endif // ! CATCH_CONFIG_IMPL_ONLY\n\n// start catch_reenable_warnings.h\n\n\n#ifdef __clang__\n#    ifdef __ICC // icpc defines the __clang__ macro\n#        pragma warning(pop)\n#    else\n#        pragma clang diagnostic pop\n#    endif\n#elif defined __GNUC__\n#    pragma GCC diagnostic pop\n#endif\n\n// end catch_reenable_warnings.h\n// end catch.hpp\n#endif // TWOBLUECUBES_SINGLE_INCLUDE_CATCH_HPP_INCLUDED\n\n"
  },
  {
    "path": "idf_component.yml",
    "content": "version: \"7.4.2\"\ndescription: >-\n  A simple and efficient JSON library for embedded C++.\n  ★ 6953 stars on GitHub!\n  Supports serialization, deserialization, MessagePack, streams, filtering, and more.\n  Fully tested and documented.\nurl: https://arduinojson.org/\nfiles:\n  exclude:\n    - \"**/.vs/**/*\"\n    - \".devcontainer/**/*\"\n    - \"examples/**/*\"\n    - \"extras/**/*\"\n"
  },
  {
    "path": "keywords.txt",
    "content": "# Free functions\ndeserializeJson\tKEYWORD2\ndeserializeMsgPack\tKEYWORD2\nserialized\tKEYWORD2\nserializeJson\tKEYWORD2\nserializeJsonPretty\tKEYWORD2\nserializeMsgPack\tKEYWORD2\nmeasureJson\tKEYWORD2\nmeasureJsonPretty\tKEYWORD2\nmeasureMsgPack\tKEYWORD2\n\n# Methods\nadd\tKEYWORD2\nas\tKEYWORD2\nget\tKEYWORD2\nset\tKEYWORD2\nto\tKEYWORD2\n\n# Type names\nDeserializationError\tKEYWORD1\tDATA_TYPE\nJsonDocument\tKEYWORD1\tDATA_TYPE\nJsonArray\tKEYWORD1\tDATA_TYPE\nJsonArrayConst\tKEYWORD1\tDATA_TYPE\nJsonDocument\tKEYWORD1\tDATA_TYPE\nJsonFloat\tKEYWORD1\tDATA_TYPE\nJsonInteger\tKEYWORD1\tDATA_TYPE\nJsonObject\tKEYWORD1\tDATA_TYPE\nJsonObjectConst\tKEYWORD1\tDATA_TYPE\nJsonString\tKEYWORD1\tDATA_TYPE\nJsonUInt\tKEYWORD1\tDATA_TYPE\nJsonVariant\tKEYWORD1\tDATA_TYPE\nJsonVariantConst\tKEYWORD1\tDATA_TYPE\n"
  },
  {
    "path": "library.json",
    "content": "{\n  \"name\": \"ArduinoJson\",\n  \"keywords\": \"json, rest, http, web\",\n  \"description\": \"A simple and efficient JSON library for embedded C++. ⭐ 6953 stars on GitHub! Supports serialization, deserialization, MessagePack, streams, filtering, and more. Fully tested and documented.\",\n  \"homepage\": \"https://arduinojson.org/?utm_source=meta&utm_medium=library.json\",\n  \"repository\": {\n    \"type\": \"git\",\n    \"url\": \"https://github.com/bblanchon/ArduinoJson.git\"\n  },\n  \"version\": \"7.4.2\",\n  \"authors\": {\n    \"name\": \"Benoit Blanchon\",\n    \"url\": \"https://blog.benoitblanchon.fr\"\n  },\n  \"export\": {\n    \"include\": [\"src\", \"examples\", \"LICENSE.txt\", \"ArduinoJson.h\"]\n  },\n  \"frameworks\": \"*\",\n  \"platforms\": \"*\",\n  \"build\": {\n    \"libArchive\": false\n  }\n}\n"
  },
  {
    "path": "library.properties",
    "content": "name=ArduinoJson\nversion=7.4.2\nauthor=Benoit Blanchon <blog.benoitblanchon.fr>\nmaintainer=Benoit Blanchon <blog.benoitblanchon.fr>\nsentence=A simple and efficient JSON library for embedded C++.\nparagraph=⭐ 6953 stars on GitHub! Supports serialization, deserialization, MessagePack, streams, filtering, and more. Fully tested and documented.\ncategory=Data Processing\nurl=https://arduinojson.org/?utm_source=meta&utm_medium=library.properties\narchitectures=*\nrepository=https://github.com/bblanchon/ArduinoJson.git\nlicense=MIT\n"
  },
  {
    "path": "src/ArduinoJson/Array/ArrayImpl.hpp",
    "content": "// ArduinoJson - https://arduinojson.org\n// Copyright © 2014-2025, Benoit BLANCHON\n// MIT License\n\n#pragma once\n\n#include <ArduinoJson/Variant/VariantCompare.hpp>\n#include <ArduinoJson/Variant/VariantImpl.hpp>\n\nARDUINOJSON_BEGIN_PRIVATE_NAMESPACE\n\ninline VariantImpl::iterator VariantImpl::at(size_t index) const {\n  if (!isArray())\n    return iterator();\n\n  auto it = createIterator();\n  while (!it.done() && index) {\n    it.move(resources_);\n    --index;\n  }\n  return it;\n}\n\ninline VariantData* VariantImpl::addNewElement(VariantData* data,\n                                               ResourceManager* resources) {\n  ARDUINOJSON_ASSERT(data != nullptr);\n  ARDUINOJSON_ASSERT(data->isArray());\n  ARDUINOJSON_ASSERT(resources != nullptr);\n\n  auto slot = resources->allocVariant();\n  if (!slot)\n    return nullptr;\n  addElement(slot, data, resources);\n  return slot.ptr();\n}\n\ninline VariantData* VariantImpl::getOrAddElement(size_t index) {\n  auto it = createIterator();\n  while (!it.done() && index > 0) {\n    it.move(resources_);\n    index--;\n  }\n  if (it.done())\n    index++;\n  VariantData* element = it.data();\n  while (index > 0) {\n    element = addNewElement();\n    if (!element)\n      return nullptr;\n    index--;\n  }\n  return element;\n}\n\ninline VariantData* VariantImpl::getElement(size_t index) const {\n  return at(index).data();\n}\n\ninline void VariantImpl::removeElement(size_t index) {\n  removeElement(at(index));\n}\n\n// Returns the size (in bytes) of an array with n elements.\nconstexpr size_t sizeofArray(size_t n) {\n  return n * sizeof(VariantData);\n}\n\nARDUINOJSON_END_PRIVATE_NAMESPACE\n"
  },
  {
    "path": "src/ArduinoJson/Array/ElementProxy.hpp",
    "content": "// ArduinoJson - https://arduinojson.org\n// Copyright © 2014-2025, Benoit BLANCHON\n// MIT License\n\n#pragma once\n\n#include <ArduinoJson/Variant/VariantRefBase.hpp>\n\nARDUINOJSON_BEGIN_PRIVATE_NAMESPACE\n\n// A proxy class to get or set an element of an array.\n// https://arduinojson.org/v7/api/jsonarray/subscript/\ntemplate <typename TUpstream>\nclass ElementProxy : public VariantRefBase<ElementProxy<TUpstream>>,\n                     public VariantOperators<ElementProxy<TUpstream>> {\n  friend class VariantAttorney;\n\n  friend class VariantRefBase<ElementProxy<TUpstream>>;\n\n  template <typename, typename>\n  friend class MemberProxy;\n\n  template <typename>\n  friend class ElementProxy;\n\n public:\n  ElementProxy(TUpstream upstream, size_t index)\n      : upstream_(upstream), index_(index) {}\n\n  ElementProxy& operator=(const ElementProxy& src) {\n    this->set(src);\n    return *this;\n  }\n\n  template <typename T>\n  ElementProxy& operator=(const T& src) {\n    this->set(src);\n    return *this;\n  }\n\n  template <typename T>\n  ElementProxy& operator=(T* src) {\n    this->set(src);\n    return *this;\n  }\n\n private:\n  // clang-format off\n  ElementProxy(const ElementProxy& src)  // Error here? See https://arduinojson.org/v7/proxy-non-copyable/\n      : upstream_(src.upstream_), index_(src.index_) {}\n  // clang-format on\n\n  ResourceManager* getResourceManager() const {\n    return VariantAttorney::getResourceManager(upstream_);\n  }\n\n  FORCE_INLINE VariantData* getData() const {\n    return VariantAttorney::getVariantImpl(upstream_).getElement(index_);\n  }\n\n  VariantData* getOrCreateData() const {\n    auto data = VariantAttorney::getOrCreateData(upstream_);\n    auto resources = VariantAttorney::getResourceManager(upstream_);\n    if (data && data->type == VariantType::Null)\n      data->toArray();\n    return VariantImpl(data, resources).getOrAddElement(index_);\n  }\n\n  TUpstream upstream_;\n  size_t index_;\n};\n\nARDUINOJSON_END_PRIVATE_NAMESPACE\n"
  },
  {
    "path": "src/ArduinoJson/Array/JsonArray.hpp",
    "content": "// ArduinoJson - https://arduinojson.org\n// Copyright © 2014-2025, Benoit BLANCHON\n// MIT License\n\n#pragma once\n\n#include <ArduinoJson/Array/ElementProxy.hpp>\n#include <ArduinoJson/Array/JsonArrayConst.hpp>\n\nARDUINOJSON_BEGIN_PUBLIC_NAMESPACE\n\nclass JsonObject;\n\n// A reference to an array in a JsonDocument\n// https://arduinojson.org/v7/api/jsonarray/\nclass JsonArray : public detail::VariantOperators<JsonArray> {\n  friend class detail::VariantAttorney;\n\n public:\n  using iterator = JsonArrayIterator;\n\n  // Constructs an unbound reference.\n  JsonArray() {}\n\n  // INTERNAL USE ONLY\n  JsonArray(detail::VariantData* data, detail::ResourceManager* resources)\n      : impl_(data, resources) {}\n\n  // INTERNAL USE ONLY\n  JsonArray(const detail::VariantImpl& impl) : impl_(impl) {}\n\n  // Returns a JsonVariant pointing to the array.\n  // https://arduinojson.org/v7/api/jsonvariant/\n  operator JsonVariant() {\n    return JsonVariant(getData(), getResourceManager());\n  }\n\n  // Returns a read-only reference to the array.\n  // https://arduinojson.org/v7/api/jsonarrayconst/\n  operator JsonArrayConst() const {\n    return JsonArrayConst(getData(), getResourceManager());\n  }\n\n  // Appends a new (empty) element to the array.\n  // Returns a reference to the new element.\n  // https://arduinojson.org/v7/api/jsonarray/add/\n  template <typename T, detail::enable_if_t<\n                            !detail::is_same<T, JsonVariant>::value, int> = 0>\n  T add() const {\n    return add<JsonVariant>().to<T>();\n  }\n\n  // Appends a new (null) element to the array.\n  // Returns a reference to the new element.\n  // https://arduinojson.org/v7/api/jsonarray/add/\n  template <typename T, detail::enable_if_t<\n                            detail::is_same<T, JsonVariant>::value, int> = 0>\n  JsonVariant add() const {\n    return JsonVariant(impl_.addNewElement(), impl_.resources());\n  }\n\n  // Appends a value to the array.\n  // https://arduinojson.org/v7/api/jsonarray/add/\n  template <typename T>\n  bool add(const T& value) const {\n    if (!impl_.isArray())\n      return false;\n    return addValue(value, impl_.data(), impl_.resources());\n  }\n\n  // Appends a value to the array.\n  // https://arduinojson.org/v7/api/jsonarray/add/\n  template <typename T,\n            detail::enable_if_t<!detail::is_const<T>::value, int> = 0>\n  bool add(T* value) const {\n    if (!impl_.isArray())\n      return false;\n    return addValue(value, impl_.data(), impl_.resources());\n  }\n\n  // Returns an iterator to the first element of the array.\n  // https://arduinojson.org/v7/api/jsonarray/begin/\n  iterator begin() const {\n    return iterator(impl_.createIterator(), impl_.resources());\n  }\n\n  // Returns an iterator following the last element of the array.\n  // https://arduinojson.org/v7/api/jsonarray/end/\n  iterator end() const {\n    return iterator();\n  }\n\n  // Copies an array.\n  // https://arduinojson.org/v7/api/jsonarray/set/\n  bool set(JsonArrayConst src) const {\n    clear();\n    for (auto element : src) {\n      if (!add(element))\n        return false;\n    }\n\n    return true;\n  }\n\n  // Removes the element at the specified iterator.\n  // https://arduinojson.org/v7/api/jsonarray/remove/\n  void remove(iterator it) const {\n    impl_.removeElement(it.iterator_);\n  }\n\n  // Removes the element at the specified index.\n  // https://arduinojson.org/v7/api/jsonarray/remove/\n  void remove(size_t index) const {\n    impl_.removeElement(index);\n  }\n\n  // Removes the element at the specified index.\n  // https://arduinojson.org/v7/api/jsonarray/remove/\n  template <typename TVariant,\n            detail::enable_if_t<detail::IsVariant<TVariant>::value, int> = 0>\n  void remove(const TVariant& variant) const {\n    if (variant.template is<size_t>())\n      remove(variant.template as<size_t>());\n  }\n\n  // Removes all the elements of the array.\n  // https://arduinojson.org/v7/api/jsonarray/clear/\n  void clear() const {\n    impl_.empty();\n  }\n\n  // Gets or sets the element at the specified index.\n  // https://arduinojson.org/v7/api/jsonarray/subscript/\n  template <typename T,\n            detail::enable_if_t<detail::is_integral<T>::value, int> = 0>\n  detail::ElementProxy<JsonArray> operator[](T index) const {\n    return {*this, size_t(index)};\n  }\n\n  // Gets or sets the element at the specified index.\n  // https://arduinojson.org/v7/api/jsonarray/subscript/\n  template <typename TVariant,\n            detail::enable_if_t<detail::IsVariant<TVariant>::value, int> = 0>\n  detail::ElementProxy<JsonArray> operator[](const TVariant& variant) const {\n    if (variant.template is<size_t>())\n      return {*this, variant.template as<size_t>()};\n    else\n      return {*this, size_t(-1)};\n  }\n\n  operator JsonVariantConst() const {\n    return JsonVariantConst(getData(), getResourceManager());\n  }\n\n  // Returns true if the reference is unbound.\n  // https://arduinojson.org/v7/api/jsonarray/isnull/\n  bool isNull() const {\n    return impl_.isNull();\n  }\n\n  // Returns true if the reference is bound.\n  // https://arduinojson.org/v7/api/jsonarray/isnull/\n  operator bool() const {\n    return !isNull();\n  }\n\n  // Returns the depth (nesting level) of the array.\n  // https://arduinojson.org/v7/api/jsonarray/nesting/\n  size_t nesting() const {\n    return impl_.nesting();\n  }\n\n  // Returns the number of elements in the array.\n  // https://arduinojson.org/v7/api/jsonarray/size/\n  size_t size() const {\n    return impl_.size();\n  }\n\n  // DEPRECATED: use add<JsonVariant>() instead\n  ARDUINOJSON_DEPRECATED(\"use add<JsonVariant>() instead\")\n  JsonVariant add() const {\n    return add<JsonVariant>();\n  }\n\n  // DEPRECATED: use add<JsonArray>() instead\n  ARDUINOJSON_DEPRECATED(\"use add<JsonArray>() instead\")\n  JsonArray createNestedArray() const {\n    return add<JsonArray>();\n  }\n\n  // DEPRECATED: use add<JsonObject>() instead\n  ARDUINOJSON_DEPRECATED(\"use add<JsonObject>() instead\")\n  JsonObject createNestedObject() const;\n\n  // DEPRECATED: always returns zero\n  ARDUINOJSON_DEPRECATED(\"always returns zero\")\n  size_t memoryUsage() const {\n    return 0;\n  }\n\n private:\n  detail::ResourceManager* getResourceManager() const {\n    return impl_.resources();\n  }\n\n  detail::VariantData* getData() const {\n    return impl_.data();\n  }\n\n  detail::VariantData* getOrCreateData() const {\n    return impl_.data();\n  }\n\n  // HACK: this function has been pulled out of VariantImpl to avoid the\n  // circular dependency between VariantImpl and JsonVariant\n  template <typename T>\n  static bool addValue(const T& value, detail::VariantData* data,\n                       detail::ResourceManager* resources) {\n    ARDUINOJSON_ASSERT(data != nullptr);\n    ARDUINOJSON_ASSERT(data->isArray());\n    ARDUINOJSON_ASSERT(resources != nullptr);\n\n    auto slot = resources->allocVariant();\n    if (!slot)\n      return false;\n\n    if (!JsonVariant(slot.ptr(), resources).set(value)) {\n      detail::VariantImpl::freeVariant(slot, resources);\n      return false;\n    }\n\n    detail::VariantImpl::addElement(slot, data, resources);\n    return true;\n  }\n\n  mutable detail::VariantImpl impl_;\n};\n\nARDUINOJSON_END_PUBLIC_NAMESPACE\n"
  },
  {
    "path": "src/ArduinoJson/Array/JsonArrayConst.hpp",
    "content": "// ArduinoJson - https://arduinojson.org\n// Copyright © 2014-2025, Benoit BLANCHON\n// MIT License\n\n#pragma once\n\n#include <ArduinoJson/Array/JsonArrayIterator.hpp>\n#include <ArduinoJson/Variant/VariantAttorney.hpp>\n#include <ArduinoJson/Variant/VariantData.hpp>\n\nARDUINOJSON_BEGIN_PUBLIC_NAMESPACE\n\nclass JsonObject;\n\n// A read-only reference to an array in a JsonDocument\n// https://arduinojson.org/v7/api/jsonarrayconst/\nclass JsonArrayConst : public detail::VariantOperators<JsonArrayConst> {\n  friend class JsonArray;\n  friend class detail::VariantAttorney;\n\n public:\n  using iterator = JsonArrayConstIterator;\n\n  // Returns an iterator to the first element of the array.\n  // https://arduinojson.org/v7/api/jsonarrayconst/begin/\n  iterator begin() const {\n    return iterator(impl_.createIterator(), impl_.resources());\n  }\n\n  // Returns an iterator to the element following the last element of the array.\n  // https://arduinojson.org/v7/api/jsonarrayconst/end/\n  iterator end() const {\n    return iterator();\n  }\n\n  // Creates an unbound reference.\n  JsonArrayConst() {}\n\n  // INTERNAL USE ONLY\n  JsonArrayConst(detail::VariantData* data, detail::ResourceManager* resources)\n      : impl_(data, resources) {}\n\n  // INTERNAL USE ONLY\n  JsonArrayConst(const detail::VariantImpl& impl) : impl_(impl) {}\n\n  // Returns the element at the specified index.\n  // https://arduinojson.org/v7/api/jsonarrayconst/subscript/\n  template <typename T,\n            detail::enable_if_t<detail::is_integral<T>::value, int> = 0>\n  JsonVariantConst operator[](T index) const {\n    return JsonVariantConst(impl_.getElement(size_t(index)), impl_.resources());\n  }\n\n  // Returns the element at the specified index.\n  // https://arduinojson.org/v7/api/jsonarrayconst/subscript/\n  template <typename TVariant,\n            detail::enable_if_t<detail::IsVariant<TVariant>::value, int> = 0>\n  JsonVariantConst operator[](const TVariant& variant) const {\n    if (variant.template is<size_t>())\n      return operator[](variant.template as<size_t>());\n    else\n      return JsonVariantConst();\n  }\n\n  operator JsonVariantConst() const {\n    return JsonVariantConst(impl_.data(), impl_.resources());\n  }\n\n  // Returns true if the reference is unbound.\n  // https://arduinojson.org/v7/api/jsonarrayconst/isnull/\n  bool isNull() const {\n    return impl_.isNull();\n  }\n\n  // Returns true if the reference is bound.\n  // https://arduinojson.org/v7/api/jsonarrayconst/isnull/\n  operator bool() const {\n    return !isNull();\n  }\n\n  // Returns the depth (nesting level) of the array.\n  // https://arduinojson.org/v7/api/jsonarrayconst/nesting/\n  size_t nesting() const {\n    return impl_.nesting();\n  }\n\n  // Returns the number of elements in the array.\n  // https://arduinojson.org/v7/api/jsonarrayconst/size/\n  size_t size() const {\n    return impl_.size();\n  }\n\n  // DEPRECATED: always returns zero\n  ARDUINOJSON_DEPRECATED(\"always returns zero\")\n  size_t memoryUsage() const {\n    return 0;\n  }\n\n private:\n  const detail::VariantData* getData() const {\n    return impl_.data();\n  }\n\n  detail::VariantImpl impl_;\n};\n\n// Compares the content of two arrays.\n// Returns true if the two arrays are equal.\ninline bool operator==(JsonArrayConst lhs, JsonArrayConst rhs) {\n  if (!lhs && !rhs)\n    return true;\n  if (!lhs || !rhs)\n    return false;\n\n  auto a = lhs.begin();\n  auto b = rhs.begin();\n\n  for (;;) {\n    if (a == b)  // same pointer or both null\n      return true;\n    if (a == lhs.end() || b == rhs.end())\n      return false;\n    if (*a != *b)\n      return false;\n    ++a;\n    ++b;\n  }\n}\n\nARDUINOJSON_END_PUBLIC_NAMESPACE\n"
  },
  {
    "path": "src/ArduinoJson/Array/JsonArrayIterator.hpp",
    "content": "// ArduinoJson - https://arduinojson.org\n// Copyright © 2014-2025, Benoit BLANCHON\n// MIT License\n\n#pragma once\n\n#include <ArduinoJson/Variant/JsonVariant.hpp>\n\nARDUINOJSON_BEGIN_PUBLIC_NAMESPACE\n\ntemplate <typename T>\nclass Ptr {\n public:\n  Ptr(T value) : value_(value) {}\n\n  T* operator->() {\n    return &value_;\n  }\n\n  T& operator*() {\n    return value_;\n  }\n\n private:\n  T value_;\n};\n\nclass JsonArrayIterator {\n  friend class JsonArray;\n\n public:\n  JsonArrayIterator() {}\n  explicit JsonArrayIterator(detail::CollectionIterator iterator,\n                             detail::ResourceManager* resources)\n      : iterator_(iterator), resources_(resources) {}\n\n  JsonVariant operator*() {\n    return JsonVariant(iterator_.data(), resources_);\n  }\n  Ptr<JsonVariant> operator->() {\n    return operator*();\n  }\n\n  bool operator==(const JsonArrayIterator& other) const {\n    return iterator_ == other.iterator_;\n  }\n\n  bool operator!=(const JsonArrayIterator& other) const {\n    return iterator_ != other.iterator_;\n  }\n\n  JsonArrayIterator& operator++() {\n    iterator_.move(resources_);\n    return *this;\n  }\n\n private:\n  detail::CollectionIterator iterator_;\n  detail::ResourceManager* resources_;\n};\n\nclass JsonArrayConstIterator {\n  friend class JsonArray;\n\n public:\n  JsonArrayConstIterator() {}\n  explicit JsonArrayConstIterator(detail::CollectionIterator iterator,\n                                  detail::ResourceManager* resources)\n      : iterator_(iterator), resources_(resources) {}\n\n  JsonVariantConst operator*() const {\n    return JsonVariantConst(iterator_.data(), resources_);\n  }\n  Ptr<JsonVariantConst> operator->() {\n    return operator*();\n  }\n\n  bool operator==(const JsonArrayConstIterator& other) const {\n    return iterator_ == other.iterator_;\n  }\n\n  bool operator!=(const JsonArrayConstIterator& other) const {\n    return iterator_ != other.iterator_;\n  }\n\n  JsonArrayConstIterator& operator++() {\n    iterator_.move(resources_);\n    return *this;\n  }\n\n private:\n  mutable detail::CollectionIterator iterator_;\n  mutable detail::ResourceManager* resources_;\n};\n\nARDUINOJSON_END_PUBLIC_NAMESPACE\n"
  },
  {
    "path": "src/ArduinoJson/Array/Utilities.hpp",
    "content": "// ArduinoJson - https://arduinojson.org\n// Copyright © 2014-2025, Benoit BLANCHON\n// MIT License\n\n#pragma once\n\n#include <ArduinoJson/Array/JsonArray.hpp>\n#include <ArduinoJson/Document/JsonDocument.hpp>\n\nARDUINOJSON_BEGIN_PUBLIC_NAMESPACE\n\n// Copies a value to a JsonVariant.\n// This is a degenerated form of copyArray() to stop the recursion.\ntemplate <typename T, detail::enable_if_t<!detail::is_array<T>::value, int> = 0>\ninline bool copyArray(const T& src, JsonVariant dst) {\n  return dst.set(src);\n}\n\n// Copies values from an array to a JsonArray or a JsonVariant.\n// https://arduinojson.org/v7/api/misc/copyarray/\ntemplate <typename T, size_t N, typename TDestination,\n          detail::enable_if_t<\n              !detail::is_base_of<JsonDocument, TDestination>::value, int> = 0>\ninline bool copyArray(T (&src)[N], const TDestination& dst) {\n  return copyArray(src, N, dst);\n}\n\n// Copies values from an array to a JsonArray or a JsonVariant.\n// https://arduinojson.org/v7/api/misc/copyarray/\ntemplate <typename T, typename TDestination,\n          detail::enable_if_t<\n              !detail::is_base_of<JsonDocument, TDestination>::value, int> = 0>\ninline bool copyArray(const T* src, size_t len, const TDestination& dst) {\n  bool ok = true;\n  for (size_t i = 0; i < len; i++) {\n    ok &= copyArray(src[i], dst.template add<JsonVariant>());\n  }\n  return ok;\n}\n\n// Copies a string to a JsonVariant.\n// This is a degenerated form of copyArray() to handle strings.\ntemplate <typename TDestination>\ninline bool copyArray(const char* src, size_t, const TDestination& dst) {\n  return dst.set(src);\n}\n\n// Copies values from an array to a JsonDocument.\n// https://arduinojson.org/v7/api/misc/copyarray/\ntemplate <typename T>\ninline bool copyArray(const T& src, JsonDocument& dst) {\n  return copyArray(src, dst.to<JsonArray>());\n}\n\n// Copies an array to a JsonDocument.\n// https://arduinojson.org/v7/api/misc/copyarray/\ntemplate <typename T>\ninline bool copyArray(const T* src, size_t len, JsonDocument& dst) {\n  return copyArray(src, len, dst.to<JsonArray>());\n}\n\n// Copies a value from a JsonVariant.\n// This is a degenerated form of copyArray() to stop the recursion.\ntemplate <typename T, detail::enable_if_t<!detail::is_array<T>::value, int> = 0>\ninline size_t copyArray(JsonVariantConst src, T& dst) {\n  dst = src.as<T>();\n  return 1;\n}\n\n// Copies values from a JsonArray or JsonVariant to an array.\n// https://arduinojson.org/v7/api/misc/copyarray/\ntemplate <typename T, size_t N>\ninline size_t copyArray(JsonArrayConst src, T (&dst)[N]) {\n  return copyArray(src, dst, N);\n}\n\n// Copies values from a JsonArray or JsonVariant to an array.\n// https://arduinojson.org/v7/api/misc/copyarray/\ntemplate <typename T>\ninline size_t copyArray(JsonArrayConst src, T* dst, size_t len) {\n  size_t i = 0;\n  for (JsonArrayConst::iterator it = src.begin(); it != src.end() && i < len;\n       ++it)\n    copyArray(*it, dst[i++]);\n  return i;\n}\n\n// Copies a string from a JsonVariant.\n// This is a degenerated form of copyArray() to handle strings.\ntemplate <size_t N>\ninline size_t copyArray(JsonVariantConst src, char (&dst)[N]) {\n  JsonString s = src;\n  size_t len = N - 1;\n  if (len > s.size())\n    len = s.size();\n  memcpy(dst, s.c_str(), len);\n  dst[len] = 0;\n  return 1;\n}\n\n// Copies values from a JsonDocument to an array.\n// https://arduinojson.org/v7/api/misc/copyarray/\ntemplate <\n    typename TSource, typename T,\n    detail::enable_if_t<detail::is_array<T>::value &&\n                            detail::is_base_of<JsonDocument, TSource>::value,\n                        int> = 0>\ninline size_t copyArray(const TSource& src, T& dst) {\n  return copyArray(src.template as<JsonArrayConst>(), dst);\n}\n\nARDUINOJSON_END_PUBLIC_NAMESPACE\n"
  },
  {
    "path": "src/ArduinoJson/Collection/CollectionImpl.hpp",
    "content": "// ArduinoJson - https://arduinojson.org\n// Copyright © 2014-2025, Benoit BLANCHON\n// MIT License\n\n#pragma once\n\n#include <ArduinoJson/Variant/VariantImpl.hpp>\n\nARDUINOJSON_BEGIN_PRIVATE_NAMESPACE\n\ninline void CollectionIterator::move(const ResourceManager* resources) {\n  ARDUINOJSON_ASSERT(slot_);\n  auto nextId = slot_->next;\n  slot_ = resources->getVariant(nextId);\n  currentId_ = nextId;\n}\n\ninline VariantImpl::iterator VariantImpl::createIterator(\n    VariantData* data, ResourceManager* resources) {\n  ARDUINOJSON_ASSERT(data != nullptr);\n  ARDUINOJSON_ASSERT(data->isCollection());\n  ARDUINOJSON_ASSERT(resources != nullptr);\n  auto head = data->content.asCollection.head;\n  return iterator(resources->getVariant(head), head);\n}\n\ninline void VariantImpl::addElement(Slot<VariantData> slot, VariantData* data,\n                                    ResourceManager* resources) {\n  ARDUINOJSON_ASSERT(data != nullptr);\n  ARDUINOJSON_ASSERT(data->isCollection());\n  ARDUINOJSON_ASSERT(resources != nullptr);\n\n  auto coll = &data->content.asCollection;\n\n  if (coll->tail != NULL_SLOT) {\n    auto tail = resources->getVariant(coll->tail);\n    tail->next = slot.id();\n    coll->tail = slot.id();\n  } else {\n    coll->head = slot.id();\n    coll->tail = slot.id();\n  }\n}\n\ninline void VariantImpl::appendPair(Slot<VariantData> key,\n                                    Slot<VariantData> value, VariantData* data,\n                                    ResourceManager* resources) {\n  ARDUINOJSON_ASSERT(data != nullptr);\n  ARDUINOJSON_ASSERT(resources != nullptr);\n\n  key->next = value.id();\n\n  auto coll = &data->content.asCollection;\n\n  if (coll->tail != NULL_SLOT) {\n    auto tail = resources->getVariant(coll->tail);\n    tail->next = key.id();\n    coll->tail = value.id();\n  } else {\n    coll->head = key.id();\n    coll->tail = value.id();\n  }\n}\n\ninline void VariantImpl::empty(VariantData* data, ResourceManager* resources) {\n  ARDUINOJSON_ASSERT(data != nullptr);\n  ARDUINOJSON_ASSERT(data->isCollection());\n  ARDUINOJSON_ASSERT(resources != nullptr);\n\n  auto coll = &data->content.asCollection;\n\n  auto next = coll->head;\n  while (next != NULL_SLOT) {\n    auto currId = next;\n    auto slot = resources->getVariant(next);\n    next = slot->next;\n    freeVariant({slot, currId}, resources);\n  }\n\n  coll->head = NULL_SLOT;\n  coll->tail = NULL_SLOT;\n}\n\ninline Slot<VariantData> VariantImpl::getPreviousSlot(\n    VariantData* target) const {\n  ARDUINOJSON_ASSERT(data_ != nullptr);\n  ARDUINOJSON_ASSERT(data_->isCollection());\n  ARDUINOJSON_ASSERT(resources_ != nullptr);\n\n  auto prev = Slot<VariantData>();\n  auto currentId = data_->content.asCollection.head;\n  while (currentId != NULL_SLOT) {\n    auto currentSlot = resources_->getVariant(currentId);\n    if (currentSlot == target)\n      break;\n    prev = Slot<VariantData>(currentSlot, currentId);\n    currentId = currentSlot->next;\n  }\n  return prev;\n}\n\ninline void VariantImpl::removeOne(iterator it) {\n  if (it.done())\n    return;\n  auto curr = it.slot_;\n  auto prev = getPreviousSlot(curr);\n  auto next = curr->next;\n  auto coll = &data_->content.asCollection;\n  if (prev)\n    prev->next = next;\n  else\n    coll->head = next;\n  if (next == NULL_SLOT)\n    coll->tail = prev.id();\n  freeVariant({it.slot_, it.currentId_}, resources_);\n}\n\ninline void VariantImpl::removePair(iterator it) {\n  if (it.done())\n    return;\n\n  auto keySlot = it.slot_;\n\n  auto valueId = keySlot->next;\n  auto valueSlot = resources_->getVariant(valueId);\n\n  // remove value slot\n  keySlot->next = valueSlot->next;\n  freeVariant({valueSlot, valueId}, resources_);\n\n  // remove key slot\n  removeOne(it);\n}\n\ninline size_t VariantImpl::nesting() const {\n  if (!data_ || !data_->isCollection())\n    return 0;\n  size_t maxChildNesting = 0;\n  for (auto it = createIterator(); !it.done(); it.move(resources_)) {\n    size_t childNesting = VariantImpl(it.data(), resources_).nesting();\n    if (childNesting > maxChildNesting)\n      maxChildNesting = childNesting;\n  }\n  return maxChildNesting + 1;\n}\n\nARDUINOJSON_END_PRIVATE_NAMESPACE\n"
  },
  {
    "path": "src/ArduinoJson/Collection/CollectionIterator.hpp",
    "content": "// ArduinoJson - https://arduinojson.org\n// Copyright © 2014-2025, Benoit BLANCHON\n// MIT License\n\n#pragma once\n\n#include <ArduinoJson/Namespace.hpp>\n#include <ArduinoJson/Polyfills/assert.hpp>\n\n#include <stddef.h>  // size_t\n\nARDUINOJSON_BEGIN_PRIVATE_NAMESPACE\n\nstruct VariantData;\nclass ResourceManager;\n\nclass CollectionIterator {\n  friend class VariantImpl;\n\n public:\n  CollectionIterator() : slot_(nullptr), currentId_(NULL_SLOT) {}\n\n  void move(const ResourceManager* resources);\n\n  bool done() const {\n    return slot_ == nullptr;\n  }\n\n  bool operator==(const CollectionIterator& other) const {\n    return slot_ == other.slot_;\n  }\n\n  bool operator!=(const CollectionIterator& other) const {\n    return slot_ != other.slot_;\n  }\n\n  VariantData* operator->() {\n    ARDUINOJSON_ASSERT(slot_ != nullptr);\n    return data();\n  }\n\n  VariantData& operator*() {\n    ARDUINOJSON_ASSERT(slot_ != nullptr);\n    return *data();\n  }\n\n  const VariantData& operator*() const {\n    ARDUINOJSON_ASSERT(slot_ != nullptr);\n    return *data();\n  }\n\n  VariantData* data() {\n    return slot_;\n  }\n\n  const VariantData* data() const {\n    return slot_;\n  }\n\n private:\n  CollectionIterator(VariantData* slot, SlotId slotId)\n      : slot_(slot), currentId_(slotId) {}\n\n  VariantData* slot_;\n  SlotId currentId_;\n};\n\nARDUINOJSON_END_PRIVATE_NAMESPACE\n"
  },
  {
    "path": "src/ArduinoJson/Configuration.hpp",
    "content": "// ArduinoJson - https://arduinojson.org\n// Copyright © 2014-2025, Benoit BLANCHON\n// MIT License\n\n#pragma once\n\n// Support std::istream and std::ostream\n// https://arduinojson.org/v7/config/enable_std_stream/\n#ifndef ARDUINOJSON_ENABLE_STD_STREAM\n#  ifdef __has_include\n#    if __has_include(<istream>) && \\\n    __has_include(<ostream>) && \\\n    !defined(min) && \\\n    !defined(max)\n#      define ARDUINOJSON_ENABLE_STD_STREAM 1\n#    else\n#      define ARDUINOJSON_ENABLE_STD_STREAM 0\n#    endif\n#  else\n#    ifdef ARDUINO\n#      define ARDUINOJSON_ENABLE_STD_STREAM 0\n#    else\n#      define ARDUINOJSON_ENABLE_STD_STREAM 1\n#    endif\n#  endif\n#endif\n\n// Support std::string\n// https://arduinojson.org/v7/config/enable_std_string/\n#ifndef ARDUINOJSON_ENABLE_STD_STRING\n#  ifdef __has_include\n#    if __has_include(<string>) && !defined(min) && !defined(max)\n#      define ARDUINOJSON_ENABLE_STD_STRING 1\n#    else\n#      define ARDUINOJSON_ENABLE_STD_STRING 0\n#    endif\n#  else\n#    ifdef ARDUINO\n#      define ARDUINOJSON_ENABLE_STD_STRING 0\n#    else\n#      define ARDUINOJSON_ENABLE_STD_STRING 1\n#    endif\n#  endif\n#endif\n\n// Support for std::string_view\n#ifndef ARDUINOJSON_ENABLE_STRING_VIEW\n#  ifdef __has_include\n#    if __has_include(<string_view>) && __cplusplus >= 201703L\n#      define ARDUINOJSON_ENABLE_STRING_VIEW 1\n#    else\n#      define ARDUINOJSON_ENABLE_STRING_VIEW 0\n#    endif\n#  else\n#    define ARDUINOJSON_ENABLE_STRING_VIEW 0\n#  endif\n#endif\n\n// Pointer size: a heuristic to set sensible defaults\n#ifndef ARDUINOJSON_SIZEOF_POINTER\n#  if defined(__SIZEOF_POINTER__)\n#    define ARDUINOJSON_SIZEOF_POINTER __SIZEOF_POINTER__\n#  elif defined(_WIN64) && _WIN64\n#    define ARDUINOJSON_SIZEOF_POINTER 8  // 64 bits\n#  else\n#    define ARDUINOJSON_SIZEOF_POINTER 4  // assume 32 bits otherwise\n#  endif\n#endif\n\n// Store floating-point values with float (0) or double (1)\n// https://arduinojson.org/v7/config/use_double/\n#ifndef ARDUINOJSON_USE_DOUBLE\n#  if ARDUINOJSON_SIZEOF_POINTER >= 4  // 32 & 64 bits systems\n#    define ARDUINOJSON_USE_DOUBLE 1\n#  else\n#    define ARDUINOJSON_USE_DOUBLE 0\n#  endif\n#endif\n\n// Store integral values with long (0) or long long (1)\n// https://arduinojson.org/v7/config/use_long_long/\n#ifndef ARDUINOJSON_USE_LONG_LONG\n#  if ARDUINOJSON_SIZEOF_POINTER >= 4  // 32 & 64 bits systems\n#    define ARDUINOJSON_USE_LONG_LONG 1\n#  else\n#    define ARDUINOJSON_USE_LONG_LONG 0\n#  endif\n#endif\n\n// Limit nesting as the stack is likely to be small\n// https://arduinojson.org/v7/config/default_nesting_limit/\n#ifndef ARDUINOJSON_DEFAULT_NESTING_LIMIT\n#  define ARDUINOJSON_DEFAULT_NESTING_LIMIT 10\n#endif\n\n// Number of bytes to store a slot id\n// https://arduinojson.org/v7/config/slot_id_size/\n#ifndef ARDUINOJSON_SLOT_ID_SIZE\n#  if ARDUINOJSON_SIZEOF_POINTER <= 2\n//   8-bit and 16-bit archs => up to 255 slots\n#    define ARDUINOJSON_SLOT_ID_SIZE 1\n#  elif ARDUINOJSON_SIZEOF_POINTER == 4\n//   32-bit arch => up to 65535 slots\n#    define ARDUINOJSON_SLOT_ID_SIZE 2\n#  else\n//   64-bit arch => up to 4294967295 slots\n#    define ARDUINOJSON_SLOT_ID_SIZE 4\n#  endif\n#endif\n\n// Capacity of each variant pool (in slots)\n#ifndef ARDUINOJSON_POOL_CAPACITY\n#  if ARDUINOJSON_SLOT_ID_SIZE == 1\n#    define ARDUINOJSON_POOL_CAPACITY 16  // 96 bytes\n#  elif ARDUINOJSON_SLOT_ID_SIZE == 2\n#    define ARDUINOJSON_POOL_CAPACITY 128  // 1024 bytes\n#  else\n#    define ARDUINOJSON_POOL_CAPACITY 256  // 4096 bytes\n#  endif\n#endif\n\n// Initial capacity of the pool list\n#ifndef ARDUINOJSON_INITIAL_POOL_COUNT\n#  define ARDUINOJSON_INITIAL_POOL_COUNT 4\n#endif\n\n// Automatically call shrinkToFit() from deserializeXxx()\n// Disabled by default on 8-bit platforms because it's not worth the increase in\n// code size\n#ifndef ARDUINOJSON_AUTO_SHRINK\n#  if ARDUINOJSON_SIZEOF_POINTER <= 2\n#    define ARDUINOJSON_AUTO_SHRINK 0\n#  else\n#    define ARDUINOJSON_AUTO_SHRINK 1\n#  endif\n#endif\n\n// Number of bytes to store the length of a string\n// https://arduinojson.org/v7/config/string_length_size/\n#ifndef ARDUINOJSON_STRING_LENGTH_SIZE\n#  if ARDUINOJSON_SIZEOF_POINTER <= 2\n#    define ARDUINOJSON_STRING_LENGTH_SIZE 1  // up to 255 characters\n#  else\n#    define ARDUINOJSON_STRING_LENGTH_SIZE 2  // up to 65535 characters\n#  endif\n#endif\n\n#ifdef ARDUINO\n\n// Enable support for Arduino's String class\n// https://arduinojson.org/v7/config/enable_arduino_string/\n#  ifndef ARDUINOJSON_ENABLE_ARDUINO_STRING\n#    define ARDUINOJSON_ENABLE_ARDUINO_STRING 1\n#  endif\n\n// Enable support for Arduino's Stream class\n// https://arduinojson.org/v7/config/enable_arduino_stream/\n#  ifndef ARDUINOJSON_ENABLE_ARDUINO_STREAM\n#    define ARDUINOJSON_ENABLE_ARDUINO_STREAM 1\n#  endif\n\n// Enable support for Arduino's Print class\n#  ifndef ARDUINOJSON_ENABLE_ARDUINO_PRINT\n#    define ARDUINOJSON_ENABLE_ARDUINO_PRINT 1\n#  endif\n\n// Enable support for PROGMEM\n// https://arduinojson.org/v7/config/enable_progmem/\n#  ifndef ARDUINOJSON_ENABLE_PROGMEM\n#    define ARDUINOJSON_ENABLE_PROGMEM 1\n#  endif\n\n#else  // ARDUINO\n\n// Disable support for Arduino's String class\n// https://arduinojson.org/v7/config/enable_arduino_string/\n#  ifndef ARDUINOJSON_ENABLE_ARDUINO_STRING\n#    define ARDUINOJSON_ENABLE_ARDUINO_STRING 0\n#  endif\n\n// Disable support for Arduino's Stream class\n// https://arduinojson.org/v7/config/enable_arduino_stream/\n#  ifndef ARDUINOJSON_ENABLE_ARDUINO_STREAM\n#    define ARDUINOJSON_ENABLE_ARDUINO_STREAM 0\n#  endif\n\n// Disable support for Arduino's Print class\n#  ifndef ARDUINOJSON_ENABLE_ARDUINO_PRINT\n#    define ARDUINOJSON_ENABLE_ARDUINO_PRINT 0\n#  endif\n\n// Enable PROGMEM support on AVR only\n// https://arduinojson.org/v7/config/enable_progmem/\n#  ifndef ARDUINOJSON_ENABLE_PROGMEM\n#    ifdef __AVR__\n#      define ARDUINOJSON_ENABLE_PROGMEM 1\n#    else\n#      define ARDUINOJSON_ENABLE_PROGMEM 0\n#    endif\n#  endif\n\n#endif  // ARDUINO\n\n// Convert unicode escape sequence (\\u0123) to UTF-8\n// https://arduinojson.org/v7/config/decode_unicode/\n#ifndef ARDUINOJSON_DECODE_UNICODE\n#  define ARDUINOJSON_DECODE_UNICODE 1\n#endif\n\n// Ignore comments in input\n// https://arduinojson.org/v7/config/enable_comments/\n#ifndef ARDUINOJSON_ENABLE_COMMENTS\n#  define ARDUINOJSON_ENABLE_COMMENTS 0\n#endif\n\n// Support NaN in JSON\n// https://arduinojson.org/v7/config/enable_nan/\n#ifndef ARDUINOJSON_ENABLE_NAN\n#  define ARDUINOJSON_ENABLE_NAN 0\n#endif\n\n// Support Infinity in JSON\n// https://arduinojson.org/v7/config/enable_infinity/\n#ifndef ARDUINOJSON_ENABLE_INFINITY\n#  define ARDUINOJSON_ENABLE_INFINITY 0\n#endif\n\n// Control the exponentiation threshold for big numbers\n// CAUTION: cannot be more that 1e9 !!!!\n// https://arduinojson.org/v7/config/positive_exponentiation_threshold/\n#ifndef ARDUINOJSON_POSITIVE_EXPONENTIATION_THRESHOLD\n#  define ARDUINOJSON_POSITIVE_EXPONENTIATION_THRESHOLD 1e7\n#endif\n\n// Control the exponentiation threshold for small numbers\n// https://arduinojson.org/v7/config/negative_exponentiation_threshold/\n#ifndef ARDUINOJSON_NEGATIVE_EXPONENTIATION_THRESHOLD\n#  define ARDUINOJSON_NEGATIVE_EXPONENTIATION_THRESHOLD 1e-5\n#endif\n\n#ifndef ARDUINOJSON_LITTLE_ENDIAN\n#  if defined(_MSC_VER) ||                           \\\n      (defined(__BYTE_ORDER__) &&                    \\\n       __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__) || \\\n      defined(__LITTLE_ENDIAN__) || defined(__i386) || defined(__x86_64)\n#    define ARDUINOJSON_LITTLE_ENDIAN 1\n#  else\n#    define ARDUINOJSON_LITTLE_ENDIAN 0\n#  endif\n#endif\n\n#ifndef ARDUINOJSON_ENABLE_ALIGNMENT\n#  if defined(__AVR)\n#    define ARDUINOJSON_ENABLE_ALIGNMENT 0\n#  else\n#    define ARDUINOJSON_ENABLE_ALIGNMENT 1\n#  endif\n#endif\n\n#ifndef ARDUINOJSON_TAB\n#  define ARDUINOJSON_TAB \"  \"\n#endif\n\n#ifndef ARDUINOJSON_STRING_BUFFER_SIZE\n#  define ARDUINOJSON_STRING_BUFFER_SIZE 32\n#endif\n\n#ifndef ARDUINOJSON_DEBUG\n#  ifdef __PLATFORMIO_BUILD_DEBUG__\n#    define ARDUINOJSON_DEBUG 1\n#  else\n#    define ARDUINOJSON_DEBUG 0\n#  endif\n#endif\n\n#if ARDUINOJSON_USE_LONG_LONG || ARDUINOJSON_USE_DOUBLE\n#  define ARDUINOJSON_USE_8_BYTE_POOL 1\n#else\n#  define ARDUINOJSON_USE_8_BYTE_POOL 0\n#endif\n\n#if defined(nullptr)\n#  error nullptr is defined as a macro. Remove the faulty #define or #undef nullptr\n// See https://github.com/bblanchon/ArduinoJson/issues/1355\n#endif\n"
  },
  {
    "path": "src/ArduinoJson/Deserialization/DeserializationError.hpp",
    "content": "// ArduinoJson - https://arduinojson.org\n// Copyright © 2014-2025, Benoit BLANCHON\n// MIT License\n\n#pragma once\n\n#include <ArduinoJson/Namespace.hpp>\n#include <ArduinoJson/Polyfills/pgmspace_generic.hpp>\n#include <ArduinoJson/Polyfills/preprocessor.hpp>\n\n#if ARDUINOJSON_ENABLE_STD_STREAM\n#  include <ostream>\n#endif\n\nARDUINOJSON_BEGIN_PUBLIC_NAMESPACE\n\nclass DeserializationError {\n public:\n  enum Code {\n    Ok,\n    EmptyInput,\n    IncompleteInput,\n    InvalidInput,\n    NoMemory,\n    TooDeep\n  };\n\n  DeserializationError() {}\n  DeserializationError(Code c) : code_(c) {}\n\n  // Compare with DeserializationError\n  friend bool operator==(const DeserializationError& lhs,\n                         const DeserializationError& rhs) {\n    return lhs.code_ == rhs.code_;\n  }\n  friend bool operator!=(const DeserializationError& lhs,\n                         const DeserializationError& rhs) {\n    return lhs.code_ != rhs.code_;\n  }\n\n  // Compare with Code\n  friend bool operator==(const DeserializationError& lhs, Code rhs) {\n    return lhs.code_ == rhs;\n  }\n  friend bool operator==(Code lhs, const DeserializationError& rhs) {\n    return lhs == rhs.code_;\n  }\n  friend bool operator!=(const DeserializationError& lhs, Code rhs) {\n    return lhs.code_ != rhs;\n  }\n  friend bool operator!=(Code lhs, const DeserializationError& rhs) {\n    return lhs != rhs.code_;\n  }\n\n  // Returns true if there is an error\n  explicit operator bool() const {\n    return code_ != Ok;\n  }\n\n  // Returns internal enum, useful for switch statement\n  Code code() const {\n    return code_;\n  }\n\n  const char* c_str() const {\n    static const char* messages[] = {\n        \"Ok\",           \"EmptyInput\", \"IncompleteInput\",\n        \"InvalidInput\", \"NoMemory\",   \"TooDeep\"};\n    ARDUINOJSON_ASSERT(static_cast<size_t>(code_) <\n                       sizeof(messages) / sizeof(messages[0]));\n    return messages[code_];\n  }\n\n#if ARDUINOJSON_ENABLE_PROGMEM\n  const __FlashStringHelper* f_str() const {\n    ARDUINOJSON_DEFINE_PROGMEM_ARRAY(char, s0, \"Ok\");\n    ARDUINOJSON_DEFINE_PROGMEM_ARRAY(char, s1, \"EmptyInput\");\n    ARDUINOJSON_DEFINE_PROGMEM_ARRAY(char, s2, \"IncompleteInput\");\n    ARDUINOJSON_DEFINE_PROGMEM_ARRAY(char, s3, \"InvalidInput\");\n    ARDUINOJSON_DEFINE_PROGMEM_ARRAY(char, s4, \"NoMemory\");\n    ARDUINOJSON_DEFINE_PROGMEM_ARRAY(char, s5, \"TooDeep\");\n    ARDUINOJSON_DEFINE_PROGMEM_ARRAY(const char*, messages,\n                                     {s0, s1, s2, s3, s4, s5});\n    return reinterpret_cast<const __FlashStringHelper*>(\n        detail::pgm_read(messages + code_));\n  }\n#endif\n\n private:\n  Code code_;\n};\n\n#if ARDUINOJSON_ENABLE_STD_STREAM\ninline std::ostream& operator<<(std::ostream& s,\n                                const DeserializationError& e) {\n  s << e.c_str();\n  return s;\n}\n\ninline std::ostream& operator<<(std::ostream& s, DeserializationError::Code c) {\n  s << DeserializationError(c).c_str();\n  return s;\n}\n#endif\n\nARDUINOJSON_END_PUBLIC_NAMESPACE\n"
  },
  {
    "path": "src/ArduinoJson/Deserialization/DeserializationOptions.hpp",
    "content": "// ArduinoJson - https://arduinojson.org\n// Copyright © 2014-2025, Benoit BLANCHON\n// MIT License\n\n#pragma once\n\n#include <ArduinoJson/Deserialization/Filter.hpp>\n#include <ArduinoJson/Deserialization/NestingLimit.hpp>\n\nARDUINOJSON_BEGIN_PRIVATE_NAMESPACE\n\ntemplate <typename TFilter>\nstruct DeserializationOptions {\n  TFilter filter;\n  DeserializationOption::NestingLimit nestingLimit;\n};\n\ntemplate <typename TFilter>\ninline DeserializationOptions<TFilter> makeDeserializationOptions(\n    TFilter filter, DeserializationOption::NestingLimit nestingLimit = {}) {\n  return {filter, nestingLimit};\n}\n\ntemplate <typename TFilter>\ninline DeserializationOptions<TFilter> makeDeserializationOptions(\n    DeserializationOption::NestingLimit nestingLimit, TFilter filter) {\n  return {filter, nestingLimit};\n}\n\ninline DeserializationOptions<AllowAllFilter> makeDeserializationOptions(\n    DeserializationOption::NestingLimit nestingLimit = {}) {\n  return {{}, nestingLimit};\n}\n\nARDUINOJSON_END_PRIVATE_NAMESPACE\n"
  },
  {
    "path": "src/ArduinoJson/Deserialization/Filter.hpp",
    "content": "// ArduinoJson - https://arduinojson.org\n// Copyright © 2014-2025, Benoit BLANCHON\n// MIT License\n\n#pragma once\n\n#include <ArduinoJson/Variant/JsonVariant.hpp>\n#include <ArduinoJson/Variant/VariantAttorney.hpp>\n\nARDUINOJSON_BEGIN_PUBLIC_NAMESPACE\n\nnamespace DeserializationOption {\nclass Filter {\n public:\n#if ARDUINOJSON_AUTO_SHRINK\n  explicit Filter(JsonDocument& doc) : variant_(doc) {\n    doc.shrinkToFit();\n  }\n#endif\n\n  explicit Filter(JsonVariantConst variant) : variant_(variant) {}\n\n  bool allow() const {\n    return variant_;\n  }\n\n  bool allowArray() const {\n    return variant_ == true || variant_.is<JsonArrayConst>();\n  }\n\n  bool allowObject() const {\n    return variant_ == true || variant_.is<JsonObjectConst>();\n  }\n\n  bool allowValue() const {\n    return variant_ == true;\n  }\n\n  template <typename TKey>\n  Filter operator[](const TKey& key) const {\n    if (variant_ == true)  // \"true\" means \"allow recursively\"\n      return *this;\n    JsonVariantConst member = variant_[key];\n    return Filter(member.isNull() ? variant_[\"*\"] : member);\n  }\n\n private:\n  JsonVariantConst variant_;\n};\n}  // namespace DeserializationOption\n\nnamespace detail {\nstruct AllowAllFilter {\n  bool allow() const {\n    return true;\n  }\n\n  bool allowArray() const {\n    return true;\n  }\n\n  bool allowObject() const {\n    return true;\n  }\n\n  bool allowValue() const {\n    return true;\n  }\n\n  template <typename TKey>\n  AllowAllFilter operator[](const TKey&) const {\n    return AllowAllFilter();\n  }\n};\n}  // namespace detail\n\nARDUINOJSON_END_PUBLIC_NAMESPACE\n"
  },
  {
    "path": "src/ArduinoJson/Deserialization/NestingLimit.hpp",
    "content": "// ArduinoJson - https://arduinojson.org\n// Copyright © 2014-2025, Benoit BLANCHON\n// MIT License\n\n#pragma once\n\n#include <ArduinoJson/Namespace.hpp>\n#include <ArduinoJson/Polyfills/assert.hpp>\n\nARDUINOJSON_BEGIN_PUBLIC_NAMESPACE\n\nnamespace DeserializationOption {\nclass NestingLimit {\n public:\n  NestingLimit() : value_(ARDUINOJSON_DEFAULT_NESTING_LIMIT) {}\n  explicit NestingLimit(uint8_t n) : value_(n) {}\n\n  NestingLimit decrement() const {\n    ARDUINOJSON_ASSERT(value_ > 0);\n    return NestingLimit(static_cast<uint8_t>(value_ - 1));\n  }\n\n  bool reached() const {\n    return value_ == 0;\n  }\n\n private:\n  uint8_t value_;\n};\n}  // namespace DeserializationOption\n\nARDUINOJSON_END_PUBLIC_NAMESPACE\n"
  },
  {
    "path": "src/ArduinoJson/Deserialization/Reader.hpp",
    "content": "// ArduinoJson - https://arduinojson.org\n// Copyright © 2014-2025, Benoit BLANCHON\n// MIT License\n\n#pragma once\n\n#include <ArduinoJson/Namespace.hpp>\n#include <ArduinoJson/Polyfills/utility.hpp>\n\n#include <stdlib.h>  // for size_t\n\nARDUINOJSON_BEGIN_PRIVATE_NAMESPACE\n\n// The default reader is a simple wrapper for Readers that are not copyable\ntemplate <typename TSource, typename Enable = void>\nstruct Reader {\n public:\n  Reader(TSource& source) : source_(&source) {}\n\n  int read() {\n    // clang-format off\n    return source_->read();  // Error here? See https://arduinojson.org/v7/invalid-input/\n    // clang-format on\n  }\n\n  size_t readBytes(char* buffer, size_t length) {\n    return source_->readBytes(buffer, length);\n  }\n\n private:\n  TSource* source_;\n};\n\ntemplate <typename TSource, typename Enable = void>\nstruct BoundedReader {\n  // no default implementation because we need to pass the size to the\n  // constructor\n};\n\nARDUINOJSON_END_PRIVATE_NAMESPACE\n\n#include <ArduinoJson/Deserialization/Readers/IteratorReader.hpp>\n#include <ArduinoJson/Deserialization/Readers/RamReader.hpp>\n#include <ArduinoJson/Deserialization/Readers/VariantReader.hpp>\n\n#if ARDUINOJSON_ENABLE_ARDUINO_STREAM\n#  include <ArduinoJson/Deserialization/Readers/ArduinoStreamReader.hpp>\n#endif\n\n#if ARDUINOJSON_ENABLE_ARDUINO_STRING\n#  include <ArduinoJson/Deserialization/Readers/ArduinoStringReader.hpp>\n#endif\n\n#if ARDUINOJSON_ENABLE_PROGMEM\n#  include <ArduinoJson/Deserialization/Readers/FlashReader.hpp>\n#endif\n\n#if ARDUINOJSON_ENABLE_STD_STREAM\n#  include <ArduinoJson/Deserialization/Readers/StdStreamReader.hpp>\n#endif\n\nARDUINOJSON_BEGIN_PRIVATE_NAMESPACE\n\ntemplate <typename TInput>\nReader<remove_reference_t<TInput>> makeReader(TInput&& input) {\n  return Reader<remove_reference_t<TInput>>{detail::forward<TInput>(input)};\n}\n\ntemplate <typename TChar>\nBoundedReader<TChar*> makeReader(TChar* input, size_t inputSize) {\n  return BoundedReader<TChar*>{input, inputSize};\n}\n\nARDUINOJSON_END_PRIVATE_NAMESPACE\n"
  },
  {
    "path": "src/ArduinoJson/Deserialization/Readers/ArduinoStreamReader.hpp",
    "content": "// ArduinoJson - https://arduinojson.org\n// Copyright © 2014-2025, Benoit BLANCHON\n// MIT License\n\n#pragma once\n\n#include <Arduino.h>\n\nARDUINOJSON_BEGIN_PRIVATE_NAMESPACE\n\ntemplate <typename TSource>\nstruct Reader<TSource, enable_if_t<is_base_of<Stream, TSource>::value>> {\n public:\n  explicit Reader(Stream& stream) : stream_(&stream) {}\n\n  int read() {\n    // don't use stream_->read() as it ignores the timeout\n    char c;\n    return stream_->readBytes(&c, 1) ? static_cast<unsigned char>(c) : -1;\n  }\n\n  size_t readBytes(char* buffer, size_t length) {\n    return stream_->readBytes(buffer, length);\n  }\n\n private:\n  Stream* stream_;\n};\n\nARDUINOJSON_END_PRIVATE_NAMESPACE\n"
  },
  {
    "path": "src/ArduinoJson/Deserialization/Readers/ArduinoStringReader.hpp",
    "content": "// ArduinoJson - https://arduinojson.org\n// Copyright © 2014-2025, Benoit BLANCHON\n// MIT License\n\n#pragma once\n\n#include <Arduino.h>\n\nARDUINOJSON_BEGIN_PRIVATE_NAMESPACE\n\ntemplate <typename TSource>\nstruct Reader<TSource, enable_if_t<is_base_of<::String, TSource>::value>>\n    : BoundedReader<const char*> {\n  explicit Reader(const ::String& s)\n      : BoundedReader<const char*>(s.c_str(), s.length()) {}\n};\n\nARDUINOJSON_END_PRIVATE_NAMESPACE\n"
  },
  {
    "path": "src/ArduinoJson/Deserialization/Readers/FlashReader.hpp",
    "content": "// ArduinoJson - https://arduinojson.org\n// Copyright © 2014-2025, Benoit BLANCHON\n// MIT License\n\n#pragma once\n\n#include <ArduinoJson/Polyfills/pgmspace.hpp>\n\nARDUINOJSON_BEGIN_PRIVATE_NAMESPACE\n\ntemplate <>\nstruct Reader<const __FlashStringHelper*, void> {\n  const char* ptr_;\n\n public:\n  explicit Reader(const __FlashStringHelper* ptr)\n      : ptr_(reinterpret_cast<const char*>(ptr)) {}\n\n  int read() {\n    return pgm_read_byte(ptr_++);\n  }\n\n  size_t readBytes(char* buffer, size_t length) {\n    memcpy_P(buffer, ptr_, length);\n    ptr_ += length;\n    return length;\n  }\n};\n\ntemplate <>\nstruct BoundedReader<const __FlashStringHelper*, void> {\n  const char* ptr_;\n  const char* end_;\n\n public:\n  explicit BoundedReader(const __FlashStringHelper* ptr, size_t size)\n      : ptr_(reinterpret_cast<const char*>(ptr)), end_(ptr_ + size) {}\n\n  int read() {\n    if (ptr_ < end_)\n      return pgm_read_byte(ptr_++);\n    else\n      return -1;\n  }\n\n  size_t readBytes(char* buffer, size_t length) {\n    size_t available = static_cast<size_t>(end_ - ptr_);\n    if (available < length)\n      length = available;\n    memcpy_P(buffer, ptr_, length);\n    ptr_ += length;\n    return length;\n  }\n};\n\nARDUINOJSON_END_PRIVATE_NAMESPACE\n"
  },
  {
    "path": "src/ArduinoJson/Deserialization/Readers/IteratorReader.hpp",
    "content": "// ArduinoJson - https://arduinojson.org\n// Copyright © 2014-2025, Benoit BLANCHON\n// MIT License\n\n#pragma once\n\n#include <ArduinoJson/Polyfills/type_traits.hpp>\n\nARDUINOJSON_BEGIN_PRIVATE_NAMESPACE\n\ntemplate <typename TIterator>\nclass IteratorReader {\n  TIterator ptr_, end_;\n\n public:\n  explicit IteratorReader(TIterator begin, TIterator end)\n      : ptr_(begin), end_(end) {}\n\n  int read() {\n    if (ptr_ < end_)\n      return static_cast<unsigned char>(*ptr_++);\n    else\n      return -1;\n  }\n\n  size_t readBytes(char* buffer, size_t length) {\n    size_t i = 0;\n    while (i < length && ptr_ < end_)\n      buffer[i++] = *ptr_++;\n    return i;\n  }\n};\n\ntemplate <typename TSource>\nstruct Reader<TSource, void_t<typename TSource::const_iterator>>\n    : IteratorReader<typename TSource::const_iterator> {\n  explicit Reader(const TSource& source)\n      : IteratorReader<typename TSource::const_iterator>(source.begin(),\n                                                         source.end()) {}\n};\n\nARDUINOJSON_END_PRIVATE_NAMESPACE\n"
  },
  {
    "path": "src/ArduinoJson/Deserialization/Readers/RamReader.hpp",
    "content": "// ArduinoJson - https://arduinojson.org\n// Copyright © 2014-2025, Benoit BLANCHON\n// MIT License\n\n#pragma once\n\n#include <ArduinoJson/Polyfills/type_traits.hpp>\n\nARDUINOJSON_BEGIN_PRIVATE_NAMESPACE\n\ntemplate <typename T>\nstruct IsCharOrVoid {\n  static const bool value =\n      is_same<T, void>::value || is_same<T, char>::value ||\n      is_same<T, unsigned char>::value || is_same<T, signed char>::value;\n};\n\ntemplate <typename T>\nstruct IsCharOrVoid<const T> : IsCharOrVoid<T> {};\n\ntemplate <typename TSource>\nstruct Reader<TSource*, enable_if_t<IsCharOrVoid<TSource>::value>> {\n  const char* ptr_;\n\n public:\n  explicit Reader(const void* ptr)\n      : ptr_(ptr ? reinterpret_cast<const char*>(ptr) : \"\") {}\n\n  int read() {\n    return static_cast<unsigned char>(*ptr_++);\n  }\n\n  size_t readBytes(char* buffer, size_t length) {\n    for (size_t i = 0; i < length; i++)\n      buffer[i] = *ptr_++;\n    return length;\n  }\n};\n\ntemplate <typename TSource>\nstruct BoundedReader<TSource*, enable_if_t<IsCharOrVoid<TSource>::value>>\n    : public IteratorReader<const char*> {\n public:\n  explicit BoundedReader(const void* ptr, size_t len)\n      : IteratorReader<const char*>(reinterpret_cast<const char*>(ptr),\n                                    reinterpret_cast<const char*>(ptr) + len) {}\n};\n\nARDUINOJSON_END_PRIVATE_NAMESPACE\n"
  },
  {
    "path": "src/ArduinoJson/Deserialization/Readers/StdStreamReader.hpp",
    "content": "// ArduinoJson - https://arduinojson.org\n// Copyright © 2014-2025, Benoit BLANCHON\n// MIT License\n\n#pragma once\n\n#include <istream>\n\nARDUINOJSON_BEGIN_PRIVATE_NAMESPACE\n\ntemplate <typename TSource>\nstruct Reader<TSource, enable_if_t<is_base_of<std::istream, TSource>::value>> {\n public:\n  explicit Reader(std::istream& stream) : stream_(&stream) {}\n\n  int read() {\n    return stream_->get();\n  }\n\n  size_t readBytes(char* buffer, size_t length) {\n    stream_->read(buffer, static_cast<std::streamsize>(length));\n    return static_cast<size_t>(stream_->gcount());\n  }\n\n private:\n  std::istream* stream_;\n};\n\nARDUINOJSON_END_PRIVATE_NAMESPACE\n"
  },
  {
    "path": "src/ArduinoJson/Deserialization/Readers/VariantReader.hpp",
    "content": "// ArduinoJson - https://arduinojson.org\n// Copyright © 2014-2025, Benoit BLANCHON\n// MIT License\n\n#pragma once\n\n#include <ArduinoJson/Object/MemberProxy.hpp>\n#include <ArduinoJson/Variant/JsonVariantConst.hpp>\n\nARDUINOJSON_BEGIN_PRIVATE_NAMESPACE\n\ntemplate <typename TVariant>\nstruct Reader<TVariant, enable_if_t<IsVariant<TVariant>::value>>\n    : Reader<char*, void> {\n  explicit Reader(const TVariant& x)\n      : Reader<char*, void>(x.template as<const char*>()) {}\n};\n\nARDUINOJSON_END_PRIVATE_NAMESPACE\n"
  },
  {
    "path": "src/ArduinoJson/Deserialization/deserialize.hpp",
    "content": "// ArduinoJson - https://arduinojson.org\n// Copyright © 2014-2025, Benoit BLANCHON\n// MIT License\n\n#pragma once\n\n#include <ArduinoJson/Deserialization/DeserializationError.hpp>\n#include <ArduinoJson/Deserialization/DeserializationOptions.hpp>\n#include <ArduinoJson/Deserialization/Reader.hpp>\n#include <ArduinoJson/Polyfills/utility.hpp>\n\nARDUINOJSON_BEGIN_PRIVATE_NAMESPACE\n\n// A meta-function that returns the first type of the parameter pack\n// or void if empty\ntemplate <typename...>\nstruct first_or_void {\n  using type = void;\n};\ntemplate <typename T, typename... Rest>\nstruct first_or_void<T, Rest...> {\n  using type = T;\n};\n\n// A meta-function that returns true if T is a valid destination type for\n// deserialize()\ntemplate <class T>\nusing is_deserialize_destination =\n    bool_constant<is_base_of<JsonDocument, remove_cv_t<T>>::value ||\n                  IsVariant<T>::value>;\n\ntemplate <typename TDestination>\ninline void shrinkJsonDocument(TDestination&) {\n  // no-op by default\n}\n\n#if ARDUINOJSON_AUTO_SHRINK\ninline void shrinkJsonDocument(JsonDocument& doc) {\n  doc.shrinkToFit();\n}\n#endif\n\ntemplate <template <typename> class TDeserializer, typename TDestination,\n          typename TReader, typename TOptions>\nDeserializationError doDeserialize(TDestination&& dst, TReader reader,\n                                   TOptions options) {\n  auto data = VariantAttorney::getOrCreateData(dst);\n  if (!data)\n    return DeserializationError::NoMemory;\n  auto resources = VariantAttorney::getResourceManager(dst);\n  dst.clear();\n  auto err = TDeserializer<TReader>(resources, reader)\n                 .parse(data, options.filter, options.nestingLimit);\n  shrinkJsonDocument(dst);\n  return err;\n}\n\ntemplate <\n    template <typename> class TDeserializer, typename TDestination,\n    typename TStream, typename... Args,\n    enable_if_t<  // issue #1897\n        !is_integral<typename first_or_void<Args...>::type>::value, int> = 0>\nDeserializationError deserialize(TDestination&& dst, TStream&& input,\n                                 Args... args) {\n  return doDeserialize<TDeserializer>(\n      dst, makeReader(detail::forward<TStream>(input)),\n      makeDeserializationOptions(args...));\n}\n\ntemplate <template <typename> class TDeserializer, typename TDestination,\n          typename TChar, typename Size, typename... Args,\n          enable_if_t<is_integral<Size>::value, int> = 0>\nDeserializationError deserialize(TDestination&& dst, TChar* input,\n                                 Size inputSize, Args... args) {\n  return doDeserialize<TDeserializer>(dst, makeReader(input, size_t(inputSize)),\n                                      makeDeserializationOptions(args...));\n}\n\nARDUINOJSON_END_PRIVATE_NAMESPACE\n"
  },
  {
    "path": "src/ArduinoJson/Document/JsonDocument.hpp",
    "content": "// ArduinoJson - https://arduinojson.org\n// Copyright © 2014-2025, Benoit BLANCHON\n// MIT License\n\n#pragma once\n\n#include <ArduinoJson/Array/ElementProxy.hpp>\n#include <ArduinoJson/Memory/Allocator.hpp>\n#include <ArduinoJson/Memory/ResourceManager.hpp>\n#include <ArduinoJson/Object/JsonObject.hpp>\n#include <ArduinoJson/Object/MemberProxy.hpp>\n#include <ArduinoJson/Polyfills/utility.hpp>\n#include <ArduinoJson/Variant/JsonVariantConst.hpp>\n\nARDUINOJSON_BEGIN_PUBLIC_NAMESPACE\n\n// A JSON document.\n// https://arduinojson.org/v7/api/jsondocument/\nclass JsonDocument : public detail::VariantOperators<const JsonDocument&> {\n  friend class detail::VariantAttorney;\n\n public:\n  explicit JsonDocument(Allocator* alloc = detail::DefaultAllocator::instance())\n      : resources_(alloc) {}\n\n  // Copy-constructor\n  JsonDocument(const JsonDocument& src) : JsonDocument(src.allocator()) {\n    set(src);\n  }\n\n  // Move-constructor\n  JsonDocument(JsonDocument&& src)\n      : JsonDocument(detail::DefaultAllocator::instance()) {\n    swap(*this, src);\n  }\n\n  // Construct from variant, array, or object\n  template <typename T,\n            detail::enable_if_t<detail::IsVariant<T>::value ||\n                                    detail::is_same<T, JsonArray>::value ||\n                                    detail::is_same<T, JsonArrayConst>::value ||\n                                    detail::is_same<T, JsonObject>::value ||\n                                    detail::is_same<T, JsonObjectConst>::value,\n                                int> = 0>\n  JsonDocument(const T& src,\n               Allocator* alloc = detail::DefaultAllocator::instance())\n      : JsonDocument(alloc) {\n    set(src);\n  }\n\n  JsonDocument& operator=(JsonDocument src) {\n    swap(*this, src);\n    return *this;\n  }\n\n  template <typename T>\n  JsonDocument& operator=(const T& src) {\n    set(src);\n    return *this;\n  }\n\n  Allocator* allocator() const {\n    return resources_.allocator();\n  }\n\n  // Reduces the capacity of the memory pool to match the current usage.\n  // https://arduinojson.org/v7/api/jsondocument/shrinktofit/\n  void shrinkToFit() {\n    resources_.shrinkToFit();\n  }\n\n  // Casts the root to the specified type.\n  // https://arduinojson.org/v7/api/jsondocument/as/\n  template <typename T>\n  T as() {\n    return getVariant().template as<T>();\n  }\n\n  // Casts the root to the specified type.\n  // https://arduinojson.org/v7/api/jsondocument/as/\n  template <typename T>\n  T as() const {\n    return getVariant().template as<T>();\n  }\n\n  // Empties the document and resets the memory pool\n  // https://arduinojson.org/v7/api/jsondocument/clear/\n  void clear() {\n    resources_.clear();\n    data_.type = detail::VariantType::Null;\n  }\n\n  // Returns true if the root is of the specified type.\n  // https://arduinojson.org/v7/api/jsondocument/is/\n  template <typename T>\n  bool is() {\n    return getVariant().template is<T>();\n  }\n\n  // Returns true if the root is of the specified type.\n  // https://arduinojson.org/v7/api/jsondocument/is/\n  template <typename T>\n  bool is() const {\n    return getVariant().template is<T>();\n  }\n\n  // Returns true if the root is null.\n  // https://arduinojson.org/v7/api/jsondocument/isnull/\n  bool isNull() const {\n    return getVariant().isNull();\n  }\n\n  // Returns trues if the memory pool was too small.\n  // https://arduinojson.org/v7/api/jsondocument/overflowed/\n  bool overflowed() const {\n    return resources_.overflowed();\n  }\n\n  // Returns the depth (nesting level) of the array.\n  // https://arduinojson.org/v7/api/jsondocument/nesting/\n  size_t nesting() const {\n    return getVariantImpl().nesting();\n  }\n\n  // Returns the number of elements in the root array or object.\n  // https://arduinojson.org/v7/api/jsondocument/size/\n  size_t size() const {\n    return getVariantImpl().size();\n  }\n\n  // Copies the specified document.\n  // https://arduinojson.org/v7/api/jsondocument/set/\n  bool set(const JsonDocument& src) {\n    return to<JsonVariant>().set(src.as<JsonVariantConst>());\n  }\n\n  // Replaces the root with the specified value.\n  // https://arduinojson.org/v7/api/jsondocument/set/\n  template <\n      typename T,\n      detail::enable_if_t<!detail::is_base_of<JsonDocument, T>::value, int> = 0>\n  bool set(const T& src) {\n    return to<JsonVariant>().set(src);\n  }\n\n  // Replaces the root with the specified value.\n  // https://arduinojson.org/v7/api/jsondocument/set/\n  template <typename TChar>\n  bool set(TChar* src) {\n    return to<JsonVariant>().set(src);\n  }\n\n  // Sets the document to an empty array.\n  // https://arduinojson.org/v7/api/jsondocument/to/\n  template <typename T,\n            detail::enable_if_t<detail::is_same<T, JsonArray>::value, int> = 0>\n  JsonArray to() {\n    clear();\n    data_.toArray();\n    return JsonArray(&data_, &resources_);\n  }\n\n  // Sets the document to an empty object.\n  // https://arduinojson.org/v7/api/jsondocument/to/\n  template <typename T,\n            detail::enable_if_t<detail::is_same<T, JsonObject>::value, int> = 0>\n  JsonObject to() {\n    clear();\n    data_.toObject();\n    return JsonObject(&data_, &resources_);\n  }\n\n  // Sets the document to null.\n  // https://arduinojson.org/v7/api/jsondocument/to/\n  template <typename T, detail::enable_if_t<\n                            detail::is_same<T, JsonVariant>::value, int> = 0>\n  JsonVariant to() {\n    clear();\n    return JsonVariant(&data_, &resources_);\n  }\n\n  // DEPRECATED: use obj[\"key\"].is<T>() instead\n  // https://arduinojson.org/v7/api/jsondocument/containskey/\n  template <typename TChar>\n  ARDUINOJSON_DEPRECATED(\"use doc[\\\"key\\\"].is<T>() instead\")\n  bool containsKey(TChar* key) const {\n    return getVariantImpl().getMember(detail::adaptString(key)) != 0;\n  }\n\n  // DEPRECATED: use obj[key].is<T>() instead\n  // https://arduinojson.org/v7/api/jsondocument/containskey/\n  template <typename TString,\n            detail::enable_if_t<detail::IsString<TString>::value, int> = 0>\n  ARDUINOJSON_DEPRECATED(\"use doc[key].is<T>() instead\")\n  bool containsKey(const TString& key) const {\n    return getVariantImpl().getMember(detail::adaptString(key)) != 0;\n  }\n\n  // DEPRECATED: use obj[key].is<T>() instead\n  // https://arduinojson.org/v7/api/jsondocument/containskey/\n  template <typename TVariant,\n            detail::enable_if_t<detail::IsVariant<TVariant>::value, int> = 0>\n  ARDUINOJSON_DEPRECATED(\"use doc[key].is<T>() instead\")\n  bool containsKey(const TVariant& key) const {\n    return containsKey(key.template as<const char*>());\n  }\n\n  // Gets or sets a root object's member.\n  // https://arduinojson.org/v7/api/jsondocument/subscript/\n  template <typename TString,\n            detail::enable_if_t<detail::IsString<TString>::value, int> = 0>\n  detail::MemberProxy<JsonDocument&, detail::AdaptedString<TString>> operator[](\n      const TString& key) {\n    return {*this, detail::adaptString(key)};\n  }\n\n  // Gets or sets a root object's member.\n  // https://arduinojson.org/v7/api/jsondocument/subscript/\n  template <typename TChar,\n            detail::enable_if_t<detail::IsString<TChar*>::value, int> = 0>\n  detail::MemberProxy<JsonDocument&, detail::AdaptedString<TChar*>> operator[](\n      TChar* key) {\n    return {*this, detail::adaptString(key)};\n  }\n\n  // Gets a root object's member.\n  // https://arduinojson.org/v7/api/jsondocument/subscript/\n  template <typename TString,\n            detail::enable_if_t<detail::IsString<TString>::value, int> = 0>\n  JsonVariantConst operator[](const TString& key) const {\n    return JsonVariantConst(\n        getVariantImpl().getMember(detail::adaptString(key)), &resources_);\n  }\n\n  // Gets a root object's member.\n  // https://arduinojson.org/v7/api/jsondocument/subscript/\n  template <typename TChar,\n            detail::enable_if_t<detail::IsString<TChar*>::value, int> = 0>\n  JsonVariantConst operator[](TChar* key) const {\n    return JsonVariantConst(\n        getVariantImpl().getMember(detail::adaptString(key)), &resources_);\n  }\n\n  // Gets or sets a root array's element.\n  // https://arduinojson.org/v7/api/jsondocument/subscript/\n  template <typename T,\n            detail::enable_if_t<detail::is_integral<T>::value, int> = 0>\n  detail::ElementProxy<JsonDocument&> operator[](T index) {\n    return {*this, size_t(index)};\n  }\n\n  // Gets a root array's member.\n  // https://arduinojson.org/v7/api/jsondocument/subscript/\n  JsonVariantConst operator[](size_t index) const {\n    return JsonVariantConst(getVariantImpl().getElement(index), &resources_);\n  }\n\n  // Gets or sets a root object's member.\n  // https://arduinojson.org/v7/api/jsondocument/subscript/\n  template <typename TVariant,\n            detail::enable_if_t<detail::IsVariant<TVariant>::value, int> = 0>\n  JsonVariantConst operator[](const TVariant& key) const {\n    if (key.template is<JsonString>())\n      return operator[](key.template as<JsonString>());\n    if (key.template is<size_t>())\n      return operator[](key.template as<size_t>());\n    return {};\n  }\n\n  // Appends a new (empty) element to the root array.\n  // Returns a reference to the new element.\n  // https://arduinojson.org/v7/api/jsondocument/add/\n  template <typename T, detail::enable_if_t<\n                            !detail::is_same<T, JsonVariant>::value, int> = 0>\n  T add() {\n    return add<JsonVariant>().to<T>();\n  }\n\n  // Appends a new (null) element to the root array.\n  // Returns a reference to the new element.\n  // https://arduinojson.org/v7/api/jsondocument/add/\n  template <typename T, detail::enable_if_t<\n                            detail::is_same<T, JsonVariant>::value, int> = 0>\n  JsonVariant add() {\n    return getOrCreateArray().add<T>();\n  }\n\n  // Appends a value to the root array.\n  // https://arduinojson.org/v7/api/jsondocument/add/\n  template <typename TValue>\n  bool add(const TValue& value) {\n    return getOrCreateArray().add(value);\n  }\n\n  // Appends a value to the root array.\n  // https://arduinojson.org/v7/api/jsondocument/add/\n  template <typename TChar>\n  bool add(TChar* value) {\n    return getOrCreateArray().add(value);\n  }\n\n  // Removes an element of the root array.\n  // https://arduinojson.org/v7/api/jsondocument/remove/\n  template <typename T,\n            detail::enable_if_t<detail::is_integral<T>::value, int> = 0>\n  void remove(T index) {\n    getVariantImpl().removeElement(size_t(index));\n  }\n\n  // Removes a member of the root object.\n  // https://arduinojson.org/v7/api/jsondocument/remove/\n  template <typename TChar,\n            detail::enable_if_t<detail::IsString<TChar*>::value, int> = 0>\n  void remove(TChar* key) {\n    getVariantImpl().removeMember(detail::adaptString(key));\n  }\n\n  // Removes a member of the root object.\n  // https://arduinojson.org/v7/api/jsondocument/remove/\n  template <typename TString,\n            detail::enable_if_t<detail::IsString<TString>::value, int> = 0>\n  void remove(const TString& key) {\n    getVariantImpl().removeMember(detail::adaptString(key));\n  }\n\n  // Removes a member of the root object or an element of the root array.\n  // https://arduinojson.org/v7/api/jsondocument/remove/\n  template <typename TVariant,\n            detail::enable_if_t<detail::IsVariant<TVariant>::value, int> = 0>\n  void remove(const TVariant& key) {\n    if (key.template is<const char*>())\n      remove(key.template as<const char*>());\n    if (key.template is<size_t>())\n      remove(key.template as<size_t>());\n  }\n\n  operator JsonVariant() {\n    return getVariant();\n  }\n\n  operator JsonVariantConst() const {\n    return getVariant();\n  }\n\n  friend void swap(JsonDocument& a, JsonDocument& b) {\n    swap(a.resources_, b.resources_);\n    swap_(a.data_, b.data_);\n  }\n\n  // DEPRECATED: use add<JsonVariant>() instead\n  ARDUINOJSON_DEPRECATED(\"use add<JsonVariant>() instead\")\n  JsonVariant add() {\n    return add<JsonVariant>();\n  }\n\n  // DEPRECATED: use add<JsonArray>() instead\n  ARDUINOJSON_DEPRECATED(\"use add<JsonArray>() instead\")\n  JsonArray createNestedArray() {\n    return add<JsonArray>();\n  }\n\n  // DEPRECATED: use doc[key].to<JsonArray>() instead\n  template <typename TChar>\n  ARDUINOJSON_DEPRECATED(\"use doc[key].to<JsonArray>() instead\")\n  JsonArray createNestedArray(TChar* key) {\n    return operator[](key).template to<JsonArray>();\n  }\n\n  // DEPRECATED: use doc[key].to<JsonArray>() instead\n  template <typename TString>\n  ARDUINOJSON_DEPRECATED(\"use doc[key].to<JsonArray>() instead\")\n  JsonArray createNestedArray(const TString& key) {\n    return operator[](key).template to<JsonArray>();\n  }\n\n  // DEPRECATED: use add<JsonObject>() instead\n  ARDUINOJSON_DEPRECATED(\"use add<JsonObject>() instead\")\n  JsonObject createNestedObject() {\n    return add<JsonObject>();\n  }\n\n  // DEPRECATED: use doc[key].to<JsonObject>() instead\n  template <typename TChar>\n  ARDUINOJSON_DEPRECATED(\"use doc[key].to<JsonObject>() instead\")\n  JsonObject createNestedObject(TChar* key) {\n    return operator[](key).template to<JsonObject>();\n  }\n\n  // DEPRECATED: use doc[key].to<JsonObject>() instead\n  template <typename TString>\n  ARDUINOJSON_DEPRECATED(\"use doc[key].to<JsonObject>() instead\")\n  JsonObject createNestedObject(const TString& key) {\n    return operator[](key).template to<JsonObject>();\n  }\n\n  // DEPRECATED: always returns zero\n  ARDUINOJSON_DEPRECATED(\"always returns zero\")\n  size_t memoryUsage() const {\n    return 0;\n  }\n\n private:\n  detail::VariantImpl getVariantImpl() const {\n    return detail::VariantImpl(&data_, &resources_);\n  }\n\n  JsonArray getOrCreateArray() const {\n    if (data_.type == detail::VariantType::Null)\n      data_.toArray();\n    return JsonArray(&data_, &resources_);\n  }\n\n  JsonVariant getVariant() {\n    return JsonVariant(&data_, &resources_);\n  }\n\n  JsonVariantConst getVariant() const {\n    return JsonVariantConst(&data_, &resources_);\n  }\n\n  detail::ResourceManager* getResourceManager() {\n    return &resources_;\n  }\n\n  detail::VariantData* getData() {\n    return &data_;\n  }\n\n  const detail::VariantData* getData() const {\n    return &data_;\n  }\n\n  detail::VariantData* getOrCreateData() {\n    return &data_;\n  }\n\n  mutable detail::ResourceManager resources_;\n  mutable detail::VariantData data_;\n};\n\ninline bool convertToJson(const JsonDocument& src, JsonVariant dst) {\n  return dst.set(src.as<JsonVariantConst>());\n}\n\nARDUINOJSON_END_PUBLIC_NAMESPACE\n"
  },
  {
    "path": "src/ArduinoJson/Json/EscapeSequence.hpp",
    "content": "// ArduinoJson - https://arduinojson.org\n// Copyright © 2014-2025, Benoit BLANCHON\n// MIT License\n\n#pragma once\n\n#include <ArduinoJson/Namespace.hpp>\n\nARDUINOJSON_BEGIN_PRIVATE_NAMESPACE\n\nclass EscapeSequence {\n public:\n  // Optimized for code size on a 8-bit AVR\n  static char escapeChar(char c) {\n    const char* p = escapeTable(true);\n    while (p[0] && p[1] != c) {\n      p += 2;\n    }\n    return p[0];\n  }\n\n  // Optimized for code size on a 8-bit AVR\n  static char unescapeChar(char c) {\n    const char* p = escapeTable(false);\n    for (;;) {\n      if (p[0] == '\\0')\n        return 0;\n      if (p[0] == c)\n        return p[1];\n      p += 2;\n    }\n  }\n\n private:\n  static const char* escapeTable(bool isSerializing) {\n    return &\"//''\\\"\\\"\\\\\\\\b\\bf\\fn\\nr\\rt\\t\"[isSerializing ? 4 : 0];\n  }\n};\n\nARDUINOJSON_END_PRIVATE_NAMESPACE\n"
  },
  {
    "path": "src/ArduinoJson/Json/JsonDeserializer.hpp",
    "content": "// ArduinoJson - https://arduinojson.org\n// Copyright © 2014-2025, Benoit BLANCHON\n// MIT License\n\n#pragma once\n\n#include <ArduinoJson/Deserialization/deserialize.hpp>\n#include <ArduinoJson/Json/EscapeSequence.hpp>\n#include <ArduinoJson/Json/Latch.hpp>\n#include <ArduinoJson/Json/Utf16.hpp>\n#include <ArduinoJson/Json/Utf8.hpp>\n#include <ArduinoJson/Memory/ResourceManager.hpp>\n#include <ArduinoJson/Numbers/parseNumber.hpp>\n#include <ArduinoJson/Polyfills/assert.hpp>\n#include <ArduinoJson/Polyfills/type_traits.hpp>\n#include <ArduinoJson/Polyfills/utility.hpp>\n#include <ArduinoJson/Variant/VariantData.hpp>\n\nARDUINOJSON_BEGIN_PRIVATE_NAMESPACE\n\ntemplate <typename TReader>\nclass JsonDeserializer {\n public:\n  JsonDeserializer(ResourceManager* resources, TReader reader)\n      : stringBuilder_(resources),\n        foundSomething_(false),\n        latch_(reader),\n        resources_(resources) {}\n\n  template <typename TFilter>\n  DeserializationError parse(VariantData* variant, TFilter filter,\n                             DeserializationOption::NestingLimit nestingLimit) {\n    DeserializationError::Code err;\n\n    err = parseVariant(variant, filter, nestingLimit);\n\n    if (!err && latch_.last() != 0 && variant->isFloat()) {\n      // We don't detect trailing characters earlier, so we need to check now\n      return DeserializationError::InvalidInput;\n    }\n\n    return err;\n  }\n\n private:\n  char current() {\n    return latch_.current();\n  }\n\n  void move() {\n    latch_.clear();\n  }\n\n  bool eat(char charToSkip) {\n    if (current() != charToSkip)\n      return false;\n    move();\n    return true;\n  }\n\n  template <typename TFilter>\n  DeserializationError::Code parseVariant(\n      VariantData* variant, TFilter filter,\n      DeserializationOption::NestingLimit nestingLimit) {\n    DeserializationError::Code err;\n\n    err = skipSpacesAndComments();\n    if (err)\n      return err;\n\n    switch (current()) {\n      case '[':\n        if (filter.allowArray())\n          return parseArray(variant, filter, nestingLimit);\n        else\n          return skipArray(nestingLimit);\n\n      case '{':\n        if (filter.allowObject())\n          return parseObject(variant, filter, nestingLimit);\n        else\n          return skipObject(nestingLimit);\n\n      case '\\\"':\n      case '\\'':\n        if (filter.allowValue())\n          return parseStringValue(variant);\n        else\n          return skipQuotedString();\n\n      case 't':\n        if (filter.allowValue())\n          variant->setBoolean(true);\n        return skipKeyword(\"true\");\n\n      case 'f':\n        if (filter.allowValue())\n          variant->setBoolean(false);\n        return skipKeyword(\"false\");\n\n      case 'n':\n        // the variant should already by null, except if the same object key was\n        // used twice, as in {\"a\":1,\"a\":null}\n        return skipKeyword(\"null\");\n\n      default:\n        if (filter.allowValue())\n          return parseNumericValue(variant);\n        else\n          return skipNumericValue();\n    }\n  }\n\n  DeserializationError::Code skipVariant(\n      DeserializationOption::NestingLimit nestingLimit) {\n    DeserializationError::Code err;\n\n    err = skipSpacesAndComments();\n    if (err)\n      return err;\n\n    switch (current()) {\n      case '[':\n        return skipArray(nestingLimit);\n\n      case '{':\n        return skipObject(nestingLimit);\n\n      case '\\\"':\n      case '\\'':\n        return skipQuotedString();\n\n      case 't':\n        return skipKeyword(\"true\");\n\n      case 'f':\n        return skipKeyword(\"false\");\n\n      case 'n':\n        return skipKeyword(\"null\");\n\n      default:\n        return skipNumericValue();\n    }\n  }\n\n  template <typename TFilter>\n  DeserializationError::Code parseArray(\n      VariantData* array, TFilter filter,\n      DeserializationOption::NestingLimit nestingLimit) {\n    DeserializationError::Code err;\n\n    array->toArray();\n\n    if (nestingLimit.reached())\n      return DeserializationError::TooDeep;\n\n    // Skip opening braket\n    ARDUINOJSON_ASSERT(current() == '[');\n    move();\n\n    // Skip spaces\n    err = skipSpacesAndComments();\n    if (err)\n      return err;\n\n    // Empty array?\n    if (eat(']'))\n      return DeserializationError::Ok;\n\n    TFilter elementFilter = filter[0UL];\n\n    // Read each value\n    for (;;) {\n      if (elementFilter.allow()) {\n        // Allocate slot in array\n        VariantData* value = VariantImpl::addNewElement(array, resources_);\n        if (!value)\n          return DeserializationError::NoMemory;\n\n        // 1 - Parse value\n        err = parseVariant(value, elementFilter, nestingLimit.decrement());\n        if (err)\n          return err;\n      } else {\n        err = skipVariant(nestingLimit.decrement());\n        if (err)\n          return err;\n      }\n\n      // 2 - Skip spaces\n      err = skipSpacesAndComments();\n      if (err)\n        return err;\n\n      // 3 - More values?\n      if (eat(']'))\n        return DeserializationError::Ok;\n      if (!eat(','))\n        return DeserializationError::InvalidInput;\n    }\n  }\n\n  DeserializationError::Code skipArray(\n      DeserializationOption::NestingLimit nestingLimit) {\n    DeserializationError::Code err;\n\n    if (nestingLimit.reached())\n      return DeserializationError::TooDeep;\n\n    // Skip opening braket\n    ARDUINOJSON_ASSERT(current() == '[');\n    move();\n\n    // Read each value\n    for (;;) {\n      // 1 - Skip value\n      err = skipVariant(nestingLimit.decrement());\n      if (err)\n        return err;\n\n      // 2 - Skip spaces\n      err = skipSpacesAndComments();\n      if (err)\n        return err;\n\n      // 3 - More values?\n      if (eat(']'))\n        return DeserializationError::Ok;\n      if (!eat(','))\n        return DeserializationError::InvalidInput;\n    }\n  }\n\n  template <typename TFilter>\n  DeserializationError::Code parseObject(\n      VariantData* object, TFilter filter,\n      DeserializationOption::NestingLimit nestingLimit) {\n    DeserializationError::Code err;\n\n    object->toObject();\n\n    if (nestingLimit.reached())\n      return DeserializationError::TooDeep;\n\n    // Skip opening brace\n    ARDUINOJSON_ASSERT(current() == '{');\n    move();\n\n    // Skip spaces\n    err = skipSpacesAndComments();\n    if (err)\n      return err;\n\n    // Empty object?\n    if (eat('}'))\n      return DeserializationError::Ok;\n\n    // Read each key value pair\n    for (;;) {\n      // Parse key\n      err = parseKey();\n      if (err)\n        return err;\n\n      // Skip spaces\n      err = skipSpacesAndComments();\n      if (err)\n        return err;\n\n      // Colon\n      if (!eat(':'))\n        return DeserializationError::InvalidInput;\n\n      JsonString key = stringBuilder_.str();\n\n      TFilter memberFilter = filter[key];\n\n      if (memberFilter.allow()) {\n        auto member =\n            VariantImpl::getMember(adaptString(key), object, resources_);\n        if (!member) {\n          auto keyVariant = VariantImpl::addPair(&member, object, resources_);\n          if (!keyVariant)\n            return DeserializationError::NoMemory;\n\n          stringBuilder_.save(keyVariant);\n        } else {\n          VariantImpl::clear(member, resources_);\n        }\n\n        // Parse value\n        err = parseVariant(member, memberFilter, nestingLimit.decrement());\n        if (err)\n          return err;\n      } else {\n        err = skipVariant(nestingLimit.decrement());\n        if (err)\n          return err;\n      }\n\n      // Skip spaces\n      err = skipSpacesAndComments();\n      if (err)\n        return err;\n\n      // More keys/values?\n      if (eat('}'))\n        return DeserializationError::Ok;\n      if (!eat(','))\n        return DeserializationError::InvalidInput;\n\n      // Skip spaces\n      err = skipSpacesAndComments();\n      if (err)\n        return err;\n    }\n  }\n\n  DeserializationError::Code skipObject(\n      DeserializationOption::NestingLimit nestingLimit) {\n    DeserializationError::Code err;\n\n    if (nestingLimit.reached())\n      return DeserializationError::TooDeep;\n\n    // Skip opening brace\n    ARDUINOJSON_ASSERT(current() == '{');\n    move();\n\n    // Skip spaces\n    err = skipSpacesAndComments();\n    if (err)\n      return err;\n\n    // Empty object?\n    if (eat('}'))\n      return DeserializationError::Ok;\n\n    // Read each key value pair\n    for (;;) {\n      // Skip key\n      err = skipKey();\n      if (err)\n        return err;\n\n      // Skip spaces\n      err = skipSpacesAndComments();\n      if (err)\n        return err;\n\n      // Colon\n      if (!eat(':'))\n        return DeserializationError::InvalidInput;\n\n      // Skip value\n      err = skipVariant(nestingLimit.decrement());\n      if (err)\n        return err;\n\n      // Skip spaces\n      err = skipSpacesAndComments();\n      if (err)\n        return err;\n\n      // More keys/values?\n      if (eat('}'))\n        return DeserializationError::Ok;\n      if (!eat(','))\n        return DeserializationError::InvalidInput;\n\n      err = skipSpacesAndComments();\n      if (err)\n        return err;\n    }\n  }\n\n  DeserializationError::Code parseKey() {\n    stringBuilder_.startString();\n    if (isQuote(current())) {\n      return parseQuotedString();\n    } else {\n      return parseNonQuotedString();\n    }\n  }\n\n  DeserializationError::Code parseStringValue(VariantData* variant) {\n    DeserializationError::Code err;\n\n    stringBuilder_.startString();\n\n    err = parseQuotedString();\n    if (err)\n      return err;\n\n    stringBuilder_.save(variant);\n\n    return DeserializationError::Ok;\n  }\n\n  DeserializationError::Code parseQuotedString() {\n#if ARDUINOJSON_DECODE_UNICODE\n    Utf16::Codepoint codepoint;\n    DeserializationError::Code err;\n#endif\n    const char stopChar = current();\n\n    move();\n    for (;;) {\n      char c = current();\n      move();\n      if (c == stopChar)\n        break;\n\n      if (c == '\\0')\n        return DeserializationError::IncompleteInput;\n\n      if (c == '\\\\') {\n        c = current();\n\n        if (c == '\\0')\n          return DeserializationError::IncompleteInput;\n\n        if (c == 'u') {\n#if ARDUINOJSON_DECODE_UNICODE\n          move();\n          uint16_t codeunit;\n          err = parseHex4(codeunit);\n          if (err)\n            return err;\n          if (codepoint.append(codeunit))\n            Utf8::encodeCodepoint(codepoint.value(), stringBuilder_);\n#else\n          stringBuilder_.append('\\\\');\n#endif\n          continue;\n        }\n\n        // replace char\n        c = EscapeSequence::unescapeChar(c);\n        if (c == '\\0')\n          return DeserializationError::InvalidInput;\n        move();\n      }\n\n      stringBuilder_.append(c);\n    }\n\n    if (!stringBuilder_.isValid())\n      return DeserializationError::NoMemory;\n\n    return DeserializationError::Ok;\n  }\n\n  DeserializationError::Code parseNonQuotedString() {\n    char c = current();\n    ARDUINOJSON_ASSERT(c);\n\n    if (canBeInNonQuotedString(c)) {  // no quotes\n      do {\n        move();\n        stringBuilder_.append(c);\n        c = current();\n      } while (canBeInNonQuotedString(c));\n    } else {\n      return DeserializationError::InvalidInput;\n    }\n\n    if (!stringBuilder_.isValid())\n      return DeserializationError::NoMemory;\n\n    return DeserializationError::Ok;\n  }\n\n  DeserializationError::Code skipKey() {\n    if (isQuote(current())) {\n      return skipQuotedString();\n    } else {\n      return skipNonQuotedString();\n    }\n  }\n\n  DeserializationError::Code skipQuotedString() {\n    const char stopChar = current();\n\n    move();\n    for (;;) {\n      char c = current();\n      move();\n      if (c == stopChar)\n        break;\n      if (c == '\\0')\n        return DeserializationError::IncompleteInput;\n      if (c == '\\\\') {\n        if (current() != '\\0')\n          move();\n      }\n    }\n\n    return DeserializationError::Ok;\n  }\n\n  DeserializationError::Code skipNonQuotedString() {\n    char c = current();\n    while (canBeInNonQuotedString(c)) {\n      move();\n      c = current();\n    }\n    return DeserializationError::Ok;\n  }\n\n  DeserializationError::Code parseNumericValue(VariantData* result) {\n    uint8_t n = 0;\n\n    char c = current();\n    while (canBeInNumber(c) && n < 63) {\n      move();\n      buffer_[n++] = c;\n      c = current();\n    }\n    buffer_[n] = 0;\n\n    auto number = parseNumber(buffer_);\n    switch (number.type()) {\n      case NumberType::UnsignedInteger:\n        if (VariantImpl::setInteger(number.asUnsignedInteger(), result,\n                                    resources_))\n          return DeserializationError::Ok;\n        else\n          return DeserializationError::NoMemory;\n\n      case NumberType::SignedInteger:\n        if (VariantImpl::setInteger(number.asSignedInteger(), result,\n                                    resources_))\n          return DeserializationError::Ok;\n        else\n          return DeserializationError::NoMemory;\n\n      case NumberType::Float:\n        if (VariantImpl::setFloat(number.asFloat(), result, resources_))\n          return DeserializationError::Ok;\n        else\n          return DeserializationError::NoMemory;\n\n#if ARDUINOJSON_USE_DOUBLE\n      case NumberType::Double:\n        if (VariantImpl::setFloat(number.asDouble(), result, resources_))\n          return DeserializationError::Ok;\n        else\n          return DeserializationError::NoMemory;\n#endif\n\n      default:\n        return DeserializationError::InvalidInput;\n    }\n  }\n\n  DeserializationError::Code skipNumericValue() {\n    char c = current();\n    while (canBeInNumber(c)) {\n      move();\n      c = current();\n    }\n    return DeserializationError::Ok;\n  }\n\n  DeserializationError::Code parseHex4(uint16_t& result) {\n    result = 0;\n    for (uint8_t i = 0; i < 4; ++i) {\n      char digit = current();\n      if (!digit)\n        return DeserializationError::IncompleteInput;\n      uint8_t value = decodeHex(digit);\n      if (value > 0x0F)\n        return DeserializationError::InvalidInput;\n      result = uint16_t((result << 4) | value);\n      move();\n    }\n    return DeserializationError::Ok;\n  }\n\n  static inline bool isBetween(char c, char min, char max) {\n    return min <= c && c <= max;\n  }\n\n  static inline bool canBeInNumber(char c) {\n    return isBetween(c, '0', '9') || c == '+' || c == '-' || c == '.' ||\n#if ARDUINOJSON_ENABLE_NAN || ARDUINOJSON_ENABLE_INFINITY\n           isBetween(c, 'A', 'Z') || isBetween(c, 'a', 'z');\n#else\n           c == 'e' || c == 'E';\n#endif\n  }\n\n  static inline bool canBeInNonQuotedString(char c) {\n    return isBetween(c, '0', '9') || isBetween(c, '_', 'z') ||\n           isBetween(c, 'A', 'Z');\n  }\n\n  static inline bool isQuote(char c) {\n    return c == '\\'' || c == '\\\"';\n  }\n\n  static inline uint8_t decodeHex(char c) {\n    if (c < 'A')\n      return uint8_t(c - '0');\n    c = char(c & ~0x20);  // uppercase\n    return uint8_t(c - 'A' + 10);\n  }\n\n  DeserializationError::Code skipSpacesAndComments() {\n    for (;;) {\n      switch (current()) {\n        // end of string\n        case '\\0':\n          return foundSomething_ ? DeserializationError::IncompleteInput\n                                 : DeserializationError::EmptyInput;\n\n        // spaces\n        case ' ':\n        case '\\t':\n        case '\\r':\n        case '\\n':\n          move();\n          continue;\n\n#if ARDUINOJSON_ENABLE_COMMENTS\n        // comments\n        case '/':\n          move();  // skip '/'\n          switch (current()) {\n            // block comment\n            case '*': {\n              move();  // skip '*'\n              bool wasStar = false;\n              for (;;) {\n                char c = current();\n                if (c == '\\0')\n                  return DeserializationError::IncompleteInput;\n                if (c == '/' && wasStar) {\n                  move();\n                  break;\n                }\n                wasStar = c == '*';\n                move();\n              }\n              break;\n            }\n\n            // trailing comment\n            case '/':\n              // no need to skip \"//\"\n              for (;;) {\n                move();\n                char c = current();\n                if (c == '\\0')\n                  return DeserializationError::IncompleteInput;\n                if (c == '\\n')\n                  break;\n              }\n              break;\n\n            // not a comment, just a '/'\n            default:\n              return DeserializationError::InvalidInput;\n          }\n          break;\n#endif\n\n        default:\n          foundSomething_ = true;\n          return DeserializationError::Ok;\n      }\n    }\n  }\n\n  DeserializationError::Code skipKeyword(const char* s) {\n    while (*s) {\n      char c = current();\n      if (c == '\\0')\n        return DeserializationError::IncompleteInput;\n      if (*s != c)\n        return DeserializationError::InvalidInput;\n      ++s;\n      move();\n    }\n    return DeserializationError::Ok;\n  }\n\n  StringBuilder stringBuilder_;\n  bool foundSomething_;\n  Latch<TReader> latch_;\n  ResourceManager* resources_;\n  char buffer_[64];  // using a member instead of a local variable because it\n                     // ended in the recursive path after compiler inlined the\n                     // code\n};\n\nARDUINOJSON_END_PRIVATE_NAMESPACE\n\nARDUINOJSON_BEGIN_PUBLIC_NAMESPACE\n\n// Parses a JSON input, filters, and puts the result in a JsonDocument.\n// https://arduinojson.org/v7/api/json/deserializejson/\ntemplate <typename TDestination, typename... Args,\n          detail::enable_if_t<\n              detail::is_deserialize_destination<TDestination>::value, int> = 0>\ninline DeserializationError deserializeJson(TDestination&& dst,\n                                            Args&&... args) {\n  using namespace detail;\n  return deserialize<JsonDeserializer>(detail::forward<TDestination>(dst),\n                                       detail::forward<Args>(args)...);\n}\n\n// Parses a JSON input, filters, and puts the result in a JsonDocument.\n// https://arduinojson.org/v7/api/json/deserializejson/\ntemplate <typename TDestination, typename TChar, typename... Args,\n          detail::enable_if_t<\n              detail::is_deserialize_destination<TDestination>::value, int> = 0>\ninline DeserializationError deserializeJson(TDestination&& dst, TChar* input,\n                                            Args&&... args) {\n  using namespace detail;\n  return deserialize<JsonDeserializer>(detail::forward<TDestination>(dst),\n                                       input, detail::forward<Args>(args)...);\n}\n\nARDUINOJSON_END_PUBLIC_NAMESPACE\n"
  },
  {
    "path": "src/ArduinoJson/Json/JsonSerializer.hpp",
    "content": "// ArduinoJson - https://arduinojson.org\n// Copyright © 2014-2025, Benoit BLANCHON\n// MIT License\n\n#pragma once\n\n#include <ArduinoJson/Json/TextFormatter.hpp>\n#include <ArduinoJson/Serialization/measure.hpp>\n#include <ArduinoJson/Serialization/serialize.hpp>\n#include <ArduinoJson/Variant/VariantDataVisitor.hpp>\n\nARDUINOJSON_BEGIN_PRIVATE_NAMESPACE\n\ntemplate <typename TWriter>\nclass JsonSerializer : public VariantDataVisitor<size_t> {\n public:\n  static const bool producesText = true;\n\n  JsonSerializer(TWriter writer, ResourceManager* resources)\n      : formatter_(writer), resources_(resources) {}\n\n  size_t visitArray(VariantData* array) {\n    ARDUINOJSON_ASSERT(array != nullptr);\n    ARDUINOJSON_ASSERT(array->isArray());\n\n    write('[');\n\n    auto slotId = array->content.asCollection.head;\n\n    while (slotId != NULL_SLOT) {\n      auto slot = resources_->getVariant(slotId);\n\n      VariantImpl::accept(*this, slot, resources_);\n\n      slotId = slot->next;\n\n      if (slotId != NULL_SLOT)\n        write(',');\n    }\n\n    write(']');\n    return bytesWritten();\n  }\n\n  size_t visitObject(VariantData* object) {\n    ARDUINOJSON_ASSERT(object != nullptr);\n    ARDUINOJSON_ASSERT(object->isObject());\n\n    write('{');\n\n    auto slotId = object->content.asCollection.head;\n\n    bool isKey = true;\n\n    while (slotId != NULL_SLOT) {\n      auto slot = resources_->getVariant(slotId);\n      VariantImpl::accept(*this, slot, resources_);\n\n      slotId = slot->next;\n\n      if (slotId != NULL_SLOT)\n        write(isKey ? ':' : ',');\n\n      isKey = !isKey;\n    }\n\n    write('}');\n    return bytesWritten();\n  }\n\n  template <typename T>\n  enable_if_t<is_floating_point<T>::value, size_t> visit(T value) {\n    formatter_.writeFloat(value);\n    return bytesWritten();\n  }\n\n  size_t visit(const char* value) {\n    formatter_.writeString(value);\n    return bytesWritten();\n  }\n\n  size_t visit(JsonString value) {\n    formatter_.writeString(value.c_str(), value.size());\n    return bytesWritten();\n  }\n\n  size_t visit(RawString value) {\n    formatter_.writeRaw(value.data(), value.size());\n    return bytesWritten();\n  }\n\n  size_t visit(JsonInteger value) {\n    formatter_.writeInteger(value);\n    return bytesWritten();\n  }\n\n  size_t visit(JsonUInt value) {\n    formatter_.writeInteger(value);\n    return bytesWritten();\n  }\n\n  size_t visit(bool value) {\n    formatter_.writeBoolean(value);\n    return bytesWritten();\n  }\n\n  size_t visit(nullptr_t) {\n    formatter_.writeRaw(\"null\");\n    return bytesWritten();\n  }\n\n protected:\n  size_t bytesWritten() const {\n    return formatter_.bytesWritten();\n  }\n\n  void write(char c) {\n    formatter_.writeRaw(c);\n  }\n\n  void write(const char* s) {\n    formatter_.writeRaw(s);\n  }\n\n private:\n  TextFormatter<TWriter> formatter_;\n\n protected:\n  ResourceManager* resources_;\n};\n\nARDUINOJSON_END_PRIVATE_NAMESPACE\n\nARDUINOJSON_BEGIN_PUBLIC_NAMESPACE\n\n// Produces a minified JSON document.\n// https://arduinojson.org/v7/api/json/serializejson/\ntemplate <\n    typename TDestination,\n    detail::enable_if_t<!detail::is_pointer<TDestination>::value, int> = 0>\nsize_t serializeJson(JsonVariantConst source, TDestination& destination) {\n  using namespace detail;\n  return serialize<JsonSerializer>(source, destination);\n}\n\n// Produces a minified JSON document.\n// https://arduinojson.org/v7/api/json/serializejson/\ninline size_t serializeJson(JsonVariantConst source, void* buffer,\n                            size_t bufferSize) {\n  using namespace detail;\n  return serialize<JsonSerializer>(source, buffer, bufferSize);\n}\n\n// Computes the length of the document that serializeJson() produces.\n// https://arduinojson.org/v7/api/json/measurejson/\ninline size_t measureJson(JsonVariantConst source) {\n  using namespace detail;\n  return measure<JsonSerializer>(source);\n}\n\n#if ARDUINOJSON_ENABLE_STD_STREAM\ntemplate <typename T,\n          detail::enable_if_t<\n              detail::is_convertible<T, JsonVariantConst>::value, int> = 0>\ninline std::ostream& operator<<(std::ostream& os, const T& source) {\n  serializeJson(source, os);\n  return os;\n}\n#endif\n\nARDUINOJSON_END_PUBLIC_NAMESPACE\n"
  },
  {
    "path": "src/ArduinoJson/Json/Latch.hpp",
    "content": "// ArduinoJson - https://arduinojson.org\n// Copyright © 2014-2025, Benoit BLANCHON\n// MIT License\n\n#pragma once\n\n#include <ArduinoJson/Polyfills/assert.hpp>\n\nARDUINOJSON_BEGIN_PRIVATE_NAMESPACE\n\ntemplate <typename TReader>\nclass Latch {\n public:\n  Latch(TReader reader) : reader_(reader), loaded_(false) {\n#if ARDUINOJSON_DEBUG\n    ended_ = false;\n#endif\n  }\n\n  void clear() {\n    loaded_ = false;\n  }\n\n  int last() const {\n    return current_;\n  }\n\n  FORCE_INLINE char current() {\n    if (!loaded_) {\n      load();\n    }\n    return current_;\n  }\n\n private:\n  void load() {\n    ARDUINOJSON_ASSERT(!ended_);\n    int c = reader_.read();\n#if ARDUINOJSON_DEBUG\n    if (c <= 0)\n      ended_ = true;\n#endif\n    current_ = static_cast<char>(c > 0 ? c : 0);\n    loaded_ = true;\n  }\n\n  TReader reader_;\n  char current_;  // NOLINT(clang-analyzer-optin.cplusplus.UninitializedObject)\n                  // Not initialized in constructor (+10 bytes on AVR)\n  bool loaded_;\n#if ARDUINOJSON_DEBUG\n  bool ended_;\n#endif\n};\n\nARDUINOJSON_END_PRIVATE_NAMESPACE\n"
  },
  {
    "path": "src/ArduinoJson/Json/PrettyJsonSerializer.hpp",
    "content": "// ArduinoJson - https://arduinojson.org\n// Copyright © 2014-2025, Benoit BLANCHON\n// MIT License\n\n#pragma once\n\n#include <ArduinoJson/Configuration.hpp>\n#include <ArduinoJson/Json/JsonSerializer.hpp>\n#include <ArduinoJson/Serialization/measure.hpp>\n#include <ArduinoJson/Serialization/serialize.hpp>\n\nARDUINOJSON_BEGIN_PRIVATE_NAMESPACE\n\ntemplate <typename TWriter>\nclass PrettyJsonSerializer : public JsonSerializer<TWriter> {\n  using base = JsonSerializer<TWriter>;\n\n public:\n  PrettyJsonSerializer(TWriter writer, ResourceManager* resources)\n      : base(writer, resources), nesting_(0) {}\n\n  size_t visitArray(VariantData* array) {\n    ARDUINOJSON_ASSERT(array != nullptr);\n    ARDUINOJSON_ASSERT(array->isArray());\n\n    auto slotId = array->content.asCollection.head;\n    if (slotId != NULL_SLOT) {\n      base::write(\"[\\r\\n\");\n      nesting_++;\n      while (slotId != NULL_SLOT) {\n        indent();\n        auto slot = base::resources_->getVariant(slotId);\n        VariantImpl::accept(*this, slot, base::resources_);\n\n        slotId = slot->next;\n        base::write(slotId == NULL_SLOT ? \"\\r\\n\" : \",\\r\\n\");\n      }\n      nesting_--;\n      indent();\n      base::write(\"]\");\n    } else {\n      base::write(\"[]\");\n    }\n    return this->bytesWritten();\n  }\n\n  size_t visitObject(VariantData* object) {\n    ARDUINOJSON_ASSERT(object != nullptr);\n    ARDUINOJSON_ASSERT(object->isObject());\n\n    auto slotId = object->content.asCollection.head;\n    if (slotId != NULL_SLOT) {\n      base::write(\"{\\r\\n\");\n      nesting_++;\n      bool isKey = true;\n      while (slotId != NULL_SLOT) {\n        if (isKey)\n          indent();\n        auto slot = base::resources_->getVariant(slotId);\n        VariantImpl::accept(*this, slot, base::resources_);\n        slotId = slot->next;\n        if (isKey)\n          base::write(\": \");\n        else\n          base::write(slotId == NULL_SLOT ? \"\\r\\n\" : \",\\r\\n\");\n        isKey = !isKey;\n      }\n      nesting_--;\n      indent();\n      base::write(\"}\");\n    } else {\n      base::write(\"{}\");\n    }\n    return this->bytesWritten();\n  }\n\n  using base::visit;\n\n private:\n  void indent() {\n    for (uint8_t i = 0; i < nesting_; i++)\n      base::write(ARDUINOJSON_TAB);\n  }\n\n  uint8_t nesting_;\n};\n\nARDUINOJSON_END_PRIVATE_NAMESPACE\n\nARDUINOJSON_BEGIN_PUBLIC_NAMESPACE\n\n// Produces JsonDocument to create a prettified JSON document.\n// https://arduinojson.org/v7/api/json/serializejsonpretty/\ntemplate <\n    typename TDestination,\n    detail::enable_if_t<!detail::is_pointer<TDestination>::value, int> = 0>\ninline size_t serializeJsonPretty(JsonVariantConst source,\n                                  TDestination& destination) {\n  using namespace ArduinoJson::detail;\n  return serialize<PrettyJsonSerializer>(source, destination);\n}\n\n// Produces JsonDocument to create a prettified JSON document.\n// https://arduinojson.org/v7/api/json/serializejsonpretty/\ninline size_t serializeJsonPretty(JsonVariantConst source, void* buffer,\n                                  size_t bufferSize) {\n  using namespace ArduinoJson::detail;\n  return serialize<PrettyJsonSerializer>(source, buffer, bufferSize);\n}\n\n// Computes the length of the document that serializeJsonPretty() produces.\n// https://arduinojson.org/v7/api/json/measurejsonpretty/\ninline size_t measureJsonPretty(JsonVariantConst source) {\n  using namespace ArduinoJson::detail;\n  return measure<PrettyJsonSerializer>(source);\n}\n\nARDUINOJSON_END_PUBLIC_NAMESPACE\n"
  },
  {
    "path": "src/ArduinoJson/Json/TextFormatter.hpp",
    "content": "// ArduinoJson - https://arduinojson.org\n// Copyright © 2014-2025, Benoit BLANCHON\n// MIT License\n\n#pragma once\n\n#include <stdint.h>\n#include <string.h>  // for strlen\n\n#include <ArduinoJson/Json/EscapeSequence.hpp>\n#include <ArduinoJson/Numbers/FloatParts.hpp>\n#include <ArduinoJson/Numbers/JsonInteger.hpp>\n#include <ArduinoJson/Polyfills/assert.hpp>\n#include <ArduinoJson/Polyfills/attributes.hpp>\n#include <ArduinoJson/Polyfills/type_traits.hpp>\n#include <ArduinoJson/Serialization/CountingDecorator.hpp>\n\nARDUINOJSON_BEGIN_PRIVATE_NAMESPACE\n\ntemplate <typename TWriter>\nclass TextFormatter {\n public:\n  explicit TextFormatter(TWriter writer) : writer_(writer) {}\n\n  TextFormatter& operator=(const TextFormatter&) = delete;\n\n  // Returns the number of bytes sent to the TWriter implementation.\n  size_t bytesWritten() const {\n    return writer_.count();\n  }\n\n  void writeBoolean(bool value) {\n    if (value)\n      writeRaw(\"true\");\n    else\n      writeRaw(\"false\");\n  }\n\n  void writeString(const char* value) {\n    ARDUINOJSON_ASSERT(value != NULL);\n    writeRaw('\\\"');\n    while (*value)\n      writeChar(*value++);\n    writeRaw('\\\"');\n  }\n\n  void writeString(const char* value, size_t n) {\n    ARDUINOJSON_ASSERT(value != NULL);\n    writeRaw('\\\"');\n    while (n--)\n      writeChar(*value++);\n    writeRaw('\\\"');\n  }\n\n  void writeChar(char c) {\n    char specialChar = EscapeSequence::escapeChar(c);\n    if (specialChar) {\n      writeRaw('\\\\');\n      writeRaw(specialChar);\n    } else if (c) {\n      writeRaw(c);\n    } else {\n      writeRaw(\"\\\\u0000\");\n    }\n  }\n\n  template <typename T>\n  void writeFloat(T value) {\n    writeFloat(JsonFloat(value), sizeof(T) >= 8 ? 9 : 6);\n  }\n\n  void writeFloat(JsonFloat value, int8_t decimalPlaces) {\n    if (isnan(value))\n      return writeRaw(ARDUINOJSON_ENABLE_NAN ? \"NaN\" : \"null\");\n\n#if ARDUINOJSON_ENABLE_INFINITY\n    if (value < 0.0) {\n      writeRaw('-');\n      value = -value;\n    }\n\n    if (isinf(value))\n      return writeRaw(\"Infinity\");\n#else\n    if (isinf(value))\n      return writeRaw(\"null\");\n\n    if (value < 0.0) {\n      writeRaw('-');\n      value = -value;\n    }\n#endif\n\n    auto parts = decomposeFloat(value, decimalPlaces);\n\n    writeInteger(parts.integral);\n    if (parts.decimalPlaces)\n      writeDecimals(parts.decimal, parts.decimalPlaces);\n\n    if (parts.exponent) {\n      writeRaw('e');\n      writeInteger(parts.exponent);\n    }\n  }\n\n  template <typename T>\n  enable_if_t<is_signed<T>::value> writeInteger(T value) {\n    using unsigned_type = make_unsigned_t<T>;\n    unsigned_type unsigned_value;\n    if (value < 0) {\n      writeRaw('-');\n      unsigned_value = unsigned_type(unsigned_type(~value) + 1);\n    } else {\n      unsigned_value = unsigned_type(value);\n    }\n    writeInteger(unsigned_value);\n  }\n\n  template <typename T>\n  enable_if_t<is_unsigned<T>::value> writeInteger(T value) {\n    char buffer[22];\n    char* end = buffer + sizeof(buffer);\n    char* begin = end;\n\n    // write the string in reverse order\n    do {\n      *--begin = char(value % 10 + '0');\n      value = T(value / 10);\n    } while (value);\n\n    // and dump it in the right order\n    writeRaw(begin, end);\n  }\n\n  void writeDecimals(uint32_t value, int8_t width) {\n    // buffer should be big enough for all digits and the dot\n    char buffer[16];\n    char* end = buffer + sizeof(buffer);\n    char* begin = end;\n\n    // write the string in reverse order\n    while (width--) {\n      *--begin = char(value % 10 + '0');\n      value /= 10;\n    }\n    *--begin = '.';\n\n    // and dump it in the right order\n    writeRaw(begin, end);\n  }\n\n  void writeRaw(const char* s) {\n    writer_.write(reinterpret_cast<const uint8_t*>(s), strlen(s));\n  }\n\n  void writeRaw(const char* s, size_t n) {\n    writer_.write(reinterpret_cast<const uint8_t*>(s), n);\n  }\n\n  void writeRaw(const char* begin, const char* end) {\n    writer_.write(reinterpret_cast<const uint8_t*>(begin),\n                  static_cast<size_t>(end - begin));\n  }\n\n  template <size_t N>\n  void writeRaw(const char (&s)[N]) {\n    writer_.write(reinterpret_cast<const uint8_t*>(s), N - 1);\n  }\n  void writeRaw(char c) {\n    writer_.write(static_cast<uint8_t>(c));\n  }\n\n protected:\n  CountingDecorator<TWriter> writer_;\n};\n\nARDUINOJSON_END_PRIVATE_NAMESPACE\n"
  },
  {
    "path": "src/ArduinoJson/Json/Utf16.hpp",
    "content": "// ArduinoJson - https://arduinojson.org\n// Copyright © 2014-2025, Benoit BLANCHON\n// MIT License\n\n#pragma once\n\n#include <ArduinoJson/Namespace.hpp>\n\n#include <stdint.h>  // uint16_t, uint32_t\n\n// The high surrogate may be uninitialized if the pair is invalid,\n// we choose to ignore the problem to reduce the size of the code\n// Garbage in => Garbage out\n#if defined(__GNUC__)\n#  if __GNUC__ >= 7\n#    pragma GCC diagnostic push\n#    pragma GCC diagnostic ignored \"-Wmaybe-uninitialized\"\n#  endif\n#endif\n\nARDUINOJSON_BEGIN_PRIVATE_NAMESPACE\n\nnamespace Utf16 {\ninline bool isHighSurrogate(uint16_t codeunit) {\n  return codeunit >= 0xD800 && codeunit < 0xDC00;\n}\n\ninline bool isLowSurrogate(uint16_t codeunit) {\n  return codeunit >= 0xDC00 && codeunit < 0xE000;\n}\n\nclass Codepoint {\n public:\n  Codepoint() : highSurrogate_(0), codepoint_(0) {}\n\n  bool append(uint16_t codeunit) {\n    if (isHighSurrogate(codeunit)) {\n      highSurrogate_ = codeunit & 0x3FF;\n      return false;\n    }\n\n    if (isLowSurrogate(codeunit)) {\n      codepoint_ =\n          uint32_t(0x10000 + ((highSurrogate_ << 10) | (codeunit & 0x3FF)));\n      return true;\n    }\n\n    codepoint_ = codeunit;\n    return true;\n  }\n\n  uint32_t value() const {\n    return codepoint_;\n  }\n\n private:\n  uint16_t highSurrogate_;\n  uint32_t codepoint_;\n};\n}  // namespace Utf16\nARDUINOJSON_END_PRIVATE_NAMESPACE\n\n#if defined(__GNUC__)\n#  if __GNUC__ >= 8\n#    pragma GCC diagnostic pop\n#  endif\n#endif\n"
  },
  {
    "path": "src/ArduinoJson/Json/Utf8.hpp",
    "content": "// ArduinoJson - https://arduinojson.org\n// Copyright © 2014-2025, Benoit BLANCHON\n// MIT License\n\n#pragma once\n\n#include <ArduinoJson/Namespace.hpp>\n\nARDUINOJSON_BEGIN_PRIVATE_NAMESPACE\n\nnamespace Utf8 {\ntemplate <typename TStringBuilder>\ninline void encodeCodepoint(uint32_t codepoint32, TStringBuilder& str) {\n  // this function was optimize for code size on AVR\n\n  if (codepoint32 < 0x80) {\n    str.append(char(codepoint32));\n  } else {\n    // a buffer to store the string in reverse\n    char buf[5];\n    char* p = buf;\n\n    *(p++) = 0;\n    *(p++) = char((codepoint32 | 0x80) & 0xBF);\n    uint16_t codepoint16 = uint16_t(codepoint32 >> 6);\n    if (codepoint16 < 0x20) {  // 0x800\n      *(p++) = char(codepoint16 | 0xC0);\n    } else {\n      *(p++) = char((codepoint16 | 0x80) & 0xBF);\n      codepoint16 = uint16_t(codepoint16 >> 6);\n      if (codepoint16 < 0x10) {  // 0x10000\n        *(p++) = char(codepoint16 | 0xE0);\n      } else {\n        *(p++) = char((codepoint16 | 0x80) & 0xBF);\n        codepoint16 = uint16_t(codepoint16 >> 6);\n        *(p++) = char(codepoint16 | 0xF0);\n      }\n    }\n\n    while (*(--p)) {\n      str.append(*p);\n    }\n  }\n}\n}  // namespace Utf8\nARDUINOJSON_END_PRIVATE_NAMESPACE\n"
  },
  {
    "path": "src/ArduinoJson/Memory/Alignment.hpp",
    "content": "// ArduinoJson - https://arduinojson.org\n// Copyright © 2014-2025, Benoit BLANCHON\n// MIT License\n\n#pragma once\n\n#include <ArduinoJson/Namespace.hpp>\n\n#include <stddef.h>  // size_t\n\nARDUINOJSON_BEGIN_PRIVATE_NAMESPACE\n\n#if ARDUINOJSON_ENABLE_ALIGNMENT\n\ninline bool isAligned(size_t value) {\n  const size_t mask = sizeof(void*) - 1;\n  size_t addr = value;\n  return (addr & mask) == 0;\n}\n\ninline size_t addPadding(size_t bytes) {\n  const size_t mask = sizeof(void*) - 1;\n  return (bytes + mask) & ~mask;\n}\n\ntemplate <size_t bytes>\nstruct AddPadding {\n  static const size_t mask = sizeof(void*) - 1;\n  static const size_t value = (bytes + mask) & ~mask;\n};\n\n#else\n\ninline bool isAligned(size_t) {\n  return true;\n}\n\ninline size_t addPadding(size_t bytes) {\n  return bytes;\n}\n\ntemplate <size_t bytes>\nstruct AddPadding {\n  static const size_t value = bytes;\n};\n\n#endif\n\ntemplate <typename T>\ninline bool isAligned(T* ptr) {\n  return isAligned(reinterpret_cast<size_t>(ptr));\n}\n\ntemplate <typename T>\ninline T* addPadding(T* p) {\n  size_t address = addPadding(reinterpret_cast<size_t>(p));\n  return reinterpret_cast<T*>(address);\n}\n\nARDUINOJSON_END_PRIVATE_NAMESPACE\n"
  },
  {
    "path": "src/ArduinoJson/Memory/Allocator.hpp",
    "content": "// ArduinoJson - https://arduinojson.org\n// Copyright © 2014-2025, Benoit BLANCHON\n// MIT License\n\n#pragma once\n\n#include <ArduinoJson/Namespace.hpp>\n\n#include <stdlib.h>  // malloc, free\n\nARDUINOJSON_BEGIN_PUBLIC_NAMESPACE\n\nclass Allocator {\n public:\n  virtual void* allocate(size_t size) = 0;\n  virtual void deallocate(void* ptr) = 0;\n  virtual void* reallocate(void* ptr, size_t new_size) = 0;\n\n protected:\n  ~Allocator() = default;\n};\n\nnamespace detail {\nclass DefaultAllocator : public Allocator {\n public:\n  void* allocate(size_t size) override {\n    return malloc(size);\n  }\n\n  void deallocate(void* ptr) override {\n    free(ptr);\n  }\n\n  void* reallocate(void* ptr, size_t new_size) override {\n    return realloc(ptr, new_size);\n  }\n\n  static Allocator* instance() {\n    static DefaultAllocator allocator;\n    return &allocator;\n  }\n\n private:\n  DefaultAllocator() = default;\n  ~DefaultAllocator() = default;\n};\n}  // namespace detail\n\nARDUINOJSON_END_PUBLIC_NAMESPACE\n"
  },
  {
    "path": "src/ArduinoJson/Memory/MemoryPool.hpp",
    "content": "// ArduinoJson - https://arduinojson.org\n// Copyright © 2014-2025, Benoit BLANCHON\n// MIT License\n\n#pragma once\n\n#include <ArduinoJson/Memory/Allocator.hpp>\n#include <ArduinoJson/Polyfills/assert.hpp>\n#include <ArduinoJson/Polyfills/integer.hpp>\n\nARDUINOJSON_BEGIN_PRIVATE_NAMESPACE\n\nusing SlotId = uint_t<ARDUINOJSON_SLOT_ID_SIZE * 8>;\nusing SlotCount = SlotId;\nconst SlotId NULL_SLOT = SlotId(-1);\n\ntemplate <typename T>\nclass Slot {\n public:\n  Slot() : ptr_(nullptr), id_(NULL_SLOT) {}\n  Slot(T* p, SlotId id) : ptr_(p), id_(id) {\n    ARDUINOJSON_ASSERT((p == nullptr) == (id == NULL_SLOT));\n  }\n\n  explicit operator bool() const {\n    return ptr_ != nullptr;\n  }\n\n  SlotId id() const {\n    return id_;\n  }\n\n  T* ptr() const {\n    return ptr_;\n  }\n\n  T* operator->() const {\n    ARDUINOJSON_ASSERT(ptr_ != nullptr);\n    return ptr_;\n  }\n\n private:\n  T* ptr_;\n  SlotId id_;\n};\n\ntemplate <typename T>\nclass MemoryPool {\n public:\n  void create(SlotCount cap, Allocator* allocator) {\n    ARDUINOJSON_ASSERT(cap > 0);\n    slots_ = reinterpret_cast<T*>(allocator->allocate(slotsToBytes(cap)));\n    capacity_ = slots_ ? cap : 0;\n    usage_ = 0;\n  }\n\n  void destroy(Allocator* allocator) {\n    if (slots_)\n      allocator->deallocate(slots_);\n    slots_ = nullptr;\n    capacity_ = 0;\n    usage_ = 0;\n  }\n\n  Slot<T> allocSlot() {\n    if (!slots_)\n      return {};\n    if (usage_ >= capacity_)\n      return {};\n    auto index = usage_++;\n    return {slots_ + index, SlotId(index)};\n  }\n\n  T* getSlot(SlotId id) const {\n    ARDUINOJSON_ASSERT(id < usage_);\n    return slots_ + id;\n  }\n\n  void clear() {\n    usage_ = 0;\n  }\n\n  void shrinkToFit(Allocator* allocator) {\n    auto newSlots = reinterpret_cast<T*>(\n        allocator->reallocate(slots_, slotsToBytes(usage_)));\n    if (newSlots) {\n      slots_ = newSlots;\n      capacity_ = usage_;\n    }\n  }\n\n  SlotCount usage() const {\n    return usage_;\n  }\n\n  static SlotCount bytesToSlots(size_t n) {\n    return static_cast<SlotCount>(n / sizeof(T));\n  }\n\n  static size_t slotsToBytes(SlotCount n) {\n    return n * sizeof(T);\n  }\n\n private:\n  SlotCount capacity_;\n  SlotCount usage_;\n  T* slots_;\n};\n\nARDUINOJSON_END_PRIVATE_NAMESPACE\n"
  },
  {
    "path": "src/ArduinoJson/Memory/MemoryPoolList.hpp",
    "content": "// ArduinoJson - https://arduinojson.org\n// Copyright © 2014-2025, Benoit BLANCHON\n// MIT License\n\n#pragma once\n\n#include <ArduinoJson/Memory/MemoryPool.hpp>\n#include <ArduinoJson/Polyfills/assert.hpp>\n#include <ArduinoJson/Polyfills/utility.hpp>\n\n#include <string.h>  // memcpy\n\nARDUINOJSON_BEGIN_PRIVATE_NAMESPACE\n\nusing PoolCount = SlotId;\n\ntemplate <typename T>\nclass MemoryPoolList {\n  struct FreeSlot {\n    SlotId next;\n  };\n\n  static_assert(sizeof(FreeSlot) <= sizeof(T), \"T is too small\");\n\n public:\n  using Pool = MemoryPool<T>;\n\n  MemoryPoolList() = default;\n\n  ~MemoryPoolList() {\n    ARDUINOJSON_ASSERT(count_ == 0);\n  }\n\n  friend void swap(MemoryPoolList& a, MemoryPoolList& b) {\n    bool aUsedPreallocated = a.pools_ == a.preallocatedPools_;\n    bool bUsedPreallocated = b.pools_ == b.preallocatedPools_;\n\n    // Who is using preallocated pools?\n    if (aUsedPreallocated && bUsedPreallocated) {\n      // both of us => swap preallocated pools\n      for (PoolCount i = 0; i < ARDUINOJSON_INITIAL_POOL_COUNT; i++)\n        swap_(a.preallocatedPools_[i], b.preallocatedPools_[i]);\n    } else if (bUsedPreallocated) {\n      // only b => copy b's preallocated pools and give him a's pointer\n      for (PoolCount i = 0; i < b.count_; i++)\n        a.preallocatedPools_[i] = b.preallocatedPools_[i];\n      b.pools_ = a.pools_;\n      a.pools_ = a.preallocatedPools_;\n    } else if (aUsedPreallocated) {\n      // only a => copy a's preallocated pools and give him b's pointer\n      for (PoolCount i = 0; i < a.count_; i++)\n        b.preallocatedPools_[i] = a.preallocatedPools_[i];\n      a.pools_ = b.pools_;\n      b.pools_ = b.preallocatedPools_;\n    } else {\n      // neither => swap pointers\n      swap_(a.pools_, b.pools_);\n    }\n\n    swap_(a.count_, b.count_);\n    swap_(a.capacity_, b.capacity_);\n    swap_(a.freeList_, b.freeList_);\n  }\n\n  MemoryPoolList& operator=(MemoryPoolList&& src) {\n    ARDUINOJSON_ASSERT(count_ == 0);\n    if (src.pools_ == src.preallocatedPools_) {\n      memcpy(preallocatedPools_, src.preallocatedPools_,\n             sizeof(preallocatedPools_));\n      pools_ = preallocatedPools_;\n    } else {\n      pools_ = src.pools_;\n      src.pools_ = nullptr;\n    }\n    count_ = src.count_;\n    capacity_ = src.capacity_;\n    src.count_ = 0;\n    src.capacity_ = 0;\n    return *this;\n  }\n\n  Slot<T> allocSlot(Allocator* allocator) {\n    // try to allocate from free list\n    if (freeList_ != NULL_SLOT) {\n      return allocFromFreeList();\n    }\n\n    // try to allocate from last pool (other pools are full)\n    if (count_) {\n      auto slot = allocFromLastPool();\n      if (slot)\n        return slot;\n    }\n\n    // create a new pool and try again\n    auto pool = addPool(allocator);\n    if (!pool)\n      return {};\n\n    return allocFromLastPool();\n  }\n\n  void freeSlot(Slot<T> slot) {\n    reinterpret_cast<FreeSlot*>(slot.ptr())->next = freeList_;\n    freeList_ = slot.id();\n  }\n\n  T* getSlot(SlotId id) const {\n    if (id == NULL_SLOT)\n      return nullptr;\n    auto poolIndex = SlotId(id / ARDUINOJSON_POOL_CAPACITY);\n    auto indexInPool = SlotId(id % ARDUINOJSON_POOL_CAPACITY);\n    ARDUINOJSON_ASSERT(poolIndex < count_);\n    return pools_[poolIndex].getSlot(indexInPool);\n  }\n\n  void clear(Allocator* allocator) {\n    for (PoolCount i = 0; i < count_; i++)\n      pools_[i].destroy(allocator);\n    count_ = 0;\n    freeList_ = NULL_SLOT;\n    if (pools_ != preallocatedPools_) {\n      allocator->deallocate(pools_);\n      pools_ = preallocatedPools_;\n      capacity_ = ARDUINOJSON_INITIAL_POOL_COUNT;\n    }\n  }\n\n  SlotCount usage() const {\n    SlotCount total = 0;\n    for (PoolCount i = 0; i < count_; i++)\n      total = SlotCount(total + pools_[i].usage());\n    return total;\n  }\n\n  size_t size() const {\n    return Pool::slotsToBytes(usage());\n  }\n\n  void shrinkToFit(Allocator* allocator) {\n    if (count_ > 0)\n      pools_[count_ - 1].shrinkToFit(allocator);\n    if (pools_ != preallocatedPools_ && count_ != capacity_) {\n      pools_ = static_cast<Pool*>(\n          allocator->reallocate(pools_, count_ * sizeof(Pool)));\n      ARDUINOJSON_ASSERT(pools_ != nullptr);  // realloc to smaller can't fail\n      capacity_ = count_;\n    }\n  }\n\n private:\n  Slot<T> allocFromFreeList() {\n    ARDUINOJSON_ASSERT(freeList_ != NULL_SLOT);\n    auto id = freeList_;\n    auto slot = getSlot(freeList_);\n    freeList_ = reinterpret_cast<FreeSlot*>(slot)->next;\n    return {slot, id};\n  }\n\n  Slot<T> allocFromLastPool() {\n    ARDUINOJSON_ASSERT(count_ > 0);\n    auto poolIndex = SlotId(count_ - 1);\n    auto slot = pools_[poolIndex].allocSlot();\n    if (!slot)\n      return {};\n    return {slot.ptr(),\n            SlotId(poolIndex * ARDUINOJSON_POOL_CAPACITY + slot.id())};\n  }\n\n  Pool* addPool(Allocator* allocator) {\n    if (count_ == capacity_ && !increaseCapacity(allocator))\n      return nullptr;\n    auto pool = &pools_[count_++];\n    SlotCount poolCapacity = ARDUINOJSON_POOL_CAPACITY;\n    if (count_ == maxPools)  // last pool is smaller because of NULL_SLOT\n      poolCapacity--;\n    pool->create(poolCapacity, allocator);\n    return pool;\n  }\n\n  bool increaseCapacity(Allocator* allocator) {\n    if (capacity_ == maxPools)\n      return false;\n    void* newPools;\n    auto newCapacity = PoolCount(capacity_ * 2);\n\n    if (pools_ == preallocatedPools_) {\n      newPools = allocator->allocate(newCapacity * sizeof(Pool));\n      if (!newPools)\n        return false;\n      memcpy(newPools, preallocatedPools_, sizeof(preallocatedPools_));\n    } else {\n      newPools = allocator->reallocate(pools_, newCapacity * sizeof(Pool));\n      if (!newPools)\n        return false;\n    }\n\n    pools_ = static_cast<Pool*>(newPools);\n    capacity_ = newCapacity;\n    return true;\n  }\n\n  Pool preallocatedPools_[ARDUINOJSON_INITIAL_POOL_COUNT];\n  Pool* pools_ = preallocatedPools_;\n  PoolCount count_ = 0;\n  PoolCount capacity_ = ARDUINOJSON_INITIAL_POOL_COUNT;\n  SlotId freeList_ = NULL_SLOT;\n\n public:\n  static const PoolCount maxPools =\n      PoolCount(NULL_SLOT / ARDUINOJSON_POOL_CAPACITY + 1);\n};\n\nARDUINOJSON_END_PRIVATE_NAMESPACE\n"
  },
  {
    "path": "src/ArduinoJson/Memory/ResourceManager.hpp",
    "content": "// ArduinoJson - https://arduinojson.org\n// Copyright © 2014-2025, Benoit BLANCHON\n// MIT License\n\n#pragma once\n\n#include <ArduinoJson/Memory/Allocator.hpp>\n#include <ArduinoJson/Memory/MemoryPoolList.hpp>\n#include <ArduinoJson/Memory/StringPool.hpp>\n#include <ArduinoJson/Polyfills/assert.hpp>\n#include <ArduinoJson/Polyfills/utility.hpp>\n#include <ArduinoJson/Strings/StringAdapters.hpp>\n#include <ArduinoJson/Variant/VariantData.hpp>\n\nARDUINOJSON_BEGIN_PRIVATE_NAMESPACE\n\nclass VariantWithId;\n\nclass ResourceManager {\n public:\n  ResourceManager(Allocator* allocator = DefaultAllocator::instance())\n      : allocator_(allocator), overflowed_(false) {}\n\n  ~ResourceManager() {\n    stringPool_.clear(allocator_);\n    variantPools_.clear(allocator_);\n#if ARDUINOJSON_USE_8_BYTE_POOL\n    eightBytePools_.clear(allocator_);\n#endif\n  }\n\n  ResourceManager(const ResourceManager&) = delete;\n  ResourceManager& operator=(const ResourceManager& src) = delete;\n\n  friend void swap(ResourceManager& a, ResourceManager& b) {\n    swap(a.stringPool_, b.stringPool_);\n    swap(a.variantPools_, b.variantPools_);\n#if ARDUINOJSON_USE_8_BYTE_POOL\n    swap(a.eightBytePools_, b.eightBytePools_);\n#endif\n    swap_(a.allocator_, b.allocator_);\n    swap_(a.overflowed_, b.overflowed_);\n  }\n\n  Allocator* allocator() const {\n    return allocator_;\n  }\n\n  size_t size() const {\n    return variantPools_.size() + stringPool_.size();\n  }\n\n  bool overflowed() const {\n    return overflowed_;\n  }\n\n  Slot<VariantData> allocVariant() {\n    auto slot = variantPools_.allocSlot(allocator_);\n    if (!slot) {\n      overflowed_ = true;\n      return {};\n    }\n    new (slot.ptr()) VariantData();\n    return slot;\n  }\n\n  void freeVariant(Slot<VariantData> slot) {\n    ARDUINOJSON_ASSERT(slot->type == VariantType::Null);\n    variantPools_.freeSlot(slot);\n  }\n\n  VariantData* getVariant(SlotId id) const {\n    return reinterpret_cast<VariantData*>(variantPools_.getSlot(id));\n  }\n\n#if ARDUINOJSON_USE_8_BYTE_POOL\n  Slot<EightByteValue> allocEightByte() {\n    auto slot = eightBytePools_.allocSlot(allocator_);\n    if (!slot) {\n      overflowed_ = true;\n      return {};\n    }\n    return slot;\n  }\n\n  void freeEightByte(SlotId id) {\n    auto p = getEightByte(id);\n    eightBytePools_.freeSlot({p, id});\n  }\n\n  EightByteValue* getEightByte(SlotId id) const {\n    return eightBytePools_.getSlot(id);\n  }\n#endif\n\n  template <typename TAdaptedString>\n  StringNode* saveString(TAdaptedString str) {\n    if (str.isNull())\n      return 0;\n\n    auto node = stringPool_.add(str, allocator_);\n    if (!node)\n      overflowed_ = true;\n\n    return node;\n  }\n\n  void saveString(StringNode* node) {\n    stringPool_.add(node);\n  }\n\n  template <typename TAdaptedString>\n  StringNode* getString(const TAdaptedString& str) const {\n    return stringPool_.get(str);\n  }\n\n  StringNode* createString(size_t length) {\n    auto node = StringNode::create(length, allocator_);\n    if (!node)\n      overflowed_ = true;\n    return node;\n  }\n\n  StringNode* resizeString(StringNode* node, size_t length) {\n    node = StringNode::resize(node, length, allocator_);\n    if (!node)\n      overflowed_ = true;\n    return node;\n  }\n\n  void destroyString(StringNode* node) {\n    StringNode::destroy(node, allocator_);\n  }\n\n  void dereferenceString(const char* s) {\n    stringPool_.dereference(s, allocator_);\n  }\n\n  void clear() {\n    variantPools_.clear(allocator_);\n    overflowed_ = false;\n    stringPool_.clear(allocator_);\n#if ARDUINOJSON_USE_8_BYTE_POOL\n    eightBytePools_.clear(allocator_);\n#endif\n  }\n\n  void shrinkToFit() {\n    variantPools_.shrinkToFit(allocator_);\n#if ARDUINOJSON_USE_8_BYTE_POOL\n    eightBytePools_.shrinkToFit(allocator_);\n#endif\n  }\n\n private:\n  Allocator* allocator_;\n  bool overflowed_;\n  StringPool stringPool_;\n  MemoryPoolList<VariantData> variantPools_;\n#if ARDUINOJSON_USE_8_BYTE_POOL\n  MemoryPoolList<EightByteValue> eightBytePools_;\n#endif\n};\n\nARDUINOJSON_END_PRIVATE_NAMESPACE\n"
  },
  {
    "path": "src/ArduinoJson/Memory/StringBuffer.hpp",
    "content": "// ArduinoJson - https://arduinojson.org\n// Copyright © 2014-2025, Benoit BLANCHON\n// MIT License\n\n#pragma once\n\n#include <ArduinoJson/Memory/ResourceManager.hpp>\n#include <ArduinoJson/Strings/JsonString.hpp>\n\nARDUINOJSON_BEGIN_PRIVATE_NAMESPACE\n\nclass StringBuffer {\n public:\n  StringBuffer(ResourceManager* resources) : resources_(resources) {}\n\n  ~StringBuffer() {\n    if (node_)\n      resources_->destroyString(node_);\n  }\n\n  char* reserve(size_t capacity) {\n    if (node_ && capacity > node_->length) {\n      // existing buffer is too small, we need to reallocate\n      resources_->destroyString(node_);\n      node_ = nullptr;\n    }\n    if (!node_)\n      node_ = resources_->createString(capacity);\n    if (!node_)\n      return nullptr;\n    size_ = capacity;\n    node_->data[capacity] = 0;  // null-terminate the string\n    return node_->data;\n  }\n\n  JsonString str() const {\n    ARDUINOJSON_ASSERT(node_ != nullptr);\n    return JsonString(node_->data, node_->length);\n  }\n\n  void save(VariantData* data) {\n    ARDUINOJSON_ASSERT(node_ != nullptr);\n    const char* s = node_->data;\n    if (isTinyString(s, size_))\n      data->setTinyString(adaptString(s, size_));\n    else\n      data->setLongString(commitStringNode());\n  }\n\n  void saveRaw(VariantData* data) {\n    data->setRawString(commitStringNode());\n  }\n\n private:\n  StringNode* commitStringNode() {\n    ARDUINOJSON_ASSERT(node_ != nullptr);\n    node_->data[size_] = 0;\n    auto node = resources_->getString(adaptString(node_->data, size_));\n    if (node) {\n      node->references++;\n      return node;\n    }\n\n    if (node_->length != size_) {\n      node = resources_->resizeString(node_, size_);\n      ARDUINOJSON_ASSERT(node != nullptr);  // realloc to smaller can't fail\n    } else {\n      node = node_;\n    }\n    node_ = nullptr;\n    resources_->saveString(node);\n    return node;\n  }\n\n  ResourceManager* resources_;\n  StringNode* node_ = nullptr;\n  size_t size_ = 0;\n};\n\nARDUINOJSON_END_PRIVATE_NAMESPACE\n"
  },
  {
    "path": "src/ArduinoJson/Memory/StringBuilder.hpp",
    "content": "// ArduinoJson - https://arduinojson.org\n// Copyright © 2014-2025, Benoit BLANCHON\n// MIT License\n\n#pragma once\n\n#include <ArduinoJson/Memory/ResourceManager.hpp>\n#include <ArduinoJson/Strings/JsonString.hpp>\n\nARDUINOJSON_BEGIN_PRIVATE_NAMESPACE\n\nclass StringBuilder {\n public:\n  static const size_t initialCapacity = 31;\n\n  StringBuilder(ResourceManager* resources) : resources_(resources) {}\n\n  ~StringBuilder() {\n    if (node_)\n      resources_->destroyString(node_);\n  }\n\n  void startString() {\n    size_ = 0;\n    if (!node_)\n      node_ = resources_->createString(initialCapacity);\n  }\n\n  void save(VariantData* variant) {\n    ARDUINOJSON_ASSERT(variant != nullptr);\n    ARDUINOJSON_ASSERT(node_ != nullptr);\n\n    char* p = node_->data;\n    if (isTinyString(p, size_)) {\n      variant->setTinyString(adaptString(p, size_));\n      return;\n    }\n\n    p[size_] = 0;\n    StringNode* node = resources_->getString(adaptString(p, size_));\n    if (!node) {\n      node = resources_->resizeString(node_, size_);\n      ARDUINOJSON_ASSERT(node != nullptr);  // realloc to smaller can't fail\n      resources_->saveString(node);\n      node_ = nullptr;  // next time we need a new string\n    } else {\n      node->references++;\n    }\n    variant->setLongString(node);\n  }\n\n  void append(const char* s) {\n    while (*s)\n      append(*s++);\n  }\n\n  void append(const char* s, size_t n) {\n    while (n-- > 0)  // TODO: memcpy\n      append(*s++);\n  }\n\n  void append(char c) {\n    if (node_ && size_ == node_->length)\n      node_ = resources_->resizeString(node_, size_ * 2U + 1);\n    if (node_)\n      node_->data[size_++] = c;\n  }\n\n  bool isValid() const {\n    return node_ != nullptr;\n  }\n\n  size_t size() const {\n    return size_;\n  }\n\n  JsonString str() const {\n    ARDUINOJSON_ASSERT(node_ != nullptr);\n    node_->data[size_] = 0;\n    return JsonString(node_->data, size_);\n  }\n\n private:\n  ResourceManager* resources_;\n  StringNode* node_ = nullptr;\n  size_t size_ = 0;\n};\n\nARDUINOJSON_END_PRIVATE_NAMESPACE\n"
  },
  {
    "path": "src/ArduinoJson/Memory/StringNode.hpp",
    "content": "// ArduinoJson - https://arduinojson.org\n// Copyright © 2014-2025, Benoit BLANCHON\n// MIT License\n\n#pragma once\n\n#include <ArduinoJson/Memory/Allocator.hpp>\n#include <ArduinoJson/Namespace.hpp>\n#include <ArduinoJson/Polyfills/assert.hpp>\n#include <ArduinoJson/Polyfills/integer.hpp>\n#include <ArduinoJson/Polyfills/limits.hpp>\n\n#include <stddef.h>  // offsetof\n\nARDUINOJSON_BEGIN_PRIVATE_NAMESPACE\n\nstruct StringNode {\n  // Use the same type as SlotId to store the reference count\n  // (there can never be more references than slots)\n  using references_type = uint_t<ARDUINOJSON_SLOT_ID_SIZE * 8>;\n\n  using length_type = uint_t<ARDUINOJSON_STRING_LENGTH_SIZE * 8>;\n\n  struct StringNode* next;\n  references_type references;\n  length_type length;\n  char data[1];\n\n  static constexpr size_t maxLength = numeric_limits<length_type>::highest();\n\n  static constexpr size_t sizeForLength(size_t n) {\n    return n + 1 + offsetof(StringNode, data);\n  }\n\n  static StringNode* create(size_t length, Allocator* allocator) {\n    if (length > maxLength)\n      return nullptr;\n    auto size = sizeForLength(length);\n    if (size < length)  // integer overflow\n      return nullptr;   // (not testable on 64-bit)\n    auto node = reinterpret_cast<StringNode*>(allocator->allocate(size));\n    if (node) {\n      node->length = length_type(length);\n      node->references = 1;\n    }\n    return node;\n  }\n\n  static StringNode* resize(StringNode* node, size_t length,\n                            Allocator* allocator) {\n    ARDUINOJSON_ASSERT(node != nullptr);\n    StringNode* newNode;\n    if (length <= maxLength)\n      newNode = reinterpret_cast<StringNode*>(\n          allocator->reallocate(node, sizeForLength(length)));\n    else\n      newNode = nullptr;\n    if (newNode)\n      newNode->length = length_type(length);\n    else\n      allocator->deallocate(node);\n    return newNode;\n  }\n\n  static void destroy(StringNode* node, Allocator* allocator) {\n    allocator->deallocate(node);\n  }\n};\n\n// Returns the size (in bytes) of an string with n characters.\nconstexpr size_t sizeofString(size_t n) {\n  return StringNode::sizeForLength(n);\n}\n\nARDUINOJSON_END_PRIVATE_NAMESPACE\n"
  },
  {
    "path": "src/ArduinoJson/Memory/StringPool.hpp",
    "content": "// ArduinoJson - https://arduinojson.org\n// Copyright © 2014-2025, Benoit BLANCHON\n// MIT License\n\n#pragma once\n\n#include <ArduinoJson/Memory/Allocator.hpp>\n#include <ArduinoJson/Memory/StringNode.hpp>\n#include <ArduinoJson/Polyfills/assert.hpp>\n#include <ArduinoJson/Polyfills/utility.hpp>\n#include <ArduinoJson/Strings/StringAdapters.hpp>\n\nARDUINOJSON_BEGIN_PRIVATE_NAMESPACE\n\nclass StringPool {\n public:\n  StringPool() = default;\n  StringPool(const StringPool&) = delete;\n  void operator=(StringPool&& src) = delete;\n\n  ~StringPool() {\n    ARDUINOJSON_ASSERT(strings_ == nullptr);\n  }\n\n  friend void swap(StringPool& a, StringPool& b) {\n    swap_(a.strings_, b.strings_);\n  }\n\n  void clear(Allocator* allocator) {\n    while (strings_) {\n      auto node = strings_;\n      strings_ = node->next;\n      StringNode::destroy(node, allocator);\n    }\n  }\n\n  size_t size() const {\n    size_t total = 0;\n    for (auto node = strings_; node; node = node->next)\n      total += sizeofString(node->length);\n    return total;\n  }\n\n  template <typename TAdaptedString>\n  StringNode* add(TAdaptedString str, Allocator* allocator) {\n    ARDUINOJSON_ASSERT(str.isNull() == false);\n\n    auto node = get(str);\n    if (node) {\n      node->references++;\n      return node;\n    }\n\n    size_t n = str.size();\n\n    node = StringNode::create(n, allocator);\n    if (!node)\n      return nullptr;\n\n    stringGetChars(str, node->data, n);\n    node->data[n] = 0;  // force NUL terminator\n    add(node);\n    return node;\n  }\n\n  void add(StringNode* node) {\n    ARDUINOJSON_ASSERT(node != nullptr);\n    node->next = strings_;\n    strings_ = node;\n  }\n\n  template <typename TAdaptedString>\n  StringNode* get(const TAdaptedString& str) const {\n    for (auto node = strings_; node; node = node->next) {\n      if (stringEquals(str, adaptString(node->data, node->length)))\n        return node;\n    }\n    return nullptr;\n  }\n\n  void dereference(const char* s, Allocator* allocator) {\n    StringNode* prev = nullptr;\n    for (auto node = strings_; node; node = node->next) {\n      if (node->data == s) {\n        if (--node->references == 0) {\n          if (prev)\n            prev->next = node->next;\n          else\n            strings_ = node->next;\n          StringNode::destroy(node, allocator);\n        }\n        return;\n      }\n      prev = node;\n    }\n  }\n\n private:\n  StringNode* strings_ = nullptr;\n};\n\nARDUINOJSON_END_PRIVATE_NAMESPACE\n"
  },
  {
    "path": "src/ArduinoJson/Misc/SerializedValue.hpp",
    "content": "// ArduinoJson - https://arduinojson.org\n// Copyright © 2014-2025, Benoit BLANCHON\n// MIT License\n\n#pragma once\n\n#include <ArduinoJson/Strings/StringAdapters.hpp>\n\nARDUINOJSON_BEGIN_PUBLIC_NAMESPACE\n\n// A special type of data that can be used to insert pregenerated JSON portions.\ntemplate <typename T>\nclass SerializedValue {\n public:\n  explicit SerializedValue(T str) : str_(str) {}\n  operator T() const {\n    return str_;\n  }\n\n  const char* data() const {\n    return str_.c_str();\n  }\n\n  size_t size() const {\n    // CAUTION: the old Arduino String doesn't have size()\n    return str_.length();\n  }\n\n private:\n  T str_;\n};\n\ntemplate <typename TChar>\nclass SerializedValue<TChar*> {\n public:\n  explicit SerializedValue(TChar* p, size_t n) : data_(p), size_(n) {}\n  operator TChar*() const {\n    return data_;\n  }\n\n  TChar* data() const {\n    return data_;\n  }\n\n  size_t size() const {\n    return size_;\n  }\n\n private:\n  TChar* data_;\n  size_t size_;\n};\n\nusing RawString = SerializedValue<const char*>;\n\ntemplate <typename T>\ninline SerializedValue<T> serialized(T str) {\n  return SerializedValue<T>(str);\n}\n\ntemplate <typename TChar>\ninline SerializedValue<TChar*> serialized(TChar* p) {\n  return SerializedValue<TChar*>(p, detail::adaptString(p).size());\n}\n\ntemplate <typename TChar>\ninline SerializedValue<TChar*> serialized(TChar* p, size_t n) {\n  return SerializedValue<TChar*>(p, n);\n}\n\nARDUINOJSON_END_PUBLIC_NAMESPACE\n"
  },
  {
    "path": "src/ArduinoJson/MsgPack/MsgPackBinary.hpp",
    "content": "#pragma once\n\n#include <ArduinoJson/Variant/Converter.hpp>\n\nARDUINOJSON_BEGIN_PUBLIC_NAMESPACE\n\nclass MsgPackBinary {\n public:\n  MsgPackBinary() : data_(nullptr), size_(0) {}\n  explicit MsgPackBinary(const void* c, size_t size) : data_(c), size_(size) {}\n\n  const void* data() const {\n    return data_;\n  }\n\n  size_t size() const {\n    return size_;\n  }\n\n private:\n  const void* data_;\n  size_t size_;\n};\n\ntemplate <>\nstruct Converter<MsgPackBinary> : private detail::VariantAttorney {\n  static bool toJson(MsgPackBinary src, JsonVariant dst) {\n    auto data = VariantAttorney::getData(dst);\n    if (!data)\n      return false;\n\n    auto resources = getResourceManager(dst);\n    detail::VariantImpl::clear(data, resources);\n\n    if (!src.data())\n      return true;\n\n    size_t headerSize = src.size() >= 0x10000 ? 5 : src.size() >= 0x100 ? 3 : 2;\n\n    auto str = resources->createString(src.size() + headerSize);\n    if (!str)\n      return false;\n\n    resources->saveString(str);\n    auto ptr = reinterpret_cast<uint8_t*>(str->data);\n    switch (headerSize) {\n      case 2:\n        ptr[0] = uint8_t(0xc4);\n        ptr[1] = uint8_t(src.size() & 0xff);\n        break;\n      case 3:\n        ptr[0] = uint8_t(0xc5);\n        ptr[1] = uint8_t(src.size() >> 8 & 0xff);\n        ptr[2] = uint8_t(src.size() & 0xff);\n        break;\n      case 5:\n        ptr[0] = uint8_t(0xc6);\n        ptr[1] = uint8_t(src.size() >> 24 & 0xff);\n        ptr[2] = uint8_t(src.size() >> 16 & 0xff);\n        ptr[3] = uint8_t(src.size() >> 8 & 0xff);\n        ptr[4] = uint8_t(src.size() & 0xff);\n        break;\n      default:\n        ARDUINOJSON_ASSERT(false);\n    }\n    memcpy(ptr + headerSize, src.data(), src.size());\n    data->setRawString(str);\n    return true;\n  }\n\n  static MsgPackBinary fromJson(JsonVariantConst src) {\n    auto data = getData(src);\n    if (!data)\n      return {};\n    auto rawstr = data->asRawString();\n    auto p = reinterpret_cast<const uint8_t*>(rawstr.c_str());\n    auto n = rawstr.size();\n    if (n >= 2 && p[0] == 0xc4) {  // bin 8\n      size_t size = p[1];\n      if (size + 2 == n)\n        return MsgPackBinary(p + 2, size);\n    } else if (n >= 3 && p[0] == 0xc5) {  // bin 16\n      size_t size = size_t(p[1] << 8) | p[2];\n      if (size + 3 == n)\n        return MsgPackBinary(p + 3, size);\n    } else if (n >= 5 && p[0] == 0xc6) {  // bin 32\n      size_t size =\n          size_t(p[1] << 24) | size_t(p[2] << 16) | size_t(p[3] << 8) | p[4];\n      if (size + 5 == n)\n        return MsgPackBinary(p + 5, size);\n    }\n    return {};\n  }\n\n  static bool checkJson(JsonVariantConst src) {\n    return fromJson(src).data() != nullptr;\n  }\n};\n\nARDUINOJSON_END_PUBLIC_NAMESPACE\n"
  },
  {
    "path": "src/ArduinoJson/MsgPack/MsgPackDeserializer.hpp",
    "content": "// ArduinoJson - https://arduinojson.org\n// Copyright © 2014-2025, Benoit BLANCHON\n// MIT License\n\n#pragma once\n\n#include <ArduinoJson/Deserialization/deserialize.hpp>\n#include <ArduinoJson/Memory/ResourceManager.hpp>\n#include <ArduinoJson/Memory/StringBuffer.hpp>\n#include <ArduinoJson/MsgPack/endianness.hpp>\n#include <ArduinoJson/MsgPack/ieee754.hpp>\n#include <ArduinoJson/Polyfills/type_traits.hpp>\n#include <ArduinoJson/Variant/VariantData.hpp>\n\nARDUINOJSON_BEGIN_PRIVATE_NAMESPACE\n\ntemplate <typename TReader>\nclass MsgPackDeserializer {\n public:\n  MsgPackDeserializer(ResourceManager* resources, TReader reader)\n      : resources_(resources),\n        reader_(reader),\n        stringBuffer_(resources),\n        foundSomething_(false) {}\n\n  template <typename TFilter>\n  DeserializationError parse(VariantData* variant, TFilter filter,\n                             DeserializationOption::NestingLimit nestingLimit) {\n    DeserializationError::Code err;\n    err = parseVariant(variant, filter, nestingLimit);\n    return foundSomething_ ? err : DeserializationError::EmptyInput;\n  }\n\n private:\n  template <typename TFilter>\n  DeserializationError::Code parseVariant(\n      VariantData* variant, TFilter filter,\n      DeserializationOption::NestingLimit nestingLimit) {\n    DeserializationError::Code err;\n\n    uint8_t header[5];\n    err = readBytes(header, 1);\n    if (err)\n      return err;\n\n    const uint8_t& code = header[0];\n\n    foundSomething_ = true;\n\n    bool allowValue = filter.allowValue();\n\n    if (allowValue) {\n      // callers pass a null pointer only when value must be ignored\n      ARDUINOJSON_ASSERT(variant != 0);\n    }\n\n    if (code >= 0xcc && code <= 0xd3) {\n      auto width = uint8_t(1U << ((code - 0xcc) % 4));\n      if (allowValue)\n        return readInteger(variant, width, code >= 0xd0);\n      else\n        return skipBytes(width);\n    }\n\n    switch (code) {\n      case 0xc0:\n        // already null\n        return DeserializationError::Ok;\n\n      case 0xc1:\n        return DeserializationError::InvalidInput;\n\n      case 0xc2:\n      case 0xc3:\n        if (allowValue)\n          variant->setBoolean(code == 0xc3);\n        return DeserializationError::Ok;\n\n      case 0xca:\n        if (allowValue)\n          return readFloat<float>(variant);\n        else\n          return skipBytes(4);\n\n      case 0xcb:\n        if (allowValue)\n          return readDouble<double>(variant);\n        else\n          return skipBytes(8);\n    }\n\n    if (code <= 0x7f || code >= 0xe0) {  // fixint\n      if (allowValue)\n        VariantImpl::setInteger(static_cast<int8_t>(code), variant, resources_);\n      return DeserializationError::Ok;\n    }\n\n    uint8_t sizeBytes = 0;\n    size_t size = 0;\n    bool isExtension = code >= 0xc7 && code <= 0xc9;\n\n    switch (code) {\n      case 0xc4:  // bin 8\n      case 0xc7:  // ext 8\n      case 0xd9:  // str 8\n        sizeBytes = 1;\n        break;\n\n      case 0xc5:  // bin 16\n      case 0xc8:  // ext 16\n      case 0xda:  // str 16\n      case 0xdc:  // array 16\n      case 0xde:  // map 16\n        sizeBytes = 2;\n        break;\n\n      case 0xc6:  // bin 32\n      case 0xc9:  // ext 32\n      case 0xdb:  // str 32\n      case 0xdd:  // array 32\n      case 0xdf:  // map 32\n        sizeBytes = 4;\n        break;\n    }\n\n    if (code >= 0xd4 && code <= 0xd8) {  // fixext\n      size = size_t(1) << (code - 0xd4);\n      isExtension = true;\n    }\n\n    switch (code & 0xf0) {\n      case 0x90:  // fixarray\n      case 0x80:  // fixmap\n        size = code & 0x0F;\n        break;\n    }\n\n    switch (code & 0xe0) {\n      case 0xa0:  // fixstr\n        size = code & 0x1f;\n        break;\n    }\n\n    if (sizeBytes) {\n      err = readBytes(header + 1, sizeBytes);\n      if (err)\n        return err;\n\n      uint32_t size32 = 0;\n      for (uint8_t i = 0; i < sizeBytes; i++)\n        size32 = (size32 << 8) | header[i + 1];\n\n      size = size_t(size32);\n      if (size < size32)                        // integer overflow\n        return DeserializationError::NoMemory;  // (not testable on 32/64-bit)\n    }\n\n    // array 16, 32 and fixarray\n    if (code == 0xdc || code == 0xdd || (code & 0xf0) == 0x90)\n      return readArray(variant, size, filter, nestingLimit);\n\n    // map 16, 32 and fixmap\n    if (code == 0xde || code == 0xdf || (code & 0xf0) == 0x80)\n      return readObject(variant, size, filter, nestingLimit);\n\n    // str 8, 16, 32 and fixstr\n    if (code == 0xd9 || code == 0xda || code == 0xdb || (code & 0xe0) == 0xa0) {\n      if (allowValue)\n        return readString(variant, size);\n      else\n        return skipBytes(size);\n    }\n\n    if (isExtension)\n      size++;  // to include the type\n\n    if (allowValue)\n      return readRawString(variant, header, uint8_t(1 + sizeBytes), size);\n    else\n      return skipBytes(size);\n  }\n\n  DeserializationError::Code readByte(uint8_t& value) {\n    int c = reader_.read();\n    if (c < 0)\n      return DeserializationError::IncompleteInput;\n    value = static_cast<uint8_t>(c);\n    return DeserializationError::Ok;\n  }\n\n  DeserializationError::Code readBytes(void* p, size_t n) {\n    if (reader_.readBytes(reinterpret_cast<char*>(p), n) == n)\n      return DeserializationError::Ok;\n    return DeserializationError::IncompleteInput;\n  }\n\n  template <typename T>\n  DeserializationError::Code readBytes(T& value) {\n    return readBytes(&value, sizeof(value));\n  }\n\n  DeserializationError::Code skipBytes(size_t n) {\n    for (; n; --n) {\n      if (reader_.read() < 0)\n        return DeserializationError::IncompleteInput;\n    }\n    return DeserializationError::Ok;\n  }\n\n  DeserializationError::Code readInteger(VariantData* variant, uint8_t width,\n                                         bool isSigned) {\n    uint8_t buffer[8];\n\n    auto err = readBytes(buffer, width);\n    if (err)\n      return err;\n\n    union {\n      int64_t signedValue;\n      uint64_t unsignedValue;\n    };\n\n    if (isSigned)\n      signedValue = static_cast<int8_t>(buffer[0]);  // propagate sign bit\n    else\n      unsignedValue = static_cast<uint8_t>(buffer[0]);\n\n    for (uint8_t i = 1; i < width; i++)\n      unsignedValue = (unsignedValue << 8) | buffer[i];\n\n    if (isSigned) {\n      auto truncatedValue = static_cast<JsonInteger>(signedValue);\n      if (truncatedValue == signedValue) {\n        if (!VariantImpl::setInteger(truncatedValue, variant, resources_))\n          return DeserializationError::NoMemory;\n      }\n      // else set null on overflow\n    } else {\n      auto truncatedValue = static_cast<JsonUInt>(unsignedValue);\n      if (truncatedValue == unsignedValue)\n        if (!VariantImpl::setInteger(truncatedValue, variant, resources_))\n          return DeserializationError::NoMemory;\n      // else set null on overflow\n    }\n\n    return DeserializationError::Ok;\n  }\n\n  template <typename T>\n  enable_if_t<sizeof(T) == 4, DeserializationError::Code> readFloat(\n      VariantData* variant) {\n    DeserializationError::Code err;\n    T value;\n\n    err = readBytes(value);\n    if (err)\n      return err;\n\n    fixEndianness(value);\n    VariantImpl::setFloat(value, variant, resources_);\n\n    return DeserializationError::Ok;\n  }\n\n  template <typename T>\n  enable_if_t<sizeof(T) == 8, DeserializationError::Code> readDouble(\n      VariantData* variant) {\n    DeserializationError::Code err;\n    T value;\n\n    err = readBytes(value);\n    if (err)\n      return err;\n\n    fixEndianness(value);\n    if (VariantImpl::setFloat(value, variant, resources_))\n      return DeserializationError::Ok;\n    else\n      return DeserializationError::NoMemory;\n  }\n\n  template <typename T>\n  enable_if_t<sizeof(T) == 4, DeserializationError::Code> readDouble(\n      VariantData* variant) {\n    DeserializationError::Code err;\n    uint8_t i[8];  // input is 8 bytes\n    T value;       // output is 4 bytes\n    uint8_t* o = reinterpret_cast<uint8_t*>(&value);\n\n    err = readBytes(i, 8);\n    if (err)\n      return err;\n\n    doubleToFloat(i, o);\n    fixEndianness(value);\n    VariantImpl::setFloat(value, variant, resources_);\n\n    return DeserializationError::Ok;\n  }\n\n  DeserializationError::Code readString(VariantData* variant, size_t n) {\n    DeserializationError::Code err;\n\n    err = readString(n);\n    if (err)\n      return err;\n\n    stringBuffer_.save(variant);\n    return DeserializationError::Ok;\n  }\n\n  DeserializationError::Code readString(size_t n) {\n    char* p = stringBuffer_.reserve(n);\n    if (!p)\n      return DeserializationError::NoMemory;\n\n    return readBytes(p, n);\n  }\n\n  DeserializationError::Code readRawString(VariantData* variant,\n                                           const void* header,\n                                           uint8_t headerSize, size_t n) {\n    auto totalSize = size_t(headerSize + n);\n    if (totalSize < n)                        // integer overflow\n      return DeserializationError::NoMemory;  // (not testable on 64-bit)\n\n    char* p = stringBuffer_.reserve(totalSize);\n    if (!p)\n      return DeserializationError::NoMemory;\n\n    memcpy(p, header, headerSize);\n\n    auto err = readBytes(p + headerSize, n);\n    if (err)\n      return err;\n\n    stringBuffer_.saveRaw(variant);\n    return DeserializationError::Ok;\n  }\n\n  template <typename TFilter>\n  DeserializationError::Code readArray(\n      VariantData* variant, size_t n, TFilter filter,\n      DeserializationOption::NestingLimit nestingLimit) {\n    DeserializationError::Code err;\n\n    if (nestingLimit.reached())\n      return DeserializationError::TooDeep;\n\n    bool allowArray = filter.allowArray();\n\n    if (allowArray) {\n      ARDUINOJSON_ASSERT(variant != 0);\n      variant->toArray();\n    }\n\n    TFilter elementFilter = filter[0U];\n\n    for (; n; --n) {\n      VariantData* value;\n\n      if (elementFilter.allow()) {\n        value = VariantImpl::addNewElement(variant, resources_);\n        if (!value)\n          return DeserializationError::NoMemory;\n      } else {\n        value = 0;\n      }\n\n      err = parseVariant(value, elementFilter, nestingLimit.decrement());\n      if (err)\n        return err;\n    }\n\n    return DeserializationError::Ok;\n  }\n\n  template <typename TFilter>\n  DeserializationError::Code readObject(\n      VariantData* variant, size_t n, TFilter filter,\n      DeserializationOption::NestingLimit nestingLimit) {\n    DeserializationError::Code err;\n\n    if (nestingLimit.reached())\n      return DeserializationError::TooDeep;\n\n    if (filter.allowObject()) {\n      ARDUINOJSON_ASSERT(variant != 0);\n      variant->toObject();\n    }\n\n    for (; n; --n) {\n      err = readKey();\n      if (err)\n        return err;\n\n      JsonString key = stringBuffer_.str();\n      TFilter memberFilter = filter[key.c_str()];\n      VariantData* member = 0;\n\n      if (memberFilter.allow()) {\n        auto keyVariant = VariantImpl::addPair(&member, variant, resources_);\n        if (!keyVariant)\n          return DeserializationError::NoMemory;\n\n        stringBuffer_.save(keyVariant);\n      }\n\n      err = parseVariant(member, memberFilter, nestingLimit.decrement());\n      if (err)\n        return err;\n    }\n\n    return DeserializationError::Ok;\n  }\n\n  DeserializationError::Code readKey() {\n    DeserializationError::Code err;\n    uint8_t code;\n\n    err = readByte(code);\n    if (err)\n      return err;\n\n    if ((code & 0xe0) == 0xa0)\n      return readString(code & 0x1f);\n\n    if (code >= 0xd9 && code <= 0xdb) {\n      uint8_t sizeBytes = uint8_t(1U << (code - 0xd9));\n      uint32_t size = 0;\n      for (uint8_t i = 0; i < sizeBytes; i++) {\n        err = readByte(code);\n        if (err)\n          return err;\n        size = (size << 8) | code;\n      }\n      return readString(size);\n    }\n\n    return DeserializationError::InvalidInput;\n  }\n\n  ResourceManager* resources_;\n  TReader reader_;\n  StringBuffer stringBuffer_;\n  bool foundSomething_;\n};\n\nARDUINOJSON_END_PRIVATE_NAMESPACE\n\nARDUINOJSON_BEGIN_PUBLIC_NAMESPACE\n\n// Parses a MessagePack input and puts the result in a JsonDocument.\n// https://arduinojson.org/v7/api/msgpack/deserializemsgpack/\ntemplate <typename TDestination, typename... Args,\n          detail::enable_if_t<\n              detail::is_deserialize_destination<TDestination>::value, int> = 0>\ninline DeserializationError deserializeMsgPack(TDestination&& dst,\n                                               Args&&... args) {\n  using namespace detail;\n  return deserialize<MsgPackDeserializer>(detail::forward<TDestination>(dst),\n                                          detail::forward<Args>(args)...);\n}\n\n// Parses a MessagePack input and puts the result in a JsonDocument.\n// https://arduinojson.org/v7/api/msgpack/deserializemsgpack/\ntemplate <typename TDestination, typename TChar, typename... Args,\n          detail::enable_if_t<\n              detail::is_deserialize_destination<TDestination>::value, int> = 0>\ninline DeserializationError deserializeMsgPack(TDestination&& dst, TChar* input,\n                                               Args&&... args) {\n  using namespace detail;\n  return deserialize<MsgPackDeserializer>(detail::forward<TDestination>(dst),\n                                          input,\n                                          detail::forward<Args>(args)...);\n}\n\nARDUINOJSON_END_PUBLIC_NAMESPACE\n"
  },
  {
    "path": "src/ArduinoJson/MsgPack/MsgPackExtension.hpp",
    "content": "#pragma once\n\n#include <ArduinoJson/Variant/Converter.hpp>\n\nARDUINOJSON_BEGIN_PUBLIC_NAMESPACE\n\nclass MsgPackExtension {\n public:\n  MsgPackExtension() : data_(nullptr), size_(0), type_(0) {}\n  explicit MsgPackExtension(int8_t type, const void* data, size_t size)\n      : data_(data), size_(size), type_(type) {}\n\n  int8_t type() const {\n    return type_;\n  }\n\n  const void* data() const {\n    return data_;\n  }\n\n  size_t size() const {\n    return size_;\n  }\n\n private:\n  const void* data_;\n  size_t size_;\n  int8_t type_;\n};\n\ntemplate <>\nstruct Converter<MsgPackExtension> : private detail::VariantAttorney {\n  static bool toJson(MsgPackExtension src, JsonVariant dst) {\n    auto data = getData(dst);\n    if (!data)\n      return false;\n\n    auto resources = getResourceManager(dst);\n    detail::VariantImpl::clear(data, resources);\n\n    if (!src.data())\n      return true;\n\n    uint8_t format, sizeBytes;\n    if (src.size() >= 0x10000) {\n      format = 0xc9;  // ext 32\n      sizeBytes = 4;\n    } else if (src.size() >= 0x100) {\n      format = 0xc8;  // ext 16\n      sizeBytes = 2;\n    } else if (src.size() == 16) {\n      format = 0xd8;  // fixext 16\n      sizeBytes = 0;\n    } else if (src.size() == 8) {\n      format = 0xd7;  // fixext 8\n      sizeBytes = 0;\n    } else if (src.size() == 4) {\n      format = 0xd6;  // fixext 4\n      sizeBytes = 0;\n    } else if (src.size() == 2) {\n      format = 0xd5;  // fixext 2\n      sizeBytes = 0;\n    } else if (src.size() == 1) {\n      format = 0xd4;  // fixext 1\n      sizeBytes = 0;\n    } else {\n      format = 0xc7;  // ext 8\n      sizeBytes = 1;\n    }\n\n    auto str = resources->createString(src.size() + 2 + sizeBytes);\n    if (!str)\n      return false;\n\n    resources->saveString(str);\n    auto ptr = reinterpret_cast<uint8_t*>(str->data);\n    *ptr++ = uint8_t(format);\n    for (uint8_t i = 0; i < sizeBytes; i++)\n      *ptr++ = uint8_t(src.size() >> (sizeBytes - i - 1) * 8 & 0xff);\n    *ptr++ = uint8_t(src.type());\n    memcpy(ptr, src.data(), src.size());\n    data->setRawString(str);\n    return true;\n  }\n\n  static MsgPackExtension fromJson(JsonVariantConst src) {\n    auto data = getData(src);\n    if (!data)\n      return {};\n    auto rawstr = data->asRawString();\n    if (rawstr.size() == 0)\n      return {};\n    auto p = reinterpret_cast<const uint8_t*>(rawstr.c_str());\n\n    size_t payloadSize = 0;\n    uint8_t headerSize = 0;\n\n    const uint8_t& code = p[0];\n\n    if (code >= 0xd4 && code <= 0xd8) {  // fixext 1\n      headerSize = 2;\n      payloadSize = size_t(1) << (code - 0xd4);\n    }\n\n    if (code >= 0xc7 && code <= 0xc9) {\n      uint8_t sizeBytes = uint8_t(1 << (code - 0xc7));\n      for (uint8_t i = 0; i < sizeBytes; i++)\n        payloadSize = (payloadSize << 8) | p[1 + i];\n      headerSize = uint8_t(2 + sizeBytes);\n    }\n\n    if (rawstr.size() == headerSize + payloadSize)\n      return MsgPackExtension(int8_t(p[headerSize - 1]), p + headerSize,\n                              payloadSize);\n\n    return {};\n  }\n\n  static bool checkJson(JsonVariantConst src) {\n    return fromJson(src).data() != nullptr;\n  }\n};\n\nARDUINOJSON_END_PUBLIC_NAMESPACE\n"
  },
  {
    "path": "src/ArduinoJson/MsgPack/MsgPackSerializer.hpp",
    "content": "// ArduinoJson - https://arduinojson.org\n// Copyright © 2014-2025, Benoit BLANCHON\n// MIT License\n\n#pragma once\n\n#include <ArduinoJson/MsgPack/endianness.hpp>\n#include <ArduinoJson/Polyfills/assert.hpp>\n#include <ArduinoJson/Polyfills/type_traits.hpp>\n#include <ArduinoJson/Serialization/CountingDecorator.hpp>\n#include <ArduinoJson/Serialization/measure.hpp>\n#include <ArduinoJson/Serialization/serialize.hpp>\n#include <ArduinoJson/Variant/VariantData.hpp>\n\nARDUINOJSON_BEGIN_PRIVATE_NAMESPACE\n\ntemplate <typename TWriter>\nclass MsgPackSerializer : public VariantDataVisitor<size_t> {\n public:\n  static const bool producesText = false;\n\n  MsgPackSerializer(TWriter writer, ResourceManager* resources)\n      : writer_(writer), resources_(resources) {}\n\n  template <typename T>\n  enable_if_t<is_floating_point<T>::value && sizeof(T) == 4, size_t> visit(\n      T value32) {\n    if (canConvertNumber<JsonInteger>(value32)) {\n      JsonInteger truncatedValue = JsonInteger(value32);\n      if (value32 == T(truncatedValue))\n        return visit(truncatedValue);\n    }\n    writeByte(0xCA);\n    writeInteger(value32);\n    return bytesWritten();\n  }\n\n  template <typename T>\n  ARDUINOJSON_NO_SANITIZE(\"float-cast-overflow\")\n  enable_if_t<is_floating_point<T>::value && sizeof(T) == 8, size_t> visit(\n      T value64) {\n    float value32 = float(value64);\n    if (value32 == value64)\n      return visit(value32);\n    writeByte(0xCB);\n    writeInteger(value64);\n    return bytesWritten();\n  }\n\n  size_t visitArray(VariantData* array) {\n    ARDUINOJSON_ASSERT(array != nullptr);\n    ARDUINOJSON_ASSERT(array->isArray());\n\n    auto n = VariantImpl::size(array, resources_);\n    if (n < 0x10) {\n      writeByte(uint8_t(0x90 + n));\n    } else if (n < 0x10000) {\n      writeByte(0xDC);\n      writeInteger(uint16_t(n));\n    } else {\n      writeByte(0xDD);\n      writeInteger(uint32_t(n));\n    }\n\n    auto slotId = array->content.asCollection.head;\n    while (slotId != NULL_SLOT) {\n      auto slot = resources_->getVariant(slotId);\n      VariantImpl::accept(*this, slot, resources_);\n      slotId = slot->next;\n    }\n\n    return bytesWritten();\n  }\n\n  size_t visitObject(VariantData* object) {\n    ARDUINOJSON_ASSERT(object != nullptr);\n    ARDUINOJSON_ASSERT(object->isObject());\n\n    auto n = VariantImpl::size(object, resources_);\n    if (n < 0x10) {\n      writeByte(uint8_t(0x80 + n));\n    } else if (n < 0x10000) {\n      writeByte(0xDE);\n      writeInteger(uint16_t(n));\n    } else {\n      writeByte(0xDF);\n      writeInteger(uint32_t(n));\n    }\n\n    auto slotId = object->content.asCollection.head;\n    while (slotId != NULL_SLOT) {\n      auto slot = resources_->getVariant(slotId);\n      VariantImpl::accept(*this, slot, resources_);\n      slotId = slot->next;\n    }\n\n    return bytesWritten();\n  }\n\n  size_t visit(const char* value) {\n    return visit(JsonString(value));\n  }\n\n  size_t visit(JsonString value) {\n    ARDUINOJSON_ASSERT(!value.isNull());\n\n    auto n = value.size();\n\n    if (n < 0x20) {\n      writeByte(uint8_t(0xA0 + n));\n    } else if (n < 0x100) {\n      writeByte(0xD9);\n      writeInteger(uint8_t(n));\n    } else if (n < 0x10000) {\n      writeByte(0xDA);\n      writeInteger(uint16_t(n));\n    } else {\n      writeByte(0xDB);\n      writeInteger(uint32_t(n));\n    }\n    writeBytes(reinterpret_cast<const uint8_t*>(value.c_str()), n);\n    return bytesWritten();\n  }\n\n  size_t visit(RawString value) {\n    writeBytes(reinterpret_cast<const uint8_t*>(value.data()), value.size());\n    return bytesWritten();\n  }\n\n  size_t visit(JsonInteger value) {\n    if (value > 0) {\n      visit(static_cast<JsonUInt>(value));\n    } else if (value >= -0x20) {\n      writeInteger(int8_t(value));\n    } else if (value >= -0x80) {\n      writeByte(0xD0);\n      writeInteger(int8_t(value));\n    } else if (value >= -0x8000) {\n      writeByte(0xD1);\n      writeInteger(int16_t(value));\n    }\n#if ARDUINOJSON_USE_LONG_LONG\n    else if (value >= -0x80000000LL)\n#else\n    else\n#endif\n    {\n      writeByte(0xD2);\n      writeInteger(int32_t(value));\n    }\n#if ARDUINOJSON_USE_LONG_LONG\n    else {\n      writeByte(0xD3);\n      writeInteger(int64_t(value));\n    }\n#endif\n    return bytesWritten();\n  }\n\n  size_t visit(JsonUInt value) {\n    if (value <= 0x7F) {\n      writeInteger(uint8_t(value));\n    } else if (value <= 0xFF) {\n      writeByte(0xCC);\n      writeInteger(uint8_t(value));\n    } else if (value <= 0xFFFF) {\n      writeByte(0xCD);\n      writeInteger(uint16_t(value));\n    }\n#if ARDUINOJSON_USE_LONG_LONG\n    else if (value <= 0xFFFFFFFF)\n#else\n    else\n#endif\n    {\n      writeByte(0xCE);\n      writeInteger(uint32_t(value));\n    }\n#if ARDUINOJSON_USE_LONG_LONG\n    else {\n      writeByte(0xCF);\n      writeInteger(uint64_t(value));\n    }\n#endif\n    return bytesWritten();\n  }\n\n  size_t visit(bool value) {\n    writeByte(value ? 0xC3 : 0xC2);\n    return bytesWritten();\n  }\n\n  size_t visit(nullptr_t) {\n    writeByte(0xC0);\n    return bytesWritten();\n  }\n\n private:\n  size_t bytesWritten() const {\n    return writer_.count();\n  }\n\n  void writeByte(uint8_t c) {\n    writer_.write(c);\n  }\n\n  void writeBytes(const uint8_t* p, size_t n) {\n    writer_.write(p, n);\n  }\n\n  template <typename T>\n  void writeInteger(T value) {\n    fixEndianness(value);\n    writeBytes(reinterpret_cast<uint8_t*>(&value), sizeof(value));\n  }\n\n  CountingDecorator<TWriter> writer_;\n  ResourceManager* resources_;\n};\n\nARDUINOJSON_END_PRIVATE_NAMESPACE\n\nARDUINOJSON_BEGIN_PUBLIC_NAMESPACE\n\n// Produces a MessagePack document.\n// https://arduinojson.org/v7/api/msgpack/serializemsgpack/\ntemplate <\n    typename TDestination,\n    detail::enable_if_t<!detail::is_pointer<TDestination>::value, int> = 0>\ninline size_t serializeMsgPack(JsonVariantConst source, TDestination& output) {\n  using namespace ArduinoJson::detail;\n  return serialize<MsgPackSerializer>(source, output);\n}\n\n// Produces a MessagePack document.\n// https://arduinojson.org/v7/api/msgpack/serializemsgpack/\ninline size_t serializeMsgPack(JsonVariantConst source, void* output,\n                               size_t size) {\n  using namespace ArduinoJson::detail;\n  return serialize<MsgPackSerializer>(source, output, size);\n}\n\n// Computes the length of the document that serializeMsgPack() produces.\n// https://arduinojson.org/v7/api/msgpack/measuremsgpack/\ninline size_t measureMsgPack(JsonVariantConst source) {\n  using namespace ArduinoJson::detail;\n  return measure<MsgPackSerializer>(source);\n}\n\nARDUINOJSON_END_PUBLIC_NAMESPACE\n"
  },
  {
    "path": "src/ArduinoJson/MsgPack/endianness.hpp",
    "content": "// ArduinoJson - https://arduinojson.org\n// Copyright © 2014-2025, Benoit BLANCHON\n// MIT License\n\n#pragma once\n\n#include <ArduinoJson/Polyfills/type_traits.hpp>\n\nARDUINOJSON_BEGIN_PRIVATE_NAMESPACE\n\n#if ARDUINOJSON_LITTLE_ENDIAN\ninline void swapBytes(uint8_t& a, uint8_t& b) {\n  uint8_t t(a);\n  a = b;\n  b = t;\n}\n\ninline void fixEndianness(uint8_t* p, integral_constant<size_t, 8>) {\n  swapBytes(p[0], p[7]);\n  swapBytes(p[1], p[6]);\n  swapBytes(p[2], p[5]);\n  swapBytes(p[3], p[4]);\n}\n\ninline void fixEndianness(uint8_t* p, integral_constant<size_t, 4>) {\n  swapBytes(p[0], p[3]);\n  swapBytes(p[1], p[2]);\n}\n\ninline void fixEndianness(uint8_t* p, integral_constant<size_t, 2>) {\n  swapBytes(p[0], p[1]);\n}\n\ninline void fixEndianness(uint8_t*, integral_constant<size_t, 1>) {}\n\ntemplate <typename T>\ninline void fixEndianness(T& value) {\n  fixEndianness(reinterpret_cast<uint8_t*>(&value),\n                integral_constant<size_t, sizeof(T)>());\n}\n#else\ntemplate <typename T>\ninline void fixEndianness(T&) {}\n#endif\n\nARDUINOJSON_END_PRIVATE_NAMESPACE\n"
  },
  {
    "path": "src/ArduinoJson/MsgPack/ieee754.hpp",
    "content": "// ArduinoJson - https://arduinojson.org\n// Copyright © 2014-2025, Benoit BLANCHON\n// MIT License\n\n#pragma once\n\n#include <ArduinoJson/Namespace.hpp>\n\nARDUINOJSON_BEGIN_PRIVATE_NAMESPACE\n\ninline void doubleToFloat(const uint8_t d[8], uint8_t f[4]) {\n  f[0] = uint8_t((d[0] & 0xC0) | (d[0] << 3 & 0x3f) | (d[1] >> 5));\n  f[1] = uint8_t((d[1] << 3) | (d[2] >> 5));\n  f[2] = uint8_t((d[2] << 3) | (d[3] >> 5));\n  f[3] = uint8_t((d[3] << 3) | (d[4] >> 5));\n}\n\nARDUINOJSON_END_PRIVATE_NAMESPACE\n"
  },
  {
    "path": "src/ArduinoJson/Namespace.hpp",
    "content": "// ArduinoJson - https://arduinojson.org\n// Copyright © 2014-2025, Benoit BLANCHON\n// MIT License\n\n#pragma once\n\n#include <ArduinoJson/Configuration.hpp>\n#include <ArduinoJson/Polyfills/preprocessor.hpp>\n#include <ArduinoJson/version.hpp>\n\n#ifndef ARDUINOJSON_VERSION_NAMESPACE\n\n#  define ARDUINOJSON_VERSION_NAMESPACE                               \\\n    ARDUINOJSON_CONCAT5(                                              \\\n        ARDUINOJSON_VERSION_MACRO,                                    \\\n        ARDUINOJSON_BIN2ALPHA(ARDUINOJSON_ENABLE_PROGMEM,             \\\n                              ARDUINOJSON_USE_LONG_LONG,              \\\n                              ARDUINOJSON_USE_DOUBLE, 1),             \\\n        ARDUINOJSON_BIN2ALPHA(                                        \\\n            ARDUINOJSON_ENABLE_NAN, ARDUINOJSON_ENABLE_INFINITY,      \\\n            ARDUINOJSON_ENABLE_COMMENTS, ARDUINOJSON_DECODE_UNICODE), \\\n        ARDUINOJSON_SLOT_ID_SIZE, ARDUINOJSON_STRING_LENGTH_SIZE)\n\n#endif\n\n#define ARDUINOJSON_BEGIN_PUBLIC_NAMESPACE \\\n  namespace ArduinoJson {                  \\\n  inline namespace ARDUINOJSON_VERSION_NAMESPACE {\n\n#define ARDUINOJSON_END_PUBLIC_NAMESPACE \\\n  }                                      \\\n  }\n\n#define ARDUINOJSON_BEGIN_PRIVATE_NAMESPACE        \\\n  namespace ArduinoJson {                          \\\n  inline namespace ARDUINOJSON_VERSION_NAMESPACE { \\\n  namespace detail {\n\n#define ARDUINOJSON_END_PRIVATE_NAMESPACE \\\n  }                                       \\\n  }                                       \\\n  }\n"
  },
  {
    "path": "src/ArduinoJson/Numbers/FloatParts.hpp",
    "content": "// ArduinoJson - https://arduinojson.org\n// Copyright © 2014-2025, Benoit BLANCHON\n// MIT License\n\n#pragma once\n\n#include <ArduinoJson/Configuration.hpp>\n#include <ArduinoJson/Numbers/FloatTraits.hpp>\n#include <ArduinoJson/Numbers/JsonFloat.hpp>\n#include <ArduinoJson/Polyfills/math.hpp>\n\nARDUINOJSON_BEGIN_PRIVATE_NAMESPACE\n\nstruct FloatParts {\n  uint32_t integral;\n  uint32_t decimal;\n  int16_t exponent;\n  int8_t decimalPlaces;\n};\n\ntemplate <typename TFloat>\ninline int16_t normalize(TFloat& value) {\n  using traits = FloatTraits<TFloat>;\n  int16_t powersOf10 = 0;\n\n  int8_t index = sizeof(TFloat) == 8 ? 8 : 5;\n  int bit = 1 << index;\n\n  if (value >= ARDUINOJSON_POSITIVE_EXPONENTIATION_THRESHOLD) {\n    for (; index >= 0; index--) {\n      if (value >= traits::positiveBinaryPowersOfTen()[uint8_t(index)]) {\n        value *= traits::negativeBinaryPowersOfTen()[uint8_t(index)];\n        powersOf10 = int16_t(powersOf10 + bit);\n      }\n      bit >>= 1;\n    }\n  }\n\n  if (value > 0 && value <= ARDUINOJSON_NEGATIVE_EXPONENTIATION_THRESHOLD) {\n    for (; index >= 0; index--) {\n      if (value < traits::negativeBinaryPowersOfTen()[uint8_t(index)] * 10) {\n        value *= traits::positiveBinaryPowersOfTen()[uint8_t(index)];\n        powersOf10 = int16_t(powersOf10 - bit);\n      }\n      bit >>= 1;\n    }\n  }\n\n  return powersOf10;\n}\n\nconstexpr uint32_t pow10(int exponent) {\n  return (exponent == 0) ? 1 : 10 * pow10(exponent - 1);\n}\n\ninline FloatParts decomposeFloat(JsonFloat value, int8_t decimalPlaces) {\n  uint32_t maxDecimalPart = pow10(decimalPlaces);\n\n  int16_t exponent = normalize(value);\n\n  uint32_t integral = uint32_t(value);\n  // reduce number of decimal places by the number of integral places\n  for (uint32_t tmp = integral; tmp >= 10; tmp /= 10) {\n    maxDecimalPart /= 10;\n    decimalPlaces--;\n  }\n\n  JsonFloat remainder =\n      (value - JsonFloat(integral)) * JsonFloat(maxDecimalPart);\n\n  uint32_t decimal = uint32_t(remainder);\n  remainder = remainder - JsonFloat(decimal);\n\n  // rounding:\n  // increment by 1 if remainder >= 0.5\n  decimal += uint32_t(remainder * 2);\n  if (decimal >= maxDecimalPart) {\n    decimal = 0;\n    integral++;\n    if (exponent && integral >= 10) {\n      exponent++;\n      integral = 1;\n    }\n  }\n\n  // remove trailing zeros\n  while (decimal % 10 == 0 && decimalPlaces > 0) {\n    decimal /= 10;\n    decimalPlaces--;\n  }\n\n  return {integral, decimal, exponent, decimalPlaces};\n}\n\nARDUINOJSON_END_PRIVATE_NAMESPACE\n"
  },
  {
    "path": "src/ArduinoJson/Numbers/FloatTraits.hpp",
    "content": "// ArduinoJson - https://arduinojson.org\n// Copyright © 2014-2025, Benoit BLANCHON\n// MIT License\n\n#pragma once\n\n#include <stddef.h>  // for size_t\n#include <stdint.h>\n\n#include <ArduinoJson/Configuration.hpp>\n#include <ArduinoJson/Polyfills/alias_cast.hpp>\n#include <ArduinoJson/Polyfills/math.hpp>\n#include <ArduinoJson/Polyfills/pgmspace_generic.hpp>\n#include <ArduinoJson/Polyfills/preprocessor.hpp>\n#include <ArduinoJson/Polyfills/type_traits.hpp>\n\nARDUINOJSON_BEGIN_PRIVATE_NAMESPACE\n\ntemplate <typename T, size_t = sizeof(T)>\nstruct FloatTraits {};\n\ntemplate <typename T>\nstruct FloatTraits<T, 8 /*64bits*/> {\n  using mantissa_type = uint64_t;\n  static const short mantissa_bits = 52;\n  static const mantissa_type mantissa_max =\n      (mantissa_type(1) << mantissa_bits) - 1;\n\n  using exponent_type = int16_t;\n  static const exponent_type exponent_max = 308;\n\n  static pgm_array<T, 9> positiveBinaryPowersOfTen() {\n    ARDUINOJSON_DEFINE_PROGMEM_ARRAY(  //\n        uint64_t, factors,\n        {\n            0x4024000000000000,  // 1e1\n            0x4059000000000000,  // 1e2\n            0x40C3880000000000,  // 1e4\n            0x4197D78400000000,  // 1e8\n            0x4341C37937E08000,  // 1e16\n            0x4693B8B5B5056E17,  // 1e32\n            0x4D384F03E93FF9F5,  // 1e64\n            0x5A827748F9301D32,  // 1e128\n            0x75154FDD7F73BF3C,  // 1e256\n        });\n    return pgm_array<T, 9>(reinterpret_cast<const T*>(factors));\n  }\n\n  static pgm_array<T, 9> negativeBinaryPowersOfTen() {\n    ARDUINOJSON_DEFINE_PROGMEM_ARRAY(  //\n        uint64_t, factors,\n        {\n            0x3FB999999999999A,  // 1e-1\n            0x3F847AE147AE147B,  // 1e-2\n            0x3F1A36E2EB1C432D,  // 1e-4\n            0x3E45798EE2308C3A,  // 1e-8\n            0x3C9CD2B297D889BC,  // 1e-16\n            0x3949F623D5A8A733,  // 1e-32\n            0x32A50FFD44F4A73D,  // 1e-64\n            0x255BBA08CF8C979D,  // 1e-128\n            0x0AC8062864AC6F43   // 1e-256\n        });\n    return pgm_array<T, 9>(reinterpret_cast<const T*>(factors));\n  }\n\n  static T nan() {\n    return forge(0x7ff8000000000000);\n  }\n\n  static T inf() {\n    return forge(0x7ff0000000000000);\n  }\n\n  static T highest() {\n    return forge(0x7FEFFFFFFFFFFFFF);\n  }\n\n  template <typename TOut>  // int64_t\n  static T highest_for(\n      enable_if_t<is_integral<TOut>::value && is_signed<TOut>::value &&\n                      sizeof(TOut) == 8,\n                  signed>* = 0) {\n    return forge(0x43DFFFFFFFFFFFFF);  //  9.2233720368547748e+18\n  }\n\n  template <typename TOut>  // uint64_t\n  static T highest_for(\n      enable_if_t<is_integral<TOut>::value && is_unsigned<TOut>::value &&\n                      sizeof(TOut) == 8,\n                  unsigned>* = 0) {\n    return forge(0x43EFFFFFFFFFFFFF);  //  1.8446744073709549568e+19\n  }\n\n  static T lowest() {\n    return forge(0xFFEFFFFFFFFFFFFF);\n  }\n\n  // constructs a double floating point values from its binary representation\n  // we use this function to workaround platforms with single precision literals\n  // (for example, when -fsingle-precision-constant is passed to GCC)\n  static T forge(uint64_t bits) {\n    return alias_cast<T>(bits);\n  }\n};\n\ntemplate <typename T>\nstruct FloatTraits<T, 4 /*32bits*/> {\n  using mantissa_type = uint32_t;\n  static const short mantissa_bits = 23;\n  static const mantissa_type mantissa_max =\n      (mantissa_type(1) << mantissa_bits) - 1;\n\n  using exponent_type = int8_t;\n  static const exponent_type exponent_max = 38;\n\n  static pgm_array<T, 6> positiveBinaryPowersOfTen() {\n    ARDUINOJSON_DEFINE_PROGMEM_ARRAY(uint32_t, factors,\n                                     {\n                                         0x41200000,  // 1e1f\n                                         0x42c80000,  // 1e2f\n                                         0x461c4000,  // 1e4f\n                                         0x4cbebc20,  // 1e8f\n                                         0x5a0e1bca,  // 1e16f\n                                         0x749dc5ae   // 1e32f\n                                     });\n    return pgm_array<T, 6>(reinterpret_cast<const T*>(factors));\n  }\n\n  static pgm_array<T, 6> negativeBinaryPowersOfTen() {\n    ARDUINOJSON_DEFINE_PROGMEM_ARRAY(uint32_t, factors,\n                                     {\n                                         0x3dcccccd,  // 1e-1f\n                                         0x3c23d70a,  // 1e-2f\n                                         0x38d1b717,  // 1e-4f\n                                         0x322bcc77,  // 1e-8f\n                                         0x24e69595,  // 1e-16f\n                                         0x0a4fb11f   // 1e-32f\n                                     });\n    return pgm_array<T, 6>(reinterpret_cast<const T*>(factors));\n  }\n\n  static T forge(uint32_t bits) {\n    return alias_cast<T>(bits);\n  }\n\n  static T nan() {\n    return forge(0x7fc00000);\n  }\n\n  static T inf() {\n    return forge(0x7f800000);\n  }\n\n  static T highest() {\n    return forge(0x7f7fffff);\n  }\n\n  template <typename TOut>  // int32_t\n  static T highest_for(\n      enable_if_t<is_integral<TOut>::value && is_signed<TOut>::value &&\n                      sizeof(TOut) == 4,\n                  signed>* = 0) {\n    return forge(0x4EFFFFFF);  // 2.14748352E9\n  }\n\n  template <typename TOut>  // uint32_t\n  static T highest_for(\n      enable_if_t<is_integral<TOut>::value && is_unsigned<TOut>::value &&\n                      sizeof(TOut) == 4,\n                  unsigned>* = 0) {\n    return forge(0x4F7FFFFF);  // 4.29496704E9\n  }\n\n  template <typename TOut>  // int64_t\n  static T highest_for(\n      enable_if_t<is_integral<TOut>::value && is_signed<TOut>::value &&\n                      sizeof(TOut) == 8,\n                  signed>* = 0) {\n    return forge(0x5EFFFFFF);  // 9.22337148709896192E18\n  }\n\n  template <typename TOut>  // uint64_t\n  static T highest_for(\n      enable_if_t<is_integral<TOut>::value && is_unsigned<TOut>::value &&\n                      sizeof(TOut) == 8,\n                  unsigned>* = 0) {\n    return forge(0x5F7FFFFF);  // 1.844674297419792384E19\n  }\n\n  static T lowest() {\n    return forge(0xFf7fffff);\n  }\n};\n\n// Returns m*10^e\ntemplate <typename TFloat, typename TExponent>\ninline TFloat multiplyByPowerOfTen(TFloat m, TExponent e) {\n  using traits = FloatTraits<TFloat>;\n\n  auto powersOfTen = e > 0 ? traits::positiveBinaryPowersOfTen()\n                           : traits::negativeBinaryPowersOfTen();\n\n  if (e <= 0)\n    e = TExponent(-e);\n\n  for (uint8_t index = 0; e != 0; index++) {\n    if (index >= powersOfTen.size())\n      return traits::nan();\n    if (e & 1)\n      m *= powersOfTen[index];\n    e >>= 1;\n  }\n  return m;\n}\n\nARDUINOJSON_END_PRIVATE_NAMESPACE\n"
  },
  {
    "path": "src/ArduinoJson/Numbers/JsonFloat.hpp",
    "content": "// ArduinoJson - https://arduinojson.org\n// Copyright © 2014-2025, Benoit BLANCHON\n// MIT License\n\n#pragma once\n\n#include <ArduinoJson/Configuration.hpp>\n#include <ArduinoJson/Namespace.hpp>\n\nARDUINOJSON_BEGIN_PUBLIC_NAMESPACE\n\n#if ARDUINOJSON_USE_DOUBLE\nusing JsonFloat = double;\n#else\nusing JsonFloat = float;\n#endif\n\nARDUINOJSON_END_PUBLIC_NAMESPACE\n"
  },
  {
    "path": "src/ArduinoJson/Numbers/JsonInteger.hpp",
    "content": "// ArduinoJson - https://arduinojson.org\n// Copyright © 2014-2025, Benoit BLANCHON\n// MIT License\n\n#pragma once\n\n#include <ArduinoJson/Configuration.hpp>\n#include <ArduinoJson/Namespace.hpp>\n\n#include <stdint.h>  // int64_t\n\nARDUINOJSON_BEGIN_PUBLIC_NAMESPACE\n\n#if ARDUINOJSON_USE_LONG_LONG\nusing JsonInteger = int64_t;\nusing JsonUInt = uint64_t;\n#else\nusing JsonInteger = long;\nusing JsonUInt = unsigned long;\n#endif\n\nARDUINOJSON_END_PUBLIC_NAMESPACE\n\n#define ARDUINOJSON_ASSERT_INTEGER_TYPE_IS_SUPPORTED(T)                  \\\n  static_assert(sizeof(T) <= sizeof(ArduinoJson::JsonInteger),           \\\n                \"To use 64-bit integers with ArduinoJson, you must set \" \\\n                \"ARDUINOJSON_USE_LONG_LONG to 1. See \"                   \\\n                \"https://arduinojson.org/v7/api/config/use_long_long/\");\n"
  },
  {
    "path": "src/ArduinoJson/Numbers/arithmeticCompare.hpp",
    "content": "// ArduinoJson - https://arduinojson.org\n// Copyright © 2014-2025, Benoit BLANCHON\n// MIT License\n\n#pragma once\n\n#include <ArduinoJson/Numbers/JsonInteger.hpp>\n#include <ArduinoJson/Polyfills/type_traits.hpp>\n\nARDUINOJSON_BEGIN_PRIVATE_NAMESPACE\n\nenum CompareResult {\n  COMPARE_RESULT_DIFFER = 0,\n  COMPARE_RESULT_EQUAL = 1,\n  COMPARE_RESULT_GREATER = 2,\n  COMPARE_RESULT_LESS = 4,\n\n  COMPARE_RESULT_GREATER_OR_EQUAL = 3,\n  COMPARE_RESULT_LESS_OR_EQUAL = 5\n};\n\ntemplate <typename T>\nCompareResult arithmeticCompare(const T& lhs, const T& rhs) {\n  if (lhs < rhs)\n    return COMPARE_RESULT_LESS;\n  else if (lhs > rhs)\n    return COMPARE_RESULT_GREATER;\n  else\n    return COMPARE_RESULT_EQUAL;\n}\n\ntemplate <typename T1, typename T2>\nCompareResult arithmeticCompare(\n    const T1& lhs, const T2& rhs,\n    enable_if_t<is_integral<T1>::value && is_integral<T2>::value &&\n                sizeof(T1) < sizeof(T2)>* = 0) {\n  return arithmeticCompare<T2>(static_cast<T2>(lhs), rhs);\n}\n\ntemplate <typename T1, typename T2>\nCompareResult arithmeticCompare(\n    const T1& lhs, const T2& rhs,\n    enable_if_t<is_integral<T1>::value && is_integral<T2>::value &&\n                sizeof(T2) < sizeof(T1)>* = 0) {\n  return arithmeticCompare<T1>(lhs, static_cast<T1>(rhs));\n}\n\ntemplate <typename T1, typename T2>\nCompareResult arithmeticCompare(\n    const T1& lhs, const T2& rhs,\n    enable_if_t<is_integral<T1>::value && is_integral<T2>::value &&\n                is_signed<T1>::value == is_signed<T2>::value &&\n                sizeof(T2) == sizeof(T1)>* = 0) {\n  return arithmeticCompare<T1>(lhs, static_cast<T1>(rhs));\n}\n\ntemplate <typename T1, typename T2>\nCompareResult arithmeticCompare(\n    const T1& lhs, const T2& rhs,\n    enable_if_t<is_integral<T1>::value && is_integral<T2>::value &&\n                is_unsigned<T1>::value && is_signed<T2>::value &&\n                sizeof(T2) == sizeof(T1)>* = 0) {\n  if (rhs < 0)\n    return COMPARE_RESULT_GREATER;\n  return arithmeticCompare<T1>(lhs, static_cast<T1>(rhs));\n}\n\ntemplate <typename T1, typename T2>\nCompareResult arithmeticCompare(\n    const T1& lhs, const T2& rhs,\n    enable_if_t<is_integral<T1>::value && is_integral<T2>::value &&\n                is_signed<T1>::value && is_unsigned<T2>::value &&\n                sizeof(T2) == sizeof(T1)>* = 0) {\n  if (lhs < 0)\n    return COMPARE_RESULT_LESS;\n  return arithmeticCompare<T2>(static_cast<T2>(lhs), rhs);\n}\n\ntemplate <typename T1, typename T2>\nCompareResult arithmeticCompare(\n    const T1& lhs, const T2& rhs,\n    enable_if_t<is_floating_point<T1>::value || is_floating_point<T2>::value>* =\n        0) {\n  return arithmeticCompare<double>(static_cast<double>(lhs),\n                                   static_cast<double>(rhs));\n}\n\ntemplate <typename T2>\nCompareResult arithmeticCompareNegateLeft(\n    JsonUInt, const T2&, enable_if_t<is_unsigned<T2>::value>* = 0) {\n  return COMPARE_RESULT_LESS;\n}\n\ntemplate <typename T2>\nCompareResult arithmeticCompareNegateLeft(\n    JsonUInt lhs, const T2& rhs, enable_if_t<is_signed<T2>::value>* = 0) {\n  if (rhs > 0)\n    return COMPARE_RESULT_LESS;\n  return arithmeticCompare(-rhs, static_cast<T2>(lhs));\n}\n\ntemplate <typename T1>\nCompareResult arithmeticCompareNegateRight(\n    const T1&, JsonUInt, enable_if_t<is_unsigned<T1>::value>* = 0) {\n  return COMPARE_RESULT_GREATER;\n}\n\ntemplate <typename T1>\nCompareResult arithmeticCompareNegateRight(\n    const T1& lhs, JsonUInt rhs, enable_if_t<is_signed<T1>::value>* = 0) {\n  if (lhs > 0)\n    return COMPARE_RESULT_GREATER;\n  return arithmeticCompare(static_cast<T1>(rhs), -lhs);\n}\n\nARDUINOJSON_END_PRIVATE_NAMESPACE\n"
  },
  {
    "path": "src/ArduinoJson/Numbers/convertNumber.hpp",
    "content": "// ArduinoJson - https://arduinojson.org\n// Copyright © 2014-2025, Benoit BLANCHON\n// MIT License\n\n#pragma once\n\n#if defined(__clang__)\n#  pragma clang diagnostic push\n#  pragma clang diagnostic ignored \"-Wconversion\"\n#elif defined(__GNUC__)\n#  pragma GCC diagnostic push\n#  pragma GCC diagnostic ignored \"-Wconversion\"\n#endif\n\n#include <ArduinoJson/Numbers/FloatTraits.hpp>\n#include <ArduinoJson/Numbers/JsonFloat.hpp>\n#include <ArduinoJson/Polyfills/limits.hpp>\n#include <ArduinoJson/Polyfills/type_traits.hpp>\n\nARDUINOJSON_BEGIN_PRIVATE_NAMESPACE\n\n// uint32 -> int32\n// uint64 -> int32\ntemplate <typename TOut, typename TIn>\nenable_if_t<is_integral<TIn>::value && is_unsigned<TIn>::value &&\n                is_integral<TOut>::value && sizeof(TOut) <= sizeof(TIn),\n            bool>\ncanConvertNumber(TIn value) {\n  return value <= TIn(numeric_limits<TOut>::highest());\n}\n\n// uint32 -> int64\ntemplate <typename TOut, typename TIn>\nenable_if_t<is_integral<TIn>::value && is_unsigned<TIn>::value &&\n                is_integral<TOut>::value && sizeof(TIn) < sizeof(TOut),\n            bool>\ncanConvertNumber(TIn) {\n  return true;\n}\n\n// uint32 -> float\n// int32 -> float\ntemplate <typename TOut, typename TIn>\nenable_if_t<is_integral<TIn>::value && is_floating_point<TOut>::value, bool>\ncanConvertNumber(TIn) {\n  return true;\n}\n\n// int64 -> int32\ntemplate <typename TOut, typename TIn>\nenable_if_t<is_integral<TIn>::value && is_signed<TIn>::value &&\n                is_integral<TOut>::value && is_signed<TOut>::value &&\n                sizeof(TOut) < sizeof(TIn),\n            bool>\ncanConvertNumber(TIn value) {\n  return value >= TIn(numeric_limits<TOut>::lowest()) &&\n         value <= TIn(numeric_limits<TOut>::highest());\n}\n\n// int32 -> int32\n// int32 -> int64\ntemplate <typename TOut, typename TIn>\nenable_if_t<is_integral<TIn>::value && is_signed<TIn>::value &&\n                is_integral<TOut>::value && is_signed<TOut>::value &&\n                sizeof(TIn) <= sizeof(TOut),\n            bool>\ncanConvertNumber(TIn) {\n  return true;\n}\n\n// int32 -> uint32\n// int32 -> uint64\ntemplate <typename TOut, typename TIn>\nenable_if_t<is_integral<TIn>::value && is_signed<TIn>::value &&\n                is_integral<TOut>::value && is_unsigned<TOut>::value &&\n                sizeof(TOut) >= sizeof(TIn),\n            bool>\ncanConvertNumber(TIn value) {\n  if (value < 0)\n    return false;\n  return TOut(value) <= numeric_limits<TOut>::highest();\n}\n\n// int32 -> uint16\ntemplate <typename TOut, typename TIn>\nenable_if_t<is_integral<TIn>::value && is_signed<TIn>::value &&\n                is_integral<TOut>::value && is_unsigned<TOut>::value &&\n                sizeof(TOut) < sizeof(TIn),\n            bool>\ncanConvertNumber(TIn value) {\n  if (value < 0)\n    return false;\n  return value <= TIn(numeric_limits<TOut>::highest());\n}\n\n// float32 -> int16\n// float64 -> int32\ntemplate <typename TOut, typename TIn>\nenable_if_t<is_floating_point<TIn>::value && is_integral<TOut>::value &&\n                sizeof(TOut) < sizeof(TIn),\n            bool>\ncanConvertNumber(TIn value) {\n  return value >= numeric_limits<TOut>::lowest() &&\n         value <= numeric_limits<TOut>::highest();\n}\n\n// float32 -> int32\n// float32 -> uint32\n// float32 -> int64\n// float32 -> uint64\n// float64 -> int64\n// float64 -> uint64\ntemplate <typename TOut, typename TIn>\nenable_if_t<is_floating_point<TIn>::value && is_integral<TOut>::value &&\n                sizeof(TOut) >= sizeof(TIn),\n            bool>\ncanConvertNumber(TIn value) {\n  // Avoid error \"9.22337e+18 is outside the range of representable values of\n  // type 'long'\"\n  return value >= numeric_limits<TOut>::lowest() &&\n         value <= FloatTraits<TIn>::template highest_for<TOut>();\n}\n\n// float32 -> float32\n// float64 -> float64\n// float64 -> float32\ntemplate <typename TOut, typename TIn>\nenable_if_t<is_floating_point<TIn>::value && is_floating_point<TOut>::value,\n            bool>\ncanConvertNumber(TIn) {\n  return true;\n}\n\ntemplate <typename TOut, typename TIn>\nTOut convertNumber(TIn value) {\n  return canConvertNumber<TOut>(value) ? TOut(value) : 0;\n}\n\nARDUINOJSON_END_PRIVATE_NAMESPACE\n\n#if defined(__clang__)\n#  pragma clang diagnostic pop\n#elif defined(__GNUC__)\n#  pragma GCC diagnostic pop\n#endif\n"
  },
  {
    "path": "src/ArduinoJson/Numbers/parseNumber.hpp",
    "content": "// ArduinoJson - https://arduinojson.org\n// Copyright © 2014-2025, Benoit BLANCHON\n// MIT License\n\n#pragma once\n\n#include <ArduinoJson/Numbers/FloatTraits.hpp>\n#include <ArduinoJson/Numbers/JsonFloat.hpp>\n#include <ArduinoJson/Numbers/convertNumber.hpp>\n#include <ArduinoJson/Polyfills/assert.hpp>\n#include <ArduinoJson/Polyfills/ctype.hpp>\n#include <ArduinoJson/Polyfills/math.hpp>\n#include <ArduinoJson/Polyfills/type_traits.hpp>\n\nARDUINOJSON_BEGIN_PRIVATE_NAMESPACE\n\ntemplate <typename A, typename B>\nusing largest_type = conditional_t<(sizeof(A) > sizeof(B)), A, B>;\n\nenum class NumberType : uint8_t {\n  Invalid,\n  Float,\n  SignedInteger,\n  UnsignedInteger,\n#if ARDUINOJSON_USE_DOUBLE\n  Double,\n#endif\n};\n\nunion NumberValue {\n  NumberValue() {}\n  NumberValue(float x) : asFloat(x) {}\n  NumberValue(JsonInteger x) : asSignedInteger(x) {}\n  NumberValue(JsonUInt x) : asUnsignedInteger(x) {}\n#if ARDUINOJSON_USE_DOUBLE\n  NumberValue(double x) : asDouble(x) {}\n#endif\n\n  JsonInteger asSignedInteger;\n  JsonUInt asUnsignedInteger;\n  float asFloat;\n#if ARDUINOJSON_USE_DOUBLE\n  double asDouble;\n#endif\n};\n\nclass Number {\n  NumberType type_;\n  NumberValue value_;\n\n public:\n  Number() : type_(NumberType::Invalid) {}\n  Number(float value) : type_(NumberType::Float), value_(value) {}\n  Number(JsonInteger value) : type_(NumberType::SignedInteger), value_(value) {}\n  Number(JsonUInt value) : type_(NumberType::UnsignedInteger), value_(value) {}\n#if ARDUINOJSON_USE_DOUBLE\n  Number(double value) : type_(NumberType::Double), value_(value) {}\n#endif\n\n  template <typename T>\n  T convertTo() const {\n    switch (type_) {\n      case NumberType::Float:\n        return convertNumber<T>(value_.asFloat);\n      case NumberType::SignedInteger:\n        return convertNumber<T>(value_.asSignedInteger);\n      case NumberType::UnsignedInteger:\n        return convertNumber<T>(value_.asUnsignedInteger);\n#if ARDUINOJSON_USE_DOUBLE\n      case NumberType::Double:\n        return convertNumber<T>(value_.asDouble);\n#endif\n      default:\n        return T();\n    }\n  }\n\n  NumberType type() const {\n    return type_;\n  }\n\n  JsonInteger asSignedInteger() const {\n    ARDUINOJSON_ASSERT(type_ == NumberType::SignedInteger);\n    return value_.asSignedInteger;\n  }\n\n  JsonUInt asUnsignedInteger() const {\n    ARDUINOJSON_ASSERT(type_ == NumberType::UnsignedInteger);\n    return value_.asUnsignedInteger;\n  }\n\n  float asFloat() const {\n    ARDUINOJSON_ASSERT(type_ == NumberType::Float);\n    return value_.asFloat;\n  }\n\n#if ARDUINOJSON_USE_DOUBLE\n  double asDouble() const {\n    ARDUINOJSON_ASSERT(type_ == NumberType::Double);\n    return value_.asDouble;\n  }\n#endif\n};\n\ninline Number parseNumber(const char* s) {\n  using traits = FloatTraits<JsonFloat>;\n  using mantissa_t = largest_type<traits::mantissa_type, JsonUInt>;\n  using exponent_t = traits::exponent_type;\n\n  ARDUINOJSON_ASSERT(s != 0);\n\n  bool is_negative = false;\n  switch (*s) {\n    case '-':\n      is_negative = true;\n      s++;\n      break;\n    case '+':\n      s++;\n      break;\n  }\n\n#if ARDUINOJSON_ENABLE_NAN\n  if (*s == 'n' || *s == 'N') {\n    return Number(traits::nan());\n  }\n#endif\n\n#if ARDUINOJSON_ENABLE_INFINITY\n  if (*s == 'i' || *s == 'I') {\n    return Number(is_negative ? -traits::inf() : traits::inf());\n  }\n#endif\n\n  if (!isdigit(*s) && *s != '.')\n    return Number();\n\n  mantissa_t mantissa = 0;\n  exponent_t exponent_offset = 0;\n  const mantissa_t maxUint = JsonUInt(-1);\n\n  while (isdigit(*s)) {\n    uint8_t digit = uint8_t(*s - '0');\n    if (mantissa > maxUint / 10)\n      break;\n    mantissa *= 10;\n    if (mantissa > maxUint - digit)\n      break;\n    mantissa += digit;\n    s++;\n  }\n\n  if (*s == '\\0') {\n    if (is_negative) {\n      const mantissa_t sintMantissaMax = mantissa_t(1)\n                                         << (sizeof(JsonInteger) * 8 - 1);\n      if (mantissa <= sintMantissaMax) {\n        return Number(JsonInteger(~mantissa + 1));\n      }\n    } else {\n      return Number(JsonUInt(mantissa));\n    }\n  }\n\n  // avoid mantissa overflow\n  while (mantissa > traits::mantissa_max) {\n    mantissa /= 10;\n    exponent_offset++;\n  }\n\n  // remaing digits can't fit in the mantissa\n  while (isdigit(*s)) {\n    exponent_offset++;\n    s++;\n  }\n\n  if (*s == '.') {\n    s++;\n    while (isdigit(*s)) {\n      if (mantissa < traits::mantissa_max / 10) {\n        mantissa = mantissa * 10 + uint8_t(*s - '0');\n        exponent_offset--;\n      }\n      s++;\n    }\n  }\n\n  int exponent = 0;\n  if (*s == 'e' || *s == 'E') {\n    s++;\n    bool negative_exponent = false;\n    if (*s == '-') {\n      negative_exponent = true;\n      s++;\n    } else if (*s == '+') {\n      s++;\n    }\n\n    while (isdigit(*s)) {\n      exponent = exponent * 10 + (*s - '0');\n      if (exponent + exponent_offset > traits::exponent_max) {\n        if (negative_exponent)\n          return Number(is_negative ? -0.0f : 0.0f);\n        else\n          return Number(is_negative ? -traits::inf() : traits::inf());\n      }\n      s++;\n    }\n    if (negative_exponent)\n      exponent = -exponent;\n  }\n  exponent += exponent_offset;\n\n  // we should be at the end of the string, otherwise it's an error\n  if (*s != '\\0')\n    return Number();\n\n#if ARDUINOJSON_USE_DOUBLE\n  bool isDouble = exponent < -FloatTraits<float>::exponent_max ||\n                  exponent > FloatTraits<float>::exponent_max ||\n                  mantissa > FloatTraits<float>::mantissa_max;\n  if (isDouble) {\n    auto final_result = multiplyByPowerOfTen(double(mantissa), exponent);\n    return Number(is_negative ? -final_result : final_result);\n  } else\n#endif\n  {\n    auto final_result = multiplyByPowerOfTen(float(mantissa), exponent);\n    return Number(is_negative ? -final_result : final_result);\n  }\n}\n\ntemplate <typename T>\ninline T parseNumber(const char* s) {\n  return parseNumber(s).convertTo<T>();\n}\n\nARDUINOJSON_END_PRIVATE_NAMESPACE\n"
  },
  {
    "path": "src/ArduinoJson/Object/JsonObject.hpp",
    "content": "// ArduinoJson - https://arduinojson.org\n// Copyright © 2014-2025, Benoit BLANCHON\n// MIT License\n\n#pragma once\n\n#include <ArduinoJson/Object/JsonObjectConst.hpp>\n#include <ArduinoJson/Object/MemberProxy.hpp>\n\nARDUINOJSON_BEGIN_PUBLIC_NAMESPACE\n\nclass JsonArray;\n\n// A reference to an object in a JsonDocument.\n// https://arduinojson.org/v7/api/jsonobject/\nclass JsonObject : public detail::VariantOperators<JsonObject> {\n  friend class detail::VariantAttorney;\n\n public:\n  using iterator = JsonObjectIterator;\n\n  // Creates an unbound reference.\n  JsonObject() {}\n\n  // INTERNAL USE ONLY\n  JsonObject(const detail::VariantImpl& impl) : impl_(impl) {}\n\n  // INTERNAL USE ONLY\n  JsonObject(detail::VariantData* data, detail::ResourceManager* resource)\n      : impl_(data, resource) {}\n\n  operator JsonVariant() const {\n    return JsonVariant(getData(), getResourceManager());\n  }\n\n  operator JsonObjectConst() const {\n    return JsonObjectConst(getData(), getResourceManager());\n  }\n\n  operator JsonVariantConst() const {\n    return JsonVariantConst(getData(), getResourceManager());\n  }\n\n  // Returns true if the reference is unbound.\n  // https://arduinojson.org/v7/api/jsonobject/isnull/\n  bool isNull() const {\n    return !impl_.isObject();\n  }\n\n  // Returns true if the reference is bound.\n  // https://arduinojson.org/v7/api/jsonobject/isnull/\n  operator bool() const {\n    return impl_.isObject();\n  }\n\n  // Returns the depth (nesting level) of the object.\n  // https://arduinojson.org/v7/api/jsonobject/nesting/\n  size_t nesting() const {\n    return impl_.nesting();\n  }\n\n  // Returns the number of members in the object.\n  // https://arduinojson.org/v7/api/jsonobject/size/\n  size_t size() const {\n    return impl_.size();\n  }\n\n  // Returns an iterator to the first key-value pair of the object.\n  // https://arduinojson.org/v7/api/jsonobject/begin/\n  iterator begin() const {\n    return iterator(impl_.createIterator(), impl_.resources());\n  }\n\n  // Returns an iterator following the last key-value pair of the object.\n  // https://arduinojson.org/v7/api/jsonobject/end/\n  iterator end() const {\n    return iterator();\n  }\n\n  // Removes all the members of the object.\n  // https://arduinojson.org/v7/api/jsonobject/clear/\n  void clear() const {\n    impl_.empty();\n  }\n\n  // Copies an object.\n  // https://arduinojson.org/v7/api/jsonobject/set/\n  bool set(JsonObjectConst src) {\n    if (isNull() || src.isNull())\n      return false;\n\n    clear();\n    for (auto kvp : src) {\n      if (!operator[](kvp.key()).set(kvp.value()))\n        return false;\n    }\n\n    return true;\n  }\n\n  // Gets or sets the member with specified key.\n  // https://arduinojson.org/v7/api/jsonobject/subscript/\n  template <typename TString,\n            detail::enable_if_t<detail::IsString<TString>::value, int> = 0>\n  detail::MemberProxy<JsonObject, detail::AdaptedString<TString>> operator[](\n      const TString& key) const {\n    return {*this, detail::adaptString(key)};\n  }\n\n  // Gets or sets the member with specified key.\n  // https://arduinojson.org/v7/api/jsonobject/subscript/\n  template <typename TChar,\n            detail::enable_if_t<detail::IsString<TChar*>::value, int> = 0>\n  detail::MemberProxy<JsonObject, detail::AdaptedString<TChar*>> operator[](\n      TChar* key) const {\n    return {*this, detail::adaptString(key)};\n  }\n\n  // Gets or sets the member with specified key.\n  // https://arduinojson.org/v7/api/jsonobject/subscript/\n  template <typename TVariant,\n            detail::enable_if_t<detail::IsVariant<TVariant>::value, int> = 0>\n  detail::MemberProxy<JsonObject, detail::AdaptedString<JsonString>> operator[](\n      const TVariant& key) const {\n    return {*this, detail::adaptString(key.template as<JsonString>())};\n  }\n\n  // Removes the member at the specified iterator.\n  // https://arduinojson.org/v7/api/jsonobject/remove/\n  FORCE_INLINE void remove(iterator it) const {\n    impl_.removeMember(it.iterator_);\n  }\n\n  // Removes the member with the specified key.\n  // https://arduinojson.org/v7/api/jsonobject/remove/\n  template <typename TString,\n            detail::enable_if_t<detail::IsString<TString>::value, int> = 0>\n  void remove(const TString& key) const {\n    impl_.removeMember(detail::adaptString(key));\n  }\n\n  // Removes the member with the specified key.\n  // https://arduinojson.org/v7/api/jsonobject/remove/\n  template <typename TVariant,\n            detail::enable_if_t<detail::IsVariant<TVariant>::value, int> = 0>\n  void remove(const TVariant& key) const {\n    if (key.template is<const char*>())\n      remove(key.template as<const char*>());\n  }\n\n  // Removes the member with the specified key.\n  // https://arduinojson.org/v7/api/jsonobject/remove/\n  template <typename TChar>\n  FORCE_INLINE void remove(TChar* key) const {\n    impl_.removeMember(detail::adaptString(key));\n  }\n\n  // DEPRECATED: use obj[key].is<T>() instead\n  // https://arduinojson.org/v7/api/jsonobject/containskey/\n  template <typename TString,\n            detail::enable_if_t<detail::IsString<TString>::value, int> = 0>\n  ARDUINOJSON_DEPRECATED(\"use obj[key].is<T>() instead\")\n  bool containsKey(const TString& key) const {\n    return impl_.getMember(detail::adaptString(key)) != 0;\n  }\n\n  // DEPRECATED: use obj[\"key\"].is<T>() instead\n  // https://arduinojson.org/v7/api/jsonobject/containskey/\n  template <typename TChar,\n            detail::enable_if_t<detail::IsString<TChar*>::value, int> = 0>\n  ARDUINOJSON_DEPRECATED(\"use obj[\\\"key\\\"].is<T>() instead\")\n  bool containsKey(TChar* key) const {\n    return impl_.getMember(detail::adaptString(key)) != 0;\n  }\n\n  // DEPRECATED: use obj[key].is<T>() instead\n  // https://arduinojson.org/v7/api/jsonobject/containskey/\n  template <typename TVariant,\n            detail::enable_if_t<detail::IsVariant<TVariant>::value, int> = 0>\n  ARDUINOJSON_DEPRECATED(\"use obj[key].is<T>() instead\")\n  bool containsKey(const TVariant& key) const {\n    return containsKey(key.template as<const char*>());\n  }\n\n  // DEPRECATED: use obj[key].to<JsonArray>() instead\n  template <typename TChar>\n  ARDUINOJSON_DEPRECATED(\"use obj[key].to<JsonArray>() instead\")\n  JsonArray createNestedArray(TChar* key) const {\n    return operator[](key).template to<JsonArray>();\n  }\n\n  // DEPRECATED: use obj[key].to<JsonArray>() instead\n  template <typename TString>\n  ARDUINOJSON_DEPRECATED(\"use obj[key].to<JsonArray>() instead\")\n  JsonArray createNestedArray(const TString& key) const {\n    return operator[](key).template to<JsonArray>();\n  }\n\n  // DEPRECATED: use obj[key].to<JsonObject>() instead\n  template <typename TChar>\n  ARDUINOJSON_DEPRECATED(\"use obj[key].to<JsonObject>() instead\")\n  JsonObject createNestedObject(TChar* key) {\n    return operator[](key).template to<JsonObject>();\n  }\n\n  // DEPRECATED: use obj[key].to<JsonObject>() instead\n  template <typename TString>\n  ARDUINOJSON_DEPRECATED(\"use obj[key].to<JsonObject>() instead\")\n  JsonObject createNestedObject(const TString& key) {\n    return operator[](key).template to<JsonObject>();\n  }\n\n  // DEPRECATED: always returns zero\n  ARDUINOJSON_DEPRECATED(\"always returns zero\")\n  size_t memoryUsage() const {\n    return 0;\n  }\n\n private:\n  detail::ResourceManager* getResourceManager() const {\n    return impl_.resources();\n  }\n\n  detail::VariantData* getData() const {\n    return impl_.data();\n  }\n\n  detail::VariantData* getOrCreateData() const {\n    return impl_.data();\n  }\n\n  mutable detail::VariantImpl impl_;\n};\n\nARDUINOJSON_END_PUBLIC_NAMESPACE\n"
  },
  {
    "path": "src/ArduinoJson/Object/JsonObjectConst.hpp",
    "content": "// ArduinoJson - https://arduinojson.org\n// Copyright © 2014-2025, Benoit BLANCHON\n// MIT License\n\n#pragma once\n\n#include <ArduinoJson/Object/JsonObjectIterator.hpp>\n#include <ArduinoJson/Variant/VariantOperators.hpp>\n\nARDUINOJSON_BEGIN_PUBLIC_NAMESPACE\n\n// A read-only reference to an object in a JsonDocument.\n// https://arduinojson.org/v7/api/jsonobjectconst/\nclass JsonObjectConst : public detail::VariantOperators<JsonObjectConst> {\n  friend class JsonObject;\n  friend class detail::VariantAttorney;\n\n public:\n  using iterator = JsonObjectConstIterator;\n\n  // Creates an unbound reference.\n  JsonObjectConst() {}\n\n  // INTERNAL USE ONLY\n  JsonObjectConst(detail::VariantData* data, detail::ResourceManager* resources)\n      : impl_(data, resources) {}\n\n  // INTERNAL USE ONLY\n  JsonObjectConst(const detail::VariantImpl& impl) : impl_(impl) {}\n\n  operator JsonVariantConst() const {\n    return JsonVariantConst(impl_.data(), impl_.resources());\n  }\n\n  // Returns true if the reference is unbound.\n  // https://arduinojson.org/v7/api/jsonobjectconst/isnull/\n  bool isNull() const {\n    return impl_.isNull();\n  }\n\n  // Returns true if the reference is bound.\n  // https://arduinojson.org/v7/api/jsonobjectconst/isnull/\n  operator bool() const {\n    return !isNull();\n  }\n\n  // Returns the depth (nesting level) of the object.\n  // https://arduinojson.org/v7/api/jsonobjectconst/nesting/\n  size_t nesting() const {\n    return impl_.nesting();\n  }\n\n  // Returns the number of members in the object.\n  // https://arduinojson.org/v7/api/jsonobjectconst/size/\n  size_t size() const {\n    return impl_.size();\n  }\n\n  // Returns an iterator to the first key-value pair of the object.\n  // https://arduinojson.org/v7/api/jsonobjectconst/begin/\n  iterator begin() const {\n    return iterator(impl_.createIterator(), impl_.resources());\n  }\n\n  // Returns an iterator following the last key-value pair of the object.\n  // https://arduinojson.org/v7/api/jsonobjectconst/end/\n  iterator end() const {\n    return iterator();\n  }\n\n  // DEPRECATED: use obj[key].is<T>() instead\n  // https://arduinojson.org/v7/api/jsonobjectconst/containskey/\n  template <typename TString,\n            detail::enable_if_t<detail::IsString<TString>::value, int> = 0>\n  ARDUINOJSON_DEPRECATED(\"use obj[key].is<T>() instead\")\n  bool containsKey(const TString& key) const {\n    return impl_.getMember(detail::adaptString(key)) != 0;\n  }\n\n  // DEPRECATED: use obj[\"key\"].is<T>() instead\n  // https://arduinojson.org/v7/api/jsonobjectconst/containskey/\n  template <typename TChar>\n  ARDUINOJSON_DEPRECATED(\"use obj[\\\"key\\\"].is<T>() instead\")\n  bool containsKey(TChar* key) const {\n    return impl_.getMember(detail::adaptString(key)) != 0;\n  }\n\n  // DEPRECATED: use obj[key].is<T>() instead\n  // https://arduinojson.org/v7/api/jsonobjectconst/containskey/\n  template <typename TVariant,\n            detail::enable_if_t<detail::IsVariant<TVariant>::value, int> = 0>\n  ARDUINOJSON_DEPRECATED(\"use obj[key].is<T>() instead\")\n  bool containsKey(const TVariant& key) const {\n    return containsKey(key.template as<const char*>());\n  }\n\n  // Gets the member with specified key.\n  // https://arduinojson.org/v7/api/jsonobjectconst/subscript/\n  template <typename TString,\n            detail::enable_if_t<detail::IsString<TString>::value, int> = 0>\n  JsonVariantConst operator[](const TString& key) const {\n    return JsonVariantConst(impl_.getMember(detail::adaptString(key)),\n                            impl_.resources());\n  }\n\n  // Gets the member with specified key.\n  // https://arduinojson.org/v7/api/jsonobjectconst/subscript/\n  template <typename TChar,\n            detail::enable_if_t<detail::IsString<TChar*>::value, int> = 0>\n  JsonVariantConst operator[](TChar* key) const {\n    return JsonVariantConst(impl_.getMember(detail::adaptString(key)),\n                            impl_.resources());\n  }\n\n  // Gets the member with specified key.\n  // https://arduinojson.org/v7/api/jsonobjectconst/subscript/\n  template <typename TVariant,\n            detail::enable_if_t<detail::IsVariant<TVariant>::value, int> = 0>\n  JsonVariantConst operator[](const TVariant& key) const {\n    if (key.template is<JsonString>())\n      return operator[](key.template as<JsonString>());\n    else\n      return JsonVariantConst();\n  }\n\n  // DEPRECATED: always returns zero\n  ARDUINOJSON_DEPRECATED(\"always returns zero\")\n  size_t memoryUsage() const {\n    return 0;\n  }\n\n private:\n  const detail::VariantData* getData() const {\n    return impl_.data();\n  }\n\n  detail::VariantImpl impl_;\n};\n\ninline bool operator==(JsonObjectConst lhs, JsonObjectConst rhs) {\n  if (!lhs && !rhs)  // both are null\n    return true;\n\n  if (!lhs || !rhs)  // only one is null\n    return false;\n\n  size_t count = 0;\n  for (auto kvp : lhs) {\n    auto rhsValue = rhs[kvp.key()];\n    if (rhsValue.isUnbound())\n      return false;\n    if (kvp.value() != rhsValue)\n      return false;\n    count++;\n  }\n  return count == rhs.size();\n}\n\nARDUINOJSON_END_PUBLIC_NAMESPACE\n"
  },
  {
    "path": "src/ArduinoJson/Object/JsonObjectIterator.hpp",
    "content": "// ArduinoJson - https://arduinojson.org\n// Copyright © 2014-2025, Benoit BLANCHON\n// MIT License\n\n#pragma once\n\n#include <ArduinoJson/Object/JsonPair.hpp>\n\nARDUINOJSON_BEGIN_PUBLIC_NAMESPACE\n\nclass JsonObjectIterator {\n  friend class JsonObject;\n\n public:\n  JsonObjectIterator() {}\n\n  explicit JsonObjectIterator(detail::VariantImpl::iterator iterator,\n                              detail::ResourceManager* resources)\n      : iterator_(iterator), resources_(resources) {}\n\n  JsonPair operator*() const {\n    return JsonPair(iterator_, resources_);\n  }\n  Ptr<JsonPair> operator->() {\n    return operator*();\n  }\n\n  bool operator==(const JsonObjectIterator& other) const {\n    return iterator_ == other.iterator_;\n  }\n\n  bool operator!=(const JsonObjectIterator& other) const {\n    return iterator_ != other.iterator_;\n  }\n\n  JsonObjectIterator& operator++() {\n    iterator_.move(resources_);  // key\n    iterator_.move(resources_);  // value\n    return *this;\n  }\n\n private:\n  detail::VariantImpl::iterator iterator_;\n  detail::ResourceManager* resources_;\n};\n\nclass JsonObjectConstIterator {\n  friend class JsonObject;\n\n public:\n  JsonObjectConstIterator() {}\n\n  explicit JsonObjectConstIterator(detail::VariantImpl::iterator iterator,\n                                   detail::ResourceManager* resources)\n      : iterator_(iterator), resources_(resources) {}\n\n  JsonPairConst operator*() const {\n    return JsonPairConst(iterator_, resources_);\n  }\n  Ptr<JsonPairConst> operator->() {\n    return operator*();\n  }\n\n  bool operator==(const JsonObjectConstIterator& other) const {\n    return iterator_ == other.iterator_;\n  }\n\n  bool operator!=(const JsonObjectConstIterator& other) const {\n    return iterator_ != other.iterator_;\n  }\n\n  JsonObjectConstIterator& operator++() {\n    iterator_.move(resources_);  // key\n    iterator_.move(resources_);  // value\n    return *this;\n  }\n\n private:\n  detail::VariantImpl::iterator iterator_;\n  detail::ResourceManager* resources_;\n};\n\nARDUINOJSON_END_PUBLIC_NAMESPACE\n"
  },
  {
    "path": "src/ArduinoJson/Object/JsonPair.hpp",
    "content": "// ArduinoJson - https://arduinojson.org\n// Copyright © 2014-2025, Benoit BLANCHON\n// MIT License\n\n#pragma once\n\n#include <ArduinoJson/Strings/JsonString.hpp>\n#include <ArduinoJson/Variant/JsonVariant.hpp>\n#include <ArduinoJson/Variant/JsonVariantConst.hpp>\n\nARDUINOJSON_BEGIN_PUBLIC_NAMESPACE\n\n// A key-value pair.\n// https://arduinojson.org/v7/api/jsonobject/begin_end/\nclass JsonPair {\n public:\n  // INTERNAL USE ONLY\n  JsonPair(detail::VariantImpl::iterator iterator,\n           detail::ResourceManager* resources) {\n    if (!iterator.done()) {\n      key_ = iterator->asString();\n      iterator.move(resources);\n      value_ = JsonVariant(iterator.data(), resources);\n    }\n  }\n\n  // Returns the key.\n  JsonString key() const {\n    return key_;\n  }\n\n  // Returns the value.\n  JsonVariant value() {\n    return value_;\n  }\n\n private:\n  JsonString key_;\n  JsonVariant value_;\n};\n\n// A read-only key-value pair.\n// https://arduinojson.org/v7/api/jsonobjectconst/begin_end/\nclass JsonPairConst {\n public:\n  JsonPairConst(detail::VariantImpl::iterator iterator,\n                detail::ResourceManager* resources) {\n    if (!iterator.done()) {\n      key_ = iterator->asString();\n      iterator.move(resources);\n      value_ = JsonVariantConst(iterator.data(), resources);\n    }\n  }\n\n  // Returns the key.\n  JsonString key() const {\n    return key_;\n  }\n\n  // Returns the value.\n  JsonVariantConst value() const {\n    return value_;\n  }\n\n private:\n  JsonString key_;\n  JsonVariantConst value_;\n};\n\nARDUINOJSON_END_PUBLIC_NAMESPACE\n"
  },
  {
    "path": "src/ArduinoJson/Object/MemberProxy.hpp",
    "content": "// ArduinoJson - https://arduinojson.org\n// Copyright © 2014-2025, Benoit BLANCHON\n// MIT License\n\n#pragma once\n\n#include <ArduinoJson/Variant/VariantRefBase.hpp>\n\nARDUINOJSON_BEGIN_PRIVATE_NAMESPACE\n\n// A proxy class to get or set a member of an object.\n// https://arduinojson.org/v7/api/jsonobject/subscript/\ntemplate <typename TUpstream, typename AdaptedString>\nclass MemberProxy\n    : public VariantRefBase<MemberProxy<TUpstream, AdaptedString>>,\n      public VariantOperators<MemberProxy<TUpstream, AdaptedString>> {\n  friend class VariantAttorney;\n\n  friend class VariantRefBase<MemberProxy<TUpstream, AdaptedString>>;\n\n  template <typename, typename>\n  friend class MemberProxy;\n\n  template <typename>\n  friend class ElementProxy;\n\n public:\n  MemberProxy(TUpstream upstream, AdaptedString key)\n      : upstream_(upstream), key_(key) {}\n\n  MemberProxy& operator=(const MemberProxy& src) {\n    this->set(src);\n    return *this;\n  }\n\n  template <typename T>\n  MemberProxy& operator=(const T& src) {\n    this->set(src);\n    return *this;\n  }\n\n  template <typename T>\n  MemberProxy& operator=(T* src) {\n    this->set(src);\n    return *this;\n  }\n\n private:\n  // clang-format off\n  MemberProxy(const MemberProxy& src) // Error here? See https://arduinojson.org/v7/proxy-non-copyable/\n      : upstream_(src.upstream_), key_(src.key_) {}\n  // clang-format on\n\n  ResourceManager* getResourceManager() const {\n    return VariantAttorney::getResourceManager(upstream_);\n  }\n\n  VariantData* getData() const {\n    return VariantAttorney::getVariantImpl(upstream_).getMember(key_);\n  }\n\n  VariantData* getOrCreateData() const {\n    auto data = VariantAttorney::getOrCreateData(upstream_);\n    auto resources = VariantAttorney::getResourceManager(upstream_);\n    if (data && data->type == VariantType::Null)\n      data->toObject();\n    return VariantImpl(data, resources).getOrAddMember(key_);\n  }\n\n private:\n  TUpstream upstream_;\n  AdaptedString key_;\n};\n\nARDUINOJSON_END_PRIVATE_NAMESPACE\n"
  },
  {
    "path": "src/ArduinoJson/Object/ObjectImpl.hpp",
    "content": "// ArduinoJson - https://arduinojson.org\n// Copyright © 2014-2025, Benoit BLANCHON\n// MIT License\n\n#pragma once\n\n#include <ArduinoJson/Variant/VariantCompare.hpp>\n#include <ArduinoJson/Variant/VariantImpl.hpp>\n\nARDUINOJSON_BEGIN_PRIVATE_NAMESPACE\n\ntemplate <typename TAdaptedString>\ninline VariantData* VariantImpl::getMember(TAdaptedString key,\n                                           VariantData* data,\n                                           ResourceManager* resources) {\n  auto it = findKey(key, data, resources);\n  if (it.done())\n    return nullptr;\n  it.move(resources);\n  return it.data();\n}\n\ntemplate <typename TAdaptedString>\nVariantData* VariantImpl::getOrAddMember(TAdaptedString key, VariantData* data,\n                                         ResourceManager* resources) {\n  ARDUINOJSON_ASSERT(data != nullptr);\n  ARDUINOJSON_ASSERT(data->isObject());\n  ARDUINOJSON_ASSERT(resources != nullptr);\n\n  auto member = getMember(key, data, resources);\n  if (member)\n    return member;\n  return addMember(key, data, resources);\n}\n\ntemplate <typename TAdaptedString>\ninline VariantImpl::iterator VariantImpl::findKey(TAdaptedString key,\n                                                  VariantData* data,\n                                                  ResourceManager* resources) {\n  ARDUINOJSON_ASSERT(data != nullptr);\n  ARDUINOJSON_ASSERT(data->isObject());\n  ARDUINOJSON_ASSERT(resources != nullptr);\n\n  if (key.isNull())\n    return iterator();\n  bool isKey = true;\n  for (auto it = createIterator(data, resources); !it.done();\n       it.move(resources)) {\n    if (isKey && stringEquals(key, adaptString(it->asString())))\n      return it;\n    isKey = !isKey;\n  }\n  return iterator();\n}\n\ntemplate <typename TAdaptedString>\ninline VariantData* VariantImpl::addMember(TAdaptedString key,\n                                           VariantData* data,\n                                           ResourceManager* resources) {\n  ARDUINOJSON_ASSERT(data != nullptr);\n  ARDUINOJSON_ASSERT(data->isObject());\n  ARDUINOJSON_ASSERT(resources != nullptr);\n\n  if (key.isNull())\n    return nullptr;  // Ignore null key\n\n  auto keySlot = resources->allocVariant();\n  if (!keySlot)\n    return nullptr;\n\n  auto valueSlot = resources->allocVariant();\n  if (!valueSlot)\n    return nullptr;\n\n  if (!VariantImpl::setString(key, keySlot.ptr(), resources))\n    return nullptr;\n\n  appendPair(keySlot, valueSlot, data, resources);\n\n  return valueSlot.ptr();\n}\n\ninline VariantData* VariantImpl::addPair(VariantData** value, VariantData* data,\n                                         ResourceManager* resources) {\n  ARDUINOJSON_ASSERT(value != nullptr);\n  ARDUINOJSON_ASSERT(data != nullptr);\n  ARDUINOJSON_ASSERT(data->isObject());\n  ARDUINOJSON_ASSERT(resources != nullptr);\n\n  auto keySlot = resources->allocVariant();\n  if (!keySlot)\n    return nullptr;\n\n  auto valueSlot = resources->allocVariant();\n  if (!valueSlot)\n    return nullptr;\n  *value = valueSlot.ptr();\n\n  appendPair(keySlot, valueSlot, data, resources);\n\n  return keySlot.ptr();\n}\n\n// Returns the size (in bytes) of an object with n members.\nconstexpr size_t sizeofObject(size_t n) {\n  return 2 * n * sizeof(VariantData);\n}\n\nARDUINOJSON_END_PRIVATE_NAMESPACE\n"
  },
  {
    "path": "src/ArduinoJson/Polyfills/alias_cast.hpp",
    "content": "// ArduinoJson - https://arduinojson.org\n// Copyright © 2014-2025, Benoit BLANCHON\n// MIT License\n\n#pragma once\n\n#include <stdint.h>\n#include <stdlib.h>  // for size_t\n\n#include <ArduinoJson/Configuration.hpp>\n#include \"math.hpp\"\n\nARDUINOJSON_BEGIN_PRIVATE_NAMESPACE\n\ntemplate <typename T, typename F>\nstruct alias_cast_t {\n  union {\n    F raw;\n    T data;\n  };\n};\n\ntemplate <typename T, typename F>\nT alias_cast(F raw_data) {\n  alias_cast_t<T, F> ac;\n  ac.raw = raw_data;\n  return ac.data;\n}\n\nARDUINOJSON_END_PRIVATE_NAMESPACE\n"
  },
  {
    "path": "src/ArduinoJson/Polyfills/assert.hpp",
    "content": "// ArduinoJson - https://arduinojson.org\n// Copyright © 2014-2025, Benoit BLANCHON\n// MIT License\n\n#pragma once\n\n#include <ArduinoJson/Configuration.hpp>\n\n#if ARDUINOJSON_DEBUG\n#  include <assert.h>\n#  define ARDUINOJSON_ASSERT(X) assert(X)\n#else\n#  define ARDUINOJSON_ASSERT(X) ((void)0)\n#endif\n"
  },
  {
    "path": "src/ArduinoJson/Polyfills/attributes.hpp",
    "content": "// ArduinoJson - https://arduinojson.org\n// Copyright © 2014-2025, Benoit BLANCHON\n// MIT License\n\n#pragma once\n\n#ifdef _MSC_VER  // Visual Studio\n\n#  define FORCE_INLINE  // __forceinline causes C4714 when returning std::string\n\n#  ifndef ARDUINOJSON_DEPRECATED\n#    define ARDUINOJSON_DEPRECATED(msg) __declspec(deprecated(msg))\n#  endif\n\n#elif defined(__GNUC__)  // GCC or Clang\n\n#  define FORCE_INLINE __attribute__((always_inline))\n\n#  ifndef ARDUINOJSON_DEPRECATED\n#    if __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 5)\n#      define ARDUINOJSON_DEPRECATED(msg) __attribute__((deprecated(msg)))\n#    else\n#      define ARDUINOJSON_DEPRECATED(msg) __attribute__((deprecated))\n#    endif\n#  endif\n\n#else  // Other compilers\n\n#  define FORCE_INLINE\n\n#  ifndef ARDUINOJSON_DEPRECATED\n#    define ARDUINOJSON_DEPRECATED(msg)\n#  endif\n\n#endif\n\n#if defined(__has_attribute)\n#  if __has_attribute(no_sanitize)\n#    define ARDUINOJSON_NO_SANITIZE(check) __attribute__((no_sanitize(check)))\n#  else\n#    define ARDUINOJSON_NO_SANITIZE(check)\n#  endif\n#else\n#  define ARDUINOJSON_NO_SANITIZE(check)\n#endif\n"
  },
  {
    "path": "src/ArduinoJson/Polyfills/ctype.hpp",
    "content": "// ArduinoJson - https://arduinojson.org\n// Copyright © 2014-2025, Benoit BLANCHON\n// MIT License\n\n#pragma once\n\n#include <ArduinoJson/Namespace.hpp>\n\nARDUINOJSON_BEGIN_PRIVATE_NAMESPACE\n\n#ifndef isdigit\ninline bool isdigit(char c) {\n  return '0' <= c && c <= '9';\n}\n#endif\n\ninline bool issign(char c) {\n  return '-' == c || c == '+';\n}\n\nARDUINOJSON_END_PRIVATE_NAMESPACE\n"
  },
  {
    "path": "src/ArduinoJson/Polyfills/integer.hpp",
    "content": "// ArduinoJson - https://arduinojson.org\n// Copyright © 2014-2025, Benoit BLANCHON\n// MIT License\n\n#pragma once\n\n#include <stdint.h>  // int8_t, int16_t\n\n#include <ArduinoJson/Namespace.hpp>\n\nARDUINOJSON_BEGIN_PRIVATE_NAMESPACE\n\ntemplate <int Bits>\nstruct uint_;\n\ntemplate <>\nstruct uint_<8> {\n  using type = uint8_t;\n};\n\ntemplate <>\nstruct uint_<16> {\n  using type = uint16_t;\n};\n\ntemplate <>\nstruct uint_<32> {\n  using type = uint32_t;\n};\n\ntemplate <int Bits>\nusing uint_t = typename uint_<Bits>::type;\n\nARDUINOJSON_END_PRIVATE_NAMESPACE\n"
  },
  {
    "path": "src/ArduinoJson/Polyfills/limits.hpp",
    "content": "// ArduinoJson - https://arduinojson.org\n// Copyright © 2014-2025, Benoit BLANCHON\n// MIT License\n\n#pragma once\n\n#include \"type_traits.hpp\"\n\n#ifdef _MSC_VER\n#  pragma warning(push)\n#  pragma warning(disable : 4310)\n#endif\n\nARDUINOJSON_BEGIN_PRIVATE_NAMESPACE\n\n// Differs from standard because we can't use the symbols \"min\" and \"max\"\ntemplate <typename T, typename Enable = void>\nstruct numeric_limits;\n\ntemplate <typename T>\nstruct numeric_limits<T, enable_if_t<is_unsigned<T>::value>> {\n  static constexpr T lowest() {\n    return 0;\n  }\n  static constexpr T highest() {\n    return T(-1);\n  }\n};\n\ntemplate <typename T>\nstruct numeric_limits<\n    T, enable_if_t<is_integral<T>::value && is_signed<T>::value>> {\n  static constexpr T lowest() {\n    return T(T(1) << (sizeof(T) * 8 - 1));\n  }\n  static constexpr T highest() {\n    return T(~lowest());\n  }\n};\n\nARDUINOJSON_END_PRIVATE_NAMESPACE\n\n#ifdef _MSC_VER\n#  pragma warning(pop)\n#endif\n"
  },
  {
    "path": "src/ArduinoJson/Polyfills/math.hpp",
    "content": "// ArduinoJson - https://arduinojson.org\n// Copyright © 2014-2025, Benoit BLANCHON\n// MIT License\n\n#pragma once\n\n#include <ArduinoJson/Namespace.hpp>\n\nARDUINOJSON_BEGIN_PRIVATE_NAMESPACE\n\n// Some libraries #define isnan() and isinf() so we need to check before\n// using this name\n\n#ifndef isnan\ntemplate <typename T>\nbool isnan(T x) {\n  return x != x;\n}\n#endif\n\n#ifndef isinf\ntemplate <typename T>\nbool isinf(T x) {\n  return x != 0.0 && x * 2 == x;\n}\n#endif\nARDUINOJSON_END_PRIVATE_NAMESPACE\n"
  },
  {
    "path": "src/ArduinoJson/Polyfills/mpl/max.hpp",
    "content": "// ArduinoJson - https://arduinojson.org\n// Copyright © 2014-2025, Benoit BLANCHON\n// MIT License\n\n#pragma once\n\n#include <ArduinoJson/Namespace.hpp>\n\n#include <stddef.h>  // for size_t\n\nARDUINOJSON_BEGIN_PRIVATE_NAMESPACE\n\n// A meta-function that returns the highest value\ntemplate <size_t X, size_t Y, bool MaxIsX = (X > Y)>\nstruct Max {};\n\ntemplate <size_t X, size_t Y>\nstruct Max<X, Y, true> {\n  static const size_t value = X;\n};\n\ntemplate <size_t X, size_t Y>\nstruct Max<X, Y, false> {\n  static const size_t value = Y;\n};\n\nARDUINOJSON_END_PRIVATE_NAMESPACE\n"
  },
  {
    "path": "src/ArduinoJson/Polyfills/pgmspace.hpp",
    "content": "// ArduinoJson - https://arduinojson.org\n// Copyright © 2014-2025, Benoit BLANCHON\n// MIT License\n\n#pragma once\n\n#ifdef ARDUINO\n#  include <Arduino.h>\n#else\n// Allow using PROGMEM outside of Arduino (issue #1903)\nclass __FlashStringHelper;\n#  include <avr/pgmspace.h>\n#endif\n\n#include <ArduinoJson/Configuration.hpp>\n#include <ArduinoJson/Namespace.hpp>\n#include <ArduinoJson/Polyfills/assert.hpp>\n\nARDUINOJSON_BEGIN_PRIVATE_NAMESPACE\n// Wraps a const char* so that the our functions are picked only if the\n// originals are missing\nstruct pgm_p {\n  pgm_p(const void* p) : address(reinterpret_cast<const char*>(p)) {}\n  const char* address;\n};\n\nARDUINOJSON_END_PRIVATE_NAMESPACE\n\n#ifndef strlen_P\ninline size_t strlen_P(ArduinoJson::detail::pgm_p s) {\n  const char* p = s.address;\n  ARDUINOJSON_ASSERT(p != NULL);\n  while (pgm_read_byte(p))\n    p++;\n  return size_t(p - s.address);\n}\n#endif\n\n#ifndef strncmp_P\ninline int strncmp_P(const char* a, ArduinoJson::detail::pgm_p b, size_t n) {\n  const char* s1 = a;\n  const char* s2 = b.address;\n  ARDUINOJSON_ASSERT(s1 != NULL);\n  ARDUINOJSON_ASSERT(s2 != NULL);\n  while (n-- > 0) {\n    char c1 = *s1++;\n    char c2 = static_cast<char>(pgm_read_byte(s2++));\n    if (c1 < c2)\n      return -1;\n    if (c1 > c2)\n      return 1;\n    if (c1 == 0 /* and c2 as well */)\n      return 0;\n  }\n  return 0;\n}\n#endif\n\n#ifndef strcmp_P\ninline int strcmp_P(const char* a, ArduinoJson::detail::pgm_p b) {\n  const char* s1 = a;\n  const char* s2 = b.address;\n  ARDUINOJSON_ASSERT(s1 != NULL);\n  ARDUINOJSON_ASSERT(s2 != NULL);\n  for (;;) {\n    char c1 = *s1++;\n    char c2 = static_cast<char>(pgm_read_byte(s2++));\n    if (c1 < c2)\n      return -1;\n    if (c1 > c2)\n      return 1;\n    if (c1 == 0 /* and c2 as well */)\n      return 0;\n  }\n}\n#endif\n\n#ifndef memcmp_P\ninline int memcmp_P(const void* a, ArduinoJson::detail::pgm_p b, size_t n) {\n  const uint8_t* p1 = reinterpret_cast<const uint8_t*>(a);\n  const char* p2 = b.address;\n  ARDUINOJSON_ASSERT(p1 != NULL);\n  ARDUINOJSON_ASSERT(p2 != NULL);\n  while (n-- > 0) {\n    uint8_t v1 = *p1++;\n    uint8_t v2 = pgm_read_byte(p2++);\n    if (v1 != v2)\n      return v1 - v2;\n  }\n  return 0;\n}\n#endif\n\n#ifndef memcpy_P\ninline void* memcpy_P(void* dst, ArduinoJson::detail::pgm_p src, size_t n) {\n  uint8_t* d = reinterpret_cast<uint8_t*>(dst);\n  const char* s = src.address;\n  ARDUINOJSON_ASSERT(d != NULL);\n  ARDUINOJSON_ASSERT(s != NULL);\n  while (n-- > 0) {\n    *d++ = pgm_read_byte(s++);\n  }\n  return dst;\n}\n#endif\n\n#ifndef pgm_read_dword\ninline uint32_t pgm_read_dword(ArduinoJson::detail::pgm_p p) {\n  uint32_t result;\n  memcpy_P(&result, p.address, 4);\n  return result;\n}\n#endif\n\n#ifndef pgm_read_float\ninline float pgm_read_float(ArduinoJson::detail::pgm_p p) {\n  float result;\n  memcpy_P(&result, p.address, sizeof(float));\n  return result;\n}\n#endif\n\n#ifndef pgm_read_double\n#  if defined(__SIZEOF_DOUBLE__) && defined(__SIZEOF_FLOAT__) && \\\n      __SIZEOF_DOUBLE__ == __SIZEOF_FLOAT__\ninline double pgm_read_double(ArduinoJson::detail::pgm_p p) {\n  return pgm_read_float(p.address);\n}\n#  else\ninline double pgm_read_double(ArduinoJson::detail::pgm_p p) {\n  double result;\n  memcpy_P(&result, p.address, sizeof(double));\n  return result;\n}\n#  endif\n#endif\n\n#ifndef pgm_read_ptr\ninline void* pgm_read_ptr(ArduinoJson::detail::pgm_p p) {\n  void* result;\n  memcpy_P(&result, p.address, sizeof(result));\n  return result;\n}\n#endif\n"
  },
  {
    "path": "src/ArduinoJson/Polyfills/pgmspace_generic.hpp",
    "content": "// ArduinoJson - https://arduinojson.org\n// Copyright © 2014-2025, Benoit BLANCHON\n// MIT License\n\n#pragma once\n\n#include <ArduinoJson/Namespace.hpp>\n#include <ArduinoJson/Polyfills/assert.hpp>\n\n#if ARDUINOJSON_ENABLE_PROGMEM\n#  include <ArduinoJson/Polyfills/pgmspace.hpp>\n#  include <ArduinoJson/Polyfills/type_traits.hpp>\n#endif\n\nARDUINOJSON_BEGIN_PRIVATE_NAMESPACE\n\n#if ARDUINOJSON_ENABLE_PROGMEM\n\n#  ifndef ARDUINOJSON_DEFINE_PROGMEM_ARRAY\n#    define ARDUINOJSON_DEFINE_PROGMEM_ARRAY(type, name, ...) \\\n      static type const name[] PROGMEM = __VA_ARGS__;\n#  endif\n\ntemplate <typename T>\ninline const T* pgm_read(const T* const* p) {\n  return reinterpret_cast<const T*>(pgm_read_ptr(p));\n}\n\ninline uint32_t pgm_read(const uint32_t* p) {\n  return pgm_read_dword(p);\n}\n\ninline double pgm_read(const double* p) {\n  return pgm_read_double(p);\n}\n\ninline float pgm_read(const float* p) {\n  return pgm_read_float(p);\n}\n\n#else\n\n#  ifndef ARDUINOJSON_DEFINE_PROGMEM_ARRAY\n#    define ARDUINOJSON_DEFINE_PROGMEM_ARRAY(type, name, ...) \\\n      static type const name[] = __VA_ARGS__;\n#  endif\n\ntemplate <typename T>\ninline T pgm_read(const T* p) {\n  return *p;\n}\n\n#endif\n\ntemplate <typename T>\nclass pgm_ptr {\n public:\n  explicit pgm_ptr(const T* ptr) : ptr_(ptr) {}\n\n  T operator[](intptr_t index) const {\n    return pgm_read(ptr_ + index);\n  }\n\n private:\n  const T* ptr_;\n};\n\ntemplate <typename T, size_t N>\nclass pgm_array {\n public:\n  explicit pgm_array(const T* ptr) : ptr_(ptr) {}\n\n  T operator[](size_t index) const {\n    ARDUINOJSON_ASSERT(index < N);\n    return ptr_[intptr_t(index)];\n  }\n\n  size_t size() const {\n    return N;\n  }\n\n private:\n  pgm_ptr<T> ptr_;\n};\n\nARDUINOJSON_END_PRIVATE_NAMESPACE\n"
  },
  {
    "path": "src/ArduinoJson/Polyfills/preprocessor.hpp",
    "content": "// ArduinoJson - https://arduinojson.org\n// Copyright © 2014-2025, Benoit BLANCHON\n// MIT License\n\n#pragma once\n\n#define ARDUINOJSON_CONCAT_(A, B) A##B\n#define ARDUINOJSON_CONCAT2(A, B) ARDUINOJSON_CONCAT_(A, B)\n#define ARDUINOJSON_CONCAT3(A, B, C) \\\n  ARDUINOJSON_CONCAT2(ARDUINOJSON_CONCAT2(A, B), C)\n#define ARDUINOJSON_CONCAT4(A, B, C, D) \\\n  ARDUINOJSON_CONCAT2(ARDUINOJSON_CONCAT3(A, B, C), D)\n#define ARDUINOJSON_CONCAT5(A, B, C, D, E) \\\n  ARDUINOJSON_CONCAT2(ARDUINOJSON_CONCAT4(A, B, C, D), E)\n\n#define ARDUINOJSON_BIN2ALPHA_0000() A\n#define ARDUINOJSON_BIN2ALPHA_0001() B\n#define ARDUINOJSON_BIN2ALPHA_0010() C\n#define ARDUINOJSON_BIN2ALPHA_0011() D\n#define ARDUINOJSON_BIN2ALPHA_0100() E\n#define ARDUINOJSON_BIN2ALPHA_0101() F\n#define ARDUINOJSON_BIN2ALPHA_0110() G\n#define ARDUINOJSON_BIN2ALPHA_0111() H\n#define ARDUINOJSON_BIN2ALPHA_1000() I\n#define ARDUINOJSON_BIN2ALPHA_1001() J\n#define ARDUINOJSON_BIN2ALPHA_1010() K\n#define ARDUINOJSON_BIN2ALPHA_1011() L\n#define ARDUINOJSON_BIN2ALPHA_1100() M\n#define ARDUINOJSON_BIN2ALPHA_1101() N\n#define ARDUINOJSON_BIN2ALPHA_1110() O\n#define ARDUINOJSON_BIN2ALPHA_1111() P\n#define ARDUINOJSON_BIN2ALPHA_(A, B, C, D) ARDUINOJSON_BIN2ALPHA_##A##B##C##D()\n#define ARDUINOJSON_BIN2ALPHA(A, B, C, D) ARDUINOJSON_BIN2ALPHA_(A, B, C, D)\n"
  },
  {
    "path": "src/ArduinoJson/Polyfills/type_traits/conditional.hpp",
    "content": "// ArduinoJson - https://arduinojson.org\n// Copyright © 2014-2025, Benoit BLANCHON\n// MIT License\n\n#pragma once\n\n#include <ArduinoJson/Namespace.hpp>\n\nARDUINOJSON_BEGIN_PRIVATE_NAMESPACE\n\ntemplate <bool Condition, class TrueType, class FalseType>\nstruct conditional {\n  using type = TrueType;\n};\n\ntemplate <class TrueType, class FalseType>\nstruct conditional<false, TrueType, FalseType> {\n  using type = FalseType;\n};\n\ntemplate <bool Condition, class TrueType, class FalseType>\nusing conditional_t =\n    typename conditional<Condition, TrueType, FalseType>::type;\n\nARDUINOJSON_END_PRIVATE_NAMESPACE\n"
  },
  {
    "path": "src/ArduinoJson/Polyfills/type_traits/decay.hpp",
    "content": "// ArduinoJson - https://arduinojson.org\n// Copyright © 2014-2025, Benoit BLANCHON\n// MIT License\n\n#pragma once\n\n#include <stddef.h>  // size_t\n\n#include <ArduinoJson/Namespace.hpp>\n\nARDUINOJSON_BEGIN_PRIVATE_NAMESPACE\n\ntemplate <typename T>\nstruct decay {\n  using type = T;\n};\n\ntemplate <typename T>\nstruct decay<T&> : decay<T> {};\n\ntemplate <typename T>\nstruct decay<T&&> : decay<T> {};\n\ntemplate <typename T>\nstruct decay<T[]> : decay<T*> {};\n\ntemplate <typename T, size_t N>\nstruct decay<T[N]> : decay<T*> {};\n\ntemplate <typename T>\nusing decay_t = typename decay<T>::type;\n\nARDUINOJSON_END_PRIVATE_NAMESPACE\n"
  },
  {
    "path": "src/ArduinoJson/Polyfills/type_traits/declval.hpp",
    "content": "// ArduinoJson - https://arduinojson.org\n// Copyright © 2014-2025, Benoit BLANCHON\n// MIT License\n\n#pragma once\n\n#include <ArduinoJson/Namespace.hpp>\n\nARDUINOJSON_BEGIN_PRIVATE_NAMESPACE\n\ntemplate <typename T>\nT&& declval();\n\nARDUINOJSON_END_PRIVATE_NAMESPACE\n"
  },
  {
    "path": "src/ArduinoJson/Polyfills/type_traits/enable_if.hpp",
    "content": "// ArduinoJson - https://arduinojson.org\n// Copyright © 2014-2025, Benoit BLANCHON\n// MIT License\n\n#pragma once\n\n#include <ArduinoJson/Namespace.hpp>\n\nARDUINOJSON_BEGIN_PRIVATE_NAMESPACE\n\n// A meta-function that return the type T if Condition is true.\ntemplate <bool Condition, typename T = void>\nstruct enable_if {};\n\ntemplate <typename T>\nstruct enable_if<true, T> {\n  using type = T;\n};\n\ntemplate <bool Condition, typename T = void>\nusing enable_if_t = typename enable_if<Condition, T>::type;\n\nARDUINOJSON_END_PRIVATE_NAMESPACE\n"
  },
  {
    "path": "src/ArduinoJson/Polyfills/type_traits/function_traits.hpp",
    "content": "// ArduinoJson - https://arduinojson.org\n// Copyright © 2014-2025, Benoit BLANCHON\n// MIT License\n\n#pragma once\n\n#include <ArduinoJson/Namespace.hpp>\n\nARDUINOJSON_BEGIN_PRIVATE_NAMESPACE\n\ntemplate <typename Sig>\nstruct function_traits;\n\ntemplate <typename ReturnType, typename Arg1>\nstruct function_traits<ReturnType (*)(Arg1)> {\n  using return_type = ReturnType;\n  using arg1_type = Arg1;\n};\n\ntemplate <typename ReturnType, typename Arg1, typename Arg2>\nstruct function_traits<ReturnType (*)(Arg1, Arg2)> {\n  using return_type = ReturnType;\n  using arg1_type = Arg1;\n  using arg2_type = Arg2;\n};\n\nARDUINOJSON_END_PRIVATE_NAMESPACE\n"
  },
  {
    "path": "src/ArduinoJson/Polyfills/type_traits/integral_constant.hpp",
    "content": "// ArduinoJson - https://arduinojson.org\n// Copyright © 2014-2025, Benoit BLANCHON\n// MIT License\n\n#pragma once\n\n#include <ArduinoJson/Namespace.hpp>\n\nARDUINOJSON_BEGIN_PRIVATE_NAMESPACE\n\ntemplate <typename T, T v>\nstruct integral_constant {\n  static const T value = v;\n};\n\ntemplate <bool B>\nusing bool_constant = integral_constant<bool, B>;\n\nusing true_type = bool_constant<true>;\nusing false_type = bool_constant<false>;\n\nARDUINOJSON_END_PRIVATE_NAMESPACE\n"
  },
  {
    "path": "src/ArduinoJson/Polyfills/type_traits/is_array.hpp",
    "content": "// ArduinoJson - https://arduinojson.org\n// Copyright © 2014-2025, Benoit BLANCHON\n// MIT License\n\n#pragma once\n\n#include <ArduinoJson/Namespace.hpp>\n\n#include <stddef.h>  // size_t\n\nARDUINOJSON_BEGIN_PRIVATE_NAMESPACE\n\ntemplate <typename T>\nstruct is_array : false_type {};\n\ntemplate <typename T>\nstruct is_array<T[]> : true_type {};\n\ntemplate <typename T, size_t N>\nstruct is_array<T[N]> : true_type {};\n\nARDUINOJSON_END_PRIVATE_NAMESPACE\n"
  },
  {
    "path": "src/ArduinoJson/Polyfills/type_traits/is_base_of.hpp",
    "content": "// ArduinoJson - https://arduinojson.org\n// Copyright © 2014-2025, Benoit BLANCHON\n// MIT License\n\n#pragma once\n\n#include <ArduinoJson/Namespace.hpp>\n\n#include \"remove_reference.hpp\"\n\nARDUINOJSON_BEGIN_PRIVATE_NAMESPACE\n\n// A meta-function that returns true if Derived inherits from TBase is an\n// integral type.\ntemplate <typename TBase, typename TDerived>\nclass is_base_of {\n protected:  // <- to avoid GCC's \"all member functions in class are private\"\n  static int probe(const TBase*);\n  static char probe(...);\n\n public:\n  static const bool value =\n      sizeof(probe(reinterpret_cast<remove_reference_t<TDerived>*>(0))) ==\n      sizeof(int);\n};\n\nARDUINOJSON_END_PRIVATE_NAMESPACE\n"
  },
  {
    "path": "src/ArduinoJson/Polyfills/type_traits/is_class.hpp",
    "content": "// ArduinoJson - https://arduinojson.org\n// Copyright © 2014-2025, Benoit BLANCHON\n// MIT License\n\n#pragma once\n\n#include \"declval.hpp\"\n\nARDUINOJSON_BEGIN_PRIVATE_NAMESPACE\n\ntemplate <typename T>\nstruct is_class {\n protected:  // <- to avoid GCC's \"all member functions in class are private\"\n  template <typename U>\n  static int probe(void (U::*)(void));\n  template <typename>\n  static char probe(...);\n\n public:\n  static const bool value = sizeof(probe<T>(0)) == sizeof(int);\n};\n\nARDUINOJSON_END_PRIVATE_NAMESPACE\n"
  },
  {
    "path": "src/ArduinoJson/Polyfills/type_traits/is_const.hpp",
    "content": "// ArduinoJson - https://arduinojson.org\n// Copyright © 2014-2025, Benoit BLANCHON\n// MIT License\n\n#pragma once\n\n#include \"integral_constant.hpp\"\n\nARDUINOJSON_BEGIN_PRIVATE_NAMESPACE\n\n// A meta-function that return the type T without the const modifier\ntemplate <typename T>\nstruct is_const : false_type {};\n\ntemplate <typename T>\nstruct is_const<const T> : true_type {};\n\nARDUINOJSON_END_PRIVATE_NAMESPACE\n"
  },
  {
    "path": "src/ArduinoJson/Polyfills/type_traits/is_convertible.hpp",
    "content": "// ArduinoJson - https://arduinojson.org\n// Copyright © 2014-2025, Benoit BLANCHON\n// MIT License\n\n#pragma once\n\n#include \"declval.hpp\"\n\n#ifdef _MSC_VER\n#  pragma warning(push)\n// conversion from 'T' to 'To', possible loss of data\n#  pragma warning(disable : 4244)\n#endif\n\n// clang-format off\n#ifdef __ICCARM__\n// Suppress IAR Compiler Warning[Pa093]: implicit conversion from floating point to integer\n#pragma diag_suppress=Pa093\n#endif\n// clang-format on\n\nARDUINOJSON_BEGIN_PRIVATE_NAMESPACE\n\ntemplate <typename From, typename To>\nstruct is_convertible {\n protected:  // <- to avoid GCC's \"all member functions in class are private\"\n  static int probe(To);\n  static char probe(...);\n\n  static const From& from_;\n\n public:\n  static const bool value = sizeof(probe(from_)) == sizeof(int);\n};\n\nARDUINOJSON_END_PRIVATE_NAMESPACE\n\n#ifdef _MSC_VER\n#  pragma warning(pop)\n#endif\n\n// clang-format off\n#ifdef __ICCARM__\n#pragma diag_default=Pa093\n#endif\n// clang-format on\n"
  },
  {
    "path": "src/ArduinoJson/Polyfills/type_traits/is_enum.hpp",
    "content": "// ArduinoJson - https://arduinojson.org\n// Copyright © 2014-2025, Benoit BLANCHON\n// MIT License\n\n#pragma once\n\n#include \"is_class.hpp\"\n#include \"is_convertible.hpp\"\n#include \"is_floating_point.hpp\"\n#include \"is_integral.hpp\"\n#include \"is_same.hpp\"\n\nARDUINOJSON_BEGIN_PRIVATE_NAMESPACE\n\ntemplate <typename T>\nstruct is_enum {\n  static const bool value = is_convertible<T, long long>::value &&\n                            !is_class<T>::value && !is_integral<T>::value &&\n                            !is_floating_point<T>::value;\n};\n\nARDUINOJSON_END_PRIVATE_NAMESPACE\n"
  },
  {
    "path": "src/ArduinoJson/Polyfills/type_traits/is_floating_point.hpp",
    "content": "// ArduinoJson - https://arduinojson.org\n// Copyright © 2014-2025, Benoit BLANCHON\n// MIT License\n\n#pragma once\n\n#include \"integral_constant.hpp\"\n#include \"is_same.hpp\"\n#include \"remove_cv.hpp\"\n\nARDUINOJSON_BEGIN_PRIVATE_NAMESPACE\n\ntemplate <class T>\nstruct is_floating_point\n    : integral_constant<bool,  //\n                        is_same<float, remove_cv_t<T>>::value ||\n                            is_same<double, remove_cv_t<T>>::value> {};\n\nARDUINOJSON_END_PRIVATE_NAMESPACE\n"
  },
  {
    "path": "src/ArduinoJson/Polyfills/type_traits/is_integral.hpp",
    "content": "// ArduinoJson - https://arduinojson.org\n// Copyright © 2014-2025, Benoit BLANCHON\n// MIT License\n\n#pragma once\n\n#include <ArduinoJson/Configuration.hpp>\n\n#include \"integral_constant.hpp\"\n#include \"is_same.hpp\"\n#include \"remove_cv.hpp\"\n\nARDUINOJSON_BEGIN_PRIVATE_NAMESPACE\n\n// clang-format off\ntemplate <typename T>\nstruct is_integral : integral_constant<bool,\n    is_same<remove_cv_t<T>, signed char>::value ||\n    is_same<remove_cv_t<T>, unsigned char>::value ||\n    is_same<remove_cv_t<T>, signed short>::value ||\n    is_same<remove_cv_t<T>, unsigned short>::value ||\n    is_same<remove_cv_t<T>, signed int>::value ||\n    is_same<remove_cv_t<T>, unsigned int>::value ||\n    is_same<remove_cv_t<T>, signed long>::value ||\n    is_same<remove_cv_t<T>, unsigned long>::value ||\n    is_same<remove_cv_t<T>, signed long long>::value ||\n    is_same<remove_cv_t<T>, unsigned long long>::value ||\n    is_same<remove_cv_t<T>, char>::value ||\n    is_same<remove_cv_t<T>, bool>::value> {};\n// clang-format on\n\nARDUINOJSON_END_PRIVATE_NAMESPACE\n"
  },
  {
    "path": "src/ArduinoJson/Polyfills/type_traits/is_pointer.hpp",
    "content": "// ArduinoJson - https://arduinojson.org\n// Copyright © 2014-2025, Benoit BLANCHON\n// MIT License\n\n#pragma once\n\n#include \"integral_constant.hpp\"\n\nARDUINOJSON_BEGIN_PRIVATE_NAMESPACE\n\ntemplate <typename T>\nstruct is_pointer : false_type {};\n\ntemplate <typename T>\nstruct is_pointer<T*> : true_type {};\n\nARDUINOJSON_END_PRIVATE_NAMESPACE\n"
  },
  {
    "path": "src/ArduinoJson/Polyfills/type_traits/is_same.hpp",
    "content": "// ArduinoJson - https://arduinojson.org\n// Copyright © 2014-2025, Benoit BLANCHON\n// MIT License\n\n#pragma once\n\n#include \"integral_constant.hpp\"\n\nARDUINOJSON_BEGIN_PRIVATE_NAMESPACE\n\n// A meta-function that returns true if types T and U are the same.\ntemplate <typename T, typename U>\nstruct is_same : false_type {};\n\ntemplate <typename T>\nstruct is_same<T, T> : true_type {};\n\nARDUINOJSON_END_PRIVATE_NAMESPACE\n"
  },
  {
    "path": "src/ArduinoJson/Polyfills/type_traits/is_signed.hpp",
    "content": "// ArduinoJson - https://arduinojson.org\n// Copyright © 2014-2025, Benoit BLANCHON\n// MIT License\n\n#pragma once\n\n#include \"integral_constant.hpp\"\n#include \"is_same.hpp\"\n#include \"remove_cv.hpp\"\n\nARDUINOJSON_BEGIN_PRIVATE_NAMESPACE\n\n// clang-format off\ntemplate <typename T>\nstruct is_signed : integral_constant<bool,\n    is_same<remove_cv_t<T>, char>::value ||\n    is_same<remove_cv_t<T>, signed char>::value ||\n    is_same<remove_cv_t<T>, signed short>::value ||\n    is_same<remove_cv_t<T>, signed int>::value ||\n    is_same<remove_cv_t<T>, signed long>::value ||\n    is_same<remove_cv_t<T>, signed long long>::value ||\n    is_same<remove_cv_t<T>, float>::value ||\n    is_same<remove_cv_t<T>, double>::value> {};\n// clang-format on\n\nARDUINOJSON_END_PRIVATE_NAMESPACE\n"
  },
  {
    "path": "src/ArduinoJson/Polyfills/type_traits/is_unsigned.hpp",
    "content": "// ArduinoJson - https://arduinojson.org\n// Copyright © 2014-2025, Benoit BLANCHON\n// MIT License\n\n#pragma once\n\n#include \"integral_constant.hpp\"\n#include \"is_same.hpp\"\n#include \"remove_cv.hpp\"\n\nARDUINOJSON_BEGIN_PRIVATE_NAMESPACE\n\n// clang-format off\ntemplate <typename T>\nstruct is_unsigned : integral_constant<bool,\n    is_same<remove_cv_t<T>, unsigned char>::value ||\n    is_same<remove_cv_t<T>, unsigned short>::value ||\n    is_same<remove_cv_t<T>, unsigned int>::value ||\n    is_same<remove_cv_t<T>, unsigned long>::value ||\n    is_same<remove_cv_t<T>, unsigned long long>::value ||\n    is_same<remove_cv_t<T>, bool>::value> {};\n// clang-format on\n\nARDUINOJSON_END_PRIVATE_NAMESPACE\n"
  },
  {
    "path": "src/ArduinoJson/Polyfills/type_traits/make_unsigned.hpp",
    "content": "// ArduinoJson - https://arduinojson.org\n// Copyright © 2014-2025, Benoit BLANCHON\n// MIT License\n\n#pragma once\n\n#include \"type_identity.hpp\"\nARDUINOJSON_BEGIN_PRIVATE_NAMESPACE\n\ntemplate <typename T>\nstruct make_unsigned;\n\ntemplate <>\nstruct make_unsigned<char> : type_identity<unsigned char> {};\n\ntemplate <>\nstruct make_unsigned<signed char> : type_identity<unsigned char> {};\ntemplate <>\nstruct make_unsigned<unsigned char> : type_identity<unsigned char> {};\n\ntemplate <>\nstruct make_unsigned<signed short> : type_identity<unsigned short> {};\ntemplate <>\nstruct make_unsigned<unsigned short> : type_identity<unsigned short> {};\n\ntemplate <>\nstruct make_unsigned<signed int> : type_identity<unsigned int> {};\ntemplate <>\nstruct make_unsigned<unsigned int> : type_identity<unsigned int> {};\n\ntemplate <>\nstruct make_unsigned<signed long> : type_identity<unsigned long> {};\ntemplate <>\nstruct make_unsigned<unsigned long> : type_identity<unsigned long> {};\n\ntemplate <>\nstruct make_unsigned<signed long long> : type_identity<unsigned long long> {};\ntemplate <>\nstruct make_unsigned<unsigned long long> : type_identity<unsigned long long> {};\n\ntemplate <typename T>\nusing make_unsigned_t = typename make_unsigned<T>::type;\n\nARDUINOJSON_END_PRIVATE_NAMESPACE\n"
  },
  {
    "path": "src/ArduinoJson/Polyfills/type_traits/remove_const.hpp",
    "content": "// ArduinoJson - https://arduinojson.org\n// Copyright © 2014-2025, Benoit BLANCHON\n// MIT License\n\n#pragma once\n\n#include <ArduinoJson/Namespace.hpp>\n\nARDUINOJSON_BEGIN_PRIVATE_NAMESPACE\n\n// A meta-function that return the type T without the const modifier\ntemplate <typename T>\nstruct remove_const {\n  using type = T;\n};\ntemplate <typename T>\nstruct remove_const<const T> {\n  using type = T;\n};\n\ntemplate <typename T>\nusing remove_const_t = typename remove_const<T>::type;\n\nARDUINOJSON_END_PRIVATE_NAMESPACE\n"
  },
  {
    "path": "src/ArduinoJson/Polyfills/type_traits/remove_cv.hpp",
    "content": "// ArduinoJson - https://arduinojson.org\n// Copyright © 2014-2025, Benoit BLANCHON\n// MIT License\n\n#pragma once\n\n#include <ArduinoJson/Namespace.hpp>\n\nARDUINOJSON_BEGIN_PRIVATE_NAMESPACE\n\ntemplate <typename T>\nstruct remove_cv {\n  using type = T;\n};\ntemplate <typename T>\nstruct remove_cv<const T> {\n  using type = T;\n};\ntemplate <typename T>\nstruct remove_cv<volatile T> {\n  using type = T;\n};\ntemplate <typename T>\nstruct remove_cv<const volatile T> {\n  using type = T;\n};\n\ntemplate <typename T>\nusing remove_cv_t = typename remove_cv<T>::type;\n\nARDUINOJSON_END_PRIVATE_NAMESPACE\n"
  },
  {
    "path": "src/ArduinoJson/Polyfills/type_traits/remove_reference.hpp",
    "content": "// ArduinoJson - https://arduinojson.org\n// Copyright © 2014-2025, Benoit BLANCHON\n// MIT License\n\n#pragma once\n\n#include <ArduinoJson/Namespace.hpp>\n\nARDUINOJSON_BEGIN_PRIVATE_NAMESPACE\n\n// A meta-function that return the type T without the reference modifier.\ntemplate <typename T>\nstruct remove_reference {\n  using type = T;\n};\ntemplate <typename T>\nstruct remove_reference<T&> {\n  using type = T;\n};\n\ntemplate <typename T>\nusing remove_reference_t = typename remove_reference<T>::type;\n\nARDUINOJSON_END_PRIVATE_NAMESPACE\n"
  },
  {
    "path": "src/ArduinoJson/Polyfills/type_traits/type_identity.hpp",
    "content": "// ArduinoJson - https://arduinojson.org\n// Copyright © 2014-2025, Benoit BLANCHON\n// MIT License\n\n#pragma once\n\n#include \"integral_constant.hpp\"\n\nARDUINOJSON_BEGIN_PRIVATE_NAMESPACE\n\ntemplate <typename T>\nstruct type_identity {\n  using type = T;\n};\n\nARDUINOJSON_END_PRIVATE_NAMESPACE\n"
  },
  {
    "path": "src/ArduinoJson/Polyfills/type_traits/void_t.hpp",
    "content": "// ArduinoJson - https://arduinojson.org\n// Copyright © 2014-2025, Benoit BLANCHON\n// MIT License\n\n#pragma once\n\n#include <ArduinoJson/Namespace.hpp>\n\nARDUINOJSON_BEGIN_PRIVATE_NAMESPACE\n\ntemplate <typename...>\nstruct make_void {\n  using type = void;\n};\n\ntemplate <typename... Args>\nusing void_t = typename make_void<Args...>::type;\n// NOTE: using void_t = void; doesn't work on GCC 4.8\n\nARDUINOJSON_END_PRIVATE_NAMESPACE\n"
  },
  {
    "path": "src/ArduinoJson/Polyfills/type_traits.hpp",
    "content": "// ArduinoJson - https://arduinojson.org\n// Copyright © 2014-2025, Benoit BLANCHON\n// MIT License\n\n#pragma once\n\n#include \"type_traits/conditional.hpp\"\n#include \"type_traits/decay.hpp\"\n#include \"type_traits/enable_if.hpp\"\n#include \"type_traits/function_traits.hpp\"\n#include \"type_traits/integral_constant.hpp\"\n#include \"type_traits/is_array.hpp\"\n#include \"type_traits/is_base_of.hpp\"\n#include \"type_traits/is_class.hpp\"\n#include \"type_traits/is_const.hpp\"\n#include \"type_traits/is_convertible.hpp\"\n#include \"type_traits/is_enum.hpp\"\n#include \"type_traits/is_floating_point.hpp\"\n#include \"type_traits/is_integral.hpp\"\n#include \"type_traits/is_pointer.hpp\"\n#include \"type_traits/is_same.hpp\"\n#include \"type_traits/is_signed.hpp\"\n#include \"type_traits/is_unsigned.hpp\"\n#include \"type_traits/make_unsigned.hpp\"\n#include \"type_traits/remove_const.hpp\"\n#include \"type_traits/remove_reference.hpp\"\n#include \"type_traits/void_t.hpp\"\n"
  },
  {
    "path": "src/ArduinoJson/Polyfills/utility.hpp",
    "content": "// ArduinoJson - https://arduinojson.org\n// Copyright © 2014-2025, Benoit BLANCHON\n// MIT License\n\n#pragma once\n\n#include \"type_traits.hpp\"\n\nARDUINOJSON_BEGIN_PRIVATE_NAMESPACE\n\nusing nullptr_t = decltype(nullptr);\n\ntemplate <class T>\nT&& forward(remove_reference_t<T>& t) noexcept {\n  return static_cast<T&&>(t);\n}\n\ntemplate <class T>\nremove_reference_t<T>&& move(T&& t) {\n  return static_cast<remove_reference_t<T>&&>(t);\n}\n\n// Polyfull for std::swap\n// Don't use the name \"swap\" because it makes calls ambiguous for types in the\n// detail namespace\ntemplate <class T>\nvoid swap_(T& a, T& b) {\n  T tmp = move(a);\n  a = move(b);\n  b = move(tmp);\n}\n\nARDUINOJSON_END_PRIVATE_NAMESPACE\n"
  },
  {
    "path": "src/ArduinoJson/Serialization/CountingDecorator.hpp",
    "content": "// ArduinoJson - https://arduinojson.org\n// Copyright © 2014-2025, Benoit BLANCHON\n// MIT License\n\n#pragma once\n\n#include <ArduinoJson/Namespace.hpp>\n\nARDUINOJSON_BEGIN_PRIVATE_NAMESPACE\n\ntemplate <typename TWriter>\nclass CountingDecorator {\n public:\n  explicit CountingDecorator(TWriter& writer) : writer_(writer), count_(0) {}\n\n  void write(uint8_t c) {\n    count_ += writer_.write(c);\n  }\n\n  void write(const uint8_t* s, size_t n) {\n    count_ += writer_.write(s, n);\n  }\n\n  size_t count() const {\n    return count_;\n  }\n\n private:\n  TWriter writer_;\n  size_t count_;\n};\n\nARDUINOJSON_END_PRIVATE_NAMESPACE\n"
  },
  {
    "path": "src/ArduinoJson/Serialization/Writer.hpp",
    "content": "// ArduinoJson - https://arduinojson.org\n// Copyright © 2014-2025, Benoit BLANCHON\n// MIT License\n\n#pragma once\n\n#include <ArduinoJson/Namespace.hpp>\n\nARDUINOJSON_BEGIN_PRIVATE_NAMESPACE\n\n// The default writer is a simple wrapper for Writers that are not copyable\ntemplate <typename TDestination, typename Enable = void>\nclass Writer {\n public:\n  explicit Writer(TDestination& dest) : dest_(&dest) {}\n\n  size_t write(uint8_t c) {\n    return dest_->write(c);\n  }\n\n  size_t write(const uint8_t* s, size_t n) {\n    return dest_->write(s, n);\n  }\n\n private:\n  TDestination* dest_;\n};\n\nARDUINOJSON_END_PRIVATE_NAMESPACE\n\n#include <ArduinoJson/Serialization/Writers/StaticStringWriter.hpp>\n\n#if ARDUINOJSON_ENABLE_STD_STRING\n#  include <ArduinoJson/Serialization/Writers/StdStringWriter.hpp>\n#endif\n\n#if ARDUINOJSON_ENABLE_ARDUINO_STRING\n#  include <ArduinoJson/Serialization/Writers/ArduinoStringWriter.hpp>\n#endif\n\n#if ARDUINOJSON_ENABLE_STD_STREAM\n#  include <ArduinoJson/Serialization/Writers/StdStreamWriter.hpp>\n#endif\n\n#if ARDUINOJSON_ENABLE_ARDUINO_PRINT\n#  include <ArduinoJson/Serialization/Writers/PrintWriter.hpp>\n#endif\n"
  },
  {
    "path": "src/ArduinoJson/Serialization/Writers/ArduinoStringWriter.hpp",
    "content": "// ArduinoJson - https://arduinojson.org\n// Copyright © 2014-2025, Benoit BLANCHON\n// MIT License\n\n#pragma once\n\n#include <Arduino.h>\n\nARDUINOJSON_BEGIN_PRIVATE_NAMESPACE\n\ntemplate <>\nclass Writer<::String, void> {\n  static const size_t bufferCapacity = ARDUINOJSON_STRING_BUFFER_SIZE;\n\n public:\n  explicit Writer(::String& str) : destination_(&str), size_(0) {\n    // clear the string but don't use \"\" to avoid useless allocation\n    // https://cpp4arduino.com/2018/11/21/eight-tips-to-use-the-string-class-efficiently.html\n    str = static_cast<const char*>(0);\n  }\n\n  ~Writer() {\n    flush();\n  }\n\n  size_t write(uint8_t c) {\n    if (size_ + 1 >= bufferCapacity)\n      if (flush() != 0)\n        return 0;\n    buffer_[size_++] = static_cast<char>(c);\n    return 1;\n  }\n\n  size_t write(const uint8_t* s, size_t n) {\n    for (size_t i = 0; i < n; i++) {\n      write(s[i]);\n    }\n    return n;\n  }\n\n  size_t flush() {\n    ARDUINOJSON_ASSERT(size_ < bufferCapacity);\n    buffer_[size_] = 0;\n    if (destination_->concat(buffer_))\n      size_ = 0;\n    return size_;\n  }\n\n private:\n  ::String* destination_;\n  char buffer_[bufferCapacity];\n  size_t size_;\n};\n\nARDUINOJSON_END_PRIVATE_NAMESPACE\n"
  },
  {
    "path": "src/ArduinoJson/Serialization/Writers/DummyWriter.hpp",
    "content": "// ArduinoJson - https://arduinojson.org\n// Copyright © 2014-2025, Benoit BLANCHON\n// MIT License\n\n#pragma once\n\n#include <ArduinoJson/Namespace.hpp>\n\nARDUINOJSON_BEGIN_PRIVATE_NAMESPACE\n\nclass DummyWriter {\n public:\n  size_t write(uint8_t) {\n    return 1;\n  }\n\n  size_t write(const uint8_t*, size_t n) {\n    return n;\n  }\n};\n\nARDUINOJSON_END_PRIVATE_NAMESPACE\n"
  },
  {
    "path": "src/ArduinoJson/Serialization/Writers/PrintWriter.hpp",
    "content": "// ArduinoJson - https://arduinojson.org\n// Copyright © 2014-2025, Benoit BLANCHON\n// MIT License\n\n#pragma once\n\n#include <Arduino.h>\n\nARDUINOJSON_BEGIN_PRIVATE_NAMESPACE\n\ntemplate <typename TDestination>\nclass Writer<TDestination,\n             enable_if_t<is_base_of<::Print, TDestination>::value>> {\n public:\n  explicit Writer(::Print& print) : print_(&print) {}\n\n  size_t write(uint8_t c) {\n    return print_->write(c);\n  }\n\n  size_t write(const uint8_t* s, size_t n) {\n    return print_->write(s, n);\n  }\n\n private:\n  ::Print* print_;\n};\n\nARDUINOJSON_END_PRIVATE_NAMESPACE\n"
  },
  {
    "path": "src/ArduinoJson/Serialization/Writers/StaticStringWriter.hpp",
    "content": "// ArduinoJson - https://arduinojson.org\n// Copyright © 2014-2025, Benoit BLANCHON\n// MIT License\n\n#pragma once\n\n#include <ArduinoJson/Namespace.hpp>\n\nARDUINOJSON_BEGIN_PRIVATE_NAMESPACE\n\nclass StaticStringWriter {\n public:\n  StaticStringWriter(char* buf, size_t size) : end(buf + size), p(buf) {}\n\n  size_t write(uint8_t c) {\n    if (p >= end)\n      return 0;\n    *p++ = static_cast<char>(c);\n    return 1;\n  }\n\n  size_t write(const uint8_t* s, size_t n) {\n    char* begin = p;\n    while (p < end && n > 0) {\n      *p++ = static_cast<char>(*s++);\n      n--;\n    }\n    return size_t(p - begin);\n  }\n\n private:\n  char* end;\n  char* p;\n};\n\nARDUINOJSON_END_PRIVATE_NAMESPACE\n"
  },
  {
    "path": "src/ArduinoJson/Serialization/Writers/StdStreamWriter.hpp",
    "content": "// ArduinoJson - https://arduinojson.org\n// Copyright © 2014-2025, Benoit BLANCHON\n// MIT License\n\n#pragma once\n\n#include <ostream>\n\nARDUINOJSON_BEGIN_PRIVATE_NAMESPACE\n\ntemplate <typename TDestination>\nclass Writer<TDestination,\n             enable_if_t<is_base_of<std::ostream, TDestination>::value>> {\n public:\n  explicit Writer(std::ostream& os) : os_(&os) {}\n\n  size_t write(uint8_t c) {\n    os_->put(static_cast<char>(c));\n    return 1;\n  }\n\n  size_t write(const uint8_t* s, size_t n) {\n    os_->write(reinterpret_cast<const char*>(s),\n               static_cast<std::streamsize>(n));\n    return n;\n  }\n\n private:\n  std::ostream* os_;\n};\n\nARDUINOJSON_END_PRIVATE_NAMESPACE\n"
  },
  {
    "path": "src/ArduinoJson/Serialization/Writers/StdStringWriter.hpp",
    "content": "// ArduinoJson - https://arduinojson.org\n// Copyright © 2014-2025, Benoit BLANCHON\n// MIT License\n\n#pragma once\n\n#include <ArduinoJson/Namespace.hpp>\n#include <ArduinoJson/Polyfills/type_traits.hpp>\n\nARDUINOJSON_BEGIN_PRIVATE_NAMESPACE\n\ntemplate <class T, typename = void>\nstruct is_std_string : false_type {};\n\ntemplate <class T>\nstruct is_std_string<\n    T, enable_if_t<is_same<void, decltype(T().push_back('a'))>::value &&\n                   is_same<T&, decltype(T().append(\"\"))>::value>> : true_type {\n};\n\ntemplate <typename TDestination>\nclass Writer<TDestination, enable_if_t<is_std_string<TDestination>::value>> {\n public:\n  Writer(TDestination& str) : str_(&str) {\n    str.clear();\n  }\n\n  size_t write(uint8_t c) {\n    str_->push_back(static_cast<char>(c));\n    return 1;\n  }\n\n  size_t write(const uint8_t* s, size_t n) {\n    str_->append(reinterpret_cast<const char*>(s), n);\n    return n;\n  }\n\n private:\n  TDestination* str_;\n};\n\nARDUINOJSON_END_PRIVATE_NAMESPACE\n"
  },
  {
    "path": "src/ArduinoJson/Serialization/measure.hpp",
    "content": "// ArduinoJson - https://arduinojson.org\n// Copyright © 2014-2025, Benoit BLANCHON\n// MIT License\n\n#pragma once\n\n#include <ArduinoJson/Serialization/Writers/DummyWriter.hpp>\n\nARDUINOJSON_BEGIN_PRIVATE_NAMESPACE\n\ntemplate <template <typename> class TSerializer>\nsize_t measure(ArduinoJson::JsonVariantConst source) {\n  DummyWriter dp;\n  auto data = VariantAttorney::getData(source);\n  auto resources = VariantAttorney::getResourceManager(source);\n  TSerializer<DummyWriter> serializer(dp, resources);\n  return VariantImpl::accept(serializer, data, resources);\n}\n\nARDUINOJSON_END_PRIVATE_NAMESPACE\n"
  },
  {
    "path": "src/ArduinoJson/Serialization/serialize.hpp",
    "content": "// ArduinoJson - https://arduinojson.org\n// Copyright © 2014-2025, Benoit BLANCHON\n// MIT License\n\n#pragma once\n\n#include <ArduinoJson/Serialization/Writer.hpp>\n\nARDUINOJSON_BEGIN_PRIVATE_NAMESPACE\n\ntemplate <template <typename> class TSerializer, typename TWriter>\nsize_t doSerialize(ArduinoJson::JsonVariantConst source, TWriter writer) {\n  auto data = VariantAttorney::getData(source);\n  auto resources = VariantAttorney::getResourceManager(source);\n  TSerializer<TWriter> serializer(writer, resources);\n  return VariantImpl::accept(serializer, data, resources);\n}\n\ntemplate <template <typename> class TSerializer, typename TDestination>\nsize_t serialize(ArduinoJson::JsonVariantConst source,\n                 TDestination& destination) {\n  Writer<TDestination> writer(destination);\n  return doSerialize<TSerializer>(source, writer);\n}\n\ntemplate <template <typename> class TSerializer>\nenable_if_t<!TSerializer<StaticStringWriter>::producesText, size_t> serialize(\n    ArduinoJson::JsonVariantConst source, void* buffer, size_t bufferSize) {\n  StaticStringWriter writer(reinterpret_cast<char*>(buffer), bufferSize);\n  return doSerialize<TSerializer>(source, writer);\n}\n\ntemplate <template <typename> class TSerializer>\nenable_if_t<TSerializer<StaticStringWriter>::producesText, size_t> serialize(\n    ArduinoJson::JsonVariantConst source, void* buffer, size_t bufferSize) {\n  StaticStringWriter writer(reinterpret_cast<char*>(buffer), bufferSize);\n  size_t n = doSerialize<TSerializer>(source, writer);\n  // add null-terminator for text output (not counted in the size)\n  if (n < bufferSize)\n    reinterpret_cast<char*>(buffer)[n] = 0;\n  return n;\n}\n\ntemplate <template <typename> class TSerializer, typename TChar, size_t N>\nenable_if_t<IsChar<TChar>::value, size_t> serialize(\n    ArduinoJson::JsonVariantConst source, TChar (&buffer)[N]) {\n  return serialize<TSerializer>(source, buffer, N);\n}\n\nARDUINOJSON_END_PRIVATE_NAMESPACE\n"
  },
  {
    "path": "src/ArduinoJson/Strings/Adapters/FlashString.hpp",
    "content": "// ArduinoJson - https://arduinojson.org\n// Copyright © 2014-2025, Benoit BLANCHON\n// MIT License\n\n#pragma once\n\n#include <ArduinoJson/Polyfills/pgmspace.hpp>\n#include <ArduinoJson/Strings/StringAdapter.hpp>\n\nARDUINOJSON_BEGIN_PRIVATE_NAMESPACE\n\nclass FlashString {\n public:\n  static const size_t typeSortKey = 1;\n\n  FlashString(const __FlashStringHelper* str, size_t sz)\n      : str_(reinterpret_cast<const char*>(str)), size_(sz) {}\n\n  bool isNull() const {\n    return !str_;\n  }\n\n  char operator[](size_t i) const {\n    ARDUINOJSON_ASSERT(str_ != 0);\n    ARDUINOJSON_ASSERT(i <= size_);\n    return static_cast<char>(pgm_read_byte(str_ + i));\n  }\n\n  const char* data() const {\n    return nullptr;\n  }\n\n  size_t size() const {\n    return size_;\n  }\n\n  friend bool stringEquals(FlashString a, RamString b) {\n    ARDUINOJSON_ASSERT(a.typeSortKey < b.typeSortKey);\n    ARDUINOJSON_ASSERT(!a.isNull());\n    ARDUINOJSON_ASSERT(!b.isNull());\n    if (a.size() != b.size())\n      return false;\n    return ::memcmp_P(b.data(), a.str_, a.size_) == 0;\n  }\n\n  friend int stringCompare(FlashString a, RamString b) {\n    ARDUINOJSON_ASSERT(a.typeSortKey < b.typeSortKey);\n    ARDUINOJSON_ASSERT(!a.isNull());\n    ARDUINOJSON_ASSERT(!b.isNull());\n    size_t minsize = a.size() < b.size() ? a.size() : b.size();\n    int res = ::memcmp_P(b.data(), a.str_, minsize);\n    if (res)\n      return -res;\n    if (a.size() < b.size())\n      return -1;\n    if (a.size() > b.size())\n      return 1;\n    return 0;\n  }\n\n  friend void stringGetChars(FlashString s, char* p, size_t n) {\n    ARDUINOJSON_ASSERT(s.size() <= n);\n    ::memcpy_P(p, s.str_, n);\n  }\n\n private:\n  const char* str_;\n  size_t size_;\n};\n\ntemplate <>\nstruct StringAdapter<const __FlashStringHelper*, void> {\n  using AdaptedString = FlashString;\n\n  static AdaptedString adapt(const __FlashStringHelper* s) {\n    return AdaptedString(s, s ? strlen_P(reinterpret_cast<const char*>(s)) : 0);\n  }\n};\n\ntemplate <>\nstruct SizedStringAdapter<const __FlashStringHelper*, void> {\n  using AdaptedString = FlashString;\n\n  static AdaptedString adapt(const __FlashStringHelper* s, size_t n) {\n    return AdaptedString(s, n);\n  }\n};\n\nARDUINOJSON_END_PRIVATE_NAMESPACE\n"
  },
  {
    "path": "src/ArduinoJson/Strings/Adapters/RamString.hpp",
    "content": "// ArduinoJson - https://arduinojson.org\n// Copyright © 2014-2025, Benoit BLANCHON\n// MIT License\n\n#pragma once\n\n#include <stddef.h>  // size_t\n#include <string.h>  // strcmp\n\n#include <ArduinoJson/Polyfills/assert.hpp>\n#include <ArduinoJson/Polyfills/attributes.hpp>\n#include <ArduinoJson/Strings/StringAdapter.hpp>\n\nARDUINOJSON_BEGIN_PRIVATE_NAMESPACE\n\ntemplate <typename T>\nstruct IsChar\n    : integral_constant<bool, is_integral<T>::value && sizeof(T) == 1> {};\n\nclass RamString {\n public:\n  static const size_t typeSortKey = 2;\n\n  RamString(const char* str, size_t sz) : str_(str), size_(sz) {\n    ARDUINOJSON_ASSERT(size_ == sz);\n  }\n\n  bool isNull() const {\n    return !str_;\n  }\n\n  size_t size() const {\n    return size_;\n  }\n\n  char operator[](size_t i) const {\n    ARDUINOJSON_ASSERT(str_ != 0);\n    ARDUINOJSON_ASSERT(i <= size());\n    return str_[i];\n  }\n\n  const char* data() const {\n    return str_;\n  }\n\n protected:\n  const char* str_;\n  size_t size_;\n};\n\ntemplate <typename TChar>\nstruct StringAdapter<TChar*, enable_if_t<IsChar<TChar>::value>> {\n  using AdaptedString = RamString;\n\n  static AdaptedString adapt(const TChar* p) {\n    auto str = reinterpret_cast<const char*>(p);\n    return AdaptedString(str, str ? ::strlen(str) : 0);\n  }\n};\n\ntemplate <typename TChar>\nstruct SizedStringAdapter<TChar*, enable_if_t<IsChar<TChar>::value>> {\n  using AdaptedString = RamString;\n\n  static AdaptedString adapt(const TChar* p, size_t n) {\n    return AdaptedString(reinterpret_cast<const char*>(p), n);\n  }\n};\n\nARDUINOJSON_END_PRIVATE_NAMESPACE\n"
  },
  {
    "path": "src/ArduinoJson/Strings/Adapters/StringObject.hpp",
    "content": "// ArduinoJson - https://arduinojson.org\n// Copyright © 2014-2025, Benoit BLANCHON\n// MIT License\n\n#pragma once\n\n#include <ArduinoJson/Strings/Adapters/RamString.hpp>\n#include <ArduinoJson/Strings/StringAdapter.hpp>\n#include <ArduinoJson/Strings/StringTraits.hpp>\n\nARDUINOJSON_BEGIN_PRIVATE_NAMESPACE\n\ntemplate <typename T>\nstruct StringAdapter<\n    T,\n    enable_if_t<(string_traits<T>::has_cstr || string_traits<T>::has_data) &&\n                (string_traits<T>::has_length || string_traits<T>::has_size)>> {\n  using AdaptedString = RamString;\n\n  static AdaptedString adapt(const T& s) {\n    return AdaptedString(get_data(s), get_size(s));\n  }\n\n private:\n  template <typename U>\n  static enable_if_t<string_traits<U>::has_size, size_t> get_size(const U& s) {\n    return s.size();\n  }\n\n  template <typename U>\n  static enable_if_t<!string_traits<U>::has_size, size_t> get_size(const U& s) {\n    return s.length();\n  }\n\n  template <typename U>\n  static enable_if_t<string_traits<U>::has_data, const char*> get_data(\n      const U& s) {\n    return s.data();\n  }\n\n  template <typename U>\n  static enable_if_t<!string_traits<U>::has_data, const char*> get_data(\n      const U& s) {\n    return s.c_str();\n  }\n};\n\nARDUINOJSON_END_PRIVATE_NAMESPACE\n"
  },
  {
    "path": "src/ArduinoJson/Strings/IsString.hpp",
    "content": "// ArduinoJson - https://arduinojson.org\n// Copyright © 2014-2025, Benoit BLANCHON\n// MIT License\n\n#pragma once\n\n#include <ArduinoJson/Polyfills/type_traits.hpp>\n#include <ArduinoJson/Strings/StringAdapter.hpp>\n\nARDUINOJSON_BEGIN_PRIVATE_NAMESPACE\n\ntemplate <typename T, typename Enable = void>\nstruct IsString : false_type {};\n\ntemplate <typename T>\nstruct IsString<T, void_t<typename StringAdapterFor<T>::AdaptedString>>\n    : true_type {};\n\nARDUINOJSON_END_PRIVATE_NAMESPACE\n"
  },
  {
    "path": "src/ArduinoJson/Strings/JsonString.hpp",
    "content": "// ArduinoJson - https://arduinojson.org\n// Copyright © 2014-2025, Benoit BLANCHON\n// MIT License\n\n#pragma once\n\n#include <ArduinoJson/Polyfills/type_traits.hpp>\n#include <ArduinoJson/Strings/Adapters/RamString.hpp>\n\n#if ARDUINOJSON_ENABLE_STD_STREAM\n#  include <ostream>\n#endif\n\nARDUINOJSON_BEGIN_PUBLIC_NAMESPACE\n\n// A string.\n// https://arduinojson.org/v7/api/jsonstring/\nclass JsonString {\n  friend struct detail::StringAdapter<JsonString>;\n\n public:\n  JsonString() : str_(nullptr, 0) {}\n\n  JsonString(const char* data) : str_(data, data ? ::strlen(data) : 0) {}\n\n  ARDUINOJSON_DEPRECATED(\n      \"ArduinoJson doesn't differentiate between static and dynamic strings \"\n      \"anymore. Remove the second argument to fix this warning.\")\n  JsonString(const char* data, bool) : JsonString(data) {}\n\n  template <typename TSize,\n            detail::enable_if_t<detail::is_integral<TSize>::value &&\n                                    !detail::is_same<TSize, bool>::value,\n                                int> = 0>\n  JsonString(const char* data, TSize sz) : str_(data, size_t(sz)) {}\n\n  ARDUINOJSON_DEPRECATED(\n      \"ArduinoJson doesn't differentiate between static and dynamic strings \"\n      \"anymore. Remove the third argument to fix this warning.\")\n  JsonString(const char* data, size_t sz, bool) : JsonString(data, sz) {}\n\n  // Returns a pointer to the characters.\n  const char* c_str() const {\n    return str_.data();\n  }\n\n  // Returns true if the string is null.\n  bool isNull() const {\n    return str_.isNull();\n  }\n\n  // Deprecated: always returns false.\n  ARDUINOJSON_DEPRECATED(\"The isStatic() was removed in v7.5\")\n  bool isStatic() const {\n    return false;\n  }\n\n  // Returns length of the string.\n  size_t size() const {\n    return str_.size();\n  }\n\n  // Returns true if the string is non-null\n  explicit operator bool() const {\n    return str_.data() != 0;\n  }\n\n  // Returns true if strings are equal.\n  friend bool operator==(JsonString lhs, JsonString rhs) {\n    if (lhs.size() != rhs.size())\n      return false;\n    if (lhs.c_str() == rhs.c_str())\n      return true;\n    if (!lhs.c_str())\n      return false;\n    if (!rhs.c_str())\n      return false;\n    return memcmp(lhs.c_str(), rhs.c_str(), lhs.size()) == 0;\n  }\n\n  // Returns true if strings differs.\n  friend bool operator!=(JsonString lhs, JsonString rhs) {\n    return !(lhs == rhs);\n  }\n\n#if ARDUINOJSON_ENABLE_STD_STREAM\n  friend std::ostream& operator<<(std::ostream& lhs, const JsonString& rhs) {\n    lhs.write(rhs.c_str(), static_cast<std::streamsize>(rhs.size()));\n    return lhs;\n  }\n#endif\n\n private:\n  detail::RamString str_;\n};\n\nnamespace detail {\ntemplate <>\nstruct StringAdapter<JsonString> {\n  using AdaptedString = RamString;\n\n  static const AdaptedString& adapt(const JsonString& s) {\n    return s.str_;\n  }\n};\n}  // namespace detail\n\nARDUINOJSON_END_PUBLIC_NAMESPACE\n"
  },
  {
    "path": "src/ArduinoJson/Strings/StringAdapter.hpp",
    "content": "// ArduinoJson - https://arduinojson.org\n// Copyright © 2014-2025, Benoit BLANCHON\n// MIT License\n\n#pragma once\n\n#include <ArduinoJson/Polyfills/utility.hpp>\n\nARDUINOJSON_BEGIN_PRIVATE_NAMESPACE\n\ntemplate <typename TString, typename Enable = void>\nstruct StringAdapter;\n\ntemplate <typename TString, typename Enable = void>\nstruct SizedStringAdapter;\n\ntemplate <typename TString>\nusing StringAdapterFor = StringAdapter<decay_t<TString>>;\n\ntemplate <typename T>\nusing AdaptedString = typename StringAdapterFor<T>::AdaptedString;\n\ntemplate <typename TString>\nAdaptedString<TString> adaptString(TString&& s) {\n  return StringAdapterFor<TString>::adapt(detail::forward<TString>(s));\n}\n\ntemplate <typename TChar>\nAdaptedString<TChar*> adaptString(TChar* p) {\n  return StringAdapter<TChar*>::adapt(p);\n}\n\ntemplate <typename TChar>\nAdaptedString<TChar*> adaptString(TChar* p, size_t n) {\n  return SizedStringAdapter<TChar*>::adapt(p, n);\n}\n\nARDUINOJSON_END_PRIVATE_NAMESPACE\n"
  },
  {
    "path": "src/ArduinoJson/Strings/StringAdapters.hpp",
    "content": "// ArduinoJson - https://arduinojson.org\n// Copyright © 2014-2025, Benoit BLANCHON\n// MIT License\n\n#pragma once\n\n#include <ArduinoJson/Polyfills/type_traits.hpp>\n#include <ArduinoJson/Strings/Adapters/RamString.hpp>\n#include <ArduinoJson/Strings/Adapters/StringObject.hpp>\n\n#if ARDUINOJSON_ENABLE_PROGMEM\n#  include <ArduinoJson/Strings/Adapters/FlashString.hpp>\n#endif\n\nARDUINOJSON_BEGIN_PRIVATE_NAMESPACE\n\ntemplate <typename TAdaptedString1, typename TAdaptedString2>\nenable_if_t<TAdaptedString1::typeSortKey <= TAdaptedString2::typeSortKey, int>\nstringCompare(TAdaptedString1 s1, TAdaptedString2 s2) {\n  ARDUINOJSON_ASSERT(!s1.isNull());\n  ARDUINOJSON_ASSERT(!s2.isNull());\n  size_t size1 = s1.size();\n  size_t size2 = s2.size();\n  size_t n = size1 < size2 ? size1 : size2;\n  for (size_t i = 0; i < n; i++) {\n    if (s1[i] != s2[i])\n      return s1[i] - s2[i];\n  }\n  if (size1 < size2)\n    return -1;\n  if (size1 > size2)\n    return 1;\n  return 0;\n}\n\ntemplate <typename TAdaptedString1, typename TAdaptedString2>\nenable_if_t<(TAdaptedString1::typeSortKey > TAdaptedString2::typeSortKey), int>\nstringCompare(TAdaptedString1 s1, TAdaptedString2 s2) {\n  return -stringCompare(s2, s1);\n}\n\ntemplate <typename TAdaptedString1, typename TAdaptedString2>\nenable_if_t<TAdaptedString1::typeSortKey <= TAdaptedString2::typeSortKey, bool>\nstringEquals(TAdaptedString1 s1, TAdaptedString2 s2) {\n  ARDUINOJSON_ASSERT(!s1.isNull());\n  ARDUINOJSON_ASSERT(!s2.isNull());\n  size_t size1 = s1.size();\n  size_t size2 = s2.size();\n  if (size1 != size2)\n    return false;\n  for (size_t i = 0; i < size1; i++) {\n    if (s1[i] != s2[i])\n      return false;\n  }\n  return true;\n}\n\ntemplate <typename TAdaptedString1, typename TAdaptedString2>\nenable_if_t<(TAdaptedString1::typeSortKey > TAdaptedString2::typeSortKey), bool>\nstringEquals(TAdaptedString1 s1, TAdaptedString2 s2) {\n  return stringEquals(s2, s1);\n}\n\ntemplate <typename TAdaptedString>\nstatic void stringGetChars(TAdaptedString s, char* p, size_t n) {\n  ARDUINOJSON_ASSERT(s.size() <= n);\n  for (size_t i = 0; i < n; i++) {\n    p[i] = s[i];\n  }\n}\n\nARDUINOJSON_END_PRIVATE_NAMESPACE\n"
  },
  {
    "path": "src/ArduinoJson/Strings/StringTraits.hpp",
    "content": "// ArduinoJson - https://arduinojson.org\n// Copyright © 2014-2025, Benoit BLANCHON\n// MIT License\n\n#pragma once\n\n#include <ArduinoJson/Strings/Adapters/RamString.hpp>\n#include <ArduinoJson/Strings/StringAdapter.hpp>\n\nARDUINOJSON_BEGIN_PRIVATE_NAMESPACE\n\nnamespace string_traits_impl {\n\n// const char* c_str() const\n// - String\n// - std::string\n\ntemplate <class T, class = void>\nstruct has_cstr : false_type {};\n\ntemplate <class T>\nstruct has_cstr<T, enable_if_t<is_same<decltype(declval<const T>().c_str()),\n                                       const char*>::value>> : true_type {};\n\n// const char* data() const\n// - std::string\n// - std::string_view\n// - etl::string\n\ntemplate <class T, class = void>\nstruct has_data : false_type {};\n\ntemplate <class T>\nstruct has_data<T, enable_if_t<is_same<decltype(declval<const T>().data()),\n                                       const char*>::value>> : true_type {};\n\n// unsigned int length() const\n// - String\n\ntemplate <class T, class = void>\nstruct has_length : false_type {};\n\ntemplate <class T>\nstruct has_length<\n    T, enable_if_t<is_unsigned<decltype(declval<const T>().length())>::value>>\n    : true_type {};\n\n// size_t size() const\n// - std::string\n// - std::string_view\n// - etl::string\n\ntemplate <class T, class = void>\nstruct has_size : false_type {};\n\ntemplate <class T>\nstruct has_size<\n    T, enable_if_t<is_same<decltype(declval<const T>().size()), size_t>::value>>\n    : true_type {};\n\n}  // namespace string_traits_impl\n\ntemplate <typename T>\nstruct string_traits {\n  enum {\n    has_cstr = string_traits_impl::has_cstr<T>::value,\n    has_length = string_traits_impl::has_length<T>::value,\n    has_data = string_traits_impl::has_data<T>::value,\n    has_size = string_traits_impl::has_size<T>::value\n  };\n};\n\nARDUINOJSON_END_PRIVATE_NAMESPACE\n"
  },
  {
    "path": "src/ArduinoJson/Variant/Converter.hpp",
    "content": "// ArduinoJson - https://arduinojson.org\n// Copyright © 2014-2025, Benoit BLANCHON\n// MIT License\n\n#pragma once\n\n#include <ArduinoJson/Namespace.hpp>\n\nARDUINOJSON_BEGIN_PUBLIC_NAMESPACE\n\ntemplate <typename T, typename Enable = void>\nstruct Converter;\n\nARDUINOJSON_END_PUBLIC_NAMESPACE\n\nARDUINOJSON_BEGIN_PRIVATE_NAMESPACE\n\n// clang-format off\ntemplate <typename T1, typename T2>\nclass InvalidConversion;  // Error here? See https://arduinojson.org/v7/invalid-conversion/\n// clang-format on\n\nARDUINOJSON_END_PRIVATE_NAMESPACE\n"
  },
  {
    "path": "src/ArduinoJson/Variant/ConverterImpl.hpp",
    "content": "// ArduinoJson - https://arduinojson.org\n// Copyright © 2014-2025, Benoit BLANCHON\n// MIT License\n\n#pragma once\n\n#include <ArduinoJson/Json/JsonSerializer.hpp>\n#include <ArduinoJson/Memory/StringBuilder.hpp>\n#include <ArduinoJson/Polyfills/utility.hpp>\n#include <ArduinoJson/Variant/JsonVariantConst.hpp>\n\n#if ARDUINOJSON_ENABLE_STD_STRING\n#  include <string>\n#endif\n\n#if ARDUINOJSON_ENABLE_STRING_VIEW\n#  include <string_view>\n#endif\n\nARDUINOJSON_BEGIN_PUBLIC_NAMESPACE\n\ntemplate <typename T, typename Enable>\nstruct Converter {\n  static_assert(!detail::is_same<T, char>::value,\n                \"type 'char' is not supported, use 'signed char', 'unsigned \"\n                \"char' or another integer type instead\");\n\n  static auto toJson(const T& src, JsonVariant dst)\n      -> decltype(convertToJson(src, dst)) {\n    // clang-format off\n    return convertToJson(src, dst); // Error here? See https://arduinojson.org/v7/unsupported-set/\n    // clang-format on\n  }\n\n  static detail::decay_t<T> fromJson(JsonVariantConst src) {\n    static_assert(!detail::is_same<T, char*>::value,\n                  \"type 'char*' is not supported, use 'const char*' instead\");\n\n    // clang-format off\n    T result; // Error here? See https://arduinojson.org/v7/non-default-constructible/\n    convertFromJson(src, result);  // Error here? See https://arduinojson.org/v7/unsupported-as/\n    // clang-format on\n    return result;\n  }\n\n  static bool checkJson(JsonVariantConst src) {\n    static_assert(!detail::is_same<T, char*>::value,\n                  \"type 'char*' is not supported, use 'const char*' instead\");\n\n    T dummy = T();\n    // clang-format off\n    return canConvertFromJson(src, dummy);  // Error here? See https://arduinojson.org/v7/unsupported-is/\n    // clang-format on\n  }\n};\n\ntemplate <typename T>\nstruct Converter<T, detail::enable_if_t<detail::is_integral<T>::value &&\n                                        !detail::is_same<bool, T>::value &&\n                                        !detail::is_same<char, T>::value>>\n    : private detail::VariantAttorney {\n  static bool toJson(T src, JsonVariant dst) {\n    ARDUINOJSON_ASSERT_INTEGER_TYPE_IS_SUPPORTED(T);\n    return getVariantImpl(dst).setInteger(src);\n  }\n\n  static T fromJson(JsonVariantConst src) {\n    ARDUINOJSON_ASSERT_INTEGER_TYPE_IS_SUPPORTED(T);\n    return getVariantImpl(src).template asIntegral<T>();\n  }\n\n  static bool checkJson(JsonVariantConst src) {\n    return getVariantImpl(src).template isInteger<T>();\n  }\n};\n\ntemplate <typename T>\nstruct Converter<T, detail::enable_if_t<detail::is_enum<T>::value>>\n    : private detail::VariantAttorney {\n  static bool toJson(T src, JsonVariant dst) {\n    return dst.set(static_cast<JsonInteger>(src));\n  }\n\n  static T fromJson(JsonVariantConst src) {\n    return static_cast<T>(getVariantImpl(src).template asIntegral<int>());\n  }\n\n  static bool checkJson(JsonVariantConst src) {\n    return getVariantImpl(src).template isInteger<int>();\n  }\n};\n\ntemplate <>\nstruct Converter<bool> : private detail::VariantAttorney {\n  static bool toJson(bool src, JsonVariant dst) {\n    return getVariantImpl(dst).setBoolean(src);\n  }\n\n  static bool fromJson(JsonVariantConst src) {\n    return getVariantImpl(src).asBoolean();\n  }\n\n  static bool checkJson(JsonVariantConst src) {\n    auto data = getData(src);\n    return data && data->isBoolean();\n  }\n};\n\ntemplate <typename T>\nstruct Converter<T, detail::enable_if_t<detail::is_floating_point<T>::value>>\n    : private detail::VariantAttorney {\n  static bool toJson(T src, JsonVariant dst) {\n    return getVariantImpl(dst).setFloat(src);\n  }\n\n  static T fromJson(JsonVariantConst src) {\n    return getVariantImpl(src).template asFloat<T>();\n  }\n\n  static bool checkJson(JsonVariantConst src) {\n    auto data = getData(src);\n    return data && data->isFloat();\n  }\n};\n\ntemplate <>\nstruct Converter<const char*> : private detail::VariantAttorney {\n  static bool toJson(const char* src, JsonVariant dst) {\n    return getVariantImpl(dst).setString(detail::adaptString(src));\n  }\n\n  static const char* fromJson(JsonVariantConst src) {\n    auto data = getData(src);\n    return data ? data->asString().c_str() : 0;\n  }\n\n  static bool checkJson(JsonVariantConst src) {\n    auto data = getData(src);\n    return data && data->isString();\n  }\n};\n\ntemplate <>\nstruct Converter<JsonString> : private detail::VariantAttorney {\n  static bool toJson(JsonString src, JsonVariant dst) {\n    return getVariantImpl(dst).setString(detail::adaptString(src));\n  }\n\n  static JsonString fromJson(JsonVariantConst src) {\n    auto data = getData(src);\n    return data ? data->asString() : JsonString();\n  }\n\n  static bool checkJson(JsonVariantConst src) {\n    auto data = getData(src);\n    return data && data->isString();\n  }\n};\n\ntemplate <typename T>\ninline detail::enable_if_t<detail::IsString<T>::value, bool> convertToJson(\n    const T& src, JsonVariant dst) {\n  return detail::VariantAttorney::getVariantImpl(dst).setString(\n      detail::adaptString(src));\n}\n\n// SerializedValue<std::string>\n// SerializedValue<String>\n// SerializedValue<const __FlashStringHelper*>\ntemplate <typename T>\nstruct Converter<SerializedValue<T>> : private detail::VariantAttorney {\n  static bool toJson(SerializedValue<T> src, JsonVariant dst) {\n    return getVariantImpl(dst).setRawString(\n        detail::adaptString(src.data(), src.size()));\n  }\n};\n\ntemplate <>\nstruct Converter<detail::nullptr_t> : private detail::VariantAttorney {\n  static bool toJson(detail::nullptr_t, JsonVariant dst) {\n    return getVariantImpl(dst).clear();\n  }\n  static detail::nullptr_t fromJson(JsonVariantConst) {\n    return nullptr;\n  }\n  static bool checkJson(JsonVariantConst src) {\n    auto data = getData(src);\n    return data == 0 || data->isNull();\n  }\n};\n\n#if ARDUINOJSON_ENABLE_ARDUINO_STREAM\n\nnamespace detail {\nclass StringBuilderPrint : public Print {\n public:\n  StringBuilderPrint(ResourceManager* resources) : copier_(resources) {\n    copier_.startString();\n  }\n\n  void save(VariantData* data) {\n    ARDUINOJSON_ASSERT(!overflowed());\n    copier_.save(data);\n  }\n\n  size_t write(uint8_t c) {\n    copier_.append(char(c));\n    return copier_.isValid() ? 1 : 0;\n  }\n\n  size_t write(const uint8_t* buffer, size_t size) {\n    for (size_t i = 0; i < size; i++) {\n      copier_.append(char(buffer[i]));\n      if (!copier_.isValid())\n        return i;\n    }\n    return size;\n  }\n\n  bool overflowed() const {\n    return !copier_.isValid();\n  }\n\n private:\n  StringBuilder copier_;\n};\n}  // namespace detail\n\ninline bool convertToJson(const ::Printable& src, JsonVariant dst) {\n  auto resources = detail::VariantAttorney::getResourceManager(dst);\n  auto data = detail::VariantAttorney::getData(dst);\n  if (!resources || !data)\n    return false;\n  detail::VariantImpl::clear(data, resources);\n  detail::StringBuilderPrint print(resources);\n  src.printTo(print);\n  if (print.overflowed())\n    return false;\n  print.save(data);\n  return true;\n}\n\n#endif\n\n#if ARDUINOJSON_ENABLE_ARDUINO_STRING\n\ninline void convertFromJson(JsonVariantConst src, ::String& dst) {\n  JsonString str = src.as<JsonString>();\n  if (str)\n    dst = str.c_str();\n  else\n    serializeJson(src, dst);\n}\n\ninline bool canConvertFromJson(JsonVariantConst src, const ::String&) {\n  return src.is<JsonString>();\n}\n\n#endif\n\n#if ARDUINOJSON_ENABLE_STD_STRING\n\ninline void convertFromJson(JsonVariantConst src, std::string& dst) {\n  JsonString str = src.as<JsonString>();\n  if (str)\n    dst.assign(str.c_str(), str.size());\n  else\n    serializeJson(src, dst);\n}\n\ninline bool canConvertFromJson(JsonVariantConst src, const std::string&) {\n  return src.is<JsonString>();\n}\n\n#endif\n\n#if ARDUINOJSON_ENABLE_STRING_VIEW\n\ninline void convertFromJson(JsonVariantConst src, std::string_view& dst) {\n  JsonString str = src.as<JsonString>();\n  if (str)  // the standard doesn't allow passing null to the constructor\n    dst = std::string_view(str.c_str(), str.size());\n}\n\ninline bool canConvertFromJson(JsonVariantConst src, const std::string_view&) {\n  return src.is<JsonString>();\n}\n\n#endif\n\ntemplate <>\nstruct Converter<JsonArrayConst> : private detail::VariantAttorney {\n  static bool toJson(JsonArrayConst src, JsonVariant dst) {\n    if (src.isNull())\n      return dst.set(nullptr);\n    else\n      return dst.to<JsonArray>().set(src);\n  }\n\n  static JsonArrayConst fromJson(JsonVariantConst src) {\n    return JsonArrayConst(getData(src), getResourceManager(src));\n  }\n\n  static bool checkJson(JsonVariantConst src) {\n    auto data = getData(src);\n    return data && data->isArray();\n  }\n};\n\ntemplate <>\nstruct Converter<JsonArray> : private detail::VariantAttorney {\n  static bool toJson(JsonVariantConst src, JsonVariant dst) {\n    if (src.isNull())\n      return dst.set(nullptr);\n    else\n      return dst.to<JsonArray>().set(src);\n  }\n\n  static JsonArray fromJson(JsonVariant src) {\n    return JsonArray(getData(src), getResourceManager(src));\n  }\n\n  static bool checkJson(JsonVariant src) {\n    auto data = getData(src);\n    return data && data->isArray();\n  }\n};\n\ntemplate <>\nstruct Converter<JsonObjectConst> : private detail::VariantAttorney {\n  static bool toJson(JsonVariantConst src, JsonVariant dst) {\n    if (src.isNull())\n      return dst.set(nullptr);\n    else\n      return dst.to<JsonObject>().set(src);\n  }\n\n  static JsonObjectConst fromJson(JsonVariantConst src) {\n    return JsonObjectConst(getData(src), getResourceManager(src));\n  }\n\n  static bool checkJson(JsonVariantConst src) {\n    auto data = getData(src);\n    return data && data->isObject();\n  }\n};\n\ntemplate <>\nstruct Converter<JsonObject> : private detail::VariantAttorney {\n  static bool toJson(JsonVariantConst src, JsonVariant dst) {\n    if (src.isNull())\n      return dst.set(nullptr);\n    else\n      return dst.to<JsonObject>().set(src);\n  }\n\n  static JsonObject fromJson(JsonVariant src) {\n    return JsonObject(getData(src), getResourceManager(src));\n  }\n\n  static bool checkJson(JsonVariant src) {\n    auto data = getData(src);\n    return data && data->isObject();\n  }\n};\n\nARDUINOJSON_END_PUBLIC_NAMESPACE\n"
  },
  {
    "path": "src/ArduinoJson/Variant/JsonVariant.hpp",
    "content": "// ArduinoJson - https://arduinojson.org\n// Copyright © 2014-2025, Benoit BLANCHON\n// MIT License\n\n#pragma once\n\n#include <ArduinoJson/Variant/VariantRefBase.hpp>\n\nARDUINOJSON_BEGIN_PUBLIC_NAMESPACE\n\n// A reference to a value in a JsonDocument.\n// https://arduinojson.org/v7/api/jsonvariant/\nclass JsonVariant : public detail::VariantRefBase<JsonVariant>,\n                    public detail::VariantOperators<JsonVariant> {\n  friend class detail::VariantAttorney;\n\n public:\n  // Creates an unbound reference.\n  JsonVariant() {}\n\n  // INTERNAL USE ONLY\n  JsonVariant(detail::VariantData* data, detail::ResourceManager* resources)\n      : impl_(data, resources) {}\n\n  // INTERNAL USE ONLY\n  JsonVariant(detail::VariantImpl impl) : impl_(impl) {}\n\n private:\n  detail::ResourceManager* getResourceManager() const {\n    return impl_.resources();\n  }\n\n  detail::VariantData* getData() const {\n    return impl_.data();\n  }\n\n  detail::VariantData* getOrCreateData() const {\n    return impl_.data();\n  }\n\n  mutable detail::VariantImpl impl_;\n};\n\nnamespace detail {\nbool copyVariant(JsonVariant dst, JsonVariantConst src);\n}\n\ntemplate <>\nstruct Converter<JsonVariant> : private detail::VariantAttorney {\n  static bool toJson(JsonVariantConst src, JsonVariant dst) {\n    return copyVariant(dst, src);\n  }\n\n  static JsonVariant fromJson(JsonVariant src) {\n    return src;\n  }\n\n  static bool checkJson(JsonVariant src) {\n    auto data = getData(src);\n    return !!data;\n  }\n};\n\ntemplate <>\nstruct Converter<JsonVariantConst> : private detail::VariantAttorney {\n  static bool toJson(JsonVariantConst src, JsonVariant dst) {\n    return copyVariant(dst, src);\n  }\n\n  static JsonVariantConst fromJson(JsonVariantConst src) {\n    return JsonVariantConst(getData(src), getResourceManager(src));\n  }\n\n  static bool checkJson(JsonVariantConst src) {\n    auto data = getData(src);\n    return !!data;\n  }\n};\n\nARDUINOJSON_END_PUBLIC_NAMESPACE\n"
  },
  {
    "path": "src/ArduinoJson/Variant/JsonVariantConst.hpp",
    "content": "// ArduinoJson - https://arduinojson.org\n// Copyright © 2014-2025, Benoit BLANCHON\n// MIT License\n\n#pragma once\n\n#include <stddef.h>\n#include <stdint.h>  // for uint8_t\n\n#include <ArduinoJson/Memory/ResourceManager.hpp>\n#include <ArduinoJson/Polyfills/type_traits.hpp>\n#include <ArduinoJson/Strings/IsString.hpp>\n#include <ArduinoJson/Strings/StringAdapters.hpp>\n#include <ArduinoJson/Variant/VariantAttorney.hpp>\n#include <ArduinoJson/Variant/VariantOperators.hpp>\n#include <ArduinoJson/Variant/VariantTag.hpp>\n\nARDUINOJSON_BEGIN_PUBLIC_NAMESPACE\n\n// Forward declarations.\nclass JsonArray;\nclass JsonObject;\n\n// A read-only reference to a value in a JsonDocument\n// https://arduinojson.org/v7/api/jsonarrayconst/\nclass JsonVariantConst : public detail::VariantTag,\n                         public detail::VariantOperators<JsonVariantConst> {\n  friend class detail::VariantAttorney;\n\n  template <typename T>\n  using ConversionSupported =\n      detail::is_same<typename detail::function_traits<\n                          decltype(&Converter<T>::fromJson)>::arg1_type,\n                      JsonVariantConst>;\n\n public:\n  // Creates an unbound reference.\n  JsonVariantConst() {}\n\n  // INTERNAL USE ONLY\n  explicit JsonVariantConst(detail::VariantData* data,\n                            detail::ResourceManager* resources)\n      : impl_(data, resources) {}\n\n  // Returns true if the value is null or the reference is unbound.\n  // https://arduinojson.org/v7/api/jsonvariantconst/isnull/\n  bool isNull() const {\n    return impl_.isNull();\n  }\n\n  // Returns true if the reference is unbound.\n  bool isUnbound() const {\n    return impl_.data() == nullptr;\n  }\n\n  // Returns the depth (nesting level) of the value.\n  // https://arduinojson.org/v7/api/jsonvariantconst/nesting/\n  size_t nesting() const {\n    return impl_.nesting();\n  }\n\n  // Returns the size of the array or object.\n  // https://arduinojson.org/v7/api/jsonvariantconst/size/\n  size_t size() const {\n    return impl_.size();\n  }\n\n  // Casts the value to the specified type.\n  // https://arduinojson.org/v7/api/jsonvariantconst/as/\n  template <typename T,\n            detail::enable_if_t<ConversionSupported<T>::value, int> = 0>\n  T as() const {\n    return Converter<T>::fromJson(*this);\n  }\n\n  // Invalid conversion. Will not compile.\n  template <typename T,\n            detail::enable_if_t<!ConversionSupported<T>::value, int> = 0>\n  detail::InvalidConversion<JsonVariantConst, T> as() const;\n\n  // Returns true if the value is of the specified type.\n  // https://arduinojson.org/v7/api/jsonvariantconst/is/\n  template <typename T,\n            detail::enable_if_t<ConversionSupported<T>::value, int> = 0>\n  bool is() const {\n    return Converter<T>::checkJson(*this);\n  }\n\n  // Always returns false for the unsupported types.\n  // https://arduinojson.org/v7/api/jsonvariantconst/is/\n  template <typename T,\n            detail::enable_if_t<!ConversionSupported<T>::value, int> = 0>\n  bool is() const {\n    return false;\n  }\n\n  template <typename T>\n  operator T() const {\n    return as<T>();\n  }\n\n  // Gets array's element at specified index.\n  // https://arduinojson.org/v7/api/jsonvariantconst/subscript/\n  template <typename T,\n            detail::enable_if_t<detail::is_integral<T>::value, int> = 0>\n  JsonVariantConst operator[](T index) const {\n    return JsonVariantConst(impl_.getElement(size_t(index)), impl_.resources());\n  }\n\n  // Gets object's member with specified key.\n  // https://arduinojson.org/v7/api/jsonvariantconst/subscript/\n  template <typename TString,\n            detail::enable_if_t<detail::IsString<TString>::value, int> = 0>\n  JsonVariantConst operator[](const TString& key) const {\n    return JsonVariantConst(impl_.getMember(detail::adaptString(key)),\n                            impl_.resources());\n  }\n\n  // Gets object's member with specified key.\n  // https://arduinojson.org/v7/api/jsonvariantconst/subscript/\n  template <typename TChar,\n            detail::enable_if_t<detail::IsString<TChar*>::value, int> = 0>\n  JsonVariantConst operator[](TChar* key) const {\n    return JsonVariantConst(impl_.getMember(detail::adaptString(key)),\n                            impl_.resources());\n  }\n\n  // Gets object's member with specified key or the array's element at the\n  // specified index.\n  // https://arduinojson.org/v7/api/jsonvariantconst/subscript/\n  template <typename TVariant,\n            detail::enable_if_t<detail::IsVariant<TVariant>::value, int> = 0>\n  JsonVariantConst operator[](const TVariant& key) const {\n    if (key.template is<size_t>())\n      return operator[](key.template as<size_t>());\n    else\n      return operator[](key.template as<JsonString>());\n  }\n\n  // DEPRECATED: use obj[key].is<T>() instead\n  // https://arduinojson.org/v7/api/jsonvariantconst/containskey/\n  template <typename TString,\n            detail::enable_if_t<detail::IsString<TString>::value, int> = 0>\n  ARDUINOJSON_DEPRECATED(\"use var[key].is<T>() instead\")\n  bool containsKey(const TString& key) const {\n    return impl_.getMember(detail::adaptString(key)) != 0;\n  }\n\n  // DEPRECATED: use obj[\"key\"].is<T>() instead\n  // https://arduinojson.org/v7/api/jsonvariantconst/containskey/\n  template <typename TChar,\n            detail::enable_if_t<detail::IsString<TChar*>::value, int> = 0>\n  ARDUINOJSON_DEPRECATED(\"use obj[\\\"key\\\"].is<T>() instead\")\n  bool containsKey(TChar* key) const {\n    return impl_.getMember(detail::adaptString(key)) != 0;\n  }\n\n  // DEPRECATED: use obj[key].is<T>() instead\n  // https://arduinojson.org/v7/api/jsonvariantconst/containskey/\n  template <typename TVariant,\n            detail::enable_if_t<detail::IsVariant<TVariant>::value, int> = 0>\n  ARDUINOJSON_DEPRECATED(\"use var[key].is<T>() instead\")\n  bool containsKey(const TVariant& key) const {\n    return containsKey(key.template as<const char*>());\n  }\n\n  // DEPRECATED: always returns zero\n  ARDUINOJSON_DEPRECATED(\"always returns zero\")\n  size_t memoryUsage() const {\n    return 0;\n  }\n\n protected:\n  detail::VariantData* getData() const {\n    return impl_.data();\n  }\n\n  detail::ResourceManager* getResourceManager() const {\n    return impl_.resources();\n  }\n\n private:\n  mutable detail::VariantImpl impl_;\n};\n\nARDUINOJSON_END_PUBLIC_NAMESPACE\n"
  },
  {
    "path": "src/ArduinoJson/Variant/JsonVariantCopier.hpp",
    "content": "// ArduinoJson - https://arduinojson.org\n// Copyright © 2014-2025, Benoit BLANCHON\n// MIT License\n\n#pragma once\n\n#include <ArduinoJson/Variant/JsonVariant.hpp>\n#include <ArduinoJson/Variant/JsonVariantVisitor.hpp>\n\nARDUINOJSON_BEGIN_PRIVATE_NAMESPACE\n\nclass JsonVariantCopier {\n public:\n  using result_type = bool;\n\n  JsonVariantCopier(JsonVariant dst) : dst_(dst) {}\n\n  template <typename T>\n  bool visit(T src) {\n    return dst_.set(src);\n  }\n\n private:\n  JsonVariant dst_;\n};\n\ninline bool copyVariant(JsonVariant dst, JsonVariantConst src) {\n  if (dst.isUnbound())\n    return false;\n  JsonVariantCopier copier(dst);\n  return accept(src, copier);\n}\n\nARDUINOJSON_END_PRIVATE_NAMESPACE\n"
  },
  {
    "path": "src/ArduinoJson/Variant/JsonVariantVisitor.hpp",
    "content": "// ArduinoJson - https://arduinojson.org\n// Copyright © 2014-2025, Benoit BLANCHON\n// MIT License\n\n#pragma once\n\n#include <ArduinoJson/Array/JsonArray.hpp>\n#include <ArduinoJson/Object/JsonObject.hpp>\n#include <ArduinoJson/Variant/JsonVariant.hpp>\n#include <ArduinoJson/Variant/VariantDataVisitor.hpp>\n\nARDUINOJSON_BEGIN_PRIVATE_NAMESPACE\n\ntemplate <typename TResult>\nstruct JsonVariantVisitor {\n  using result_type = TResult;\n\n  template <typename T>\n  TResult visit(const T&) {\n    return TResult();\n  }\n};\n\ntemplate <typename TVisitor>\nclass VisitorAdapter {\n public:\n  using result_type = typename TVisitor::result_type;\n\n  VisitorAdapter(TVisitor& visitor, ResourceManager* resources)\n      : visitor_(&visitor), resources_(resources) {}\n\n  result_type visitArray(VariantData* data) {\n    return visitor_->visit(JsonArrayConst(data, resources_));\n  }\n\n  result_type visitObject(VariantData* data) {\n    return visitor_->visit(JsonObjectConst(data, resources_));\n  }\n\n  template <typename T>\n  result_type visit(const T& value) {\n    return visitor_->visit(value);\n  }\n\n private:\n  TVisitor* visitor_;\n  ResourceManager* resources_;\n};\n\ntemplate <typename TVisitor>\ntypename TVisitor::result_type accept(JsonVariantConst variant,\n                                      TVisitor& visit) {\n  VisitorAdapter<TVisitor> adapter(\n      visit, VariantAttorney::getResourceManager(variant));\n  return VariantAttorney::getVariantImpl(variant).accept(adapter);\n}\n\nARDUINOJSON_END_PRIVATE_NAMESPACE\n"
  },
  {
    "path": "src/ArduinoJson/Variant/VariantAttorney.hpp",
    "content": "// ArduinoJson - https://arduinojson.org\n// Copyright © 2014-2025, Benoit BLANCHON\n// MIT License\n\n#pragma once\n\n#include <ArduinoJson/Polyfills/attributes.hpp>\n#include <ArduinoJson/Polyfills/type_traits.hpp>\n#include <ArduinoJson/Variant/VariantImpl.hpp>\n#include \"JsonVariantConst.hpp\"\n\nARDUINOJSON_BEGIN_PRIVATE_NAMESPACE\n\n// Grants access to the internal variant API\nclass VariantAttorney {\n public:\n  template <typename TClient>\n  static auto getResourceManager(TClient& client)\n      -> decltype(client.getResourceManager()) {\n    return client.getResourceManager();\n  }\n\n  template <typename TClient>\n  static auto getData(TClient& client) -> decltype(client.getData()) {\n    return client.getData();\n  }\n\n  template <typename TClient>\n  static VariantImpl getVariantImpl(TClient& client) {\n    return VariantImpl(client.getData(), client.getResourceManager());\n  }\n\n  template <typename TClient>\n  static VariantImpl getOrCreateVariantImpl(TClient& client) {\n    return VariantImpl(client.getOrCreateData(), client.getResourceManager());\n  }\n\n  template <typename TClient>\n  static VariantData* getOrCreateData(TClient& client) {\n    return client.getOrCreateData();\n  }\n};\n\nARDUINOJSON_END_PRIVATE_NAMESPACE\n"
  },
  {
    "path": "src/ArduinoJson/Variant/VariantCompare.hpp",
    "content": "// ArduinoJson - https://arduinojson.org\n// Copyright © 2014-2025, Benoit BLANCHON\n// MIT License\n\n#pragma once\n\n#include <ArduinoJson/Configuration.hpp>\n#include <ArduinoJson/Numbers/arithmeticCompare.hpp>\n#include <ArduinoJson/Polyfills/type_traits.hpp>\n#include <ArduinoJson/Polyfills/utility.hpp>\n#include <ArduinoJson/Strings/StringAdapters.hpp>\n#include <ArduinoJson/Variant/JsonVariantVisitor.hpp>\n\nARDUINOJSON_BEGIN_PRIVATE_NAMESPACE\n\nstruct ComparerBase : JsonVariantVisitor<CompareResult> {};\n\ntemplate <typename T, typename Enable = void>\nstruct Comparer;\n\ntemplate <typename T>\nstruct Comparer<T, enable_if_t<IsString<T>::value>> : ComparerBase {\n  T rhs;  // TODO: store adapted string?\n\n  explicit Comparer(T value) : rhs(value) {}\n\n  CompareResult visit(JsonString lhs) {\n    int i = stringCompare(adaptString(rhs), adaptString(lhs));\n    if (i < 0)\n      return COMPARE_RESULT_GREATER;\n    else if (i > 0)\n      return COMPARE_RESULT_LESS;\n    else\n      return COMPARE_RESULT_EQUAL;\n  }\n\n  CompareResult visit(nullptr_t) {\n    if (adaptString(rhs).isNull())\n      return COMPARE_RESULT_EQUAL;\n    else\n      return COMPARE_RESULT_DIFFER;\n  }\n\n  using ComparerBase::visit;\n};\n\ntemplate <typename T>\nstruct Comparer<\n    T, enable_if_t<is_integral<T>::value || is_floating_point<T>::value>>\n    : ComparerBase {\n  T rhs;\n\n  explicit Comparer(T value) : rhs(value) {}\n\n  template <typename U>\n  enable_if_t<is_floating_point<U>::value || is_integral<U>::value,\n              CompareResult>\n  visit(const U& lhs) {\n    return arithmeticCompare(lhs, rhs);\n  }\n\n  template <typename U>\n  enable_if_t<!is_floating_point<U>::value && !is_integral<U>::value,\n              CompareResult>\n  visit(const U& lhs) {\n    return ComparerBase::visit(lhs);\n  }\n};\n\nstruct NullComparer : ComparerBase {\n  CompareResult visit(nullptr_t) {\n    return COMPARE_RESULT_EQUAL;\n  }\n\n  using ComparerBase::visit;\n};\n\ntemplate <>\nstruct Comparer<nullptr_t, void> : NullComparer {\n  explicit Comparer(nullptr_t) : NullComparer() {}\n};\n\nstruct ArrayComparer : ComparerBase {\n  JsonArrayConst rhs_;\n\n  explicit ArrayComparer(JsonArrayConst rhs) : rhs_(rhs) {}\n\n  CompareResult visit(JsonArrayConst lhs) {\n    if (rhs_ == lhs)\n      return COMPARE_RESULT_EQUAL;\n    else\n      return COMPARE_RESULT_DIFFER;\n  }\n\n  using ComparerBase::visit;\n};\n\nstruct ObjectComparer : ComparerBase {\n  JsonObjectConst rhs_;\n\n  explicit ObjectComparer(JsonObjectConst rhs) : rhs_(rhs) {}\n\n  CompareResult visit(JsonObjectConst lhs) {\n    if (lhs == rhs_)\n      return COMPARE_RESULT_EQUAL;\n    else\n      return COMPARE_RESULT_DIFFER;\n  }\n\n  using ComparerBase::visit;\n};\n\nstruct RawComparer : ComparerBase {\n  RawString rhs_;\n\n  explicit RawComparer(RawString rhs) : rhs_(rhs) {}\n\n  CompareResult visit(RawString lhs) {\n    size_t size = rhs_.size() < lhs.size() ? rhs_.size() : lhs.size();\n    int n = memcmp(lhs.data(), rhs_.data(), size);\n    if (n < 0)\n      return COMPARE_RESULT_LESS;\n    else if (n > 0)\n      return COMPARE_RESULT_GREATER;\n    else\n      return COMPARE_RESULT_EQUAL;\n  }\n\n  using ComparerBase::visit;\n};\n\nstruct VariantComparer : ComparerBase {\n  JsonVariantConst rhs;\n\n  explicit VariantComparer(JsonVariantConst value) : rhs(value) {}\n\n  CompareResult visit(JsonArrayConst lhs) {\n    ArrayComparer comparer(lhs);\n    return reverseResult(comparer);\n  }\n\n  CompareResult visit(JsonObjectConst lhs) {\n    ObjectComparer comparer(lhs);\n    return reverseResult(comparer);\n  }\n\n  CompareResult visit(JsonFloat lhs) {\n    Comparer<JsonFloat> comparer(lhs);\n    return reverseResult(comparer);\n  }\n\n  CompareResult visit(JsonString lhs) {\n    Comparer<JsonString> comparer(lhs);\n    return reverseResult(comparer);\n  }\n\n  CompareResult visit(RawString value) {\n    RawComparer comparer(value);\n    return reverseResult(comparer);\n  }\n\n  CompareResult visit(JsonInteger lhs) {\n    Comparer<JsonInteger> comparer(lhs);\n    return reverseResult(comparer);\n  }\n\n  CompareResult visit(JsonUInt lhs) {\n    Comparer<JsonUInt> comparer(lhs);\n    return reverseResult(comparer);\n  }\n\n  CompareResult visit(bool lhs) {\n    Comparer<bool> comparer(lhs);\n    return reverseResult(comparer);\n  }\n\n  CompareResult visit(nullptr_t) {\n    NullComparer comparer;\n    return reverseResult(comparer);\n  }\n\n private:\n  template <typename TComparer>\n  CompareResult reverseResult(TComparer& comparer) {\n    CompareResult reversedResult = accept(rhs, comparer);\n    switch (reversedResult) {\n      case COMPARE_RESULT_GREATER:\n        return COMPARE_RESULT_LESS;\n      case COMPARE_RESULT_LESS:\n        return COMPARE_RESULT_GREATER;\n      default:\n        return reversedResult;\n    }\n  }\n};\n\ntemplate <typename T>\nstruct Comparer<\n    T, enable_if_t<is_convertible<T, ArduinoJson::JsonVariantConst>::value>>\n    : VariantComparer {\n  explicit Comparer(const T& value)\n      : VariantComparer(static_cast<JsonVariantConst>(value)) {}\n};\n\ntemplate <typename T>\nCompareResult compare(ArduinoJson::JsonVariantConst lhs, const T& rhs) {\n  Comparer<T> comparer(rhs);\n  return accept(lhs, comparer);\n}\n\nARDUINOJSON_END_PRIVATE_NAMESPACE\n"
  },
  {
    "path": "src/ArduinoJson/Variant/VariantContent.hpp",
    "content": "// ArduinoJson - https://arduinojson.org\n// Copyright © 2014-2025, Benoit BLANCHON\n// MIT License\n\n#pragma once\n\n#include <stddef.h>  // size_t\n\n#include <ArduinoJson/Numbers/JsonFloat.hpp>\n#include <ArduinoJson/Numbers/JsonInteger.hpp>\n\nARDUINOJSON_BEGIN_PRIVATE_NAMESPACE\n\nenum class VariantTypeBits : uint8_t {\n  OwnedStringBit = 0x01,  // 0000 0001\n  NumberBit = 0x08,       // 0000 1000\n#if ARDUINOJSON_USE_8_BYTE_POOL\n  EightByteBit = 0x10,  // 0001 0000\n#endif\n  CollectionMask = 0x60,\n};\n\nenum class VariantType : uint8_t {\n  Null = 0,           // 0000 0000\n  TinyString = 0x02,  // 0000 0010\n  RawString = 0x03,   // 0000 0011\n  LongString = 0x05,  // 0000 0101\n  Boolean = 0x06,     // 0000 0110\n  Uint32 = 0x0A,      // 0000 1010\n  Int32 = 0x0C,       // 0000 1100\n  Float = 0x0E,       // 0000 1110\n#if ARDUINOJSON_USE_LONG_LONG\n  Uint64 = 0x1A,  // 0001 1010\n  Int64 = 0x1C,   // 0001 1100\n#endif\n#if ARDUINOJSON_USE_DOUBLE\n  Double = 0x1E,  // 0001 1110\n#endif\n  Object = 0x20,\n  Array = 0x40,\n};\n\ninline bool operator&(VariantType type, VariantTypeBits bit) {\n  return (uint8_t(type) & uint8_t(bit)) != 0;\n}\n\nstruct CollectionData {\n  SlotId head = NULL_SLOT;\n  SlotId tail = NULL_SLOT;\n\n  // Placement new\n  static void* operator new(size_t, void* p) noexcept {\n    return p;\n  }\n\n  static void operator delete(void*, void*) noexcept {}\n};\n\nconst size_t tinyStringMaxLength = 3;\n\nunion VariantContent {\n  VariantContent() {}\n\n  float asFloat;\n  bool asBoolean;\n  uint32_t asUint32;\n  int32_t asInt32;\n#if ARDUINOJSON_USE_8_BYTE_POOL\n  SlotId asSlotId;\n#endif\n  CollectionData asCollection;\n  struct StringNode* asStringNode;\n  char asTinyString[tinyStringMaxLength + 1];\n};\n\n#if ARDUINOJSON_USE_8_BYTE_POOL\nunion EightByteValue {\n#  if ARDUINOJSON_USE_LONG_LONG\n  uint64_t asUint64;\n  int64_t asInt64;\n#  endif\n#  if ARDUINOJSON_USE_DOUBLE\n  double asDouble;\n#  endif\n};\n\nstatic_assert(sizeof(EightByteValue) == 8,\n              \"sizeof(EightByteValue) must be 8 bytes\");\n#endif\n\nARDUINOJSON_END_PRIVATE_NAMESPACE\n"
  },
  {
    "path": "src/ArduinoJson/Variant/VariantData.hpp",
    "content": "// ArduinoJson - https://arduinojson.org\n// Copyright © 2014-2025, Benoit BLANCHON\n// MIT License\n\n#pragma once\n\n#include <ArduinoJson/Memory/StringNode.hpp>\n#include <ArduinoJson/Strings/JsonString.hpp>\n#include <ArduinoJson/Variant/VariantContent.hpp>\n\nARDUINOJSON_BEGIN_PRIVATE_NAMESPACE\n\ntemplate <typename T>\nT parseNumber(const char* s);\n\ntemplate <typename T>\nstatic bool isTinyString(const T& s, size_t n) {\n  if (n > tinyStringMaxLength)\n    return false;\n  bool containsNul = false;\n  for (uint8_t i = 0; i < uint8_t(n); i++)\n    containsNul |= !s[i];\n  return !containsNul;\n}\n\nstruct VariantData {\n  VariantContent content;  // must be first to allow cast from array to variant\n  VariantType type = VariantType::Null;\n  SlotId next = NULL_SLOT;\n\n  // Placement new\n  static void* operator new(size_t, void* p) noexcept {\n    return p;\n  }\n\n  static void operator delete(void*, void*) noexcept {}\n\n  JsonString asRawString() const {\n    switch (type) {\n      case VariantType::RawString:\n        return JsonString(content.asStringNode->data,\n                          content.asStringNode->length);\n      default:\n        return JsonString();\n    }\n  }\n\n  JsonString asString() const {\n    switch (type) {\n      case VariantType::TinyString:\n        return JsonString(content.asTinyString);\n      case VariantType::LongString:\n        return JsonString(content.asStringNode->data,\n                          content.asStringNode->length);\n      default:\n        return JsonString();\n    }\n  }\n\n  bool isArray() const {\n    return type == VariantType::Array;\n  }\n\n  bool isBoolean() const {\n    return type == VariantType::Boolean;\n  }\n\n  bool isCollection() const {\n    return type & VariantTypeBits::CollectionMask;\n  }\n\n  bool isFloat() const {\n    return type & VariantTypeBits::NumberBit;\n  }\n\n  bool isNull() const {\n    return type == VariantType::Null;\n  }\n\n  bool isObject() const {\n    return type == VariantType::Object;\n  }\n\n  bool isString() const {\n    return type == VariantType::LongString || type == VariantType::TinyString;\n  }\n\n  void setBoolean(bool value) {\n    ARDUINOJSON_ASSERT(type == VariantType::Null);\n    type = VariantType::Boolean;\n    content.asBoolean = value;\n  }\n\n  void setRawString(StringNode* s) {\n    ARDUINOJSON_ASSERT(type == VariantType::Null);\n    ARDUINOJSON_ASSERT(s);\n    type = VariantType::RawString;\n    content.asStringNode = s;\n  }\n\n  template <typename TAdaptedString>\n  void setTinyString(const TAdaptedString& s) {\n    ARDUINOJSON_ASSERT(type == VariantType::Null);\n    ARDUINOJSON_ASSERT(s.size() <= tinyStringMaxLength);\n\n    type = VariantType::TinyString;\n\n    auto n = uint8_t(s.size());\n    for (uint8_t i = 0; i < n; i++) {\n      char c = s[i];\n      ARDUINOJSON_ASSERT(c != 0);  // no NUL in tiny string\n      content.asTinyString[i] = c;\n    }\n\n    content.asTinyString[n] = 0;\n  }\n\n  void setLongString(StringNode* s) {\n    ARDUINOJSON_ASSERT(type == VariantType::Null);\n    ARDUINOJSON_ASSERT(s);\n    type = VariantType::LongString;\n    content.asStringNode = s;\n  }\n\n  CollectionData* toArray() {\n    ARDUINOJSON_ASSERT(type == VariantType::Null);\n    type = VariantType::Array;\n    return new (&content.asCollection) CollectionData();\n  }\n\n  CollectionData* toObject() {\n    ARDUINOJSON_ASSERT(type == VariantType::Null);\n    type = VariantType::Object;\n    return new (&content.asCollection) CollectionData();\n  }\n};\n\nARDUINOJSON_END_PRIVATE_NAMESPACE\n"
  },
  {
    "path": "src/ArduinoJson/Variant/VariantDataVisitor.hpp",
    "content": "// ArduinoJson - https://arduinojson.org\n// Copyright © 2014-2025, Benoit BLANCHON\n// MIT License\n\n#pragma once\n\n#include <ArduinoJson/Numbers/JsonFloat.hpp>\n#include <ArduinoJson/Numbers/JsonInteger.hpp>\n\nARDUINOJSON_BEGIN_PRIVATE_NAMESPACE\n\ntemplate <typename TResult>\nstruct VariantDataVisitor {\n  using result_type = TResult;\n\n  template <typename T>\n  TResult visit(const T&) {\n    return TResult();\n  }\n\n  TResult visitArray(VariantData*) {\n    return TResult();\n  }\n\n  TResult visitObject(VariantData*) {\n    return TResult();\n  }\n};\n\nARDUINOJSON_END_PRIVATE_NAMESPACE\n"
  },
  {
    "path": "src/ArduinoJson/Variant/VariantImpl.hpp",
    "content": "// ArduinoJson - https://arduinojson.org\n// Copyright © 2014-2025, Benoit BLANCHON\n// MIT License\n\n#pragma once\n\n#include <ArduinoJson/Collection/CollectionIterator.hpp>\n#include <ArduinoJson/Memory/ResourceManager.hpp>\n#include <ArduinoJson/Misc/SerializedValue.hpp>\n#include <ArduinoJson/Numbers/convertNumber.hpp>\n#include <ArduinoJson/Strings/JsonString.hpp>\n#include <ArduinoJson/Strings/StringAdapters.hpp>\n#include <ArduinoJson/Variant/VariantData.hpp>\n\nARDUINOJSON_BEGIN_PRIVATE_NAMESPACE\n\n// HACK: large functions are implemented in static function to give opportunity\n// to the compiler to optimize the `this` pointer away.\nclass VariantImpl {\n public:\n  using iterator = CollectionIterator;\n\n  VariantImpl() : data_(nullptr), resources_(nullptr) {}\n\n  VariantImpl(VariantData* data, ResourceManager* resources)\n      : data_(data), resources_(resources) {}\n\n  VariantData* data() const {\n    return data_;\n  }\n\n  ResourceManager* resources() const {\n    return resources_;\n  }\n\n  template <typename TVisitor>\n  typename TVisitor::result_type accept(TVisitor& visit) {\n    return accept(visit, data_, resources_);\n  }\n\n  template <typename TVisitor>\n  static typename TVisitor::result_type accept(TVisitor& visit,\n                                               VariantData* data,\n                                               ResourceManager* resources) {\n    if (!data)\n      return visit.visit(nullptr);\n\n#if ARDUINOJSON_USE_8_BYTE_POOL\n    auto eightByteValue = getEightByte(data, resources);\n#endif\n    switch (data->type) {\n      case VariantType::Float:\n        return visit.visit(data->content.asFloat);\n\n#if ARDUINOJSON_USE_DOUBLE\n      case VariantType::Double:\n        return visit.visit(eightByteValue->asDouble);\n#endif\n\n      case VariantType::Array:\n        return visit.visitArray(data);\n\n      case VariantType::Object:\n        return visit.visitObject(data);\n\n      case VariantType::TinyString:\n        return visit.visit(JsonString(data->content.asTinyString));\n\n      case VariantType::LongString:\n        return visit.visit(JsonString(data->content.asStringNode->data,\n                                      data->content.asStringNode->length));\n\n      case VariantType::RawString:\n        return visit.visit(RawString(data->content.asStringNode->data,\n                                     data->content.asStringNode->length));\n\n      case VariantType::Int32:\n        return visit.visit(static_cast<JsonInteger>(data->content.asInt32));\n\n      case VariantType::Uint32:\n        return visit.visit(static_cast<JsonUInt>(data->content.asUint32));\n\n#if ARDUINOJSON_USE_LONG_LONG\n      case VariantType::Int64:\n        return visit.visit(eightByteValue->asInt64);\n\n      case VariantType::Uint64:\n        return visit.visit(eightByteValue->asUint64);\n#endif\n\n      case VariantType::Boolean:\n        return visit.visit(data->content.asBoolean != 0);\n\n      default:\n        return visit.visit(nullptr);\n    }\n  }\n\n  VariantData* addNewElement() {\n    if (!isArray())\n      return nullptr;\n    return addNewElement(data_, resources_);\n  }\n\n  static VariantData* addNewElement(VariantData*, ResourceManager*);\n\n  static void addElement(Slot<VariantData> slot, VariantData*,\n                         ResourceManager*);\n\n  template <typename TAdaptedString>\n  VariantData* addMember(TAdaptedString key) {\n    if (!isObject())\n      return nullptr;\n    return addMember(key, data_, resources_);\n  }\n\n  template <typename TAdaptedString>\n  static VariantData* addMember(TAdaptedString key, VariantData*,\n                                ResourceManager*);\n\n  VariantData* addPair(VariantData** value) {\n    if (isNull())\n      return nullptr;\n    return addPair(value, data_, resources_);\n  }\n\n  static VariantData* addPair(VariantData** value, VariantData*,\n                              ResourceManager*);\n\n  bool asBoolean() const {\n    return asBoolean(data_, resources_);\n  }\n\n  static bool asBoolean(VariantData* data, ResourceManager* resources) {\n    if (!data)\n      return false;\n\n#if ARDUINOJSON_USE_8_BYTE_POOL\n    auto eightByteValue = getEightByte(data, resources);\n#endif\n    switch (data->type) {\n      case VariantType::Boolean:\n        return data->content.asBoolean;\n      case VariantType::Uint32:\n      case VariantType::Int32:\n        return data->content.asUint32 != 0;\n      case VariantType::Float:\n        return data->content.asFloat != 0;\n#if ARDUINOJSON_USE_DOUBLE\n      case VariantType::Double:\n        return eightByteValue->asDouble != 0;\n#endif\n      case VariantType::Null:\n        return false;\n#if ARDUINOJSON_USE_LONG_LONG\n      case VariantType::Uint64:\n      case VariantType::Int64:\n        return eightByteValue->asUint64 != 0;\n#endif\n      default:\n        return true;\n    }\n  }\n\n  template <typename T>\n  T asFloat() const {\n    return asFloat<T>(data_, resources_);\n  }\n\n  template <typename T>\n  static T asFloat(VariantData* data, ResourceManager* resources) {\n    if (!data)\n      return 0.0;\n\n    static_assert(is_floating_point<T>::value, \"T must be a floating point\");\n#if ARDUINOJSON_USE_8_BYTE_POOL\n    auto eightByteValue = getEightByte(data, resources);\n#endif\n    const char* str = nullptr;\n    switch (data->type) {\n      case VariantType::Boolean:\n        return static_cast<T>(data->content.asBoolean);\n      case VariantType::Uint32:\n        return static_cast<T>(data->content.asUint32);\n      case VariantType::Int32:\n        return static_cast<T>(data->content.asInt32);\n#if ARDUINOJSON_USE_LONG_LONG\n      case VariantType::Uint64:\n        return static_cast<T>(eightByteValue->asUint64);\n      case VariantType::Int64:\n        return static_cast<T>(eightByteValue->asInt64);\n#endif\n      case VariantType::TinyString:\n        str = data->content.asTinyString;\n        break;\n      case VariantType::LongString:\n        str = data->content.asStringNode->data;\n        break;\n      case VariantType::Float:\n        return static_cast<T>(data->content.asFloat);\n#if ARDUINOJSON_USE_DOUBLE\n      case VariantType::Double:\n        return static_cast<T>(eightByteValue->asDouble);\n#endif\n      default:\n        return 0.0;\n    }\n\n    ARDUINOJSON_ASSERT(str != nullptr);\n    return parseNumber<T>(str);\n  }\n\n  template <typename T>\n  T asIntegral() const {\n    return asIntegral<T>(data_, resources_);\n  }\n\n  template <typename T>\n  static T asIntegral(VariantData* data, ResourceManager* resources) {\n    if (!data)\n      return 0;\n\n    static_assert(is_integral<T>::value, \"T must be an integral type\");\n#if ARDUINOJSON_USE_8_BYTE_POOL\n    auto eightByteValue = getEightByte(data, resources);\n#endif\n    const char* str = nullptr;\n    switch (data->type) {\n      case VariantType::Boolean:\n        return data->content.asBoolean;\n      case VariantType::Uint32:\n        return convertNumber<T>(data->content.asUint32);\n      case VariantType::Int32:\n        return convertNumber<T>(data->content.asInt32);\n#if ARDUINOJSON_USE_LONG_LONG\n      case VariantType::Uint64:\n        return convertNumber<T>(eightByteValue->asUint64);\n      case VariantType::Int64:\n        return convertNumber<T>(eightByteValue->asInt64);\n#endif\n      case VariantType::TinyString:\n        str = data->content.asTinyString;\n        break;\n      case VariantType::LongString:\n        str = data->content.asStringNode->data;\n        break;\n      case VariantType::Float:\n        return convertNumber<T>(data->content.asFloat);\n#if ARDUINOJSON_USE_DOUBLE\n      case VariantType::Double:\n        return convertNumber<T>(eightByteValue->asDouble);\n#endif\n      default:\n        return 0;\n    }\n\n    ARDUINOJSON_ASSERT(str != nullptr);\n    return parseNumber<T>(str);\n  }\n\n  iterator at(size_t index) const;\n\n  iterator createIterator() const {\n    if (!isCollection())\n      return iterator();\n    return createIterator(data_, resources_);\n  }\n\n  static iterator createIterator(VariantData*, ResourceManager*);\n\n#if ARDUINOJSON_USE_8_BYTE_POOL\n  static const EightByteValue* getEightByte(VariantData* data,\n                                            ResourceManager* resources) {\n    ARDUINOJSON_ASSERT(data != nullptr);\n    ARDUINOJSON_ASSERT(resources != nullptr);\n    return data->type & VariantTypeBits::EightByteBit\n               ? resources->getEightByte(data->content.asSlotId)\n               : 0;\n  }\n#endif\n\n  VariantData* getOrAddElement(size_t index);\n\n  VariantData* getElement(size_t index) const;\n\n  template <typename TAdaptedString>\n  VariantData* getMember(TAdaptedString key) const {\n    if (!isObject())\n      return nullptr;\n    return getMember(key, data_, resources_);\n  }\n\n  template <typename TAdaptedString>\n  static VariantData* getMember(TAdaptedString key, VariantData*,\n                                ResourceManager*);\n\n  template <typename TAdaptedString>\n  VariantData* getOrAddMember(TAdaptedString key) {\n    if (!isObject())\n      return nullptr;\n    return getOrAddMember(key, data_, resources_);\n  }\n\n  template <typename TAdaptedString>\n  static VariantData* getOrAddMember(TAdaptedString key, VariantData*,\n                                     ResourceManager*);\n\n  bool isArray() const {\n    return type() == VariantType::Array;\n  }\n\n  bool isCollection() const {\n    return type() & VariantTypeBits::CollectionMask;\n  }\n\n  template <typename T>\n  bool isInteger() const {\n    return isInteger<T>(data_, resources_);\n  }\n\n  template <typename T>\n  static bool isInteger(VariantData* data, ResourceManager* resources) {\n    if (!data)\n      return false;\n\n#if ARDUINOJSON_USE_LONG_LONG\n    auto eightByteValue = getEightByte(data, resources);\n#else\n    (void)resources;\n#endif\n    switch (data->type) {\n      case VariantType::Uint32:\n        return canConvertNumber<T>(data->content.asUint32);\n\n      case VariantType::Int32:\n        return canConvertNumber<T>(data->content.asInt32);\n\n#if ARDUINOJSON_USE_LONG_LONG\n      case VariantType::Uint64:\n        return canConvertNumber<T>(eightByteValue->asUint64);\n\n      case VariantType::Int64:\n        return canConvertNumber<T>(eightByteValue->asInt64);\n#endif\n\n      default:\n        return false;\n    }\n  }\n\n  bool isNull() const {\n    return type() == VariantType::Null;\n  }\n\n  bool isObject() const {\n    return type() == VariantType::Object;\n  }\n\n  size_t nesting() const;\n\n  void removeElement(size_t index);\n\n  void removeElement(CollectionIterator it) {\n    removeOne(it);\n  }\n\n  template <typename TAdaptedString>\n  void removeMember(TAdaptedString key) {\n    removePair(findKey(key));\n  }\n\n  void removeMember(CollectionIterator it) {\n    removePair(it);\n  }\n\n  bool setBoolean(bool value) {\n    if (!data_)\n      return false;\n    clear(data_, resources_);\n    data_->setBoolean(value);\n    return true;\n  }\n\n  template <typename T>\n  bool setFloat(T value) {\n    if (!data_)\n      return false;\n    clear(data_, resources_);\n    return setFloat(value, data_, resources_);\n  }\n\n  template <typename T>\n  static enable_if_t<sizeof(T) == 4, bool> setFloat(T value, VariantData* data,\n                                                    ResourceManager*) {\n    ARDUINOJSON_ASSERT(data != nullptr);\n    ARDUINOJSON_ASSERT(data->type == VariantType::Null);\n    data->type = VariantType::Float;\n    data->content.asFloat = value;\n    return true;\n  }\n\n  template <typename T>\n  static enable_if_t<sizeof(T) == 8, bool> setFloat(\n      T value, VariantData* data, ResourceManager* resources) {\n    ARDUINOJSON_ASSERT(data != nullptr);\n    ARDUINOJSON_ASSERT(data->type == VariantType::Null);\n    ARDUINOJSON_ASSERT(resources != nullptr);\n\n    float valueAsFloat = static_cast<float>(value);\n\n#if ARDUINOJSON_USE_DOUBLE\n    if (value == valueAsFloat) {\n      data->type = VariantType::Float;\n      data->content.asFloat = valueAsFloat;\n    } else {\n      auto slot = resources->allocEightByte();\n      if (!slot)\n        return false;\n      data->type = VariantType::Double;\n      data->content.asSlotId = slot.id();\n      slot->asDouble = value;\n    }\n#else\n    data->type = VariantType::Float;\n    data->content.asFloat = valueAsFloat;\n#endif\n    return true;\n  }\n\n  template <typename T>\n  bool setInteger(T value) {\n    if (!data_)\n      return false;\n    clear(data_, resources_);\n    return setInteger(value, data_, resources_);\n  }\n\n  template <typename T>\n  static enable_if_t<is_signed<T>::value, bool> setInteger(\n      T value, VariantData* data, ResourceManager* resources) {\n    ARDUINOJSON_ASSERT(data != nullptr);\n    ARDUINOJSON_ASSERT(data->type == VariantType::Null);\n    ARDUINOJSON_ASSERT(resources != nullptr);\n\n    if (canConvertNumber<int32_t>(value)) {\n      data->type = VariantType::Int32;\n      data->content.asInt32 = static_cast<int32_t>(value);\n    }\n#if ARDUINOJSON_USE_LONG_LONG\n    else {\n      auto slot = resources->allocEightByte();\n      if (!slot)\n        return false;\n      data->type = VariantType::Int64;\n      data->content.asSlotId = slot.id();\n      slot->asInt64 = value;\n    }\n#else\n    (void)resources;\n#endif\n    return true;\n  }\n\n  template <typename T>\n  static enable_if_t<is_unsigned<T>::value, bool> setInteger(\n      T value, VariantData* data, ResourceManager* resources) {\n    ARDUINOJSON_ASSERT(data != nullptr);\n    ARDUINOJSON_ASSERT(data->type == VariantType::Null);\n    ARDUINOJSON_ASSERT(resources != nullptr);\n\n    if (canConvertNumber<uint32_t>(value)) {\n      data->type = VariantType::Uint32;\n      data->content.asUint32 = static_cast<uint32_t>(value);\n    }\n#if ARDUINOJSON_USE_LONG_LONG\n    else {\n      auto slot = resources->allocEightByte();\n      if (!slot)\n        return false;\n      data->type = VariantType::Uint64;\n      data->content.asSlotId = slot.id();\n      slot->asUint64 = value;\n    }\n#else\n    (void)resources;\n#endif\n    return true;\n  }\n\n  template <typename TAdaptedString>\n  bool setRawString(TAdaptedString value) {\n    if (!data_)\n      return false;\n    clear(data_, resources_);\n    auto dup = resources_->saveString(adaptString(value.data(), value.size()));\n    if (!dup)\n      return false;\n    data_->setRawString(dup);\n    return true;\n  }\n\n  template <typename TAdaptedString>\n  bool setString(TAdaptedString value) {\n    if (!data_)\n      return false;\n    clear(data_, resources_);\n    return setString(value, data_, resources_);\n  }\n\n  template <typename TAdaptedString>\n  static bool setString(TAdaptedString value, VariantData* data,\n                        ResourceManager* resources) {\n    ARDUINOJSON_ASSERT(data != nullptr);\n    ARDUINOJSON_ASSERT(data->type == VariantType::Null);\n    ARDUINOJSON_ASSERT(resources != nullptr);\n\n    if (value.isNull())\n      return true;  // TODO: should this be moved up to the member function?\n\n    if (isTinyString(value, value.size())) {\n      data->setTinyString(value);\n      return true;\n    }\n\n    auto dup = resources->saveString(value);\n    if (dup) {\n      data->setLongString(dup);\n      return true;\n    }\n\n    return false;\n  }\n\n  size_t size() const {\n    if (!isCollection())\n      return 0;\n\n    return size(data_, resources_);\n  }\n\n  static size_t size(VariantData* data, ResourceManager* resources) {\n    ARDUINOJSON_ASSERT(data != nullptr);\n    ARDUINOJSON_ASSERT(data->isCollection());\n    ARDUINOJSON_ASSERT(resources != nullptr);\n\n    size_t n = 0;\n    for (auto it = createIterator(data, resources); !it.done();\n         it.move(resources))\n      n++;\n\n    if (data->type == VariantType::Object) {\n      ARDUINOJSON_ASSERT((n % 2) == 0);\n      n /= 2;\n    }\n\n    return n;\n  }\n\n  bool toArray() {\n    if (!data_)\n      return false;\n    clear(data_, resources_);\n    data_->toArray();\n    return true;\n  }\n\n  bool toObject() {\n    if (!data_)\n      return false;\n    clear(data_, resources_);\n    data_->toObject();\n    return true;\n  }\n\n  VariantType type() const {\n    return data_ ? data_->type : VariantType::Null;\n  }\n\n  // Release the resources used by this variant and set it to null.\n  bool clear() {\n    if (!data_)\n      return false;\n    clear(data_, resources_);\n    return true;\n  }\n\n  static void clear(VariantData* data, ResourceManager* resources) {\n    ARDUINOJSON_ASSERT(data != nullptr);\n    ARDUINOJSON_ASSERT(resources != nullptr);\n\n    if (data->type & VariantTypeBits::OwnedStringBit)\n      resources->dereferenceString(data->content.asStringNode->data);\n\n#if ARDUINOJSON_USE_8_BYTE_POOL\n    if (data->type & VariantTypeBits::EightByteBit)\n      resources->freeEightByte(data->content.asSlotId);\n#endif\n\n    if (data->type & VariantTypeBits::CollectionMask)\n      empty(data, resources);\n\n    data->type = VariantType::Null;\n  }\n\n  void empty() {\n    if (!isCollection())\n      return;\n    empty(data_, resources_);\n  }\n\n  static void empty(VariantData*, ResourceManager*);\n\n  static void freeVariant(Slot<VariantData> slot, ResourceManager* resources) {\n    clear(slot.ptr(), resources);\n    resources->freeVariant(slot);\n  }\n\n private:\n  VariantData* data_;\n  ResourceManager* resources_;\n\n  template <typename TAdaptedString>\n  iterator findKey(TAdaptedString key) const {\n    if (!isObject())\n      return iterator();\n    return findKey(key, data_, resources_);\n  }\n\n  template <typename TAdaptedString>\n  static iterator findKey(TAdaptedString key, VariantData*, ResourceManager*);\n\n  static void appendPair(Slot<VariantData> key, Slot<VariantData> value,\n                         VariantData*, ResourceManager*);\n\n  void removeOne(iterator it);\n  void removePair(iterator it);\n\n  Slot<VariantData> getPreviousSlot(VariantData*) const;\n};\n\nARDUINOJSON_END_PRIVATE_NAMESPACE\n"
  },
  {
    "path": "src/ArduinoJson/Variant/VariantOperators.hpp",
    "content": "// ArduinoJson - https://arduinojson.org\n// Copyright © 2014-2025, Benoit BLANCHON\n// MIT License\n\n#pragma once\n\n#include <ArduinoJson/Numbers/arithmeticCompare.hpp>\n#include <ArduinoJson/Polyfills/attributes.hpp>\n#include <ArduinoJson/Polyfills/type_traits.hpp>\n#include <ArduinoJson/Variant/VariantTag.hpp>\n\nARDUINOJSON_BEGIN_PUBLIC_NAMESPACE\n\nclass JsonVariantConst;\n\nARDUINOJSON_END_PUBLIC_NAMESPACE\n\nARDUINOJSON_BEGIN_PRIVATE_NAMESPACE\n\ntemplate <typename T>\nCompareResult compare(JsonVariantConst lhs,\n                      const T& rhs);  // VariantCompare.cpp\n\nstruct VariantOperatorTag {};\n\ntemplate <typename TVariant>\nstruct VariantOperators : VariantOperatorTag {\n  // Returns the default value if the JsonVariant is unbound or incompatible\n  //\n  // int operator|(JsonVariant, int)\n  // float operator|(JsonVariant, float)\n  // bool operator|(JsonVariant, bool)\n  template <typename T,\n            enable_if_t<!IsVariant<T>::value && !is_array<T>::value, int> = 0>\n  friend T operator|(const TVariant& variant, const T& defaultValue) {\n    if (variant.template is<T>())\n      return variant.template as<T>();\n    else\n      return defaultValue;\n  }\n  //\n  // const char* operator|(JsonVariant, const char*)\n  friend const char* operator|(const TVariant& variant,\n                               const char* defaultValue) {\n    if (variant.template is<const char*>())\n      return variant.template as<const char*>();\n    else\n      return defaultValue;\n  }\n  //\n  // JsonVariant operator|(JsonVariant, JsonVariant)\n  template <typename T>\n  friend enable_if_t<IsVariant<T>::value, JsonVariantConst> operator|(\n      const TVariant& variant, const T& defaultValue) {\n    if (variant)\n      return variant;\n    else\n      return defaultValue;\n  }\n\n  // value == TVariant\n  template <typename T>\n  friend bool operator==(T* lhs, const TVariant& rhs) {\n    return compare(rhs, lhs) == COMPARE_RESULT_EQUAL;\n  }\n  template <typename T>\n  friend bool operator==(const T& lhs, const TVariant& rhs) {\n    return compare(rhs, lhs) == COMPARE_RESULT_EQUAL;\n  }\n\n  // TVariant == value\n  template <typename T>\n  friend bool operator==(const TVariant& lhs, T* rhs) {\n    return compare(lhs, rhs) == COMPARE_RESULT_EQUAL;\n  }\n  template <typename T,\n            enable_if_t<!is_base_of<VariantOperatorTag, T>::value, int> = 0>\n  friend bool operator==(const TVariant& lhs, const T& rhs) {\n    return compare(lhs, rhs) == COMPARE_RESULT_EQUAL;\n  }\n\n  // value != TVariant\n  template <typename T>\n  friend bool operator!=(T* lhs, const TVariant& rhs) {\n    return compare(rhs, lhs) != COMPARE_RESULT_EQUAL;\n  }\n  template <typename T>\n  friend bool operator!=(const T& lhs, const TVariant& rhs) {\n    return compare(rhs, lhs) != COMPARE_RESULT_EQUAL;\n  }\n\n  // TVariant != value\n  template <typename T>\n  friend bool operator!=(const TVariant& lhs, T* rhs) {\n    return compare(lhs, rhs) != COMPARE_RESULT_EQUAL;\n  }\n  template <typename T,\n            enable_if_t<!is_base_of<VariantOperatorTag, T>::value, int> = 0>\n  friend bool operator!=(TVariant lhs, const T& rhs) {\n    return compare(lhs, rhs) != COMPARE_RESULT_EQUAL;\n  }\n\n  // value < TVariant\n  template <typename T>\n  friend bool operator<(T* lhs, const TVariant& rhs) {\n    return compare(rhs, lhs) == COMPARE_RESULT_GREATER;\n  }\n  template <typename T>\n  friend bool operator<(const T& lhs, const TVariant& rhs) {\n    return compare(rhs, lhs) == COMPARE_RESULT_GREATER;\n  }\n\n  // TVariant < value\n  template <typename T>\n  friend bool operator<(const TVariant& lhs, T* rhs) {\n    return compare(lhs, rhs) == COMPARE_RESULT_LESS;\n  }\n  template <typename T,\n            enable_if_t<!is_base_of<VariantOperatorTag, T>::value, int> = 0>\n  friend bool operator<(TVariant lhs, const T& rhs) {\n    return compare(lhs, rhs) == COMPARE_RESULT_LESS;\n  }\n\n  // value <= TVariant\n  template <typename T>\n  friend bool operator<=(T* lhs, const TVariant& rhs) {\n    return (compare(rhs, lhs) & COMPARE_RESULT_GREATER_OR_EQUAL) != 0;\n  }\n  template <typename T>\n  friend bool operator<=(const T& lhs, const TVariant& rhs) {\n    return (compare(rhs, lhs) & COMPARE_RESULT_GREATER_OR_EQUAL) != 0;\n  }\n\n  // TVariant <= value\n  template <typename T>\n  friend bool operator<=(const TVariant& lhs, T* rhs) {\n    return (compare(lhs, rhs) & COMPARE_RESULT_LESS_OR_EQUAL) != 0;\n  }\n  template <typename T,\n            enable_if_t<!is_base_of<VariantOperatorTag, T>::value, int> = 0>\n  friend bool operator<=(TVariant lhs, const T& rhs) {\n    return (compare(lhs, rhs) & COMPARE_RESULT_LESS_OR_EQUAL) != 0;\n  }\n\n  // value > TVariant\n  template <typename T>\n  friend bool operator>(T* lhs, const TVariant& rhs) {\n    return compare(rhs, lhs) == COMPARE_RESULT_LESS;\n  }\n  template <typename T>\n  friend bool operator>(const T& lhs, const TVariant& rhs) {\n    return compare(rhs, lhs) == COMPARE_RESULT_LESS;\n  }\n\n  // TVariant > value\n  template <typename T>\n  friend bool operator>(const TVariant& lhs, T* rhs) {\n    return compare(lhs, rhs) == COMPARE_RESULT_GREATER;\n  }\n  template <typename T,\n            enable_if_t<!is_base_of<VariantOperatorTag, T>::value, int> = 0>\n  friend bool operator>(TVariant lhs, const T& rhs) {\n    return compare(lhs, rhs) == COMPARE_RESULT_GREATER;\n  }\n\n  // value >= TVariant\n  template <typename T>\n  friend bool operator>=(T* lhs, const TVariant& rhs) {\n    return (compare(rhs, lhs) & COMPARE_RESULT_LESS_OR_EQUAL) != 0;\n  }\n  template <typename T>\n  friend bool operator>=(const T& lhs, const TVariant& rhs) {\n    return (compare(rhs, lhs) & COMPARE_RESULT_LESS_OR_EQUAL) != 0;\n  }\n\n  // TVariant >= value\n  template <typename T>\n  friend bool operator>=(const TVariant& lhs, T* rhs) {\n    return (compare(lhs, rhs) & COMPARE_RESULT_GREATER_OR_EQUAL) != 0;\n  }\n  template <typename T,\n            enable_if_t<!is_base_of<VariantOperatorTag, T>::value, int> = 0>\n  friend bool operator>=(const TVariant& lhs, const T& rhs) {\n    return (compare(lhs, rhs) & COMPARE_RESULT_GREATER_OR_EQUAL) != 0;\n  }\n};\n\nARDUINOJSON_END_PRIVATE_NAMESPACE\n"
  },
  {
    "path": "src/ArduinoJson/Variant/VariantRefBase.hpp",
    "content": "// ArduinoJson - https://arduinojson.org\n// Copyright © 2014-2025, Benoit BLANCHON\n// MIT License\n\n#pragma once\n\n#include <ArduinoJson/Configuration.hpp>\n#include <ArduinoJson/Variant/Converter.hpp>\n#include <ArduinoJson/Variant/JsonVariantConst.hpp>\n#include <ArduinoJson/Variant/VariantOperators.hpp>\n\nARDUINOJSON_BEGIN_PUBLIC_NAMESPACE\nclass JsonVariant;\nARDUINOJSON_END_PUBLIC_NAMESPACE\n\nARDUINOJSON_BEGIN_PRIVATE_NAMESPACE\ntemplate <typename>\nclass ElementProxy;\n\ntemplate <typename, typename>\nclass MemberProxy;\n\ntemplate <typename TDerived>\nclass VariantRefBase : public VariantTag {\n  friend class VariantAttorney;\n\n public:\n  // Sets the value to null.\n  // https://arduinojson.org/v7/api/jsonvariant/clear/\n  void clear() const {\n    getOrCreateVariantImpl().clear();\n  }\n\n  // Returns true if the value is null or the reference is unbound.\n  // https://arduinojson.org/v7/api/jsonvariant/isnull/\n  bool isNull() const {\n    return getVariantImpl().isNull();\n  }\n\n  // Returns true if the reference is unbound.\n  bool isUnbound() const {\n    return !getData();\n  }\n\n  // Casts the value to the specified type.\n  // https://arduinojson.org/v7/api/jsonvariant/as/\n  template <typename T>\n  T as() const;\n\n  template <typename T, enable_if_t<!is_same<T, TDerived>::value, int> = 0>\n  operator T() const {\n    return as<T>();\n  }\n\n  // Sets the value to an empty array.\n  // https://arduinojson.org/v7/api/jsonvariant/to/\n  template <typename T, enable_if_t<is_same<T, JsonArray>::value, int> = 0>\n  JsonArray to() const;\n\n  // Sets the value to an empty object.\n  // https://arduinojson.org/v7/api/jsonvariant/to/\n  template <typename T, enable_if_t<is_same<T, JsonObject>::value, int> = 0>\n  JsonObject to() const;\n\n  // Sets the value to null.\n  // https://arduinojson.org/v7/api/jsonvariant/to/\n  template <typename T, enable_if_t<is_same<T, JsonVariant>::value, int> = 0>\n  JsonVariant to() const;\n\n  // Returns true if the value is of the specified type.\n  // https://arduinojson.org/v7/api/jsonvariant/is/\n  template <typename T>\n  FORCE_INLINE bool is() const;\n\n  // Copies the specified value.\n  // https://arduinojson.org/v7/api/jsonvariant/set/\n  template <typename T>\n  bool set(const T& value) const {\n    using TypeForConverter = remove_cv_t<remove_reference_t<T>>;\n    return doSet<Converter<TypeForConverter>>(value);\n  }\n\n  // Copies the specified value.\n  // https://arduinojson.org/v7/api/jsonvariant/set/\n  template <typename T>\n  bool set(T* value) const {\n    return doSet<Converter<T*>>(value);\n  }\n\n  // Returns the size of the array or object.\n  // https://arduinojson.org/v7/api/jsonvariant/size/\n  size_t size() const {\n    return getVariantImpl().size();\n  }\n\n  // Returns the depth (nesting level) of the value.\n  // https://arduinojson.org/v7/api/jsonvariant/nesting/\n  size_t nesting() const {\n    return getVariantImpl().nesting();\n  }\n\n  // Appends a new (empty) element to the array.\n  // Returns a reference to the new element.\n  // https://arduinojson.org/v7/api/jsonvariant/add/\n  template <typename T, enable_if_t<!is_same<T, JsonVariant>::value, int> = 0>\n  T add() const {\n    return add<JsonVariant>().template to<T>();\n  }\n\n  // Appends a new (null) element to the array.\n  // Returns a reference to the new element.\n  // https://arduinojson.org/v7/api/jsonvariant/add/\n  template <typename T, enable_if_t<is_same<T, JsonVariant>::value, int> = 0>\n  T add() const;\n\n  // Appends a value to the array.\n  // https://arduinojson.org/v7/api/jsonvariant/add/\n  template <typename T>\n  bool add(const T& value) const {\n    return getOrCreateArray().add(value);\n  }\n\n  // Appends a value to the array.\n  // https://arduinojson.org/v7/api/jsonvariant/add/\n  template <typename T>\n  bool add(T* value) const {\n    return getOrCreateArray().add(value);\n  }\n\n  // Removes an element of the array.\n  // https://arduinojson.org/v7/api/jsonvariant/remove/\n  void remove(size_t index) const {\n    getVariantImpl().removeElement(index);\n  }\n\n  // Removes a member of the object.\n  // https://arduinojson.org/v7/api/jsonvariant/remove/\n  template <typename TChar, enable_if_t<IsString<TChar*>::value, int> = 0>\n  void remove(TChar* key) const {\n    getVariantImpl().removeMember(adaptString(key));\n  }\n\n  // Removes a member of the object.\n  // https://arduinojson.org/v7/api/jsonvariant/remove/\n  template <typename TString, enable_if_t<IsString<TString>::value, int> = 0>\n  void remove(const TString& key) const {\n    getVariantImpl().removeMember(adaptString(key));\n  }\n\n  // Removes a member of the object or an element of the array.\n  // https://arduinojson.org/v7/api/jsonvariant/remove/\n  template <typename TVariant, enable_if_t<IsVariant<TVariant>::value, int> = 0>\n  void remove(const TVariant& key) const {\n    if (key.template is<size_t>())\n      remove(key.template as<size_t>());\n    else\n      remove(key.template as<const char*>());\n  }\n\n  // Gets or sets an array element.\n  // https://arduinojson.org/v7/api/jsonvariant/subscript/\n  ElementProxy<TDerived> operator[](size_t index) const;\n\n  // DEPRECATED: use obj[key].is<T>() instead\n  // https://arduinojson.org/v7/api/jsonvariant/containskey/\n  template <typename TString, enable_if_t<IsString<TString>::value, int> = 0>\n  ARDUINOJSON_DEPRECATED(\"use obj[key].is<T>() instead\")\n  bool containsKey(const TString& key) const;\n\n  // DEPRECATED: use obj[\"key\"].is<T>() instead\n  // https://arduinojson.org/v7/api/jsonvariant/containskey/\n  template <typename TChar, enable_if_t<IsString<TChar*>::value, int> = 0>\n  ARDUINOJSON_DEPRECATED(\"use obj[\\\"key\\\"].is<T>() instead\")\n  bool containsKey(TChar* key) const;\n\n  // DEPRECATED: use obj[key].is<T>() instead\n  // https://arduinojson.org/v7/api/jsonvariant/containskey/\n  template <typename TVariant, enable_if_t<IsVariant<TVariant>::value, int> = 0>\n  ARDUINOJSON_DEPRECATED(\"use obj[key].is<T>() instead\")\n  bool containsKey(const TVariant& key) const;\n\n  // Gets or sets an object member.\n  // https://arduinojson.org/v7/api/jsonvariant/subscript/\n  template <typename TString, enable_if_t<IsString<TString>::value, int> = 0>\n  FORCE_INLINE MemberProxy<TDerived, AdaptedString<TString>> operator[](\n      const TString& key) const;\n\n  // Gets or sets an object member.\n  // https://arduinojson.org/v7/api/jsonvariant/subscript/\n  template <typename TChar, enable_if_t<IsString<TChar*>::value, int> = 0>\n  FORCE_INLINE MemberProxy<TDerived, AdaptedString<TChar*>> operator[](\n      TChar* key) const;\n\n  // Gets an object member or an array element.\n  // https://arduinojson.org/v7/api/jsonvariant/subscript/\n  template <typename TVariant, enable_if_t<IsVariant<TVariant>::value, int> = 0>\n  JsonVariantConst operator[](const TVariant& key) const {\n    if (key.template is<size_t>())\n      return operator[](key.template as<size_t>());\n    else\n      return operator[](key.template as<JsonString>());\n  }\n\n  // DEPRECATED: use add<JsonVariant>() instead\n  ARDUINOJSON_DEPRECATED(\"use add<JsonVariant>() instead\")\n  JsonVariant add() const;\n\n  // DEPRECATED: use add<JsonArray>() instead\n  ARDUINOJSON_DEPRECATED(\"use add<JsonArray>() instead\")\n  JsonArray createNestedArray() const;\n\n  // DEPRECATED: use var[key].to<JsonArray>() instead\n  template <typename TChar>\n  ARDUINOJSON_DEPRECATED(\"use var[key].to<JsonArray>() instead\")\n  JsonArray createNestedArray(TChar* key) const;\n\n  // DEPRECATED: use var[key].to<JsonArray>() instead\n  template <typename TString>\n  ARDUINOJSON_DEPRECATED(\"use var[key].to<JsonArray>() instead\")\n  JsonArray createNestedArray(const TString& key) const;\n\n  // DEPRECATED: use add<JsonObject>() instead\n  ARDUINOJSON_DEPRECATED(\"use add<JsonObject>() instead\")\n  JsonObject createNestedObject() const;\n\n  // DEPRECATED: use var[key].to<JsonObject>() instead\n  template <typename TChar>\n  ARDUINOJSON_DEPRECATED(\"use var[key].to<JsonObject>() instead\")\n  JsonObject createNestedObject(TChar* key) const;\n\n  // DEPRECATED: use var[key].to<JsonObject>() instead\n  template <typename TString>\n  ARDUINOJSON_DEPRECATED(\"use var[key].to<JsonObject>() instead\")\n  JsonObject createNestedObject(const TString& key) const;\n\n  // DEPRECATED: always returns zero\n  ARDUINOJSON_DEPRECATED(\"always returns zero\")\n  size_t memoryUsage() const {\n    return 0;\n  }\n\n  // DEPRECATED: performs a deep copy\n  ARDUINOJSON_DEPRECATED(\"performs a deep copy\")\n  void shallowCopy(JsonVariantConst src) const {\n    set(src);\n  }\n\n private:\n  TDerived& derived() {\n    return static_cast<TDerived&>(*this);\n  }\n\n  const TDerived& derived() const {\n    return static_cast<const TDerived&>(*this);\n  }\n\n  ResourceManager* getResourceManager() const {\n    return VariantAttorney::getResourceManager(derived());\n  }\n\n  VariantData* getData() const {\n    return VariantAttorney::getData(derived());\n  }\n\n  VariantData* getOrCreateData() const {\n    return VariantAttorney::getOrCreateData(derived());\n  }\n\n  VariantImpl getVariantImpl() const {\n    return VariantImpl(getData(), getResourceManager());\n  }\n\n  VariantImpl getOrCreateVariantImpl() const {\n    return VariantImpl(getOrCreateData(), getResourceManager());\n  }\n\n  JsonArray getOrCreateArray() const;\n\n  FORCE_INLINE ArduinoJson::JsonVariant getVariant() const;\n\n  FORCE_INLINE ArduinoJson::JsonVariantConst getVariantConst() const {\n    return ArduinoJson::JsonVariantConst(getData(), getResourceManager());\n  }\n\n  template <typename T>\n  FORCE_INLINE enable_if_t<is_same<T, JsonVariantConst>::value, T> getVariant()\n      const {\n    return getVariantConst();\n  }\n\n  template <typename T>\n  FORCE_INLINE enable_if_t<is_same<T, JsonVariant>::value, T> getVariant()\n      const {\n    return getVariant();\n  }\n\n  template <typename TConverter, typename T>\n  bool doSet(const T& value) const {\n    return doSet<TConverter>(\n        value, is_same<typename function_traits<\n                           decltype(&TConverter::toJson)>::return_type,\n                       bool>{});\n  }\n\n  template <typename TConverter, typename T>\n  bool doSet(const T& value, false_type) const;\n\n  template <typename TConverter, typename T>\n  bool doSet(const T& value, true_type) const;\n\n  ArduinoJson::JsonVariant getOrCreateVariant() const;\n};\n\nARDUINOJSON_END_PRIVATE_NAMESPACE\n"
  },
  {
    "path": "src/ArduinoJson/Variant/VariantRefBaseImpl.hpp",
    "content": "// ArduinoJson - https://arduinojson.org\n// Copyright © 2014-2025, Benoit BLANCHON\n// MIT License\n\n#pragma once\n\n#include <ArduinoJson/Array/JsonArray.hpp>\n#include <ArduinoJson/Object/JsonObject.hpp>\n#include <ArduinoJson/Variant/VariantRefBase.hpp>\n\nARDUINOJSON_BEGIN_PRIVATE_NAMESPACE\n\ntemplate <typename TDerived>\ninline JsonVariant VariantRefBase<TDerived>::add() const {\n  return add<JsonVariant>();\n}\n\ntemplate <typename TDerived>\ntemplate <typename T>\ninline T VariantRefBase<TDerived>::as() const {\n  using variant_type =  // JsonVariantConst or JsonVariant?\n      typename function_traits<decltype(&Converter<T>::fromJson)>::arg1_type;\n  return Converter<T>::fromJson(getVariant<variant_type>());\n}\n\ntemplate <typename TDerived>\ninline JsonArray VariantRefBase<TDerived>::createNestedArray() const {\n  return add<JsonArray>();\n}\n\ntemplate <typename TDerived>\ntemplate <typename TChar>\ninline JsonArray VariantRefBase<TDerived>::createNestedArray(TChar* key) const {\n  return operator[](key).template to<JsonArray>();\n}\n\ntemplate <typename TDerived>\ntemplate <typename TString>\ninline JsonArray VariantRefBase<TDerived>::createNestedArray(\n    const TString& key) const {\n  return operator[](key).template to<JsonArray>();\n}\n\ntemplate <typename TDerived>\ninline JsonObject VariantRefBase<TDerived>::createNestedObject() const {\n  return add<JsonObject>();\n}\n\ntemplate <typename TDerived>\ntemplate <typename TChar>\ninline JsonObject VariantRefBase<TDerived>::createNestedObject(\n    TChar* key) const {\n  return operator[](key).template to<JsonObject>();\n}\n\ntemplate <typename TDerived>\ntemplate <typename TString>\ninline JsonObject VariantRefBase<TDerived>::createNestedObject(\n    const TString& key) const {\n  return operator[](key).template to<JsonObject>();\n}\n\ntemplate <typename TDerived>\ninline bool convertToJson(const VariantRefBase<TDerived>& src,\n                          JsonVariant dst) {\n  return dst.set(src.template as<JsonVariantConst>());\n}\n\ntemplate <typename TDerived>\ntemplate <typename T, enable_if_t<is_same<T, JsonVariant>::value, int>>\ninline T VariantRefBase<TDerived>::add() const {\n  return getOrCreateArray().template add<T>();\n}\n\ntemplate <typename TDerived>\ntemplate <typename TString, enable_if_t<IsString<TString>::value, int>>\ninline bool VariantRefBase<TDerived>::containsKey(const TString& key) const {\n  return getVariantImpl().getMember(adaptString(key)) != 0;\n}\n\ntemplate <typename TDerived>\ntemplate <typename TChar, enable_if_t<IsString<TChar*>::value, int>>\ninline bool VariantRefBase<TDerived>::containsKey(TChar* key) const {\n  return getVariantImpl().getMember(adaptString(key)) != 0;\n}\n\ntemplate <typename TDerived>\ntemplate <typename TVariant, enable_if_t<IsVariant<TVariant>::value, int>>\ninline bool VariantRefBase<TDerived>::containsKey(const TVariant& key) const {\n  return containsKey(key.template as<const char*>());\n}\n\ntemplate <typename TDerived>\ninline JsonVariant VariantRefBase<TDerived>::getVariant() const {\n  return JsonVariant(getData(), getResourceManager());\n}\n\ntemplate <typename TDerived>\ninline JsonArray VariantRefBase<TDerived>::getOrCreateArray() const {\n  auto data = getOrCreateData();\n  auto resources = getResourceManager();\n  if (data && data->type == VariantType::Null)\n    data->toArray();\n  return JsonArray(data, resources);\n}\n\ntemplate <typename TDerived>\ninline JsonVariant VariantRefBase<TDerived>::getOrCreateVariant() const {\n  return JsonVariant(getOrCreateData(), getResourceManager());\n}\n\ntemplate <typename TDerived>\ntemplate <typename T>\ninline bool VariantRefBase<TDerived>::is() const {\n  using variant_type =  // JsonVariantConst or JsonVariant?\n      typename function_traits<decltype(&Converter<T>::checkJson)>::arg1_type;\n  return Converter<T>::checkJson(getVariant<variant_type>());\n}\n\ntemplate <typename TDerived>\ninline ElementProxy<TDerived> VariantRefBase<TDerived>::operator[](\n    size_t index) const {\n  return {derived(), index};\n}\n\ntemplate <typename TDerived>\ntemplate <typename TChar, enable_if_t<IsString<TChar*>::value, int>>\ninline MemberProxy<TDerived, AdaptedString<TChar*>>\nVariantRefBase<TDerived>::operator[](TChar* key) const {\n  return {derived(), adaptString(key)};\n}\n\ntemplate <typename TDerived>\ntemplate <typename TString, enable_if_t<IsString<TString>::value, int>>\ninline MemberProxy<TDerived, AdaptedString<TString>>\nVariantRefBase<TDerived>::operator[](const TString& key) const {\n  return {derived(), adaptString(key)};\n}\n\ntemplate <typename TDerived>\ntemplate <typename TConverter, typename T>\ninline bool VariantRefBase<TDerived>::doSet(const T& value, false_type) const {\n  TConverter::toJson(value, getOrCreateVariant());\n  auto resources = getResourceManager();\n  return resources && !resources->overflowed();\n}\n\ntemplate <typename TDerived>\ntemplate <typename TConverter, typename T>\ninline bool VariantRefBase<TDerived>::doSet(const T& value, true_type) const {\n  return TConverter::toJson(value, getOrCreateVariant());\n}\n\ntemplate <typename TDerived>\ntemplate <typename T, enable_if_t<is_same<T, JsonArray>::value, int>>\ninline JsonArray VariantRefBase<TDerived>::to() const {\n  auto impl = getOrCreateVariantImpl();\n  impl.toArray();\n  return JsonArray(impl);\n}\n\ntemplate <typename TDerived>\ntemplate <typename T, enable_if_t<is_same<T, JsonObject>::value, int>>\nJsonObject VariantRefBase<TDerived>::to() const {\n  auto impl = getOrCreateVariantImpl();\n  impl.toObject();\n  return JsonObject(impl);\n}\n\ntemplate <typename TDerived>\ntemplate <typename T, enable_if_t<is_same<T, JsonVariant>::value, int>>\nJsonVariant VariantRefBase<TDerived>::to() const {\n  auto impl = getOrCreateVariantImpl();\n  impl.clear();\n  return JsonVariant(impl);\n}\n\nARDUINOJSON_END_PRIVATE_NAMESPACE\n"
  },
  {
    "path": "src/ArduinoJson/Variant/VariantTag.hpp",
    "content": "// ArduinoJson - https://arduinojson.org\n// Copyright © 2014-2025, Benoit BLANCHON\n// MIT License\n\n#pragma once\n\n#include <ArduinoJson/Namespace.hpp>\n\nARDUINOJSON_BEGIN_PRIVATE_NAMESPACE\n\nstruct VariantTag {};\n\ntemplate <typename T>\nstruct IsVariant : is_base_of<VariantTag, T> {};\n\nARDUINOJSON_END_PRIVATE_NAMESPACE\n"
  },
  {
    "path": "src/ArduinoJson/compatibility.hpp",
    "content": "// ArduinoJson - https://arduinojson.org\n// Copyright © 2014-2025, Benoit BLANCHON\n// MIT License\n//\n// clang-format off\n\n#include <ArduinoJson/Namespace.hpp>\n\n#ifdef ARDUINOJSON_SLOT_OFFSET_SIZE\n#error ARDUINOJSON_SLOT_OFFSET_SIZE has been removed, use ARDUINOJSON_SLOT_ID_SIZE instead\n#endif\n\n#ifdef ARDUINOJSON_ENABLE_STRING_DEDUPLICATION\n#warning \"ARDUINOJSON_ENABLE_STRING_DEDUPLICATION has been removed, string deduplication is now always enabled\"\n#endif\n\n#ifdef __GNUC__\n\n#define ARDUINOJSON_PRAGMA(x) _Pragma(#x)\n\n#define ARDUINOJSON_COMPILE_ERROR(msg) ARDUINOJSON_PRAGMA(GCC error msg)\n\n#define ARDUINOJSON_STRINGIFY(S) #S\n\n#define ARDUINOJSON_DEPRECATION_ERROR(X, Y) \\\n  ARDUINOJSON_COMPILE_ERROR(ARDUINOJSON_STRINGIFY(X is a Y from ArduinoJson 5. Please see https:/\\/arduinojson.org/v7/upgrade-from-v5/ to learn how to upgrade to ArduinoJson 7))\n\n#define StaticJsonBuffer ARDUINOJSON_DEPRECATION_ERROR(StaticJsonBuffer, class)\n#define DynamicJsonBuffer ARDUINOJSON_DEPRECATION_ERROR(DynamicJsonBuffer, class)\n#define JsonBuffer ARDUINOJSON_DEPRECATION_ERROR(JsonBuffer, class)\n#define RawJson ARDUINOJSON_DEPRECATION_ERROR(RawJson, function)\n\n#define ARDUINOJSON_NAMESPACE _Pragma (\"GCC warning \\\"ARDUINOJSON_NAMESPACE is deprecated, use ArduinoJson instead\\\"\") ArduinoJson\n\n// DEPRECATED: you don't need to compute the size anymore\n#define JSON_ARRAY_SIZE(N) _Pragma (\"GCC warning \\\"JSON_ARRAY_SIZE is deprecated, you don't need to compute the size anymore\\\"\") (ArduinoJson::detail::sizeofArray(N))\n\n// DEPRECATED: you don't need to compute the size anymore\n#define JSON_OBJECT_SIZE(N) _Pragma (\"GCC warning \\\"JSON_OBJECT_SIZE is deprecated, you don't need to compute the size anymore\\\"\") (ArduinoJson::detail::sizeofObject(N))\n\n// DEPRECATED: you don't need to compute the size anymore\n#define JSON_STRING_SIZE(N) _Pragma (\"GCC warning \\\"JSON_STRING_SIZE is deprecated, you don't need to compute the size anymore\\\"\") (N+1)\n\n#else\n\n// DEPRECATED: you don't need to compute the size anymore\n#define JSON_ARRAY_SIZE(N) (ArduinoJson::detail::sizeofArray(N))\n\n// DEPRECATED: you don't need to compute the size anymore\n#define JSON_OBJECT_SIZE(N) (ArduinoJson::detail::sizeofObject(N))\n\n// DEPRECATED: you don't need to compute the size anymore\n#define JSON_STRING_SIZE(N) (N+1)\n\n#endif\n\n// clang-format on\n\nARDUINOJSON_BEGIN_PUBLIC_NAMESPACE\n\n// DEPRECATED: use JsonDocument instead\ntemplate <size_t N>\nclass ARDUINOJSON_DEPRECATED(\"use JsonDocument instead\") StaticJsonDocument\n    : public JsonDocument {\n public:\n  using JsonDocument::JsonDocument;\n\n  size_t capacity() const {\n    return N;\n  }\n};\n\nnamespace detail {\ntemplate <typename TAllocator>\nclass AllocatorAdapter : public Allocator {\n public:\n  AllocatorAdapter(const AllocatorAdapter&) = delete;\n  AllocatorAdapter& operator=(const AllocatorAdapter&) = delete;\n\n  void* allocate(size_t size) override {\n    return _allocator.allocate(size);\n  }\n\n  void deallocate(void* ptr) override {\n    _allocator.deallocate(ptr);\n  }\n\n  void* reallocate(void* ptr, size_t new_size) override {\n    return _allocator.reallocate(ptr, new_size);\n  }\n\n  static Allocator* instance() {\n    static AllocatorAdapter instance;\n    return &instance;\n  }\n\n private:\n  AllocatorAdapter() = default;\n  ~AllocatorAdapter() = default;\n\n  TAllocator _allocator;\n};\n}  // namespace detail\n\n// DEPRECATED: use JsonDocument instead\ntemplate <typename TAllocator>\nclass ARDUINOJSON_DEPRECATED(\"use JsonDocument instead\") BasicJsonDocument\n    : public JsonDocument {\n public:\n  BasicJsonDocument(size_t capacity)\n      : JsonDocument(detail::AllocatorAdapter<TAllocator>::instance()),\n        _capacity(capacity) {}\n\n  size_t capacity() const {\n    return _capacity;\n  }\n\n  void garbageCollect() {}\n\n private:\n  size_t _capacity;\n};\n\n// DEPRECATED: use JsonDocument instead\nclass ARDUINOJSON_DEPRECATED(\"use JsonDocument instead\") DynamicJsonDocument\n    : public JsonDocument {\n public:\n  DynamicJsonDocument(size_t capacity) : _capacity(capacity) {}\n\n  size_t capacity() const {\n    return _capacity;\n  }\n\n  void garbageCollect() {}\n\n private:\n  size_t _capacity;\n};\n\ninline JsonObject JsonArray::createNestedObject() const {\n  return add<JsonObject>();\n}\n\nARDUINOJSON_END_PUBLIC_NAMESPACE\n"
  },
  {
    "path": "src/ArduinoJson/version.hpp",
    "content": "// ArduinoJson - https://arduinojson.org\n// Copyright © 2014-2025, Benoit BLANCHON\n// MIT License\n\n#pragma once\n\n#define ARDUINOJSON_VERSION \"7.4.2\"\n#define ARDUINOJSON_VERSION_MAJOR 7\n#define ARDUINOJSON_VERSION_MINOR 4\n#define ARDUINOJSON_VERSION_REVISION 2\n#define ARDUINOJSON_VERSION_MACRO V742\n"
  },
  {
    "path": "src/ArduinoJson.h",
    "content": "// ArduinoJson - https://arduinojson.org\n// Copyright © 2014-2025, Benoit BLANCHON\n// MIT License\n\n#pragma once\n\n#ifdef __cplusplus\n\n#  include \"ArduinoJson.hpp\"\n\nusing namespace ArduinoJson;\n\n#else\n\n#error ArduinoJson requires a C++ compiler, please change file extension to .cc or .cpp\n\n#endif\n"
  },
  {
    "path": "src/ArduinoJson.hpp",
    "content": "// ArduinoJson - https://arduinojson.org\n// Copyright © 2014-2025, Benoit BLANCHON\n// MIT License\n\n#pragma once\n\n#if __cplusplus < 201103L && (!defined(_MSC_VER) || _MSC_VER < 1910)\n#  error ArduinoJson requires C++11 or newer. Configure your compiler for C++11 or downgrade ArduinoJson to 6.20.\n#endif\n\n#include \"ArduinoJson/Configuration.hpp\"\n\n// Include Arduino.h before stdlib.h to avoid conflict with atexit()\n// https://github.com/bblanchon/ArduinoJson/pull/1693#issuecomment-1001060240\n#if ARDUINOJSON_ENABLE_ARDUINO_STRING || ARDUINOJSON_ENABLE_ARDUINO_STREAM || \\\n    ARDUINOJSON_ENABLE_ARDUINO_PRINT ||                                       \\\n    (ARDUINOJSON_ENABLE_PROGMEM && defined(ARDUINO))\n#  include <Arduino.h>\n#endif\n\n#if !ARDUINOJSON_DEBUG\n#  ifdef __clang__\n#    pragma clang system_header\n#  elif defined __GNUC__\n#    pragma GCC system_header\n#  endif\n#endif\n\n// Remove true and false macros defined by some cores, such as Arduino Due's\n// See issues #2181 and arduino/ArduinoCore-sam#50\n#ifdef true\n#  undef true\n#endif\n#ifdef false\n#  undef false\n#endif\n\n#include \"ArduinoJson/Array/JsonArray.hpp\"\n#include \"ArduinoJson/Object/JsonObject.hpp\"\n#include \"ArduinoJson/Variant/JsonVariantConst.hpp\"\n\n#include \"ArduinoJson/Document/JsonDocument.hpp\"\n\n#include \"ArduinoJson/Array/ArrayImpl.hpp\"\n#include \"ArduinoJson/Array/ElementProxy.hpp\"\n#include \"ArduinoJson/Array/Utilities.hpp\"\n#include \"ArduinoJson/Collection/CollectionImpl.hpp\"\n#include \"ArduinoJson/Object/MemberProxy.hpp\"\n#include \"ArduinoJson/Object/ObjectImpl.hpp\"\n#include \"ArduinoJson/Variant/ConverterImpl.hpp\"\n#include \"ArduinoJson/Variant/JsonVariantCopier.hpp\"\n#include \"ArduinoJson/Variant/VariantCompare.hpp\"\n#include \"ArduinoJson/Variant/VariantRefBaseImpl.hpp\"\n\n#include \"ArduinoJson/Json/JsonDeserializer.hpp\"\n#include \"ArduinoJson/Json/JsonSerializer.hpp\"\n#include \"ArduinoJson/Json/PrettyJsonSerializer.hpp\"\n#include \"ArduinoJson/MsgPack/MsgPackBinary.hpp\"\n#include \"ArduinoJson/MsgPack/MsgPackDeserializer.hpp\"\n#include \"ArduinoJson/MsgPack/MsgPackExtension.hpp\"\n#include \"ArduinoJson/MsgPack/MsgPackSerializer.hpp\"\n\n#include \"ArduinoJson/compatibility.hpp\"\n"
  },
  {
    "path": "src/CMakeLists.txt",
    "content": "# ArduinoJson - https://arduinojson.org\n# Copyright © 2014-2025, Benoit BLANCHON\n# MIT License\n\n# I have no idea what this is about, I simply followed the instructions from:\n# https://dominikberner.ch/cmake-interface-lib/\n\nadd_library(ArduinoJson INTERFACE)\n\ninclude(GNUInstallDirs)\n\n# Adding the install interface generator expression makes sure that the include\n# files are installed to the proper location (provided by GNUInstallDirs)\ntarget_include_directories(ArduinoJson\n\tINTERFACE\n\t\t$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}>\n\t\t$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>\n)\n\ntarget_compile_definitions(ArduinoJson\n\tINTERFACE\n\t\tARDUINOJSON_DEBUG=$<CONFIG:Debug>\n)\n\n# locations are provided by GNUInstallDirs\ninstall(\n\tTARGETS\n\t\tArduinoJson\n\tEXPORT\n\t\tArduinoJson_Targets\n\tARCHIVE DESTINATION\n\t\t${CMAKE_INSTALL_LIBDIR}\n\tLIBRARY DESTINATION\n\t\t${CMAKE_INSTALL_LIBDIR}\n\tRUNTIME DESTINATION\n\t\t${CMAKE_INSTALL_BINDIR}\n)\n\ninclude(CMakePackageConfigHelpers)\n\nif(${CMAKE_VERSION} VERSION_GREATER \"3.14.0\")\n\tset(ARCH_INDEPENDENT \"ARCH_INDEPENDENT\")\nendif()\n\nwrite_basic_package_version_file(\n\t\t\"${PROJECT_BINARY_DIR}/ArduinoJsonConfigVersion.cmake\"\n\tVERSION\n\t\t${PROJECT_VERSION}\n\tCOMPATIBILITY\n\t\tSameMajorVersion\n\t${ARCH_INDEPENDENT}\n)\n\nconfigure_package_config_file(\n\t\t\"${PROJECT_SOURCE_DIR}/extras/ArduinoJsonConfig.cmake.in\"\n\t\t\"${PROJECT_BINARY_DIR}/ArduinoJsonConfig.cmake\"\n\tINSTALL_DESTINATION\n\t\t${CMAKE_INSTALL_DATAROOTDIR}/ArduinoJson/cmake\n)\n\ninstall(\n\tEXPORT\n\t\tArduinoJson_Targets\n\tFILE\n\t\tArduinoJsonTargets.cmake\n\tDESTINATION\n\t\t${CMAKE_INSTALL_DATAROOTDIR}/ArduinoJson/cmake\n)\n\ninstall(\n\tFILES\n\t\t\"${PROJECT_BINARY_DIR}/ArduinoJsonConfig.cmake\"\n\t\t\"${PROJECT_BINARY_DIR}/ArduinoJsonConfigVersion.cmake\"\n\tDESTINATION\n\t\t\"${CMAKE_INSTALL_DATAROOTDIR}/ArduinoJson/cmake\"\n)\n\ninstall(\n\tFILES\n\t\tArduinoJson.h\n\t\tArduinoJson.hpp\n\tDESTINATION\n\t\tinclude\n)\n\ninstall(\n\tDIRECTORY\n\t\t\"${CMAKE_CURRENT_SOURCE_DIR}/ArduinoJson\"\n\tDESTINATION\n\t\tinclude\n)\n"
  }
]