Line | |
---|
1 | // Copyright Benoit Blanchon 2014-2016
|
---|
2 | // MIT License
|
---|
3 | //
|
---|
4 | // Arduino JSON library
|
---|
5 | // https://github.com/bblanchon/ArduinoJson
|
---|
6 | // If you like this project, please add a star!
|
---|
7 |
|
---|
8 | #include <gtest/gtest.h>
|
---|
9 | #include <limits.h> // for LONG_MAX
|
---|
10 |
|
---|
11 | #define ARDUINOJSON_USE_LONG_LONG 0
|
---|
12 | #define ARDUINOJSON_USE_INT64 0
|
---|
13 | #include <ArduinoJson.h>
|
---|
14 |
|
---|
15 | #define SUITE Issue90
|
---|
16 |
|
---|
17 | using namespace ArduinoJson::Internals;
|
---|
18 |
|
---|
19 | static const char* superLong =
|
---|
20 | "12345678901234567890123456789012345678901234567890123456789012345678901234"
|
---|
21 | "5678901234567890123456789012345678901234567890123456789012345678901234567";
|
---|
22 |
|
---|
23 | static const JsonVariant variant = Unparsed(superLong);
|
---|
24 |
|
---|
25 | TEST(SUITE, IsNotALong) { ASSERT_FALSE(variant.is<long>()); }
|
---|
26 |
|
---|
27 | TEST(SUITE, AsLong) { ASSERT_EQ(LONG_MAX, variant.as<long>()); }
|
---|
28 |
|
---|
29 | TEST(SUITE, IsAString) { ASSERT_FALSE(variant.is<const char*>()); }
|
---|
30 |
|
---|
31 | TEST(SUITE, AsString) { ASSERT_STREQ(superLong, variant.as<const char*>()); }
|
---|
Note:
See
TracBrowser
for help on using the repository browser.