issue772.cpp 899 B

12345678910111213141516171819202122232425262728
  1. // ArduinoJson - arduinojson.org
  2. // Copyright Benoit Blanchon 2014-2019
  3. // MIT License
  4. #include <ArduinoJson.h>
  5. #include <catch.hpp>
  6. // https://github.com/bblanchon/ArduinoJson/issues/772
  7. TEST_CASE("Issue772") {
  8. DynamicJsonDocument doc1(4096);
  9. DynamicJsonDocument doc2(4096);
  10. DeserializationError err;
  11. std::string data =
  12. "{\"state\":{\"reported\":{\"timestamp\":\"2018-07-02T09:40:12Z\","
  13. "\"mac\":\"2C3AE84FC076\",\"firmwareVersion\":\"v0.2.7-5-gf4d4d78\","
  14. "\"visibleLight\":261,\"infraRed\":255,\"ultraViolet\":0.02,"
  15. "\"Temperature\":26.63,\"Pressure\":101145.7,\"Humidity\":54.79883,"
  16. "\"Vbat\":4.171261,\"soilMoisture\":0,\"ActB\":0}}}";
  17. err = deserializeJson(doc1, data);
  18. REQUIRE(err == DeserializationError::Ok);
  19. data = "";
  20. serializeMsgPack(doc1, data);
  21. err = deserializeMsgPack(doc2, data);
  22. REQUIRE(err == DeserializationError::Ok);
  23. }