Test that JsonArray can store booleans

This commit is contained in:
Benoit Blanchon
2014-10-05 15:04:17 +02:00
parent 99a785179d
commit f0754aed53
3 changed files with 12 additions and 2 deletions

View File

@ -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);

View File

@ -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); }

View File

@ -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");