forked from bblanchon/ArduinoJson
Fixed bug in JsonObject::begin() and end()
This commit is contained in:
@ -7,28 +7,26 @@ using namespace ArduinoJson::Parser;
|
||||
|
||||
namespace JsonParserTests
|
||||
{
|
||||
TEST_CLASS(JsonObjectIteratorTests)
|
||||
{
|
||||
public:
|
||||
TEST_CLASS(JsonArrayIteratorTests)
|
||||
{
|
||||
public:
|
||||
|
||||
TEST_METHOD(ThreeIntegers)
|
||||
{
|
||||
char json [] = "[1,2,3]";
|
||||
long expected [] = { 1, 2, 3 };
|
||||
JsonParser<4> parser;
|
||||
|
||||
TEST_METHOD(ThreeStrings)
|
||||
{
|
||||
char json [] = "{\"key1\":\"value1\",\"key2\":\"value2\",\"key3\":\"value3\"}";
|
||||
char* expectedKeys [] = { "key1", "key2", "key3" };
|
||||
char* expectedValues [] = { "value1", "value2", "value3" };
|
||||
JsonParser<7> parser;
|
||||
|
||||
JsonHashTable a = parser.parse(json);
|
||||
JsonValue v = parser.parse(json);
|
||||
JsonArray a = (ArduinoJson::Parser::JsonArray)v;
|
||||
|
||||
int index = 0;
|
||||
|
||||
for (auto i : a)
|
||||
for (long i : a)
|
||||
{
|
||||
Assert::AreEqual(expectedKeys[index], i.key());
|
||||
Assert::AreEqual(expectedValues[index], (const char*) i.value());
|
||||
index++;
|
||||
Assert::AreEqual(expected[index++], i);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
};
|
||||
};
|
||||
}
|
Reference in New Issue
Block a user