forked from bblanchon/ArduinoJson
Added support of long long
(issue #171)
Moved all build settings to `ArduinoJson/Configuration.hpp` Added AppVeyor settings in source tree
This commit is contained in:
@ -5,10 +5,11 @@
|
||||
// https://github.com/bblanchon/ArduinoJson
|
||||
// If you like this project, please add a star!
|
||||
|
||||
#include <gtest/gtest.h>
|
||||
#define ARDUINOJSON_ENABLE_STD_STREAM
|
||||
#include <ArduinoJson.h>
|
||||
|
||||
#include <gtest/gtest.h>
|
||||
#include <stdint.h>
|
||||
|
||||
static const char* null = 0;
|
||||
|
||||
TEST(JsonVariant_As_Tests, DoubleAsBool) {
|
||||
@ -136,6 +137,18 @@ 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<long long>());
|
||||
}
|
||||
|
||||
TEST(JsonVariant_As_Tests, NumberStringAsInt64Positive) {
|
||||
JsonVariant variant = "9223372036854775807";
|
||||
ASSERT_EQ(9223372036854775807, variant.as<long long>());
|
||||
}
|
||||
#endif
|
||||
|
||||
TEST(JsonVariant_As_Tests, RandomStringAsBool) {
|
||||
JsonVariant variant = "hello";
|
||||
ASSERT_FALSE(variant.as<bool>());
|
||||
|
Reference in New Issue
Block a user