get.cpp 540 B

12345678910111213141516171819202122
  1. // Copyright Benoit Blanchon 2014-2017
  2. // MIT License
  3. //
  4. // Arduino JSON library
  5. // https://bblanchon.github.io/ArduinoJson/
  6. // If you like this project, please add a star!
  7. #include <ArduinoJson.h>
  8. #include <catch.hpp>
  9. using namespace Catch::Matchers;
  10. TEST_CASE("JsonObject::get()") {
  11. DynamicJsonBuffer jb;
  12. JsonObject& obj = jb.createObject();
  13. SECTION("GetConstCharPointer_GivenStringLiteral") {
  14. obj.set("hello", "world");
  15. const char* value = obj.get<const char*>("hello");
  16. REQUIRE_THAT(value, Equals("world"));
  17. }
  18. }