Improves both the compile-time and run-time errors.
At compile-time it does a bit more work to get more specific errors.
This could be done at run-time too, but that has a performance penalty.
Since it's expected most use-cases use format* instead of vformat* the
compile-time errors are more common.
For example when using
std::format_to("{:-c}", 42);
Before compile output would contain
std::__throw_format_error("The format-spec should consume the input or end with a '}'");
Now it contains
std::__throw_format_error("The format specifier does not allow the sign option");
Given a better indication the sign option is not allowed. Note the
output is still not user-friendly; C++ doesn't have good facilities to
generate nice messages from the library.
In general all messages have been reviewed and improved, using a more
consistent style and using less terms used in the standard. For example
format-spec -> format specifier
arg-id -> argument index
Reviewed By: #libc, ldionne
Differential Revision: https://reviews.llvm.org/D152624
} else {
// Test __weekday_name_ before __weekday_ to give a better error.
if (__specs.__chrono_.__weekday_name_ && !__formatter::__weekday_name_ok(__value))
- std::__throw_format_error("formatting a weekday name needs a valid weekday");
+ std::__throw_format_error("Formatting a weekday name needs a valid weekday");
if (__specs.__chrono_.__weekday_ && !__formatter::__weekday_ok(__value))
- std::__throw_format_error("formatting a weekday needs a valid weekday");
+ std::__throw_format_error("Formatting a weekday needs a valid weekday");
if (__specs.__chrono_.__day_of_year_ && !__formatter::__date_ok(__value))
- std::__throw_format_error("formatting a day of year needs a valid date");
+ std::__throw_format_error("Formatting a day of year needs a valid date");
if (__specs.__chrono_.__week_of_year_ && !__formatter::__date_ok(__value))
- std::__throw_format_error("formatting a week of year needs a valid date");
+ std::__throw_format_error("Formatting a week of year needs a valid date");
if (__specs.__chrono_.__month_name_ && !__formatter::__month_name_ok(__value))
- std::__throw_format_error("formatting a month name from an invalid month number");
+ std::__throw_format_error("Formatting a month name from an invalid month number");
if constexpr (__is_hh_mm_ss<_Tp>) {
// Note this is a pedantic intepretation of the Standard. A hh_mm_ss
// - Write it as not valid,
// - or write the number of days.
if (__specs.__chrono_.__hour_ && __value.hours().count() > 23)
- std::__throw_format_error("formatting a hour needs a valid value");
+ std::__throw_format_error("Formatting a hour needs a valid value");
if (__value.is_negative())
__sstr << _CharT('-');
"undefined behavior by evaluating data not in the input");
if (*__begin != _CharT('%') && *__begin != _CharT('}'))
- std::__throw_format_error("Expected '%' or '}' in the chrono format-string");
+ std::__throw_format_error("The format specifier expects a '%' or a '}'");
do {
switch (*__begin) {
case _CharT('{'):
- std::__throw_format_error("The chrono-specs contains a '{'");
+ std::__throw_format_error("The chrono specifiers contain a '{'");
case _CharT('}'):
return __begin;
__parse_conversion_spec(_ConstIterator& __begin, _ConstIterator __end, __flags __flags) {
++__begin;
if (__begin == __end)
- std::__throw_format_error("End of input while parsing the modifier chrono conversion-spec");
+ std::__throw_format_error("End of input while parsing a conversion specifier");
switch (*__begin) {
case _CharT('n'):
_LIBCPP_HIDE_FROM_ABI constexpr __arg_t arg(size_t __id) const {
if (__id >= __size_)
- std::__throw_format_error("Argument index out of bounds");
+ std::__throw_format_error("The argument index value is too large for the number of arguments supplied");
return __args_[__id];
}
_LIBCPP_HIDE_FROM_ABI constexpr const __compile_time_handle<_CharT>& __handle(size_t __id) const {
if (__id >= __size_)
- std::__throw_format_error("Argument index out of bounds");
+ std::__throw_format_error("The argument index value is too large for the number of arguments supplied");
return __handles_[__id];
}
__parse_ctx.advance_to(__r.__last);
break;
default:
- std::__throw_format_error("The replacement field arg-id should terminate at a ':' or '}'");
+ std::__throw_format_error("The argument index should end with a ':' or a '}'");
}
if constexpr (same_as<_Ctx, __compile_time_basic_format_context<_CharT>>) {
__arg_t __type = __ctx.arg(__r.__value);
if (__type == __arg_t::__none)
- std::__throw_format_error("Argument index out of bounds");
+ std::__throw_format_error("The argument index value is too large for the number of arguments supplied");
else if (__type == __arg_t::__handle)
__ctx.__handle(__r.__value).__parse(__parse_ctx);
else if (__parse)
_VSTD::__visit_format_arg(
[&](auto __arg) {
if constexpr (same_as<decltype(__arg), monostate>)
- std::__throw_format_error("Argument index out of bounds");
+ std::__throw_format_error("The argument index value is too large for the number of arguments supplied");
else if constexpr (same_as<decltype(__arg), typename basic_format_arg<_Ctx>::handle>)
__arg.format(__parse_ctx, __ctx);
else {
if (__v > __number_max ||
(__begin != __end_input && *__begin >= _CharT('0') &&
*__begin <= _CharT('9')))
- std::__throw_format_error("The numeric value of the format-spec is too large");
+ std::__throw_format_error("The numeric value of the format specifier is too large");
__value = __v;
}
return __detail::__parse_automatic(__begin, __end, __parse_ctx);
}
if (*__begin < _CharT('0') || *__begin > _CharT('9'))
- std::__throw_format_error("The arg-id of the format-spec starts with an invalid character");
+ std::__throw_format_error("The argument index starts with an invalid character");
return __detail::__parse_manual(__begin, __end, __parse_ctx);
}
set_brackets({}, {});
++__begin;
} else
- std::__throw_format_error("The format specifier m requires a pair or a two-element tuple");
+ std::__throw_format_error("Type m requires a pair or a tuple with two elements");
}
if (__begin != __end && *__begin != _CharT('}'))
- std::__throw_format_error("The format-spec should consume the input or end with a '}'");
+ std::__throw_format_error("The format specifier should consume the input or end with a '}'");
__ctx.advance_to(__begin);
// This function is a wrapper to call the real parser. But it does the
// validation for the pre-conditions and post-conditions.
if (__begin == __end)
- std::__throw_format_error("End of input while parsing format-spec arg-id");
+ std::__throw_format_error("End of input while parsing an argument index");
__format::__parse_number_result __r = __format::__parse_arg_id(__begin, __end, __ctx);
if (__r.__last == __end || *__r.__last != _CharT('}'))
- std::__throw_format_error("Invalid arg-id");
+ std::__throw_format_error("The argument index is invalid");
++__r.__last;
return __r;
[](auto __arg) -> uint32_t {
using _Type = decltype(__arg);
if constexpr (same_as<_Type, monostate>)
- std::__throw_format_error("Argument index out of bounds");
+ std::__throw_format_error("The argument index value is too large for the number of arguments supplied");
// [format.string.std]/8
// If { arg-idopt } is used in a width or precision, the value of the
same_as<_Type, long long> || same_as<_Type, unsigned long long>) {
if constexpr (signed_integral<_Type>) {
if (__arg < 0)
- std::__throw_format_error("A format-spec arg-id replacement shouldn't have a negative value");
+ std::__throw_format_error("An argument index may not have a negative value");
}
using _CT = common_type_t<_Type, decltype(__format::__number_max)>;
if (static_cast<_CT>(__arg) > static_cast<_CT>(__format::__number_max))
- std::__throw_format_error("A format-spec arg-id replacement exceeds the maximum supported value");
+ std::__throw_format_error("The value of the argument index exceeds its maximum value");
return __arg;
} else
// The forbidden fill characters all code points formed from a single code unit, thus the
// check can be omitted when more code units are used.
if (__use_range_fill && (__fill == _CharT('{') || __fill == _CharT('}') || __fill == _CharT(':')))
- std::__throw_format_error("The format-spec range-fill field contains an invalid character");
+ std::__throw_format_error("The fill option contains an invalid value");
else if (__fill == _CharT('{') || __fill == _CharT('}'))
- std::__throw_format_error("The format-spec fill field contains an invalid character");
+ std::__throw_format_error("The fill option contains an invalid value");
}
# ifndef _LIBCPP_HAS_NO_UNICODE
__unicode::__code_point_view<_CharT> __view{__begin, __end};
__unicode::__consume_result __consumed = __view.__consume();
if (__consumed.__status != __unicode::__consume_result::__ok)
- std::__throw_format_error("The format-spec contains malformed Unicode characters");
+ std::__throw_format_error("The format specifier contains malformed Unicode characters");
if (__view.__position() < __end && __parse_alignment(*__view.__position())) {
ptrdiff_t __code_units = __view.__position() - __begin;
"undefined behavior by evaluating data not in the input");
if (__begin + 1 != __end && __parse_alignment(*(__begin + 1))) {
if (!__unicode::__is_scalar_value(*__begin))
- std::__throw_format_error("The fill character contains an invalid value");
+ std::__throw_format_error("The fill option contains an invalid value");
__validate_fill_character(*__begin, __use_range_fill);
template <contiguous_iterator _Iterator>
_LIBCPP_HIDE_FROM_ABI constexpr bool __parse_width(_Iterator& __begin, _Iterator __end, auto& __ctx) {
if (*__begin == _CharT('0'))
- std::__throw_format_error("A format-spec width field shouldn't have a leading zero");
+ std::__throw_format_error("The width option should not have a leading zero");
if (*__begin == _CharT('{')) {
__format::__parse_number_result __r = __format_spec::__parse_arg_id(++__begin, __end, __ctx);
++__begin;
if (__begin == __end)
- std::__throw_format_error("End of input while parsing format-spec precision");
+ std::__throw_format_error("End of input while parsing format specifier precision");
if (*__begin == _CharT('{')) {
__format::__parse_number_result __arg_id = __format_spec::__parse_arg_id(++__begin, __end, __ctx);
}
if (*__begin < _CharT('0') || *__begin > _CharT('9'))
- std::__throw_format_error("The format-spec precision field doesn't contain a value or arg-id");
+ std::__throw_format_error("The precision option does not contain a value or an argument index");
__format::__parse_number_result __r = __format::__parse_number(__begin, __end);
__precision_ = __r.__value;
break;
default:
- std::__throw_format_error("The format-spec type has a type not supported for a string argument");
+ std::__throw_format_error("The type option contains an invalid value for a string formatting argument");
}
}
// processed by the underlying. For example {:-} for a range in invalid,
// the sign field is not present. Without this check the underlying_ will
// get -} as input which my be valid.
- std::__throw_format_error("The format-spec should consume the input or end with a '}'");
+ std::__throw_format_error("The format specifier should consume the input or end with a '}'");
__ctx.advance_to(__begin);
__begin = __underlying_.parse(__ctx);
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
// could consume more than it should.
if (__begin != __end && *__begin != _CharT('}'))
- std::__throw_format_error("The format-spec should consume the input or end with a '}'");
+ std::__throw_format_error("The format specifier should consume the input or end with a '}'");
if (__parser_.__type_ != __format_spec::__type::__default) {
// [format.range.formatter]/6
set_separator(_LIBCPP_STATICALLY_WIDEN(_CharT, ", "));
++__begin;
} else
- std::__throw_format_error("The range-format-spec type m requires two elements for a pair or tuple");
+ std::__throw_format_error("Type m requires a pair or a tuple with two elements");
break;
case _CharT('s'):
__parser_.__type_ = __format_spec::__type::__string;
++__begin;
} else
- std::__throw_format_error("The range-format-spec type s requires formatting a character type");
+ std::__throw_format_error("Type s requires character type as formatting argument");
break;
case _CharT('?'):
++__begin;
if (__begin == __end || *__begin != _CharT('s'))
- std::__throw_format_error("The format-spec should consume the input or end with a '}'");
+ std::__throw_format_error("The format specifier should consume the input or end with a '}'");
if constexpr (same_as<_Tp, _CharT>) {
__parser_.__type_ = __format_spec::__type::__debug;
++__begin;
} else
- std::__throw_format_error("The range-format-spec type ?s requires formatting a character type");
+ std::__throw_format_error("Type ?s requires character type as formatting argument");
}
}
check(SV("__['H', 'e', 'l', 'l', 'o']___"), SV("{:_^{}}"), input, 30);
check(SV("#####['H', 'e', 'l', 'l', 'o']"), SV("{:#>{}}"), input, 30);
- check_exception("The format-spec range-fill field contains an invalid character", SV("{:}<}"), input);
- check_exception("The format-spec range-fill field contains an invalid character", SV("{:{<}"), input);
- check_exception("The format-spec range-fill field contains an invalid character", SV("{::<}"), input);
+ check_exception("The fill option contains an invalid value", SV("{:}<}"), input);
+ check_exception("The fill option contains an invalid value", SV("{:{<}"), input);
+ check_exception("The fill option contains an invalid value", SV("{::<}"), input);
// *** sign ***
- check_exception("The format-spec should consume the input or end with a '}'", SV("{:-}"), input);
- check_exception("The format-spec should consume the input or end with a '}'", SV("{:+}"), input);
- check_exception("The format-spec should consume the input or end with a '}'", SV("{: }"), input);
+ check_exception("The format specifier should consume the input or end with a '}'", SV("{:-}"), input);
+ check_exception("The format specifier should consume the input or end with a '}'", SV("{:+}"), input);
+ check_exception("The format specifier should consume the input or end with a '}'", SV("{: }"), input);
// *** alternate form ***
- check_exception("The format-spec should consume the input or end with a '}'", SV("{:#}"), input);
+ check_exception("The format specifier should consume the input or end with a '}'", SV("{:#}"), input);
// *** zero-padding ***
- check_exception("A format-spec width field shouldn't have a leading zero", SV("{:0}"), input);
+ check_exception("The width option should not have a leading zero", SV("{:0}"), input);
// *** precision ***
- check_exception("The format-spec should consume the input or end with a '}'", SV("{:.}"), input);
+ check_exception("The format specifier should consume the input or end with a '}'", SV("{:.}"), input);
// *** locale-specific form ***
- check_exception("The format-spec should consume the input or end with a '}'", SV("{:L}"), input);
+ check_exception("The format specifier should consume the input or end with a '}'", SV("{:L}"), input);
// *** n
check(SV("__'H', 'e', 'l', 'l', 'o'___"), SV("{:_^28n}"), input);
// *** type ***
- check_exception("The range-format-spec type m requires two elements for a pair or tuple", SV("{:m}"), input);
+ check_exception("Type m requires a pair or a tuple with two elements", SV("{:m}"), input);
for (std::basic_string_view<CharT> fmt : fmt_invalid_types<CharT>("s"))
- check_exception("The format-spec should consume the input or end with a '}'", fmt, input);
+ check_exception("The format specifier should consume the input or end with a '}'", fmt, input);
// ***** Only underlying has a format-spec
check(SV("[H , e , l , l , o ]"), SV("{::4}"), input);
check(SV("[_H__, _e__, _l__, _l__, _o__]"), SV("{::_^{}}"), input, 4);
check(SV("[:::H, :::e, :::l, :::l, :::o]"), SV("{:::>{}}"), input, 4);
- check_exception("The format-spec fill field contains an invalid character", SV("{::}<}"), input);
- check_exception("The format-spec fill field contains an invalid character", SV("{::{<}"), input);
+ check_exception("The fill option contains an invalid value", SV("{::}<}"), input);
+ check_exception("The fill option contains an invalid value", SV("{::{<}"), input);
// *** sign ***
check_exception("The format specifier for a character does not allow the sign option", SV("{::-}"), input);
for (std::basic_string_view<CharT> fmt : fmt_invalid_nested_types<CharT>("bBcdoxX?"))
check_exception("The type option contains an invalid value for a character formatting argument", fmt, input);
- // ***** Both have a format-spec
+ // ***** Both have a format specifier
check(SV("^^[:H, :e, :l, :l, :o]^^^"), SV("{:^^25::>2}"), input);
check(SV("^^[:H, :e, :l, :l, :o]^^^"), SV("{:^^{}::>2}"), input, 25);
check(SV("^^[:H, :e, :l, :l, :o]^^^"), SV("{:^^{}::>{}}"), input, 25, 2);
- check_exception("Argument index out of bounds", SV("{:^^{}::>2}"), input);
- check_exception("Argument index out of bounds", SV("{:^^{}::>{}}"), input, 25);
+ check_exception(
+ "The argument index value is too large for the number of arguments supplied", SV("{:^^{}::>2}"), input);
+ check_exception(
+ "The argument index value is too large for the number of arguments supplied", SV("{:^^{}::>{}}"), input, 25);
}
template <class CharT, class TestFunction, class ExceptionTest>
check(SV("_Hello__"), SV("{:_^{}s}"), input, 8);
check(SV("###Hello"), SV("{:#>{}s}"), input, 8);
- check_exception("The format-spec range-fill field contains an invalid character", SV("{:}<s}"), input);
- check_exception("The format-spec range-fill field contains an invalid character", SV("{:{<s}"), input);
- check_exception("The format-spec range-fill field contains an invalid character", SV("{::<s}"), input);
+ check_exception("The fill option contains an invalid value", SV("{:}<s}"), input);
+ check_exception("The fill option contains an invalid value", SV("{:{<s}"), input);
+ check_exception("The fill option contains an invalid value", SV("{::<s}"), input);
// *** sign ***
- check_exception("The format-spec should consume the input or end with a '}'", SV("{:-s}"), input);
- check_exception("The format-spec should consume the input or end with a '}'", SV("{:+s}"), input);
- check_exception("The format-spec should consume the input or end with a '}'", SV("{: s}"), input);
+ check_exception("The format specifier should consume the input or end with a '}'", SV("{:-s}"), input);
+ check_exception("The format specifier should consume the input or end with a '}'", SV("{:+s}"), input);
+ check_exception("The format specifier should consume the input or end with a '}'", SV("{: s}"), input);
// *** alternate form ***
- check_exception("The format-spec should consume the input or end with a '}'", SV("{:#s}"), input);
+ check_exception("The format specifier should consume the input or end with a '}'", SV("{:#s}"), input);
// *** zero-padding ***
- check_exception("A format-spec width field shouldn't have a leading zero", SV("{:0s}"), input);
+ check_exception("The width option should not have a leading zero", SV("{:0s}"), input);
// *** precision ***
- check_exception("The format-spec should consume the input or end with a '}'", SV("{:.s}"), input);
+ check_exception("The format specifier should consume the input or end with a '}'", SV("{:.s}"), input);
// *** locale-specific form ***
- check_exception("The format-spec should consume the input or end with a '}'", SV("{:Ls}"), input);
+ check_exception("The format specifier should consume the input or end with a '}'", SV("{:Ls}"), input);
// *** n
check_exception("The n option and type s can't be used together", SV("{:ns}"), input);
// *** type ***
- check_exception("The range-format-spec type m requires two elements for a pair or tuple", SV("{:m}"), input);
+ check_exception("Type m requires a pair or a tuple with two elements", SV("{:m}"), input);
// ***** Only underlying has a format-spec
check_exception("Type s and an underlying format specification can't be used together", SV("{:s:}"), input);
check(SV(R"(_"Hello"__)"), SV("{:_^{}?s}"), input, 10);
check(SV(R"(###"Hello")"), SV("{:#>{}?s}"), input, 10);
- check_exception("The format-spec range-fill field contains an invalid character", SV("{:}<?s}"), input);
- check_exception("The format-spec range-fill field contains an invalid character", SV("{:{<?s}"), input);
- check_exception("The format-spec range-fill field contains an invalid character", SV("{::<?s}"), input);
+ check_exception("The fill option contains an invalid value", SV("{:}<?s}"), input);
+ check_exception("The fill option contains an invalid value", SV("{:{<?s}"), input);
+ check_exception("The fill option contains an invalid value", SV("{::<?s}"), input);
// *** sign ***
- check_exception("The format-spec should consume the input or end with a '}'", SV("{:-?s}"), input);
- check_exception("The format-spec should consume the input or end with a '}'", SV("{:+?s}"), input);
- check_exception("The format-spec should consume the input or end with a '}'", SV("{: ?s}"), input);
+ check_exception("The format specifier should consume the input or end with a '}'", SV("{:-?s}"), input);
+ check_exception("The format specifier should consume the input or end with a '}'", SV("{:+?s}"), input);
+ check_exception("The format specifier should consume the input or end with a '}'", SV("{: ?s}"), input);
// *** alternate form ***
- check_exception("The format-spec should consume the input or end with a '}'", SV("{:#?s}"), input);
+ check_exception("The format specifier should consume the input or end with a '}'", SV("{:#?s}"), input);
// *** zero-padding ***
- check_exception("A format-spec width field shouldn't have a leading zero", SV("{:0?s}"), input);
+ check_exception("The width option should not have a leading zero", SV("{:0?s}"), input);
// *** precision ***
- check_exception("The format-spec should consume the input or end with a '}'", SV("{:.?s}"), input);
+ check_exception("The format specifier should consume the input or end with a '}'", SV("{:.?s}"), input);
// *** locale-specific form ***
- check_exception("The format-spec should consume the input or end with a '}'", SV("{:L?s}"), input);
+ check_exception("The format specifier should consume the input or end with a '}'", SV("{:L?s}"), input);
// *** n
check_exception("The n option and type ?s can't be used together", SV("{:n?s}"), input);
// *** type ***
- check_exception("The range-format-spec type m requires two elements for a pair or tuple", SV("{:m}"), input);
+ check_exception("Type m requires a pair or a tuple with two elements", SV("{:m}"), input);
// ***** Only underlying has a format-spec
check_exception("Type ?s and an underlying format specification can't be used together", SV("{:?s:}"), input);
// debug-enabled specialization.
using CharT = wchar_t;
- check_exception("The range-format-spec type s requires formatting a character type",
- SV("{:s}"),
- std::queue{input.begin(), input.end()});
- check_exception("The range-format-spec type s requires formatting a character type",
+ check_exception(
+ "Type s requires character type as formatting argument", SV("{:s}"), std::queue{input.begin(), input.end()});
+ check_exception("Type s requires character type as formatting argument",
SV("{:s}"),
std::priority_queue{input.begin(), input.end()});
- check_exception("The range-format-spec type s requires formatting a character type",
- SV("{:s}"),
- std::stack{input.begin(), input.end()});
- check_exception("The range-format-spec type ?s requires formatting a character type",
- SV("{:?s}"),
- std::queue{input.begin(), input.end()});
- check_exception("The range-format-spec type ?s requires formatting a character type",
+ check_exception(
+ "Type s requires character type as formatting argument", SV("{:s}"), std::stack{input.begin(), input.end()});
+ check_exception(
+ "Type ?s requires character type as formatting argument", SV("{:?s}"), std::queue{input.begin(), input.end()});
+ check_exception("Type ?s requires character type as formatting argument",
SV("{:?s}"),
std::priority_queue{input.begin(), input.end()});
- check_exception("The range-format-spec type ?s requires formatting a character type",
- SV("{:?s}"),
- std::stack{input.begin(), input.end()});
+ check_exception(
+ "Type ?s requires character type as formatting argument", SV("{:?s}"), std::stack{input.begin(), input.end()});
}
#endif // _LIBCPP_HAS_NO_WIDE_CHARACTERS
check(SV("__[true, true, false]___"), SV("{:_^{}}"), input, 24);
check(SV("#####[true, true, false]"), SV("{:#>{}}"), input, 24);
- check_exception("The format-spec range-fill field contains an invalid character", SV("{:}<}"), input);
- check_exception("The format-spec range-fill field contains an invalid character", SV("{:{<}"), input);
- check_exception("The format-spec range-fill field contains an invalid character", SV("{::<}"), input);
+ check_exception("The fill option contains an invalid value", SV("{:}<}"), input);
+ check_exception("The fill option contains an invalid value", SV("{:{<}"), input);
+ check_exception("The fill option contains an invalid value", SV("{::<}"), input);
// *** sign ***
- check_exception("The format-spec should consume the input or end with a '}'", SV("{:-}"), input);
- check_exception("The format-spec should consume the input or end with a '}'", SV("{:+}"), input);
- check_exception("The format-spec should consume the input or end with a '}'", SV("{: }"), input);
+ check_exception("The format specifier should consume the input or end with a '}'", SV("{:-}"), input);
+ check_exception("The format specifier should consume the input or end with a '}'", SV("{:+}"), input);
+ check_exception("The format specifier should consume the input or end with a '}'", SV("{: }"), input);
// *** alternate form ***
- check_exception("The format-spec should consume the input or end with a '}'", SV("{:#}"), input);
+ check_exception("The format specifier should consume the input or end with a '}'", SV("{:#}"), input);
// *** zero-padding ***
- check_exception("A format-spec width field shouldn't have a leading zero", SV("{:0}"), input);
+ check_exception("The width option should not have a leading zero", SV("{:0}"), input);
// *** precision ***
- check_exception("The format-spec should consume the input or end with a '}'", SV("{:.}"), input);
+ check_exception("The format specifier should consume the input or end with a '}'", SV("{:.}"), input);
// *** locale-specific form ***
- check_exception("The format-spec should consume the input or end with a '}'", SV("{:L}"), input);
+ check_exception("The format specifier should consume the input or end with a '}'", SV("{:L}"), input);
// *** n
check(SV("__true, true, false___"), SV("{:_^22n}"), input);
// *** type ***
- check_exception("The range-format-spec type m requires two elements for a pair or tuple", SV("{:m}"), input);
- check_exception("The range-format-spec type s requires formatting a character type", SV("{:s}"), input);
- check_exception("The range-format-spec type ?s requires formatting a character type", SV("{:?s}"), input);
+ check_exception("Type m requires a pair or a tuple with two elements", SV("{:m}"), input);
+ check_exception("Type s requires character type as formatting argument", SV("{:s}"), input);
+ check_exception("Type ?s requires character type as formatting argument", SV("{:?s}"), input);
for (std::basic_string_view<CharT> fmt : fmt_invalid_types<CharT>("s"))
- check_exception("The format-spec should consume the input or end with a '}'", fmt, input);
+ check_exception("The format specifier should consume the input or end with a '}'", fmt, input);
// ***** Only underlying has a format-spec
check(SV("[true , true , false ]"), SV("{::7}"), input);
check(SV("[_true__, _true__, _false_]"), SV("{::_^{}}"), input, 7);
check(SV("[:::true, :::true, ::false]"), SV("{:::>{}}"), input, 7);
- check_exception("The format-spec fill field contains an invalid character", SV("{::}<}"), input);
- check_exception("The format-spec fill field contains an invalid character", SV("{::{<}"), input);
+ check_exception("The fill option contains an invalid value", SV("{::}<}"), input);
+ check_exception("The fill option contains an invalid value", SV("{::{<}"), input);
// *** sign ***
check_exception("The format specifier for a bool does not allow the sign option", SV("{::-}"), input);
check(SV("^^[:::true, :::true, ::false]^^^"), SV("{:^^{}::>7}"), input, 32);
check(SV("^^[:::true, :::true, ::false]^^^"), SV("{:^^{}::>{}}"), input, 32, 7);
- check_exception("Argument index out of bounds", SV("{:^^{}::>5}"), input);
- check_exception("Argument index out of bounds", SV("{:^^{}::>{}}"), input, 32);
+ check_exception(
+ "The argument index value is too large for the number of arguments supplied", SV("{:^^{}::>5}"), input);
+ check_exception(
+ "The argument index value is too large for the number of arguments supplied", SV("{:^^{}::>{}}"), input, 32);
}
template <class CharT, class TestFunction, class ExceptionTest>
check(SV("__[-42, 1, 2, 42]___"), SV("{:_^{}}"), input, 20);
check(SV("#####[-42, 1, 2, 42]"), SV("{:#>{}}"), input, 20);
- check_exception("The format-spec range-fill field contains an invalid character", SV("{:}<}"), input);
- check_exception("The format-spec range-fill field contains an invalid character", SV("{:{<}"), input);
- check_exception("The format-spec range-fill field contains an invalid character", SV("{::<}"), input);
+ check_exception("The fill option contains an invalid value", SV("{:}<}"), input);
+ check_exception("The fill option contains an invalid value", SV("{:{<}"), input);
+ check_exception("The fill option contains an invalid value", SV("{::<}"), input);
// *** sign ***
- check_exception("The format-spec should consume the input or end with a '}'", SV("{:-}"), input);
- check_exception("The format-spec should consume the input or end with a '}'", SV("{:+}"), input);
- check_exception("The format-spec should consume the input or end with a '}'", SV("{: }"), input);
+ check_exception("The format specifier should consume the input or end with a '}'", SV("{:-}"), input);
+ check_exception("The format specifier should consume the input or end with a '}'", SV("{:+}"), input);
+ check_exception("The format specifier should consume the input or end with a '}'", SV("{: }"), input);
// *** alternate form ***
- check_exception("The format-spec should consume the input or end with a '}'", SV("{:#}"), input);
+ check_exception("The format specifier should consume the input or end with a '}'", SV("{:#}"), input);
// *** zero-padding ***
- check_exception("A format-spec width field shouldn't have a leading zero", SV("{:0}"), input);
+ check_exception("The width option should not have a leading zero", SV("{:0}"), input);
// *** precision ***
- check_exception("The format-spec should consume the input or end with a '}'", SV("{:.}"), input);
+ check_exception("The format specifier should consume the input or end with a '}'", SV("{:.}"), input);
// *** locale-specific form ***
- check_exception("The format-spec should consume the input or end with a '}'", SV("{:L}"), input);
+ check_exception("The format specifier should consume the input or end with a '}'", SV("{:L}"), input);
// *** n
check(SV("__-42, 1, 2, 42___"), SV("{:_^18n}"), input);
// *** type ***
- check_exception("The range-format-spec type m requires two elements for a pair or tuple", SV("{:m}"), input);
- check_exception("The range-format-spec type s requires formatting a character type", SV("{:s}"), input);
- check_exception("The range-format-spec type ?s requires formatting a character type", SV("{:?s}"), input);
+ check_exception("Type m requires a pair or a tuple with two elements", SV("{:m}"), input);
+ check_exception("Type s requires character type as formatting argument", SV("{:s}"), input);
+ check_exception("Type ?s requires character type as formatting argument", SV("{:?s}"), input);
for (std::basic_string_view<CharT> fmt : fmt_invalid_types<CharT>("s"))
- check_exception("The format-spec should consume the input or end with a '}'", fmt, input);
+ check_exception("The format specifier should consume the input or end with a '}'", fmt, input);
// ***** Only underlying has a format-spec
check(SV("[ -42, 1, 2, 42]"), SV("{::5}"), input);
check(SV("[_-42_, __1__, __2__, _42__]"), SV("{::_^{}}"), input, 5);
check(SV("[::-42, ::::1, ::::2, :::42]"), SV("{:::>{}}"), input, 5);
- check_exception("The format-spec fill field contains an invalid character", SV("{::}<}"), input);
- check_exception("The format-spec fill field contains an invalid character", SV("{::{<}"), input);
+ check_exception("The fill option contains an invalid value", SV("{::}<}"), input);
+ check_exception("The fill option contains an invalid value", SV("{::{<}"), input);
// *** sign ***
check(SV("[-42, 1, 2, 42]"), SV("{::-}"), input);
check(SV("^^[::-42, ::::1, ::::2, :::42]^^^"), SV("{:^^{}::>5}"), input, 33);
check(SV("^^[::-42, ::::1, ::::2, :::42]^^^"), SV("{:^^{}::>{}}"), input, 33, 5);
- check_exception("Argument index out of bounds", SV("{:^^{}::>5}"), input);
- check_exception("Argument index out of bounds", SV("{:^^{}::>{}}"), input, 33);
+ check_exception(
+ "The argument index value is too large for the number of arguments supplied", SV("{:^^{}::>5}"), input);
+ check_exception(
+ "The argument index value is too large for the number of arguments supplied", SV("{:^^{}::>{}}"), input, 33);
}
template <class CharT, class TestFunction, class ExceptionTest>
check(SV("__[-42.5, 0, 1.25, 42.5]___"), SV("{:_^{}}"), input, 27);
check(SV("#####[-42.5, 0, 1.25, 42.5]"), SV("{:#>{}}"), input, 27);
- check_exception("The format-spec range-fill field contains an invalid character", SV("{:}<}"), input);
- check_exception("The format-spec range-fill field contains an invalid character", SV("{:{<}"), input);
- check_exception("The format-spec range-fill field contains an invalid character", SV("{::<}"), input);
+ check_exception("The fill option contains an invalid value", SV("{:}<}"), input);
+ check_exception("The fill option contains an invalid value", SV("{:{<}"), input);
+ check_exception("The fill option contains an invalid value", SV("{::<}"), input);
// *** sign ***
- check_exception("The format-spec should consume the input or end with a '}'", SV("{:-}"), input);
- check_exception("The format-spec should consume the input or end with a '}'", SV("{:+}"), input);
- check_exception("The format-spec should consume the input or end with a '}'", SV("{: }"), input);
+ check_exception("The format specifier should consume the input or end with a '}'", SV("{:-}"), input);
+ check_exception("The format specifier should consume the input or end with a '}'", SV("{:+}"), input);
+ check_exception("The format specifier should consume the input or end with a '}'", SV("{: }"), input);
// *** alternate form ***
- check_exception("The format-spec should consume the input or end with a '}'", SV("{:#}"), input);
+ check_exception("The format specifier should consume the input or end with a '}'", SV("{:#}"), input);
// *** zero-padding ***
- check_exception("A format-spec width field shouldn't have a leading zero", SV("{:0}"), input);
+ check_exception("The width option should not have a leading zero", SV("{:0}"), input);
// *** precision ***
- check_exception("The format-spec should consume the input or end with a '}'", SV("{:.}"), input);
+ check_exception("The format specifier should consume the input or end with a '}'", SV("{:.}"), input);
// *** locale-specific form ***
- check_exception("The format-spec should consume the input or end with a '}'", SV("{:L}"), input);
+ check_exception("The format specifier should consume the input or end with a '}'", SV("{:L}"), input);
// *** n
check(SV("__-42.5, 0, 1.25, 42.5___"), SV("{:_^25n}"), input);
// *** type ***
- check_exception("The range-format-spec type m requires two elements for a pair or tuple", SV("{:m}"), input);
- check_exception("The range-format-spec type s requires formatting a character type", SV("{:s}"), input);
- check_exception("The range-format-spec type ?s requires formatting a character type", SV("{:?s}"), input);
+ check_exception("Type m requires a pair or a tuple with two elements", SV("{:m}"), input);
+ check_exception("Type s requires character type as formatting argument", SV("{:s}"), input);
+ check_exception("Type ?s requires character type as formatting argument", SV("{:?s}"), input);
for (std::basic_string_view<CharT> fmt : fmt_invalid_types<CharT>("s"))
- check_exception("The format-spec should consume the input or end with a '}'", fmt, input);
+ check_exception("The format specifier should consume the input or end with a '}'", fmt, input);
// ***** Only underlying has a format-spec
check(SV("[-42.5, 0, 1.25, 42.5]"), SV("{::5}"), input);
check(SV("[-42.5, __0__, 1.25_, 42.5_]"), SV("{::_^{}}"), input, 5);
check(SV("[-42.5, ::::0, :1.25, :42.5]"), SV("{:::>{}}"), input, 5);
- check_exception("The format-spec fill field contains an invalid character", SV("{::}<}"), input);
- check_exception("The format-spec fill field contains an invalid character", SV("{::{<}"), input);
+ check_exception("The fill option contains an invalid value", SV("{::}<}"), input);
+ check_exception("The fill option contains an invalid value", SV("{::{<}"), input);
// *** sign ***
check(SV("[-42.5, 0, 1.25, 42.5]"), SV("{::-}"), input);
check(SV("[-42, 0, 1.2, 42]"), SV("{::.{}}"), input, 2);
check(SV("[-42.500, 0.000, 1.250, 42.500]"), SV("{::.{}f}"), input, 3);
- check_exception("The format-spec precision field doesn't contain a value or arg-id", SV("{::.}"), input);
+ check_exception("The precision option does not contain a value or an argument index", SV("{::.}"), input);
// *** locale-specific form ***
check(SV("[-42.5, 0, 1.25, 42.5]"), SV("{::L}"), input); // does not require locales present
check(SV("^^[::-42, ::::0, ::1.2, :::42]^^^"), SV("{:^^{}::>{}.2}"), input, 33, 5);
check(SV("^^[::-42, ::::0, ::1.2, :::42]^^^"), SV("{:^^{}::>{}.{}}"), input, 33, 5, 2);
- check_exception("Argument index out of bounds", SV("{:^^{}::>5.2}"), input);
- check_exception("Argument index out of bounds", SV("{:^^{}::>{}.2}"), input, 33);
- check_exception("Argument index out of bounds", SV("{:^^{}::>{}.{}}"), input, 33, 5);
+ check_exception(
+ "The argument index value is too large for the number of arguments supplied", SV("{:^^{}::>5.2}"), input);
+ check_exception(
+ "The argument index value is too large for the number of arguments supplied", SV("{:^^{}::>{}.2}"), input, 33);
+ check_exception(
+ "The argument index value is too large for the number of arguments supplied",
+ SV("{:^^{}::>{}.{}}"),
+ input,
+ 33,
+ 5);
}
template <class CharT, class TestFunction, class ExceptionTest>
check(SV("__[0x0]___"), SV("{:_^{}}"), input, 10);
check(SV("#####[0x0]"), SV("{:#>{}}"), input, 10);
- check_exception("The format-spec range-fill field contains an invalid character", SV("{:}<}"), input);
- check_exception("The format-spec range-fill field contains an invalid character", SV("{:{<}"), input);
- check_exception("The format-spec range-fill field contains an invalid character", SV("{::<}"), input);
+ check_exception("The fill option contains an invalid value", SV("{:}<}"), input);
+ check_exception("The fill option contains an invalid value", SV("{:{<}"), input);
+ check_exception("The fill option contains an invalid value", SV("{::<}"), input);
// *** sign ***
- check_exception("The format-spec should consume the input or end with a '}'", SV("{:-}"), input);
+ check_exception("The format specifier should consume the input or end with a '}'", SV("{:-}"), input);
// *** alternate form ***
- check_exception("The format-spec should consume the input or end with a '}'", SV("{:#}"), input);
+ check_exception("The format specifier should consume the input or end with a '}'", SV("{:#}"), input);
// *** zero-padding ***
- check_exception("A format-spec width field shouldn't have a leading zero", SV("{:0}"), input);
+ check_exception("The width option should not have a leading zero", SV("{:0}"), input);
// *** precision ***
- check_exception("The format-spec should consume the input or end with a '}'", SV("{:.}"), input);
+ check_exception("The format specifier should consume the input or end with a '}'", SV("{:.}"), input);
// *** locale-specific form ***
- check_exception("The format-spec should consume the input or end with a '}'", SV("{:L}"), input);
+ check_exception("The format specifier should consume the input or end with a '}'", SV("{:L}"), input);
// *** n
check(SV("_0x0_"), SV("{:_^5n}"), input);
// *** type ***
- check_exception("The range-format-spec type m requires two elements for a pair or tuple", SV("{:m}"), input);
- check_exception("The range-format-spec type s requires formatting a character type", SV("{:s}"), input);
- check_exception("The range-format-spec type ?s requires formatting a character type", SV("{:?s}"), input);
+ check_exception("Type m requires a pair or a tuple with two elements", SV("{:m}"), input);
+ check_exception("Type s requires character type as formatting argument", SV("{:s}"), input);
+ check_exception("Type ?s requires character type as formatting argument", SV("{:?s}"), input);
for (std::basic_string_view<CharT> fmt : fmt_invalid_types<CharT>("s"))
- check_exception("The format-spec should consume the input or end with a '}'", fmt, input);
+ check_exception("The format specifier should consume the input or end with a '}'", fmt, input);
// ***** Only underlying has a format-spec
check(SV("[ 0x0]"), SV("{::5}"), input);
check(SV("[_0x0_]"), SV("{::_^{}}"), input, 5);
check(SV("[::0x0]"), SV("{:::>{}}"), input, 5);
- check_exception("The format-spec fill field contains an invalid character", SV("{::}<}"), input);
- check_exception("The format-spec fill field contains an invalid character", SV("{::{<}"), input);
+ check_exception("The fill option contains an invalid value", SV("{::}<}"), input);
+ check_exception("The fill option contains an invalid value", SV("{::{<}"), input);
// *** sign ***
check_exception("The format specifier should consume the input or end with a '}'", SV("{::-}"), input);
check(SV("^^[::0x0]^^^"), SV("{:^^{}::>5}"), input, 12);
check(SV("^^[::0x0]^^^"), SV("{:^^{}::>{}}"), input, 12, 5);
- check_exception("Argument index out of bounds", SV("{:^^{}::>5}"), input);
- check_exception("Argument index out of bounds", SV("{:^^{}::>{}}"), input, 12);
+ check_exception(
+ "The argument index value is too large for the number of arguments supplied", SV("{:^^{}::>5}"), input);
+ check_exception(
+ "The argument index value is too large for the number of arguments supplied", SV("{:^^{}::>{}}"), input, 12);
}
template <class CharT, class TestFunction, class ExceptionTest>
check(SV(R"(__["Hello", "world"]___)"), SV("{:_^{}}"), input, 23);
check(SV(R"(#####["Hello", "world"])"), SV("{:#>{}}"), input, 23);
- check_exception("The format-spec range-fill field contains an invalid character", SV("{:}<}"), input);
- check_exception("The format-spec range-fill field contains an invalid character", SV("{:{<}"), input);
- check_exception("The format-spec range-fill field contains an invalid character", SV("{::<}"), input);
+ check_exception("The fill option contains an invalid value", SV("{:}<}"), input);
+ check_exception("The fill option contains an invalid value", SV("{:{<}"), input);
+ check_exception("The fill option contains an invalid value", SV("{::<}"), input);
// *** sign ***
- check_exception("The format-spec should consume the input or end with a '}'", SV("{:-}"), input);
+ check_exception("The format specifier should consume the input or end with a '}'", SV("{:-}"), input);
// *** alternate form ***
- check_exception("The format-spec should consume the input or end with a '}'", SV("{:#}"), input);
+ check_exception("The format specifier should consume the input or end with a '}'", SV("{:#}"), input);
// *** zero-padding ***
- check_exception("A format-spec width field shouldn't have a leading zero", SV("{:0}"), input);
+ check_exception("The width option should not have a leading zero", SV("{:0}"), input);
// *** precision ***
- check_exception("The format-spec should consume the input or end with a '}'", SV("{:.}"), input);
+ check_exception("The format specifier should consume the input or end with a '}'", SV("{:.}"), input);
// *** locale-specific form ***
- check_exception("The format-spec should consume the input or end with a '}'", SV("{:L}"), input);
+ check_exception("The format specifier should consume the input or end with a '}'", SV("{:L}"), input);
// *** n
check(SV(R"(_"Hello", "world"_)"), SV("{:_^18n}"), input);
// *** type ***
- check_exception("The range-format-spec type m requires two elements for a pair or tuple", SV("{:m}"), input);
- check_exception("The range-format-spec type s requires formatting a character type", SV("{:s}"), input);
- check_exception("The range-format-spec type ?s requires formatting a character type", SV("{:?s}"), input);
+ check_exception("Type m requires a pair or a tuple with two elements", SV("{:m}"), input);
+ check_exception("Type s requires character type as formatting argument", SV("{:s}"), input);
+ check_exception("Type ?s requires character type as formatting argument", SV("{:?s}"), input);
for (std::basic_string_view<CharT> fmt : fmt_invalid_types<CharT>("s"))
- check_exception("The format-spec should consume the input or end with a '}'", fmt, input);
+ check_exception("The format specifier should consume the input or end with a '}'", fmt, input);
// ***** Only underlying has a format-spec
check(SV(R"([Hello , world ])"), SV("{::8}"), input);
check(SV(R"([_Hello__, _world__])"), SV("{::_^{}}"), input, 8);
check(SV(R"([:::Hello, :::world])"), SV("{:::>{}}"), input, 8);
- check_exception("The format-spec fill field contains an invalid character", SV("{::}<}"), input);
- check_exception("The format-spec fill field contains an invalid character", SV("{::{<}"), input);
+ check_exception("The fill option contains an invalid value", SV("{::}<}"), input);
+ check_exception("The fill option contains an invalid value", SV("{::{<}"), input);
// *** sign ***
check_exception("The format specifier should consume the input or end with a '}'", SV("{::-}"), input);
check_exception("The format specifier should consume the input or end with a '}'", SV("{::#}"), input);
// *** zero-padding ***
- check_exception("A format-spec width field shouldn't have a leading zero", SV("{::05}"), input);
+ check_exception("The width option should not have a leading zero", SV("{::05}"), input);
// *** precision ***
check(SV(R"([Hel, wor])"), SV("{::.3}"), input);
check(SV(R"([Hel, wor])"), SV("{::.{}}"), input, 3);
- check_exception("The format-spec precision field doesn't contain a value or arg-id", SV("{::.}"), input);
+ check_exception("The precision option does not contain a value or an argument index", SV("{::.}"), input);
// *** locale-specific form ***
check_exception("The format specifier should consume the input or end with a '}'", SV("{::L}"), input);
// *** type ***
for (std::basic_string_view<CharT> fmt : fmt_invalid_nested_types<CharT>("s?"))
- check_exception("The format-spec type has a type not supported for a string argument", fmt, input);
+ check_exception("The type option contains an invalid value for a string formatting argument", fmt, input);
// ***** Both have a format-spec
check(SV(R"(^^[:::Hello, :::world]^^^)"), SV("{:^^25::>8}"), input);
check(SV(R"(^^[:::Hello, :::world]^^^)"), SV("{:^^{}::>8}"), input, 25);
check(SV(R"(^^[:::Hello, :::world]^^^)"), SV("{:^^{}::>{}}"), input, 25, 8);
- check_exception("Argument index out of bounds", SV("{:^^{}::>8}"), input);
- check_exception("Argument index out of bounds", SV("{:^^{}::>{}}"), input, 25);
+ check_exception(
+ "The argument index value is too large for the number of arguments supplied", SV("{:^^{}::>8}"), input);
+ check_exception(
+ "The argument index value is too large for the number of arguments supplied", SV("{:^^{}::>{}}"), input, 25);
}
template <class CharT, class TestFunction, class ExceptionTest>
check(SV("__[0xaaaa, 0x5555, 0xaa55]___"), SV("{:_^{}}"), input, 29);
check(SV("#####[0xaaaa, 0x5555, 0xaa55]"), SV("{:#>{}}"), input, 29);
- check_exception("The format-spec range-fill field contains an invalid character", SV("{:}<}"), input);
- check_exception("The format-spec range-fill field contains an invalid character", SV("{:{<}"), input);
- check_exception("The format-spec range-fill field contains an invalid character", SV("{::<}"), input);
+ check_exception("The fill option contains an invalid value", SV("{:}<}"), input);
+ check_exception("The fill option contains an invalid value", SV("{:{<}"), input);
+ check_exception("The fill option contains an invalid value", SV("{::<}"), input);
// *** sign ***
- check_exception("The format-spec should consume the input or end with a '}'", SV("{:-}"), input);
- check_exception("The format-spec should consume the input or end with a '}'", SV("{:+}"), input);
- check_exception("The format-spec should consume the input or end with a '}'", SV("{: }"), input);
+ check_exception("The format specifier should consume the input or end with a '}'", SV("{:-}"), input);
+ check_exception("The format specifier should consume the input or end with a '}'", SV("{:+}"), input);
+ check_exception("The format specifier should consume the input or end with a '}'", SV("{: }"), input);
// *** alternate form ***
- check_exception("The format-spec should consume the input or end with a '}'", SV("{:#}"), input);
+ check_exception("The format specifier should consume the input or end with a '}'", SV("{:#}"), input);
// *** zero-padding ***
- check_exception("A format-spec width field shouldn't have a leading zero", SV("{:0}"), input);
+ check_exception("The width option should not have a leading zero", SV("{:0}"), input);
// *** precision ***
- check_exception("The format-spec should consume the input or end with a '}'", SV("{:.}"), input);
+ check_exception("The format specifier should consume the input or end with a '}'", SV("{:.}"), input);
// *** locale-specific form ***
- check_exception("The format-spec should consume the input or end with a '}'", SV("{:L}"), input);
+ check_exception("The format specifier should consume the input or end with a '}'", SV("{:L}"), input);
// *** n
check(SV("__0xaaaa, 0x5555, 0xaa55___"), SV("{:_^27n}"), input);
// *** type ***
- check_exception("The range-format-spec type m requires two elements for a pair or tuple", SV("{:m}"), input);
- check_exception("The range-format-spec type s requires formatting a character type", SV("{:s}"), input);
- check_exception("The range-format-spec type ?s requires formatting a character type", SV("{:?s}"), input);
+ check_exception("Type m requires a pair or a tuple with two elements", SV("{:m}"), input);
+ check_exception("Type s requires character type as formatting argument", SV("{:s}"), input);
+ check_exception("Type ?s requires character type as formatting argument", SV("{:?s}"), input);
for (std::basic_string_view<CharT> fmt : fmt_invalid_types<CharT>("s"))
- check_exception("The format-spec should consume the input or end with a '}'", fmt, input);
+ check_exception("The format specifier should consume the input or end with a '}'", fmt, input);
// ***** Only underlying has a format-spec
- check_exception("The format-spec type has a type not supported for a status argument", SV("{::*<7}"), input);
+ check_exception("The type option contains an invalid value for a status formatting argument", SV("{::*<7}"), input);
for (std::basic_string_view<CharT> fmt : fmt_invalid_nested_types<CharT>("sxX"))
- check_exception("The format-spec type has a type not supported for a status argument", fmt, input);
+ check_exception("The type option contains an invalid value for a status formatting argument", fmt, input);
check(SV("[0xaaaa, 0x5555, 0xaa55]"), SV("{::x}"), input);
check(SV("[0XAAAA, 0X5555, 0XAA55]"), SV("{::X}"), input);
check(SV("^^[0XAAAA, 0X5555, 0XAA55]^^^"), SV("{:^^29:X}"), input);
check(SV("^^[0XAAAA, 0X5555, 0XAA55]^^^"), SV("{:^^{}:X}"), input, 29);
- check_exception("Argument index out of bounds", SV("{:^^{}:X}"), input);
+ check_exception("The argument index value is too large for the number of arguments supplied", SV("{:^^{}:X}"), input);
}
template <class CharT, class TestFunction, class ExceptionTest>
check(SV("__[true, true, false]___"), SV("{:_^{}}"), input, 24);
check(SV("#####[true, true, false]"), SV("{:#>{}}"), input, 24);
- check_exception("The format-spec range-fill field contains an invalid character", SV("{:}<}"), input);
- check_exception("The format-spec range-fill field contains an invalid character", SV("{:{<}"), input);
- check_exception("The format-spec range-fill field contains an invalid character", SV("{::<}"), input);
+ check_exception("The fill option contains an invalid value", SV("{:}<}"), input);
+ check_exception("The fill option contains an invalid value", SV("{:{<}"), input);
+ check_exception("The fill option contains an invalid value", SV("{::<}"), input);
// *** sign ***
- check_exception("The format-spec should consume the input or end with a '}'", SV("{:-}"), input);
- check_exception("The format-spec should consume the input or end with a '}'", SV("{:+}"), input);
- check_exception("The format-spec should consume the input or end with a '}'", SV("{: }"), input);
+ check_exception("The format specifier should consume the input or end with a '}'", SV("{:-}"), input);
+ check_exception("The format specifier should consume the input or end with a '}'", SV("{:+}"), input);
+ check_exception("The format specifier should consume the input or end with a '}'", SV("{: }"), input);
// *** alternate form ***
- check_exception("The format-spec should consume the input or end with a '}'", SV("{:#}"), input);
+ check_exception("The format specifier should consume the input or end with a '}'", SV("{:#}"), input);
// *** zero-padding ***
- check_exception("A format-spec width field shouldn't have a leading zero", SV("{:0}"), input);
+ check_exception("The width option should not have a leading zero", SV("{:0}"), input);
// *** precision ***
- check_exception("The format-spec should consume the input or end with a '}'", SV("{:.}"), input);
+ check_exception("The format specifier should consume the input or end with a '}'", SV("{:.}"), input);
// *** locale-specific form ***
- check_exception("The format-spec should consume the input or end with a '}'", SV("{:L}"), input);
+ check_exception("The format specifier should consume the input or end with a '}'", SV("{:L}"), input);
// *** n
check(SV("__true, true, false___"), SV("{:_^22n}"), input);
// *** type ***
- check_exception("The range-format-spec type m requires two elements for a pair or tuple", SV("{:m}"), input);
- check_exception("The range-format-spec type s requires formatting a character type", SV("{:s}"), input);
- check_exception("The range-format-spec type ?s requires formatting a character type", SV("{:?s}"), input);
+ check_exception("Type m requires a pair or a tuple with two elements", SV("{:m}"), input);
+ check_exception("Type s requires character type as formatting argument", SV("{:s}"), input);
+ check_exception("Type ?s requires character type as formatting argument", SV("{:?s}"), input);
for (std::basic_string_view<CharT> fmt : fmt_invalid_types<CharT>("s"))
- check_exception("The format-spec should consume the input or end with a '}'", fmt, input);
+ check_exception("The format specifier should consume the input or end with a '}'", fmt, input);
// ***** Only underlying has a format-spec
check(SV("[true , true , false ]"), SV("{::7}"), input);
check(SV("[_true__, _true__, _false_]"), SV("{::_^{}}"), input, 7);
check(SV("[:::true, :::true, ::false]"), SV("{:::>{}}"), input, 7);
- check_exception("The format-spec fill field contains an invalid character", SV("{::}<}"), input);
- check_exception("The format-spec fill field contains an invalid character", SV("{::{<}"), input);
+ check_exception("The fill option contains an invalid value", SV("{::}<}"), input);
+ check_exception("The fill option contains an invalid value", SV("{::{<}"), input);
// *** sign ***
check_exception("The format specifier for a bool does not allow the sign option", SV("{::-}"), input);
check(SV("^^[:::true, :::true, ::false]^^^"), SV("{:^^{}::>7}"), input, 32);
check(SV("^^[:::true, :::true, ::false]^^^"), SV("{:^^{}::>{}}"), input, 32, 7);
- check_exception("Argument index out of bounds", SV("{:^^{}::>5}"), input);
- check_exception("Argument index out of bounds", SV("{:^^{}::>{}}"), input, 32);
+ check_exception(
+ "The argument index value is too large for the number of arguments supplied", SV("{:^^{}::>5}"), input);
+ check_exception(
+ "The argument index value is too large for the number of arguments supplied", SV("{:^^{}::>{}}"), input, 32);
}
template <class CharT, class TestFunction, class ExceptionTest>
#endif // !defined(__APPLE__) && !defined(__FreeBSD__)
/***** Test the type generic part *****/
- check_exception("The format-spec fill field contains an invalid character", SV("{:}<}"), input);
- check_exception("The format-spec fill field contains an invalid character", SV("{:{<}"), input);
+ check_exception("The fill option contains an invalid value", SV("{:}<}"), input);
+ check_exception("The fill option contains an invalid value", SV("{:{<}"), input);
// *** sign ***
check_exception("The replacement field misses a terminating '}'", SV("{:-}"), input);
check_exception("The replacement field misses a terminating '}'", SV("{:#}"), input);
// *** zero-padding ***
- check_exception("A format-spec width field shouldn't have a leading zero", SV("{:0}"), input);
+ check_exception("The width option should not have a leading zero", SV("{:0}"), input);
// *** precision ***
check_exception("The replacement field misses a terminating '}'", SV("{:.}"), input);
test_valid_values<CharT>();
check_invalid_types<CharT>({SV("d"), SV("e"), SV("Od"), SV("Oe")}, 0d);
- check_exception("Expected '%' or '}' in the chrono format-string", SV("{:A"), 0d);
- check_exception("The chrono-specs contains a '{'", SV("{:%%{"), 0d);
- check_exception("End of input while parsing the modifier chrono conversion-spec", SV("{:%"), 0d);
+ check_exception("The format specifier expects a '%' or a '}'", SV("{:A"), 0d);
+ check_exception("The chrono specifiers contain a '{'", SV("{:%%{"), 0d);
+ check_exception("End of input while parsing a conversion specifier", SV("{:%"), 0d);
check_exception("End of input while parsing the modifier E", SV("{:%E"), 0d);
check_exception("End of input while parsing the modifier O", SV("{:%O"), 0d);
// Precision not allowed
- check_exception("Expected '%' or '}' in the chrono format-string", SV("{:.3}"), 0d);
+ check_exception("The format specifier expects a '%' or a '}'", SV("{:.3}"), 0d);
}
int main(int, char**) {
SV("R"), SV("S"), SV("t"), SV("T"), SV("X"), SV("EX"), SV("OH"), SV("OI"), SV("OM"), SV("OS")},
0ms);
- check_exception("Expected '%' or '}' in the chrono format-string", SV("{:A"), 0ms);
- check_exception("The chrono-specs contains a '{'", SV("{:%%{"), 0ms);
- check_exception("End of input while parsing the modifier chrono conversion-spec", SV("{:%"), 0ms);
+ check_exception("The format specifier expects a '%' or a '}'", SV("{:A"), 0ms);
+ check_exception("The chrono specifiers contain a '{'", SV("{:%%{"), 0ms);
+ check_exception("End of input while parsing a conversion specifier", SV("{:%"), 0ms);
check_exception("End of input while parsing the modifier E", SV("{:%E"), 0ms);
check_exception("End of input while parsing the modifier O", SV("{:%O"), 0ms);
check(SV("05:42:00"), SV("{:%T}"), std::chrono::years{0xffff}); // 17 bit signed value max
// Precision not allowed
- check_exception("Expected '%' or '}' in the chrono format-string", SV("{:.3}"), 0ms);
+ check_exception("The format specifier expects a '%' or a '}'", SV("{:.3}"), 0ms);
}
int main(int, char**) {
SV("OI"), SV("Om"), SV("OM"), SV("OS"), SV("Ou"), SV("OU"), SV("OV"), SV("Ow"), SV("OW"), SV("Oy"), SV("Oz")},
file_seconds(0s));
- check_exception("Expected '%' or '}' in the chrono format-string", SV("{:A"), file_seconds(0s));
- check_exception("The chrono-specs contains a '{'", SV("{:%%{"), file_seconds(0s));
- check_exception("End of input while parsing the modifier chrono conversion-spec", SV("{:%"), file_seconds(0s));
+ check_exception("The format specifier expects a '%' or a '}'", SV("{:A"), file_seconds(0s));
+ check_exception("The chrono specifiers contain a '{'", SV("{:%%{"), file_seconds(0s));
+ check_exception("End of input while parsing a conversion specifier", SV("{:%"), file_seconds(0s));
check_exception("End of input while parsing the modifier E", SV("{:%E"), file_seconds(0s));
check_exception("End of input while parsing the modifier O", SV("{:%O"), file_seconds(0s));
// Precision not allowed
- check_exception("Expected '%' or '}' in the chrono format-string", SV("{:.3}"), file_seconds(0s));
+ check_exception("The format specifier expects a '%' or a '}'", SV("{:.3}"), file_seconds(0s));
}
int main(int, char**) {
// This looks odd, however the 24 hours is not valid for a 24 hour clock.
// TODO FMT discuss what the "proper" behaviour is.
- check_exception("formatting a hour needs a valid value", SV("{:%H"), std::chrono::hh_mm_ss{24h});
- check_exception("formatting a hour needs a valid value", SV("{:%OH"), std::chrono::hh_mm_ss{24h});
- check_exception("formatting a hour needs a valid value", SV("{:%I"), std::chrono::hh_mm_ss{24h});
- check_exception("formatting a hour needs a valid value", SV("{:%OI"), std::chrono::hh_mm_ss{24h});
+ check_exception("Formatting a hour needs a valid value", SV("{:%H"), std::chrono::hh_mm_ss{24h});
+ check_exception("Formatting a hour needs a valid value", SV("{:%OH"), std::chrono::hh_mm_ss{24h});
+ check_exception("Formatting a hour needs a valid value", SV("{:%I"), std::chrono::hh_mm_ss{24h});
+ check_exception("Formatting a hour needs a valid value", SV("{:%OI"), std::chrono::hh_mm_ss{24h});
check(SV("00"), SV("{:%M}"), std::chrono::hh_mm_ss{24h});
check(SV("00"), SV("{:%OM}"), std::chrono::hh_mm_ss{24h});
check(SV("00"), SV("{:%S}"), std::chrono::hh_mm_ss{24h});
check(SV("00"), SV("{:%OS}"), std::chrono::hh_mm_ss{24h});
- check_exception("formatting a hour needs a valid value", SV("{:%p"), std::chrono::hh_mm_ss{24h});
- check_exception("formatting a hour needs a valid value", SV("{:%R"), std::chrono::hh_mm_ss{24h});
- check_exception("formatting a hour needs a valid value", SV("{:%T"), std::chrono::hh_mm_ss{24h});
- check_exception("formatting a hour needs a valid value", SV("{:%r"), std::chrono::hh_mm_ss{24h});
- check_exception("formatting a hour needs a valid value", SV("{:%X"), std::chrono::hh_mm_ss{24h});
- check_exception("formatting a hour needs a valid value", SV("{:%EX"), std::chrono::hh_mm_ss{24h});
+ check_exception("Formatting a hour needs a valid value", SV("{:%p"), std::chrono::hh_mm_ss{24h});
+ check_exception("Formatting a hour needs a valid value", SV("{:%R"), std::chrono::hh_mm_ss{24h});
+ check_exception("Formatting a hour needs a valid value", SV("{:%T"), std::chrono::hh_mm_ss{24h});
+ check_exception("Formatting a hour needs a valid value", SV("{:%r"), std::chrono::hh_mm_ss{24h});
+ check_exception("Formatting a hour needs a valid value", SV("{:%X"), std::chrono::hh_mm_ss{24h});
+ check_exception("Formatting a hour needs a valid value", SV("{:%EX"), std::chrono::hh_mm_ss{24h});
}
template <class CharT>
SV("EX")},
std::chrono::hh_mm_ss{0ms});
- check_exception("Expected '%' or '}' in the chrono format-string", SV("{:A"), std::chrono::hh_mm_ss{0ms});
- check_exception("The chrono-specs contains a '{'", SV("{:%%{"), std::chrono::hh_mm_ss{0ms});
- check_exception(
- "End of input while parsing the modifier chrono conversion-spec", SV("{:%"), std::chrono::hh_mm_ss{0ms});
+ check_exception("The format specifier expects a '%' or a '}'", SV("{:A"), std::chrono::hh_mm_ss{0ms});
+ check_exception("The chrono specifiers contain a '{'", SV("{:%%{"), std::chrono::hh_mm_ss{0ms});
+ check_exception("End of input while parsing a conversion specifier", SV("{:%"), std::chrono::hh_mm_ss{0ms});
check_exception("End of input while parsing the modifier E", SV("{:%E"), std::chrono::hh_mm_ss{0ms});
check_exception("End of input while parsing the modifier O", SV("{:%O"), std::chrono::hh_mm_ss{0ms});
- check_exception("Expected '%' or '}' in the chrono format-string", SV("{:.3}"), std::chrono::hh_mm_ss{0ms});
+ check_exception("The format specifier expects a '%' or a '}'", SV("{:.3}"), std::chrono::hh_mm_ss{0ms});
}
int main(int, char**) {
},
std::chrono::local_seconds(0s));
- check_exception("Expected '%' or '}' in the chrono format-string", SV("{:A"), std::chrono::local_seconds(0s));
- check_exception("The chrono-specs contains a '{'", SV("{:%%{"), std::chrono::local_seconds(0s));
- check_exception(
- "End of input while parsing the modifier chrono conversion-spec", SV("{:%"), std::chrono::local_seconds(0s));
+ check_exception("The format specifier expects a '%' or a '}'", SV("{:A"), std::chrono::local_seconds(0s));
+ check_exception("The chrono specifiers contain a '{'", SV("{:%%{"), std::chrono::local_seconds(0s));
+ check_exception("End of input while parsing a conversion specifier", SV("{:%"), std::chrono::local_seconds(0s));
check_exception("End of input while parsing the modifier E", SV("{:%E"), std::chrono::local_seconds(0s));
check_exception("End of input while parsing the modifier O", SV("{:%O"), std::chrono::local_seconds(0s));
// Precision not allowed
- check_exception("Expected '%' or '}' in the chrono format-string", SV("{:.3}"), std::chrono::local_seconds(0s));
+ check_exception("The format specifier expects a '%' or a '}'", SV("{:.3}"), std::chrono::local_seconds(0s));
}
int main(int, char**) {
template <class CharT>
static void test_valid_values() {
// Test that %b, %h, and %B throw an exception.
- check_exception("formatting a month name from an invalid month number", SV("{:%b}"), std::chrono::month{200});
- check_exception("formatting a month name from an invalid month number", SV("{:%b}"), std::chrono::month{13});
- check_exception("formatting a month name from an invalid month number", SV("{:%b}"), std::chrono::month{255});
+ check_exception("Formatting a month name from an invalid month number", SV("{:%b}"), std::chrono::month{200});
+ check_exception("Formatting a month name from an invalid month number", SV("{:%b}"), std::chrono::month{13});
+ check_exception("Formatting a month name from an invalid month number", SV("{:%b}"), std::chrono::month{255});
- check_exception("formatting a month name from an invalid month number", SV("{:%h}"), std::chrono::month{0});
- check_exception("formatting a month name from an invalid month number", SV("{:%h}"), std::chrono::month{13});
- check_exception("formatting a month name from an invalid month number", SV("{:%h}"), std::chrono::month{255});
+ check_exception("Formatting a month name from an invalid month number", SV("{:%h}"), std::chrono::month{0});
+ check_exception("Formatting a month name from an invalid month number", SV("{:%h}"), std::chrono::month{13});
+ check_exception("Formatting a month name from an invalid month number", SV("{:%h}"), std::chrono::month{255});
- check_exception("formatting a month name from an invalid month number", SV("{:%B}"), std::chrono::month{0});
- check_exception("formatting a month name from an invalid month number", SV("{:%B}"), std::chrono::month{13});
- check_exception("formatting a month name from an invalid month number", SV("{:%B}"), std::chrono::month{255});
+ check_exception("Formatting a month name from an invalid month number", SV("{:%B}"), std::chrono::month{0});
+ check_exception("Formatting a month name from an invalid month number", SV("{:%B}"), std::chrono::month{13});
+ check_exception("Formatting a month name from an invalid month number", SV("{:%B}"), std::chrono::month{255});
constexpr std::basic_string_view<CharT> fmt = SV("{:%%b='%b'%t%%B='%B'%t%%h='%h'%t%%m='%m'%t%%Om='%Om'%n}");
constexpr std::basic_string_view<CharT> lfmt = SV("{:L%%b='%b'%t%%B='%B'%t%%h='%h'%t%%m='%m'%t%%Om='%Om'%n}");
test_valid_values<CharT>();
check_invalid_types<CharT>({SV("b"), SV("B"), SV("h"), SV("m"), SV("Om")}, std::chrono::January);
- check_exception("Expected '%' or '}' in the chrono format-string", SV("{:A"), std::chrono::January);
- check_exception("The chrono-specs contains a '{'", SV("{:%%{"), std::chrono::January);
- check_exception("End of input while parsing the modifier chrono conversion-spec", SV("{:%"), std::chrono::January);
+ check_exception("The format specifier expects a '%' or a '}'", SV("{:A"), std::chrono::January);
+ check_exception("The chrono specifiers contain a '{'", SV("{:%%{"), std::chrono::January);
+ check_exception("End of input while parsing a conversion specifier", SV("{:%"), std::chrono::January);
check_exception("End of input while parsing the modifier E", SV("{:%E"), std::chrono::January);
check_exception("End of input while parsing the modifier O", SV("{:%O"), std::chrono::January);
// Precision not allowed
- check_exception("Expected '%' or '}' in the chrono format-string", SV("{:.3}"), std::chrono::January);
+ check_exception("The format specifier expects a '%' or a '}'", SV("{:.3}"), std::chrono::January);
}
int main(int, char**) {
template <class CharT>
static void test_valid_values() {
// Test that %b, %h, and %B throw an exception.
- check_exception("formatting a month name from an invalid month number",
+ check_exception("Formatting a month name from an invalid month number",
SV("{:%b}"),
std::chrono::month_day{std::chrono::month{200}, std::chrono::day{31}});
- check_exception("formatting a month name from an invalid month number",
+ check_exception("Formatting a month name from an invalid month number",
SV("{:%b}"),
std::chrono::month_day{std::chrono::month{13}, std::chrono::day{31}});
- check_exception("formatting a month name from an invalid month number",
+ check_exception("Formatting a month name from an invalid month number",
SV("{:%b}"),
std::chrono::month_day{std::chrono::month{255}, std::chrono::day{31}});
- check_exception("formatting a month name from an invalid month number",
+ check_exception("Formatting a month name from an invalid month number",
SV("{:%h}"),
std::chrono::month_day{std::chrono::month{0}, std::chrono::day{31}});
- check_exception("formatting a month name from an invalid month number",
+ check_exception("Formatting a month name from an invalid month number",
SV("{:%h}"),
std::chrono::month_day{std::chrono::month{13}, std::chrono::day{31}});
- check_exception("formatting a month name from an invalid month number",
+ check_exception("Formatting a month name from an invalid month number",
SV("{:%h}"),
std::chrono::month_day{std::chrono::month{255}, std::chrono::day{31}});
- check_exception("formatting a month name from an invalid month number",
+ check_exception("Formatting a month name from an invalid month number",
SV("{:%B}"),
std::chrono::month_day{std::chrono::month{0}, std::chrono::day{31}});
- check_exception("formatting a month name from an invalid month number",
+ check_exception("Formatting a month name from an invalid month number",
SV("{:%B}"),
std::chrono::month_day{std::chrono::month{13}, std::chrono::day{31}});
- check_exception("formatting a month name from an invalid month number",
+ check_exception("Formatting a month name from an invalid month number",
SV("{:%B}"),
std::chrono::month_day{std::chrono::month{255}, std::chrono::day{31}});
check_invalid_types<CharT>({SV("b"), SV("B"), SV("d"), SV("e"), SV("h"), SV("m"), SV("Od"), SV("Oe"), SV("Om")},
std::chrono::month_day{std::chrono::January, std::chrono::day{31}});
- check_exception("Expected '%' or '}' in the chrono format-string",
+ check_exception("The format specifier expects a '%' or a '}'",
SV("{:A"),
std::chrono::month_day{std::chrono::January, std::chrono::day{31}});
- check_exception("The chrono-specs contains a '{'",
+ check_exception("The chrono specifiers contain a '{'",
SV("{:%%{"),
std::chrono::month_day{std::chrono::January, std::chrono::day{31}});
- check_exception("End of input while parsing the modifier chrono conversion-spec",
+ check_exception("End of input while parsing a conversion specifier",
SV("{:%"),
std::chrono::month_day{std::chrono::January, std::chrono::day{31}});
check_exception("End of input while parsing the modifier E",
std::chrono::month_day{std::chrono::January, std::chrono::day{31}});
// Precision not allowed
- check_exception("Expected '%' or '}' in the chrono format-string",
+ check_exception("The format specifier expects a '%' or a '}'",
SV("{:.3}"),
std::chrono::month_day{std::chrono::January, std::chrono::day{31}});
}
template <class CharT>
static void test_valid_values() {
// Test that %b, %h, and %B throw an exception.
- check_exception("formatting a month name from an invalid month number",
+ check_exception("Formatting a month name from an invalid month number",
SV("{:%b}"),
std::chrono::month_day_last{std::chrono::month{200}});
- check_exception("formatting a month name from an invalid month number",
+ check_exception("Formatting a month name from an invalid month number",
SV("{:%b}"),
std::chrono::month_day_last{std::chrono::month{13}});
- check_exception("formatting a month name from an invalid month number",
+ check_exception("Formatting a month name from an invalid month number",
SV("{:%b}"),
std::chrono::month_day_last{std::chrono::month{255}});
- check_exception("formatting a month name from an invalid month number",
+ check_exception("Formatting a month name from an invalid month number",
SV("{:%h}"),
std::chrono::month_day_last{std::chrono::month{0}});
- check_exception("formatting a month name from an invalid month number",
+ check_exception("Formatting a month name from an invalid month number",
SV("{:%h}"),
std::chrono::month_day_last{std::chrono::month{13}});
- check_exception("formatting a month name from an invalid month number",
+ check_exception("Formatting a month name from an invalid month number",
SV("{:%h}"),
std::chrono::month_day_last{std::chrono::month{255}});
- check_exception("formatting a month name from an invalid month number",
+ check_exception("Formatting a month name from an invalid month number",
SV("{:%B}"),
std::chrono::month_day_last{std::chrono::month{0}});
- check_exception("formatting a month name from an invalid month number",
+ check_exception("Formatting a month name from an invalid month number",
SV("{:%B}"),
std::chrono::month_day_last{std::chrono::month{13}});
- check_exception("formatting a month name from an invalid month number",
+ check_exception("Formatting a month name from an invalid month number",
SV("{:%B}"),
std::chrono::month_day_last{std::chrono::month{255}});
{SV("b"), SV("B"), SV("h"), SV("m"), SV("Om")}, std::chrono::month_day_last{std::chrono::January});
check_exception(
- "Expected '%' or '}' in the chrono format-string", SV("{:A"), std::chrono::month_day_last{std::chrono::January});
- check_exception("The chrono-specs contains a '{'", SV("{:%%{"), std::chrono::month_day_last{std::chrono::January});
- check_exception("End of input while parsing the modifier chrono conversion-spec",
+ "The format specifier expects a '%' or a '}'", SV("{:A"), std::chrono::month_day_last{std::chrono::January});
+ check_exception(
+ "The chrono specifiers contain a '{'", SV("{:%%{"), std::chrono::month_day_last{std::chrono::January});
+ check_exception("End of input while parsing a conversion specifier",
SV("{:%"),
std::chrono::month_day_last{std::chrono::January});
check_exception(
"End of input while parsing the modifier O", SV("{:%O"), std::chrono::month_day_last{std::chrono::January});
// Precision not allowed
- check_exception("Expected '%' or '}' in the chrono format-string",
- SV("{:.3}"),
- std::chrono::month_day_last{std::chrono::January});
+ check_exception(
+ "The format specifier expects a '%' or a '}'", SV("{:.3}"), std::chrono::month_day_last{std::chrono::January});
}
int main(int, char**) {
static void test_invalid_values() {
// Test that %a, %b, %h, %a, and %B throw an exception.
check_exception(
- "formatting a weekday name needs a valid weekday",
+ "Formatting a weekday name needs a valid weekday",
SV("{:%a}"),
std::chrono::month_weekday{std::chrono::month{1}, std::chrono::weekday_indexed{std::chrono::weekday{8}, 1}});
check_exception(
- "formatting a weekday name needs a valid weekday",
+ "Formatting a weekday name needs a valid weekday",
SV("{:%a}"),
std::chrono::month_weekday{std::chrono::month{1}, std::chrono::weekday_indexed{std::chrono::weekday{255}, 1}});
check_exception(
- "formatting a month name from an invalid month number",
+ "Formatting a month name from an invalid month number",
SV("{:%b}"),
std::chrono::month_weekday{std::chrono::month{0}, std::chrono::weekday_indexed{std::chrono::weekday{0}, 1}});
check_exception(
- "formatting a month name from an invalid month number",
+ "Formatting a month name from an invalid month number",
SV("{:%b}"),
std::chrono::month_weekday{std::chrono::month{13}, std::chrono::weekday_indexed{std::chrono::weekday{0}, 1}});
check_exception(
- "formatting a month name from an invalid month number",
+ "Formatting a month name from an invalid month number",
SV("{:%b}"),
std::chrono::month_weekday{std::chrono::month{255}, std::chrono::weekday_indexed{std::chrono::weekday{0}, 1}});
check_exception(
- "formatting a month name from an invalid month number",
+ "Formatting a month name from an invalid month number",
SV("{:%h}"),
std::chrono::month_weekday{std::chrono::month{0}, std::chrono::weekday_indexed{std::chrono::weekday{0}, 1}});
check_exception(
- "formatting a month name from an invalid month number",
+ "Formatting a month name from an invalid month number",
SV("{:%h}"),
std::chrono::month_weekday{std::chrono::month{13}, std::chrono::weekday_indexed{std::chrono::weekday{0}, 1}});
check_exception(
- "formatting a month name from an invalid month number",
+ "Formatting a month name from an invalid month number",
SV("{:%h}"),
std::chrono::month_weekday{std::chrono::month{255}, std::chrono::weekday_indexed{std::chrono::weekday{0}, 1}});
check_exception(
- "formatting a weekday name needs a valid weekday",
+ "Formatting a weekday name needs a valid weekday",
SV("{:%A}"),
std::chrono::month_weekday{std::chrono::month{1}, std::chrono::weekday_indexed{std::chrono::weekday{8}, 1}});
check_exception(
- "formatting a weekday name needs a valid weekday",
+ "Formatting a weekday name needs a valid weekday",
SV("{:%A}"),
std::chrono::month_weekday{std::chrono::month{1}, std::chrono::weekday_indexed{std::chrono::weekday{255}, 1}});
check_exception(
- "formatting a month name from an invalid month number",
+ "Formatting a month name from an invalid month number",
SV("{:%B}"),
std::chrono::month_weekday{std::chrono::month{0}, std::chrono::weekday_indexed{std::chrono::weekday{0}, 1}});
check_exception(
- "formatting a month name from an invalid month number",
+ "Formatting a month name from an invalid month number",
SV("{:%B}"),
std::chrono::month_weekday{std::chrono::month{13}, std::chrono::weekday_indexed{std::chrono::weekday{0}, 1}});
check_exception(
- "formatting a month name from an invalid month number",
+ "Formatting a month name from an invalid month number",
SV("{:%B}"),
std::chrono::month_weekday{std::chrono::month{255}, std::chrono::weekday_indexed{std::chrono::weekday{0}, 1}});
}
std::chrono::month_weekday{std::chrono::January, std::chrono::weekday_indexed{std::chrono::weekday{0}, 1}});
check_exception(
- "Expected '%' or '}' in the chrono format-string",
+ "The format specifier expects a '%' or a '}'",
SV("{:A"),
std::chrono::month_weekday{std::chrono::January, std::chrono::weekday_indexed{std::chrono::weekday{0}, 1}});
check_exception(
- "The chrono-specs contains a '{'",
+ "The chrono specifiers contain a '{'",
SV("{:%%{"),
std::chrono::month_weekday{std::chrono::January, std::chrono::weekday_indexed{std::chrono::weekday{0}, 1}});
check_exception(
- "End of input while parsing the modifier chrono conversion-spec",
+ "End of input while parsing a conversion specifier",
SV("{:%"),
std::chrono::month_weekday{std::chrono::January, std::chrono::weekday_indexed{std::chrono::weekday{0}, 1}});
check_exception(
// Precision not allowed
check_exception(
- "Expected '%' or '}' in the chrono format-string",
+ "The format specifier expects a '%' or a '}'",
SV("{:.3}"),
std::chrono::month_weekday{std::chrono::January, std::chrono::weekday_indexed{std::chrono::weekday{0}, 1}});
}
SV("OI"), SV("Om"), SV("OM"), SV("OS"), SV("Ou"), SV("OU"), SV("OV"), SV("Ow"), SV("OW"), SV("Oy"), SV("Oz")},
std::chrono::sys_seconds(0s));
- check_exception("Expected '%' or '}' in the chrono format-string", SV("{:A"), std::chrono::sys_seconds(0s));
- check_exception("The chrono-specs contains a '{'", SV("{:%%{"), std::chrono::sys_seconds(0s));
- check_exception(
- "End of input while parsing the modifier chrono conversion-spec", SV("{:%"), std::chrono::sys_seconds(0s));
+ check_exception("The format specifier expects a '%' or a '}'", SV("{:A"), std::chrono::sys_seconds(0s));
+ check_exception("The chrono specifiers contain a '{'", SV("{:%%{"), std::chrono::sys_seconds(0s));
+ check_exception("End of input while parsing a conversion specifier", SV("{:%"), std::chrono::sys_seconds(0s));
check_exception("End of input while parsing the modifier E", SV("{:%E"), std::chrono::sys_seconds(0s));
check_exception("End of input while parsing the modifier O", SV("{:%O"), std::chrono::sys_seconds(0s));
// Precision not allowed
- check_exception("Expected '%' or '}' in the chrono format-string", SV("{:.3}"), std::chrono::sys_seconds(0s));
+ check_exception("The format specifier expects a '%' or a '}'", SV("{:.3}"), std::chrono::sys_seconds(0s));
}
int main(int, char**) {
template <class CharT>
static void test_invalid_values() {
// Test that %a and %A throw an exception.
- check_exception("formatting a weekday name needs a valid weekday", SV("{:%a}"), std::chrono::weekday(8));
- check_exception("formatting a weekday name needs a valid weekday", SV("{:%a}"), std::chrono::weekday(255));
- check_exception("formatting a weekday name needs a valid weekday", SV("{:%A}"), std::chrono::weekday(8));
- check_exception("formatting a weekday name needs a valid weekday", SV("{:%A}"), std::chrono::weekday(255));
+ check_exception("Formatting a weekday name needs a valid weekday", SV("{:%a}"), std::chrono::weekday(8));
+ check_exception("Formatting a weekday name needs a valid weekday", SV("{:%a}"), std::chrono::weekday(255));
+ check_exception("Formatting a weekday name needs a valid weekday", SV("{:%A}"), std::chrono::weekday(8));
+ check_exception("Formatting a weekday name needs a valid weekday", SV("{:%A}"), std::chrono::weekday(255));
constexpr std::basic_string_view<CharT> fmt = SV("{:%%u='%u'%t%%Ou='%Ou'%t%%w='%w'%t%%Ow='%Ow'%n}");
constexpr std::basic_string_view<CharT> lfmt = SV("{:L%%u='%u'%t%%Ou='%Ou'%t%%w='%w'%t%%Ow='%Ow'%n}");
check_invalid_types<CharT>(
{SV("a"), SV("A"), SV("t"), SV("u"), SV("w"), SV("Ou"), SV("Ow")}, std::chrono::weekday(0));
- check_exception("Expected '%' or '}' in the chrono format-string", SV("{:A"), std::chrono::weekday(0));
- check_exception("The chrono-specs contains a '{'", SV("{:%%{"), std::chrono::weekday(0));
- check_exception("End of input while parsing the modifier chrono conversion-spec", SV("{:%"), std::chrono::weekday(0));
+ check_exception("The format specifier expects a '%' or a '}'", SV("{:A"), std::chrono::weekday(0));
+ check_exception("The chrono specifiers contain a '{'", SV("{:%%{"), std::chrono::weekday(0));
+ check_exception("End of input while parsing a conversion specifier", SV("{:%"), std::chrono::weekday(0));
check_exception("End of input while parsing the modifier E", SV("{:%E"), std::chrono::weekday(0));
check_exception("End of input while parsing the modifier O", SV("{:%O"), std::chrono::weekday(0));
// Precision not allowed
- check_exception("Expected '%' or '}' in the chrono format-string", SV("{:.3}"), std::chrono::weekday(0));
+ check_exception("The format specifier expects a '%' or a '}'", SV("{:.3}"), std::chrono::weekday(0));
}
int main(int, char**) {
template <class CharT>
static void test_invalid_values() {
// Test that %a and %A throw an exception.
- check_exception("formatting a weekday name needs a valid weekday",
+ check_exception("Formatting a weekday name needs a valid weekday",
SV("{:%a}"),
std::chrono::weekday_indexed{std::chrono::weekday(8), 1});
- check_exception("formatting a weekday name needs a valid weekday",
+ check_exception("Formatting a weekday name needs a valid weekday",
SV("{:%a}"),
std::chrono::weekday_indexed{std::chrono::weekday(255), 1});
- check_exception("formatting a weekday name needs a valid weekday",
+ check_exception("Formatting a weekday name needs a valid weekday",
SV("{:%A}"),
std::chrono::weekday_indexed{std::chrono::weekday(8), 1});
- check_exception("formatting a weekday name needs a valid weekday",
+ check_exception("Formatting a weekday name needs a valid weekday",
SV("{:%A}"),
std::chrono::weekday_indexed{std::chrono::weekday(255), 1});
check_invalid_types<CharT>({SV("a"), SV("A"), SV("t"), SV("u"), SV("w"), SV("Ou"), SV("Ow")},
std::chrono::weekday_indexed{std::chrono::weekday(0), 1});
- check_exception("Expected '%' or '}' in the chrono format-string",
+ check_exception("The format specifier expects a '%' or a '}'",
SV("{:A"),
std::chrono::weekday_indexed{std::chrono::weekday(0), 1});
check_exception(
- "The chrono-specs contains a '{'", SV("{:%%{"), std::chrono::weekday_indexed{std::chrono::weekday(0), 1});
- check_exception("End of input while parsing the modifier chrono conversion-spec",
+ "The chrono specifiers contain a '{'", SV("{:%%{"), std::chrono::weekday_indexed{std::chrono::weekday(0), 1});
+ check_exception("End of input while parsing a conversion specifier",
SV("{:%"),
std::chrono::weekday_indexed{std::chrono::weekday(0), 1});
check_exception("End of input while parsing the modifier E",
std::chrono::weekday_indexed{std::chrono::weekday(0), 1});
// Precision not allowed
- check_exception("Expected '%' or '}' in the chrono format-string",
+ check_exception("The format specifier expects a '%' or a '}'",
SV("{:.3}"),
std::chrono::weekday_indexed{std::chrono::weekday(0), 1});
}
template <class CharT>
static void test_invalid_values() {
// Test that %a and %A throw an exception.
- check_exception("formatting a weekday name needs a valid weekday",
+ check_exception("Formatting a weekday name needs a valid weekday",
SV("{:%a}"),
std::chrono::weekday_last{std::chrono::weekday(8)});
- check_exception("formatting a weekday name needs a valid weekday",
+ check_exception("Formatting a weekday name needs a valid weekday",
SV("{:%a}"),
std::chrono::weekday_last{std::chrono::weekday(255)});
- check_exception("formatting a weekday name needs a valid weekday",
+ check_exception("Formatting a weekday name needs a valid weekday",
SV("{:%A}"),
std::chrono::weekday_last{std::chrono::weekday(8)});
- check_exception("formatting a weekday name needs a valid weekday",
+ check_exception("Formatting a weekday name needs a valid weekday",
SV("{:%A}"),
std::chrono::weekday_last{std::chrono::weekday(255)});
std::chrono::weekday_last{std::chrono::weekday(0)});
check_exception(
- "Expected '%' or '}' in the chrono format-string", SV("{:A"), std::chrono::weekday_last{std::chrono::weekday(0)});
- check_exception("The chrono-specs contains a '{'", SV("{:%%{"), std::chrono::weekday_last{std::chrono::weekday(0)});
- check_exception("End of input while parsing the modifier chrono conversion-spec",
+ "The format specifier expects a '%' or a '}'", SV("{:A"), std::chrono::weekday_last{std::chrono::weekday(0)});
+ check_exception(
+ "The chrono specifiers contain a '{'", SV("{:%%{"), std::chrono::weekday_last{std::chrono::weekday(0)});
+ check_exception("End of input while parsing a conversion specifier",
SV("{:%"),
std::chrono::weekday_last{std::chrono::weekday(0)});
check_exception(
"End of input while parsing the modifier O", SV("{:%O"), std::chrono::weekday_last{std::chrono::weekday(0)});
// Precision not allowed
- check_exception("Expected '%' or '}' in the chrono format-string",
- SV("{:.3}"),
- std::chrono::weekday_last{std::chrono::weekday(0)});
+ check_exception(
+ "The format specifier expects a '%' or a '}'", SV("{:.3}"), std::chrono::weekday_last{std::chrono::weekday(0)});
}
int main(int, char**) {
check_invalid_types<CharT>(
{SV("C"), SV("y"), SV("Y"), SV("EC"), SV("Ey"), SV("EY"), SV("Oy")}, std::chrono::year{1970});
- check_exception("Expected '%' or '}' in the chrono format-string", SV("{:A"), std::chrono::year{1970});
- check_exception("The chrono-specs contains a '{'", SV("{:%%{"), std::chrono::year{1970});
- check_exception("End of input while parsing the modifier chrono conversion-spec", SV("{:%"), std::chrono::year{1970});
+ check_exception("The format specifier expects a '%' or a '}'", SV("{:A"), std::chrono::year{1970});
+ check_exception("The chrono specifiers contain a '{'", SV("{:%%{"), std::chrono::year{1970});
+ check_exception("End of input while parsing a conversion specifier", SV("{:%"), std::chrono::year{1970});
check_exception("End of input while parsing the modifier E", SV("{:%E"), std::chrono::year{1970});
check_exception("End of input while parsing the modifier O", SV("{:%O"), std::chrono::year{1970});
// Precision not allowed
- check_exception("Expected '%' or '}' in the chrono format-string", SV("{:.3}"), std::chrono::year{1970});
+ check_exception("The format specifier expects a '%' or a '}'", SV("{:.3}"), std::chrono::year{1970});
}
int main(int, char**) {
template <class CharT>
static void test_invalid_values() {
// Test that %b and %B throw an exception.
- check_exception("formatting a month name from an invalid month number",
+ check_exception("Formatting a month name from an invalid month number",
SV("{:%b}"),
std::chrono::year_month{std::chrono::year{1970}, std::chrono::month{0}});
- check_exception("formatting a month name from an invalid month number",
+ check_exception("Formatting a month name from an invalid month number",
SV("{:%B}"),
std::chrono::year_month{std::chrono::year{1970}, std::chrono::month{0}});
}
{SV("b"), SV("B"), SV("C"), SV("EC"), SV("Ey"), SV("EY"), SV("h"), SV("m"), SV("Om"), SV("Oy"), SV("y"), SV("Y")},
std::chrono::year_month{std::chrono::year{1970}, std::chrono::January});
- check_exception("Expected '%' or '}' in the chrono format-string",
+ check_exception("The format specifier expects a '%' or a '}'",
SV("{:A"),
std::chrono::year_month{std::chrono::year{1970}, std::chrono::January});
- check_exception("The chrono-specs contains a '{'",
+ check_exception("The chrono specifiers contain a '{'",
SV("{:%%{"),
std::chrono::year_month{std::chrono::year{1970}, std::chrono::January});
- check_exception("End of input while parsing the modifier chrono conversion-spec",
+ check_exception("End of input while parsing a conversion specifier",
SV("{:%"),
std::chrono::year_month{std::chrono::year{1970}, std::chrono::January});
check_exception("End of input while parsing the modifier E",
std::chrono::year_month{std::chrono::year{1970}, std::chrono::January});
// Precision not allowed
- check_exception("Expected '%' or '}' in the chrono format-string",
+ check_exception("The format specifier expects a '%' or a '}'",
SV("{:.3}"),
std::chrono::year_month{std::chrono::year{1970}, std::chrono::January});
}
template <class CharT>
static void test_invalid_values() {
// Test that %a, %A, %b, %B, %h, %j, %u, %U, %V, %w, %W, %Ou, %OU, %OV, %Ow, and %OW throw an exception.
- check_exception("formatting a weekday name needs a valid weekday",
+ check_exception("Formatting a weekday name needs a valid weekday",
SV("{:%A}"),
std::chrono::year_month_day{std::chrono::year{1970}, std::chrono::month{1}, std::chrono::day{0}});
- check_exception("formatting a weekday name needs a valid weekday",
+ check_exception("Formatting a weekday name needs a valid weekday",
SV("{:%A}"),
std::chrono::year_month_day{std::chrono::year{1970}, std::chrono::month{1}, std::chrono::day{32}});
- check_exception("formatting a weekday name needs a valid weekday",
+ check_exception("Formatting a weekday name needs a valid weekday",
SV("{:%A}"),
std::chrono::year_month_day{
std::chrono::year{1970}, std::chrono::month{2}, std::chrono::day{29}}); // not a leap year
- check_exception("formatting a weekday name needs a valid weekday",
+ check_exception("Formatting a weekday name needs a valid weekday",
SV("{:%A}"),
std::chrono::year_month_day{std::chrono::year{1970}, std::chrono::month{0}, std::chrono::day{31}});
- check_exception("formatting a weekday name needs a valid weekday",
+ check_exception("Formatting a weekday name needs a valid weekday",
SV("{:%A}"),
std::chrono::year_month_day{std::chrono::year{-32768}, std::chrono::month{1}, std::chrono::day{31}});
- check_exception("formatting a weekday name needs a valid weekday",
+ check_exception("Formatting a weekday name needs a valid weekday",
SV("{:%a}"),
std::chrono::year_month_day{std::chrono::year{1970}, std::chrono::month{1}, std::chrono::day{0}});
- check_exception("formatting a weekday name needs a valid weekday",
+ check_exception("Formatting a weekday name needs a valid weekday",
SV("{:%a}"),
std::chrono::year_month_day{std::chrono::year{1970}, std::chrono::month{1}, std::chrono::day{32}});
- check_exception("formatting a weekday name needs a valid weekday",
+ check_exception("Formatting a weekday name needs a valid weekday",
SV("{:%a}"),
std::chrono::year_month_day{
std::chrono::year{1970}, std::chrono::month{2}, std::chrono::day{29}}); // not a leap year
- check_exception("formatting a weekday name needs a valid weekday",
+ check_exception("Formatting a weekday name needs a valid weekday",
SV("{:%a}"),
std::chrono::year_month_day{std::chrono::year{1970}, std::chrono::month{0}, std::chrono::day{31}});
- check_exception("formatting a weekday name needs a valid weekday",
+ check_exception("Formatting a weekday name needs a valid weekday",
SV("{:%a}"),
std::chrono::year_month_day{std::chrono::year{-32768}, std::chrono::month{1}, std::chrono::day{31}});
- check_exception("formatting a month name from an invalid month number",
+ check_exception("Formatting a month name from an invalid month number",
SV("{:%B}"),
std::chrono::year_month_day{std::chrono::year{1970}, std::chrono::month{0}, std::chrono::day{31}});
- check_exception("formatting a month name from an invalid month number",
+ check_exception("Formatting a month name from an invalid month number",
SV("{:%B}"),
std::chrono::year_month_day{std::chrono::year{1970}, std::chrono::month{13}, std::chrono::day{31}});
- check_exception("formatting a month name from an invalid month number",
+ check_exception("Formatting a month name from an invalid month number",
SV("{:%B}"),
std::chrono::year_month_day{std::chrono::year{1970}, std::chrono::month{255}, std::chrono::day{31}});
- check_exception("formatting a month name from an invalid month number",
+ check_exception("Formatting a month name from an invalid month number",
SV("{:%b}"),
std::chrono::year_month_day{std::chrono::year{1970}, std::chrono::month{200}, std::chrono::day{31}});
- check_exception("formatting a month name from an invalid month number",
+ check_exception("Formatting a month name from an invalid month number",
SV("{:%b}"),
std::chrono::year_month_day{std::chrono::year{1970}, std::chrono::month{13}, std::chrono::day{31}});
- check_exception("formatting a month name from an invalid month number",
+ check_exception("Formatting a month name from an invalid month number",
SV("{:%b}"),
std::chrono::year_month_day{std::chrono::year{1970}, std::chrono::month{255}, std::chrono::day{31}});
- check_exception("formatting a month name from an invalid month number",
+ check_exception("Formatting a month name from an invalid month number",
SV("{:%h}"),
std::chrono::year_month_day{std::chrono::year{1970}, std::chrono::month{0}, std::chrono::day{31}});
- check_exception("formatting a month name from an invalid month number",
+ check_exception("Formatting a month name from an invalid month number",
SV("{:%h}"),
std::chrono::year_month_day{std::chrono::year{1970}, std::chrono::month{13}, std::chrono::day{31}});
- check_exception("formatting a month name from an invalid month number",
+ check_exception("Formatting a month name from an invalid month number",
SV("{:%h}"),
std::chrono::year_month_day{std::chrono::year{1970}, std::chrono::month{255}, std::chrono::day{31}});
- check_exception("formatting a day of year needs a valid date",
+ check_exception("Formatting a day of year needs a valid date",
SV("{:%j}"),
std::chrono::year_month_day{std::chrono::year{1970}, std::chrono::month{1}, std::chrono::day{0}});
- check_exception("formatting a day of year needs a valid date",
+ check_exception("Formatting a day of year needs a valid date",
SV("{:%j}"),
std::chrono::year_month_day{std::chrono::year{1970}, std::chrono::month{1}, std::chrono::day{32}});
- check_exception("formatting a day of year needs a valid date",
+ check_exception("Formatting a day of year needs a valid date",
SV("{:%j}"),
std::chrono::year_month_day{
std::chrono::year{1970}, std::chrono::month{2}, std::chrono::day{29}}); // not a leap year
- check_exception("formatting a day of year needs a valid date",
+ check_exception("Formatting a day of year needs a valid date",
SV("{:%j}"),
std::chrono::year_month_day{std::chrono::year{1970}, std::chrono::month{0}, std::chrono::day{31}});
- check_exception("formatting a day of year needs a valid date",
+ check_exception("Formatting a day of year needs a valid date",
SV("{:%j}"),
std::chrono::year_month_day{std::chrono::year{-32768}, std::chrono::month{1}, std::chrono::day{31}});
- check_exception("formatting a weekday needs a valid weekday",
+ check_exception("Formatting a weekday needs a valid weekday",
SV("{:%u}"),
std::chrono::year_month_day{std::chrono::year{1970}, std::chrono::month{1}, std::chrono::day{0}});
- check_exception("formatting a weekday needs a valid weekday",
+ check_exception("Formatting a weekday needs a valid weekday",
SV("{:%u}"),
std::chrono::year_month_day{std::chrono::year{1970}, std::chrono::month{1}, std::chrono::day{32}});
- check_exception("formatting a weekday needs a valid weekday",
+ check_exception("Formatting a weekday needs a valid weekday",
SV("{:%u}"),
std::chrono::year_month_day{
std::chrono::year{1970}, std::chrono::month{2}, std::chrono::day{29}}); // not a leap year
- check_exception("formatting a weekday needs a valid weekday",
+ check_exception("Formatting a weekday needs a valid weekday",
SV("{:%u}"),
std::chrono::year_month_day{std::chrono::year{1970}, std::chrono::month{0}, std::chrono::day{31}});
- check_exception("formatting a weekday needs a valid weekday",
+ check_exception("Formatting a weekday needs a valid weekday",
SV("{:%u}"),
std::chrono::year_month_day{std::chrono::year{-32768}, std::chrono::month{1}, std::chrono::day{31}});
- check_exception("formatting a week of year needs a valid date",
+ check_exception("Formatting a week of year needs a valid date",
SV("{:%U}"),
std::chrono::year_month_day{std::chrono::year{1970}, std::chrono::month{1}, std::chrono::day{0}});
- check_exception("formatting a week of year needs a valid date",
+ check_exception("Formatting a week of year needs a valid date",
SV("{:%U}"),
std::chrono::year_month_day{std::chrono::year{1970}, std::chrono::month{1}, std::chrono::day{32}});
- check_exception("formatting a week of year needs a valid date",
+ check_exception("Formatting a week of year needs a valid date",
SV("{:%U}"),
std::chrono::year_month_day{
std::chrono::year{1970}, std::chrono::month{2}, std::chrono::day{29}}); // not a leap year
- check_exception("formatting a week of year needs a valid date",
+ check_exception("Formatting a week of year needs a valid date",
SV("{:%U}"),
std::chrono::year_month_day{std::chrono::year{1970}, std::chrono::month{0}, std::chrono::day{31}});
- check_exception("formatting a week of year needs a valid date",
+ check_exception("Formatting a week of year needs a valid date",
SV("{:%U}"),
std::chrono::year_month_day{std::chrono::year{-32768}, std::chrono::month{1}, std::chrono::day{31}});
- check_exception("formatting a week of year needs a valid date",
+ check_exception("Formatting a week of year needs a valid date",
SV("{:%V}"),
std::chrono::year_month_day{std::chrono::year{1970}, std::chrono::month{1}, std::chrono::day{0}});
- check_exception("formatting a week of year needs a valid date",
+ check_exception("Formatting a week of year needs a valid date",
SV("{:%V}"),
std::chrono::year_month_day{std::chrono::year{1970}, std::chrono::month{1}, std::chrono::day{32}});
- check_exception("formatting a week of year needs a valid date",
+ check_exception("Formatting a week of year needs a valid date",
SV("{:%V}"),
std::chrono::year_month_day{
std::chrono::year{1970}, std::chrono::month{2}, std::chrono::day{29}}); // not a leap year
- check_exception("formatting a week of year needs a valid date",
+ check_exception("Formatting a week of year needs a valid date",
SV("{:%V}"),
std::chrono::year_month_day{std::chrono::year{1970}, std::chrono::month{0}, std::chrono::day{31}});
- check_exception("formatting a week of year needs a valid date",
+ check_exception("Formatting a week of year needs a valid date",
SV("{:%V}"),
std::chrono::year_month_day{std::chrono::year{-32768}, std::chrono::month{1}, std::chrono::day{31}});
- check_exception("formatting a weekday needs a valid weekday",
+ check_exception("Formatting a weekday needs a valid weekday",
SV("{:%w}"),
std::chrono::year_month_day{std::chrono::year{1970}, std::chrono::month{1}, std::chrono::day{0}});
- check_exception("formatting a weekday needs a valid weekday",
+ check_exception("Formatting a weekday needs a valid weekday",
SV("{:%w}"),
std::chrono::year_month_day{std::chrono::year{1970}, std::chrono::month{1}, std::chrono::day{32}});
- check_exception("formatting a weekday needs a valid weekday",
+ check_exception("Formatting a weekday needs a valid weekday",
SV("{:%w}"),
std::chrono::year_month_day{
std::chrono::year{1970}, std::chrono::month{2}, std::chrono::day{29}}); // not a leap year
- check_exception("formatting a weekday needs a valid weekday",
+ check_exception("Formatting a weekday needs a valid weekday",
SV("{:%w}"),
std::chrono::year_month_day{std::chrono::year{1970}, std::chrono::month{0}, std::chrono::day{31}});
- check_exception("formatting a weekday needs a valid weekday",
+ check_exception("Formatting a weekday needs a valid weekday",
SV("{:%w}"),
std::chrono::year_month_day{std::chrono::year{-32768}, std::chrono::month{1}, std::chrono::day{31}});
- check_exception("formatting a week of year needs a valid date",
+ check_exception("Formatting a week of year needs a valid date",
SV("{:%W}"),
std::chrono::year_month_day{std::chrono::year{1970}, std::chrono::month{1}, std::chrono::day{0}});
- check_exception("formatting a week of year needs a valid date",
+ check_exception("Formatting a week of year needs a valid date",
SV("{:%W}"),
std::chrono::year_month_day{std::chrono::year{1970}, std::chrono::month{1}, std::chrono::day{32}});
- check_exception("formatting a week of year needs a valid date",
+ check_exception("Formatting a week of year needs a valid date",
SV("{:%W}"),
std::chrono::year_month_day{
std::chrono::year{1970}, std::chrono::month{2}, std::chrono::day{29}}); // not a leap year
- check_exception("formatting a week of year needs a valid date",
+ check_exception("Formatting a week of year needs a valid date",
SV("{:%W}"),
std::chrono::year_month_day{std::chrono::year{1970}, std::chrono::month{0}, std::chrono::day{31}});
- check_exception("formatting a week of year needs a valid date",
+ check_exception("Formatting a week of year needs a valid date",
SV("{:%W}"),
std::chrono::year_month_day{std::chrono::year{-32768}, std::chrono::month{1}, std::chrono::day{31}});
- check_exception("formatting a weekday needs a valid weekday",
+ check_exception("Formatting a weekday needs a valid weekday",
SV("{:%Ou}"),
std::chrono::year_month_day{std::chrono::year{1970}, std::chrono::month{1}, std::chrono::day{0}});
- check_exception("formatting a weekday needs a valid weekday",
+ check_exception("Formatting a weekday needs a valid weekday",
SV("{:%Ou}"),
std::chrono::year_month_day{std::chrono::year{1970}, std::chrono::month{1}, std::chrono::day{32}});
- check_exception("formatting a weekday needs a valid weekday",
+ check_exception("Formatting a weekday needs a valid weekday",
SV("{:%Ou}"),
std::chrono::year_month_day{
std::chrono::year{1970}, std::chrono::month{2}, std::chrono::day{29}}); // not a leap year
- check_exception("formatting a weekday needs a valid weekday",
+ check_exception("Formatting a weekday needs a valid weekday",
SV("{:%Ou}"),
std::chrono::year_month_day{std::chrono::year{1970}, std::chrono::month{0}, std::chrono::day{31}});
- check_exception("formatting a weekday needs a valid weekday",
+ check_exception("Formatting a weekday needs a valid weekday",
SV("{:%Ou}"),
std::chrono::year_month_day{std::chrono::year{-32768}, std::chrono::month{1}, std::chrono::day{31}});
- check_exception("formatting a week of year needs a valid date",
+ check_exception("Formatting a week of year needs a valid date",
SV("{:%OU}"),
std::chrono::year_month_day{std::chrono::year{1970}, std::chrono::month{1}, std::chrono::day{0}});
- check_exception("formatting a week of year needs a valid date",
+ check_exception("Formatting a week of year needs a valid date",
SV("{:%OU}"),
std::chrono::year_month_day{std::chrono::year{1970}, std::chrono::month{1}, std::chrono::day{32}});
- check_exception("formatting a week of year needs a valid date",
+ check_exception("Formatting a week of year needs a valid date",
SV("{:%OU}"),
std::chrono::year_month_day{
std::chrono::year{1970}, std::chrono::month{2}, std::chrono::day{29}}); // not a leap year
- check_exception("formatting a week of year needs a valid date",
+ check_exception("Formatting a week of year needs a valid date",
SV("{:%OU}"),
std::chrono::year_month_day{std::chrono::year{1970}, std::chrono::month{0}, std::chrono::day{31}});
- check_exception("formatting a week of year needs a valid date",
+ check_exception("Formatting a week of year needs a valid date",
SV("{:%OU}"),
std::chrono::year_month_day{std::chrono::year{-32768}, std::chrono::month{1}, std::chrono::day{31}});
- check_exception("formatting a week of year needs a valid date",
+ check_exception("Formatting a week of year needs a valid date",
SV("{:%OV}"),
std::chrono::year_month_day{std::chrono::year{1970}, std::chrono::month{1}, std::chrono::day{0}});
- check_exception("formatting a week of year needs a valid date",
+ check_exception("Formatting a week of year needs a valid date",
SV("{:%OV}"),
std::chrono::year_month_day{std::chrono::year{1970}, std::chrono::month{1}, std::chrono::day{32}});
- check_exception("formatting a week of year needs a valid date",
+ check_exception("Formatting a week of year needs a valid date",
SV("{:%OV}"),
std::chrono::year_month_day{
std::chrono::year{1970}, std::chrono::month{2}, std::chrono::day{29}}); // not a leap year
- check_exception("formatting a week of year needs a valid date",
+ check_exception("Formatting a week of year needs a valid date",
SV("{:%OV}"),
std::chrono::year_month_day{std::chrono::year{1970}, std::chrono::month{0}, std::chrono::day{31}});
- check_exception("formatting a week of year needs a valid date",
+ check_exception("Formatting a week of year needs a valid date",
SV("{:%OV}"),
std::chrono::year_month_day{std::chrono::year{-32768}, std::chrono::month{1}, std::chrono::day{31}});
- check_exception("formatting a weekday needs a valid weekday",
+ check_exception("Formatting a weekday needs a valid weekday",
SV("{:%Ow}"),
std::chrono::year_month_day{std::chrono::year{1970}, std::chrono::month{1}, std::chrono::day{0}});
- check_exception("formatting a weekday needs a valid weekday",
+ check_exception("Formatting a weekday needs a valid weekday",
SV("{:%Ow}"),
std::chrono::year_month_day{std::chrono::year{1970}, std::chrono::month{1}, std::chrono::day{32}});
- check_exception("formatting a weekday needs a valid weekday",
+ check_exception("Formatting a weekday needs a valid weekday",
SV("{:%Ow}"),
std::chrono::year_month_day{
std::chrono::year{1970}, std::chrono::month{2}, std::chrono::day{29}}); // not a leap year
- check_exception("formatting a weekday needs a valid weekday",
+ check_exception("Formatting a weekday needs a valid weekday",
SV("{:%Ow}"),
std::chrono::year_month_day{std::chrono::year{1970}, std::chrono::month{0}, std::chrono::day{31}});
- check_exception("formatting a weekday needs a valid weekday",
+ check_exception("Formatting a weekday needs a valid weekday",
SV("{:%Ow}"),
std::chrono::year_month_day{std::chrono::year{-32768}, std::chrono::month{1}, std::chrono::day{31}});
- check_exception("formatting a week of year needs a valid date",
+ check_exception("Formatting a week of year needs a valid date",
SV("{:%OW}"),
std::chrono::year_month_day{std::chrono::year{1970}, std::chrono::month{1}, std::chrono::day{0}});
- check_exception("formatting a week of year needs a valid date",
+ check_exception("Formatting a week of year needs a valid date",
SV("{:%OW}"),
std::chrono::year_month_day{std::chrono::year{1970}, std::chrono::month{1}, std::chrono::day{32}});
- check_exception("formatting a week of year needs a valid date",
+ check_exception("Formatting a week of year needs a valid date",
SV("{:%OW}"),
std::chrono::year_month_day{
std::chrono::year{1970}, std::chrono::month{2}, std::chrono::day{29}}); // not a leap year
- check_exception("formatting a week of year needs a valid date",
+ check_exception("Formatting a week of year needs a valid date",
SV("{:%OW}"),
std::chrono::year_month_day{std::chrono::year{1970}, std::chrono::month{0}, std::chrono::day{31}});
- check_exception("formatting a week of year needs a valid date",
+ check_exception("Formatting a week of year needs a valid date",
SV("{:%OW}"),
std::chrono::year_month_day{std::chrono::year{-32768}, std::chrono::month{1}, std::chrono::day{31}});
}
SV("u"), SV("U"), SV("V"), SV("w"), SV("W"), SV("x"), SV("y"), SV("Y")},
std::chrono::year_month_day{std::chrono::year{1970}, std::chrono::January, std::chrono::day{31}});
- check_exception("Expected '%' or '}' in the chrono format-string",
+ check_exception("The format specifier expects a '%' or a '}'",
SV("{:A"),
std::chrono::year_month_day{std::chrono::year{1970}, std::chrono::January, std::chrono::day{31}});
- check_exception("The chrono-specs contains a '{'",
+ check_exception("The chrono specifiers contain a '{'",
SV("{:%%{"),
std::chrono::year_month_day{std::chrono::year{1970}, std::chrono::January, std::chrono::day{31}});
- check_exception("End of input while parsing the modifier chrono conversion-spec",
+ check_exception("End of input while parsing a conversion specifier",
SV("{:%"),
std::chrono::year_month_day{std::chrono::year{1970}, std::chrono::January, std::chrono::day{31}});
check_exception("End of input while parsing the modifier E",
std::chrono::year_month_day{std::chrono::year{1970}, std::chrono::January, std::chrono::day{31}});
// Precision not allowed
- check_exception("Expected '%' or '}' in the chrono format-string",
+ check_exception("The format specifier expects a '%' or a '}'",
SV("{:.3}"),
std::chrono::year_month_day{std::chrono::year{1970}, std::chrono::January, std::chrono::day{31}});
}
static void test_invalid_values() {
// Test that %a, %A, %b, %B, %h, %j, %u, %U, %V, %w, %W, %Ou, %OU, %OV, %Ow, and %OW throw an exception.
check_exception(
- "formatting a weekday name needs a valid weekday",
+ "Formatting a weekday name needs a valid weekday",
SV("{:%A}"),
std::chrono::year_month_day_last{std::chrono::year{1970}, std::chrono::month_day_last{std::chrono::month{0}}});
check_exception(
- "formatting a weekday name needs a valid weekday",
+ "Formatting a weekday name needs a valid weekday",
SV("{:%A}"),
std::chrono::year_month_day_last{std::chrono::year{-32768}, std::chrono::month_day_last{std::chrono::month{1}}});
check_exception(
- "formatting a weekday name needs a valid weekday",
+ "Formatting a weekday name needs a valid weekday",
SV("{:%a}"),
std::chrono::year_month_day_last{std::chrono::year{1970}, std::chrono::month_day_last{std::chrono::month{0}}});
check_exception(
- "formatting a weekday name needs a valid weekday",
+ "Formatting a weekday name needs a valid weekday",
SV("{:%a}"),
std::chrono::year_month_day_last{std::chrono::year{-32768}, std::chrono::month_day_last{std::chrono::month{1}}});
check_exception(
- "formatting a month name from an invalid month number",
+ "Formatting a month name from an invalid month number",
SV("{:%B}"),
std::chrono::year_month_day_last{std::chrono::year{1970}, std::chrono::month_day_last{std::chrono::month{0}}});
check_exception(
- "formatting a month name from an invalid month number",
+ "Formatting a month name from an invalid month number",
SV("{:%B}"),
std::chrono::year_month_day_last{std::chrono::year{1970}, std::chrono::month_day_last{std::chrono::month{13}}});
check_exception(
- "formatting a month name from an invalid month number",
+ "Formatting a month name from an invalid month number",
SV("{:%B}"),
std::chrono::year_month_day_last{std::chrono::year{1970}, std::chrono::month_day_last{std::chrono::month{255}}});
check_exception(
- "formatting a month name from an invalid month number",
+ "Formatting a month name from an invalid month number",
SV("{:%b}"),
std::chrono::year_month_day_last{std::chrono::year{1970}, std::chrono::month_day_last{std::chrono::month{200}}});
check_exception(
- "formatting a month name from an invalid month number",
+ "Formatting a month name from an invalid month number",
SV("{:%b}"),
std::chrono::year_month_day_last{std::chrono::year{1970}, std::chrono::month_day_last{std::chrono::month{13}}});
check_exception(
- "formatting a month name from an invalid month number",
+ "Formatting a month name from an invalid month number",
SV("{:%b}"),
std::chrono::year_month_day_last{std::chrono::year{1970}, std::chrono::month_day_last{std::chrono::month{255}}});
check_exception(
- "formatting a month name from an invalid month number",
+ "Formatting a month name from an invalid month number",
SV("{:%h}"),
std::chrono::year_month_day_last{std::chrono::year{1970}, std::chrono::month_day_last{std::chrono::month{0}}});
check_exception(
- "formatting a month name from an invalid month number",
+ "Formatting a month name from an invalid month number",
SV("{:%h}"),
std::chrono::year_month_day_last{std::chrono::year{1970}, std::chrono::month_day_last{std::chrono::month{13}}});
check_exception(
- "formatting a month name from an invalid month number",
+ "Formatting a month name from an invalid month number",
SV("{:%h}"),
std::chrono::year_month_day_last{std::chrono::year{1970}, std::chrono::month_day_last{std::chrono::month{255}}});
check_exception(
- "formatting a day of year needs a valid date",
+ "Formatting a day of year needs a valid date",
SV("{:%j}"),
std::chrono::year_month_day_last{std::chrono::year{1970}, std::chrono::month_day_last{std::chrono::month{0}}});
check_exception(
- "formatting a day of year needs a valid date",
+ "Formatting a day of year needs a valid date",
SV("{:%j}"),
std::chrono::year_month_day_last{std::chrono::year{-32768}, std::chrono::month_day_last{std::chrono::month{1}}});
check_exception(
- "formatting a weekday needs a valid weekday",
+ "Formatting a weekday needs a valid weekday",
SV("{:%u}"),
std::chrono::year_month_day_last{std::chrono::year{1970}, std::chrono::month_day_last{std::chrono::month{0}}});
check_exception(
- "formatting a weekday needs a valid weekday",
+ "Formatting a weekday needs a valid weekday",
SV("{:%u}"),
std::chrono::year_month_day_last{std::chrono::year{-32768}, std::chrono::month_day_last{std::chrono::month{1}}});
check_exception(
- "formatting a week of year needs a valid date",
+ "Formatting a week of year needs a valid date",
SV("{:%U}"),
std::chrono::year_month_day_last{std::chrono::year{1970}, std::chrono::month_day_last{std::chrono::month{0}}});
check_exception(
- "formatting a week of year needs a valid date",
+ "Formatting a week of year needs a valid date",
SV("{:%U}"),
std::chrono::year_month_day_last{std::chrono::year{-32768}, std::chrono::month_day_last{std::chrono::month{1}}});
check_exception(
- "formatting a week of year needs a valid date",
+ "Formatting a week of year needs a valid date",
SV("{:%V}"),
std::chrono::year_month_day_last{std::chrono::year{1970}, std::chrono::month_day_last{std::chrono::month{0}}});
check_exception(
- "formatting a week of year needs a valid date",
+ "Formatting a week of year needs a valid date",
SV("{:%V}"),
std::chrono::year_month_day_last{std::chrono::year{-32768}, std::chrono::month_day_last{std::chrono::month{1}}});
check_exception(
- "formatting a weekday needs a valid weekday",
+ "Formatting a weekday needs a valid weekday",
SV("{:%w}"),
std::chrono::year_month_day_last{std::chrono::year{1970}, std::chrono::month_day_last{std::chrono::month{0}}});
check_exception(
- "formatting a weekday needs a valid weekday",
+ "Formatting a weekday needs a valid weekday",
SV("{:%w}"),
std::chrono::year_month_day_last{std::chrono::year{-32768}, std::chrono::month_day_last{std::chrono::month{1}}});
check_exception(
- "formatting a week of year needs a valid date",
+ "Formatting a week of year needs a valid date",
SV("{:%W}"),
std::chrono::year_month_day_last{std::chrono::year{1970}, std::chrono::month_day_last{std::chrono::month{0}}});
check_exception(
- "formatting a week of year needs a valid date",
+ "Formatting a week of year needs a valid date",
SV("{:%W}"),
std::chrono::year_month_day_last{std::chrono::year{-32768}, std::chrono::month_day_last{std::chrono::month{1}}});
check_exception(
- "formatting a weekday needs a valid weekday",
+ "Formatting a weekday needs a valid weekday",
SV("{:%Ou}"),
std::chrono::year_month_day_last{std::chrono::year{1970}, std::chrono::month_day_last{std::chrono::month{0}}});
check_exception(
- "formatting a weekday needs a valid weekday",
+ "Formatting a weekday needs a valid weekday",
SV("{:%Ou}"),
std::chrono::year_month_day_last{std::chrono::year{-32768}, std::chrono::month_day_last{std::chrono::month{1}}});
check_exception(
- "formatting a week of year needs a valid date",
+ "Formatting a week of year needs a valid date",
SV("{:%OU}"),
std::chrono::year_month_day_last{std::chrono::year{1970}, std::chrono::month_day_last{std::chrono::month{0}}});
check_exception(
- "formatting a week of year needs a valid date",
+ "Formatting a week of year needs a valid date",
SV("{:%OU}"),
std::chrono::year_month_day_last{std::chrono::year{-32768}, std::chrono::month_day_last{std::chrono::month{1}}});
check_exception(
- "formatting a week of year needs a valid date",
+ "Formatting a week of year needs a valid date",
SV("{:%OV}"),
std::chrono::year_month_day_last{std::chrono::year{1970}, std::chrono::month_day_last{std::chrono::month{0}}});
check_exception(
- "formatting a week of year needs a valid date",
+ "Formatting a week of year needs a valid date",
SV("{:%OV}"),
std::chrono::year_month_day_last{std::chrono::year{-32768}, std::chrono::month_day_last{std::chrono::month{1}}});
check_exception(
- "formatting a weekday needs a valid weekday",
+ "Formatting a weekday needs a valid weekday",
SV("{:%Ow}"),
std::chrono::year_month_day_last{std::chrono::year{1970}, std::chrono::month_day_last{std::chrono::month{0}}});
check_exception(
- "formatting a weekday needs a valid weekday",
+ "Formatting a weekday needs a valid weekday",
SV("{:%Ow}"),
std::chrono::year_month_day_last{std::chrono::year{-32768}, std::chrono::month_day_last{std::chrono::month{1}}});
check_exception(
- "formatting a week of year needs a valid date",
+ "Formatting a week of year needs a valid date",
SV("{:%OW}"),
std::chrono::year_month_day_last{std::chrono::year{1970}, std::chrono::month_day_last{std::chrono::month{0}}});
check_exception(
- "formatting a week of year needs a valid date",
+ "Formatting a week of year needs a valid date",
SV("{:%OW}"),
std::chrono::year_month_day_last{std::chrono::year{-32768}, std::chrono::month_day_last{std::chrono::month{1}}});
}
std::chrono::year_month_day_last{std::chrono::year{1970}, std::chrono::month_day_last{std::chrono::January}});
check_exception(
- "Expected '%' or '}' in the chrono format-string",
+ "The format specifier expects a '%' or a '}'",
SV("{:A"),
std::chrono::year_month_day_last{std::chrono::year{1970}, std::chrono::month_day_last{std::chrono::January}});
check_exception(
- "The chrono-specs contains a '{'",
+ "The chrono specifiers contain a '{'",
SV("{:%%{"),
std::chrono::year_month_day_last{std::chrono::year{1970}, std::chrono::month_day_last{std::chrono::January}});
check_exception(
- "End of input while parsing the modifier chrono conversion-spec",
+ "End of input while parsing a conversion specifier",
SV("{:%"),
std::chrono::year_month_day_last{std::chrono::year{1970}, std::chrono::month_day_last{std::chrono::January}});
check_exception(
// Precision not allowed
check_exception(
- "Expected '%' or '}' in the chrono format-string",
+ "The format specifier expects a '%' or a '}'",
SV("{:.3}"),
std::chrono::year_month_day_last{std::chrono::year{1970}, std::chrono::month_day_last{std::chrono::January}});
}
static void test_invalid_values() {
// Test that %a, %A, %b, %B, %h, %j, %u, %U, %V, %w, %W, %Ou, %OU, %OV, %Ow, and %OW throw an exception.
check_exception(
- "formatting a weekday name needs a valid weekday",
+ "Formatting a weekday name needs a valid weekday",
SV("{:%a}"),
std::chrono::year_month_weekday{
std::chrono::year{1970}, std::chrono::month{1}, std::chrono::weekday_indexed{std::chrono::weekday{13}, 1}});
check_exception(
- "formatting a weekday name needs a valid weekday",
+ "Formatting a weekday name needs a valid weekday",
SV("{:%A}"),
std::chrono::year_month_weekday{
std::chrono::year{1970}, std::chrono::month{1}, std::chrono::weekday_indexed{std::chrono::weekday{13}, 1}});
check_exception(
- "formatting a month name from an invalid month number",
+ "Formatting a month name from an invalid month number",
SV("{:%b}"),
std::chrono::year_month_weekday{
std::chrono::year{1970}, std::chrono::month{0}, std::chrono::weekday_indexed{std::chrono::weekday{1}, 1}});
check_exception(
- "formatting a month name from an invalid month number",
+ "Formatting a month name from an invalid month number",
SV("{:%B}"),
std::chrono::year_month_weekday{
std::chrono::year{1970}, std::chrono::month{0}, std::chrono::weekday_indexed{std::chrono::weekday{1}, 1}});
check_exception(
- "formatting a month name from an invalid month number",
+ "Formatting a month name from an invalid month number",
SV("{:%h}"),
std::chrono::year_month_weekday{
std::chrono::year{1970}, std::chrono::month{0}, std::chrono::weekday_indexed{std::chrono::weekday{1}, 1}});
check_exception(
- "formatting a day of year needs a valid date",
+ "Formatting a day of year needs a valid date",
SV("{:%j}"),
std::chrono::year_month_weekday{
std::chrono::year{1970}, std::chrono::month{1}, std::chrono::weekday_indexed{std::chrono::weekday{1}, 7}});
check_exception(
- "formatting a day of year needs a valid date",
+ "Formatting a day of year needs a valid date",
SV("{:%j}"),
std::chrono::year_month_weekday{
std::chrono::year{1970}, std::chrono::month{1}, std::chrono::weekday_indexed{std::chrono::weekday{13}, 1}});
check_exception(
- "formatting a day of year needs a valid date",
+ "Formatting a day of year needs a valid date",
SV("{:%j}"),
std::chrono::year_month_weekday{
std::chrono::year{1970}, std::chrono::month{0}, std::chrono::weekday_indexed{std::chrono::weekday{1}, 1}});
check_exception(
- "formatting a day of year needs a valid date",
+ "Formatting a day of year needs a valid date",
SV("{:%j}"),
std::chrono::year_month_weekday{
std::chrono::year{-32768}, std::chrono::month{1}, std::chrono::weekday_indexed{std::chrono::weekday{1}, 1}});
check_exception(
- "formatting a weekday needs a valid weekday",
+ "Formatting a weekday needs a valid weekday",
SV("{:%u}"),
std::chrono::year_month_weekday{
std::chrono::year{1970}, std::chrono::month{1}, std::chrono::weekday_indexed{std::chrono::weekday{13}, 1}});
check_exception(
- "formatting a week of year needs a valid date",
+ "Formatting a week of year needs a valid date",
SV("{:%U}"),
std::chrono::year_month_weekday{
std::chrono::year{1970}, std::chrono::month{1}, std::chrono::weekday_indexed{std::chrono::weekday{1}, 7}});
check_exception(
- "formatting a week of year needs a valid date",
+ "Formatting a week of year needs a valid date",
SV("{:%U}"),
std::chrono::year_month_weekday{
std::chrono::year{1970}, std::chrono::month{1}, std::chrono::weekday_indexed{std::chrono::weekday{13}, 1}});
check_exception(
- "formatting a week of year needs a valid date",
+ "Formatting a week of year needs a valid date",
SV("{:%U}"),
std::chrono::year_month_weekday{
std::chrono::year{1970}, std::chrono::month{0}, std::chrono::weekday_indexed{std::chrono::weekday{1}, 1}});
check_exception(
- "formatting a week of year needs a valid date",
+ "Formatting a week of year needs a valid date",
SV("{:%U}"),
std::chrono::year_month_weekday{
std::chrono::year{-32768}, std::chrono::month{1}, std::chrono::weekday_indexed{std::chrono::weekday{1}, 1}});
check_exception(
- "formatting a week of year needs a valid date",
+ "Formatting a week of year needs a valid date",
SV("{:%V}"),
std::chrono::year_month_weekday{
std::chrono::year{1970}, std::chrono::month{1}, std::chrono::weekday_indexed{std::chrono::weekday{1}, 7}});
check_exception(
- "formatting a week of year needs a valid date",
+ "Formatting a week of year needs a valid date",
SV("{:%V}"),
std::chrono::year_month_weekday{
std::chrono::year{1970}, std::chrono::month{1}, std::chrono::weekday_indexed{std::chrono::weekday{13}, 1}});
check_exception(
- "formatting a week of year needs a valid date",
+ "Formatting a week of year needs a valid date",
SV("{:%V}"),
std::chrono::year_month_weekday{
std::chrono::year{1970}, std::chrono::month{0}, std::chrono::weekday_indexed{std::chrono::weekday{1}, 1}});
check_exception(
- "formatting a week of year needs a valid date",
+ "Formatting a week of year needs a valid date",
SV("{:%V}"),
std::chrono::year_month_weekday{
std::chrono::year{-32768}, std::chrono::month{1}, std::chrono::weekday_indexed{std::chrono::weekday{1}, 1}});
check_exception(
- "formatting a weekday needs a valid weekday",
+ "Formatting a weekday needs a valid weekday",
SV("{:%w}"),
std::chrono::year_month_weekday{
std::chrono::year{1970}, std::chrono::month{1}, std::chrono::weekday_indexed{std::chrono::weekday{13}, 1}});
check_exception(
- "formatting a week of year needs a valid date",
+ "Formatting a week of year needs a valid date",
SV("{:%W}"),
std::chrono::year_month_weekday{
std::chrono::year{1970}, std::chrono::month{1}, std::chrono::weekday_indexed{std::chrono::weekday{1}, 7}});
check_exception(
- "formatting a week of year needs a valid date",
+ "Formatting a week of year needs a valid date",
SV("{:%W}"),
std::chrono::year_month_weekday{
std::chrono::year{1970}, std::chrono::month{1}, std::chrono::weekday_indexed{std::chrono::weekday{13}, 1}});
check_exception(
- "formatting a week of year needs a valid date",
+ "Formatting a week of year needs a valid date",
SV("{:%W}"),
std::chrono::year_month_weekday{
std::chrono::year{1970}, std::chrono::month{0}, std::chrono::weekday_indexed{std::chrono::weekday{1}, 1}});
check_exception(
- "formatting a week of year needs a valid date",
+ "Formatting a week of year needs a valid date",
SV("{:%W}"),
std::chrono::year_month_weekday{
std::chrono::year{-32768}, std::chrono::month{1}, std::chrono::weekday_indexed{std::chrono::weekday{1}, 1}});
std::chrono::year{1970}, std::chrono::January, std::chrono::weekday_indexed{std::chrono::weekday{1}, 1}});
check_exception(
- "Expected '%' or '}' in the chrono format-string",
+ "The format specifier expects a '%' or a '}'",
SV("{:A"),
std::chrono::year_month_weekday{
std::chrono::year{1970}, std::chrono::January, std::chrono::weekday_indexed{std::chrono::weekday{1}, 1}});
check_exception(
- "The chrono-specs contains a '{'",
+ "The chrono specifiers contain a '{'",
SV("{:%%{"),
std::chrono::year_month_weekday{
std::chrono::year{1970}, std::chrono::January, std::chrono::weekday_indexed{std::chrono::weekday{1}, 1}});
check_exception(
- "End of input while parsing the modifier chrono conversion-spec",
+ "End of input while parsing a conversion specifier",
SV("{:%"),
std::chrono::year_month_weekday{
std::chrono::year{1970}, std::chrono::January, std::chrono::weekday_indexed{std::chrono::weekday{1}, 1}});
// Precision not allowed
check_exception(
- "Expected '%' or '}' in the chrono format-string",
+ "The format specifier expects a '%' or a '}'",
SV("{:.3}"),
std::chrono::year_month_weekday{
std::chrono::year{1970}, std::chrono::January, std::chrono::weekday_indexed{std::chrono::weekday{1}, 1}});
// Weekday name conversion
check_exception(
- "formatting a weekday name needs a valid weekday",
+ "Formatting a weekday name needs a valid weekday",
SV("{:%a}"),
std::chrono::year_month_weekday_last{
std::chrono::year{1970}, std::chrono::month{1}, std::chrono::weekday_last{std::chrono::weekday{8}}});
check_exception(
- "formatting a weekday name needs a valid weekday",
+ "Formatting a weekday name needs a valid weekday",
SV("{:%A}"),
std::chrono::year_month_weekday_last{
std::chrono::year{1970}, std::chrono::month{1}, std::chrono::weekday_last{std::chrono::weekday{8}}});
// Weekday conversion
check_exception(
- "formatting a weekday needs a valid weekday",
+ "Formatting a weekday needs a valid weekday",
SV("{:%u}"),
std::chrono::year_month_weekday_last{
std::chrono::year{1970}, std::chrono::month{1}, std::chrono::weekday_last{std::chrono::weekday{8}}});
check_exception(
- "formatting a weekday needs a valid weekday",
+ "Formatting a weekday needs a valid weekday",
SV("{:%w}"),
std::chrono::year_month_weekday_last{
std::chrono::year{1970}, std::chrono::month{1}, std::chrono::weekday_last{std::chrono::weekday{8}}});
check_exception(
- "formatting a weekday needs a valid weekday",
+ "Formatting a weekday needs a valid weekday",
SV("{:%Ou}"),
std::chrono::year_month_weekday_last{
std::chrono::year{1970}, std::chrono::month{1}, std::chrono::weekday_last{std::chrono::weekday{8}}});
check_exception(
- "formatting a weekday needs a valid weekday",
+ "Formatting a weekday needs a valid weekday",
SV("{:%Ow}"),
std::chrono::year_month_weekday_last{
std::chrono::year{1970}, std::chrono::month{1}, std::chrono::weekday_last{std::chrono::weekday{8}}});
// Day of year field
check_exception(
- "formatting a day of year needs a valid date",
+ "Formatting a day of year needs a valid date",
SV("{:%j}"),
std::chrono::year_month_weekday_last{
std::chrono::year{1970}, std::chrono::month{1}, std::chrono::weekday_last{std::chrono::weekday{8}}});
// Day of year field
check_exception(
- "formatting a day of year needs a valid date",
+ "Formatting a day of year needs a valid date",
SV("{:%j}"),
std::chrono::year_month_weekday_last{
std::chrono::year{1970}, std::chrono::month{0}, std::chrono::weekday_last{std::chrono::weekday{1}}});
// Month name conversion
check_exception(
- "formatting a month name from an invalid month number",
+ "Formatting a month name from an invalid month number",
SV("{:%b}"),
std::chrono::year_month_weekday_last{
std::chrono::year{1970}, std::chrono::month{0}, std::chrono::weekday_last{std::chrono::weekday{1}}});
check_exception(
- "formatting a month name from an invalid month number",
+ "Formatting a month name from an invalid month number",
SV("{:%h}"),
std::chrono::year_month_weekday_last{
std::chrono::year{1970}, std::chrono::month{0}, std::chrono::weekday_last{std::chrono::weekday{1}}});
check_exception(
- "formatting a month name from an invalid month number",
+ "Formatting a month name from an invalid month number",
SV("{:%B}"),
std::chrono::year_month_weekday_last{
std::chrono::year{1970}, std::chrono::month{0}, std::chrono::weekday_last{std::chrono::weekday{1}}});
// Day of year field
check_exception(
- "formatting a day of year needs a valid date",
+ "Formatting a day of year needs a valid date",
SV("{:%j}"),
std::chrono::year_month_weekday_last{
std::chrono::year{-32768}, std::chrono::month{1}, std::chrono::weekday_last{std::chrono::weekday{1}}});
// Invalid Unicode Scalar Values
if constexpr (std::same_as<CharT, char>) {
- check_exception("The format-spec contains malformed Unicode characters", SV("{:\xed\xa0\x80^}"), 42); // U+D800
- check_exception("The format-spec contains malformed Unicode characters", SV("{:\xed\xa0\xbf^}"), 42); // U+DBFF
- check_exception("The format-spec contains malformed Unicode characters", SV("{:\xed\xbf\x80^}"), 42); // U+DC00
- check_exception("The format-spec contains malformed Unicode characters", SV("{:\xed\xbf\xbf^}"), 42); // U+DFFF
+ check_exception("The format specifier contains malformed Unicode characters", SV("{:\xed\xa0\x80^}"), 42); // U+D800
+ check_exception("The format specifier contains malformed Unicode characters", SV("{:\xed\xa0\xbf^}"), 42); // U+DBFF
+ check_exception("The format specifier contains malformed Unicode characters", SV("{:\xed\xbf\x80^}"), 42); // U+DC00
+ check_exception("The format specifier contains malformed Unicode characters", SV("{:\xed\xbf\xbf^}"), 42); // U+DFFF
check_exception(
- "The format-spec contains malformed Unicode characters", SV("{:\xf4\x90\x80\x80^}"), 42); // U+110000
+ "The format specifier contains malformed Unicode characters", SV("{:\xf4\x90\x80\x80^}"), 42); // U+110000
check_exception(
- "The format-spec contains malformed Unicode characters", SV("{:\xf4\x90\xbf\xbf^}"), 42); // U+11FFFF
+ "The format specifier contains malformed Unicode characters", SV("{:\xf4\x90\xbf\xbf^}"), 42); // U+11FFFF
- check_exception("The format-spec contains malformed Unicode characters",
+ check_exception("The format specifier contains malformed Unicode characters",
SV("{:\x80^}"),
42); // Trailing code unit with no leading one.
- check_exception(
- "The format-spec contains malformed Unicode characters", SV("{:\xc0^}"), 42); // Missing trailing code unit.
- check_exception(
- "The format-spec contains malformed Unicode characters", SV("{:\xe0\x80^}"), 42); // Missing trailing code unit.
- check_exception("The format-spec contains malformed Unicode characters",
+ check_exception("The format specifier contains malformed Unicode characters",
+ SV("{:\xc0^}"),
+ 42); // Missing trailing code unit.
+ check_exception("The format specifier contains malformed Unicode characters",
+ SV("{:\xe0\x80^}"),
+ 42); // Missing trailing code unit.
+ check_exception("The format specifier contains malformed Unicode characters",
SV("{:\xf0\x80^}"),
42); // Missing two trailing code units.
- check_exception("The format-spec contains malformed Unicode characters",
+ check_exception("The format specifier contains malformed Unicode characters",
SV("{:\xf0\x80\x80^}"),
42); // Missing trailing code unit.
#ifndef TEST_HAS_NO_WIDE_CHARACTERS
} else {
# ifdef TEST_SHORT_WCHAR
- check_exception("The format-spec contains malformed Unicode characters", std::wstring_view{L"{:\xd800^}"}, 42);
- check_exception("The format-spec contains malformed Unicode characters", std::wstring_view{L"{:\xdbff^}"}, 42);
- check_exception("The format-spec contains malformed Unicode characters", std::wstring_view{L"{:\xdc00^}"}, 42);
- check_exception("The format-spec contains malformed Unicode characters", std::wstring_view{L"{:\xddff^}"}, 42);
+ check_exception("The format specifier contains malformed Unicode characters", std::wstring_view{L"{:\xd800^}"}, 42);
+ check_exception("The format specifier contains malformed Unicode characters", std::wstring_view{L"{:\xdbff^}"}, 42);
+ check_exception("The format specifier contains malformed Unicode characters", std::wstring_view{L"{:\xdc00^}"}, 42);
+ check_exception("The format specifier contains malformed Unicode characters", std::wstring_view{L"{:\xddff^}"}, 42);
- check_exception("The format-spec contains malformed Unicode characters",
+ check_exception("The format specifier contains malformed Unicode characters",
std::wstring_view{L"{:\xdc00\xd800^}"},
42); // Reverted surrogates.
# else // TEST_SHORT_WCHAR
- check_exception("The fill character contains an invalid value", std::wstring_view{L"{:\xd800^}"}, 42);
- check_exception("The fill character contains an invalid value", std::wstring_view{L"{:\xdbff^}"}, 42);
- check_exception("The fill character contains an invalid value", std::wstring_view{L"{:\xdc00^}"}, 42);
- check_exception("The fill character contains an invalid value", std::wstring_view{L"{:\xddff^}"}, 42);
+ check_exception("The fill option contains an invalid value", std::wstring_view{L"{:\xd800^}"}, 42);
+ check_exception("The fill option contains an invalid value", std::wstring_view{L"{:\xdbff^}"}, 42);
+ check_exception("The fill option contains an invalid value", std::wstring_view{L"{:\xdc00^}"}, 42);
+ check_exception("The fill option contains an invalid value", std::wstring_view{L"{:\xddff^}"}, 42);
check_exception(
"The format specifier should consume the input or end with a '}'", std::wstring_view{L"{:\xdc00\xd800^}"}, 42);
- check_exception("The fill character contains an invalid value", std::wstring_view{L"{:\x00110000^}"}, 42);
- check_exception("The fill character contains an invalid value", std::wstring_view{L"{:\x0011ffff^}"}, 42);
+ check_exception("The fill option contains an invalid value", std::wstring_view{L"{:\x00110000^}"}, 42);
+ check_exception("The fill option contains an invalid value", std::wstring_view{L"{:\x0011ffff^}"}, 42);
# endif // TEST_SHORT_WCHAR
#endif // TEST_HAS_NO_WIDE_CHARACTERS
}
check_exception("The format specifier should consume the input or end with a '}'", SV("hello {:#}"), world);
// *** zero-padding ***
- check_exception("A format-spec width field shouldn't have a leading zero", SV("hello {:0}"), world);
+ check_exception("The width option should not have a leading zero", SV("hello {:0}"), world);
// *** width ***
// Width 0 allowed, but not useful for string arguments.
#ifdef _LIBCPP_VERSION
// This limit isn't specified in the Standard.
static_assert(std::__format::__number_max == 2'147'483'647, "Update the assert and the test.");
- check_exception("The numeric value of the format-spec is too large", SV("{:2147483648}"), world);
- check_exception("The numeric value of the format-spec is too large", SV("{:5000000000}"), world);
- check_exception("The numeric value of the format-spec is too large", SV("{:10000000000}"), world);
+ check_exception("The numeric value of the format specifier is too large", SV("{:2147483648}"), world);
+ check_exception("The numeric value of the format specifier is too large", SV("{:5000000000}"), world);
+ check_exception("The numeric value of the format specifier is too large", SV("{:10000000000}"), world);
#endif
- check_exception("A format-spec arg-id replacement shouldn't have a negative value", SV("hello {:{}}"), world, -1);
- check_exception("A format-spec arg-id replacement exceeds the maximum supported value", SV("hello {:{}}"), world,
- unsigned(-1));
- check_exception("Argument index out of bounds", SV("hello {:{}}"), world);
+ check_exception("An argument index may not have a negative value", SV("hello {:{}}"), world, -1);
+ check_exception("The value of the argument index exceeds its maximum value", SV("hello {:{}}"), world, unsigned(-1));
+ check_exception(
+ "The argument index value is too large for the number of arguments supplied", SV("hello {:{}}"), world);
check_exception(
"Replacement argument isn't a standard signed or unsigned integer type", SV("hello {:{}}"), world, universe);
check_exception("Using manual argument numbering in automatic argument numbering mode", SV("hello {:{0}}"), world, 1);
check_exception("Using automatic argument numbering in manual argument numbering mode", SV("hello {0:{}}"), world, 1);
// Arg-id may not have leading zeros.
- check_exception("Invalid arg-id", SV("hello {0:{01}}"), world, 1);
+ check_exception("The argument index is invalid", SV("hello {0:{01}}"), world, 1);
// *** precision ***
#ifdef _LIBCPP_VERSION
// This limit isn't specified in the Standard.
static_assert(std::__format::__number_max == 2'147'483'647, "Update the assert and the test.");
- check_exception("The numeric value of the format-spec is too large", SV("{:.2147483648}"), world);
- check_exception("The numeric value of the format-spec is too large", SV("{:.5000000000}"), world);
- check_exception("The numeric value of the format-spec is too large", SV("{:.10000000000}"), world);
+ check_exception("The numeric value of the format specifier is too large", SV("{:.2147483648}"), world);
+ check_exception("The numeric value of the format specifier is too large", SV("{:.5000000000}"), world);
+ check_exception("The numeric value of the format specifier is too large", SV("{:.10000000000}"), world);
#endif
// Precision 0 allowed, but not useful for string arguments.
check(SV("hello "), SV("hello {:.{}}"), world, 0);
// Precision may have leading zeros. Secondly tests the value is still base 10.
check(SV("hello 0123456789"), SV("hello {:.000010}"), STR("0123456789abcdef"));
- check_exception("A format-spec arg-id replacement shouldn't have a negative value", SV("hello {:.{}}"), world, -1);
- check_exception("A format-spec arg-id replacement exceeds the maximum supported value", SV("hello {:.{}}"), world,
- ~0u);
- check_exception("Argument index out of bounds", SV("hello {:.{}}"), world);
+ check_exception("An argument index may not have a negative value", SV("hello {:.{}}"), world, -1);
+ check_exception("The value of the argument index exceeds its maximum value", SV("hello {:.{}}"), world, ~0u);
+ check_exception(
+ "The argument index value is too large for the number of arguments supplied", SV("hello {:.{}}"), world);
check_exception(
"Replacement argument isn't a standard signed or unsigned integer type", SV("hello {:.{}}"), world, universe);
check_exception("Using manual argument numbering in automatic argument numbering mode", SV("hello {:.{0}}"), world,
check_exception("Using automatic argument numbering in manual argument numbering mode", SV("hello {0:.{}}"), world,
1);
// Arg-id may not have leading zeros.
- check_exception("Invalid arg-id", SV("hello {0:.{01}}"), world, 1);
+ check_exception("The argument index is invalid", SV("hello {0:.{01}}"), world, 1);
// *** locale-specific form ***
check_exception("The format specifier should consume the input or end with a '}'", SV("hello {:L}"), world);
const char* valid_types = "s";
#endif
for (const auto& fmt : invalid_types<CharT>(valid_types))
- check_exception("The format-spec type has a type not supported for a string argument", fmt, world);
+ check_exception("The type option contains an invalid value for a string formatting argument", fmt, world);
}
template <class CharT, class TestFunction>
check_exception("The format specifier should consume the input or end with a '}'", SV("{:.0}"), I(0));
check_exception("The format specifier should consume the input or end with a '}'", SV("{:.42}"), I(0));
+ check_exception("The format specifier should consume the input or end with a '}'", SV("{:.{}}"), I(0));
+ check_exception("The format specifier should consume the input or end with a '}'", SV("{:.{}}"), I(0), true);
+ check_exception("The format specifier should consume the input or end with a '}'", SV("{:.{}}"), I(0), 1.0);
+
// *** locale-specific form ***
// See locale-specific_form.pass.cpp
// *** type ***
for (const auto& fmt : invalid_types<CharT>("bBcdoxX"))
- check_exception("The type option contains an invalid value for an integer formatting argument", fmt, 42);
+ check_exception("The type option contains an invalid value for an integer formatting argument", fmt, I(0));
}
template <class I, class CharT, class TestFunction, class ExceptionTest>
check_exception("The format specifier should consume the input or end with a '}'", SV("{:.0c}"), I(0));
check_exception("The format specifier should consume the input or end with a '}'", SV("{:.42c}"), I(0));
+ check_exception("The format specifier should consume the input or end with a '}'", SV("{:.{}c}"), I(0));
+ check_exception("The format specifier should consume the input or end with a '}'", SV("{:.{}c}"), I(0), true);
+ check_exception("The format specifier should consume the input or end with a '}'", SV("{:.{}c}"), I(0), 1.0);
+
// *** locale-specific form ***
// Note it has no effect but it's allowed.
check(SV("answer is '*'"), SV("answer is '{:Lc}'"), I(42));
const char* valid_types = "bBcdoxX";
#endif
for (const auto& fmt : invalid_types<CharT>(valid_types))
- check_exception("The type option contains an invalid value for a character formatting argument", fmt, '*');
+ check_exception("The type option contains an invalid value for a character formatting argument", fmt, CharT('*'));
}
template <class F, class CharT, class TestFunction>
check(SV("answer is '0X0000'"), SV("answer is '{:06P}'"), P(nullptr));
// *** precision ***
- check_exception("The format specifier should consume the input or end with a '}'", SV("{:.}"), P(nullptr));
+ check_exception("The format specifier should consume the input or end with a '}'", SV("{:.}"), nullptr);
+ check_exception("The format specifier should consume the input or end with a '}'", SV("{:.0}"), nullptr);
+ check_exception("The format specifier should consume the input or end with a '}'", SV("{:.42}"), nullptr);
+
+ check_exception("The format specifier should consume the input or end with a '}'", SV("{:.{}}"), nullptr);
+ check_exception("The format specifier should consume the input or end with a '}'", SV("{:.{}}"), nullptr, true);
+ check_exception("The format specifier should consume the input or end with a '}'", SV("{:.{}}"), nullptr, 1.0);
// *** locale-specific form ***
check_exception("The format specifier should consume the input or end with a '}'", SV("{:L}"), P(nullptr));
// *** type ***
for (const auto& fmt : invalid_types<CharT>("xXs"))
- check_exception("The format-spec type has a type not supported for a status argument", fmt, status::foo);
+ check_exception("The type option contains an invalid value for a status formatting argument", fmt, status::foo);
}
template <class CharT, class TestFunction, class ExceptionTest>
template <class CharT, execution_modus modus, class TestFunction, class ExceptionTest>
void format_tests(TestFunction check, ExceptionTest check_exception) {
// *** Test escaping ***
-
check(SV("{"), SV("{{"));
check(SV("}"), SV("}}"));
check(SV("{:^}"), SV("{{:^}}"));
check_exception("The format string contains an invalid escape sequence", SV("{:}-}"), 42);
check_exception("The format string contains an invalid escape sequence", SV("} "));
- check_exception("The arg-id of the format-spec starts with an invalid character", SV("{-"), 42);
- check_exception("Argument index out of bounds", SV("hello {}"));
- check_exception("Argument index out of bounds", SV("hello {0}"));
- check_exception("Argument index out of bounds", SV("hello {1}"), 42);
+ check_exception("The argument index starts with an invalid character", SV("{-"), 42);
+ check_exception("The argument index value is too large for the number of arguments supplied", SV("hello {}"));
+ check_exception("The argument index value is too large for the number of arguments supplied", SV("hello {0}"));
+ check_exception("The argument index value is too large for the number of arguments supplied", SV("hello {1}"), 42);
// *** Test char format argument ***
// The `char` to `wchar_t` formatting is tested separately.
format_test_bool<CharT>(check, check_exception);
format_test_bool_as_integer<CharT>(check, check_exception);
}
-
// *** Test signed integral format argument ***
check(SV("hello 42"), SV("hello {}"), static_cast<signed char>(42));
check(SV("hello 42"), SV("hello {}"), static_cast<short>(42));
#ifndef TEST_HAS_NO_INT128
check(SV("hello 42"), SV("hello {}"), static_cast<__int128_t>(42));
#endif
+
if constexpr (modus == execution_modus::full)
format_test_signed_integer<CharT>(check, check_exception);
check(SV("__{'a': 'A', 'b': 'B', 'c': 'C'}___"), SV("{:_^{}}"), input, 35);
check(SV("#####{'a': 'A', 'b': 'B', 'c': 'C'}"), SV("{:#>{}}"), input, 35);
- check_exception("The format-spec range-fill field contains an invalid character", SV("{:}<}"), input);
- check_exception("The format-spec range-fill field contains an invalid character", SV("{:{<}"), input);
- check_exception("The format-spec range-fill field contains an invalid character", SV("{::<}"), input);
+ check_exception("The fill option contains an invalid value", SV("{:}<}"), input);
+ check_exception("The fill option contains an invalid value", SV("{:{<}"), input);
+ check_exception("The fill option contains an invalid value", SV("{::<}"), input);
// *** sign ***
- check_exception("The format-spec should consume the input or end with a '}'", SV("{:-}"), input);
- check_exception("The format-spec should consume the input or end with a '}'", SV("{:+}"), input);
- check_exception("The format-spec should consume the input or end with a '}'", SV("{: }"), input);
+ check_exception("The format specifier should consume the input or end with a '}'", SV("{:-}"), input);
+ check_exception("The format specifier should consume the input or end with a '}'", SV("{:+}"), input);
+ check_exception("The format specifier should consume the input or end with a '}'", SV("{: }"), input);
// *** alternate form ***
- check_exception("The format-spec should consume the input or end with a '}'", SV("{:#}"), input);
+ check_exception("The format specifier should consume the input or end with a '}'", SV("{:#}"), input);
// *** zero-padding ***
- check_exception("A format-spec width field shouldn't have a leading zero", SV("{:0}"), input);
+ check_exception("The width option should not have a leading zero", SV("{:0}"), input);
// *** precision ***
- check_exception("The format-spec should consume the input or end with a '}'", SV("{:.}"), input);
+ check_exception("The format specifier should consume the input or end with a '}'", SV("{:.}"), input);
// *** locale-specific form ***
- check_exception("The format-spec should consume the input or end with a '}'", SV("{:L}"), input);
+ check_exception("The format specifier should consume the input or end with a '}'", SV("{:L}"), input);
// *** n
check(SV("__'a': 'A', 'b': 'B', 'c': 'C'___"), SV("{:_^33n}"), input);
// *** type ***
check(SV("__{'a': 'A', 'b': 'B', 'c': 'C'}___"), SV("{:_^35m}"), input); // the m type does the same as the default.
- check_exception("The range-format-spec type s requires formatting a character type", SV("{:s}"), input);
- check_exception("The range-format-spec type ?s requires formatting a character type", SV("{:?s}"), input);
+ check_exception("Type s requires character type as formatting argument", SV("{:s}"), input);
+ check_exception("Type ?s requires character type as formatting argument", SV("{:?s}"), input);
for (std::basic_string_view<CharT> fmt : fmt_invalid_types<CharT>("s"))
- check_exception("The format-spec should consume the input or end with a '}'", fmt, input);
+ check_exception("The format specifier should consume the input or end with a '}'", fmt, input);
// ***** Only underlying has a format-spec
check(SV("{__'a': 'A'___, __'b': 'B'___, __'c': 'C'___}"), SV("{::_^{}}"), input, 13);
check(SV("{#####'a': 'A', #####'b': 'B', #####'c': 'C'}"), SV("{::#>{}}"), input, 13);
- check_exception("The format-spec range-fill field contains an invalid character", SV("{:::<}"), input);
- check_exception("The format-spec range-fill field contains an invalid character", SV("{::}<}"), input);
- check_exception("The format-spec range-fill field contains an invalid character", SV("{::{<}"), input);
+ check_exception("The fill option contains an invalid value", SV("{:::<}"), input);
+ check_exception("The fill option contains an invalid value", SV("{::}<}"), input);
+ check_exception("The fill option contains an invalid value", SV("{::{<}"), input);
// *** sign ***
- check_exception("The format-spec should consume the input or end with a '}'", SV("{::-}"), input);
- check_exception("The format-spec should consume the input or end with a '}'", SV("{::+}"), input);
- check_exception("The format-spec should consume the input or end with a '}'", SV("{:: }"), input);
+ check_exception("The format specifier should consume the input or end with a '}'", SV("{::-}"), input);
+ check_exception("The format specifier should consume the input or end with a '}'", SV("{::+}"), input);
+ check_exception("The format specifier should consume the input or end with a '}'", SV("{:: }"), input);
// *** alternate form ***
- check_exception("The format-spec should consume the input or end with a '}'", SV("{::#}"), input);
+ check_exception("The format specifier should consume the input or end with a '}'", SV("{::#}"), input);
// *** zero-padding ***
- check_exception("A format-spec width field shouldn't have a leading zero", SV("{::05}"), input);
+ check_exception("The width option should not have a leading zero", SV("{::05}"), input);
// *** precision ***
- check_exception("The format-spec should consume the input or end with a '}'", SV("{::.}"), input);
+ check_exception("The format specifier should consume the input or end with a '}'", SV("{::.}"), input);
// *** locale-specific form ***
- check_exception("The format-spec should consume the input or end with a '}'", SV("{::L}"), input);
+ check_exception("The format specifier should consume the input or end with a '}'", SV("{::L}"), input);
// *** type ***
check(SV("{'a': 'A', 'b': 'B', 'c': 'C'}"), SV("{::m}"), input);
check(SV("{'a': 'A', 'b': 'B', 'c': 'C'}"), SV("{::n}"), input);
- check_exception("The range-format-spec type s requires formatting a character type", SV("{:s}"), input);
- check_exception("The range-format-spec type ?s requires formatting a character type", SV("{:?s}"), input);
+ check_exception("Type s requires character type as formatting argument", SV("{:s}"), input);
+ check_exception("Type ?s requires character type as formatting argument", SV("{:?s}"), input);
for (std::basic_string_view<CharT> fmt : fmt_invalid_types<CharT>("s"))
- check_exception("The format-spec should consume the input or end with a '}'", fmt, input);
+ check_exception("The format specifier should consume the input or end with a '}'", fmt, input);
// ***** Both have a format-spec
check(SV("^^{###'a': 'A', ###'b': 'B', ###'c': 'C'}^^^"), SV("{:^^44:#>11}"), input);
check(SV("^^{###'a': 'A', ###'b': 'B', ###'c': 'C'}^^^"), SV("{:^^{}:#>11}"), input, 44);
check(SV("^^{###'a': 'A', ###'b': 'B', ###'c': 'C'}^^^"), SV("{:^^{}:#>{}}"), input, 44, 11);
- check_exception("Argument index out of bounds", SV("{:^^{}:#>11}"), input);
- check_exception("Argument index out of bounds", SV("{:^^{}:#>{}}"), input, 44);
+ check_exception(
+ "The argument index value is too large for the number of arguments supplied", SV("{:^^{}:#>11}"), input);
+ check_exception(
+ "The argument index value is too large for the number of arguments supplied", SV("{:^^{}:#>{}}"), input, 44);
}
//
check(SV("__{'a': 'A', 'b': 'B', 'c': 'C'}___"), SV("{:_^{}}"), input, 35);
check(SV("#####{'a': 'A', 'b': 'B', 'c': 'C'}"), SV("{:#>{}}"), input, 35);
- check_exception("The format-spec range-fill field contains an invalid character", SV("{:}<}"), input);
- check_exception("The format-spec range-fill field contains an invalid character", SV("{:{<}"), input);
- check_exception("The format-spec range-fill field contains an invalid character", SV("{::<}"), input);
+ check_exception("The fill option contains an invalid value", SV("{:}<}"), input);
+ check_exception("The fill option contains an invalid value", SV("{:{<}"), input);
+ check_exception("The fill option contains an invalid value", SV("{::<}"), input);
// *** sign ***
- check_exception("The format-spec should consume the input or end with a '}'", SV("{:-}"), input);
- check_exception("The format-spec should consume the input or end with a '}'", SV("{:+}"), input);
- check_exception("The format-spec should consume the input or end with a '}'", SV("{: }"), input);
+ check_exception("The format specifier should consume the input or end with a '}'", SV("{:-}"), input);
+ check_exception("The format specifier should consume the input or end with a '}'", SV("{:+}"), input);
+ check_exception("The format specifier should consume the input or end with a '}'", SV("{: }"), input);
// *** alternate form ***
- check_exception("The format-spec should consume the input or end with a '}'", SV("{:#}"), input);
+ check_exception("The format specifier should consume the input or end with a '}'", SV("{:#}"), input);
// *** zero-padding ***
- check_exception("A format-spec width field shouldn't have a leading zero", SV("{:0}"), input);
+ check_exception("The width option should not have a leading zero", SV("{:0}"), input);
// *** precision ***
- check_exception("The format-spec should consume the input or end with a '}'", SV("{:.}"), input);
+ check_exception("The format specifier should consume the input or end with a '}'", SV("{:.}"), input);
// *** locale-specific form ***
- check_exception("The format-spec should consume the input or end with a '}'", SV("{:L}"), input);
+ check_exception("The format specifier should consume the input or end with a '}'", SV("{:L}"), input);
// *** n
check(SV("__'a': 'A', 'b': 'B', 'c': 'C'___"), SV("{:_^33n}"), input);
// *** type ***
check(SV("__{'a': 'A', 'b': 'B', 'c': 'C'}___"), SV("{:_^35m}"), input); // the m type does the same as the default.
- check_exception("The range-format-spec type s requires formatting a character type", SV("{:s}"), input);
- check_exception("The range-format-spec type ?s requires formatting a character type", SV("{:?s}"), input);
+ check_exception("Type s requires character type as formatting argument", SV("{:s}"), input);
+ check_exception("Type ?s requires character type as formatting argument", SV("{:?s}"), input);
for (std::basic_string_view<CharT> fmt : fmt_invalid_types<CharT>("s"))
- check_exception("The format-spec should consume the input or end with a '}'", fmt, input);
+ check_exception("The format specifier should consume the input or end with a '}'", fmt, input);
// ***** Only underlying has a format-spec
check(SV("{'a': 'A' , 'b': 'B' , 'c': 'C' }"), SV("{::13}"), input);
check(SV("{__'a': 'A'___, __'b': 'B'___, __'c': 'C'___}"), SV("{::_^{}}"), input, 13);
check(SV("{#####'a': 'A', #####'b': 'B', #####'c': 'C'}"), SV("{::#>{}}"), input, 13);
- check_exception("The format-spec range-fill field contains an invalid character", SV("{:::<}"), input);
- check_exception("The format-spec range-fill field contains an invalid character", SV("{::}<}"), input);
- check_exception("The format-spec range-fill field contains an invalid character", SV("{::{<}"), input);
+ check_exception("The fill option contains an invalid value", SV("{:::<}"), input);
+ check_exception("The fill option contains an invalid value", SV("{::}<}"), input);
+ check_exception("The fill option contains an invalid value", SV("{::{<}"), input);
// *** sign ***
- check_exception("The format-spec should consume the input or end with a '}'", SV("{::-}"), input);
- check_exception("The format-spec should consume the input or end with a '}'", SV("{::+}"), input);
- check_exception("The format-spec should consume the input or end with a '}'", SV("{:: }"), input);
+ check_exception("The format specifier should consume the input or end with a '}'", SV("{::-}"), input);
+ check_exception("The format specifier should consume the input or end with a '}'", SV("{::+}"), input);
+ check_exception("The format specifier should consume the input or end with a '}'", SV("{:: }"), input);
// *** alternate form ***
- check_exception("The format-spec should consume the input or end with a '}'", SV("{::#}"), input);
+ check_exception("The format specifier should consume the input or end with a '}'", SV("{::#}"), input);
// *** zero-padding ***
- check_exception("A format-spec width field shouldn't have a leading zero", SV("{::05}"), input);
+ check_exception("The width option should not have a leading zero", SV("{::05}"), input);
// *** precision ***
- check_exception("The format-spec should consume the input or end with a '}'", SV("{::.}"), input);
+ check_exception("The format specifier should consume the input or end with a '}'", SV("{::.}"), input);
// *** locale-specific form ***
- check_exception("The format-spec should consume the input or end with a '}'", SV("{::L}"), input);
+ check_exception("The format specifier should consume the input or end with a '}'", SV("{::L}"), input);
// *** type ***
check(SV("{'a': 'A', 'b': 'B', 'c': 'C'}"), SV("{::m}"), input);
check(SV("{'a': 'A', 'b': 'B', 'c': 'C'}"), SV("{::n}"), input);
- check_exception("The range-format-spec type s requires formatting a character type", SV("{:s}"), input);
- check_exception("The range-format-spec type ?s requires formatting a character type", SV("{:?s}"), input);
+ check_exception("Type s requires character type as formatting argument", SV("{:s}"), input);
+ check_exception("Type ?s requires character type as formatting argument", SV("{:?s}"), input);
for (std::basic_string_view<CharT> fmt : fmt_invalid_types<CharT>("s"))
- check_exception("The format-spec should consume the input or end with a '}'", fmt, input);
+ check_exception("The format specifier should consume the input or end with a '}'", fmt, input);
// ***** Both have a format-spec
check(SV("^^{###'a': 'A', ###'b': 'B', ###'c': 'C'}^^^"), SV("{:^^44:#>11}"), input);
check(SV("^^{###'a': 'A', ###'b': 'B', ###'c': 'C'}^^^"), SV("{:^^{}:#>11}"), input, 44);
check(SV("^^{###'a': 'A', ###'b': 'B', ###'c': 'C'}^^^"), SV("{:^^{}:#>{}}"), input, 44, 11);
- check_exception("Argument index out of bounds", SV("{:^^{}:#>11}"), input);
- check_exception("Argument index out of bounds", SV("{:^^{}:#>{}}"), input, 44);
+ check_exception(
+ "The argument index value is too large for the number of arguments supplied", SV("{:^^{}:#>11}"), input);
+ check_exception(
+ "The argument index value is too large for the number of arguments supplied", SV("{:^^{}:#>{}}"), input, 44);
}
#endif // _LIBCPP_HAS_NO_WIDE_CHARACTERS
check(SV("__{false: 0, true: 42, true: 1}___"), SV("{:_^{}}"), input, 34);
check(SV("#####{false: 0, true: 42, true: 1}"), SV("{:#>{}}"), input, 34);
- check_exception("The format-spec range-fill field contains an invalid character", SV("{:}<}"), input);
- check_exception("The format-spec range-fill field contains an invalid character", SV("{:{<}"), input);
- check_exception("The format-spec range-fill field contains an invalid character", SV("{::<}"), input);
+ check_exception("The fill option contains an invalid value", SV("{:}<}"), input);
+ check_exception("The fill option contains an invalid value", SV("{:{<}"), input);
+ check_exception("The fill option contains an invalid value", SV("{::<}"), input);
// *** sign ***
- check_exception("The format-spec should consume the input or end with a '}'", SV("{:-}"), input);
- check_exception("The format-spec should consume the input or end with a '}'", SV("{:+}"), input);
- check_exception("The format-spec should consume the input or end with a '}'", SV("{: }"), input);
+ check_exception("The format specifier should consume the input or end with a '}'", SV("{:-}"), input);
+ check_exception("The format specifier should consume the input or end with a '}'", SV("{:+}"), input);
+ check_exception("The format specifier should consume the input or end with a '}'", SV("{: }"), input);
// *** alternate form ***
- check_exception("The format-spec should consume the input or end with a '}'", SV("{:#}"), input);
+ check_exception("The format specifier should consume the input or end with a '}'", SV("{:#}"), input);
// *** zero-padding ***
- check_exception("A format-spec width field shouldn't have a leading zero", SV("{:0}"), input);
+ check_exception("The width option should not have a leading zero", SV("{:0}"), input);
// *** precision ***
- check_exception("The format-spec should consume the input or end with a '}'", SV("{:.}"), input);
+ check_exception("The format specifier should consume the input or end with a '}'", SV("{:.}"), input);
// *** locale-specific form ***
- check_exception("The format-spec should consume the input or end with a '}'", SV("{:L}"), input);
+ check_exception("The format specifier should consume the input or end with a '}'", SV("{:L}"), input);
// *** n
check(SV("__false: 0, true: 42, true: 1___"), SV("{:_^32n}"), input);
// *** type ***
check(SV("__{false: 0, true: 42, true: 1}___"), SV("{:_^34m}"), input); // the m type does the same as the default.
- check_exception("The range-format-spec type s requires formatting a character type", SV("{:s}"), input);
- check_exception("The range-format-spec type ?s requires formatting a character type", SV("{:?s}"), input);
+ check_exception("Type s requires character type as formatting argument", SV("{:s}"), input);
+ check_exception("Type ?s requires character type as formatting argument", SV("{:?s}"), input);
for (std::basic_string_view<CharT> fmt : fmt_invalid_types<CharT>("s"))
- check_exception("The format-spec should consume the input or end with a '}'", fmt, input);
+ check_exception("The format specifier should consume the input or end with a '}'", fmt, input);
// ***** Only underlying has a format-spec
check(SV("{false: 0 , true: 42 , true: 1 }"), SV("{::10}"), input);
check(SV("{_false: 0_, _true: 42_, _true: 1__}"), SV("{::_^{}}"), input, 10);
check(SV("{##false: 0, ##true: 42, ###true: 1}"), SV("{::#>{}}"), input, 10);
- check_exception("The format-spec range-fill field contains an invalid character", SV("{:::<}"), input);
- check_exception("The format-spec range-fill field contains an invalid character", SV("{::}<}"), input);
- check_exception("The format-spec range-fill field contains an invalid character", SV("{::{<}"), input);
+ check_exception("The fill option contains an invalid value", SV("{:::<}"), input);
+ check_exception("The fill option contains an invalid value", SV("{::}<}"), input);
+ check_exception("The fill option contains an invalid value", SV("{::{<}"), input);
// *** sign ***
- check_exception("The format-spec should consume the input or end with a '}'", SV("{::-}"), input);
- check_exception("The format-spec should consume the input or end with a '}'", SV("{::+}"), input);
- check_exception("The format-spec should consume the input or end with a '}'", SV("{:: }"), input);
+ check_exception("The format specifier should consume the input or end with a '}'", SV("{::-}"), input);
+ check_exception("The format specifier should consume the input or end with a '}'", SV("{::+}"), input);
+ check_exception("The format specifier should consume the input or end with a '}'", SV("{:: }"), input);
// *** alternate form ***
- check_exception("The format-spec should consume the input or end with a '}'", SV("{::#}"), input);
+ check_exception("The format specifier should consume the input or end with a '}'", SV("{::#}"), input);
// *** zero-padding ***
- check_exception("A format-spec width field shouldn't have a leading zero", SV("{::05}"), input);
+ check_exception("The width option should not have a leading zero", SV("{::05}"), input);
// *** precision ***
- check_exception("The format-spec should consume the input or end with a '}'", SV("{::.}"), input);
+ check_exception("The format specifier should consume the input or end with a '}'", SV("{::.}"), input);
// *** locale-specific form ***
- check_exception("The format-spec should consume the input or end with a '}'", SV("{::L}"), input);
+ check_exception("The format specifier should consume the input or end with a '}'", SV("{::L}"), input);
// *** type ***
for (std::basic_string_view<CharT> fmt : fmt_invalid_nested_types<CharT>(""))
- check_exception("The format-spec should consume the input or end with a '}'", fmt, input);
+ check_exception("The format specifier should consume the input or end with a '}'", fmt, input);
// ***** Both have a format-spec
check(SV("^^{##false: 0, ##true: 42, ###true: 1}^^^"), SV("{:^^41:#>10}"), input);
check(SV("^^{##false: 0, ##true: 42, ###true: 1}^^^"), SV("{:^^{}:#>10}"), input, 41);
check(SV("^^{##false: 0, ##true: 42, ###true: 1}^^^"), SV("{:^^{}:#>{}}"), input, 41, 10);
- check_exception("Argument index out of bounds", SV("{:^^{}:#>10}"), input);
- check_exception("Argument index out of bounds", SV("{:^^{}:#>{}}"), input, 41);
+ check_exception(
+ "The argument index value is too large for the number of arguments supplied", SV("{:^^{}:#>10}"), input);
+ check_exception(
+ "The argument index value is too large for the number of arguments supplied", SV("{:^^{}:#>{}}"), input, 41);
}
//
check(SV("__{-42: 42, 1: -1, 42: -42}___"), SV("{:_^{}}"), input, 30);
check(SV("#####{-42: 42, 1: -1, 42: -42}"), SV("{:#>{}}"), input, 30);
- check_exception("The format-spec range-fill field contains an invalid character", SV("{:}<}"), input);
- check_exception("The format-spec range-fill field contains an invalid character", SV("{:{<}"), input);
- check_exception("The format-spec range-fill field contains an invalid character", SV("{::<}"), input);
+ check_exception("The fill option contains an invalid value", SV("{:}<}"), input);
+ check_exception("The fill option contains an invalid value", SV("{:{<}"), input);
+ check_exception("The fill option contains an invalid value", SV("{::<}"), input);
// *** sign ***
- check_exception("The format-spec should consume the input or end with a '}'", SV("{:-}"), input);
- check_exception("The format-spec should consume the input or end with a '}'", SV("{:+}"), input);
- check_exception("The format-spec should consume the input or end with a '}'", SV("{: }"), input);
+ check_exception("The format specifier should consume the input or end with a '}'", SV("{:-}"), input);
+ check_exception("The format specifier should consume the input or end with a '}'", SV("{:+}"), input);
+ check_exception("The format specifier should consume the input or end with a '}'", SV("{: }"), input);
// *** alternate form ***
- check_exception("The format-spec should consume the input or end with a '}'", SV("{:#}"), input);
+ check_exception("The format specifier should consume the input or end with a '}'", SV("{:#}"), input);
// *** zero-padding ***
- check_exception("A format-spec width field shouldn't have a leading zero", SV("{:0}"), input);
+ check_exception("The width option should not have a leading zero", SV("{:0}"), input);
// *** precision ***
- check_exception("The format-spec should consume the input or end with a '}'", SV("{:.}"), input);
+ check_exception("The format specifier should consume the input or end with a '}'", SV("{:.}"), input);
// *** locale-specific form ***
- check_exception("The format-spec should consume the input or end with a '}'", SV("{:L}"), input);
+ check_exception("The format specifier should consume the input or end with a '}'", SV("{:L}"), input);
// *** n
check(SV("__-42: 42, 1: -1, 42: -42___"), SV("{:_^28n}"), input);
// *** type ***
check(SV("__{-42: 42, 1: -1, 42: -42}___"), SV("{:_^30m}"), input); // the m type does the same as the default.
- check_exception("The range-format-spec type s requires formatting a character type", SV("{:s}"), input);
- check_exception("The range-format-spec type ?s requires formatting a character type", SV("{:?s}"), input);
+ check_exception("Type s requires character type as formatting argument", SV("{:s}"), input);
+ check_exception("Type ?s requires character type as formatting argument", SV("{:?s}"), input);
for (std::basic_string_view<CharT> fmt : fmt_invalid_types<CharT>("s"))
- check_exception("The format-spec should consume the input or end with a '}'", fmt, input);
+ check_exception("The format specifier should consume the input or end with a '}'", fmt, input);
// ***** Only underlying has a format-spec
check(SV("{-42: 42 , 1: -1 , 42: -42 }"), SV("{::10}"), input);
check(SV("{_-42: 42__, __1: -1___, _42: -42__}"), SV("{::_^{}}"), input, 10);
check(SV("{###-42: 42, #####1: -1, ###42: -42}"), SV("{::#>{}}"), input, 10);
- check_exception("The format-spec range-fill field contains an invalid character", SV("{:::<}"), input);
- check_exception("The format-spec range-fill field contains an invalid character", SV("{::}<}"), input);
- check_exception("The format-spec range-fill field contains an invalid character", SV("{::{<}"), input);
+ check_exception("The fill option contains an invalid value", SV("{:::<}"), input);
+ check_exception("The fill option contains an invalid value", SV("{::}<}"), input);
+ check_exception("The fill option contains an invalid value", SV("{::{<}"), input);
// *** sign ***
- check_exception("The format-spec should consume the input or end with a '}'", SV("{::-}"), input);
- check_exception("The format-spec should consume the input or end with a '}'", SV("{::+}"), input);
- check_exception("The format-spec should consume the input or end with a '}'", SV("{:: }"), input);
+ check_exception("The format specifier should consume the input or end with a '}'", SV("{::-}"), input);
+ check_exception("The format specifier should consume the input or end with a '}'", SV("{::+}"), input);
+ check_exception("The format specifier should consume the input or end with a '}'", SV("{:: }"), input);
// *** alternate form ***
- check_exception("The format-spec should consume the input or end with a '}'", SV("{::#}"), input);
+ check_exception("The format specifier should consume the input or end with a '}'", SV("{::#}"), input);
// *** zero-padding ***
- check_exception("A format-spec width field shouldn't have a leading zero", SV("{::05}"), input);
+ check_exception("The width option should not have a leading zero", SV("{::05}"), input);
// *** precision ***
- check_exception("The format-spec should consume the input or end with a '}'", SV("{::.}"), input);
+ check_exception("The format specifier should consume the input or end with a '}'", SV("{::.}"), input);
// *** locale-specific form ***
- check_exception("The format-spec should consume the input or end with a '}'", SV("{::L}"), input);
+ check_exception("The format specifier should consume the input or end with a '}'", SV("{::L}"), input);
// *** type ***
for (std::basic_string_view<CharT> fmt : fmt_invalid_nested_types<CharT>(""))
- check_exception("The format-spec should consume the input or end with a '}'", fmt, input);
+ check_exception("The format specifier should consume the input or end with a '}'", fmt, input);
// ***** Both have a format-spec
check(SV("^^{###-42: 42, #####1: -1, ###42: -42}^^^"), SV("{:^^41:#>10}"), input);
check(SV("^^{###-42: 42, #####1: -1, ###42: -42}^^^"), SV("{:^^{}:#>10}"), input, 41);
check(SV("^^{###-42: 42, #####1: -1, ###42: -42}^^^"), SV("{:^^{}:#>{}}"), input, 41, 10);
- check_exception("Argument index out of bounds", SV("{:^^{}:#>10}"), input);
- check_exception("Argument index out of bounds", SV("{:^^{}:#>{}}"), input, 41);
+ check_exception(
+ "The argument index value is too large for the number of arguments supplied", SV("{:^^{}:#>10}"), input);
+ check_exception(
+ "The argument index value is too large for the number of arguments supplied", SV("{:^^{}:#>{}}"), input, 41);
}
template <class CharT, class TestFunction, class ExceptionTest>
check(SV("__{-42: 42, 1: -1}___"), SV("{:_^{}}"), input, 21);
check(SV("#####{-42: 42, 1: -1}"), SV("{:#>{}}"), input, 21);
- check_exception("The format-spec range-fill field contains an invalid character", SV("{:}<}"), input);
- check_exception("The format-spec range-fill field contains an invalid character", SV("{:{<}"), input);
- check_exception("The format-spec range-fill field contains an invalid character", SV("{::<}"), input);
+ check_exception("The fill option contains an invalid value", SV("{:}<}"), input);
+ check_exception("The fill option contains an invalid value", SV("{:{<}"), input);
+ check_exception("The fill option contains an invalid value", SV("{::<}"), input);
// *** sign ***
- check_exception("The format-spec should consume the input or end with a '}'", SV("{:-}"), input);
- check_exception("The format-spec should consume the input or end with a '}'", SV("{:+}"), input);
- check_exception("The format-spec should consume the input or end with a '}'", SV("{: }"), input);
+ check_exception("The format specifier should consume the input or end with a '}'", SV("{:-}"), input);
+ check_exception("The format specifier should consume the input or end with a '}'", SV("{:+}"), input);
+ check_exception("The format specifier should consume the input or end with a '}'", SV("{: }"), input);
// *** alternate form ***
- check_exception("The format-spec should consume the input or end with a '}'", SV("{:#}"), input);
+ check_exception("The format specifier should consume the input or end with a '}'", SV("{:#}"), input);
// *** zero-padding ***
- check_exception("A format-spec width field shouldn't have a leading zero", SV("{:0}"), input);
+ check_exception("The width option should not have a leading zero", SV("{:0}"), input);
// *** precision ***
- check_exception("The format-spec should consume the input or end with a '}'", SV("{:.}"), input);
+ check_exception("The format specifier should consume the input or end with a '}'", SV("{:.}"), input);
// *** locale-specific form ***
- check_exception("The format-spec should consume the input or end with a '}'", SV("{:L}"), input);
+ check_exception("The format specifier should consume the input or end with a '}'", SV("{:L}"), input);
// *** n
check(SV("__-42: 42, 1: -1___"), SV("{:_^19n}"), input);
// *** type ***
check(SV("__{-42: 42, 1: -1}___"), SV("{:_^21m}"), input); // the m type does the same as the default.
- check_exception("The range-format-spec type s requires formatting a character type", SV("{:s}"), input);
- check_exception("The range-format-spec type ?s requires formatting a character type", SV("{:?s}"), input);
+ check_exception("Type s requires character type as formatting argument", SV("{:s}"), input);
+ check_exception("Type ?s requires character type as formatting argument", SV("{:?s}"), input);
for (std::basic_string_view<CharT> fmt : fmt_invalid_types<CharT>("s"))
- check_exception("The format-spec should consume the input or end with a '}'", fmt, input);
+ check_exception("The format specifier should consume the input or end with a '}'", fmt, input);
// ***** Only underlying has a format-spec
check(SV("{-42: 42 , 1: -1 }"), SV("{::10}"), input);
check(SV("{_-42: 42__, __1: -1___}"), SV("{::_^{}}"), input, 10);
check(SV("{###-42: 42, #####1: -1}"), SV("{::#>{}}"), input, 10);
- check_exception("The format-spec range-fill field contains an invalid character", SV("{:::<}"), input);
- check_exception("The format-spec range-fill field contains an invalid character", SV("{::}<}"), input);
- check_exception("The format-spec range-fill field contains an invalid character", SV("{::{<}"), input);
+ check_exception("The fill option contains an invalid value", SV("{:::<}"), input);
+ check_exception("The fill option contains an invalid value", SV("{::}<}"), input);
+ check_exception("The fill option contains an invalid value", SV("{::{<}"), input);
// *** sign ***
- check_exception("The format-spec should consume the input or end with a '}'", SV("{::-}"), input);
- check_exception("The format-spec should consume the input or end with a '}'", SV("{::+}"), input);
- check_exception("The format-spec should consume the input or end with a '}'", SV("{:: }"), input);
+ check_exception("The format specifier should consume the input or end with a '}'", SV("{::-}"), input);
+ check_exception("The format specifier should consume the input or end with a '}'", SV("{::+}"), input);
+ check_exception("The format specifier should consume the input or end with a '}'", SV("{:: }"), input);
// *** alternate form ***
- check_exception("The format-spec should consume the input or end with a '}'", SV("{::#}"), input);
+ check_exception("The format specifier should consume the input or end with a '}'", SV("{::#}"), input);
// *** zero-padding ***
- check_exception("A format-spec width field shouldn't have a leading zero", SV("{::05}"), input);
+ check_exception("The width option should not have a leading zero", SV("{::05}"), input);
// *** precision ***
- check_exception("The format-spec should consume the input or end with a '}'", SV("{::.}"), input);
+ check_exception("The format specifier should consume the input or end with a '}'", SV("{::.}"), input);
// *** locale-specific form ***
- check_exception("The format-spec should consume the input or end with a '}'", SV("{::L}"), input);
+ check_exception("The format specifier should consume the input or end with a '}'", SV("{::L}"), input);
// *** type ***
for (std::basic_string_view<CharT> fmt : fmt_invalid_nested_types<CharT>(""))
- check_exception("The format-spec should consume the input or end with a '}'", fmt, input);
+ check_exception("The format specifier should consume the input or end with a '}'", fmt, input);
// ***** Both have a format-spec
check(SV("^^{###-42: 42, #####1: -1}^^^"), SV("{:^^29:#>10}"), input);
check(SV("^^{###-42: 42, #####1: -1}^^^"), SV("{:^^{}:#>10}"), input, 29);
check(SV("^^{###-42: 42, #####1: -1}^^^"), SV("{:^^{}:#>{}}"), input, 29, 10);
- check_exception("Argument index out of bounds", SV("{:^^{}:#>10}"), input);
- check_exception("Argument index out of bounds", SV("{:^^{}:#>{}}"), input, 29);
+ check_exception(
+ "The argument index value is too large for the number of arguments supplied", SV("{:^^{}:#>10}"), input);
+ check_exception(
+ "The argument index value is too large for the number of arguments supplied", SV("{:^^{}:#>{}}"), input, 29);
}
//
check(SV("__{0x0: 0x0}___"), SV("{:_^{}}"), input, 15);
check(SV("#####{0x0: 0x0}"), SV("{:#>{}}"), input, 15);
- check_exception("The format-spec range-fill field contains an invalid character", SV("{:}<}"), input);
- check_exception("The format-spec range-fill field contains an invalid character", SV("{:{<}"), input);
- check_exception("The format-spec range-fill field contains an invalid character", SV("{::<}"), input);
+ check_exception("The fill option contains an invalid value", SV("{:}<}"), input);
+ check_exception("The fill option contains an invalid value", SV("{:{<}"), input);
+ check_exception("The fill option contains an invalid value", SV("{::<}"), input);
// *** sign ***
- check_exception("The format-spec should consume the input or end with a '}'", SV("{:#}"), input);
+ check_exception("The format specifier should consume the input or end with a '}'", SV("{:#}"), input);
// *** alternate form ***
- check_exception("The format-spec should consume the input or end with a '}'", SV("{:#}"), input);
+ check_exception("The format specifier should consume the input or end with a '}'", SV("{:#}"), input);
// *** zero-padding ***
- check_exception("A format-spec width field shouldn't have a leading zero", SV("{:0}"), input);
+ check_exception("The width option should not have a leading zero", SV("{:0}"), input);
// *** precision ***
- check_exception("The format-spec should consume the input or end with a '}'", SV("{:.}"), input);
+ check_exception("The format specifier should consume the input or end with a '}'", SV("{:.}"), input);
// *** locale-specific form ***
- check_exception("The format-spec should consume the input or end with a '}'", SV("{:L}"), input);
+ check_exception("The format specifier should consume the input or end with a '}'", SV("{:L}"), input);
// *** n
check(SV("__0x0: 0x0___"), SV("{:_^13n}"), input);
// *** type ***
check(SV("__{0x0: 0x0}___"), SV("{:_^15m}"), input); // the m type does the same as the default.
- check_exception("The range-format-spec type s requires formatting a character type", SV("{:s}"), input);
- check_exception("The range-format-spec type ?s requires formatting a character type", SV("{:?s}"), input);
+ check_exception("Type s requires character type as formatting argument", SV("{:s}"), input);
+ check_exception("Type ?s requires character type as formatting argument", SV("{:?s}"), input);
for (std::basic_string_view<CharT> fmt : fmt_invalid_types<CharT>("s"))
- check_exception("The format-spec should consume the input or end with a '}'", fmt, input);
+ check_exception("The format specifier should consume the input or end with a '}'", fmt, input);
// ***** Only underlying has a format-spec
check(SV("{0x0: 0x0 }"), SV("{::13}"), input);
check(SV("{__0x0: 0x0___}"), SV("{::_^{}}"), input, 13);
check(SV("{#####0x0: 0x0}"), SV("{::#>{}}"), input, 13);
- check_exception("The format-spec range-fill field contains an invalid character", SV("{:::<}"), input);
- check_exception("The format-spec range-fill field contains an invalid character", SV("{::}<}"), input);
- check_exception("The format-spec range-fill field contains an invalid character", SV("{::{<}"), input);
+ check_exception("The fill option contains an invalid value", SV("{:::<}"), input);
+ check_exception("The fill option contains an invalid value", SV("{::}<}"), input);
+ check_exception("The fill option contains an invalid value", SV("{::{<}"), input);
// *** sign ***
- check_exception("The format-spec should consume the input or end with a '}'", SV("{::-}"), input);
- check_exception("The format-spec should consume the input or end with a '}'", SV("{::+}"), input);
- check_exception("The format-spec should consume the input or end with a '}'", SV("{:: }"), input);
+ check_exception("The format specifier should consume the input or end with a '}'", SV("{::-}"), input);
+ check_exception("The format specifier should consume the input or end with a '}'", SV("{::+}"), input);
+ check_exception("The format specifier should consume the input or end with a '}'", SV("{:: }"), input);
// *** alternate form ***
- check_exception("The format-spec should consume the input or end with a '}'", SV("{::#}"), input);
+ check_exception("The format specifier should consume the input or end with a '}'", SV("{::#}"), input);
// *** zero-padding ***
- check_exception("A format-spec width field shouldn't have a leading zero", SV("{::05}"), input);
+ check_exception("The width option should not have a leading zero", SV("{::05}"), input);
// *** precision ***
- check_exception("The format-spec should consume the input or end with a '}'", SV("{::.}"), input);
+ check_exception("The format specifier should consume the input or end with a '}'", SV("{::.}"), input);
// *** locale-specific form ***
- check_exception("The format-spec should consume the input or end with a '}'", SV("{::L}"), input);
+ check_exception("The format specifier should consume the input or end with a '}'", SV("{::L}"), input);
// *** type ***
for (std::basic_string_view<CharT> fmt : fmt_invalid_nested_types<CharT>(""))
- check_exception("The format-spec should consume the input or end with a '}'", fmt, input);
+ check_exception("The format specifier should consume the input or end with a '}'", fmt, input);
// ***** Both have a format-spec
check(SV("^^{###0x0: 0x0}^^^"), SV("{:^^18:#>11}"), input);
check(SV("^^{###0x0: 0x0}^^^"), SV("{:^^{}:#>11}"), input, 18);
check(SV("^^{###0x0: 0x0}^^^"), SV("{:^^{}:#>{}}"), input, 18, 11);
- check_exception("Argument index out of bounds", SV("{:^^{}:#>11}"), input);
- check_exception("Argument index out of bounds", SV("{:^^{}:#>{}}"), input, 18);
+ check_exception(
+ "The argument index value is too large for the number of arguments supplied", SV("{:^^{}:#>11}"), input);
+ check_exception(
+ "The argument index value is too large for the number of arguments supplied", SV("{:^^{}:#>{}}"), input, 18);
}
//
check(SV(R"(__{"hello": "HELLO", "world": "WORLD"}___)"), SV("{:_^{}}"), input, 41);
check(SV(R"(#####{"hello": "HELLO", "world": "WORLD"})"), SV("{:#>{}}"), input, 41);
- check_exception("The format-spec range-fill field contains an invalid character", SV("{:}<}"), input);
- check_exception("The format-spec range-fill field contains an invalid character", SV("{:{<}"), input);
- check_exception("The format-spec range-fill field contains an invalid character", SV("{::<}"), input);
+ check_exception("The fill option contains an invalid value", SV("{:}<}"), input);
+ check_exception("The fill option contains an invalid value", SV("{:{<}"), input);
+ check_exception("The fill option contains an invalid value", SV("{::<}"), input);
// *** sign ***
- check_exception("The format-spec should consume the input or end with a '}'", SV("{:#}"), input);
+ check_exception("The format specifier should consume the input or end with a '}'", SV("{:#}"), input);
// *** alternate form ***
- check_exception("The format-spec should consume the input or end with a '}'", SV("{:#}"), input);
+ check_exception("The format specifier should consume the input or end with a '}'", SV("{:#}"), input);
// *** zero-padding ***
- check_exception("A format-spec width field shouldn't have a leading zero", SV("{:0}"), input);
+ check_exception("The width option should not have a leading zero", SV("{:0}"), input);
// *** precision ***
- check_exception("The format-spec should consume the input or end with a '}'", SV("{:.}"), input);
+ check_exception("The format specifier should consume the input or end with a '}'", SV("{:.}"), input);
// *** locale-specific form ***
- check_exception("The format-spec should consume the input or end with a '}'", SV("{:L}"), input);
+ check_exception("The format specifier should consume the input or end with a '}'", SV("{:L}"), input);
// *** n
check(SV(R"(__"hello": "HELLO", "world": "WORLD"___)"), SV("{:_^39n}"), input);
// *** type ***
check(SV(R"(__{"hello": "HELLO", "world": "WORLD"}___)"), SV("{:_^41m}"), input);
- check_exception("The range-format-spec type s requires formatting a character type", SV("{:s}"), input);
- check_exception("The range-format-spec type ?s requires formatting a character type", SV("{:?s}"), input);
+ check_exception("Type s requires character type as formatting argument", SV("{:s}"), input);
+ check_exception("Type ?s requires character type as formatting argument", SV("{:?s}"), input);
for (std::basic_string_view<CharT> fmt : fmt_invalid_types<CharT>("s"))
- check_exception("The format-spec should consume the input or end with a '}'", fmt, input);
+ check_exception("The format specifier should consume the input or end with a '}'", fmt, input);
// ***** Only underlying has a format-spec
check(SV(R"({"hello": "HELLO" , "world": "WORLD" })"), SV("{::21}"), input);
check(SV(R"({__"hello": "HELLO"___, __"world": "WORLD"___})"), SV("{::_^{}}"), input, 21);
check(SV(R"({#####"hello": "HELLO", #####"world": "WORLD"})"), SV("{::#>{}}"), input, 21);
- check_exception("The format-spec range-fill field contains an invalid character", SV("{:::<}"), input);
- check_exception("The format-spec range-fill field contains an invalid character", SV("{::}<}"), input);
- check_exception("The format-spec range-fill field contains an invalid character", SV("{::{<}"), input);
+ check_exception("The fill option contains an invalid value", SV("{:::<}"), input);
+ check_exception("The fill option contains an invalid value", SV("{::}<}"), input);
+ check_exception("The fill option contains an invalid value", SV("{::{<}"), input);
// *** sign ***
- check_exception("The format-spec should consume the input or end with a '}'", SV("{::-}"), input);
- check_exception("The format-spec should consume the input or end with a '}'", SV("{::+}"), input);
- check_exception("The format-spec should consume the input or end with a '}'", SV("{:: }"), input);
+ check_exception("The format specifier should consume the input or end with a '}'", SV("{::-}"), input);
+ check_exception("The format specifier should consume the input or end with a '}'", SV("{::+}"), input);
+ check_exception("The format specifier should consume the input or end with a '}'", SV("{:: }"), input);
// *** alternate form ***
- check_exception("The format-spec should consume the input or end with a '}'", SV("{::#}"), input);
+ check_exception("The format specifier should consume the input or end with a '}'", SV("{::#}"), input);
// *** zero-padding ***
- check_exception("A format-spec width field shouldn't have a leading zero", SV("{::05}"), input);
+ check_exception("The width option should not have a leading zero", SV("{::05}"), input);
// *** precision ***
- check_exception("The format-spec should consume the input or end with a '}'", SV("{::.}"), input);
+ check_exception("The format specifier should consume the input or end with a '}'", SV("{::.}"), input);
// *** locale-specific form ***
- check_exception("The format-spec should consume the input or end with a '}'", SV("{::L}"), input);
+ check_exception("The format specifier should consume the input or end with a '}'", SV("{::L}"), input);
// *** type ***
for (std::basic_string_view<CharT> fmt : fmt_invalid_nested_types<CharT>(""))
- check_exception("The format-spec should consume the input or end with a '}'", fmt, input);
+ check_exception("The format specifier should consume the input or end with a '}'", fmt, input);
// ***** Both have a format-spec
check(SV(R"(^^{#####"hello": "HELLO", #####"world": "WORLD"}^^^)"), SV("{:^^{}:#>21}"), input, 51);
check(SV(R"(^^{#####"hello": "HELLO", #####"world": "WORLD"}^^^)"), SV("{:^^{}:#>{}}"), input, 51, 21);
- check_exception("Argument index out of bounds", SV("{:^^{}:#>21}"), input);
- check_exception("Argument index out of bounds", SV("{:^^{}:#>{}}"), input, 51);
+ check_exception(
+ "The argument index value is too large for the number of arguments supplied", SV("{:^^{}:#>21}"), input);
+ check_exception(
+ "The argument index value is too large for the number of arguments supplied", SV("{:^^{}:#>{}}"), input, 51);
}
//
check(SV("__{0xaa55: 0xaaaa, 0xaa55: 0x5555}___"), SV("{:_^{}}"), input, 37);
check(SV("#####{0xaa55: 0xaaaa, 0xaa55: 0x5555}"), SV("{:#>{}}"), input, 37);
- check_exception("The format-spec range-fill field contains an invalid character", SV("{:}<}"), input);
- check_exception("The format-spec range-fill field contains an invalid character", SV("{:{<}"), input);
- check_exception("The format-spec range-fill field contains an invalid character", SV("{::<}"), input);
+ check_exception("The fill option contains an invalid value", SV("{:}<}"), input);
+ check_exception("The fill option contains an invalid value", SV("{:{<}"), input);
+ check_exception("The fill option contains an invalid value", SV("{::<}"), input);
// *** sign ***
- check_exception("The format-spec should consume the input or end with a '}'", SV("{:-}"), input);
- check_exception("The format-spec should consume the input or end with a '}'", SV("{:+}"), input);
- check_exception("The format-spec should consume the input or end with a '}'", SV("{: }"), input);
+ check_exception("The format specifier should consume the input or end with a '}'", SV("{:-}"), input);
+ check_exception("The format specifier should consume the input or end with a '}'", SV("{:+}"), input);
+ check_exception("The format specifier should consume the input or end with a '}'", SV("{: }"), input);
// *** alternate form ***
- check_exception("The format-spec should consume the input or end with a '}'", SV("{:#}"), input);
+ check_exception("The format specifier should consume the input or end with a '}'", SV("{:#}"), input);
// *** zero-padding ***
- check_exception("A format-spec width field shouldn't have a leading zero", SV("{:0}"), input);
+ check_exception("The width option should not have a leading zero", SV("{:0}"), input);
// *** precision ***
- check_exception("The format-spec should consume the input or end with a '}'", SV("{:.}"), input);
+ check_exception("The format specifier should consume the input or end with a '}'", SV("{:.}"), input);
// *** locale-specific form ***
- check_exception("The format-spec should consume the input or end with a '}'", SV("{:L}"), input);
+ check_exception("The format specifier should consume the input or end with a '}'", SV("{:L}"), input);
// *** n
check(SV("__0xaa55: 0xaaaa, 0xaa55: 0x5555___"), SV("{:_^35n}"), input);
// *** type ***
check(SV("__{0xaa55: 0xaaaa, 0xaa55: 0x5555}___"), SV("{:_^37}"), input); // the m type does the same as the default.
- check_exception("The range-format-spec type s requires formatting a character type", SV("{:s}"), input);
- check_exception("The range-format-spec type ?s requires formatting a character type", SV("{:?s}"), input);
+ check_exception("Type s requires character type as formatting argument", SV("{:s}"), input);
+ check_exception("Type ?s requires character type as formatting argument", SV("{:?s}"), input);
// Underlying can't have a format-spec
}
check(SV("__{'a', 'b', 'c'}___"), SV("{:_^{}}"), input, 20);
check(SV("#####{'a', 'b', 'c'}"), SV("{:#>{}}"), input, 20);
- check_exception("The format-spec range-fill field contains an invalid character", SV("{:}<}"), input);
- check_exception("The format-spec range-fill field contains an invalid character", SV("{:{<}"), input);
- check_exception("The format-spec range-fill field contains an invalid character", SV("{::<}"), input);
+ check_exception("The fill option contains an invalid value", SV("{:}<}"), input);
+ check_exception("The fill option contains an invalid value", SV("{:{<}"), input);
+ check_exception("The fill option contains an invalid value", SV("{::<}"), input);
// *** sign ***
- check_exception("The format-spec should consume the input or end with a '}'", SV("{:-}"), input);
- check_exception("The format-spec should consume the input or end with a '}'", SV("{:+}"), input);
- check_exception("The format-spec should consume the input or end with a '}'", SV("{: }"), input);
+ check_exception("The format specifier should consume the input or end with a '}'", SV("{:-}"), input);
+ check_exception("The format specifier should consume the input or end with a '}'", SV("{:+}"), input);
+ check_exception("The format specifier should consume the input or end with a '}'", SV("{: }"), input);
// *** alternate form ***
- check_exception("The format-spec should consume the input or end with a '}'", SV("{:#}"), input);
+ check_exception("The format specifier should consume the input or end with a '}'", SV("{:#}"), input);
// *** zero-padding ***
- check_exception("A format-spec width field shouldn't have a leading zero", SV("{:0}"), input);
+ check_exception("The width option should not have a leading zero", SV("{:0}"), input);
// *** precision ***
- check_exception("The format-spec should consume the input or end with a '}'", SV("{:.}"), input);
+ check_exception("The format specifier should consume the input or end with a '}'", SV("{:.}"), input);
// *** locale-specific form ***
- check_exception("The format-spec should consume the input or end with a '}'", SV("{:L}"), input);
+ check_exception("The format specifier should consume the input or end with a '}'", SV("{:L}"), input);
// *** n
check(SV("__'a', 'b', 'c'___"), SV("{:_^18n}"), input);
// *** type ***
- check_exception("The range-format-spec type m requires two elements for a pair or tuple", SV("{:m}"), input);
+ check_exception("Type m requires a pair or a tuple with two elements", SV("{:m}"), input);
// ***** Only underlying has a format-spec
check(SV("{a , b , c }"), SV("{::4}"), input);
check(SV("{_a__, _b__, _c__}"), SV("{::_^{}}"), input, 4);
check(SV("{:::a, :::b, :::c}"), SV("{:::>{}}"), input, 4);
- check_exception("The format-spec fill field contains an invalid character", SV("{::}<}"), input);
- check_exception("The format-spec fill field contains an invalid character", SV("{::{<}"), input);
+ check_exception("The fill option contains an invalid value", SV("{::}<}"), input);
+ check_exception("The fill option contains an invalid value", SV("{::{<}"), input);
// *** sign ***
check_exception("The format specifier for a character does not allow the sign option", SV("{::-}"), input);
check(SV("^^{:a, :b, :c}^^^"), SV("{:^^{}::>2}"), input, 17);
check(SV("^^{:a, :b, :c}^^^"), SV("{:^^{}::>{}}"), input, 17, 2);
- check_exception("Argument index out of bounds", SV("{:^^{}::>2}"), input);
- check_exception("Argument index out of bounds", SV("{:^^{}::>{}}"), input, 17);
+ check_exception(
+ "The argument index value is too large for the number of arguments supplied", SV("{:^^{}::>2}"), input);
+ check_exception(
+ "The argument index value is too large for the number of arguments supplied", SV("{:^^{}::>{}}"), input, 17);
}
// A set can be written as a string, based on
check(SV("_abc__"), SV("{:_^{}s}"), input, 6);
check(SV("###abc"), SV("{:#>{}s}"), input, 6);
- check_exception("The format-spec range-fill field contains an invalid character", SV("{:}<s}"), input);
- check_exception("The format-spec range-fill field contains an invalid character", SV("{:{<s}"), input);
- check_exception("The format-spec range-fill field contains an invalid character", SV("{::<s}"), input);
+ check_exception("The fill option contains an invalid value", SV("{:}<s}"), input);
+ check_exception("The fill option contains an invalid value", SV("{:{<s}"), input);
+ check_exception("The fill option contains an invalid value", SV("{::<s}"), input);
// *** sign ***
- check_exception("The format-spec should consume the input or end with a '}'", SV("{:-s}"), input);
- check_exception("The format-spec should consume the input or end with a '}'", SV("{:+s}"), input);
- check_exception("The format-spec should consume the input or end with a '}'", SV("{: s}"), input);
+ check_exception("The format specifier should consume the input or end with a '}'", SV("{:-s}"), input);
+ check_exception("The format specifier should consume the input or end with a '}'", SV("{:+s}"), input);
+ check_exception("The format specifier should consume the input or end with a '}'", SV("{: s}"), input);
// *** alternate form ***
- check_exception("The format-spec should consume the input or end with a '}'", SV("{:#s}"), input);
+ check_exception("The format specifier should consume the input or end with a '}'", SV("{:#s}"), input);
// *** zero-padding ***
- check_exception("A format-spec width field shouldn't have a leading zero", SV("{:0s}"), input);
+ check_exception("The width option should not have a leading zero", SV("{:0s}"), input);
// *** precision ***
- check_exception("The format-spec should consume the input or end with a '}'", SV("{:.s}"), input);
+ check_exception("The format specifier should consume the input or end with a '}'", SV("{:.s}"), input);
// *** locale-specific form ***
- check_exception("The format-spec should consume the input or end with a '}'", SV("{:Ls}"), input);
+ check_exception("The format specifier should consume the input or end with a '}'", SV("{:Ls}"), input);
// *** n
check_exception("The n option and type s can't be used together", SV("{:ns}"), input);
// *** type ***
- check_exception("The range-format-spec type m requires two elements for a pair or tuple", SV("{:m}"), input);
+ check_exception("Type m requires a pair or a tuple with two elements", SV("{:m}"), input);
// ***** Only underlying has a format-spec
check_exception("Type s and an underlying format specification can't be used together", SV("{:s:}"), input);
check(SV(R"(_"abc"__)"), SV("{:_^{}?s}"), input, 8);
check(SV(R"(###"abc")"), SV("{:#>{}?s}"), input, 8);
- check_exception("The format-spec range-fill field contains an invalid character", SV("{:}<?s}"), input);
- check_exception("The format-spec range-fill field contains an invalid character", SV("{:{<?s}"), input);
- check_exception("The format-spec range-fill field contains an invalid character", SV("{::<?s}"), input);
+ check_exception("The fill option contains an invalid value", SV("{:}<?s}"), input);
+ check_exception("The fill option contains an invalid value", SV("{:{<?s}"), input);
+ check_exception("The fill option contains an invalid value", SV("{::<?s}"), input);
// *** sign ***
- check_exception("The format-spec should consume the input or end with a '}'", SV("{:-?s}"), input);
- check_exception("The format-spec should consume the input or end with a '}'", SV("{:+?s}"), input);
- check_exception("The format-spec should consume the input or end with a '}'", SV("{: ?s}"), input);
+ check_exception("The format specifier should consume the input or end with a '}'", SV("{:-?s}"), input);
+ check_exception("The format specifier should consume the input or end with a '}'", SV("{:+?s}"), input);
+ check_exception("The format specifier should consume the input or end with a '}'", SV("{: ?s}"), input);
// *** alternate form ***
- check_exception("The format-spec should consume the input or end with a '}'", SV("{:#?s}"), input);
+ check_exception("The format specifier should consume the input or end with a '}'", SV("{:#?s}"), input);
// *** zero-padding ***
- check_exception("A format-spec width field shouldn't have a leading zero", SV("{:0?s}"), input);
+ check_exception("The width option should not have a leading zero", SV("{:0?s}"), input);
// *** precision ***
- check_exception("The format-spec should consume the input or end with a '}'", SV("{:.?s}"), input);
+ check_exception("The format specifier should consume the input or end with a '}'", SV("{:.?s}"), input);
// *** locale-specific form ***
- check_exception("The format-spec should consume the input or end with a '}'", SV("{:L?s}"), input);
+ check_exception("The format specifier should consume the input or end with a '}'", SV("{:L?s}"), input);
// *** n
check_exception("The n option and type ?s can't be used together", SV("{:n?s}"), input);
// *** type ***
- check_exception("The range-format-spec type m requires two elements for a pair or tuple", SV("{:m}"), input);
+ check_exception("Type m requires a pair or a tuple with two elements", SV("{:m}"), input);
// ***** Only underlying has a format-spec
check_exception("Type ?s and an underlying format specification can't be used together", SV("{:?s:}"), input);
check(SV("__{'a', 'b', 'c'}___"), SV("{:_^{}}"), input, 20);
check(SV("#####{'a', 'b', 'c'}"), SV("{:#>{}}"), input, 20);
- check_exception("The format-spec range-fill field contains an invalid character", SV("{:}<}"), input);
- check_exception("The format-spec range-fill field contains an invalid character", SV("{:{<}"), input);
- check_exception("The format-spec range-fill field contains an invalid character", SV("{::<}"), input);
+ check_exception("The fill option contains an invalid value", SV("{:}<}"), input);
+ check_exception("The fill option contains an invalid value", SV("{:{<}"), input);
+ check_exception("The fill option contains an invalid value", SV("{::<}"), input);
// *** sign ***
- check_exception("The format-spec should consume the input or end with a '}'", SV("{:-}"), input);
- check_exception("The format-spec should consume the input or end with a '}'", SV("{:+}"), input);
- check_exception("The format-spec should consume the input or end with a '}'", SV("{: }"), input);
+ check_exception("The format specifier should consume the input or end with a '}'", SV("{:-}"), input);
+ check_exception("The format specifier should consume the input or end with a '}'", SV("{:+}"), input);
+ check_exception("The format specifier should consume the input or end with a '}'", SV("{: }"), input);
// *** alternate form ***
- check_exception("The format-spec should consume the input or end with a '}'", SV("{:#}"), input);
+ check_exception("The format specifier should consume the input or end with a '}'", SV("{:#}"), input);
// *** zero-padding ***
- check_exception("A format-spec width field shouldn't have a leading zero", SV("{:0}"), input);
+ check_exception("The width option should not have a leading zero", SV("{:0}"), input);
// *** precision ***
- check_exception("The format-spec should consume the input or end with a '}'", SV("{:.}"), input);
+ check_exception("The format specifier should consume the input or end with a '}'", SV("{:.}"), input);
// *** locale-specific form ***
- check_exception("The format-spec should consume the input or end with a '}'", SV("{:L}"), input);
+ check_exception("The format specifier should consume the input or end with a '}'", SV("{:L}"), input);
// *** n
check(SV("__'a', 'b', 'c'___"), SV("{:_^18n}"), input);
// *** type ***
- check_exception("The range-format-spec type m requires two elements for a pair or tuple", SV("{:m}"), input);
+ check_exception("Type m requires a pair or a tuple with two elements", SV("{:m}"), input);
// ***** Only underlying has a format-spec
check(SV("{a , b , c }"), SV("{::4}"), input);
check(SV("{_a__, _b__, _c__}"), SV("{::_^{}}"), input, 4);
check(SV("{:::a, :::b, :::c}"), SV("{:::>{}}"), input, 4);
- check_exception("The format-spec fill field contains an invalid character", SV("{::}<}"), input);
- check_exception("The format-spec fill field contains an invalid character", SV("{::{<}"), input);
+ check_exception("The fill option contains an invalid value", SV("{::}<}"), input);
+ check_exception("The fill option contains an invalid value", SV("{::{<}"), input);
// *** sign ***
check_exception("The format specifier for a character does not allow the sign option", SV("{::-}"), input);
check(SV("^^{:a, :b, :c}^^^"), SV("{:^^{}::>2}"), input, 17);
check(SV("^^{:a, :b, :c}^^^"), SV("{:^^{}::>{}}"), input, 17, 2);
- check_exception("Argument index out of bounds", SV("{:^^{}::>2}"), input);
- check_exception("Argument index out of bounds", SV("{:^^{}::>{}}"), input, 17);
+ check_exception(
+ "The argument index value is too large for the number of arguments supplied", SV("{:^^{}::>2}"), input);
+ check_exception(
+ "The argument index value is too large for the number of arguments supplied", SV("{:^^{}::>{}}"), input, 17);
// The types s and ?s may only be used when using range_formatter<T, charT>
// where the types T and charT are the same. This means this can't be used for
// debug-enabled specialization.
using CharT = wchar_t;
- check_exception("The range-format-spec type s requires formatting a character type", SV("{:s}"), input);
- check_exception("The range-format-spec type ?s requires formatting a character type", SV("{:?s}"), input);
+ check_exception("Type s requires character type as formatting argument", SV("{:s}"), input);
+ check_exception("Type ?s requires character type as formatting argument", SV("{:?s}"), input);
}
#endif // _LIBCPP_HAS_NO_WIDE_CHARACTERS
check(SV("__{false, true}___"), SV("{:_^{}}"), input, 18);
check(SV("#####{false, true}"), SV("{:#>{}}"), input, 18);
- check_exception("The format-spec range-fill field contains an invalid character", SV("{:}<}"), input);
- check_exception("The format-spec range-fill field contains an invalid character", SV("{:{<}"), input);
- check_exception("The format-spec range-fill field contains an invalid character", SV("{::<}"), input);
+ check_exception("The fill option contains an invalid value", SV("{:}<}"), input);
+ check_exception("The fill option contains an invalid value", SV("{:{<}"), input);
+ check_exception("The fill option contains an invalid value", SV("{::<}"), input);
// *** sign ***
- check_exception("The format-spec should consume the input or end with a '}'", SV("{:-}"), input);
- check_exception("The format-spec should consume the input or end with a '}'", SV("{:+}"), input);
- check_exception("The format-spec should consume the input or end with a '}'", SV("{: }"), input);
+ check_exception("The format specifier should consume the input or end with a '}'", SV("{:-}"), input);
+ check_exception("The format specifier should consume the input or end with a '}'", SV("{:+}"), input);
+ check_exception("The format specifier should consume the input or end with a '}'", SV("{: }"), input);
// *** alternate form ***
- check_exception("The format-spec should consume the input or end with a '}'", SV("{:#}"), input);
+ check_exception("The format specifier should consume the input or end with a '}'", SV("{:#}"), input);
// *** zero-padding ***
- check_exception("A format-spec width field shouldn't have a leading zero", SV("{:0}"), input);
+ check_exception("The width option should not have a leading zero", SV("{:0}"), input);
// *** precision ***
- check_exception("The format-spec should consume the input or end with a '}'", SV("{:.}"), input);
+ check_exception("The format specifier should consume the input or end with a '}'", SV("{:.}"), input);
// *** locale-specific form ***
- check_exception("The format-spec should consume the input or end with a '}'", SV("{:L}"), input);
+ check_exception("The format specifier should consume the input or end with a '}'", SV("{:L}"), input);
// *** n
check(SV("__false, true___"), SV("{:_^16n}"), input);
// *** type ***
- check_exception("The range-format-spec type m requires two elements for a pair or tuple", SV("{:m}"), input);
- check_exception("The range-format-spec type s requires formatting a character type", SV("{:s}"), input);
- check_exception("The range-format-spec type ?s requires formatting a character type", SV("{:?s}"), input);
+ check_exception("Type m requires a pair or a tuple with two elements", SV("{:m}"), input);
+ check_exception("Type s requires character type as formatting argument", SV("{:s}"), input);
+ check_exception("Type ?s requires character type as formatting argument", SV("{:?s}"), input);
for (std::basic_string_view<CharT> fmt : fmt_invalid_types<CharT>("s"))
- check_exception("The format-spec should consume the input or end with a '}'", fmt, input);
+ check_exception("The format specifier should consume the input or end with a '}'", fmt, input);
// ***** Only underlying has a format-spec
check(SV("{false , true }"), SV("{::7}"), input);
check(SV("{_false_, _true__}"), SV("{::_^{}}"), input, 7);
check(SV("{::false, :::true}"), SV("{:::>{}}"), input, 7);
- check_exception("The format-spec fill field contains an invalid character", SV("{::}<}"), input);
- check_exception("The format-spec fill field contains an invalid character", SV("{::{<}"), input);
+ check_exception("The fill option contains an invalid value", SV("{::}<}"), input);
+ check_exception("The fill option contains an invalid value", SV("{::{<}"), input);
// *** sign ***
check_exception("The format specifier for a bool does not allow the sign option", SV("{::-}"), input);
check(SV("^^{::false, :::true}^^^"), SV("{:^^{}::>7}"), input, 23);
check(SV("^^{::false, :::true}^^^"), SV("{:^^{}::>{}}"), input, 23, 7);
- check_exception("Argument index out of bounds", SV("{:^^{}::>5}"), input);
- check_exception("Argument index out of bounds", SV("{:^^{}::>{}}"), input, 23);
+ check_exception(
+ "The argument index value is too large for the number of arguments supplied", SV("{:^^{}::>5}"), input);
+ check_exception(
+ "The argument index value is too large for the number of arguments supplied", SV("{:^^{}::>{}}"), input, 23);
}
template <class CharT, class TestFunction, class ExceptionTest>
check(SV("__{true, true, false}___"), SV("{:_^{}}"), input, 24);
check(SV("#####{true, true, false}"), SV("{:#>{}}"), input, 24);
- check_exception("The format-spec range-fill field contains an invalid character", SV("{:}<}"), input);
- check_exception("The format-spec range-fill field contains an invalid character", SV("{:{<}"), input);
- check_exception("The format-spec range-fill field contains an invalid character", SV("{::<}"), input);
+ check_exception("The fill option contains an invalid value", SV("{:}<}"), input);
+ check_exception("The fill option contains an invalid value", SV("{:{<}"), input);
+ check_exception("The fill option contains an invalid value", SV("{::<}"), input);
// *** sign ***
- check_exception("The format-spec should consume the input or end with a '}'", SV("{:-}"), input);
- check_exception("The format-spec should consume the input or end with a '}'", SV("{:+}"), input);
- check_exception("The format-spec should consume the input or end with a '}'", SV("{: }"), input);
+ check_exception("The format specifier should consume the input or end with a '}'", SV("{:-}"), input);
+ check_exception("The format specifier should consume the input or end with a '}'", SV("{:+}"), input);
+ check_exception("The format specifier should consume the input or end with a '}'", SV("{: }"), input);
// *** alternate form ***
- check_exception("The format-spec should consume the input or end with a '}'", SV("{:#}"), input);
+ check_exception("The format specifier should consume the input or end with a '}'", SV("{:#}"), input);
// *** zero-padding ***
- check_exception("A format-spec width field shouldn't have a leading zero", SV("{:0}"), input);
+ check_exception("The width option should not have a leading zero", SV("{:0}"), input);
// *** precision ***
- check_exception("The format-spec should consume the input or end with a '}'", SV("{:.}"), input);
+ check_exception("The format specifier should consume the input or end with a '}'", SV("{:.}"), input);
// *** locale-specific form ***
- check_exception("The format-spec should consume the input or end with a '}'", SV("{:L}"), input);
+ check_exception("The format specifier should consume the input or end with a '}'", SV("{:L}"), input);
// *** n
check(SV("__true, true, false___"), SV("{:_^22n}"), input);
// *** type ***
- check_exception("The range-format-spec type m requires two elements for a pair or tuple", SV("{:m}"), input);
- check_exception("The range-format-spec type s requires formatting a character type", SV("{:s}"), input);
- check_exception("The range-format-spec type ?s requires formatting a character type", SV("{:?s}"), input);
+ check_exception("Type m requires a pair or a tuple with two elements", SV("{:m}"), input);
+ check_exception("Type s requires character type as formatting argument", SV("{:s}"), input);
+ check_exception("Type ?s requires character type as formatting argument", SV("{:?s}"), input);
for (std::basic_string_view<CharT> fmt : fmt_invalid_types<CharT>("s"))
- check_exception("The format-spec should consume the input or end with a '}'", fmt, input);
+ check_exception("The format specifier should consume the input or end with a '}'", fmt, input);
// ***** Only underlying has a format-spec
check(SV("{true , true , false }"), SV("{::7}"), input);
check(SV("{_true__, _true__, _false_}"), SV("{::_^{}}"), input, 7);
check(SV("{:::true, :::true, ::false}"), SV("{:::>{}}"), input, 7);
- check_exception("The format-spec fill field contains an invalid character", SV("{::}<}"), input);
- check_exception("The format-spec fill field contains an invalid character", SV("{::{<}"), input);
+ check_exception("The fill option contains an invalid value", SV("{::}<}"), input);
+ check_exception("The fill option contains an invalid value", SV("{::{<}"), input);
// *** sign ***
check_exception("The format specifier for a bool does not allow the sign option", SV("{::-}"), input);
check(SV("^^{:::true, :::true, ::false}^^^"), SV("{:^^{}::>7}"), input, 32);
check(SV("^^{:::true, :::true, ::false}^^^"), SV("{:^^{}::>{}}"), input, 32, 7);
- check_exception("Argument index out of bounds", SV("{:^^{}::>5}"), input);
- check_exception("Argument index out of bounds", SV("{:^^{}::>{}}"), input, 32);
+ check_exception(
+ "The argument index value is too large for the number of arguments supplied", SV("{:^^{}::>5}"), input);
+ check_exception(
+ "The argument index value is too large for the number of arguments supplied", SV("{:^^{}::>{}}"), input, 32);
}
//
check(SV("__{-42, 1, 2, 42}___"), SV("{:_^{}}"), input, 20);
check(SV("#####{-42, 1, 2, 42}"), SV("{:#>{}}"), input, 20);
- check_exception("The format-spec range-fill field contains an invalid character", SV("{:}<}"), input);
- check_exception("The format-spec range-fill field contains an invalid character", SV("{:{<}"), input);
- check_exception("The format-spec range-fill field contains an invalid character", SV("{::<}"), input);
+ check_exception("The fill option contains an invalid value", SV("{:}<}"), input);
+ check_exception("The fill option contains an invalid value", SV("{:{<}"), input);
+ check_exception("The fill option contains an invalid value", SV("{::<}"), input);
// *** sign ***
- check_exception("The format-spec should consume the input or end with a '}'", SV("{:-}"), input);
- check_exception("The format-spec should consume the input or end with a '}'", SV("{:+}"), input);
- check_exception("The format-spec should consume the input or end with a '}'", SV("{: }"), input);
+ check_exception("The format specifier should consume the input or end with a '}'", SV("{:-}"), input);
+ check_exception("The format specifier should consume the input or end with a '}'", SV("{:+}"), input);
+ check_exception("The format specifier should consume the input or end with a '}'", SV("{: }"), input);
// *** alternate form ***
- check_exception("The format-spec should consume the input or end with a '}'", SV("{:#}"), input);
+ check_exception("The format specifier should consume the input or end with a '}'", SV("{:#}"), input);
// *** zero-padding ***
- check_exception("A format-spec width field shouldn't have a leading zero", SV("{:0}"), input);
+ check_exception("The width option should not have a leading zero", SV("{:0}"), input);
// *** precision ***
- check_exception("The format-spec should consume the input or end with a '}'", SV("{:.}"), input);
+ check_exception("The format specifier should consume the input or end with a '}'", SV("{:.}"), input);
// *** locale-specific form ***
- check_exception("The format-spec should consume the input or end with a '}'", SV("{:L}"), input);
+ check_exception("The format specifier should consume the input or end with a '}'", SV("{:L}"), input);
// *** n
check(SV("__-42, 1, 2, 42___"), SV("{:_^18n}"), input);
// *** type ***
- check_exception("The range-format-spec type m requires two elements for a pair or tuple", SV("{:m}"), input);
- check_exception("The range-format-spec type s requires formatting a character type", SV("{:s}"), input);
- check_exception("The range-format-spec type ?s requires formatting a character type", SV("{:?s}"), input);
+ check_exception("Type m requires a pair or a tuple with two elements", SV("{:m}"), input);
+ check_exception("Type s requires character type as formatting argument", SV("{:s}"), input);
+ check_exception("Type ?s requires character type as formatting argument", SV("{:?s}"), input);
for (std::basic_string_view<CharT> fmt : fmt_invalid_types<CharT>("s"))
- check_exception("The format-spec should consume the input or end with a '}'", fmt, input);
+ check_exception("The format specifier should consume the input or end with a '}'", fmt, input);
// ***** Only underlying has a format-spec
check(SV("{ -42, 1, 2, 42}"), SV("{::5}"), input);
check(SV("{_-42_, __1__, __2__, _42__}"), SV("{::_^{}}"), input, 5);
check(SV("{::-42, ::::1, ::::2, :::42}"), SV("{:::>{}}"), input, 5);
- check_exception("The format-spec fill field contains an invalid character", SV("{::}<}"), input);
- check_exception("The format-spec fill field contains an invalid character", SV("{::{<}"), input);
+ check_exception("The fill option contains an invalid value", SV("{::}<}"), input);
+ check_exception("The fill option contains an invalid value", SV("{::{<}"), input);
// *** sign ***
check(SV("{-42, 1, 2, 42}"), SV("{::-}"), input);
check(SV("^^{::-42, ::::1, ::::2, :::42}^^^"), SV("{:^^{}::>5}"), input, 33);
check(SV("^^{::-42, ::::1, ::::2, :::42}^^^"), SV("{:^^{}::>{}}"), input, 33, 5);
- check_exception("Argument index out of bounds", SV("{:^^{}::>5}"), input);
- check_exception("Argument index out of bounds", SV("{:^^{}::>{}}"), input, 33);
+ check_exception(
+ "The argument index value is too large for the number of arguments supplied", SV("{:^^{}::>5}"), input);
+ check_exception(
+ "The argument index value is too large for the number of arguments supplied", SV("{:^^{}::>{}}"), input, 33);
}
template <class CharT, class TestFunction, class ExceptionTest>
check(SV("__{-42.5, 0, 1.25, 42.5}___"), SV("{:_^{}}"), input, 27);
check(SV("#####{-42.5, 0, 1.25, 42.5}"), SV("{:#>{}}"), input, 27);
- check_exception("The format-spec range-fill field contains an invalid character", SV("{:}<}"), input);
- check_exception("The format-spec range-fill field contains an invalid character", SV("{:{<}"), input);
- check_exception("The format-spec range-fill field contains an invalid character", SV("{::<}"), input);
+ check_exception("The fill option contains an invalid value", SV("{:}<}"), input);
+ check_exception("The fill option contains an invalid value", SV("{:{<}"), input);
+ check_exception("The fill option contains an invalid value", SV("{::<}"), input);
// *** sign ***
- check_exception("The format-spec should consume the input or end with a '}'", SV("{:-}"), input);
- check_exception("The format-spec should consume the input or end with a '}'", SV("{:+}"), input);
- check_exception("The format-spec should consume the input or end with a '}'", SV("{: }"), input);
+ check_exception("The format specifier should consume the input or end with a '}'", SV("{:-}"), input);
+ check_exception("The format specifier should consume the input or end with a '}'", SV("{:+}"), input);
+ check_exception("The format specifier should consume the input or end with a '}'", SV("{: }"), input);
// *** alternate form ***
- check_exception("The format-spec should consume the input or end with a '}'", SV("{:#}"), input);
+ check_exception("The format specifier should consume the input or end with a '}'", SV("{:#}"), input);
// *** zero-padding ***
- check_exception("A format-spec width field shouldn't have a leading zero", SV("{:0}"), input);
+ check_exception("The width option should not have a leading zero", SV("{:0}"), input);
// *** precision ***
- check_exception("The format-spec should consume the input or end with a '}'", SV("{:.}"), input);
+ check_exception("The format specifier should consume the input or end with a '}'", SV("{:.}"), input);
// *** locale-specific form ***
- check_exception("The format-spec should consume the input or end with a '}'", SV("{:L}"), input);
+ check_exception("The format specifier should consume the input or end with a '}'", SV("{:L}"), input);
// *** n
check(SV("__-42.5, 0, 1.25, 42.5___"), SV("{:_^25n}"), input);
// *** type ***
- check_exception("The range-format-spec type m requires two elements for a pair or tuple", SV("{:m}"), input);
- check_exception("The range-format-spec type s requires formatting a character type", SV("{:s}"), input);
- check_exception("The range-format-spec type ?s requires formatting a character type", SV("{:?s}"), input);
+ check_exception("Type m requires a pair or a tuple with two elements", SV("{:m}"), input);
+ check_exception("Type s requires character type as formatting argument", SV("{:s}"), input);
+ check_exception("Type ?s requires character type as formatting argument", SV("{:?s}"), input);
for (std::basic_string_view<CharT> fmt : fmt_invalid_types<CharT>("s"))
- check_exception("The format-spec should consume the input or end with a '}'", fmt, input);
+ check_exception("The format specifier should consume the input or end with a '}'", fmt, input);
// ***** Only underlying has a format-spec
check(SV("{-42.5, 0, 1.25, 42.5}"), SV("{::5}"), input);
check(SV("{-42.5, __0__, 1.25_, 42.5_}"), SV("{::_^{}}"), input, 5);
check(SV("{-42.5, ::::0, :1.25, :42.5}"), SV("{:::>{}}"), input, 5);
- check_exception("The format-spec fill field contains an invalid character", SV("{::}<}"), input);
- check_exception("The format-spec fill field contains an invalid character", SV("{::{<}"), input);
+ check_exception("The fill option contains an invalid value", SV("{::}<}"), input);
+ check_exception("The fill option contains an invalid value", SV("{::{<}"), input);
// *** sign ***
check(SV("{-42.5, 0, 1.25, 42.5}"), SV("{::-}"), input);
check(SV("{-42, 0, 1.2, 42}"), SV("{::.{}}"), input, 2);
check(SV("{-42.500, 0.000, 1.250, 42.500}"), SV("{::.{}f}"), input, 3);
- check_exception("The format-spec precision field doesn't contain a value or arg-id", SV("{::.}"), input);
+ check_exception("The precision option does not contain a value or an argument index", SV("{::.}"), input);
// *** locale-specific form ***
check(SV("{-42.5, 0, 1.25, 42.5}"), SV("{::L}"), input); // does not require locales present
check(SV("^^{::-42, ::::0, ::1.2, :::42}^^^"), SV("{:^^{}::>{}.2}"), input, 33, 5);
check(SV("^^{::-42, ::::0, ::1.2, :::42}^^^"), SV("{:^^{}::>{}.{}}"), input, 33, 5, 2);
- check_exception("Argument index out of bounds", SV("{:^^{}::>5.2}"), input);
- check_exception("Argument index out of bounds", SV("{:^^{}::>{}.2}"), input, 33);
- check_exception("Argument index out of bounds", SV("{:^^{}::>{}.{}}"), input, 33, 5);
+ check_exception(
+ "The argument index value is too large for the number of arguments supplied", SV("{:^^{}::>5.2}"), input);
+ check_exception(
+ "The argument index value is too large for the number of arguments supplied", SV("{:^^{}::>{}.2}"), input, 33);
+ check_exception(
+ "The argument index value is too large for the number of arguments supplied",
+ SV("{:^^{}::>{}.{}}"),
+ input,
+ 33,
+ 5);
}
template <class CharT, class TestFunction, class ExceptionTest>
check(SV("__{0x0}___"), SV("{:_^{}}"), input, 10);
check(SV("#####{0x0}"), SV("{:#>{}}"), input, 10);
- check_exception("The format-spec range-fill field contains an invalid character", SV("{:}<}"), input);
- check_exception("The format-spec range-fill field contains an invalid character", SV("{:{<}"), input);
- check_exception("The format-spec range-fill field contains an invalid character", SV("{::<}"), input);
+ check_exception("The fill option contains an invalid value", SV("{:}<}"), input);
+ check_exception("The fill option contains an invalid value", SV("{:{<}"), input);
+ check_exception("The fill option contains an invalid value", SV("{::<}"), input);
// *** sign ***
- check_exception("The format-spec should consume the input or end with a '}'", SV("{:#}"), input);
+ check_exception("The format specifier should consume the input or end with a '}'", SV("{:#}"), input);
// *** alternate form ***
- check_exception("The format-spec should consume the input or end with a '}'", SV("{:#}"), input);
+ check_exception("The format specifier should consume the input or end with a '}'", SV("{:#}"), input);
// *** zero-padding ***
- check_exception("A format-spec width field shouldn't have a leading zero", SV("{:0}"), input);
+ check_exception("The width option should not have a leading zero", SV("{:0}"), input);
// *** precision ***
- check_exception("The format-spec should consume the input or end with a '}'", SV("{:.}"), input);
+ check_exception("The format specifier should consume the input or end with a '}'", SV("{:.}"), input);
// *** locale-specific form ***
- check_exception("The format-spec should consume the input or end with a '}'", SV("{:L}"), input);
+ check_exception("The format specifier should consume the input or end with a '}'", SV("{:L}"), input);
// *** n
check(SV("_0x0_"), SV("{:_^5n}"), input);
// *** type ***
- check_exception("The range-format-spec type m requires two elements for a pair or tuple", SV("{:m}"), input);
- check_exception("The range-format-spec type s requires formatting a character type", SV("{:s}"), input);
- check_exception("The range-format-spec type ?s requires formatting a character type", SV("{:?s}"), input);
+ check_exception("Type m requires a pair or a tuple with two elements", SV("{:m}"), input);
+ check_exception("Type s requires character type as formatting argument", SV("{:s}"), input);
+ check_exception("Type ?s requires character type as formatting argument", SV("{:?s}"), input);
for (std::basic_string_view<CharT> fmt : fmt_invalid_types<CharT>("s"))
- check_exception("The format-spec should consume the input or end with a '}'", fmt, input);
+ check_exception("The format specifier should consume the input or end with a '}'", fmt, input);
// ***** Only underlying has a format-spec
check(SV("{ 0x0}"), SV("{::5}"), input);
check(SV("{_0x0_}"), SV("{::_^{}}"), input, 5);
check(SV("{::0x0}"), SV("{:::>{}}"), input, 5);
- check_exception("The format-spec fill field contains an invalid character", SV("{::}<}"), input);
- check_exception("The format-spec fill field contains an invalid character", SV("{::{<}"), input);
+ check_exception("The fill option contains an invalid value", SV("{::}<}"), input);
+ check_exception("The fill option contains an invalid value", SV("{::{<}"), input);
// *** sign ***
check_exception("The format specifier should consume the input or end with a '}'", SV("{::-}"), input);
check(SV("^^{::0x0}^^^"), SV("{:^^{}::>5}"), input, 12);
check(SV("^^{::0x0}^^^"), SV("{:^^{}::>{}}"), input, 12, 5);
- check_exception("Argument index out of bounds", SV("{:^^{}::>5}"), input);
- check_exception("Argument index out of bounds", SV("{:^^{}::>{}}"), input, 12);
+ check_exception(
+ "The argument index value is too large for the number of arguments supplied", SV("{:^^{}::>5}"), input);
+ check_exception(
+ "The argument index value is too large for the number of arguments supplied", SV("{:^^{}::>{}}"), input, 12);
}
template <class CharT, class TestFunction, class ExceptionTest>
check(SV(R"(__{"Hello", "world"}___)"), SV("{:_^{}}"), input, 23);
check(SV(R"(#####{"Hello", "world"})"), SV("{:#>{}}"), input, 23);
- check_exception("The format-spec range-fill field contains an invalid character", SV("{:}<}"), input);
- check_exception("The format-spec range-fill field contains an invalid character", SV("{:{<}"), input);
- check_exception("The format-spec range-fill field contains an invalid character", SV("{::<}"), input);
+ check_exception("The fill option contains an invalid value", SV("{:}<}"), input);
+ check_exception("The fill option contains an invalid value", SV("{:{<}"), input);
+ check_exception("The fill option contains an invalid value", SV("{::<}"), input);
// *** sign ***
- check_exception("The format-spec should consume the input or end with a '}'", SV("{:#}"), input);
+ check_exception("The format specifier should consume the input or end with a '}'", SV("{:#}"), input);
// *** alternate form ***
- check_exception("The format-spec should consume the input or end with a '}'", SV("{:#}"), input);
+ check_exception("The format specifier should consume the input or end with a '}'", SV("{:#}"), input);
// *** zero-padding ***
- check_exception("A format-spec width field shouldn't have a leading zero", SV("{:0}"), input);
+ check_exception("The width option should not have a leading zero", SV("{:0}"), input);
// *** precision ***
- check_exception("The format-spec should consume the input or end with a '}'", SV("{:.}"), input);
+ check_exception("The format specifier should consume the input or end with a '}'", SV("{:.}"), input);
// *** locale-specific form ***
- check_exception("The format-spec should consume the input or end with a '}'", SV("{:L}"), input);
+ check_exception("The format specifier should consume the input or end with a '}'", SV("{:L}"), input);
// *** n
check(SV(R"(_"Hello", "world"_)"), SV("{:_^18n}"), input);
// *** type ***
- check_exception("The range-format-spec type m requires two elements for a pair or tuple", SV("{:m}"), input);
- check_exception("The range-format-spec type s requires formatting a character type", SV("{:s}"), input);
- check_exception("The range-format-spec type ?s requires formatting a character type", SV("{:?s}"), input);
+ check_exception("Type m requires a pair or a tuple with two elements", SV("{:m}"), input);
+ check_exception("Type s requires character type as formatting argument", SV("{:s}"), input);
+ check_exception("Type ?s requires character type as formatting argument", SV("{:?s}"), input);
for (std::basic_string_view<CharT> fmt : fmt_invalid_types<CharT>("s"))
- check_exception("The format-spec should consume the input or end with a '}'", fmt, input);
+ check_exception("The format specifier should consume the input or end with a '}'", fmt, input);
// ***** Only underlying has a format-spec
check(SV(R"({Hello , world })"), SV("{::8}"), input);
check(SV(R"({_Hello__, _world__})"), SV("{::_^{}}"), input, 8);
check(SV(R"({:::Hello, :::world})"), SV("{:::>{}}"), input, 8);
- check_exception("The format-spec fill field contains an invalid character", SV("{::}<}"), input);
- check_exception("The format-spec fill field contains an invalid character", SV("{::{<}"), input);
+ check_exception("The fill option contains an invalid value", SV("{::}<}"), input);
+ check_exception("The fill option contains an invalid value", SV("{::{<}"), input);
// *** sign ***
check_exception("The format specifier should consume the input or end with a '}'", SV("{::-}"), input);
check_exception("The format specifier should consume the input or end with a '}'", SV("{::#}"), input);
// *** zero-padding ***
- check_exception("A format-spec width field shouldn't have a leading zero", SV("{::05}"), input);
+ check_exception("The width option should not have a leading zero", SV("{::05}"), input);
// *** precision ***
check(SV(R"({Hel, wor})"), SV("{::.3}"), input);
check(SV(R"({Hel, wor})"), SV("{::.{}}"), input, 3);
- check_exception("The format-spec precision field doesn't contain a value or arg-id", SV("{::.}"), input);
+ check_exception("The precision option does not contain a value or an argument index", SV("{::.}"), input);
// *** locale-specific form ***
check_exception("The format specifier should consume the input or end with a '}'", SV("{::L}"), input);
// *** type ***
for (std::basic_string_view<CharT> fmt : fmt_invalid_nested_types<CharT>("s?"))
- check_exception("The format-spec type has a type not supported for a string argument", fmt, input);
+ check_exception("The type option contains an invalid value for a string formatting argument", fmt, input);
// ***** Both have a format-spec
check(SV(R"(^^{:::Hello, :::world}^^^)"), SV("{:^^25::>8}"), input);
check(SV(R"(^^{:::Hello, :::world}^^^)"), SV("{:^^{}::>8}"), input, 25);
check(SV(R"(^^{:::Hello, :::world}^^^)"), SV("{:^^{}::>{}}"), input, 25, 8);
- check_exception("Argument index out of bounds", SV("{:^^{}::>8}"), input);
- check_exception("Argument index out of bounds", SV("{:^^{}::>{}}"), input, 25);
+ check_exception(
+ "The argument index value is too large for the number of arguments supplied", SV("{:^^{}::>8}"), input);
+ check_exception(
+ "The argument index value is too large for the number of arguments supplied", SV("{:^^{}::>{}}"), input, 25);
}
template <class CharT, class TestFunction, class ExceptionTest>
check(SV("__{0x5555, 0xaa55, 0xaaaa}___"), SV("{:_^{}}"), input, 29);
check(SV("#####{0x5555, 0xaa55, 0xaaaa}"), SV("{:#>{}}"), input, 29);
- check_exception("The format-spec range-fill field contains an invalid character", SV("{:}<}"), input);
- check_exception("The format-spec range-fill field contains an invalid character", SV("{:{<}"), input);
- check_exception("The format-spec range-fill field contains an invalid character", SV("{::<}"), input);
+ check_exception("The fill option contains an invalid value", SV("{:}<}"), input);
+ check_exception("The fill option contains an invalid value", SV("{:{<}"), input);
+ check_exception("The fill option contains an invalid value", SV("{::<}"), input);
// *** sign ***
- check_exception("The format-spec should consume the input or end with a '}'", SV("{:-}"), input);
- check_exception("The format-spec should consume the input or end with a '}'", SV("{:+}"), input);
- check_exception("The format-spec should consume the input or end with a '}'", SV("{: }"), input);
+ check_exception("The format specifier should consume the input or end with a '}'", SV("{:-}"), input);
+ check_exception("The format specifier should consume the input or end with a '}'", SV("{:+}"), input);
+ check_exception("The format specifier should consume the input or end with a '}'", SV("{: }"), input);
// *** alternate form ***
- check_exception("The format-spec should consume the input or end with a '}'", SV("{:#}"), input);
+ check_exception("The format specifier should consume the input or end with a '}'", SV("{:#}"), input);
// *** zero-padding ***
- check_exception("A format-spec width field shouldn't have a leading zero", SV("{:0}"), input);
+ check_exception("The width option should not have a leading zero", SV("{:0}"), input);
// *** precision ***
- check_exception("The format-spec should consume the input or end with a '}'", SV("{:.}"), input);
+ check_exception("The format specifier should consume the input or end with a '}'", SV("{:.}"), input);
// *** locale-specific form ***
- check_exception("The format-spec should consume the input or end with a '}'", SV("{:L}"), input);
+ check_exception("The format specifier should consume the input or end with a '}'", SV("{:L}"), input);
// *** n
check(SV("__0x5555, 0xaa55, 0xaaaa___"), SV("{:_^27n}"), input);
// *** type ***
- check_exception("The range-format-spec type m requires two elements for a pair or tuple", SV("{:m}"), input);
- check_exception("The range-format-spec type s requires formatting a character type", SV("{:s}"), input);
- check_exception("The range-format-spec type ?s requires formatting a character type", SV("{:?s}"), input);
+ check_exception("Type m requires a pair or a tuple with two elements", SV("{:m}"), input);
+ check_exception("Type s requires character type as formatting argument", SV("{:s}"), input);
+ check_exception("Type ?s requires character type as formatting argument", SV("{:?s}"), input);
for (std::basic_string_view<CharT> fmt : fmt_invalid_types<CharT>("s"))
- check_exception("The format-spec should consume the input or end with a '}'", fmt, input);
+ check_exception("The format specifier should consume the input or end with a '}'", fmt, input);
// ***** Only underlying has a format-spec
- check_exception("The format-spec type has a type not supported for a status argument", SV("{::*<7}"), input);
+ check_exception("The type option contains an invalid value for a status formatting argument", SV("{::*<7}"), input);
check(SV("{0x5555, 0xaa55, 0xaaaa}"), SV("{::x}"), input);
check(SV("{0X5555, 0XAA55, 0XAAAA}"), SV("{::X}"), input);
check(SV("^^{0X5555, 0XAA55, 0XAAAA}^^^"), SV("{:^^29:X}"), input);
check(SV("^^{0X5555, 0XAA55, 0XAAAA}^^^"), SV("{:^^{}:X}"), input, 29);
- check_exception("Argument index out of bounds", SV("{:^^{}:X}"), input);
+ check_exception("The argument index value is too large for the number of arguments supplied", SV("{:^^{}:X}"), input);
}
//
check(SV("__{(1, 'a'), (42, '*')}___"), SV("{:_^{}}"), input, 26);
check(SV("#####{(1, 'a'), (42, '*')}"), SV("{:#>{}}"), input, 26);
- check_exception("The format-spec range-fill field contains an invalid character", SV("{:}<}"), input);
- check_exception("The format-spec range-fill field contains an invalid character", SV("{:{<}"), input);
- check_exception("The format-spec range-fill field contains an invalid character", SV("{::<}"), input);
+ check_exception("The fill option contains an invalid value", SV("{:}<}"), input);
+ check_exception("The fill option contains an invalid value", SV("{:{<}"), input);
+ check_exception("The fill option contains an invalid value", SV("{::<}"), input);
// *** sign ***
- check_exception("The format-spec should consume the input or end with a '}'", SV("{:-}"), input);
- check_exception("The format-spec should consume the input or end with a '}'", SV("{:+}"), input);
- check_exception("The format-spec should consume the input or end with a '}'", SV("{: }"), input);
+ check_exception("The format specifier should consume the input or end with a '}'", SV("{:-}"), input);
+ check_exception("The format specifier should consume the input or end with a '}'", SV("{:+}"), input);
+ check_exception("The format specifier should consume the input or end with a '}'", SV("{: }"), input);
// *** alternate form ***
- check_exception("The format-spec should consume the input or end with a '}'", SV("{:#}"), input);
+ check_exception("The format specifier should consume the input or end with a '}'", SV("{:#}"), input);
// *** zero-padding ***
- check_exception("A format-spec width field shouldn't have a leading zero", SV("{:0}"), input);
+ check_exception("The width option should not have a leading zero", SV("{:0}"), input);
// *** precision ***
- check_exception("The format-spec should consume the input or end with a '}'", SV("{:.}"), input);
+ check_exception("The format specifier should consume the input or end with a '}'", SV("{:.}"), input);
// *** locale-specific form ***
- check_exception("The format-spec should consume the input or end with a '}'", SV("{:L}"), input);
+ check_exception("The format specifier should consume the input or end with a '}'", SV("{:L}"), input);
// *** n
check(SV("__(1, 'a'), (42, '*')___"), SV("{:_^24n}"), input);
// *** type ***
check(SV("__{(1, 'a'), (42, '*')}___"), SV("{:_^26m}"), input);
- check_exception("The range-format-spec type s requires formatting a character type", SV("{:s}"), input);
- check_exception("The range-format-spec type ?s requires formatting a character type", SV("{:?s}"), input);
+ check_exception("Type s requires character type as formatting argument", SV("{:s}"), input);
+ check_exception("Type ?s requires character type as formatting argument", SV("{:?s}"), input);
for (std::basic_string_view<CharT> fmt : fmt_invalid_types<CharT>("s"))
- check_exception("The format-spec should consume the input or end with a '}'", fmt, input);
+ check_exception("The format specifier should consume the input or end with a '}'", fmt, input);
// ***** Only underlying has a format-spec
check(SV("{(1, 'a') , (42, '*') }"), SV("{::11}"), input);
check(SV("{_(1, 'a')__, _(42, '*')_}"), SV("{::_^{}}"), input, 11);
check(SV("{###(1, 'a'), ##(42, '*')}"), SV("{::#>{}}"), input, 11);
- check_exception("The format-spec range-fill field contains an invalid character", SV("{:::<}"), input);
- check_exception("The format-spec range-fill field contains an invalid character", SV("{::}<}"), input);
- check_exception("The format-spec range-fill field contains an invalid character", SV("{::{<}"), input);
+ check_exception("The fill option contains an invalid value", SV("{:::<}"), input);
+ check_exception("The fill option contains an invalid value", SV("{::}<}"), input);
+ check_exception("The fill option contains an invalid value", SV("{::{<}"), input);
// *** sign ***
- check_exception("The format-spec should consume the input or end with a '}'", SV("{::-}"), input);
- check_exception("The format-spec should consume the input or end with a '}'", SV("{::+}"), input);
- check_exception("The format-spec should consume the input or end with a '}'", SV("{:: }"), input);
+ check_exception("The format specifier should consume the input or end with a '}'", SV("{::-}"), input);
+ check_exception("The format specifier should consume the input or end with a '}'", SV("{::+}"), input);
+ check_exception("The format specifier should consume the input or end with a '}'", SV("{:: }"), input);
// *** alternate form ***
- check_exception("The format-spec should consume the input or end with a '}'", SV("{::#}"), input);
+ check_exception("The format specifier should consume the input or end with a '}'", SV("{::#}"), input);
// *** zero-padding ***
- check_exception("A format-spec width field shouldn't have a leading zero", SV("{::05}"), input);
+ check_exception("The width option should not have a leading zero", SV("{::05}"), input);
// *** precision ***
- check_exception("The format-spec should consume the input or end with a '}'", SV("{::.}"), input);
+ check_exception("The format specifier should consume the input or end with a '}'", SV("{::.}"), input);
// *** locale-specific form ***
- check_exception("The format-spec should consume the input or end with a '}'", SV("{::L}"), input);
+ check_exception("The format specifier should consume the input or end with a '}'", SV("{::L}"), input);
// *** type ***
check(SV("{1: 'a', 42: '*'}"), SV("{::m}"), input);
check(SV("{1, 'a', 42, '*'}"), SV("{::n}"), input);
- check_exception("The format-spec should consume the input or end with a '}'", SV("{::s}"), input);
- check_exception("The format-spec should consume the input or end with a '}'", SV("{::?s}"), input);
+ check_exception("The format specifier should consume the input or end with a '}'", SV("{::s}"), input);
+ check_exception("The format specifier should consume the input or end with a '}'", SV("{::?s}"), input);
for (std::basic_string_view<CharT> fmt : fmt_invalid_nested_types<CharT>("s"))
- check_exception("The format-spec should consume the input or end with a '}'", fmt, input);
+ check_exception("The format specifier should consume the input or end with a '}'", fmt, input);
// ***** Both have a format-spec
check(SV("^^{###(1, 'a'), ##(42, '*')}^^^"), SV("{:^^31:#>11}"), input);
check(SV("^^{###(1, 'a'), ##(42, '*')}^^^"), SV("{:^^{}:#>11}"), input, 31);
check(SV("^^{###(1, 'a'), ##(42, '*')}^^^"), SV("{:^^{}:#>{}}"), input, 31, 11);
- check_exception("Argument index out of bounds", SV("{:^^{}:#>5}"), input);
- check_exception("Argument index out of bounds", SV("{:^^{}:#>{}}"), input, 31);
+ check_exception(
+ "The argument index value is too large for the number of arguments supplied", SV("{:^^{}:#>5}"), input);
+ check_exception(
+ "The argument index value is too large for the number of arguments supplied", SV("{:^^{}:#>{}}"), input, 31);
check(SV("1: 'a', 42: '*'"), SV("{:n:m}"), input);
check(SV("1, 'a', 42, '*'"), SV("{:n:n}"), input);
check(SV("__{(42), (99)}___"), SV("{:_^{}}"), input, 17);
check(SV("#####{(42), (99)}"), SV("{:#>{}}"), input, 17);
- check_exception("The format-spec range-fill field contains an invalid character", SV("{:}<}"), input);
- check_exception("The format-spec range-fill field contains an invalid character", SV("{:{<}"), input);
- check_exception("The format-spec range-fill field contains an invalid character", SV("{::<}"), input);
+ check_exception("The fill option contains an invalid value", SV("{:}<}"), input);
+ check_exception("The fill option contains an invalid value", SV("{:{<}"), input);
+ check_exception("The fill option contains an invalid value", SV("{::<}"), input);
// *** sign ***
- check_exception("The format-spec should consume the input or end with a '}'", SV("{:-}"), input);
- check_exception("The format-spec should consume the input or end with a '}'", SV("{:+}"), input);
- check_exception("The format-spec should consume the input or end with a '}'", SV("{: }"), input);
+ check_exception("The format specifier should consume the input or end with a '}'", SV("{:-}"), input);
+ check_exception("The format specifier should consume the input or end with a '}'", SV("{:+}"), input);
+ check_exception("The format specifier should consume the input or end with a '}'", SV("{: }"), input);
// *** alternate form ***
- check_exception("The format-spec should consume the input or end with a '}'", SV("{:#}"), input);
+ check_exception("The format specifier should consume the input or end with a '}'", SV("{:#}"), input);
// *** zero-padding ***
- check_exception("A format-spec width field shouldn't have a leading zero", SV("{:0}"), input);
+ check_exception("The width option should not have a leading zero", SV("{:0}"), input);
// *** precision ***
- check_exception("The format-spec should consume the input or end with a '}'", SV("{:.}"), input);
+ check_exception("The format specifier should consume the input or end with a '}'", SV("{:.}"), input);
// *** locale-specific form ***
- check_exception("The format-spec should consume the input or end with a '}'", SV("{:L}"), input);
+ check_exception("The format specifier should consume the input or end with a '}'", SV("{:L}"), input);
// *** n
check(SV("__(42), (99)___"), SV("{:_^15n}"), input);
// *** type ***
- check_exception("The range-format-spec type m requires two elements for a pair or tuple", SV("{:m}"), input);
- check_exception("The range-format-spec type s requires formatting a character type", SV("{:s}"), input);
- check_exception("The range-format-spec type ?s requires formatting a character type", SV("{:?s}"), input);
+ check_exception("Type m requires a pair or a tuple with two elements", SV("{:m}"), input);
+ check_exception("Type s requires character type as formatting argument", SV("{:s}"), input);
+ check_exception("Type ?s requires character type as formatting argument", SV("{:?s}"), input);
for (std::basic_string_view<CharT> fmt : fmt_invalid_types<CharT>("s"))
- check_exception("The format-spec should consume the input or end with a '}'", fmt, input);
+ check_exception("The format specifier should consume the input or end with a '}'", fmt, input);
// ***** Only underlying has a format-spec
check(SV("{(42) , (99) }"), SV("{::7}"), input);
check(SV("{_(42)__, _(99)__}"), SV("{::_^{}}"), input, 7);
check(SV("{###(42), ###(99)}"), SV("{::#>{}}"), input, 7);
- check_exception("The format-spec range-fill field contains an invalid character", SV("{:::<}"), input);
- check_exception("The format-spec range-fill field contains an invalid character", SV("{::}<}"), input);
- check_exception("The format-spec range-fill field contains an invalid character", SV("{::{<}"), input);
+ check_exception("The fill option contains an invalid value", SV("{:::<}"), input);
+ check_exception("The fill option contains an invalid value", SV("{::}<}"), input);
+ check_exception("The fill option contains an invalid value", SV("{::{<}"), input);
// *** sign ***
- check_exception("The format-spec should consume the input or end with a '}'", SV("{::-}"), input);
- check_exception("The format-spec should consume the input or end with a '}'", SV("{::+}"), input);
- check_exception("The format-spec should consume the input or end with a '}'", SV("{:: }"), input);
+ check_exception("The format specifier should consume the input or end with a '}'", SV("{::-}"), input);
+ check_exception("The format specifier should consume the input or end with a '}'", SV("{::+}"), input);
+ check_exception("The format specifier should consume the input or end with a '}'", SV("{:: }"), input);
// *** alternate form ***
- check_exception("The format-spec should consume the input or end with a '}'", SV("{::#}"), input);
+ check_exception("The format specifier should consume the input or end with a '}'", SV("{::#}"), input);
// *** zero-padding ***
- check_exception("A format-spec width field shouldn't have a leading zero", SV("{::05}"), input);
+ check_exception("The width option should not have a leading zero", SV("{::05}"), input);
// *** precision ***
- check_exception("The format-spec should consume the input or end with a '}'", SV("{::.}"), input);
+ check_exception("The format specifier should consume the input or end with a '}'", SV("{::.}"), input);
// *** locale-specific form ***
- check_exception("The format-spec should consume the input or end with a '}'", SV("{::L}"), input);
+ check_exception("The format specifier should consume the input or end with a '}'", SV("{::L}"), input);
// *** type ***
check(SV("{42, 99}"), SV("{::n}"), input);
- check_exception("The format specifier m requires a pair or a two-element tuple", SV("{::m}"), input);
- check_exception("The format-spec should consume the input or end with a '}'", SV("{::s}"), input);
- check_exception("The format-spec should consume the input or end with a '}'", SV("{::?s}"), input);
+ check_exception("Type m requires a pair or a tuple with two elements", SV("{::m}"), input);
+ check_exception("The format specifier should consume the input or end with a '}'", SV("{::s}"), input);
+ check_exception("The format specifier should consume the input or end with a '}'", SV("{::?s}"), input);
for (std::basic_string_view<CharT> fmt : fmt_invalid_nested_types<CharT>("s"))
- check_exception("The format-spec should consume the input or end with a '}'", fmt, input);
+ check_exception("The format specifier should consume the input or end with a '}'", fmt, input);
// ***** Both have a format-spec
check(SV("^^{###(42), ###(99)}^^^"), SV("{:^^23:#>7}"), input);
check(SV("^^{###(42), ###(99)}^^^"), SV("{:^^{}:#>7}"), input, 23);
check(SV("^^{###(42), ###(99)}^^^"), SV("{:^^{}:#>{}}"), input, 23, 7);
- check_exception("Argument index out of bounds", SV("{:^^{}:#>5}"), input);
- check_exception("Argument index out of bounds", SV("{:^^{}:#>{}}"), input, 23);
+ check_exception(
+ "The argument index value is too large for the number of arguments supplied", SV("{:^^{}:#>5}"), input);
+ check_exception(
+ "The argument index value is too large for the number of arguments supplied", SV("{:^^{}:#>{}}"), input, 23);
}
//
check(SV("__{(1, 10, 100), (42, 99, 0)}___"), SV("{:_^{}}"), input, 32);
check(SV("#####{(1, 10, 100), (42, 99, 0)}"), SV("{:#>{}}"), input, 32);
- check_exception("The format-spec range-fill field contains an invalid character", SV("{:}<}"), input);
- check_exception("The format-spec range-fill field contains an invalid character", SV("{:{<}"), input);
- check_exception("The format-spec range-fill field contains an invalid character", SV("{::<}"), input);
+ check_exception("The fill option contains an invalid value", SV("{:}<}"), input);
+ check_exception("The fill option contains an invalid value", SV("{:{<}"), input);
+ check_exception("The fill option contains an invalid value", SV("{::<}"), input);
// *** sign ***
- check_exception("The format-spec should consume the input or end with a '}'", SV("{:-}"), input);
- check_exception("The format-spec should consume the input or end with a '}'", SV("{:+}"), input);
- check_exception("The format-spec should consume the input or end with a '}'", SV("{: }"), input);
+ check_exception("The format specifier should consume the input or end with a '}'", SV("{:-}"), input);
+ check_exception("The format specifier should consume the input or end with a '}'", SV("{:+}"), input);
+ check_exception("The format specifier should consume the input or end with a '}'", SV("{: }"), input);
// *** alternate form ***
- check_exception("The format-spec should consume the input or end with a '}'", SV("{:#}"), input);
+ check_exception("The format specifier should consume the input or end with a '}'", SV("{:#}"), input);
// *** zero-padding ***
- check_exception("A format-spec width field shouldn't have a leading zero", SV("{:0}"), input);
+ check_exception("The width option should not have a leading zero", SV("{:0}"), input);
// *** precision ***
- check_exception("The format-spec should consume the input or end with a '}'", SV("{:.}"), input);
+ check_exception("The format specifier should consume the input or end with a '}'", SV("{:.}"), input);
// *** locale-specific form ***
- check_exception("The format-spec should consume the input or end with a '}'", SV("{:L}"), input);
+ check_exception("The format specifier should consume the input or end with a '}'", SV("{:L}"), input);
// *** n
check(SV("__(1, 10, 100), (42, 99, 0)___"), SV("{:_^30n}"), input);
// *** type ***
- check_exception("The range-format-spec type m requires two elements for a pair or tuple", SV("{:m}"), input);
- check_exception("The range-format-spec type s requires formatting a character type", SV("{:s}"), input);
- check_exception("The range-format-spec type ?s requires formatting a character type", SV("{:?s}"), input);
+ check_exception("Type m requires a pair or a tuple with two elements", SV("{:m}"), input);
+ check_exception("Type s requires character type as formatting argument", SV("{:s}"), input);
+ check_exception("Type ?s requires character type as formatting argument", SV("{:?s}"), input);
for (std::basic_string_view<CharT> fmt : fmt_invalid_types<CharT>("s"))
- check_exception("The format-spec should consume the input or end with a '}'", fmt, input);
+ check_exception("The format specifier should consume the input or end with a '}'", fmt, input);
// ***** Only underlying has a format-spec
check(SV("{(1, 10, 100) , (42, 99, 0) }"), SV("{::14}"), input);
check(SV("{_(1, 10, 100)_, _(42, 99, 0)__}"), SV("{::_^{}}"), input, 14);
check(SV("{##(1, 10, 100), ###(42, 99, 0)}"), SV("{::#>{}}"), input, 14);
- check_exception("The format-spec range-fill field contains an invalid character", SV("{:::<}"), input);
- check_exception("The format-spec range-fill field contains an invalid character", SV("{::}<}"), input);
- check_exception("The format-spec range-fill field contains an invalid character", SV("{::{<}"), input);
+ check_exception("The fill option contains an invalid value", SV("{:::<}"), input);
+ check_exception("The fill option contains an invalid value", SV("{::}<}"), input);
+ check_exception("The fill option contains an invalid value", SV("{::{<}"), input);
// *** sign ***
- check_exception("The format-spec should consume the input or end with a '}'", SV("{::-}"), input);
- check_exception("The format-spec should consume the input or end with a '}'", SV("{::+}"), input);
- check_exception("The format-spec should consume the input or end with a '}'", SV("{:: }"), input);
+ check_exception("The format specifier should consume the input or end with a '}'", SV("{::-}"), input);
+ check_exception("The format specifier should consume the input or end with a '}'", SV("{::+}"), input);
+ check_exception("The format specifier should consume the input or end with a '}'", SV("{:: }"), input);
// *** alternate form ***
- check_exception("The format-spec should consume the input or end with a '}'", SV("{::#}"), input);
+ check_exception("The format specifier should consume the input or end with a '}'", SV("{::#}"), input);
// *** zero-padding ***
- check_exception("A format-spec width field shouldn't have a leading zero", SV("{::05}"), input);
+ check_exception("The width option should not have a leading zero", SV("{::05}"), input);
// *** precision ***
- check_exception("The format-spec should consume the input or end with a '}'", SV("{::.}"), input);
+ check_exception("The format specifier should consume the input or end with a '}'", SV("{::.}"), input);
// *** locale-specific form ***
- check_exception("The format-spec should consume the input or end with a '}'", SV("{::L}"), input);
+ check_exception("The format specifier should consume the input or end with a '}'", SV("{::L}"), input);
// *** type ***
check(SV("{1, 10, 100, 42, 99, 0}"), SV("{::n}"), input);
- check_exception("The format specifier m requires a pair or a two-element tuple", SV("{::m}"), input);
- check_exception("The format-spec should consume the input or end with a '}'", SV("{::s}"), input);
- check_exception("The format-spec should consume the input or end with a '}'", SV("{::?s}"), input);
+ check_exception("Type m requires a pair or a tuple with two elements", SV("{::m}"), input);
+ check_exception("The format specifier should consume the input or end with a '}'", SV("{::s}"), input);
+ check_exception("The format specifier should consume the input or end with a '}'", SV("{::?s}"), input);
for (std::basic_string_view<CharT> fmt : fmt_invalid_nested_types<CharT>("s"))
- check_exception("The format-spec should consume the input or end with a '}'", fmt, input);
+ check_exception("The format specifier should consume the input or end with a '}'", fmt, input);
// ***** Both have a format-spec
check(SV("^^{##(1, 10, 100), ###(42, 99, 0)}^^^"), SV("{:^^37:#>14}"), input);
check(SV("^^{##(1, 10, 100), ###(42, 99, 0)}^^^"), SV("{:^^{}:#>14}"), input, 37);
check(SV("^^{##(1, 10, 100), ###(42, 99, 0)}^^^"), SV("{:^^{}:#>{}}"), input, 37, 14);
- check_exception("Argument index out of bounds", SV("{:^^{}:#>5}"), input);
- check_exception("Argument index out of bounds", SV("{:^^{}:#>{}}"), input, 37);
+ check_exception(
+ "The argument index value is too large for the number of arguments supplied", SV("{:^^{}:#>5}"), input);
+ check_exception(
+ "The argument index value is too large for the number of arguments supplied", SV("{:^^{}:#>{}}"), input, 37);
}
//
check(SV("__hello___"), SV("{:_^{}}"), input, 10);
check(SV(":::::hello"), SV("{::>{}}"), input, 10);
- check_exception("The format-spec fill field contains an invalid character", SV("{:}<}"), input);
- check_exception("The format-spec fill field contains an invalid character", SV("{:{<}"), input);
+ check_exception("The fill option contains an invalid value", SV("{:}<}"), input);
+ check_exception("The fill option contains an invalid value", SV("{:{<}"), input);
// *** sign ***
check_exception("The format specifier should consume the input or end with a '}'", SV("{:-}"), input);
check_exception("The format specifier should consume the input or end with a '}'", SV("{:#}"), input);
// *** zero-padding ***
- check_exception("A format-spec width field shouldn't have a leading zero", SV("{:0}"), input);
+ check_exception("The width option should not have a leading zero", SV("{:0}"), input);
// *** precision ***
check(SV("hel"), SV("{:.3}"), input);
check(SV("hello"), SV("{:s}"), input);
check(SV("\"hello\""), SV("{:?}"), input);
for (std::basic_string_view<CharT> fmt : fmt_invalid_types<CharT>("s?"))
- check_exception("The format-spec type has a type not supported for a string argument", fmt, input);
+ check_exception("The type option contains an invalid value for a string formatting argument", fmt, input);
}
template <class CharT, class TestFunction, class ExceptionTest>
check(SV(R"(__[Hello, world]___)"), SV("{:_^{}}"), input, 19);
check(SV(R"(#####[Hello, world])"), SV("{:#>{}}"), input, 19);
- check_exception("The format-spec range-fill field contains an invalid character", SV("{:}<}"), input);
- check_exception("The format-spec range-fill field contains an invalid character", SV("{:{<}"), input);
- check_exception("The format-spec range-fill field contains an invalid character", SV("{::<}"), input);
+ check_exception("The fill option contains an invalid value", SV("{:}<}"), input);
+ check_exception("The fill option contains an invalid value", SV("{:{<}"), input);
+ check_exception("The fill option contains an invalid value", SV("{::<}"), input);
// *** sign ***
- check_exception("The format-spec should consume the input or end with a '}'", SV("{:-}"), input);
+ check_exception("The format specifier should consume the input or end with a '}'", SV("{:-}"), input);
// *** alternate form ***
- check_exception("The format-spec should consume the input or end with a '}'", SV("{:#}"), input);
+ check_exception("The format specifier should consume the input or end with a '}'", SV("{:#}"), input);
// *** zero-padding ***
- check_exception("A format-spec width field shouldn't have a leading zero", SV("{:0}"), input);
+ check_exception("The width option should not have a leading zero", SV("{:0}"), input);
// *** precision ***
- check_exception("The format-spec should consume the input or end with a '}'", SV("{:.}"), input);
+ check_exception("The format specifier should consume the input or end with a '}'", SV("{:.}"), input);
// *** locale-specific form ***
- check_exception("The format-spec should consume the input or end with a '}'", SV("{:L}"), input);
+ check_exception("The format specifier should consume the input or end with a '}'", SV("{:L}"), input);
// *** n
check(SV(R"(_Hello, world_)"), SV("{:_^14n}"), input);
// *** type ***
- check_exception("The range-format-spec type m requires two elements for a pair or tuple", SV("{:m}"), input);
- check_exception("The range-format-spec type s requires formatting a character type", SV("{:s}"), input);
- check_exception("The range-format-spec type ?s requires formatting a character type", SV("{:?s}"), input);
+ check_exception("Type m requires a pair or a tuple with two elements", SV("{:m}"), input);
+ check_exception("Type s requires character type as formatting argument", SV("{:s}"), input);
+ check_exception("Type ?s requires character type as formatting argument", SV("{:?s}"), input);
for (std::basic_string_view<CharT> fmt : fmt_invalid_types<CharT>("s"))
- check_exception("The format-spec should consume the input or end with a '}'", fmt, input);
+ check_exception("The format specifier should consume the input or end with a '}'", fmt, input);
// ***** Only underlying has a format-spec
check(SV(R"([Hello , world ])"), SV("{::8}"), input);
check(SV(R"([_Hello__, _world__])"), SV("{::_^{}}"), input, 8);
check(SV(R"([:::Hello, :::world])"), SV("{:::>{}}"), input, 8);
- check_exception("The format-spec fill field contains an invalid character", SV("{::}<}"), input);
- check_exception("The format-spec fill field contains an invalid character", SV("{::{<}"), input);
+ check_exception("The fill option contains an invalid value", SV("{::}<}"), input);
+ check_exception("The fill option contains an invalid value", SV("{::{<}"), input);
// *** sign ***
check_exception("The format specifier should consume the input or end with a '}'", SV("{::-}"), input);
check_exception("The format specifier should consume the input or end with a '}'", SV("{::#}"), input);
// *** zero-padding ***
- check_exception("A format-spec width field shouldn't have a leading zero", SV("{::05}"), input);
+ check_exception("The width option should not have a leading zero", SV("{::05}"), input);
// *** precision ***
check(SV(R"([Hel, wor])"), SV("{::.3}"), input);
check(SV(R"([Hel, wor])"), SV("{::.{}}"), input, 3);
- check_exception("The format-spec precision field doesn't contain a value or arg-id", SV("{::.}"), input);
+ check_exception("The precision option does not contain a value or an argument index", SV("{::.}"), input);
// *** locale-specific form ***
check_exception("The format specifier should consume the input or end with a '}'", SV("{::L}"), input);
// *** type ***
for (std::basic_string_view<CharT> fmt : fmt_invalid_nested_types<CharT>("s?"))
- check_exception("The format-spec type has a type not supported for a string argument", fmt, input);
+ check_exception("The type option contains an invalid value for a string formatting argument", fmt, input);
// ***** Both have a format-spec
check(SV(R"(^^[:::Hello, :::world]^^^)"), SV("{:^^25::>8}"), input);
check(SV(R"(^^[:::Hello, :::world]^^^)"), SV("{:^^{}::>8}"), input, 25);
check(SV(R"(^^[:::Hello, :::world]^^^)"), SV("{:^^{}::>{}}"), input, 25, 8);
- check_exception("Argument index out of bounds", SV("{:^^{}::>8}"), input);
- check_exception("Argument index out of bounds", SV("{:^^{}::>{}}"), input, 25);
+ check_exception(
+ "The argument index value is too large for the number of arguments supplied", SV("{:^^{}::>8}"), input);
+ check_exception(
+ "The argument index value is too large for the number of arguments supplied", SV("{:^^{}::>{}}"), input, 25);
}
template <class CharT, class TestFunction, class ExceptionTest>
check(SV("__\"hello\"___"), SV("{:_^{}}"), input, 12);
check(SV(":::::\"hello\""), SV("{::>{}}"), input, 12);
- check_exception("The format-spec fill field contains an invalid character", SV("{:}<}"), input);
- check_exception("The format-spec fill field contains an invalid character", SV("{:{<}"), input);
+ check_exception("The fill option contains an invalid value", SV("{:}<}"), input);
+ check_exception("The fill option contains an invalid value", SV("{:{<}"), input);
// *** sign ***
check_exception("The format specifier should consume the input or end with a '}'", SV("{:-}"), input);
check_exception("The format specifier should consume the input or end with a '}'", SV("{:#}"), input);
// *** zero-padding ***
- check_exception("A format-spec width field shouldn't have a leading zero", SV("{:0}"), input);
+ check_exception("The width option should not have a leading zero", SV("{:0}"), input);
// *** precision ***
check(SV("\"he"), SV("{:.3}"), input);
check(SV("\"hello\""), SV("{:s}"), input); // escape overrides the type option s
check(SV("\"hello\""), SV("{:?}"), input);
for (std::basic_string_view<CharT> fmt : fmt_invalid_types<CharT>("s?"))
- check_exception("The format-spec type has a type not supported for a string argument", fmt, input);
+ check_exception("The type option contains an invalid value for a string formatting argument", fmt, input);
}
template <class CharT, class TestFunction, class ExceptionTest>
check(SV(R"(__["Hello", "world"]___)"), SV("{:_^{}}"), input, 23);
check(SV(R"(#####["Hello", "world"])"), SV("{:#>{}}"), input, 23);
- check_exception("The format-spec range-fill field contains an invalid character", SV("{:}<}"), input);
- check_exception("The format-spec range-fill field contains an invalid character", SV("{:{<}"), input);
- check_exception("The format-spec range-fill field contains an invalid character", SV("{::<}"), input);
+ check_exception("The fill option contains an invalid value", SV("{:}<}"), input);
+ check_exception("The fill option contains an invalid value", SV("{:{<}"), input);
+ check_exception("The fill option contains an invalid value", SV("{::<}"), input);
// *** sign ***
- check_exception("The format-spec should consume the input or end with a '}'", SV("{:-}"), input);
+ check_exception("The format specifier should consume the input or end with a '}'", SV("{:-}"), input);
// *** alternate form ***
- check_exception("The format-spec should consume the input or end with a '}'", SV("{:#}"), input);
+ check_exception("The format specifier should consume the input or end with a '}'", SV("{:#}"), input);
// *** zero-padding ***
- check_exception("A format-spec width field shouldn't have a leading zero", SV("{:0}"), input);
+ check_exception("The width option should not have a leading zero", SV("{:0}"), input);
// *** precision ***
- check_exception("The format-spec should consume the input or end with a '}'", SV("{:.}"), input);
+ check_exception("The format specifier should consume the input or end with a '}'", SV("{:.}"), input);
// *** locale-specific form ***
- check_exception("The format-spec should consume the input or end with a '}'", SV("{:L}"), input);
+ check_exception("The format specifier should consume the input or end with a '}'", SV("{:L}"), input);
// *** n
check(SV(R"(_"Hello", "world"_)"), SV("{:_^18n}"), input);
// *** type ***
- check_exception("The range-format-spec type m requires two elements for a pair or tuple", SV("{:m}"), input);
- check_exception("The range-format-spec type s requires formatting a character type", SV("{:s}"), input);
- check_exception("The range-format-spec type ?s requires formatting a character type", SV("{:?s}"), input);
+ check_exception("Type m requires a pair or a tuple with two elements", SV("{:m}"), input);
+ check_exception("Type s requires character type as formatting argument", SV("{:s}"), input);
+ check_exception("Type ?s requires character type as formatting argument", SV("{:?s}"), input);
for (std::basic_string_view<CharT> fmt : fmt_invalid_types<CharT>("s"))
- check_exception("The format-spec should consume the input or end with a '}'", fmt, input);
+ check_exception("The format specifier should consume the input or end with a '}'", fmt, input);
// ***** Only underlying has a format-spec
check(SV(R"(["Hello" , "world" ])"), SV("{::10}"), input);
check(SV(R"([_"Hello"__, _"world"__])"), SV("{::_^{}}"), input, 10);
check(SV(R"([:::"Hello", :::"world"])"), SV("{:::>{}}"), input, 10);
- check_exception("The format-spec fill field contains an invalid character", SV("{::}<}"), input);
- check_exception("The format-spec fill field contains an invalid character", SV("{::{<}"), input);
+ check_exception("The fill option contains an invalid value", SV("{::}<}"), input);
+ check_exception("The fill option contains an invalid value", SV("{::{<}"), input);
// *** sign ***
check_exception("The format specifier should consume the input or end with a '}'", SV("{::-}"), input);
check_exception("The format specifier should consume the input or end with a '}'", SV("{::#}"), input);
// *** zero-padding ***
- check_exception("A format-spec width field shouldn't have a leading zero", SV("{::05}"), input);
+ check_exception("The width option should not have a leading zero", SV("{::05}"), input);
// *** precision ***
check(SV(R"(["He, "wo])"), SV("{::.3}"), input);
check(SV(R"(["He, "wo])"), SV("{::.{}}"), input, 3);
- check_exception("The format-spec precision field doesn't contain a value or arg-id", SV("{::.}"), input);
+ check_exception("The precision option does not contain a value or an argument index", SV("{::.}"), input);
// *** locale-specific form ***
check_exception("The format specifier should consume the input or end with a '}'", SV("{::L}"), input);
// *** type ***
for (std::basic_string_view<CharT> fmt : fmt_invalid_nested_types<CharT>("s?"))
- check_exception("The format-spec type has a type not supported for a string argument", fmt, input);
+ check_exception("The type option contains an invalid value for a string formatting argument", fmt, input);
// ***** Both have a format-spec
check(SV(R"(^^[:::"Hello", :::"world"]^^^)"), SV("{:^^29::>10}"), input);
check(SV(R"(^^[:::"Hello", :::"world"]^^^)"), SV("{:^^{}::>10}"), input, 29);
check(SV(R"(^^[:::"Hello", :::"world"]^^^)"), SV("{:^^{}::>{}}"), input, 29, 10);
- check_exception("Argument index out of bounds", SV("{:^^{}::>10}"), input);
- check_exception("Argument index out of bounds", SV("{:^^{}::>{}}"), input, 29);
+ check_exception(
+ "The argument index value is too large for the number of arguments supplied", SV("{:^^{}::>10}"), input);
+ check_exception(
+ "The argument index value is too large for the number of arguments supplied", SV("{:^^{}::>{}}"), input, 29);
}
template <class CharT, class TestFunction, class ExceptionTest>
check(SV("__['H', 'e', 'l', 'l', 'o']___"), SV("{:_^{}}"), input, 30);
check(SV("#####['H', 'e', 'l', 'l', 'o']"), SV("{:#>{}}"), input, 30);
- check_exception("The format-spec range-fill field contains an invalid character", SV("{:}<}"), input);
- check_exception("The format-spec range-fill field contains an invalid character", SV("{:{<}"), input);
- check_exception("The format-spec range-fill field contains an invalid character", SV("{::<}"), input);
+ check_exception("The fill option contains an invalid value", SV("{:}<}"), input);
+ check_exception("The fill option contains an invalid value", SV("{:{<}"), input);
+ check_exception("The fill option contains an invalid value", SV("{::<}"), input);
// *** sign ***
- check_exception("The format-spec should consume the input or end with a '}'", SV("{:-}"), input);
- check_exception("The format-spec should consume the input or end with a '}'", SV("{:+}"), input);
- check_exception("The format-spec should consume the input or end with a '}'", SV("{: }"), input);
+ check_exception("The format specifier should consume the input or end with a '}'", SV("{:-}"), input);
+ check_exception("The format specifier should consume the input or end with a '}'", SV("{:+}"), input);
+ check_exception("The format specifier should consume the input or end with a '}'", SV("{: }"), input);
// *** alternate form ***
- check_exception("The format-spec should consume the input or end with a '}'", SV("{:#}"), input);
+ check_exception("The format specifier should consume the input or end with a '}'", SV("{:#}"), input);
// *** zero-padding ***
- check_exception("A format-spec width field shouldn't have a leading zero", SV("{:0}"), input);
+ check_exception("The width option should not have a leading zero", SV("{:0}"), input);
// *** precision ***
- check_exception("The format-spec should consume the input or end with a '}'", SV("{:.}"), input);
+ check_exception("The format specifier should consume the input or end with a '}'", SV("{:.}"), input);
// *** locale-specific form ***
- check_exception("The format-spec should consume the input or end with a '}'", SV("{:L}"), input);
+ check_exception("The format specifier should consume the input or end with a '}'", SV("{:L}"), input);
// *** n
check(SV("__'H', 'e', 'l', 'l', 'o'___"), SV("{:_^28n}"), input);
// *** type ***
- check_exception("The range-format-spec type m requires two elements for a pair or tuple", SV("{:m}"), input);
+ check_exception("Type m requires a pair or a tuple with two elements", SV("{:m}"), input);
for (std::basic_string_view<CharT> fmt : fmt_invalid_types<CharT>("s"))
- check_exception("The format-spec should consume the input or end with a '}'", fmt, input);
+ check_exception("The format specifier should consume the input or end with a '}'", fmt, input);
// ***** Only underlying has a format-spec
check(SV("[H , e , l , l , o ]"), SV("{::4}"), input);
check(SV("[_H__, _e__, _l__, _l__, _o__]"), SV("{::_^{}}"), input, 4);
check(SV("[:::H, :::e, :::l, :::l, :::o]"), SV("{:::>{}}"), input, 4);
- check_exception("The format-spec fill field contains an invalid character", SV("{::}<}"), input);
- check_exception("The format-spec fill field contains an invalid character", SV("{::{<}"), input);
+ check_exception("The fill option contains an invalid value", SV("{::}<}"), input);
+ check_exception("The fill option contains an invalid value", SV("{::{<}"), input);
// *** sign ***
check_exception("The format specifier for a character does not allow the sign option", SV("{::-}"), input);
check(SV("^^[:H, :e, :l, :l, :o]^^^"), SV("{:^^{}::>2}"), input, 25);
check(SV("^^[:H, :e, :l, :l, :o]^^^"), SV("{:^^{}::>{}}"), input, 25, 2);
- check_exception("Argument index out of bounds", SV("{:^^{}::>2}"), input);
- check_exception("Argument index out of bounds", SV("{:^^{}::>{}}"), input, 25);
+ check_exception(
+ "The argument index value is too large for the number of arguments supplied", SV("{:^^{}::>2}"), input);
+ check_exception(
+ "The argument index value is too large for the number of arguments supplied", SV("{:^^{}::>{}}"), input, 25);
}
template <class CharT, class TestFunction, class ExceptionTest>
check(SV("_Hello__"), SV("{:_^{}s}"), input, 8);
check(SV("###Hello"), SV("{:#>{}s}"), input, 8);
- check_exception("The format-spec range-fill field contains an invalid character", SV("{:}<s}"), input);
- check_exception("The format-spec range-fill field contains an invalid character", SV("{:{<s}"), input);
- check_exception("The format-spec range-fill field contains an invalid character", SV("{::<s}"), input);
+ check_exception("The fill option contains an invalid value", SV("{:}<s}"), input);
+ check_exception("The fill option contains an invalid value", SV("{:{<s}"), input);
+ check_exception("The fill option contains an invalid value", SV("{::<s}"), input);
// *** sign ***
- check_exception("The format-spec should consume the input or end with a '}'", SV("{:-s}"), input);
- check_exception("The format-spec should consume the input or end with a '}'", SV("{:+s}"), input);
- check_exception("The format-spec should consume the input or end with a '}'", SV("{: s}"), input);
+ check_exception("The format specifier should consume the input or end with a '}'", SV("{:-s}"), input);
+ check_exception("The format specifier should consume the input or end with a '}'", SV("{:+s}"), input);
+ check_exception("The format specifier should consume the input or end with a '}'", SV("{: s}"), input);
// *** alternate form ***
- check_exception("The format-spec should consume the input or end with a '}'", SV("{:#s}"), input);
+ check_exception("The format specifier should consume the input or end with a '}'", SV("{:#s}"), input);
// *** zero-padding ***
- check_exception("A format-spec width field shouldn't have a leading zero", SV("{:0s}"), input);
+ check_exception("The width option should not have a leading zero", SV("{:0s}"), input);
// *** precision ***
- check_exception("The format-spec should consume the input or end with a '}'", SV("{:.s}"), input);
+ check_exception("The format specifier should consume the input or end with a '}'", SV("{:.s}"), input);
// *** locale-specific form ***
- check_exception("The format-spec should consume the input or end with a '}'", SV("{:Ls}"), input);
+ check_exception("The format specifier should consume the input or end with a '}'", SV("{:Ls}"), input);
// *** n
check_exception("The n option and type s can't be used together", SV("{:ns}"), input);
// *** type ***
- check_exception("The range-format-spec type m requires two elements for a pair or tuple", SV("{:m}"), input);
+ check_exception("Type m requires a pair or a tuple with two elements", SV("{:m}"), input);
// ***** Only underlying has a format-spec
check_exception("Type s and an underlying format specification can't be used together", SV("{:s:}"), input);
check(SV(R"(_"\"Hello'"__)"), SV("{:_^{}?s}"), input, 13);
check(SV(R"(###"\"Hello'")"), SV("{:#>{}?s}"), input, 13);
- check_exception("The format-spec range-fill field contains an invalid character", SV("{:}<?s}"), input);
- check_exception("The format-spec range-fill field contains an invalid character", SV("{:{<?s}"), input);
- check_exception("The format-spec range-fill field contains an invalid character", SV("{::<?s}"), input);
+ check_exception("The fill option contains an invalid value", SV("{:}<?s}"), input);
+ check_exception("The fill option contains an invalid value", SV("{:{<?s}"), input);
+ check_exception("The fill option contains an invalid value", SV("{::<?s}"), input);
// *** sign ***
- check_exception("The format-spec should consume the input or end with a '}'", SV("{:-?s}"), input);
- check_exception("The format-spec should consume the input or end with a '}'", SV("{:+?s}"), input);
- check_exception("The format-spec should consume the input or end with a '}'", SV("{: ?s}"), input);
+ check_exception("The format specifier should consume the input or end with a '}'", SV("{:-?s}"), input);
+ check_exception("The format specifier should consume the input or end with a '}'", SV("{:+?s}"), input);
+ check_exception("The format specifier should consume the input or end with a '}'", SV("{: ?s}"), input);
// *** alternate form ***
- check_exception("The format-spec should consume the input or end with a '}'", SV("{:#?s}"), input);
+ check_exception("The format specifier should consume the input or end with a '}'", SV("{:#?s}"), input);
// *** zero-padding ***
- check_exception("A format-spec width field shouldn't have a leading zero", SV("{:0?s}"), input);
+ check_exception("The width option should not have a leading zero", SV("{:0?s}"), input);
// *** precision ***
- check_exception("The format-spec should consume the input or end with a '}'", SV("{:.?s}"), input);
+ check_exception("The format specifier should consume the input or end with a '}'", SV("{:.?s}"), input);
// *** locale-specific form ***
- check_exception("The format-spec should consume the input or end with a '}'", SV("{:L?s}"), input);
+ check_exception("The format specifier should consume the input or end with a '}'", SV("{:L?s}"), input);
// *** n
check_exception("The n option and type ?s can't be used together", SV("{:n?s}"), input);
// *** type ***
- check_exception("The range-format-spec type m requires two elements for a pair or tuple", SV("{:m}"), input);
+ check_exception("Type m requires a pair or a tuple with two elements", SV("{:m}"), input);
// ***** Only underlying has a format-spec
check_exception("Type ?s and an underlying format specification can't be used together", SV("{:?s:}"), input);
// debug-enabled specialization.
using CharT = wchar_t;
- check_exception("The range-format-spec type s requires formatting a character type",
- SV("{:s}"),
- std::array{'H', 'e', 'l', 'l', 'o'});
- check_exception("The range-format-spec type ?s requires formatting a character type",
- SV("{:?s}"),
- std::array{'H', 'e', 'l', 'l', 'o'});
+ check_exception(
+ "Type s requires character type as formatting argument", SV("{:s}"), std::array{'H', 'e', 'l', 'l', 'o'});
+ check_exception(
+ "Type ?s requires character type as formatting argument", SV("{:?s}"), std::array{'H', 'e', 'l', 'l', 'o'});
}
#endif
check(SV("__[true, true, false]___"), SV("{:_^{}}"), input, 24);
check(SV("#####[true, true, false]"), SV("{:#>{}}"), input, 24);
- check_exception("The format-spec range-fill field contains an invalid character", SV("{:}<}"), input);
- check_exception("The format-spec range-fill field contains an invalid character", SV("{:{<}"), input);
- check_exception("The format-spec range-fill field contains an invalid character", SV("{::<}"), input);
+ check_exception("The fill option contains an invalid value", SV("{:}<}"), input);
+ check_exception("The fill option contains an invalid value", SV("{:{<}"), input);
+ check_exception("The fill option contains an invalid value", SV("{::<}"), input);
// *** sign ***
- check_exception("The format-spec should consume the input or end with a '}'", SV("{:-}"), input);
- check_exception("The format-spec should consume the input or end with a '}'", SV("{:+}"), input);
- check_exception("The format-spec should consume the input or end with a '}'", SV("{: }"), input);
+ check_exception("The format specifier should consume the input or end with a '}'", SV("{:-}"), input);
+ check_exception("The format specifier should consume the input or end with a '}'", SV("{:+}"), input);
+ check_exception("The format specifier should consume the input or end with a '}'", SV("{: }"), input);
// *** alternate form ***
- check_exception("The format-spec should consume the input or end with a '}'", SV("{:#}"), input);
+ check_exception("The format specifier should consume the input or end with a '}'", SV("{:#}"), input);
// *** zero-padding ***
- check_exception("A format-spec width field shouldn't have a leading zero", SV("{:0}"), input);
+ check_exception("The width option should not have a leading zero", SV("{:0}"), input);
// *** precision ***
- check_exception("The format-spec should consume the input or end with a '}'", SV("{:.}"), input);
+ check_exception("The format specifier should consume the input or end with a '}'", SV("{:.}"), input);
// *** locale-specific form ***
- check_exception("The format-spec should consume the input or end with a '}'", SV("{:L}"), input);
+ check_exception("The format specifier should consume the input or end with a '}'", SV("{:L}"), input);
// *** n
check(SV("__true, true, false___"), SV("{:_^22n}"), input);
// *** type ***
- check_exception("The range-format-spec type m requires two elements for a pair or tuple", SV("{:m}"), input);
- check_exception("The range-format-spec type s requires formatting a character type", SV("{:s}"), input);
- check_exception("The range-format-spec type ?s requires formatting a character type", SV("{:?s}"), input);
+ check_exception("Type m requires a pair or a tuple with two elements", SV("{:m}"), input);
+ check_exception("Type s requires character type as formatting argument", SV("{:s}"), input);
+ check_exception("Type ?s requires character type as formatting argument", SV("{:?s}"), input);
for (std::basic_string_view<CharT> fmt : fmt_invalid_types<CharT>("s"))
- check_exception("The format-spec should consume the input or end with a '}'", fmt, input);
+ check_exception("The format specifier should consume the input or end with a '}'", fmt, input);
// ***** Only underlying has a format-spec
check(SV("[true , true , false ]"), SV("{::7}"), input);
check(SV("[_true__, _true__, _false_]"), SV("{::_^{}}"), input, 7);
check(SV("[:::true, :::true, ::false]"), SV("{:::>{}}"), input, 7);
- check_exception("The format-spec fill field contains an invalid character", SV("{::}<}"), input);
- check_exception("The format-spec fill field contains an invalid character", SV("{::{<}"), input);
+ check_exception("The fill option contains an invalid value", SV("{::}<}"), input);
+ check_exception("The fill option contains an invalid value", SV("{::{<}"), input);
// *** sign ***
check_exception("The format specifier for a bool does not allow the sign option", SV("{::-}"), input);
check(SV("^^[:::true, :::true, ::false]^^^"), SV("{:^^{}::>7}"), input, 32);
check(SV("^^[:::true, :::true, ::false]^^^"), SV("{:^^{}::>{}}"), input, 32, 7);
- check_exception("Argument index out of bounds", SV("{:^^{}::>5}"), input);
- check_exception("Argument index out of bounds", SV("{:^^{}::>{}}"), input, 32);
+ check_exception(
+ "The argument index value is too large for the number of arguments supplied", SV("{:^^{}::>5}"), input);
+ check_exception(
+ "The argument index value is too large for the number of arguments supplied", SV("{:^^{}::>{}}"), input, 32);
}
//
check(SV("__[1, 2, 42, -42]___"), SV("{:_^{}}"), input, 20);
check(SV("#####[1, 2, 42, -42]"), SV("{:#>{}}"), input, 20);
- check_exception("The format-spec range-fill field contains an invalid character", SV("{:}<}"), input);
- check_exception("The format-spec range-fill field contains an invalid character", SV("{:{<}"), input);
- check_exception("The format-spec range-fill field contains an invalid character", SV("{::<}"), input);
+ check_exception("The fill option contains an invalid value", SV("{:}<}"), input);
+ check_exception("The fill option contains an invalid value", SV("{:{<}"), input);
+ check_exception("The fill option contains an invalid value", SV("{::<}"), input);
// *** sign ***
- check_exception("The format-spec should consume the input or end with a '}'", SV("{:-}"), input);
- check_exception("The format-spec should consume the input or end with a '}'", SV("{:+}"), input);
- check_exception("The format-spec should consume the input or end with a '}'", SV("{: }"), input);
+ check_exception("The format specifier should consume the input or end with a '}'", SV("{:-}"), input);
+ check_exception("The format specifier should consume the input or end with a '}'", SV("{:+}"), input);
+ check_exception("The format specifier should consume the input or end with a '}'", SV("{: }"), input);
// *** alternate form ***
- check_exception("The format-spec should consume the input or end with a '}'", SV("{:#}"), input);
+ check_exception("The format specifier should consume the input or end with a '}'", SV("{:#}"), input);
// *** zero-padding ***
- check_exception("A format-spec width field shouldn't have a leading zero", SV("{:0}"), input);
+ check_exception("The width option should not have a leading zero", SV("{:0}"), input);
// *** precision ***
- check_exception("The format-spec should consume the input or end with a '}'", SV("{:.}"), input);
+ check_exception("The format specifier should consume the input or end with a '}'", SV("{:.}"), input);
// *** locale-specific form ***
- check_exception("The format-spec should consume the input or end with a '}'", SV("{:L}"), input);
+ check_exception("The format specifier should consume the input or end with a '}'", SV("{:L}"), input);
// *** n
check(SV("__1, 2, 42, -42___"), SV("{:_^18n}"), input);
// *** type ***
- check_exception("The range-format-spec type m requires two elements for a pair or tuple", SV("{:m}"), input);
- check_exception("The range-format-spec type s requires formatting a character type", SV("{:s}"), input);
- check_exception("The range-format-spec type ?s requires formatting a character type", SV("{:?s}"), input);
+ check_exception("Type m requires a pair or a tuple with two elements", SV("{:m}"), input);
+ check_exception("Type s requires character type as formatting argument", SV("{:s}"), input);
+ check_exception("Type ?s requires character type as formatting argument", SV("{:?s}"), input);
for (std::basic_string_view<CharT> fmt : fmt_invalid_types<CharT>("s"))
- check_exception("The format-spec should consume the input or end with a '}'", fmt, input);
+ check_exception("The format specifier should consume the input or end with a '}'", fmt, input);
// ***** Only underlying has a format-spec
check(SV("[ 1, 2, 42, -42]"), SV("{::5}"), input);
check(SV("[__1__, __2__, _42__, _-42_]"), SV("{::_^{}}"), input, 5);
check(SV("[::::1, ::::2, :::42, ::-42]"), SV("{:::>{}}"), input, 5);
- check_exception("The format-spec fill field contains an invalid character", SV("{::}<}"), input);
- check_exception("The format-spec fill field contains an invalid character", SV("{::{<}"), input);
+ check_exception("The fill option contains an invalid value", SV("{::}<}"), input);
+ check_exception("The fill option contains an invalid value", SV("{::{<}"), input);
// *** sign ***
check(SV("[1, 2, 42, -42]"), SV("{::-}"), input);
check(SV("^^[::::1, ::::2, :::42, ::-42]^^^"), SV("{:^^{}::>5}"), input, 33);
check(SV("^^[::::1, ::::2, :::42, ::-42]^^^"), SV("{:^^{}::>{}}"), input, 33, 5);
- check_exception("Argument index out of bounds", SV("{:^^{}::>5}"), input);
- check_exception("Argument index out of bounds", SV("{:^^{}::>{}}"), input, 33);
+ check_exception(
+ "The argument index value is too large for the number of arguments supplied", SV("{:^^{}::>5}"), input);
+ check_exception(
+ "The argument index value is too large for the number of arguments supplied", SV("{:^^{}::>{}}"), input, 33);
}
template <class CharT, class TestFunction, class ExceptionTest>
check(SV("__[-42.5, 0, 1.25, 42.5]___"), SV("{:_^{}}"), input, 27);
check(SV("#####[-42.5, 0, 1.25, 42.5]"), SV("{:#>{}}"), input, 27);
- check_exception("The format-spec range-fill field contains an invalid character", SV("{:}<}"), input);
- check_exception("The format-spec range-fill field contains an invalid character", SV("{:{<}"), input);
- check_exception("The format-spec range-fill field contains an invalid character", SV("{::<}"), input);
+ check_exception("The fill option contains an invalid value", SV("{:}<}"), input);
+ check_exception("The fill option contains an invalid value", SV("{:{<}"), input);
+ check_exception("The fill option contains an invalid value", SV("{::<}"), input);
// *** sign ***
- check_exception("The format-spec should consume the input or end with a '}'", SV("{:-}"), input);
- check_exception("The format-spec should consume the input or end with a '}'", SV("{:+}"), input);
- check_exception("The format-spec should consume the input or end with a '}'", SV("{: }"), input);
+ check_exception("The format specifier should consume the input or end with a '}'", SV("{:-}"), input);
+ check_exception("The format specifier should consume the input or end with a '}'", SV("{:+}"), input);
+ check_exception("The format specifier should consume the input or end with a '}'", SV("{: }"), input);
// *** alternate form ***
- check_exception("The format-spec should consume the input or end with a '}'", SV("{:#}"), input);
+ check_exception("The format specifier should consume the input or end with a '}'", SV("{:#}"), input);
// *** zero-padding ***
- check_exception("A format-spec width field shouldn't have a leading zero", SV("{:0}"), input);
+ check_exception("The width option should not have a leading zero", SV("{:0}"), input);
// *** precision ***
- check_exception("The format-spec should consume the input or end with a '}'", SV("{:.}"), input);
+ check_exception("The format specifier should consume the input or end with a '}'", SV("{:.}"), input);
// *** locale-specific form ***
- check_exception("The format-spec should consume the input or end with a '}'", SV("{:L}"), input);
+ check_exception("The format specifier should consume the input or end with a '}'", SV("{:L}"), input);
// *** n
check(SV("__-42.5, 0, 1.25, 42.5___"), SV("{:_^25n}"), input);
// *** type ***
- check_exception("The range-format-spec type m requires two elements for a pair or tuple", SV("{:m}"), input);
- check_exception("The range-format-spec type s requires formatting a character type", SV("{:s}"), input);
- check_exception("The range-format-spec type ?s requires formatting a character type", SV("{:?s}"), input);
+ check_exception("Type m requires a pair or a tuple with two elements", SV("{:m}"), input);
+ check_exception("Type s requires character type as formatting argument", SV("{:s}"), input);
+ check_exception("Type ?s requires character type as formatting argument", SV("{:?s}"), input);
for (std::basic_string_view<CharT> fmt : fmt_invalid_types<CharT>("s"))
- check_exception("The format-spec should consume the input or end with a '}'", fmt, input);
+ check_exception("The format specifier should consume the input or end with a '}'", fmt, input);
// ***** Only underlying has a format-spec
check(SV("[-42.5, 0, 1.25, 42.5]"), SV("{::5}"), input);
check(SV("[-42.5, __0__, 1.25_, 42.5_]"), SV("{::_^{}}"), input, 5);
check(SV("[-42.5, ::::0, :1.25, :42.5]"), SV("{:::>{}}"), input, 5);
- check_exception("The format-spec fill field contains an invalid character", SV("{::}<}"), input);
- check_exception("The format-spec fill field contains an invalid character", SV("{::{<}"), input);
+ check_exception("The fill option contains an invalid value", SV("{::}<}"), input);
+ check_exception("The fill option contains an invalid value", SV("{::{<}"), input);
// *** sign ***
check(SV("[-42.5, 0, 1.25, 42.5]"), SV("{::-}"), input);
check(SV("[-42, 0, 1.2, 42]"), SV("{::.{}}"), input, 2);
check(SV("[-42.500, 0.000, 1.250, 42.500]"), SV("{::.{}f}"), input, 3);
- check_exception("The format-spec precision field doesn't contain a value or arg-id", SV("{::.}"), input);
+ check_exception("The precision option does not contain a value or an argument index", SV("{::.}"), input);
// *** locale-specific form ***
check(SV("[-42.5, 0, 1.25, 42.5]"), SV("{::L}"), input); // does not require locales present
check(SV("^^[::-42, ::::0, ::1.2, :::42]^^^"), SV("{:^^{}::>{}.2}"), input, 33, 5);
check(SV("^^[::-42, ::::0, ::1.2, :::42]^^^"), SV("{:^^{}::>{}.{}}"), input, 33, 5, 2);
- check_exception("Argument index out of bounds", SV("{:^^{}::>5.2}"), input);
- check_exception("Argument index out of bounds", SV("{:^^{}::>{}.2}"), input, 33);
- check_exception("Argument index out of bounds", SV("{:^^{}::>{}.{}}"), input, 33, 5);
+ check_exception(
+ "The argument index value is too large for the number of arguments supplied", SV("{:^^{}::>5.2}"), input);
+ check_exception(
+ "The argument index value is too large for the number of arguments supplied", SV("{:^^{}::>{}.2}"), input, 33);
+ check_exception(
+ "The argument index value is too large for the number of arguments supplied",
+ SV("{:^^{}::>{}.{}}"),
+ input,
+ 33,
+ 5);
}
template <class CharT, class TestFunction, class ExceptionTest>
check(SV("__[0x0]___"), SV("{:_^{}}"), input, 10);
check(SV("#####[0x0]"), SV("{:#>{}}"), input, 10);
- check_exception("The format-spec range-fill field contains an invalid character", SV("{:}<}"), input);
- check_exception("The format-spec range-fill field contains an invalid character", SV("{:{<}"), input);
- check_exception("The format-spec range-fill field contains an invalid character", SV("{::<}"), input);
+ check_exception("The fill option contains an invalid value", SV("{:}<}"), input);
+ check_exception("The fill option contains an invalid value", SV("{:{<}"), input);
+ check_exception("The fill option contains an invalid value", SV("{::<}"), input);
// *** sign ***
- check_exception("The format-spec should consume the input or end with a '}'", SV("{:#}"), input);
+ check_exception("The format specifier should consume the input or end with a '}'", SV("{:#}"), input);
// *** alternate form ***
- check_exception("The format-spec should consume the input or end with a '}'", SV("{:#}"), input);
+ check_exception("The format specifier should consume the input or end with a '}'", SV("{:#}"), input);
// *** zero-padding ***
- check_exception("A format-spec width field shouldn't have a leading zero", SV("{:0}"), input);
+ check_exception("The width option should not have a leading zero", SV("{:0}"), input);
// *** precision ***
- check_exception("The format-spec should consume the input or end with a '}'", SV("{:.}"), input);
+ check_exception("The format specifier should consume the input or end with a '}'", SV("{:.}"), input);
// *** locale-specific form ***
- check_exception("The format-spec should consume the input or end with a '}'", SV("{:L}"), input);
+ check_exception("The format specifier should consume the input or end with a '}'", SV("{:L}"), input);
// *** n
check(SV("_0x0_"), SV("{:_^5n}"), input);
// *** type ***
- check_exception("The range-format-spec type m requires two elements for a pair or tuple", SV("{:m}"), input);
- check_exception("The range-format-spec type s requires formatting a character type", SV("{:s}"), input);
- check_exception("The range-format-spec type ?s requires formatting a character type", SV("{:?s}"), input);
+ check_exception("Type m requires a pair or a tuple with two elements", SV("{:m}"), input);
+ check_exception("Type s requires character type as formatting argument", SV("{:s}"), input);
+ check_exception("Type ?s requires character type as formatting argument", SV("{:?s}"), input);
for (std::basic_string_view<CharT> fmt : fmt_invalid_types<CharT>("s"))
- check_exception("The format-spec should consume the input or end with a '}'", fmt, input);
+ check_exception("The format specifier should consume the input or end with a '}'", fmt, input);
// ***** Only underlying has a format-spec
check(SV("[ 0x0]"), SV("{::5}"), input);
check(SV("[_0x0_]"), SV("{::_^{}}"), input, 5);
check(SV("[::0x0]"), SV("{:::>{}}"), input, 5);
- check_exception("The format-spec fill field contains an invalid character", SV("{::}<}"), input);
- check_exception("The format-spec fill field contains an invalid character", SV("{::{<}"), input);
+ check_exception("The fill option contains an invalid value", SV("{::}<}"), input);
+ check_exception("The fill option contains an invalid value", SV("{::{<}"), input);
// *** sign ***
check_exception("The format specifier should consume the input or end with a '}'", SV("{::-}"), input);
check(SV("^^[::0x0]^^^"), SV("{:^^{}::>5}"), input, 12);
check(SV("^^[::0x0]^^^"), SV("{:^^{}::>{}}"), input, 12, 5);
- check_exception("Argument index out of bounds", SV("{:^^{}::>5}"), input);
- check_exception("Argument index out of bounds", SV("{:^^{}::>{}}"), input, 12);
+ check_exception(
+ "The argument index value is too large for the number of arguments supplied", SV("{:^^{}::>5}"), input);
+ check_exception(
+ "The argument index value is too large for the number of arguments supplied", SV("{:^^{}::>{}}"), input, 12);
}
template <class CharT, class TestFunction, class ExceptionTest>
check(SV(R"(__["Hello", "world"]___)"), SV("{:_^{}}"), input, 23);
check(SV(R"(#####["Hello", "world"])"), SV("{:#>{}}"), input, 23);
- check_exception("The format-spec range-fill field contains an invalid character", SV("{:}<}"), input);
- check_exception("The format-spec range-fill field contains an invalid character", SV("{:{<}"), input);
- check_exception("The format-spec range-fill field contains an invalid character", SV("{::<}"), input);
+ check_exception("The fill option contains an invalid value", SV("{:}<}"), input);
+ check_exception("The fill option contains an invalid value", SV("{:{<}"), input);
+ check_exception("The fill option contains an invalid value", SV("{::<}"), input);
// *** sign ***
- check_exception("The format-spec should consume the input or end with a '}'", SV("{:#}"), input);
+ check_exception("The format specifier should consume the input or end with a '}'", SV("{:#}"), input);
// *** alternate form ***
- check_exception("The format-spec should consume the input or end with a '}'", SV("{:#}"), input);
+ check_exception("The format specifier should consume the input or end with a '}'", SV("{:#}"), input);
// *** zero-padding ***
- check_exception("A format-spec width field shouldn't have a leading zero", SV("{:0}"), input);
+ check_exception("The width option should not have a leading zero", SV("{:0}"), input);
// *** precision ***
- check_exception("The format-spec should consume the input or end with a '}'", SV("{:.}"), input);
+ check_exception("The format specifier should consume the input or end with a '}'", SV("{:.}"), input);
// *** locale-specific form ***
- check_exception("The format-spec should consume the input or end with a '}'", SV("{:L}"), input);
+ check_exception("The format specifier should consume the input or end with a '}'", SV("{:L}"), input);
// *** n
check(SV(R"(_"Hello", "world"_)"), SV("{:_^18n}"), input);
// *** type ***
- check_exception("The range-format-spec type m requires two elements for a pair or tuple", SV("{:m}"), input);
- check_exception("The range-format-spec type s requires formatting a character type", SV("{:s}"), input);
- check_exception("The range-format-spec type ?s requires formatting a character type", SV("{:?s}"), input);
+ check_exception("Type m requires a pair or a tuple with two elements", SV("{:m}"), input);
+ check_exception("Type s requires character type as formatting argument", SV("{:s}"), input);
+ check_exception("Type ?s requires character type as formatting argument", SV("{:?s}"), input);
for (std::basic_string_view<CharT> fmt : fmt_invalid_types<CharT>("s"))
- check_exception("The format-spec should consume the input or end with a '}'", fmt, input);
+ check_exception("The format specifier should consume the input or end with a '}'", fmt, input);
// ***** Only underlying has a format-spec
check(SV(R"([Hello , world ])"), SV("{::8}"), input);
check(SV(R"([_Hello__, _world__])"), SV("{::_^{}}"), input, 8);
check(SV(R"([:::Hello, :::world])"), SV("{:::>{}}"), input, 8);
- check_exception("The format-spec fill field contains an invalid character", SV("{::}<}"), input);
- check_exception("The format-spec fill field contains an invalid character", SV("{::{<}"), input);
+ check_exception("The fill option contains an invalid value", SV("{::}<}"), input);
+ check_exception("The fill option contains an invalid value", SV("{::{<}"), input);
// *** sign ***
check_exception("The format specifier should consume the input or end with a '}'", SV("{::-}"), input);
check_exception("The format specifier should consume the input or end with a '}'", SV("{::#}"), input);
// *** zero-padding ***
- check_exception("A format-spec width field shouldn't have a leading zero", SV("{::05}"), input);
+ check_exception("The width option should not have a leading zero", SV("{::05}"), input);
// *** precision ***
check(SV(R"([Hel, wor])"), SV("{::.3}"), input);
check(SV(R"([Hel, wor])"), SV("{::.{}}"), input, 3);
- check_exception("The format-spec precision field doesn't contain a value or arg-id", SV("{::.}"), input);
+ check_exception("The precision option does not contain a value or an argument index", SV("{::.}"), input);
// *** locale-specific form ***
check_exception("The format specifier should consume the input or end with a '}'", SV("{::L}"), input);
// *** type ***
for (std::basic_string_view<CharT> fmt : fmt_invalid_nested_types<CharT>("s?"))
- check_exception("The format-spec type has a type not supported for a string argument", fmt, input);
+ check_exception("The type option contains an invalid value for a string formatting argument", fmt, input);
// ***** Both have a format-spec
check(SV(R"(^^[:::Hello, :::world]^^^)"), SV("{:^^25::>8}"), input);
check(SV(R"(^^[:::Hello, :::world]^^^)"), SV("{:^^{}::>8}"), input, 25);
check(SV(R"(^^[:::Hello, :::world]^^^)"), SV("{:^^{}::>{}}"), input, 25, 8);
- check_exception("Argument index out of bounds", SV("{:^^{}::>8}"), input);
- check_exception("Argument index out of bounds", SV("{:^^{}::>{}}"), input, 25);
+ check_exception(
+ "The argument index value is too large for the number of arguments supplied", SV("{:^^{}::>8}"), input);
+ check_exception(
+ "The argument index value is too large for the number of arguments supplied", SV("{:^^{}::>{}}"), input, 25);
}
template <class CharT, class TestFunction, class ExceptionTest>
check(SV("__[0xaaaa, 0x5555, 0xaa55]___"), SV("{:_^{}}"), input, 29);
check(SV("#####[0xaaaa, 0x5555, 0xaa55]"), SV("{:#>{}}"), input, 29);
- check_exception("The format-spec range-fill field contains an invalid character", SV("{:}<}"), input);
- check_exception("The format-spec range-fill field contains an invalid character", SV("{:{<}"), input);
- check_exception("The format-spec range-fill field contains an invalid character", SV("{::<}"), input);
+ check_exception("The fill option contains an invalid value", SV("{:}<}"), input);
+ check_exception("The fill option contains an invalid value", SV("{:{<}"), input);
+ check_exception("The fill option contains an invalid value", SV("{::<}"), input);
// *** sign ***
- check_exception("The format-spec should consume the input or end with a '}'", SV("{:-}"), input);
- check_exception("The format-spec should consume the input or end with a '}'", SV("{:+}"), input);
- check_exception("The format-spec should consume the input or end with a '}'", SV("{: }"), input);
+ check_exception("The format specifier should consume the input or end with a '}'", SV("{:-}"), input);
+ check_exception("The format specifier should consume the input or end with a '}'", SV("{:+}"), input);
+ check_exception("The format specifier should consume the input or end with a '}'", SV("{: }"), input);
// *** alternate form ***
- check_exception("The format-spec should consume the input or end with a '}'", SV("{:#}"), input);
+ check_exception("The format specifier should consume the input or end with a '}'", SV("{:#}"), input);
// *** zero-padding ***
- check_exception("A format-spec width field shouldn't have a leading zero", SV("{:0}"), input);
+ check_exception("The width option should not have a leading zero", SV("{:0}"), input);
// *** precision ***
- check_exception("The format-spec should consume the input or end with a '}'", SV("{:.}"), input);
+ check_exception("The format specifier should consume the input or end with a '}'", SV("{:.}"), input);
// *** locale-specific form ***
- check_exception("The format-spec should consume the input or end with a '}'", SV("{:L}"), input);
+ check_exception("The format specifier should consume the input or end with a '}'", SV("{:L}"), input);
// *** n
check(SV("__0xaaaa, 0x5555, 0xaa55___"), SV("{:_^27n}"), input);
// *** type ***
- check_exception("The range-format-spec type m requires two elements for a pair or tuple", SV("{:m}"), input);
- check_exception("The range-format-spec type s requires formatting a character type", SV("{:s}"), input);
- check_exception("The range-format-spec type ?s requires formatting a character type", SV("{:?s}"), input);
+ check_exception("Type m requires a pair or a tuple with two elements", SV("{:m}"), input);
+ check_exception("Type s requires character type as formatting argument", SV("{:s}"), input);
+ check_exception("Type ?s requires character type as formatting argument", SV("{:?s}"), input);
for (std::basic_string_view<CharT> fmt : fmt_invalid_types<CharT>("s"))
- check_exception("The format-spec should consume the input or end with a '}'", fmt, input);
+ check_exception("The format specifier should consume the input or end with a '}'", fmt, input);
// ***** Only underlying has a format-spec
- check_exception("The format-spec type has a type not supported for a status argument", SV("{::*<7}"), input);
+ check_exception("The type option contains an invalid value for a status formatting argument", SV("{::*<7}"), input);
for (std::basic_string_view<CharT> fmt : fmt_invalid_nested_types<CharT>("sxX"))
- check_exception("The format-spec type has a type not supported for a status argument", fmt, input);
+ check_exception("The type option contains an invalid value for a status formatting argument", fmt, input);
check(SV("[0xaaaa, 0x5555, 0xaa55]"), SV("{::x}"), input);
check(SV("[0XAAAA, 0X5555, 0XAA55]"), SV("{::X}"), input);
check(SV("^^[0XAAAA, 0X5555, 0XAA55]^^^"), SV("{:^^29:X}"), input);
check(SV("^^[0XAAAA, 0X5555, 0XAA55]^^^"), SV("{:^^{}:X}"), input, 29);
- check_exception("Argument index out of bounds", SV("{:^^{}:X}"), input);
+ check_exception("The argument index value is too large for the number of arguments supplied", SV("{:^^{}:X}"), input);
}
//
check(SV("__[(1, 'a'), (42, '*')]___"), SV("{:_^{}}"), input, 26);
check(SV("#####[(1, 'a'), (42, '*')]"), SV("{:#>{}}"), input, 26);
- check_exception("The format-spec range-fill field contains an invalid character", SV("{:}<}"), input);
- check_exception("The format-spec range-fill field contains an invalid character", SV("{:{<}"), input);
- check_exception("The format-spec range-fill field contains an invalid character", SV("{::<}"), input);
+ check_exception("The fill option contains an invalid value", SV("{:}<}"), input);
+ check_exception("The fill option contains an invalid value", SV("{:{<}"), input);
+ check_exception("The fill option contains an invalid value", SV("{::<}"), input);
// *** sign ***
- check_exception("The format-spec should consume the input or end with a '}'", SV("{:-}"), input);
- check_exception("The format-spec should consume the input or end with a '}'", SV("{:+}"), input);
- check_exception("The format-spec should consume the input or end with a '}'", SV("{: }"), input);
+ check_exception("The format specifier should consume the input or end with a '}'", SV("{:-}"), input);
+ check_exception("The format specifier should consume the input or end with a '}'", SV("{:+}"), input);
+ check_exception("The format specifier should consume the input or end with a '}'", SV("{: }"), input);
// *** alternate form ***
- check_exception("The format-spec should consume the input or end with a '}'", SV("{:#}"), input);
+ check_exception("The format specifier should consume the input or end with a '}'", SV("{:#}"), input);
// *** zero-padding ***
- check_exception("A format-spec width field shouldn't have a leading zero", SV("{:0}"), input);
+ check_exception("The width option should not have a leading zero", SV("{:0}"), input);
// *** precision ***
- check_exception("The format-spec should consume the input or end with a '}'", SV("{:.}"), input);
+ check_exception("The format specifier should consume the input or end with a '}'", SV("{:.}"), input);
// *** locale-specific form ***
- check_exception("The format-spec should consume the input or end with a '}'", SV("{:L}"), input);
+ check_exception("The format specifier should consume the input or end with a '}'", SV("{:L}"), input);
// *** n
check(SV("__(1, 'a'), (42, '*')___"), SV("{:_^24n}"), input);
// *** type ***
check(SV("__{(1, 'a'), (42, '*')}___"), SV("{:_^26m}"), input);
- check_exception("The range-format-spec type s requires formatting a character type", SV("{:s}"), input);
- check_exception("The range-format-spec type ?s requires formatting a character type", SV("{:?s}"), input);
+ check_exception("Type s requires character type as formatting argument", SV("{:s}"), input);
+ check_exception("Type ?s requires character type as formatting argument", SV("{:?s}"), input);
for (std::basic_string_view<CharT> fmt : fmt_invalid_types<CharT>("s"))
- check_exception("The format-spec should consume the input or end with a '}'", fmt, input);
+ check_exception("The format specifier should consume the input or end with a '}'", fmt, input);
// ***** Only underlying has a format-spec
check(SV("[(1, 'a') , (42, '*') ]"), SV("{::11}"), input);
check(SV("[_(1, 'a')__, _(42, '*')_]"), SV("{::_^{}}"), input, 11);
check(SV("[###(1, 'a'), ##(42, '*')]"), SV("{::#>{}}"), input, 11);
- check_exception("The format-spec range-fill field contains an invalid character", SV("{:::<}"), input);
- check_exception("The format-spec range-fill field contains an invalid character", SV("{::}<}"), input);
- check_exception("The format-spec range-fill field contains an invalid character", SV("{::{<}"), input);
+ check_exception("The fill option contains an invalid value", SV("{:::<}"), input);
+ check_exception("The fill option contains an invalid value", SV("{::}<}"), input);
+ check_exception("The fill option contains an invalid value", SV("{::{<}"), input);
// *** sign ***
- check_exception("The format-spec should consume the input or end with a '}'", SV("{::-}"), input);
- check_exception("The format-spec should consume the input or end with a '}'", SV("{::+}"), input);
- check_exception("The format-spec should consume the input or end with a '}'", SV("{:: }"), input);
+ check_exception("The format specifier should consume the input or end with a '}'", SV("{::-}"), input);
+ check_exception("The format specifier should consume the input or end with a '}'", SV("{::+}"), input);
+ check_exception("The format specifier should consume the input or end with a '}'", SV("{:: }"), input);
// *** alternate form ***
- check_exception("The format-spec should consume the input or end with a '}'", SV("{::#}"), input);
+ check_exception("The format specifier should consume the input or end with a '}'", SV("{::#}"), input);
// *** zero-padding ***
- check_exception("A format-spec width field shouldn't have a leading zero", SV("{::05}"), input);
+ check_exception("The width option should not have a leading zero", SV("{::05}"), input);
// *** precision ***
- check_exception("The format-spec should consume the input or end with a '}'", SV("{::.}"), input);
+ check_exception("The format specifier should consume the input or end with a '}'", SV("{::.}"), input);
// *** locale-specific form ***
- check_exception("The format-spec should consume the input or end with a '}'", SV("{::L}"), input);
+ check_exception("The format specifier should consume the input or end with a '}'", SV("{::L}"), input);
// *** type ***
check(SV("[1: 'a', 42: '*']"), SV("{::m}"), input);
check(SV("[1, 'a', 42, '*']"), SV("{::n}"), input);
for (std::basic_string_view<CharT> fmt : fmt_invalid_nested_types<CharT>(""))
- check_exception("The format-spec should consume the input or end with a '}'", fmt, input);
+ check_exception("The format specifier should consume the input or end with a '}'", fmt, input);
// ***** Both have a format-spec
check(SV("^^[###(1, 'a'), ##(42, '*')]^^^"), SV("{:^^31:#>11}"), input);
check(SV("^^[###(1, 'a'), ##(42, '*')]^^^"), SV("{:^^{}:#>11}"), input, 31);
check(SV("^^[###(1, 'a'), ##(42, '*')]^^^"), SV("{:^^{}:#>{}}"), input, 31, 11);
- check_exception("Argument index out of bounds", SV("{:^^{}:#>5}"), input);
- check_exception("Argument index out of bounds", SV("{:^^{}:#>{}}"), input, 31);
+ check_exception(
+ "The argument index value is too large for the number of arguments supplied", SV("{:^^{}:#>5}"), input);
+ check_exception(
+ "The argument index value is too large for the number of arguments supplied", SV("{:^^{}:#>{}}"), input, 31);
check(SV("1: 'a', 42: '*'"), SV("{:n:m}"), input);
check(SV("1, 'a', 42, '*'"), SV("{:n:n}"), input);
check(SV("__[(42), (99)]___"), SV("{:_^{}}"), input, 17);
check(SV("#####[(42), (99)]"), SV("{:#>{}}"), input, 17);
- check_exception("The format-spec range-fill field contains an invalid character", SV("{:}<}"), input);
- check_exception("The format-spec range-fill field contains an invalid character", SV("{:{<}"), input);
- check_exception("The format-spec range-fill field contains an invalid character", SV("{::<}"), input);
+ check_exception("The fill option contains an invalid value", SV("{:}<}"), input);
+ check_exception("The fill option contains an invalid value", SV("{:{<}"), input);
+ check_exception("The fill option contains an invalid value", SV("{::<}"), input);
// *** sign ***
- check_exception("The format-spec should consume the input or end with a '}'", SV("{:-}"), input);
- check_exception("The format-spec should consume the input or end with a '}'", SV("{:+}"), input);
- check_exception("The format-spec should consume the input or end with a '}'", SV("{: }"), input);
+ check_exception("The format specifier should consume the input or end with a '}'", SV("{:-}"), input);
+ check_exception("The format specifier should consume the input or end with a '}'", SV("{:+}"), input);
+ check_exception("The format specifier should consume the input or end with a '}'", SV("{: }"), input);
// *** alternate form ***
- check_exception("The format-spec should consume the input or end with a '}'", SV("{:#}"), input);
+ check_exception("The format specifier should consume the input or end with a '}'", SV("{:#}"), input);
// *** zero-padding ***
- check_exception("A format-spec width field shouldn't have a leading zero", SV("{:0}"), input);
+ check_exception("The width option should not have a leading zero", SV("{:0}"), input);
// *** precision ***
- check_exception("The format-spec should consume the input or end with a '}'", SV("{:.}"), input);
+ check_exception("The format specifier should consume the input or end with a '}'", SV("{:.}"), input);
// *** locale-specific form ***
- check_exception("The format-spec should consume the input or end with a '}'", SV("{:L}"), input);
+ check_exception("The format specifier should consume the input or end with a '}'", SV("{:L}"), input);
// *** n
check(SV("__(42), (99)___"), SV("{:_^15n}"), input);
// *** type ***
- check_exception("The range-format-spec type m requires two elements for a pair or tuple", SV("{:m}"), input);
- check_exception("The range-format-spec type s requires formatting a character type", SV("{:s}"), input);
- check_exception("The range-format-spec type ?s requires formatting a character type", SV("{:?s}"), input);
+ check_exception("Type m requires a pair or a tuple with two elements", SV("{:m}"), input);
+ check_exception("Type s requires character type as formatting argument", SV("{:s}"), input);
+ check_exception("Type ?s requires character type as formatting argument", SV("{:?s}"), input);
for (std::basic_string_view<CharT> fmt : fmt_invalid_types<CharT>("s"))
- check_exception("The format-spec should consume the input or end with a '}'", fmt, input);
+ check_exception("The format specifier should consume the input or end with a '}'", fmt, input);
// ***** Only underlying has a format-spec
check(SV("[(42) , (99) ]"), SV("{::7}"), input);
check(SV("[_(42)__, _(99)__]"), SV("{::_^{}}"), input, 7);
check(SV("[###(42), ###(99)]"), SV("{::#>{}}"), input, 7);
- check_exception("The format-spec range-fill field contains an invalid character", SV("{:::<}"), input);
- check_exception("The format-spec range-fill field contains an invalid character", SV("{::}<}"), input);
- check_exception("The format-spec range-fill field contains an invalid character", SV("{::{<}"), input);
+ check_exception("The fill option contains an invalid value", SV("{:::<}"), input);
+ check_exception("The fill option contains an invalid value", SV("{::}<}"), input);
+ check_exception("The fill option contains an invalid value", SV("{::{<}"), input);
// *** sign ***
- check_exception("The format-spec should consume the input or end with a '}'", SV("{::-}"), input);
- check_exception("The format-spec should consume the input or end with a '}'", SV("{::+}"), input);
- check_exception("The format-spec should consume the input or end with a '}'", SV("{:: }"), input);
+ check_exception("The format specifier should consume the input or end with a '}'", SV("{::-}"), input);
+ check_exception("The format specifier should consume the input or end with a '}'", SV("{::+}"), input);
+ check_exception("The format specifier should consume the input or end with a '}'", SV("{:: }"), input);
// *** alternate form ***
- check_exception("The format-spec should consume the input or end with a '}'", SV("{::#}"), input);
+ check_exception("The format specifier should consume the input or end with a '}'", SV("{::#}"), input);
// *** zero-padding ***
- check_exception("A format-spec width field shouldn't have a leading zero", SV("{::05}"), input);
+ check_exception("The width option should not have a leading zero", SV("{::05}"), input);
// *** precision ***
- check_exception("The format-spec should consume the input or end with a '}'", SV("{::.}"), input);
+ check_exception("The format specifier should consume the input or end with a '}'", SV("{::.}"), input);
// *** locale-specific form ***
- check_exception("The format-spec should consume the input or end with a '}'", SV("{::L}"), input);
+ check_exception("The format specifier should consume the input or end with a '}'", SV("{::L}"), input);
// *** type ***
check(SV("[42, 99]"), SV("{::n}"), input);
for (std::basic_string_view<CharT> fmt : fmt_invalid_nested_types<CharT>(""))
- check_exception("The format-spec should consume the input or end with a '}'", fmt, input);
+ check_exception("The format specifier should consume the input or end with a '}'", fmt, input);
// ***** Both have a format-spec
check(SV("^^[###(42), ###(99)]^^^"), SV("{:^^23:#>7}"), input);
check(SV("^^[###(42), ###(99)]^^^"), SV("{:^^{}:#>7}"), input, 23);
check(SV("^^[###(42), ###(99)]^^^"), SV("{:^^{}:#>{}}"), input, 23, 7);
- check_exception("Argument index out of bounds", SV("{:^^{}:#>5}"), input);
- check_exception("Argument index out of bounds", SV("{:^^{}:#>{}}"), input, 23);
+ check_exception(
+ "The argument index value is too large for the number of arguments supplied", SV("{:^^{}:#>5}"), input);
+ check_exception(
+ "The argument index value is too large for the number of arguments supplied", SV("{:^^{}:#>{}}"), input, 23);
}
//
check(SV("__[(42, 99, 0), (1, 10, 100)]___"), SV("{:_^{}}"), input, 32);
check(SV("#####[(42, 99, 0), (1, 10, 100)]"), SV("{:#>{}}"), input, 32);
- check_exception("The format-spec range-fill field contains an invalid character", SV("{:}<}"), input);
- check_exception("The format-spec range-fill field contains an invalid character", SV("{:{<}"), input);
- check_exception("The format-spec range-fill field contains an invalid character", SV("{::<}"), input);
+ check_exception("The fill option contains an invalid value", SV("{:}<}"), input);
+ check_exception("The fill option contains an invalid value", SV("{:{<}"), input);
+ check_exception("The fill option contains an invalid value", SV("{::<}"), input);
// *** sign ***
- check_exception("The format-spec should consume the input or end with a '}'", SV("{:-}"), input);
- check_exception("The format-spec should consume the input or end with a '}'", SV("{:+}"), input);
- check_exception("The format-spec should consume the input or end with a '}'", SV("{: }"), input);
+ check_exception("The format specifier should consume the input or end with a '}'", SV("{:-}"), input);
+ check_exception("The format specifier should consume the input or end with a '}'", SV("{:+}"), input);
+ check_exception("The format specifier should consume the input or end with a '}'", SV("{: }"), input);
// *** alternate form ***
- check_exception("The format-spec should consume the input or end with a '}'", SV("{:#}"), input);
+ check_exception("The format specifier should consume the input or end with a '}'", SV("{:#}"), input);
// *** zero-padding ***
- check_exception("A format-spec width field shouldn't have a leading zero", SV("{:0}"), input);
+ check_exception("The width option should not have a leading zero", SV("{:0}"), input);
// *** precision ***
- check_exception("The format-spec should consume the input or end with a '}'", SV("{:.}"), input);
+ check_exception("The format specifier should consume the input or end with a '}'", SV("{:.}"), input);
// *** locale-specific form ***
- check_exception("The format-spec should consume the input or end with a '}'", SV("{:L}"), input);
+ check_exception("The format specifier should consume the input or end with a '}'", SV("{:L}"), input);
// *** n
check(SV("__(42, 99, 0), (1, 10, 100)___"), SV("{:_^30n}"), input);
// *** type ***
- check_exception("The range-format-spec type m requires two elements for a pair or tuple", SV("{:m}"), input);
- check_exception("The range-format-spec type s requires formatting a character type", SV("{:s}"), input);
- check_exception("The range-format-spec type ?s requires formatting a character type", SV("{:?s}"), input);
+ check_exception("Type m requires a pair or a tuple with two elements", SV("{:m}"), input);
+ check_exception("Type s requires character type as formatting argument", SV("{:s}"), input);
+ check_exception("Type ?s requires character type as formatting argument", SV("{:?s}"), input);
for (std::basic_string_view<CharT> fmt : fmt_invalid_types<CharT>("s"))
- check_exception("The format-spec should consume the input or end with a '}'", fmt, input);
+ check_exception("The format specifier should consume the input or end with a '}'", fmt, input);
// ***** Only underlying has a format-spec
check(SV("[(42, 99, 0) , (1, 10, 100) ]"), SV("{::14}"), input);
check(SV("[_(42, 99, 0)__, _(1, 10, 100)_]"), SV("{::_^{}}"), input, 14);
check(SV("[###(42, 99, 0), ##(1, 10, 100)]"), SV("{::#>{}}"), input, 14);
- check_exception("The format-spec range-fill field contains an invalid character", SV("{:::<}"), input);
- check_exception("The format-spec range-fill field contains an invalid character", SV("{::}<}"), input);
- check_exception("The format-spec range-fill field contains an invalid character", SV("{::{<}"), input);
+ check_exception("The fill option contains an invalid value", SV("{:::<}"), input);
+ check_exception("The fill option contains an invalid value", SV("{::}<}"), input);
+ check_exception("The fill option contains an invalid value", SV("{::{<}"), input);
// *** sign ***
- check_exception("The format-spec should consume the input or end with a '}'", SV("{::-}"), input);
- check_exception("The format-spec should consume the input or end with a '}'", SV("{::+}"), input);
- check_exception("The format-spec should consume the input or end with a '}'", SV("{:: }"), input);
+ check_exception("The format specifier should consume the input or end with a '}'", SV("{::-}"), input);
+ check_exception("The format specifier should consume the input or end with a '}'", SV("{::+}"), input);
+ check_exception("The format specifier should consume the input or end with a '}'", SV("{:: }"), input);
// *** alternate form ***
- check_exception("The format-spec should consume the input or end with a '}'", SV("{::#}"), input);
+ check_exception("The format specifier should consume the input or end with a '}'", SV("{::#}"), input);
// *** zero-padding ***
- check_exception("A format-spec width field shouldn't have a leading zero", SV("{::05}"), input);
+ check_exception("The width option should not have a leading zero", SV("{::05}"), input);
// *** precision ***
- check_exception("The format-spec should consume the input or end with a '}'", SV("{::.}"), input);
+ check_exception("The format specifier should consume the input or end with a '}'", SV("{::.}"), input);
// *** locale-specific form ***
- check_exception("The format-spec should consume the input or end with a '}'", SV("{::L}"), input);
+ check_exception("The format specifier should consume the input or end with a '}'", SV("{::L}"), input);
// *** type ***
check(SV("[42, 99, 0, 1, 10, 100]"), SV("{::n}"), input);
for (std::basic_string_view<CharT> fmt : fmt_invalid_nested_types<CharT>("s"))
- check_exception("The format-spec should consume the input or end with a '}'", fmt, input);
+ check_exception("The format specifier should consume the input or end with a '}'", fmt, input);
// ***** Both have a format-spec
check(SV("^^[###(42, 99, 0), ##(1, 10, 100)]^^^"), SV("{:^^37:#>14}"), input);
check(SV("^^[###(42, 99, 0), ##(1, 10, 100)]^^^"), SV("{:^^{}:#>14}"), input, 37);
check(SV("^^[###(42, 99, 0), ##(1, 10, 100)]^^^"), SV("{:^^{}:#>{}}"), input, 37, 14);
- check_exception("Argument index out of bounds", SV("{:^^{}:#>5}"), input);
- check_exception("Argument index out of bounds", SV("{:^^{}:#>{}}"), input, 37);
+ check_exception(
+ "The argument index value is too large for the number of arguments supplied", SV("{:^^{}:#>5}"), input);
+ check_exception(
+ "The argument index value is too large for the number of arguments supplied", SV("{:^^{}:#>{}}"), input, 37);
}
//
check(SV("__(42, 99)___"), SV("{:_^{}}"), input, 13);
check(SV("#####(42, 99)"), SV("{:#>{}}"), input, 13);
- check_exception("The format-spec range-fill field contains an invalid character", SV("{:}<}"), input);
- check_exception("The format-spec range-fill field contains an invalid character", SV("{:{<}"), input);
- check_exception("The format-spec range-fill field contains an invalid character", SV("{::<}"), input);
+ check_exception("The fill option contains an invalid value", SV("{:}<}"), input);
+ check_exception("The fill option contains an invalid value", SV("{:{<}"), input);
+ check_exception("The fill option contains an invalid value", SV("{::<}"), input);
// *** sign ***
- check_exception("The format-spec should consume the input or end with a '}'", SV("{:-}"), input);
- check_exception("The format-spec should consume the input or end with a '}'", SV("{:+}"), input);
- check_exception("The format-spec should consume the input or end with a '}'", SV("{: }"), input);
+ check_exception("The format specifier should consume the input or end with a '}'", SV("{:-}"), input);
+ check_exception("The format specifier should consume the input or end with a '}'", SV("{:+}"), input);
+ check_exception("The format specifier should consume the input or end with a '}'", SV("{: }"), input);
// *** alternate form ***
- check_exception("The format-spec should consume the input or end with a '}'", SV("{:#}"), input);
+ check_exception("The format specifier should consume the input or end with a '}'", SV("{:#}"), input);
// *** zero-padding ***
- check_exception("A format-spec width field shouldn't have a leading zero", SV("{:0}"), input);
+ check_exception("The width option should not have a leading zero", SV("{:0}"), input);
// *** precision ***
- check_exception("The format-spec should consume the input or end with a '}'", SV("{:.}"), input);
+ check_exception("The format specifier should consume the input or end with a '}'", SV("{:.}"), input);
// *** locale-specific form ***
- check_exception("The format-spec should consume the input or end with a '}'", SV("{:L}"), input);
+ check_exception("The format specifier should consume the input or end with a '}'", SV("{:L}"), input);
// *** type ***
check(SV("__42: 99___"), SV("{:_^11m}"), input);
check(SV("__42, 99___"), SV("{:_^11n}"), input);
for (CharT c : SV("aAbBcdeEfFgGopPsxX?")) {
- check_exception("The format-spec should consume the input or end with a '}'",
+ check_exception("The format specifier should consume the input or end with a '}'",
std::basic_string_view{STR("{:") + c + STR("}")},
input);
}
check(SV("__(42, \"hello\")___"), SV("{:_^{}}"), input, 18);
check(SV("#####(42, \"hello\")"), SV("{:#>{}}"), input, 18);
- check_exception("The format-spec range-fill field contains an invalid character", SV("{:}<}"), input);
- check_exception("The format-spec range-fill field contains an invalid character", SV("{:{<}"), input);
- check_exception("The format-spec range-fill field contains an invalid character", SV("{::<}"), input);
+ check_exception("The fill option contains an invalid value", SV("{:}<}"), input);
+ check_exception("The fill option contains an invalid value", SV("{:{<}"), input);
+ check_exception("The fill option contains an invalid value", SV("{::<}"), input);
// *** sign ***
- check_exception("The format-spec should consume the input or end with a '}'", SV("{:-}"), input);
- check_exception("The format-spec should consume the input or end with a '}'", SV("{:+}"), input);
- check_exception("The format-spec should consume the input or end with a '}'", SV("{: }"), input);
+ check_exception("The format specifier should consume the input or end with a '}'", SV("{:-}"), input);
+ check_exception("The format specifier should consume the input or end with a '}'", SV("{:+}"), input);
+ check_exception("The format specifier should consume the input or end with a '}'", SV("{: }"), input);
// *** alternate form ***
- check_exception("The format-spec should consume the input or end with a '}'", SV("{:#}"), input);
+ check_exception("The format specifier should consume the input or end with a '}'", SV("{:#}"), input);
// *** zero-padding ***
- check_exception("A format-spec width field shouldn't have a leading zero", SV("{:0}"), input);
+ check_exception("The width option should not have a leading zero", SV("{:0}"), input);
// *** precision ***
- check_exception("The format-spec should consume the input or end with a '}'", SV("{:.}"), input);
+ check_exception("The format specifier should consume the input or end with a '}'", SV("{:.}"), input);
// *** locale-specific form ***
- check_exception("The format-spec should consume the input or end with a '}'", SV("{:L}"), input);
+ check_exception("The format specifier should consume the input or end with a '}'", SV("{:L}"), input);
// *** type ***
check(SV("__42: \"hello\"___"), SV("{:_^16m}"), input);
check(SV("__42, \"hello\"___"), SV("{:_^16n}"), input);
for (CharT c : SV("aAbBcdeEfFgGopPsxX?")) {
- check_exception("The format-spec should consume the input or end with a '}'",
+ check_exception("The format specifier should consume the input or end with a '}'",
std::basic_string_view{STR("{:") + c + STR("}")},
input);
}
check(SV("__(42)___"), SV("{:_^{}}"), input, 9);
check(SV("#####(42)"), SV("{:#>{}}"), input, 9);
- check_exception("The format-spec range-fill field contains an invalid character", SV("{:}<}"), input);
- check_exception("The format-spec range-fill field contains an invalid character", SV("{:{<}"), input);
- check_exception("The format-spec range-fill field contains an invalid character", SV("{::<}"), input);
+ check_exception("The fill option contains an invalid value", SV("{:}<}"), input);
+ check_exception("The fill option contains an invalid value", SV("{:{<}"), input);
+ check_exception("The fill option contains an invalid value", SV("{::<}"), input);
// *** sign ***
- check_exception("The format-spec should consume the input or end with a '}'", SV("{:-}"), input);
- check_exception("The format-spec should consume the input or end with a '}'", SV("{:+}"), input);
- check_exception("The format-spec should consume the input or end with a '}'", SV("{: }"), input);
+ check_exception("The format specifier should consume the input or end with a '}'", SV("{:-}"), input);
+ check_exception("The format specifier should consume the input or end with a '}'", SV("{:+}"), input);
+ check_exception("The format specifier should consume the input or end with a '}'", SV("{: }"), input);
// *** alternate form ***
- check_exception("The format-spec should consume the input or end with a '}'", SV("{:#}"), input);
+ check_exception("The format specifier should consume the input or end with a '}'", SV("{:#}"), input);
// *** zero-padding ***
- check_exception("A format-spec width field shouldn't have a leading zero", SV("{:0}"), input);
+ check_exception("The width option should not have a leading zero", SV("{:0}"), input);
// *** precision ***
- check_exception("The format-spec should consume the input or end with a '}'", SV("{:.}"), input);
+ check_exception("The format specifier should consume the input or end with a '}'", SV("{:.}"), input);
// *** locale-specific form ***
- check_exception("The format-spec should consume the input or end with a '}'", SV("{:L}"), input);
+ check_exception("The format specifier should consume the input or end with a '}'", SV("{:L}"), input);
// *** type ***
- check_exception("The format specifier m requires a pair or a two-element tuple", SV("{:m}"), input);
+ check_exception("Type m requires a pair or a tuple with two elements", SV("{:m}"), input);
check(SV("__42___"), SV("{:_^7n}"), input);
for (CharT c : SV("aAbBcdeEfFgGopPsxX?")) {
- check_exception("The format-spec should consume the input or end with a '}'",
+ check_exception("The format specifier should consume the input or end with a '}'",
std::basic_string_view{STR("{:") + c + STR("}")},
input);
}
check(SV("__(42, \"hello\", \"red\")___"), SV("{:_^{}}"), input, 25);
check(SV("#####(42, \"hello\", \"red\")"), SV("{:#>{}}"), input, 25);
- check_exception("The format-spec range-fill field contains an invalid character", SV("{:}<}"), input);
- check_exception("The format-spec range-fill field contains an invalid character", SV("{:{<}"), input);
- check_exception("The format-spec range-fill field contains an invalid character", SV("{::<}"), input);
+ check_exception("The fill option contains an invalid value", SV("{:}<}"), input);
+ check_exception("The fill option contains an invalid value", SV("{:{<}"), input);
+ check_exception("The fill option contains an invalid value", SV("{::<}"), input);
// *** sign ***
- check_exception("The format-spec should consume the input or end with a '}'", SV("{:-}"), input);
- check_exception("The format-spec should consume the input or end with a '}'", SV("{:+}"), input);
- check_exception("The format-spec should consume the input or end with a '}'", SV("{: }"), input);
+ check_exception("The format specifier should consume the input or end with a '}'", SV("{:-}"), input);
+ check_exception("The format specifier should consume the input or end with a '}'", SV("{:+}"), input);
+ check_exception("The format specifier should consume the input or end with a '}'", SV("{: }"), input);
// *** alternate form ***
- check_exception("The format-spec should consume the input or end with a '}'", SV("{:#}"), input);
+ check_exception("The format specifier should consume the input or end with a '}'", SV("{:#}"), input);
// *** zero-padding ***
- check_exception("A format-spec width field shouldn't have a leading zero", SV("{:0}"), input);
+ check_exception("The width option should not have a leading zero", SV("{:0}"), input);
// *** precision ***
- check_exception("The format-spec should consume the input or end with a '}'", SV("{:.}"), input);
+ check_exception("The format specifier should consume the input or end with a '}'", SV("{:.}"), input);
// *** locale-specific form ***
- check_exception("The format-spec should consume the input or end with a '}'", SV("{:L}"), input);
+ check_exception("The format specifier should consume the input or end with a '}'", SV("{:L}"), input);
// *** type ***
- check_exception("The format specifier m requires a pair or a two-element tuple", SV("{:m}"), input);
+ check_exception("Type m requires a pair or a tuple with two elements", SV("{:m}"), input);
check(SV("__42, \"hello\", \"red\"___"), SV("{:_^23n}"), input);
for (CharT c : SV("aAbBcdeEfFgGopPsxX?")) {
- check_exception("The format-spec should consume the input or end with a '}'",
+ check_exception("The format specifier should consume the input or end with a '}'",
std::basic_string_view{STR("{:") + c + STR("}")},
input);
}
check(SV("__(42, (\"hello\", \"red\"))___"), SV("{:_^{}}"), input, 27);
check(SV("#####(42, (\"hello\", \"red\"))"), SV("{:#>{}}"), input, 27);
- check_exception("The format-spec range-fill field contains an invalid character", SV("{:}<}"), input);
- check_exception("The format-spec range-fill field contains an invalid character", SV("{:{<}"), input);
- check_exception("The format-spec range-fill field contains an invalid character", SV("{::<}"), input);
+ check_exception("The fill option contains an invalid value", SV("{:}<}"), input);
+ check_exception("The fill option contains an invalid value", SV("{:{<}"), input);
+ check_exception("The fill option contains an invalid value", SV("{::<}"), input);
// *** sign ***
- check_exception("The format-spec should consume the input or end with a '}'", SV("{:-}"), input);
- check_exception("The format-spec should consume the input or end with a '}'", SV("{:+}"), input);
- check_exception("The format-spec should consume the input or end with a '}'", SV("{: }"), input);
+ check_exception("The format specifier should consume the input or end with a '}'", SV("{:-}"), input);
+ check_exception("The format specifier should consume the input or end with a '}'", SV("{:+}"), input);
+ check_exception("The format specifier should consume the input or end with a '}'", SV("{: }"), input);
// *** alternate form ***
- check_exception("The format-spec should consume the input or end with a '}'", SV("{:#}"), input);
+ check_exception("The format specifier should consume the input or end with a '}'", SV("{:#}"), input);
// *** zero-padding ***
- check_exception("A format-spec width field shouldn't have a leading zero", SV("{:0}"), input);
+ check_exception("The width option should not have a leading zero", SV("{:0}"), input);
// *** precision ***
- check_exception("The format-spec should consume the input or end with a '}'", SV("{:.}"), input);
+ check_exception("The format specifier should consume the input or end with a '}'", SV("{:.}"), input);
// *** locale-specific form ***
- check_exception("The format-spec should consume the input or end with a '}'", SV("{:L}"), input);
+ check_exception("The format specifier should consume the input or end with a '}'", SV("{:L}"), input);
// *** type ***
check(SV("__42: (\"hello\", \"red\")___"), SV("{:_^25m}"), input);
check(SV("__42, (\"hello\", \"red\")___"), SV("{:_^25n}"), input);
for (CharT c : SV("aAbBcdeEfFgGopPsxX?")) {
- check_exception("The format-spec should consume the input or end with a '}'",
+ check_exception("The format specifier should consume the input or end with a '}'",
std::basic_string_view{STR("{:") + c + STR("}")},
input);
}
case CharT('}'):
return begin;
default:
- throw_format_error("The format-spec type has a type not supported for a status argument");
+ throw_format_error("The type option contains an invalid value for a status formatting argument");
}
++begin;
if (begin != end && *begin != CharT('}'))
- throw_format_error("The format-spec should consume the input or end with a '}'");
+ throw_format_error("The format specifier should consume the input or end with a '}'");
return begin;
}