| 246 | |
| 247 | // Tests fmt::detail::count_digits for integer type Int. |
| 248 | template <typename Int> void test_count_digits() { |
| 249 | for (Int i = 0; i < 10; ++i) EXPECT_EQ(1u, fmt::detail::count_digits(i)); |
| 250 | for (Int i = 1, n = 1, end = max_value<Int>() / 10; n <= end; ++i) { |
| 251 | n *= 10; |
| 252 | EXPECT_EQ(fmt::detail::count_digits(n - 1), i); |
| 253 | EXPECT_EQ(fmt::detail::count_digits(n), i + 1); |
| 254 | } |
| 255 | } |
| 256 | |
| 257 | TEST(format_impl_test, count_digits) { |
| 258 | test_count_digits<uint32_t>(); |
nothing calls this directly
no test coverage detected