mirror of
https://github.com/nlohmann/json.git
synced 2026-10-21 13:38:16 +00:00
Address review: one powers-of-ten table, literal sizes from the type
- dtoa_impl::powers_of_ten() (10^0 to 10^19, one entry per line) replaces powers_of_ten_16() and the table of int_pow10() - put_literal() takes the length of a string literal from its type - small_stack holds the heap vector by reference - the growth step of the output buffer is written in hex Signed-off-by: Niels Lohmann <mail@nlohmann.me>
This commit is contained in:
6 files changed
+95
-103
No files matched your search
@@ -874,13 +874,13 @@ TEST_CASE("short decimals")
|
||||
|
||||
SECTION("powers of ten")
|
||||
{
|
||||
const auto& powers = nlohmann::detail::dtoa_impl::powers_of_ten_16();
|
||||
std::uint64_t power = 1;
|
||||
for (const std::uint64_t p : powers)
|
||||
const auto& powers = nlohmann::detail::dtoa_impl::powers_of_ten();
|
||||
CHECK(powers.front() == 1u);
|
||||
for (std::size_t i = 1; i < powers.size(); ++i)
|
||||
{
|
||||
CHECK(p == power);
|
||||
power *= 10;
|
||||
CHECK(powers[i] == powers[i - 1] * 10u);
|
||||
}
|
||||
CHECK(powers.back() == 10000000000000000000u);
|
||||
}
|
||||
|
||||
SECTION("examples")
|
||||
|
||||
Reference in new issue
Block a user