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