2014-10-22 21:56:38 +02:00
|
|
|
#include <gtest/gtest.h>
|
|
|
|
#include <ArduinoJson/JsonObject.hpp>
|
|
|
|
#include <ArduinoJson/StaticJsonBuffer.hpp>
|
|
|
|
|
|
|
|
using namespace ArduinoJson;
|
|
|
|
|
|
|
|
TEST(JsonObject_Iterator_Test, SimpleTest)
|
|
|
|
{
|
|
|
|
StaticJsonBuffer<42> jsonBuffer;
|
|
|
|
|
|
|
|
JsonObject object = jsonBuffer.createObject();
|
|
|
|
object["ab"] = 12;
|
|
|
|
object["cd"] = 34;
|
|
|
|
|
|
|
|
JsonObjectIterator it = object.begin();
|
|
|
|
JsonObjectIterator end = object.end();
|
|
|
|
|
|
|
|
EXPECT_NE(end, it);
|
2014-10-22 23:32:25 +02:00
|
|
|
EXPECT_STREQ("ab", it->key());
|
|
|
|
EXPECT_EQ(12, static_cast<int>(it->value()));
|
2014-10-22 21:56:38 +02:00
|
|
|
++it;
|
|
|
|
EXPECT_NE(end, it);
|
2014-10-22 23:32:25 +02:00
|
|
|
EXPECT_STREQ("cd", it->key());
|
|
|
|
EXPECT_EQ(34, static_cast<int>(it->value()));
|
2014-10-22 21:56:38 +02:00
|
|
|
++it;
|
|
|
|
EXPECT_EQ(object.end(), it);
|
|
|
|
}
|