MCPcopy Create free account
hub / github.com/fmtlib/fmt / test_count_digits

Function test_count_digits

test/format-impl-test.cc:248–255  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

246
247// Tests fmt::detail::count_digits for integer type Int.
248template <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
257TEST(format_impl_test, count_digits) {
258 test_count_digits<uint32_t>();

Callers

nothing calls this directly

Calls 1

count_digitsFunction · 0.85

Tested by

no test coverage detected