2016-01-07 22:35:12 +01:00
|
|
|
// Copyright Benoit Blanchon 2014-2016
|
2015-08-10 17:22:22 +02:00
|
|
|
// MIT License
|
|
|
|
//
|
|
|
|
// Arduino JSON library
|
|
|
|
// https://github.com/bblanchon/ArduinoJson
|
2016-01-07 22:35:12 +01:00
|
|
|
// If you like this project, please add a star!
|
2015-08-10 17:22:22 +02:00
|
|
|
|
|
|
|
#include <gtest/gtest.h>
|
|
|
|
#include <limits.h> // for LONG_MAX
|
2016-02-14 16:18:13 +01:00
|
|
|
|
|
|
|
#define ARDUINOJSON_USE_LONG_LONG 0
|
|
|
|
#define ARDUINOJSON_USE_INT64 0
|
2015-08-10 17:22:22 +02:00
|
|
|
#include <ArduinoJson.h>
|
|
|
|
|
|
|
|
#define SUITE Issue90
|
|
|
|
|
|
|
|
using namespace ArduinoJson::Internals;
|
|
|
|
|
|
|
|
static const char* superLong =
|
|
|
|
"12345678901234567890123456789012345678901234567890123456789012345678901234"
|
|
|
|
"5678901234567890123456789012345678901234567890123456789012345678901234567";
|
|
|
|
|
|
|
|
static const JsonVariant variant = Unparsed(superLong);
|
|
|
|
|
|
|
|
TEST(SUITE, IsNotALong) { ASSERT_FALSE(variant.is<long>()); }
|
|
|
|
|
|
|
|
TEST(SUITE, AsLong) { ASSERT_EQ(LONG_MAX, variant.as<long>()); }
|
|
|
|
|
|
|
|
TEST(SUITE, IsAString) { ASSERT_FALSE(variant.is<const char*>()); }
|
|
|
|
|
|
|
|
TEST(SUITE, AsString) { ASSERT_STREQ(superLong, variant.as<const char*>()); }
|