forked from bblanchon/ArduinoJson
Parse long values
This commit is contained in:
@ -92,11 +92,14 @@ TEST_F(JsonArray_Container_Tests, CanStoreBooleans)
|
||||
|
||||
TEST_F(JsonArray_Container_Tests, CanStoreStrings)
|
||||
{
|
||||
array.add("h3110");
|
||||
array.add("w0r1d");
|
||||
const char* firstString = "h3110";
|
||||
const char* secondString = "w0r1d";
|
||||
|
||||
firstElementMustBe("h3110");
|
||||
secondElementMustBe("w0r1d");
|
||||
array.add(firstString);
|
||||
array.add(secondString);
|
||||
|
||||
firstElementMustBe(firstString);
|
||||
secondElementMustBe(secondString);
|
||||
nodeCountMustBe(3);
|
||||
}
|
||||
|
||||
|
@ -1,5 +1,6 @@
|
||||
#include <gtest/gtest.h>
|
||||
#include <StaticJsonBuffer.h>
|
||||
#include <JsonValue.h>
|
||||
|
||||
class JsonArray_Parser_Tests : public testing::Test
|
||||
{
|
||||
@ -29,4 +30,13 @@ TEST_F(JsonArray_Parser_Tests, Garbage)
|
||||
|
||||
EXPECT_FALSE(array.success());
|
||||
EXPECT_EQ(0, array.size());
|
||||
}
|
||||
|
||||
TEST_F(JsonArray_Parser_Tests, OneInteger)
|
||||
{
|
||||
JsonArray array = json.parseArray("[42]");
|
||||
|
||||
EXPECT_TRUE(array.success());
|
||||
EXPECT_EQ(1, array.size());
|
||||
EXPECT_EQ(42, static_cast<int>(array[0]));
|
||||
}
|
Reference in New Issue
Block a user