JsonDeserializer: use float when the value has few digits

This commit is contained in:
Benoit Blanchon
2024-09-04 14:33:14 +02:00
parent fd6314e132
commit 1f7a3f3174
8 changed files with 163 additions and 28 deletions

View File

@@ -203,7 +203,7 @@ TEST_CASE("JsonVariant::as()") {
REQUIRE(variant.as<bool>() == true);
REQUIRE(variant.as<long>() == 4L);
REQUIRE(variant.as<double>() == 4.2);
REQUIRE(variant.as<double>() == Approx(4.2));
REQUIRE(variant.as<const char*>() == "4.2"_s);
REQUIRE(variant.as<std::string>() == "4.2"_s);
REQUIRE(variant.as<JsonString>() == "4.2");