mirror of
				https://github.com/eledio-devices/thirdparty-ArduinoJson.git
				synced 2025-10-31 16:14:11 +01:00 
			
		
		
		
	Update Catch library to 2.13.10 (#1820)
This commit is contained in:
		| @@ -6,6 +6,8 @@ | ||||
| #include <ArduinoJson.hpp> | ||||
| #include <catch.hpp> | ||||
|  | ||||
| #include <sstream> | ||||
|  | ||||
| using namespace ARDUINOJSON_NAMESPACE; | ||||
|  | ||||
| TEST_CASE("Reader<std::istringstream>") { | ||||
|   | ||||
| @@ -5,6 +5,8 @@ | ||||
| #include <ArduinoJson.h> | ||||
| #include <catch.hpp> | ||||
|  | ||||
| #include <sstream> | ||||
|  | ||||
| using namespace ARDUINOJSON_NAMESPACE; | ||||
|  | ||||
| class EmptyClass {}; | ||||
| @@ -19,9 +21,9 @@ TEST_CASE("Polyfills/type_traits") { | ||||
|   } | ||||
|  | ||||
|   SECTION("is_array") { | ||||
|     REQUIRE_FALSE((is_array<const char*>::value)); | ||||
|     REQUIRE((is_array<const char[]>::value)); | ||||
|     REQUIRE((is_array<const char[10]>::value)); | ||||
|     REQUIRE_FALSE(is_array<const char*>::value); | ||||
|     REQUIRE(is_array<const char[]>::value); | ||||
|     REQUIRE(is_array<const char[10]>::value); | ||||
|   } | ||||
|  | ||||
|   SECTION("is_const") { | ||||
| @@ -172,36 +174,35 @@ TEST_CASE("Polyfills/type_traits") { | ||||
|   } | ||||
|  | ||||
|   SECTION("is_convertible") { | ||||
|     CHECK((is_convertible<short, int>::value == true)); | ||||
|     CHECK((is_convertible<int, int>::value == true)); | ||||
|     CHECK((is_convertible<EmptyEnum, int>::value == true)); | ||||
|     CHECK((is_convertible<int*, int>::value == false)); | ||||
|     CHECK((is_convertible<EmptyClass, int>::value == false)); | ||||
|     CHECK(is_convertible<short, int>::value == true); | ||||
|     CHECK(is_convertible<int, int>::value == true); | ||||
|     CHECK(is_convertible<EmptyEnum, int>::value == true); | ||||
|     CHECK(is_convertible<int*, int>::value == false); | ||||
|     CHECK(is_convertible<EmptyClass, int>::value == false); | ||||
|  | ||||
|     CHECK((is_convertible<DeserializationError, JsonVariantConst>::value == | ||||
|            false)); | ||||
|     CHECK((is_convertible<JsonPair, JsonVariantConst>::value == false)); | ||||
|     CHECK((is_convertible<JsonVariant, JsonVariantConst>::value == true)); | ||||
|     CHECK((is_convertible<JsonVariantConst, JsonVariantConst>::value == true)); | ||||
|     CHECK((is_convertible<JsonArray, JsonVariantConst>::value == true)); | ||||
|     CHECK((is_convertible<ElementProxy<JsonArray>, JsonVariantConst>::value == | ||||
|            true)); | ||||
|     CHECK((is_convertible<JsonArrayConst, JsonVariantConst>::value == true)); | ||||
|     CHECK((is_convertible<JsonObject, JsonVariantConst>::value == true)); | ||||
|     CHECK((is_convertible<MemberProxy<JsonObject, const char*>, | ||||
|                           JsonVariantConst>::value == true)); | ||||
|     CHECK((is_convertible<JsonObjectConst, JsonVariantConst>::value == true)); | ||||
|     CHECK( | ||||
|         (is_convertible<DynamicJsonDocument, JsonVariantConst>::value == true)); | ||||
|     CHECK((is_convertible<StaticJsonDocument<10>, JsonVariantConst>::value == | ||||
|            true)); | ||||
|     CHECK(is_convertible<DeserializationError, JsonVariantConst>::value == | ||||
|           false); | ||||
|     CHECK(is_convertible<JsonPair, JsonVariantConst>::value == false); | ||||
|     CHECK(is_convertible<JsonVariant, JsonVariantConst>::value == true); | ||||
|     CHECK(is_convertible<JsonVariantConst, JsonVariantConst>::value == true); | ||||
|     CHECK(is_convertible<JsonArray, JsonVariantConst>::value == true); | ||||
|     CHECK(is_convertible<ElementProxy<JsonArray>, JsonVariantConst>::value == | ||||
|           true); | ||||
|     CHECK(is_convertible<JsonArrayConst, JsonVariantConst>::value == true); | ||||
|     CHECK(is_convertible<JsonObject, JsonVariantConst>::value == true); | ||||
|     CHECK(is_convertible<MemberProxy<JsonObject, const char*>, | ||||
|                          JsonVariantConst>::value == true); | ||||
|     CHECK(is_convertible<JsonObjectConst, JsonVariantConst>::value == true); | ||||
|     CHECK(is_convertible<DynamicJsonDocument, JsonVariantConst>::value == true); | ||||
|     CHECK(is_convertible<StaticJsonDocument<10>, JsonVariantConst>::value == | ||||
|           true); | ||||
|   } | ||||
|  | ||||
|   SECTION("is_class") { | ||||
|     CHECK((is_class<int>::value == false)); | ||||
|     CHECK((is_class<EmptyEnum>::value == false)); | ||||
|     CHECK((is_class<int*>::value == false)); | ||||
|     CHECK((is_class<EmptyClass>::value == true)); | ||||
|     CHECK(is_class<int>::value == false); | ||||
|     CHECK(is_class<EmptyEnum>::value == false); | ||||
|     CHECK(is_class<int*>::value == false); | ||||
|     CHECK(is_class<EmptyClass>::value == true); | ||||
|   } | ||||
|  | ||||
|   SECTION("is_enum") { | ||||
|   | ||||
| @@ -9,95 +9,89 @@ using namespace ARDUINOJSON_NAMESPACE; | ||||
|  | ||||
| TEST_CASE("arithmeticCompare()") { | ||||
|   SECTION("int vs uint8_t") { | ||||
|     CHECK((arithmeticCompare<int, uint8_t>(256, 1) == COMPARE_RESULT_GREATER)); | ||||
|     CHECK((arithmeticCompare<int, uint8_t>(41, 42) == COMPARE_RESULT_LESS)); | ||||
|     CHECK((arithmeticCompare<int, uint8_t>(42, 42) == COMPARE_RESULT_EQUAL)); | ||||
|     CHECK((arithmeticCompare<int, uint8_t>(43, 42) == COMPARE_RESULT_GREATER)); | ||||
|     CHECK(arithmeticCompare<int, uint8_t>(256, 1) == COMPARE_RESULT_GREATER); | ||||
|     CHECK(arithmeticCompare<int, uint8_t>(41, 42) == COMPARE_RESULT_LESS); | ||||
|     CHECK(arithmeticCompare<int, uint8_t>(42, 42) == COMPARE_RESULT_EQUAL); | ||||
|     CHECK(arithmeticCompare<int, uint8_t>(43, 42) == COMPARE_RESULT_GREATER); | ||||
|   } | ||||
|  | ||||
|   SECTION("unsigned vs int") { | ||||
|     CHECK((arithmeticCompare<unsigned, int>(0, -1) == COMPARE_RESULT_GREATER)); | ||||
|     CHECK((arithmeticCompare<unsigned, int>(42, 41) == COMPARE_RESULT_GREATER)); | ||||
|     CHECK((arithmeticCompare<unsigned, int>(42, 42) == COMPARE_RESULT_EQUAL)); | ||||
|     CHECK((arithmeticCompare<unsigned, int>(42, 43) == COMPARE_RESULT_LESS)); | ||||
|     CHECK(arithmeticCompare<unsigned, int>(0, -1) == COMPARE_RESULT_GREATER); | ||||
|     CHECK(arithmeticCompare<unsigned, int>(42, 41) == COMPARE_RESULT_GREATER); | ||||
|     CHECK(arithmeticCompare<unsigned, int>(42, 42) == COMPARE_RESULT_EQUAL); | ||||
|     CHECK(arithmeticCompare<unsigned, int>(42, 43) == COMPARE_RESULT_LESS); | ||||
|   } | ||||
|  | ||||
|   SECTION("float vs int") { | ||||
|     CHECK((arithmeticCompare<float, int>(42, 41) == COMPARE_RESULT_GREATER)); | ||||
|     CHECK((arithmeticCompare<float, int>(42, 42) == COMPARE_RESULT_EQUAL)); | ||||
|     CHECK((arithmeticCompare<float, int>(42, 43) == COMPARE_RESULT_LESS)); | ||||
|     CHECK(arithmeticCompare<float, int>(42, 41) == COMPARE_RESULT_GREATER); | ||||
|     CHECK(arithmeticCompare<float, int>(42, 42) == COMPARE_RESULT_EQUAL); | ||||
|     CHECK(arithmeticCompare<float, int>(42, 43) == COMPARE_RESULT_LESS); | ||||
|   } | ||||
|  | ||||
|   SECTION("int vs unsigned") { | ||||
|     CHECK((arithmeticCompare<int, unsigned>(-1, 0) == COMPARE_RESULT_LESS)); | ||||
|     CHECK((arithmeticCompare<int, unsigned>(0, 0) == COMPARE_RESULT_EQUAL)); | ||||
|     CHECK((arithmeticCompare<int, unsigned>(1, 0) == COMPARE_RESULT_GREATER)); | ||||
|     CHECK((arithmeticCompare<int, unsigned>(42, 41) == COMPARE_RESULT_GREATER)); | ||||
|     CHECK((arithmeticCompare<int, unsigned>(42, 42) == COMPARE_RESULT_EQUAL)); | ||||
|     CHECK((arithmeticCompare<int, unsigned>(42, 43) == COMPARE_RESULT_LESS)); | ||||
|     CHECK(arithmeticCompare<int, unsigned>(-1, 0) == COMPARE_RESULT_LESS); | ||||
|     CHECK(arithmeticCompare<int, unsigned>(0, 0) == COMPARE_RESULT_EQUAL); | ||||
|     CHECK(arithmeticCompare<int, unsigned>(1, 0) == COMPARE_RESULT_GREATER); | ||||
|     CHECK(arithmeticCompare<int, unsigned>(42, 41) == COMPARE_RESULT_GREATER); | ||||
|     CHECK(arithmeticCompare<int, unsigned>(42, 42) == COMPARE_RESULT_EQUAL); | ||||
|     CHECK(arithmeticCompare<int, unsigned>(42, 43) == COMPARE_RESULT_LESS); | ||||
|   } | ||||
|  | ||||
|   SECTION("unsigned vs unsigned") { | ||||
|     CHECK((arithmeticCompare<unsigned, unsigned>(42, 41) == | ||||
|            COMPARE_RESULT_GREATER)); | ||||
|     CHECK((arithmeticCompare<unsigned, unsigned>(42, 42) == | ||||
|            COMPARE_RESULT_EQUAL)); | ||||
|     CHECK( | ||||
|         (arithmeticCompare<unsigned, unsigned>(42, 43) == COMPARE_RESULT_LESS)); | ||||
|     CHECK(arithmeticCompare<unsigned, unsigned>(42, 41) == | ||||
|           COMPARE_RESULT_GREATER); | ||||
|     CHECK(arithmeticCompare<unsigned, unsigned>(42, 42) == | ||||
|           COMPARE_RESULT_EQUAL); | ||||
|     CHECK(arithmeticCompare<unsigned, unsigned>(42, 43) == COMPARE_RESULT_LESS); | ||||
|   } | ||||
|  | ||||
|   SECTION("bool vs bool") { | ||||
|     CHECK( | ||||
|         (arithmeticCompare<bool, bool>(false, false) == COMPARE_RESULT_EQUAL)); | ||||
|     CHECK((arithmeticCompare<bool, bool>(true, true) == COMPARE_RESULT_EQUAL)); | ||||
|     CHECK((arithmeticCompare<bool, bool>(false, true) == COMPARE_RESULT_LESS)); | ||||
|     CHECK( | ||||
|         (arithmeticCompare<bool, bool>(true, false) == COMPARE_RESULT_GREATER)); | ||||
|     CHECK(arithmeticCompare<bool, bool>(false, false) == COMPARE_RESULT_EQUAL); | ||||
|     CHECK(arithmeticCompare<bool, bool>(true, true) == COMPARE_RESULT_EQUAL); | ||||
|     CHECK(arithmeticCompare<bool, bool>(false, true) == COMPARE_RESULT_LESS); | ||||
|     CHECK(arithmeticCompare<bool, bool>(true, false) == COMPARE_RESULT_GREATER); | ||||
|   } | ||||
|  | ||||
|   SECTION("bool vs int") { | ||||
|     CHECK((arithmeticCompare<bool, int>(false, -1) == COMPARE_RESULT_GREATER)); | ||||
|     CHECK((arithmeticCompare<bool, int>(false, 0) == COMPARE_RESULT_EQUAL)); | ||||
|     CHECK((arithmeticCompare<bool, int>(false, 1) == COMPARE_RESULT_LESS)); | ||||
|     CHECK((arithmeticCompare<bool, int>(true, 0) == COMPARE_RESULT_GREATER)); | ||||
|     CHECK((arithmeticCompare<bool, int>(true, 1) == COMPARE_RESULT_EQUAL)); | ||||
|     CHECK((arithmeticCompare<bool, int>(true, 2) == COMPARE_RESULT_LESS)); | ||||
|     CHECK(arithmeticCompare<bool, int>(false, -1) == COMPARE_RESULT_GREATER); | ||||
|     CHECK(arithmeticCompare<bool, int>(false, 0) == COMPARE_RESULT_EQUAL); | ||||
|     CHECK(arithmeticCompare<bool, int>(false, 1) == COMPARE_RESULT_LESS); | ||||
|     CHECK(arithmeticCompare<bool, int>(true, 0) == COMPARE_RESULT_GREATER); | ||||
|     CHECK(arithmeticCompare<bool, int>(true, 1) == COMPARE_RESULT_EQUAL); | ||||
|     CHECK(arithmeticCompare<bool, int>(true, 2) == COMPARE_RESULT_LESS); | ||||
|   } | ||||
|  | ||||
|   SECTION("bool vs int") { | ||||
|     CHECK((arithmeticCompare<int, bool>(0, false) == COMPARE_RESULT_EQUAL)); | ||||
|     CHECK((arithmeticCompare<int, bool>(1, true) == COMPARE_RESULT_EQUAL)); | ||||
|     CHECK((arithmeticCompare<int, bool>(1, false) == COMPARE_RESULT_GREATER)); | ||||
|     CHECK((arithmeticCompare<int, bool>(0, true) == COMPARE_RESULT_LESS)); | ||||
|     CHECK(arithmeticCompare<int, bool>(0, false) == COMPARE_RESULT_EQUAL); | ||||
|     CHECK(arithmeticCompare<int, bool>(1, true) == COMPARE_RESULT_EQUAL); | ||||
|     CHECK(arithmeticCompare<int, bool>(1, false) == COMPARE_RESULT_GREATER); | ||||
|     CHECK(arithmeticCompare<int, bool>(0, true) == COMPARE_RESULT_LESS); | ||||
|   } | ||||
| } | ||||
|  | ||||
| TEST_CASE("arithmeticCompareNegateLeft()") { | ||||
|   SECTION("unsigned vs int") { | ||||
|     CHECK((arithmeticCompareNegateLeft<int>(0, 1) == COMPARE_RESULT_LESS)); | ||||
|     CHECK((arithmeticCompareNegateLeft<int>(42, -41) == COMPARE_RESULT_LESS)); | ||||
|     CHECK((arithmeticCompareNegateLeft<int>(42, -42) == COMPARE_RESULT_EQUAL)); | ||||
|     CHECK( | ||||
|         (arithmeticCompareNegateLeft<int>(42, -43) == COMPARE_RESULT_GREATER)); | ||||
|     CHECK(arithmeticCompareNegateLeft<int>(0, 1) == COMPARE_RESULT_LESS); | ||||
|     CHECK(arithmeticCompareNegateLeft<int>(42, -41) == COMPARE_RESULT_LESS); | ||||
|     CHECK(arithmeticCompareNegateLeft<int>(42, -42) == COMPARE_RESULT_EQUAL); | ||||
|     CHECK(arithmeticCompareNegateLeft<int>(42, -43) == COMPARE_RESULT_GREATER); | ||||
|   } | ||||
|  | ||||
|   SECTION("unsigned vs unsigned") { | ||||
|     CHECK( | ||||
|         (arithmeticCompareNegateLeft<unsigned>(42, 42) == COMPARE_RESULT_LESS)); | ||||
|     CHECK(arithmeticCompareNegateLeft<unsigned>(42, 42) == COMPARE_RESULT_LESS); | ||||
|   } | ||||
| } | ||||
|  | ||||
| TEST_CASE("arithmeticCompareNegateRight()") { | ||||
|   SECTION("int vs unsigned") { | ||||
|     CHECK((arithmeticCompareNegateRight<int>(1, 0) == COMPARE_RESULT_GREATER)); | ||||
|     CHECK( | ||||
|         (arithmeticCompareNegateRight<int>(-41, 42) == COMPARE_RESULT_GREATER)); | ||||
|     CHECK((arithmeticCompareNegateRight<int>(-42, 42) == COMPARE_RESULT_EQUAL)); | ||||
|     CHECK((arithmeticCompareNegateRight<int>(-43, 42) == COMPARE_RESULT_LESS)); | ||||
|     CHECK(arithmeticCompareNegateRight<int>(1, 0) == COMPARE_RESULT_GREATER); | ||||
|     CHECK(arithmeticCompareNegateRight<int>(-41, 42) == COMPARE_RESULT_GREATER); | ||||
|     CHECK(arithmeticCompareNegateRight<int>(-42, 42) == COMPARE_RESULT_EQUAL); | ||||
|     CHECK(arithmeticCompareNegateRight<int>(-43, 42) == COMPARE_RESULT_LESS); | ||||
|   } | ||||
|  | ||||
|   SECTION("unsigned vs unsigned") { | ||||
|     CHECK((arithmeticCompareNegateRight<unsigned>(42, 42) == | ||||
|            COMPARE_RESULT_GREATER)); | ||||
|     CHECK(arithmeticCompareNegateRight<unsigned>(42, 42) == | ||||
|           COMPARE_RESULT_GREATER); | ||||
|   } | ||||
| } | ||||
|   | ||||
		Reference in New Issue
	
	Block a user