Skip to content

Commit

Permalink
Expose JsonFloat, JsonInteger, and JsonUInt
Browse files Browse the repository at this point in the history
  • Loading branch information
bblanchon committed Oct 2, 2018
1 parent d526369 commit 8cd3986
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
3 changes: 3 additions & 0 deletions src/ArduinoJson.hpp
Expand Up @@ -29,7 +29,10 @@ namespace ArduinoJson {
using ARDUINOJSON_NAMESPACE::DeserializationError;
using ARDUINOJSON_NAMESPACE::DynamicJsonDocument;
using ARDUINOJSON_NAMESPACE::JsonArray;
using ARDUINOJSON_NAMESPACE::JsonFloat;
using ARDUINOJSON_NAMESPACE::JsonInteger;
using ARDUINOJSON_NAMESPACE::JsonObject;
using ARDUINOJSON_NAMESPACE::JsonUInt;
using ARDUINOJSON_NAMESPACE::JsonVariant;
using ARDUINOJSON_NAMESPACE::serialized;
using ARDUINOJSON_NAMESPACE::StaticJsonDocument;
Expand Down
10 changes: 6 additions & 4 deletions test/JsonDeserializer/deserializeJsonValue.cpp
Expand Up @@ -7,8 +7,10 @@

using namespace Catch::Matchers;

namespace my {
using ARDUINOJSON_NAMESPACE::isinf;
using ARDUINOJSON_NAMESPACE::isnan;
}

TEST_CASE("deserializeJson(DynamicJsonDocument&)") {
DynamicJsonDocument doc;
Expand Down Expand Up @@ -102,28 +104,28 @@ TEST_CASE("deserializeJson(DynamicJsonDocument&)") {
DeserializationError err = deserializeJson(doc, "NaN");
REQUIRE(err == DeserializationError::Ok);
REQUIRE(doc.is<float>() == true);
REQUIRE(isnan(doc.as<float>()));
REQUIRE(my::isnan(doc.as<float>()));
}

SECTION("Infinity") {
DeserializationError err = deserializeJson(doc, "Infinity");
REQUIRE(err == DeserializationError::Ok);
REQUIRE(doc.is<float>() == true);
REQUIRE(isinf(doc.as<float>()));
REQUIRE(my::isinf(doc.as<float>()));
}

SECTION("+Infinity") {
DeserializationError err = deserializeJson(doc, "+Infinity");
REQUIRE(err == DeserializationError::Ok);
REQUIRE(doc.is<float>() == true);
REQUIRE(isinf(doc.as<float>()));
REQUIRE(my::isinf(doc.as<float>()));
}

SECTION("-Infinity") {
DeserializationError err = deserializeJson(doc, "-Infinity");
REQUIRE(err == DeserializationError::Ok);
REQUIRE(doc.is<float>() == true);
REQUIRE(isinf(doc.as<float>()));
REQUIRE(my::isinf(doc.as<float>()));
}

SECTION("issue #628") {
Expand Down

0 comments on commit 8cd3986

Please sign in to comment.