mirror of
https://github.com/gabime/spdlog.git
synced 2025-09-30 02:19:35 +08:00
Optimized nano seconds formatting
This commit is contained in:
@@ -22,6 +22,13 @@ void test_pad6(std::size_t n, const char *expected)
|
||||
REQUIRE(fmt::to_string(buf) == expected);
|
||||
}
|
||||
|
||||
void test_pad9(std::size_t n, const char *expected)
|
||||
{
|
||||
fmt::memory_buffer buf;
|
||||
spdlog::details::fmt_helper::pad9(n, buf);
|
||||
REQUIRE(fmt::to_string(buf) == expected);
|
||||
}
|
||||
|
||||
TEST_CASE("pad2", "[fmt_helper]")
|
||||
{
|
||||
test_pad2(0, "00");
|
||||
@@ -52,3 +59,19 @@ TEST_CASE("pad6", "[fmt_helper]")
|
||||
test_pad6(12345, "012345");
|
||||
test_pad6(123456, "123456");
|
||||
}
|
||||
|
||||
|
||||
TEST_CASE("pad9", "[fmt_helper]")
|
||||
{
|
||||
test_pad9(0,"000000000");
|
||||
test_pad9(3, "000000003");
|
||||
test_pad9(23, "000000023");
|
||||
test_pad9(123, "000000123");
|
||||
test_pad9(1234, "000001234");
|
||||
test_pad9(12345, "000012345");
|
||||
test_pad9(123456, "000123456");
|
||||
test_pad9(1234567, "001234567");
|
||||
test_pad9(12345678, "012345678");
|
||||
test_pad9(123456789, "123456789");
|
||||
test_pad9(1234567891, "1234567891");
|
||||
}
|
||||
|
Reference in New Issue
Block a user