mirror of
https://github.com/nlohmann/json.git
synced 2026-02-22 19:36:26 +00:00
🚑 fix for #1021
This commit is contained in:
@@ -114,6 +114,13 @@ struct nocopy
|
||||
};
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////////////////////
|
||||
// for #1021
|
||||
/////////////////////////////////////////////////////////////////////
|
||||
|
||||
using float_json = nlohmann::basic_json<std::map, std::vector, std::string, bool, std::int32_t, std::uint32_t, float>;
|
||||
|
||||
|
||||
TEST_CASE("regression tests")
|
||||
{
|
||||
SECTION("issue #60 - Double quotation mark is not parsed correctly")
|
||||
@@ -1597,4 +1604,15 @@ TEST_CASE("regression tests")
|
||||
auto j = json::parse(geojsonExample, cb, true);
|
||||
CHECK(j == json());
|
||||
}
|
||||
|
||||
SECTION("issue #1021 - to/from_msgpack only works with standard typization")
|
||||
{
|
||||
float_json j = 1000.0;
|
||||
CHECK(float_json::from_cbor(float_json::to_cbor(j)) == j);
|
||||
CHECK(float_json::from_msgpack(float_json::to_msgpack(j)) == j);
|
||||
CHECK(float_json::from_ubjson(float_json::to_ubjson(j)) == j);
|
||||
|
||||
float_json j2 = {1000.0, 2000.0, 3000.0};
|
||||
CHECK(float_json::from_ubjson(float_json::to_ubjson(j2, true, true)) == j2);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user