Skip to content

Commit

Permalink
Add serialization unit tests for extreme integer values
Browse files Browse the repository at this point in the history
  • Loading branch information
t-b committed Aug 26, 2019
1 parent 2d78820 commit 8ed16e2
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions test/src/unit-serialization.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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")
{
static constexpr auto minimum = (std::numeric_limits<T>::min)();
json j = minimum;
CHECK(j.dump() == std::to_string(minimum));
}

SECTION("maximum")
{
static constexpr auto maximum = (std::numeric_limits<T>::max)();
json j = maximum;
CHECK(j.dump() == std::to_string(maximum));
}
}

0 comments on commit 8ed16e2

Please sign in to comment.