mirror of
https://github.com/nlohmann/json
synced 2024-11-10 14:30:08 +00:00
Add serialization unit tests for extreme integer values
This commit is contained in:
parent
70aa8a31a2
commit
8067c3ca5b
@ -189,3 +189,20 @@ TEST_CASE("serialization")
|
||||
test("[3,\"false\",false]", "[3,\\\"false\\\",false]");
|
||||
}
|
||||
}
|
||||
|
||||
TEST_CASE_TEMPLATE("serialization for extreme integer values", T, int32_t, uint32_t, int64_t, uint64_t)
|
||||
{
|
||||
SECTION("minimum")
|
||||
{
|
||||
constexpr auto minimum = (std::numeric_limits<T>::min)();
|
||||
json j = minimum;
|
||||
CHECK(j.dump() == std::to_string(minimum));
|
||||
}
|
||||
|
||||
SECTION("maximum")
|
||||
{
|
||||
constexpr auto maximum = (std::numeric_limits<T>::max)();
|
||||
json j = maximum;
|
||||
CHECK(j.dump() == std::to_string(maximum));
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user