forked from bblanchon/ArduinoJson
Test that JsonArray can store booleans
This commit is contained in:
@ -13,6 +13,15 @@ JsonValue JsonArray::operator[](int index) const
|
||||
return JsonValue();
|
||||
}
|
||||
|
||||
void JsonArray::add(bool value)
|
||||
{
|
||||
JsonNode* node = createNode(JSON_BOOLEAN);
|
||||
if (!node) return;
|
||||
|
||||
node->content.asBoolean = value;
|
||||
addChild(node);
|
||||
}
|
||||
|
||||
void JsonArray::add(char const* value)
|
||||
{
|
||||
JsonNode* node = createNode(JSON_STRING);
|
||||
|
@ -16,6 +16,7 @@ public:
|
||||
|
||||
JsonValue operator[](int index) const;
|
||||
|
||||
void add(bool value);
|
||||
void add(const char* value);
|
||||
void add(double value, int decimals=2);
|
||||
void add(int value) { add((long) value); }
|
||||
|
@ -45,7 +45,7 @@ TEST_F(JsonArray_Container_Tests, CanStoreDoubles)
|
||||
EXPECT_EQ(123.45, (double) array[0]);
|
||||
EXPECT_EQ(456.78, (double) array[1]);
|
||||
}
|
||||
/*
|
||||
|
||||
TEST_F(JsonArray_Container_Tests, CanStoreBooleans)
|
||||
{
|
||||
array.add(true);
|
||||
@ -54,7 +54,7 @@ TEST_F(JsonArray_Container_Tests, CanStoreBooleans)
|
||||
EXPECT_TRUE((bool) array[0]);
|
||||
EXPECT_FALSE((bool) array[1]);
|
||||
}
|
||||
|
||||
/*
|
||||
TEST_F(JsonArray_Container_Tests, CanStoreStrings)
|
||||
{
|
||||
array.add("h3110");
|
||||
|
Reference in New Issue
Block a user