parseNumber.cpp 535 B

123456789101112131415161718
  1. // ArduinoJson - arduinojson.org
  2. // Copyright Benoit Blanchon 2014-2019
  3. // MIT License
  4. #include <ArduinoJson/Numbers/parseNumber.hpp>
  5. #include <catch.hpp>
  6. using namespace ARDUINOJSON_NAMESPACE;
  7. TEST_CASE("Test uint32_t overflow") {
  8. ParsedNumber<float, uint32_t> first =
  9. parseNumber<float, uint32_t>("4294967295");
  10. ParsedNumber<float, uint32_t> second =
  11. parseNumber<float, uint32_t>("4294967296");
  12. REQUIRE(first.type() == uint8_t(VALUE_IS_POSITIVE_INTEGER));
  13. REQUIRE(second.type() == uint8_t(VALUE_IS_FLOAT));
  14. }