gcc - GNU Compiler Collection (original) (raw)
libstdc++: Replace _CharT template parameter with CharT in format tests.HEADtrunkmaster
As pointed out by Daniel Krügler we do not need to use reserved name in tests. libstdc++-v3/ChangeLog: * testsuite/23_containers/vector/bool/format.cc: Replaced _CharT with CharT. * testsuite/std/format/debug.cc: Likewise. * testsuite/std/format/ranges/adaptors.cc: Likewise. * testsuite/std/format/ranges/formatter.cc: Likewise. * testsuite/std/format/ranges/map.cc: Likewise. * testsuite/std/format/ranges/sequence.cc: Likewise. * testsuite/std/format/ranges/string.cc: Likewise. * testsuite/std/format/tuple.cc: Likewise. * testsuite/std/time/format/empty_spec.cc: Likewise. * testsuite/std/time/format/pr120114.cc: Likewise. * testsuite/std/time/format/pr120481.cc: Likewise. * testsuite/std/time/format/precision.cc: Likewise.
@@ -21,7 +21,7 @@ is_format_string_for(const char* str, Args&&... args)
}
}
#define WIDEN_(C, S) ::std::__format::_Widen(S, L##S)
#define WIDEN_(C, S) ::std::__format::_Widen(S, L##S)
#define WIDEN(S) WIDEN_(_CharT, S)
#define WIDEN(S) WIDEN_(CharT, S)
void
void
test_format_string()
test_format_string()
@@ -34,11 +34,11 @@ test_format_string()
VERIFY( !is_format_string_for("{:{}}", v[0], 1.0f) );
VERIFY( !is_format_string_for("{:{}}", v[0], 1.0f) );
}
}
template<typename _CharT>
template
void
void
test_output()
test_output()
{
{
std::basic_string<_CharT> res;
std::basic_string res;
size_t size = 0;
size_t size = 0;
std::vector v{true, false};
std::vector v{true, false};
@@ -26,13 +26,13 @@ fdebug(std::wstring_view t)
#define WIDEN_(C, S) ::std::__format::_Widen(S, L##S)
#define WIDEN_(C, S) ::std::__format::_Widen(S, L##S)
#define WIDEN(S) WIDEN_(_CharT, S)
#define WIDEN(S) WIDEN_(CharT, S)
template<typename _CharT>
template
void
void
test_basic_escapes()
test_basic_escapes()
{
{
std::basic_string<_CharT> res;
std::basic_string res;
const auto tab = WIDEN("\t");
const auto tab = WIDEN("\t");
res = fdebug(tab);
res = fdebug(tab);
@@ -71,11 +71,11 @@ test_basic_escapes()
VERIFY( res == WIDEN(R"('\'')") );
VERIFY( res == WIDEN(R"('\'')") );
}
}
template<typename _CharT>
template
void
void
test_ascii_escapes()
test_ascii_escapes()
{
{
std::basic_string<_CharT> res;
std::basic_string res;
const auto in = WIDEN("\x10 abcde\x7f\t0123");
const auto in = WIDEN("\x10 abcde\x7f\t0123");
res = fdebug(in);
res = fdebug(in);
@@ -88,11 +88,11 @@ test_ascii_escapes()
VERIFY( res == WIDEN(R"('a')") );
VERIFY( res == WIDEN(R"('a')") );
}
}
template<typename _CharT>
template
void
void
test_extended_ascii()
test_extended_ascii()
{
{
std::basic_string<_CharT> res;
std::basic_string res;
const auto in = WIDEN("Åëÿ");
const auto in = WIDEN("Åëÿ");
res = fdebug(in);
res = fdebug(in);
@@ -100,7 +100,7 @@ test_extended_ascii()
static constexpr bool __test_characters
static constexpr bool __test_characters
#if UNICODE_ENC
#if UNICODE_ENC
= sizeof(_CharT) >= 2;
= sizeof(CharT) >= 2;
#else // ISO8859-1
#else // ISO8859-1
= true;
= true;
#endif // UNICODE_ENC
#endif // UNICODE_ENC
@@ -116,12 +116,12 @@ test_extended_ascii()
}
}
}
}
template<typename _CharT>
template
void
void
test_unicode_escapes()
test_unicode_escapes()
{
{
#if UNICODE_ENC
#if UNICODE_ENC
std::basic_string<_CharT> res;
std::basic_string res;
const auto in = WIDEN(
const auto in = WIDEN(
"\u008a" // Cc, Control, Line Tabulation Set,
"\u008a" // Cc, Control, Line Tabulation Set,
@@ -143,7 +143,7 @@ test_unicode_escapes()
res = fdebug(in);
res = fdebug(in);
VERIFY( res == out );
VERIFY( res == out );
if constexpr (sizeof(_CharT) >= 2)
if constexpr (sizeof(CharT) >= 2)
{
{
res = fdebug(in[0]);
res = fdebug(in[0]);
VERIFY( res == WIDEN(R"('\u{8a}')") );
VERIFY( res == WIDEN(R"('\u{8a}')") );
@@ -157,7 +157,7 @@ test_unicode_escapes()
VERIFY( res == WIDEN(R"('\u{2029}')") );
VERIFY( res == WIDEN(R"('\u{2029}')") );
}
}
if constexpr (sizeof(_CharT) >= 4)
if constexpr (sizeof(CharT) >= 4)
{
{
res = fdebug(in[5]);
res = fdebug(in[5]);
VERIFY( res == WIDEN("'\U0001f984'") );
VERIFY( res == WIDEN("'\U0001f984'") );
@@ -165,25 +165,25 @@ test_unicode_escapes()
#endif // UNICODE_ENC
#endif // UNICODE_ENC
}
}
template<typename _CharT>
template
void
void
test_grapheme_extend()
test_grapheme_extend()
{
{
#if UNICODE_ENC
#if UNICODE_ENC
std::basic_string<_CharT> res;
std::basic_string res;
const auto vin = WIDEN("o\u0302\u0323");
const auto vin = WIDEN("o\u0302\u0323");
res = fdebug(vin);
res = fdebug(vin);
VERIFY( res == WIDEN("\"o\u0302\u0323\"") );
VERIFY( res == WIDEN("\"o\u0302\u0323\"") );
std::basic_string_view<_CharT> in = WIDEN("\t\u0302\u0323");
std::basic_string_view in = WIDEN("\t\u0302\u0323");
res = fdebug(in);
res = fdebug(in);
VERIFY( res == WIDEN(R"("\t\u{302}\u{323}")") );
VERIFY( res == WIDEN(R"("\t\u{302}\u{323}")") );
res = fdebug(in.substr(1));
res = fdebug(in.substr(1));
VERIFY( res == WIDEN(R"("\u{302}\u{323}")") );
VERIFY( res == WIDEN(R"("\u{302}\u{323}")") );
if constexpr (sizeof(_CharT) >= 2)
if constexpr (sizeof(CharT) >= 2)
{
{
res = fdebug(in[1]);
res = fdebug(in[1]);
VERIFY( res == WIDEN(R"('\u{302}')") );
VERIFY( res == WIDEN(R"('\u{302}')") );
@@ -191,13 +191,13 @@ test_grapheme_extend()
#endif // UNICODE_ENC
#endif // UNICODE_ENC
}
}
template<typename _CharT>
template
void
void
test_replacement_char()
test_replacement_char()
{
{
#if UNICODE_ENC
#if UNICODE_ENC
std::basic_string<_CharT> repl = WIDEN("\uFFFD");
std::basic_string repl = WIDEN("\uFFFD");
std::basic_string<_CharT> res = fdebug(repl);
std::basic_string res = fdebug(repl);
VERIFY( res == WIDEN("\"\uFFFD\"") );
VERIFY( res == WIDEN("\"\uFFFD\"") );
repl = WIDEN("\uFFFD\uFFFD");
repl = WIDEN("\uFFFD\uFFFD");
@@ -268,13 +268,13 @@ test_ill_formed_utf32()
#endif // UNICODE_ENC
#endif // UNICODE_ENC
}
}
template<typename _CharT>
template
void
void
test_fill()
test_fill()
{
{
std::basic_string<_CharT> res;
std::basic_string res;
std::basic_string_view<_CharT> in = WIDEN("a\t\x10\u00ad");
std::basic_string_view in = WIDEN("a\t\x10\u00ad");
res = std::format(WIDEN("{:10?}"), in.substr(0, 1));
res = std::format(WIDEN("{:10?}"), in.substr(0, 1));
VERIFY( res == WIDEN(R"("a" )") );
VERIFY( res == WIDEN(R"("a" )") );
@@ -299,11 +299,11 @@ test_fill()
VERIFY( res == WIDEN(R"(="\u{ad}"=)") );
VERIFY( res == WIDEN(R"(="\u{ad}"=)") );
// width is 2
// width is 2
std::basic_string_view<_CharT> in2 = WIDEN("\u1100");
std::basic_string_view in2 = WIDEN("\u1100");
res = std::format(WIDEN("{:*^10?}"), in2);
res = std::format(WIDEN("{:*^10?}"), in2);
VERIFY( res == WIDEN("***\"\u1100\"***") );
VERIFY( res == WIDEN("***\"\u1100\"***") );
if constexpr (sizeof(_CharT) >= 2)
if constexpr (sizeof(CharT) >= 2)
{
{
res = std::format(WIDEN("{:=^10?}"), in[3]);
res = std::format(WIDEN("{:=^10?}"), in[3]);
VERIFY( res == WIDEN(R"(='\u{ad}'=)") );
VERIFY( res == WIDEN(R"(='\u{ad}'=)") );
@@ -314,14 +314,14 @@ test_fill()
#endif // UNICODE_ENC
#endif // UNICODE_ENC
}
}
template<typename _CharT>
template
void
void
test_prec()
test_prec()
{
{
std::basic_string<_CharT> res;
std::basic_string res;
// with ? escpaed presentation is copied to ouput, same as source
// with ? escpaed presentation is copied to ouput, same as source
std::basic_string_view<_CharT> in = WIDEN("a\t\x10\u00ad");
std::basic_string_view in = WIDEN("a\t\x10\u00ad");
res = std::format(WIDEN("{:.2?}"), in.substr(0, 1));
res = std::format(WIDEN("{:.2?}"), in.substr(0, 1));
VERIFY( res == WIDEN(R"("a)") );
VERIFY( res == WIDEN(R"("a)") );
@@ -335,7 +335,7 @@ test_prec()
res = std::format(WIDEN("{:.10?}"), in.substr(3));
res = std::format(WIDEN("{:.10?}"), in.substr(3));
VERIFY( res == WIDEN(R"("\u{ad}")") );
VERIFY( res == WIDEN(R"("\u{ad}")") );
std::basic_string_view<_CharT> in2 = WIDEN("\u1100");
std::basic_string_view in2 = WIDEN("\u1100");
res = std::format(WIDEN("{:.3?}"), in2);
res = std::format(WIDEN("{:.3?}"), in2);
VERIFY( res == WIDEN("\"\u1100") );
VERIFY( res == WIDEN("\"\u1100") );
#endif // UNICODE_ENC
#endif // UNICODE_ENC
@@ -759,38 +759,38 @@ private:
std::formatter<T, CharT> under;
std::formatter<T, CharT> under;
};
};
template<typename _CharT, typename StrT>
template<typename CharT, typename StrT>
void
void
test_formatter_str()
test_formatter_str()
{
{
_CharT buf[]{ 'a', 'b', 'c', 0 };
CharT buf[]{ 'a', 'b', 'c', 0 };
DebugWrapper in{ buf };
DebugWrapper in{ buf };
std::basic_string<_CharT> res = std::format(WIDEN("{:?}"), in );
std::basic_string res = std::format(WIDEN("{:?}"), in );
VERIFY( res == WIDEN(R"("abc")") );
VERIFY( res == WIDEN(R"("abc")") );
}
}
template<typename _CharT>
template
void
void
test_formatter_arr()
test_formatter_arr()
{
{
std::basic_string<_CharT> res;
std::basic_string res;
DebugWrapper<_CharT[3]> in3{ 'a', 'b', 'c' };
DebugWrapper<CharT[3]> in3{ 'a', 'b', 'c' };
res = std::format(WIDEN("{:?}"), in3 );
res = std::format(WIDEN("{:?}"), in3 );
VERIFY( res == WIDEN(R"("abc")") );
VERIFY( res == WIDEN(R"("abc")") );
// We print all characters, including null-terminator
// We print all characters, including null-terminator
DebugWrapper<_CharT[4]> in4{ 'a', 'b', 'c', 0 };
DebugWrapper<CharT[4]> in4{ 'a', 'b', 'c', 0 };
res = std::format(WIDEN("{:?}"), in4 );
res = std::format(WIDEN("{:?}"), in4 );
VERIFY( res == WIDEN(R"("abc\u{0}")") );
VERIFY( res == WIDEN(R"("abc\u{0}")") );
}
}
template<typename _CharT, typename SrcT>
template<typename CharT, typename SrcT>
void
void
test_formatter_char()
test_formatter_char()
{
{
DebugWrapper in{ 'a' };
DebugWrapper in{ 'a' };
std::basic_string<_CharT> res = std::format(WIDEN("{:?}"), in);
std::basic_string res = std::format(WIDEN("{:?}"), in);
VERIFY( res == WIDEN(R"('a')") );
VERIFY( res == WIDEN(R"('a')") );
}
}
@@ -19,7 +19,7 @@ is_format_string_for(const char* str, Args&&... args)
}
}
#define WIDEN_(C, S) ::std::__format::_Widen(S, L##S)
#define WIDEN_(C, S) ::std::__format::_Widen(S, L##S)
#define WIDEN(S) WIDEN_(_CharT, S)
#define WIDEN(S) WIDEN_(CharT, S)
template<template class Adaptor>
template<template class Adaptor>
void
void
@@ -66,13 +66,13 @@ template
constexpr auto std::format_kind<NotFormattableCont>
constexpr auto std::format_kind<NotFormattableCont>
= std::range_format::disabled;
= std::range_format::disabled;
template<typename _CharT,
template<typename CharT,
template<typename Tp, typename Cont = std::vector> class Adaptor>
template<typename Tp, typename Cont = std::vector> class Adaptor>
void
void
test_output()
test_output()
{
{
const std::vector v{3, 2, 1};
const std::vector v{3, 2, 1};
std::basic_string<_CharT> res;
std::basic_string res;
Adaptor<int, std::vector> q(std::from_range, v);
Adaptor<int, std::vector> q(std::from_range, v);
res = std::format(WIDEN("{}"), q);
res = std::format(WIDEN("{}"), q);
@@ -88,9 +88,9 @@ test_output()
VERIFY( res == WIDEN("==[0x03, 0x02, 0x01]===") );
VERIFY( res == WIDEN("==[0x03, 0x02, 0x01]===") );
// Sequence output is always used
// Sequence output is always used
Adaptor<_CharT, std::basic_string<_CharT>> qs(
Adaptor<CharT, std::basic_string> qs(
std::from_range,
std::from_range,
std::basic_string_view<_CharT>(WIDEN("321")));
std::basic_string_view(WIDEN("321")));
res = std::format(WIDEN("{}"), qs);
res = std::format(WIDEN("{}"), qs);
VERIFY( res == WIDEN("['3', '2', '1']") );
VERIFY( res == WIDEN("['3', '2', '1']") );
@@ -114,13 +114,13 @@ test_output()
res = std::format(WIDEN("{}"), mq);
res = std::format(WIDEN("{}"), mq);
VERIFY( res == WIDEN("[3, 2, 1]") );
VERIFY( res == WIDEN("[3, 2, 1]") );
static_assert(!std::formattable<const Adaptor, _CharT>);
static_assert(!std::formattable<const Adaptor, CharT>);
static_assert(!std::formattable<Adaptor, _CharT>);
static_assert(!std::formattable<Adaptor, CharT>);
static_assert(!std::formattable<const Adaptor, _CharT>);
static_assert(!std::formattable<const Adaptor, CharT>);
// Formatter check if container is formattable, not container elements.
// Formatter check if container is formattable, not container elements.
static_assert(!std::formattable<Adaptor<int, NotFormattableCont>, _CharT>);
static_assert(!std::formattable<Adaptor<int, NotFormattableCont>, CharT>);
}
}
template<template<typename Tp, typename Cont = std::vector> class Adaptor>
template<template<typename Tp, typename Cont = std::vector> class Adaptor>
@@ -135,12 +135,12 @@ test_adaptor()
static_assert(!std::formattable<Adaptor, char32_t>);
static_assert(!std::formattable<Adaptor, char32_t>);
}
}
template<typename _CharT>
template
void
void
test_compare()
test_compare()
{
{
const std::vector v{3, 2, 1};
const std::vector v{3, 2, 1};
std::basic_string<_CharT> res;
std::basic_string res;
std::priority_queue<int, std::vector, std::greater<>> q(
std::priority_queue<int, std::vector, std::greater<>> q(
std::from_range, v);
std::from_range, v);
@@ -6,7 +6,7 @@
#include
#include
#define WIDEN_(C, S) ::std::__format::_Widen(S, L##S)
#define WIDEN_(C, S) ::std::__format::_Widen(S, L##S)
#define WIDEN(S) WIDEN_(_CharT, S)
#define WIDEN(S) WIDEN_(CharT, S)
template<typename T,
template<typename T,
template<typename, typename> class Formatter = std::range_formatter>
template<typename, typename> class Formatter = std::range_formatter>
@@ -22,7 +22,6 @@ struct std::formatter<MyVector<T, Formatter>, CharT>
{
{
constexpr formatter() noexcept
constexpr formatter() noexcept
{
{
using _CharT = CharT;
_formatter.set_brackets(WIDEN("<"), WIDEN(">"));
_formatter.set_brackets(WIDEN("<"), WIDEN(">"));
_formatter.set_separator(WIDEN("; "));
_formatter.set_separator(WIDEN("; "));
}
}
@@ -41,12 +40,12 @@ private:
Formatter<T, CharT> _formatter;
Formatter<T, CharT> _formatter;
};
};
template<typename _CharT, template<typename, typename> class Formatter>
template<typename CharT, template<typename, typename> class Formatter>
void
void
test_default()
test_default()
{
{
MyVector<int, Formatter> vec{1, 2, 3};
MyVector<int, Formatter> vec{1, 2, 3};
std::basic_string<_CharT> res;
std::basic_string res;
res = std::format(WIDEN("{}"), vec);
res = std::format(WIDEN("{}"), vec);
VERIFY( res == WIDEN("<1; 2; 3>") );
VERIFY( res == WIDEN("<1; 2; 3>") );
@@ -93,13 +92,13 @@ test_default()
VERIFY( res == WIDEN("< +1 ; +2 ; +3 >") );
VERIFY( res == WIDEN("< +1 ; +2 ; +3 >") );
}
}
template<typename _CharT, template<typename, typename> class Formatter>
template<typename CharT, template<typename, typename> class Formatter>
void
void
test_override()
test_override()
{
{
MyVector<_CharT, Formatter> vc{'a', 'b', 'c', 'd'};
MyVector<CharT, Formatter> vc{'a', 'b', 'c', 'd'};
MyVector<std::pair<int, int>, Formatter> vp{{1, 11}, {2, 21}};
MyVector<std::pair<int, int>, Formatter> vp{{1, 11}, {2, 21}};
std::basic_string<_CharT> res;
std::basic_string res;
res = std::format(WIDEN("{:s}"), vc);
res = std::format(WIDEN("{:s}"), vc);
VERIFY( res == WIDEN("abcd") );
VERIFY( res == WIDEN("abcd") );
@@ -57,7 +57,7 @@ bool is_range_formatter_spec_for(CharT const* spec, Rg&& rg)
}
}
#define WIDEN_(C, S) ::std::__format::_Widen(S, L##S)
#define WIDEN_(C, S) ::std::__format::_Widen(S, L##S)
#define WIDEN(S) WIDEN_(_CharT, S)
#define WIDEN(S) WIDEN_(CharT, S)
void
void
test_format_string()
test_format_string()
@@ -83,10 +83,10 @@ test_format_string()
VERIFY( !is_format_string_for("{:{}m}", std::vector<std::pair<int, int>>(), 1.0f) );
VERIFY( !is_format_string_for("{:{}m}", std::vector<std::pair<int, int>>(), 1.0f) );
}
}
template<typename _CharT, typename Range>
template<typename CharT, typename Range>
void test_output(bool mapIsDefault)
void test_output(bool mapIsDefault)
{
{
using Sv = std::basic_string_view<_CharT>;
using Sv = std::basic_string_view;
using Pt = std::ranges::range_value_t;
using Pt = std::ranges::range_value_t;
using Ft = std::remove_cvref_t<std::tuple_element_t<0, Pt>>;
using Ft = std::remove_cvref_t<std::tuple_element_t<0, Pt>>;
using St = std::remove_cvref_t<std::tuple_element_t<1, Pt>>;
using St = std::remove_cvref_t<std::tuple_element_t<1, Pt>>;
@@ -94,7 +94,7 @@ void test_output(bool mapIsDefault)
return Range(s.data(), s.data() + s.size());
return Range(s.data(), s.data() + s.size());
};
};
std::basic_string<_CharT> res;
std::basic_string res;
size_t size = 0;
size_t size = 0;
Ft f1[]{1, 2, 3};
Ft f1[]{1, 2, 3};
@@ -76,12 +76,12 @@ test_format_string()
}
}
#define WIDEN_(C, S) ::std::__format::_Widen(S, L##S)
#define WIDEN_(C, S) ::std::__format::_Widen(S, L##S)
#define WIDEN(S) WIDEN_(_CharT, S)
#define WIDEN(S) WIDEN_(CharT, S)
template<typename _CharT, typename Range, typename Storage>
template<typename CharT, typename Range, typename Storage>
void test_output()
void test_output()
{
{
using Sv = std::basic_string_view<_CharT>;
using Sv = std::basic_string_view;
using T = std::ranges::range_value_t;
using T = std::ranges::range_value_t;
auto makeRange = [](Storage& s) -> Range {
auto makeRange = [](Storage& s) -> Range {
if constexpr (std::is_same_v<std::remove_cvref_t, Storage>)
if constexpr (std::is_same_v<std::remove_cvref_t, Storage>)
@@ -91,7 +91,7 @@ void test_output()
std::ranges::data(s) + std::ranges::size(s));
std::ranges::data(s) + std::ranges::size(s));
};
};
std::basic_string<_CharT> res;
std::basic_string res;
size_t size = 0;
size_t size = 0;
Storage v1{1, 2, 3};
Storage v1{1, 2, 3};
@@ -48,7 +48,7 @@ bool is_range_formatter_spec_for(CharT const* spec, Rg&& rg)
}
}
#define WIDEN_(C, S) ::std::__format::_Widen(S, L##S)
#define WIDEN_(C, S) ::std::__format::_Widen(S, L##S)
#define WIDEN(S) WIDEN_(_CharT, S)
#define WIDEN(S) WIDEN_(CharT, S)
void
void
test_format_string()
test_format_string()
@@ -81,14 +81,14 @@ test_format_string()
template
template
void test_output()
void test_output()
{
{
using _CharT = std::ranges::range_value_t;
using CharT = std::ranges::range_value_t;
auto makeRange = [](std::basic_string<_CharT>& s) {
auto makeRange = [](std::basic_string& s) {
return Range(s.data(), s.data() + s.size());
return Range(s.data(), s.data() + s.size());
};
};
std::basic_string<_CharT> res;
std::basic_string res;
size_t size = 0;
size_t size = 0;
std::basic_string<_CharT> s1 = WIDEN("abcd");
std::basic_string s1 = WIDEN("abcd");
res = std::format(WIDEN("{}"), makeRange(s1));
res = std::format(WIDEN("{}"), makeRange(s1));
VERIFY( res == WIDEN("['a', 'b', 'c', 'd']") );
VERIFY( res == WIDEN("['a', 'b', 'c', 'd']") );
@@ -122,7 +122,7 @@ void test_output()
res = std::format(WIDEN("{:=^8s}"), makeRange(s1));
res = std::format(WIDEN("{:=^8s}"), makeRange(s1));
VERIFY( res == WIDEN("==abcd==") );
VERIFY( res == WIDEN("==abcd==") );
std::basic_string<_CharT> s2(512, static_cast<_CharT>('a'));
std::basic_string s2(512, static_cast('a'));
res = std::format(WIDEN("{:=^8s}"), makeRange(s2));
res = std::format(WIDEN("{:=^8s}"), makeRange(s2));
VERIFY( res == s2 );
VERIFY( res == s2 );
@@ -39,7 +39,7 @@ is_format_string_for(const wchar_t* str, Args&&... args)
}
}
#define WIDEN_(C, S) ::std::__format::_Widen(S, L##S)
#define WIDEN_(C, S) ::std::__format::_Widen(S, L##S)
#define WIDEN(S) WIDEN_(_CharT, S)
#define WIDEN(S) WIDEN_(CharT, S)
void
void
test_format_string()
test_format_string()
@@ -62,13 +62,13 @@ test_format_string()
VERIFY( !is_format_string_for("{:{}}", std::tuple<>(), 1.0f) );
VERIFY( !is_format_string_for("{:{}}", std::tuple<>(), 1.0f) );
}
}
template<typename _CharT>
template
void test_multi()
void test_multi()
{
{
using Sv = std::basic_string_view<_CharT>;
using Sv = std::basic_string_view;
using Str = std::basic_string<_CharT>;
using Str = std::basic_string;
std::basic_string<_CharT> res;
std::basic_string res;
std::size_t size = 0;
std::size_t size = 0;
std::tuple<int, Str, float> t1(1, WIDEN("test"), 2.1);
std::tuple<int, Str, float> t1(1, WIDEN("test"), 2.1);
@@ -122,10 +122,10 @@ void test_multi()
}
}
template<typename _CharT, typename Tuple>
template<typename CharT, typename Tuple>
void test_empty()
void test_empty()
{
{
std::basic_string<_CharT> res;
std::basic_string res;
Tuple e1;
Tuple e1;
res = std::format(WIDEN("{}"), e1);
res = std::format(WIDEN("{}"), e1);
@@ -141,13 +141,13 @@ void test_empty()
VERIFY( res == WIDEN(R"(^^^^())") );
VERIFY( res == WIDEN(R"(^^^^())") );
}
}
template<typename _CharT, typename Pair>
template<typename CharT, typename Pair>
void test_pair()
void test_pair()
{
{
using Ft = std::remove_cvref_t<std::tuple_element_t<0, Pair>>;
using Ft = std::remove_cvref_t<std::tuple_element_t<0, Pair>>;
using St = std::remove_cvref_t<std::tuple_element_t<1, Pair>>;
using St = std::remove_cvref_t<std::tuple_element_t<1, Pair>>;
std::basic_string<_CharT> res;
std::basic_string res;
Ft f1 = 1;
Ft f1 = 1;
St s1 = WIDEN("abc");
St s1 = WIDEN("abc");
@@ -187,7 +187,6 @@ struct std::formatter<MyPair, CharT>
{
{
constexpr formatter() noexcept
constexpr formatter() noexcept
{
{
using _CharT = CharT;
_formatter.set_brackets(WIDEN("<"), WIDEN(">"));
_formatter.set_brackets(WIDEN("<"), WIDEN(">"));
_formatter.set_separator(WIDEN("; "));
_formatter.set_separator(WIDEN("; "));
}
}
@@ -206,11 +205,11 @@ private:
std::formatter<Pair, CharT> _formatter;
std::formatter<Pair, CharT> _formatter;
};
};
template<typename _CharT, template<typename, typename> class PairT>
template<typename CharT, template<typename, typename> class PairT>
void test_custom()
void test_custom()
{
{
std::basic_string<_CharT> res;
std::basic_string res;
MyPair<PairT<int, const _CharT*>> c1(1, WIDEN("abc"));
MyPair<PairT<int, const CharT*>> c1(1, WIDEN("abc"));
res = std::format(WIDEN("{}"), c1);
res = std::format(WIDEN("{}"), c1);
VERIFY( res == WIDEN(R"(<1; "abc">)") );
VERIFY( res == WIDEN(R"(<1; "abc">)") );
@@ -10,7 +10,7 @@
using namespace std::chrono;
using namespace std::chrono;
#define WIDEN_(C, S) ::std::__format::_Widen(S, L##S)
#define WIDEN_(C, S) ::std::__format::_Widen(S, L##S)
#define WIDEN(S) WIDEN_(_CharT, S)
#define WIDEN(S) WIDEN_(CharT, S)
template<typename CharT, typename T>
template<typename CharT, typename T>
void
void
@@ -34,15 +34,15 @@ test_no_empty_spec()
}
}
}
}
template<typename T, typename _CharT>
template<typename T, typename CharT>
void verify(const T& t, std::basic_string_view<_CharT> str)
void verify(const T& t, std::basic_string_view str)
{
{
std::basic_string<_CharT> res;
std::basic_string res;
res = std::format(WIDEN("{}"), t);
res = std::format(WIDEN("{}"), t);
VERIFY( res == str );
VERIFY( res == str );
std::basic_stringstream<_CharT> os;
std::basic_stringstream os;
os << t;
os << t;
res = std::move(os).str();
res = std::move(os).str();
VERIFY( res == str );
VERIFY( res == str );
@@ -52,11 +52,11 @@ template<typename T, typename CharT>
void verify(const T& t, const CharT* str)
void verify(const T& t, const CharT* str)
{ verify(t, std::basic_string_view(str)); }
{ verify(t, std::basic_string_view(str)); }
template<typename _CharT>
template
void
void
test_padding()
test_padding()
{
{
std::basic_string<_CharT> res;
std::basic_string res;
res = std::format(WIDEN("{:5}"), day(2));
res = std::format(WIDEN("{:5}"), day(2));
VERIFY( res == WIDEN("02 ") );
VERIFY( res == WIDEN("02 ") );
@@ -114,9 +114,9 @@ struct Rep
friend auto operator<=>(Rep, Rep) = default;
friend auto operator<=>(Rep, Rep) = default;
template<typename _CharT>
template
friend std::basic_ostream<_CharT>&
friend std::basic_ostream&
operator<<(std::basic_ostream<_CharT>& os, const Rep& t)
operator<<(std::basic_ostream& os, const Rep& t)
{ return os << t.val << WIDEN("[via <<]"); }
{ return os << t.val << WIDEN("[via <<]"); }
long val;
long val;
@@ -140,27 +140,27 @@ struct std::numeric_limits<Rep>
: std::numeric_limits
: std::numeric_limits
{ };
{ };
template<typename Ret, typename _CharT>
template<typename Ret, typename CharT>
struct std::formatter<Rep, _CharT>
struct std::formatter<Rep, CharT>
: std::formatter<long, _CharT>
: std::formatter<long, CharT>
{
{
template
template
typename std::basic_format_context<Out, _CharT>::iterator
typename std::basic_format_context<Out, CharT>::iterator
format(const Rep& t, std::basic_format_context<Out, _CharT>& ctx) const
format(const Rep& t, std::basic_format_context<Out, CharT>& ctx) const
{
{
constexpr std::basic_string_view<_CharT> suffix = WIDEN("[via format]");
constexpr std::basic_string_view suffix = WIDEN("[via format]");
auto out = std::formatter<long, _CharT>::format(t.val, ctx);
auto out = std::formatter<long, CharT>::format(t.val, ctx);
return std::ranges::copy(suffix, out).out;
return std::ranges::copy(suffix, out).out;
}
}
};
};
using deciseconds = duration<seconds::rep, std::deci>;
using deciseconds = duration<seconds::rep, std::deci>;
template<typename _CharT>
template
void
void
test_duration()
test_duration()
{
{
std::basic_string<_CharT> res;
std::basic_string res;
const milliseconds di(40);
const milliseconds di(40);
verify( di, WIDEN("40ms") );
verify( di, WIDEN("40ms") );
@@ -172,11 +172,11 @@ test_duration()
VERIFY( res == WIDEN(" -40ms") );
VERIFY( res == WIDEN(" -40ms") );
}
}
template<typename _CharT>
template
void
void
test_duration_fp()
test_duration_fp()
{
{
std::basic_string<_CharT> res;
std::basic_string res;
const duration df(11.22);
const duration df(11.22);
verify( df, WIDEN("11.22s") );
verify( df, WIDEN("11.22s") );
@@ -192,11 +192,11 @@ test_duration_fp()
VERIFY( res == WIDEN("11.22s") );
VERIFY( res == WIDEN("11.22s") );
}
}
template<typename _CharT>
template
void
void
test_duration_cust()
test_duration_cust()
{
{
std::basic_string<_CharT> res;
std::basic_string res;
const duration<char, std::ratio<1, 10>> charRep(123);
const duration<char, std::ratio<1, 10>> charRep(123);
verify( charRep, WIDEN("123ds") );
verify( charRep, WIDEN("123ds") );
@@ -253,7 +253,7 @@ hms(const duration<Rep, Period>& d)
return hh_mm_ss(duration_cast(d));
return hh_mm_ss(duration_cast(d));
}
}
template<typename _CharT>
template
void
void
test_hh_mm_ss()
test_hh_mm_ss()
{
{
@@ -303,7 +303,7 @@ test_hh_mm_ss()
WIDEN("-14322:24:54.111222333") );
WIDEN("-14322:24:54.111222333") );
}
}
template<typename _CharT>
template
void
void
test_hh_mm_ss_fp()
test_hh_mm_ss_fp()
{
{
@@ -341,7 +341,7 @@ test_hh_mm_ss_fp()
WIDEN("-22:24:54") );
WIDEN("-22:24:54") );
}
}
template<typename _CharT>
template
void
void
test_hh_mm_ss_cust()
test_hh_mm_ss_cust()
{
{
@@ -396,7 +396,7 @@ test_durations()
test_hh_mm_ss_cust();
test_hh_mm_ss_cust();
}
}
template<typename _CharT>
template
void
void
test_day()
test_day()
{
{
@@ -408,7 +408,7 @@ test_day()
verify( day(255), WIDEN("255 is not a valid day") );
verify( day(255), WIDEN("255 is not a valid day") );
}
}
template<typename _CharT>
template
void
void
test_month()
test_month()
{
{
@@ -422,7 +422,7 @@ test_month()
verify( month(255), WIDEN("255 is not a valid month") );
verify( month(255), WIDEN("255 is not a valid month") );
}
}
template<typename _CharT>
template
void
void
test_year()
test_year()
{
{
@@ -437,7 +437,7 @@ test_year()
verify( year(32767), WIDEN( "32767") );
verify( year(32767), WIDEN( "32767") );
}
}
template<typename _CharT>
template
void
void
test_weekday()
test_weekday()
{
{
@@ -451,7 +451,7 @@ test_weekday()
verify( weekday(255), WIDEN("255 is not a valid weekday") );
verify( weekday(255), WIDEN("255 is not a valid weekday") );
}
}
template<typename _CharT>
template
void
void
test_weekday_indexed()
test_weekday_indexed()
{
{
@@ -466,7 +466,7 @@ test_weekday_indexed()
verify( weekday(32)[7], WIDEN("32 is not a valid weekday[7 is not a valid index]") );
verify( weekday(32)[7], WIDEN("32 is not a valid weekday[7 is not a valid index]") );
}
}
template<typename _CharT>
template
void
void
test_weekday_last()
test_weekday_last()
{
{
@@ -474,7 +474,7 @@ test_weekday_last()
verify( weekday(9)[last], WIDEN("9 is not a valid weekday[last]") );
verify( weekday(9)[last], WIDEN("9 is not a valid weekday[last]") );
}
}
template<typename _CharT>
template
void
void
test_month_day()
test_month_day()
{
{
@@ -484,7 +484,7 @@ test_month_day()
verify( month(13)/32, WIDEN("13 is not a valid month/32 is not a valid day") );
verify( month(13)/32, WIDEN("13 is not a valid month/32 is not a valid day") );
}
}
template<typename _CharT>
template
void
void
test_month_day_last()
test_month_day_last()
{
{
@@ -492,7 +492,7 @@ test_month_day_last()
verify( month(14)/last, WIDEN("14 is not a valid month/last") );
verify( month(14)/last, WIDEN("14 is not a valid month/last") );
}
}
template<typename _CharT>
template
void
void
test_month_weekday()
test_month_weekday()
{
{
@@ -508,7 +508,7 @@ test_month_weekday()
WIDEN("13 is not a valid month/130 is not a valid weekday[0 is not a valid index]") );
WIDEN("13 is not a valid month/130 is not a valid weekday[0 is not a valid index]") );
}
}
template<typename _CharT>
template
void
void
test_month_weekday_last()
test_month_weekday_last()
{
{
@@ -522,7 +522,7 @@ test_month_weekday_last()
WIDEN("13 is not a valid month/10 is not a valid weekday[last]") );
WIDEN("13 is not a valid month/10 is not a valid weekday[last]") );
}
}
template<typename _CharT>
template
void
void
test_year_month()
test_year_month()
{
{
@@ -536,7 +536,7 @@ test_year_month()
WIDEN("-32768 is not a valid year/0 is not a valid month") );
WIDEN("-32768 is not a valid year/0 is not a valid month") );
}
}
template<typename _CharT>
template
void
void
test_year_month_day()
test_year_month_day()
{
{
@@ -556,7 +556,7 @@ test_year_month_day()
WIDEN("-32768-14-55 is not a valid date") );
WIDEN("-32768-14-55 is not a valid date") );
}
}
template<typename _CharT>
template
void
void
test_year_month_last()
test_year_month_last()
{
{
@@ -570,7 +570,7 @@ test_year_month_last()
WIDEN("-32768 is not a valid year/0 is not a valid month/last") );
WIDEN("-32768 is not a valid year/0 is not a valid month/last") );
}
}
template<typename _CharT>
template
void
void
test_year_month_weekday()
test_year_month_weekday()
{
{
@@ -586,7 +586,7 @@ test_year_month_weekday()
WIDEN("-32768 is not a valid year/13 is not a valid month/130 is not a valid weekday[0 is not a valid index]") );
WIDEN("-32768 is not a valid year/13 is not a valid month/130 is not a valid weekday[0 is not a valid index]") );
}
}
template<typename _CharT>
template
void
void
test_year_month_weekday_last()
test_year_month_weekday_last()
{
{
@@ -644,14 +644,14 @@ wall_cast(const local_time& tp)
using decadays = duration<days::rep, std::ratio_multiply<std::deca, days::period>>;
using decadays = duration<days::rep, std::ratio_multiply<std::deca, days::period>>;
using kilodays = duration<days::rep, std::ratio_multiply<std::kilo, days::period>>;
using kilodays = duration<days::rep, std::ratio_multiply<std::kilo, days::period>>;
template<typename _CharT, typename Clock>
template<typename CharT, typename Clock>
void
void
test_time_point(bool daysAsTime)
test_time_point(bool daysAsTime)
{
{
std::basic_string<_CharT> res;
std::basic_string res;
const auto lt = local_days(2024y/March/22) + 13h + 24min + 54s + 111222333ns;
const auto lt = local_days(2024y/March/22) + 13h + 24min + 54s + 111222333ns;
auto strip_time = [daysAsTime](std::basic_string_view<_CharT> sv)
auto strip_time = [daysAsTime](std::basic_string_view sv)
{ return daysAsTime ? sv : sv.substr(0, 10); };
{ return daysAsTime ? sv : sv.substr(0, 10); };
verify( wall_cast<Clock, nanoseconds>(lt),
verify( wall_cast<Clock, nanoseconds>(lt),
@@ -674,11 +674,11 @@ test_time_point(bool daysAsTime)
strip_time(WIDEN("2022-01-08 00:00:00")) );
strip_time(WIDEN("2022-01-08 00:00:00")) );
}
}
template<typename _CharT>
template
void
void
test_leap_second()
test_leap_second()
{
{
std::basic_string<_CharT> res;
std::basic_string res;
const auto st = sys_days(2012y/June/30) + 23h + 59min + 59s + 111222333ns;
const auto st = sys_days(2012y/June/30) + 23h + 59min + 59s + 111222333ns;
auto tp = clock_cast<utc_clock>(st);
auto tp = clock_cast<utc_clock>(st);
@@ -700,7 +700,7 @@ auto
make_zoned(const sys_time& st, const time_zone* tz)
make_zoned(const sys_time& st, const time_zone* tz)
{ return zoned_time(tz, floor(st)); }
{ return zoned_time(tz, floor(st)); }
template<typename _CharT>
template
void
void
test_zoned_time()
test_zoned_time()
{
{
@@ -734,11 +734,11 @@ auto
local_fmt(const local_time& lt, std::string* zone)
local_fmt(const local_time& lt, std::string* zone)
{ return local_time_format(floor(lt), zone); }
{ return local_time_format(floor(lt), zone); }
template<typename _CharT>
template
void
void
test_local_time_format()
test_local_time_format()
{
{
std::basic_string<_CharT> res;
std::basic_string res;
std::string abbrev = "Zone";
std::string abbrev = "Zone";
const auto lt = local_days(2024y/March/22) + 13h + 24min + 54s + 111222333ns;
const auto lt = local_days(2024y/March/22) + 13h + 24min + 54s + 111222333ns;
@@ -784,7 +784,7 @@ test_time_points()
}
}
#if _GLIBCXX_USE_CXX11_ABI || !_GLIBCXX_USE_DUAL_ABI
#if _GLIBCXX_USE_CXX11_ABI || !_GLIBCXX_USE_DUAL_ABI
template<typename _CharT>
template
void
void
test_sys_info()
test_sys_info()
{
{
@@ -796,13 +796,13 @@ test_sys_info()
15min,
15min,
"Zone"
"Zone"
};
};
const std::basic_string_view<_CharT> txt
const std::basic_string_view txt
= WIDEN("[2024-03-22 02:00:00,2025-04-11 23:15:10,02:13:04,15min,Zone]");
= WIDEN("[2024-03-22 02:00:00,2025-04-11 23:15:10,02:13:04,15min,Zone]");
verify( si, txt );
verify( si, txt );
std::basic_string<_CharT> res;
std::basic_string res;
std::basic_string_view<_CharT> sv;
std::basic_string_view sv;
sv = res = std::format(WIDEN("{:65}"), si);
sv = res = std::format(WIDEN("{:65}"), si);
VERIFY( sv.ends_with(WIDEN(" ")) );
VERIFY( sv.ends_with(WIDEN(" ")) );
@@ -817,11 +817,11 @@ test_sys_info()
VERIFY( sv == txt );
VERIFY( sv == txt );
}
}
template<typename _CharT>
template
void test_local_info()
void test_local_info()
{
{
using String = std::basic_string<_CharT>;
using String = std::basic_string;
using StringView = std::basic_string_view<_CharT>;
using StringView = std::basic_string_view;
const sys_info s1
const sys_info s1
{
{
@@ -7,13 +7,13 @@
#include <testsuite_hooks.h>
#include <testsuite_hooks.h>
#define WIDEN_(C, S) ::std::__format::_Widen(S, L##S)
#define WIDEN_(C, S) ::std::__format::_Widen(S, L##S)
#define WIDEN(S) WIDEN_(_CharT, S)
#define WIDEN(S) WIDEN_(CharT, S)
template<typename _CharT>
template
void
void
test_from_format_string()
test_from_format_string()
{
{
std::basic_string<_CharT> res;
std::basic_string res;
using namespace std::chrono_literals;
using namespace std::chrono_literals;
auto date = 2025y/std::chrono::May/05d;
auto date = 2025y/std::chrono::May/05d;
@@ -27,24 +27,24 @@ test_from_format_string()
VERIFY( res == WIDEN("====2025-05-05\U0001f921====") );
VERIFY( res == WIDEN("====2025-05-05\U0001f921====") );
}
}
template<typename _CharT>
template
void
void
test_formatted_value()
test_formatted_value()
{
{
// Custom time_put facet which returns Ideographic Telegraph Symbol
// Custom time_put facet which returns Ideographic Telegraph Symbol
// for given month for Om.
// for given month for Om.
struct TimePut : std::time_put<_CharT>
struct TimePut : std::time_put
{
{
using iter_type = std::time_put<_CharT>::iter_type;
using iter_type = std::time_put::iter_type;
using char_type = std::time_put<_CharT>::char_type;
using char_type = std::time_put::char_type;
iter_type
iter_type
do_put(iter_type out, std::ios_base& io, char_type fill, const tm* t,
do_put(iter_type out, std::ios_base& io, char_type fill, const tm* t,
char format, char modifier) const override
char format, char modifier) const override
{
{
if (format != 'm' && modifier != 'm')
if (format != 'm' && modifier != 'm')
return std::time_put<_CharT>::do_put(out, io, fill, t, format, modifier);
return std::time_put::do_put(out, io, fill, t, format, modifier);
std::basic_string_view<_CharT> str;
std::basic_string_view str;
switch (t->tm_mon)
switch (t->tm_mon)
{
{
case 0:
case 0:
@@ -89,7 +89,7 @@ test_formatted_value()
};
};
const std::locale loc(std::locale::classic(), new TimePut);
const std::locale loc(std::locale::classic(), new TimePut);
std::basic_string<_CharT> res;
std::basic_string res;
res = std::format(loc, WIDEN("{:<1L%Om}"), std::chrono::January);
res = std::format(loc, WIDEN("{:<1L%Om}"), std::chrono::January);
VERIFY( res == WIDEN("\u32C0") );
VERIFY( res == WIDEN("\u32C0") );
@@ -7,15 +7,15 @@
#include <testsuite_hooks.h>
#include <testsuite_hooks.h>
#define WIDEN_(C, S) ::std::__format::_Widen(S, L##S)
#define WIDEN_(C, S) ::std::__format::_Widen(S, L##S)
#define WIDEN(S) WIDEN_(_CharT, S)
#define WIDEN(S) WIDEN_(CharT, S)
using namespace std::chrono;
using namespace std::chrono;
template<typename _CharT>
template
void
void
test_year()
test_year()
{
{
std::basic_string<_CharT> res;
std::basic_string res;
res = std::format(WIDEN("{:%Y}"), year(0));
res = std::format(WIDEN("{:%Y}"), year(0));
VERIFY( res == WIDEN("0000") );
VERIFY( res == WIDEN("0000") );
@@ -77,11 +77,11 @@ test_year()
VERIFY( res == WIDEN("01") );
VERIFY( res == WIDEN("01") );
}
}
template<typename _CharT>
template
void
void
test_month()
test_month()
{
{
std::basic_string<_CharT> res;
std::basic_string res;
res = std::format(WIDEN("{:%m}"), month(5));
res = std::format(WIDEN("{:%m}"), month(5));
VERIFY( res == WIDEN("05") );
VERIFY( res == WIDEN("05") );
@@ -93,11 +93,11 @@ test_month()
VERIFY( res == WIDEN("254") );
VERIFY( res == WIDEN("254") );
}
}
template<typename _CharT>
template
void
void
test_day()
test_day()
{
{
std::basic_string<_CharT> res;
std::basic_string res;
res = std::format(WIDEN("{:%d}"), day(3));
res = std::format(WIDEN("{:%d}"), day(3));
VERIFY( res == WIDEN("03") );
VERIFY( res == WIDEN("03") );
@@ -118,11 +118,11 @@ test_day()
VERIFY( res == WIDEN("214") );
VERIFY( res == WIDEN("214") );
}
}
template<typename _CharT>
template
void
void
test_date()
test_date()
{
{
std::basic_string<_CharT> res;
std::basic_string res;
res = std::format(WIDEN("{:%F}"), year(-22)/month(10)/day(20));
res = std::format(WIDEN("{:%F}"), year(-22)/month(10)/day(20));
VERIFY( res == WIDEN("-0022-10-20") );
VERIFY( res == WIDEN("-0022-10-20") );
@@ -145,11 +145,11 @@ test_date()
VERIFY( res == WIDEN("220/100/00") );
VERIFY( res == WIDEN("220/100/00") );
}
}
template<typename _CharT>
template
void
void
test_weekday()
test_weekday()
{
{
std::basic_string<_CharT> res;
std::basic_string res;
res = std::format(WIDEN("{:%w}"), weekday(0));
res = std::format(WIDEN("{:%w}"), weekday(0));
VERIFY( res == WIDEN("0") );
VERIFY( res == WIDEN("0") );
@@ -187,11 +187,11 @@ test_weekday()
VERIFY( res == WIDEN("202") );
VERIFY( res == WIDEN("202") );
}
}
template<typename _CharT>
template
void
void
test_hour()
test_hour()
{
{
std::basic_string<_CharT> res;
std::basic_string res;
res = std::format(WIDEN("{:%H}"), 0h + 5min + 6s);
res = std::format(WIDEN("{:%H}"), 0h + 5min + 6s);
VERIFY( res == WIDEN("00") );
VERIFY( res == WIDEN("00") );
@@ -7,13 +7,13 @@
using namespace std::chrono;
using namespace std::chrono;
#define WIDEN_(C, S) ::std::__format::_Widen(S, L##S)
#define WIDEN_(C, S) ::std::__format::_Widen(S, L##S)
#define WIDEN(S) WIDEN_(_CharT, S)
#define WIDEN(S) WIDEN_(CharT, S)
template<typename _CharT>
template
void
void
test_empty()
test_empty()
{
{
std::basic_string<_CharT> res;
std::basic_string res;
const duration d(33.111222);
const duration d(33.111222);
res = std::format(WIDEN("{:.3}"), d);
res = std::format(WIDEN("{:.3}"), d);
@@ -33,11 +33,11 @@ test_empty()
VERIFY( res == WIDEN("3.31112e+10ns") );
VERIFY( res == WIDEN("3.31112e+10ns") );
}
}
template<typename _CharT>
template
void
void
test_Q()
test_Q()
{
{
std::basic_string<_CharT> res;
std::basic_string res;
const duration d(7.111222);
const duration d(7.111222);
res = std::format(WIDEN("{:.3%Q}"), d);
res = std::format(WIDEN("{:.3%Q}"), d);
@@ -56,11 +56,11 @@ test_Q()
VERIFY( res == WIDEN("7111222000") );
VERIFY( res == WIDEN("7111222000") );
}
}
template<typename _CharT>
template
void
void
test_S()
test_S()
{
{
std::basic_string<_CharT> res;
std::basic_string res;
// Precision is ignored, but period affects output
// Precision is ignored, but period affects output
const duration d(5.111222);
const duration d(5.111222);