mirror of
https://github.com/eledio-devices/thirdparty-ArduinoJson.git
synced 2025-11-02 00:38:26 +01:00
Fix build on Visual Studio 2010, 2012, MinGW32 and GCC 5
This commit is contained in:
@@ -5,8 +5,8 @@
|
||||
// https://github.com/bblanchon/ArduinoJson
|
||||
// If you like this project, please add a star!
|
||||
|
||||
#include <gtest/gtest.h>
|
||||
#include <ArduinoJson.h>
|
||||
#include <gtest/gtest.h>
|
||||
#include <stdint.h>
|
||||
|
||||
class JsonArray_Subscript_Tests : public ::testing::Test {
|
||||
@@ -33,12 +33,14 @@ TEST_(StoreInteger) {
|
||||
EXPECT_FALSE(_array[0].is<double>());
|
||||
}
|
||||
|
||||
TEST_(StoreInt64) {
|
||||
#if ARDUINOJSON_USE_LONG_LONG || ARDUINOJSON_USE_INT64
|
||||
TEST_(StoreLongLong) {
|
||||
_array[0] = 9223372036854775807;
|
||||
EXPECT_EQ(9223372036854775807, _array[0].as<int64_t>());
|
||||
EXPECT_EQ(9223372036854775807, _array[0].as<long long>());
|
||||
EXPECT_TRUE(_array[0].is<int>());
|
||||
EXPECT_FALSE(_array[0].is<double>());
|
||||
}
|
||||
#endif
|
||||
|
||||
TEST_(StoreDouble) {
|
||||
_array[0] = 123.45;
|
||||
|
||||
@@ -5,9 +5,9 @@
|
||||
// https://github.com/bblanchon/ArduinoJson
|
||||
// If you like this project, please add a star!
|
||||
|
||||
#include <gtest/gtest.h>
|
||||
#include <ArduinoJson.h>
|
||||
|
||||
#include <gtest/gtest.h>
|
||||
#include <stdint.h>
|
||||
|
||||
static const char* null = 0;
|
||||
@@ -137,15 +137,17 @@ TEST(JsonVariant_As_Tests, NumberStringAsLong) {
|
||||
ASSERT_EQ(42L, variant.as<long>());
|
||||
}
|
||||
|
||||
#if ARDUINOJSON_USE_LONG_LONG || ARDUINOJSON_USE_INT64
|
||||
TEST(JsonVariant_As_Tests, NumberStringAsInt64Negative) {
|
||||
JsonVariant variant = "-9223372036854775808";
|
||||
ASSERT_EQ(-9223372036854775807 - 1, variant.as<int64_t>());
|
||||
ASSERT_EQ(-9223372036854775807 - 1, variant.as<long long>());
|
||||
}
|
||||
|
||||
TEST(JsonVariant_As_Tests, NumberStringAsInt64Positive) {
|
||||
JsonVariant variant = "9223372036854775807";
|
||||
ASSERT_EQ(9223372036854775807, variant.as<int64_t>());
|
||||
ASSERT_EQ(9223372036854775807, variant.as<long long>());
|
||||
}
|
||||
#endif
|
||||
|
||||
TEST(JsonVariant_As_Tests, RandomStringAsBool) {
|
||||
JsonVariant variant = "hello";
|
||||
|
||||
@@ -72,6 +72,7 @@ TEST_F(JsonVariant_PrintTo_Tests, OneFalse) {
|
||||
outputMustBe("false");
|
||||
}
|
||||
|
||||
#if ARDUINOJSON_USE_LONG_LONG || ARDUINOJSON_USE_INT64
|
||||
TEST_F(JsonVariant_PrintTo_Tests, NegativeInt64) {
|
||||
variant = -9223372036854775807 - 1;
|
||||
outputMustBe("-9223372036854775808");
|
||||
@@ -81,3 +82,4 @@ TEST_F(JsonVariant_PrintTo_Tests, PositiveInt64) {
|
||||
variant = 9223372036854775807;
|
||||
outputMustBe("9223372036854775807");
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -5,9 +5,9 @@
|
||||
// https://github.com/bblanchon/ArduinoJson
|
||||
// If you like this project, please add a star!
|
||||
|
||||
#include <gtest/gtest.h>
|
||||
#include <stdint.h>
|
||||
#include <limits>
|
||||
#include <gtest/gtest.h>
|
||||
#include <ArduinoJson.h>
|
||||
|
||||
class JsonVariant_Storage_Tests : public ::testing::Test {
|
||||
@@ -37,9 +37,11 @@ class JsonVariant_Storage_Tests : public ::testing::Test {
|
||||
}
|
||||
};
|
||||
|
||||
#if ARDUINOJSON_USE_LONG_LONG || ARDUINOJSON_USE_INT64
|
||||
TEST_F(JsonVariant_Storage_Tests, SizeOfJsonInteger) {
|
||||
ASSERT_EQ(8, sizeof(Internals::JsonInteger));
|
||||
}
|
||||
#endif
|
||||
|
||||
TEST_F(JsonVariant_Storage_Tests, Null) { testValue<const char *>(NULL); }
|
||||
TEST_F(JsonVariant_Storage_Tests, String) { testValue<const char *>("hello"); }
|
||||
@@ -57,15 +59,21 @@ TEST_F(JsonVariant_Storage_Tests, UChar) { testNumericType<unsigned char>(); }
|
||||
TEST_F(JsonVariant_Storage_Tests, UInt) { testNumericType<unsigned int>(); }
|
||||
TEST_F(JsonVariant_Storage_Tests, ULong) { testNumericType<unsigned long>(); }
|
||||
TEST_F(JsonVariant_Storage_Tests, UShort) { testNumericType<unsigned short>(); }
|
||||
#if ARDUINOJSON_USE_LONG_LONG || ARDUINOJSON_USE_INT64
|
||||
TEST_F(JsonVariant_Storage_Tests, LongLong) { testNumericType<unsigned long long>(); }
|
||||
TEST_F(JsonVariant_Storage_Tests, ULongLong) { testNumericType<unsigned long long>(); }
|
||||
#endif
|
||||
|
||||
TEST_F(JsonVariant_Storage_Tests, Int8) { testNumericType<int8_t>(); }
|
||||
TEST_F(JsonVariant_Storage_Tests, Int16) { testNumericType<int16_t>(); }
|
||||
TEST_F(JsonVariant_Storage_Tests, Int32) { testNumericType<int32_t>(); }
|
||||
TEST_F(JsonVariant_Storage_Tests, Int64) { testNumericType<int64_t>(); }
|
||||
TEST_F(JsonVariant_Storage_Tests, Uint8) { testNumericType<uint8_t>(); }
|
||||
TEST_F(JsonVariant_Storage_Tests, Int16) { testNumericType<int16_t>(); }
|
||||
TEST_F(JsonVariant_Storage_Tests, Uint16) { testNumericType<uint16_t>(); }
|
||||
TEST_F(JsonVariant_Storage_Tests, Int32) { testNumericType<int32_t>(); }
|
||||
TEST_F(JsonVariant_Storage_Tests, Uint32) { testNumericType<uint32_t>(); }
|
||||
#if ARDUINOJSON_USE_LONG_LONG || ARDUINOJSON_USE_INT64
|
||||
TEST_F(JsonVariant_Storage_Tests, Int64) { testNumericType<int64_t>(); }
|
||||
TEST_F(JsonVariant_Storage_Tests, Uint64) { testNumericType<uint64_t>(); }
|
||||
#endif
|
||||
|
||||
TEST_F(JsonVariant_Storage_Tests, CanStoreObject) {
|
||||
DynamicJsonBuffer jsonBuffer;
|
||||
|
||||
Reference in New Issue
Block a user