get.cpp 655 B

1234567891011121314151617181920212223242526
  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 <gtest/gtest.h>
  9. class JsonObject_Get_Tests : public ::testing::Test {
  10. public:
  11. JsonObject_Get_Tests() : _object(_jsonBuffer.createObject()) {}
  12. protected:
  13. DynamicJsonBuffer _jsonBuffer;
  14. JsonObject& _object;
  15. };
  16. #define TEST_(name) TEST_F(JsonObject_Get_Tests, name)
  17. TEST_(GetConstCharPointer_GivenStringLiteral) {
  18. _object.set("hello", "world");
  19. const char* value = _object.get<const char*>("hello");
  20. EXPECT_STREQ("world", value);
  21. }