From eb20ae6a3f39f620627725da5d4213345faef993 Mon Sep 17 00:00:00 2001 From: Benoit Blanchon Date: Fri, 1 Jun 2018 09:16:45 +0200 Subject: [PATCH] Added macros `ARDUINOJSON_VERSION`, `ARDUINOJSON_VERSION_MAJOR`... --- CHANGELOG.md | 1 + src/ArduinoJson.hpp | 2 ++ src/ArduinoJson/version.hpp | 10 ++++++++++ test/Misc/CMakeLists.txt | 1 + test/Misc/version.cpp | 16 ++++++++++++++++ 5 files changed, 30 insertions(+) create mode 100644 src/ArduinoJson/version.hpp create mode 100644 test/Misc/version.cpp diff --git a/CHANGELOG.md b/CHANGELOG.md index 4c764675..70dc7040 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,7 @@ HEAD * Fixed `JsonBuffer::parse()` not respecting nesting limit correctly (issue #693) * Fixed inconsistencies in nesting level counting (PR #695 from Zhenyu Wu) * Fixed null values that could be pass to `strcmp()` (PR #745 from Mike Karlesky) +* Added macros `ARDUINOJSON_VERSION`, `ARDUINOJSON_VERSION_MAJOR`... v5.13.1 ------- diff --git a/src/ArduinoJson.hpp b/src/ArduinoJson.hpp index 445a2c8a..c493c06a 100644 --- a/src/ArduinoJson.hpp +++ b/src/ArduinoJson.hpp @@ -4,6 +4,8 @@ #pragma once +#include "ArduinoJson/version.hpp" + #include "ArduinoJson/DynamicJsonBuffer.hpp" #include "ArduinoJson/JsonArray.hpp" #include "ArduinoJson/JsonObject.hpp" diff --git a/src/ArduinoJson/version.hpp b/src/ArduinoJson/version.hpp new file mode 100644 index 00000000..6d2870fb --- /dev/null +++ b/src/ArduinoJson/version.hpp @@ -0,0 +1,10 @@ +// ArduinoJson - arduinojson.org +// Copyright Benoit Blanchon 2014-2018 +// MIT License + +#pragma once + +#define ARDUINOJSON_VERSION "5.13.1" +#define ARDUINOJSON_VERSION_MAJOR 5 +#define ARDUINOJSON_VERSION_MINOR 13 +#define ARDUINOJSON_VERSION_REVISION 1 diff --git a/test/Misc/CMakeLists.txt b/test/Misc/CMakeLists.txt index 0b54bd7b..56bbd5c3 100644 --- a/test/Misc/CMakeLists.txt +++ b/test/Misc/CMakeLists.txt @@ -11,6 +11,7 @@ add_executable(MiscTests StringTraits.cpp TypeTraits.cpp unsigned_char.cpp + version.cpp vla.cpp ) diff --git a/test/Misc/version.cpp b/test/Misc/version.cpp new file mode 100644 index 00000000..a9bbbe72 --- /dev/null +++ b/test/Misc/version.cpp @@ -0,0 +1,16 @@ +// ArduinoJson - arduinojson.org +// Copyright Benoit Blanchon 2014-2018 +// MIT License + +#include +#include +#include + +TEST_CASE("ARDUINOJSON_VERSION") { + std::stringstream version; + + version << ARDUINOJSON_VERSION_MAJOR << "." << ARDUINOJSON_VERSION_MINOR + << "." << ARDUINOJSON_VERSION_REVISION; + + REQUIRE(version.str() == ARDUINOJSON_VERSION); +}