JayBeams  0.1
Another project to have fun coding.
ut_static_digits.cpp
Go to the documentation of this file.
2 
3 #include <boost/test/unit_test.hpp>
4 
5 /**
6  * @test Verify that jb::itch5::static_digits works as expected.
7  */
9  BOOST_CHECK_EQUAL(jb::itch5::static_digits(0), 1);
10  BOOST_CHECK_EQUAL(jb::itch5::static_digits(5), 1);
11  BOOST_CHECK_EQUAL(jb::itch5::static_digits(9), 1);
12  BOOST_CHECK_EQUAL(jb::itch5::static_digits(10), 2);
13  BOOST_CHECK_EQUAL(jb::itch5::static_digits(99), 2);
14  BOOST_CHECK_EQUAL(jb::itch5::static_digits(1000), 4);
15  BOOST_CHECK_EQUAL(jb::itch5::static_digits(5000000), 7);
16 }
constexpr int static_digits(std::intmax_t value)
Compute (at compile time if possible) the number of digits in a number.
BOOST_AUTO_TEST_CASE(static_digits)