mirror of
https://github.com/bblanchon/ArduinoJson.git
synced 2025-07-13 18:46:35 +02:00
31 lines
693 B
C++
31 lines
693 B
C++
// Copyright Benoit Blanchon 2014
|
|
// MIT License
|
|
//
|
|
// Arduino JSON library
|
|
// https://github.com/bblanchon/ArduinoJson
|
|
|
|
#include <gtest/gtest.h>
|
|
#include <ArduinoJson/JsonArray.hpp>
|
|
#include <ArduinoJson/StaticJsonBuffer.hpp>
|
|
|
|
using namespace ArduinoJson;
|
|
|
|
TEST(JsonArray_Iterator_Test, SimpleTest) {
|
|
StaticJsonBuffer<42> jsonBuffer;
|
|
|
|
JsonArray array = jsonBuffer.createArray();
|
|
array.add(12);
|
|
array.add(34);
|
|
|
|
JsonArrayIterator it = array.begin();
|
|
JsonArrayIterator end = array.end();
|
|
|
|
EXPECT_NE(end, it);
|
|
EXPECT_EQ(12, (*it).as<int>()); // TODO: use ->
|
|
++it;
|
|
EXPECT_NE(end, it);
|
|
EXPECT_EQ(34, (*it).as<int>()); // TODO: use ->
|
|
++it;
|
|
EXPECT_EQ(array.end(), it);
|
|
}
|