use_double_1.cpp 340 B

1234567891011121314151617
  1. #define ARDUINOJSON_USE_DOUBLE 1
  2. #include <ArduinoJson.h>
  3. #include <catch.hpp>
  4. TEST_CASE("ARDUINOJSON_USE_DOUBLE == 1") {
  5. DynamicJsonDocument doc(4096);
  6. JsonObject root = doc.to<JsonObject>();
  7. root["pi"] = 3.14;
  8. root["e"] = 2.72;
  9. std::string json;
  10. serializeJson(doc, json);
  11. REQUIRE(json == "{\"pi\":3.14,\"e\":2.72}");
  12. }