Преглед изворни кода

Added macros `ARDUINOJSON_VERSION`, `ARDUINOJSON_VERSION_MAJOR`...

Benoit Blanchon пре 7 година
родитељ
комит
eb20ae6a3f
5 измењених фајлова са 30 додато и 0 уклоњено
  1. 1 0
      CHANGELOG.md
  2. 2 0
      src/ArduinoJson.hpp
  3. 10 0
      src/ArduinoJson/version.hpp
  4. 1 0
      test/Misc/CMakeLists.txt
  5. 16 0
      test/Misc/version.cpp

+ 1 - 0
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
 -------

+ 2 - 0
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"

+ 10 - 0
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

+ 1 - 0
test/Misc/CMakeLists.txt

@@ -11,6 +11,7 @@ add_executable(MiscTests
 	StringTraits.cpp
 	TypeTraits.cpp
 	unsigned_char.cpp
+	version.cpp
 	vla.cpp
 )
 

+ 16 - 0
test/Misc/version.cpp

@@ -0,0 +1,16 @@
+// ArduinoJson - arduinojson.org
+// Copyright Benoit Blanchon 2014-2018
+// MIT License
+
+#include <ArduinoJson/version.hpp>
+#include <catch.hpp>
+#include <sstream>
+
+TEST_CASE("ARDUINOJSON_VERSION") {
+  std::stringstream version;
+
+  version << ARDUINOJSON_VERSION_MAJOR << "." << ARDUINOJSON_VERSION_MINOR
+          << "." << ARDUINOJSON_VERSION_REVISION;
+
+  REQUIRE(version.str() == ARDUINOJSON_VERSION);
+}