13 return Catch::Predicate<T>(
21# define REQUIRE_DIGITS(v) REQUIRE_THAT((v), pred_count_digits((v)))
23template <
typename T,
typename U>
38 using namespace std::literals;
48 ==
"2147483647"sv.length());
50 ==
"-2147483648"sv.length());
52 for (
auto i :
kblib::range(std::numeric_limits<int>::digits - 1)) {
65 std::int32_t tens = 10;
66 for (
auto prime : {7, 71, 701, 7001, 70'001, 700'001, 7'000'003}) {
91 ==
"18446744073709551615"sv.length());
94 SECTION(
"floating-point") {
A range generator, similar to Python 3's range().
This file provides some iterators, ranges, iterator/range adapters, and operations that can be perfor...
constexpr struct kblib::nums::min_t min
constexpr struct kblib::nums::max_t max
constexpr auto to_signed(I x) -> std::make_signed_t< I >
Cast integral argument to corresponding signed type.
auto concat(F &&f, S &&... ins) -> string
Returns a string consisting of the concatenation of all arguments.
constexpr auto range(Value min, Value max, Delta step=0) -> range_t< Value, Delta >
Constructs a range from beginning, end, and step amount. The range is half-open, that is min is in th...
constexpr auto length(const CharT *str) noexcept -> std::size_t
auto to_string(Int num) -> std::string
constexpr auto count_digits(Number val) -> enable_if_t< std::is_floating_point< Number >::value, int >
Calculates the number of decimal digits needed to represent a number, plus one for negative numbers.
Provides utilities for performing common operations on strings.