8#include <boost/test/unit_test.hpp>
17template <
unsigned NumArgs>
20 std::apply([&](
auto...
args) {
22 }, std::array<int, NumArgs>{});
27template <
unsigned NumArgs>
39template <
unsigned WrongNumArgs>
92 auto err_mix{
"Format specifiers must be all positional or all non-positional!"};
99 auto err_num{
"Format specifier count must match the argument count!"};
107 auto err_0_pos{
"Positional format specifier must have position of at least 1"};
117 auto err_term{
"Format specifier incorrectly terminated by end of string"};
135 HasReason{
"tinyformat: %n conversion spec not supported"});
137 HasReason{
"tinyformat: Cannot convert from argument type to integer for use as variable width or precision"});
139 HasReason{
"tinyformat: Cannot convert from argument type to integer for use as variable width or precision"});
146 HasReason{
"tinyformat: Not enough conversion specifiers in format string"});
148 HasReason{
"tinyformat: Too many conversion specifiers in format string"});
178 std::string_view input =
"once upon a time\n there was a dog \r\nwho liked food\n";
203 std::string_view input =
"once upon a time there\nwas a dog who liked tea\n";
221 std::string_view input =
"\n";
228 std::string_view input;
234 std::string_view input =
"\r\r\n";
241 std::string_view input =
"ab\n";
247 std::string_view input =
"a\nb\n";
255 std::string_view input =
"a\nbaboon\n";
271 std::string_view input =
"once upon a time there";
283 std::string_view input =
"once upon a time\n there was a dog \r\nwho liked food";
BOOST_CHECK_EXCEPTION predicates to check the specific validation error.
size_t Consumed() const
Returns number of bytes already read from buffer.
std::optional< std::string_view > ReadLine() LIFETIMEBOUND
Returns a string from current iterator position up to (but not including) next and advances iterator...
size_t Remaining() const
Returns remaining size of bytes in buffer.
std::string_view ReadLength(size_t len) LIFETIMEBOUND
Returns string from current iterator position of specified length if possible and advances iterator o...
BOOST_AUTO_TEST_SUITE_END()
BOOST_CHECK_EXCEPTION(HTTPHeaders{}.Read(reader), std::runtime_error, HasReason{"Empty HTTP header name"})
constexpr void CheckNumFormatSpecifiers(const char *str)
#define BOOST_CHECK_EQUAL(v1, v2)
#define BOOST_CHECK_NO_THROW(stmt)
#define BOOST_CHECK(expr)
bool CaseInsensitiveEqual(std::string_view s1, std::string_view s2)
Locale-independent, ASCII-only comparator.
constexpr auto Ticks(Dur2 d)
Helper to count the seconds of a duration/time_point.
BOOST_AUTO_TEST_CASE(ConstevalFormatString_NumSpec)
void TfmFormatZeroes(const std::string &fmt)
void PassFmt(ConstevalFormatString< NumArgs > fmt)
void FailFmtWithError(const char *wrong_fmt, std::string_view error)