// Copyright Benoit Blanchon 2014-2017 // MIT License // // Arduino JSON library // https://bblanchon.github.io/ArduinoJson/ // If you like this project, please add a star! #include #include template static void run_iterator_test() { StaticJsonBuffer jsonBuffer; JsonArray &array = jsonBuffer.createArray(); array.add(12); array.add(34); TIterator it = array.begin(); TIterator end = array.end(); REQUIRE(end != it); REQUIRE(12 == it->template as()); REQUIRE(12 == static_cast(*it)); ++it; REQUIRE(end != it); REQUIRE(34 == it->template as()); REQUIRE(34 == static_cast(*it)); ++it; REQUIRE(end == it); } TEST_CASE("JsonArray::begin()/end()") { SECTION("Mutable") { run_iterator_test(); } SECTION("Const") { run_iterator_test(); } }