Revert "[libc] Use best-fit binary trie to make malloc logarithmic" (#117065)
[llvm-project.git] / libcxx / test / std / time / time.syn / formatter.local_time.pass.cpp
blobf062e7ac681920afb9f2440a07980c8fa1aeb689
1 //===----------------------------------------------------------------------===//
2 //
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 //
7 //===----------------------------------------------------------------------===//
9 // UNSUPPORTED: c++03, c++11, c++14, c++17
10 // UNSUPPORTED: no-localization
11 // UNSUPPORTED: GCC-ALWAYS_INLINE-FIXME
13 // TODO FMT This test should not require std::to_chars(floating-point)
14 // XFAIL: availability-fp_to_chars-missing
16 // REQUIRES: locale.fr_FR.UTF-8
17 // REQUIRES: locale.ja_JP.UTF-8
19 // <chrono>
21 // template<class charT> struct formatter<chrono::day, charT>;
23 #include <chrono>
24 #include <format>
26 #include <cassert>
27 #include <concepts>
28 #include <locale>
29 #include <iostream>
30 #include <type_traits>
32 #include "formatter_tests.h"
33 #include "make_string.h"
34 #include "platform_support.h" // locale name macros
35 #include "test_macros.h"
37 template <class CharT>
38 static void test_no_chrono_specs() {
39 using namespace std::literals::chrono_literals;
41 std::locale::global(std::locale(LOCALE_fr_FR_UTF_8));
43 // Non localized output
45 // [time.syn]
46 // using nanoseconds = duration<signed integer type of at least 64 bits, nano>;
47 // using microseconds = duration<signed integer type of at least 55 bits, micro>;
48 // using milliseconds = duration<signed integer type of at least 45 bits, milli>;
49 // using seconds = duration<signed integer type of at least 35 bits>;
50 // using minutes = duration<signed integer type of at least 29 bits, ratio< 60>>;
51 // using hours = duration<signed integer type of at least 23 bits, ratio<3600>>;
52 check(
53 SV("1425-08-04 22:06:56"), SV("{}"), std::chrono::local_seconds(-17'179'869'184s)); // Minimum value for 35 bits.
54 check(SV("1901-12-13 20:45:52"), SV("{}"), std::chrono::local_seconds(-2'147'483'648s));
56 check(SV("1969-12-31 00:00:00"), SV("{}"), std::chrono::local_seconds(-24h));
57 check(SV("1969-12-31 06:00:00"), SV("{}"), std::chrono::local_seconds(-18h));
58 check(SV("1969-12-31 12:00:00"), SV("{}"), std::chrono::local_seconds(-12h));
59 check(SV("1969-12-31 18:00:00"), SV("{}"), std::chrono::local_seconds(-6h));
60 check(SV("1969-12-31 23:59:59"), SV("{}"), std::chrono::local_seconds(-1s));
62 check(SV("1970-01-01 00:00:00"), SV("{}"), std::chrono::local_seconds(0s));
63 check(SV("2000-01-01 00:00:00"), SV("{}"), std::chrono::local_seconds(946'684'800s));
64 check(SV("2000-01-01 01:02:03"), SV("{}"), std::chrono::local_seconds(946'688'523s));
66 check(SV("2038-01-19 03:14:07"), SV("{}"), std::chrono::local_seconds(2'147'483'647s));
67 check(SV("2514-05-30 01:53:03"), SV("{}"), std::chrono::local_seconds(17'179'869'183s)); // Maximum value for 35 bits.
69 check(SV("2000-01-01 01:02:03.123"), SV("{}"), std::chrono::local_time<std::chrono::milliseconds>(946'688'523'123ms));
71 std::locale::global(std::locale::classic());
74 template <class CharT>
75 static void test_valid_values_year() {
76 using namespace std::literals::chrono_literals;
78 constexpr std::basic_string_view<CharT> fmt =
79 SV("{:%%C='%C'%t%%EC='%EC'%t%%y='%y'%t%%Oy='%Oy'%t%%Ey='%Ey'%t%%Y='%Y'%t%%EY='%EY'%n}");
80 constexpr std::basic_string_view<CharT> lfmt =
81 SV("{:L%%C='%C'%t%%EC='%EC'%t%%y='%y'%t%%Oy='%Oy'%t%%Ey='%Ey'%t%%Y='%Y'%t%%EY='%EY'%n}");
83 const std::locale loc(LOCALE_ja_JP_UTF_8);
84 std::locale::global(std::locale(LOCALE_fr_FR_UTF_8));
86 // Non localized output using C-locale
87 check(SV("%C='19'\t%EC='19'\t%y='70'\t%Oy='70'\t%Ey='70'\t%Y='1970'\t%EY='1970'\n"),
88 fmt,
89 std::chrono::local_seconds(0s)); // 00:00:00 UTC Thursday, 1 January 1970
91 check(SV("%C='20'\t%EC='20'\t%y='09'\t%Oy='09'\t%Ey='09'\t%Y='2009'\t%EY='2009'\n"),
92 fmt,
93 std::chrono::local_seconds(1'234'567'890s)); // 23:31:30 UTC on Friday, 13 February 2009
95 // Use the global locale (fr_FR)
96 check(SV("%C='19'\t%EC='19'\t%y='70'\t%Oy='70'\t%Ey='70'\t%Y='1970'\t%EY='1970'\n"),
97 lfmt,
98 std::chrono::local_seconds(0s)); // 00:00:00 UTC Thursday, 1 January 1970
100 check(SV("%C='20'\t%EC='20'\t%y='09'\t%Oy='09'\t%Ey='09'\t%Y='2009'\t%EY='2009'\n"),
101 lfmt,
102 std::chrono::local_seconds(1'234'567'890s)); // 23:31:30 UTC on Friday, 13 February 2009
104 // Use supplied locale (ja_JP). This locale has a different alternate.
105 #if defined(_WIN32) || defined(__APPLE__) || defined(_AIX) || defined(__FreeBSD__)
106 check(loc,
107 SV("%C='19'\t%EC='19'\t%y='70'\t%Oy='70'\t%Ey='70'\t%Y='1970'\t%EY='1970'\n"),
108 lfmt,
109 std::chrono::local_seconds(0s)); // 00:00:00 UTC Thursday, 1 January 1970
111 check(loc,
112 SV("%C='20'\t%EC='20'\t%y='09'\t%Oy='09'\t%Ey='09'\t%Y='2009'\t%EY='2009'\n"),
113 lfmt,
114 std::chrono::local_seconds(1'234'567'890s)); // 23:31:30 UTC on Friday, 13 February 2009
115 #else // defined(_WIN32) || defined(__APPLE__) || defined(_AIX)||defined(__FreeBSD__)
116 check(loc,
117 SV("%C='19'\t%EC='昭和'\t%y='70'\t%Oy='七十'\t%Ey='45'\t%Y='1970'\t%EY='昭和45年'\n"),
118 lfmt,
119 std::chrono::local_seconds(0s)); // 00:00:00 UTC Thursday, 1 January 1970
121 check(loc,
122 SV("%C='20'\t%EC='平成'\t%y='09'\t%Oy='九'\t%Ey='21'\t%Y='2009'\t%EY='平成21年'\n"),
123 lfmt,
124 std::chrono::local_seconds(1'234'567'890s)); // 23:31:30 UTC on Friday, 13 February 2009
125 #endif // defined(_WIN32) || defined(__APPLE__) || defined(_AIX)||defined(__FreeBSD__)
127 std::locale::global(std::locale::classic());
130 template <class CharT>
131 static void test_valid_values_month() {
132 using namespace std::literals::chrono_literals;
134 constexpr std::basic_string_view<CharT> fmt = SV("{:%%b='%b'%t%%h='%h'%t%%B='%B'%t%%m='%m'%t%%Om='%Om'%n}");
135 constexpr std::basic_string_view<CharT> lfmt = SV("{:L%%b='%b'%t%%h='%h'%t%%B='%B'%t%%m='%m'%t%%Om='%Om'%n}");
137 const std::locale loc(LOCALE_ja_JP_UTF_8);
138 std::locale::global(std::locale(LOCALE_fr_FR_UTF_8));
140 // Non localized output using C-locale
141 check(SV("%b='Jan'\t%h='Jan'\t%B='January'\t%m='01'\t%Om='01'\n"),
142 fmt,
143 std::chrono::local_seconds(0s)); // 00:00:00 UTC Thursday, 1 January 1970
145 check(SV("%b='May'\t%h='May'\t%B='May'\t%m='05'\t%Om='05'\n"),
146 fmt,
147 std::chrono::local_seconds(2'000'000'000s)); // 03:33:20 UTC on Wednesday, 18 May 2033
149 // Use the global locale (fr_FR)
150 #if defined(__APPLE__)
151 check(SV("%b='jan'\t%h='jan'\t%B='janvier'\t%m='01'\t%Om='01'\n"),
152 lfmt,
153 std::chrono::local_seconds(0s)); // 00:00:00 UTC Thursday, 1 January 1970
154 #else
155 check(SV("%b='janv.'\t%h='janv.'\t%B='janvier'\t%m='01'\t%Om='01'\n"),
156 lfmt,
157 std::chrono::local_seconds(0s)); // 00:00:00 UTC Thursday, 1 January 1970
158 #endif
160 check(SV("%b='mai'\t%h='mai'\t%B='mai'\t%m='05'\t%Om='05'\n"),
161 lfmt,
162 std::chrono::local_seconds(2'000'000'000s)); // 03:33:20 UTC on Wednesday, 18 May 2033
164 // Use supplied locale (ja_JP). This locale has a different alternate.
165 #ifdef _WIN32
166 check(loc,
167 SV("%b='1'\t%h='1'\t%B='1月'\t%m='01'\t%Om='01'\n"),
168 lfmt,
169 std::chrono::local_seconds(0s)); // 00:00:00 UTC Thursday, 1 January 1970
171 check(loc,
172 SV("%b='5'\t%h='5'\t%B='5月'\t%m='05'\t%Om='05'\n"),
173 lfmt,
174 std::chrono::local_seconds(2'000'000'000s)); // 03:33:20 UTC on Wednesday, 18 May 2033
175 #elif defined(_AIX) // _WIN32
176 check(loc,
177 SV("%b='1月'\t%h='1月'\t%B='1月'\t%m='01'\t%Om='01'\n"),
178 lfmt,
179 std::chrono::local_seconds(0s)); // 00:00:00 UTC Thursday, 1 January 1970
181 check(loc,
182 SV("%b='5月'\t%h='5月'\t%B='5月'\t%m='05'\t%Om='05'\n"),
183 lfmt,
184 std::chrono::local_seconds(2'000'000'000s)); // 03:33:20 UTC on Wednesday, 18 May 2033
185 #elif defined(__APPLE__) // _WIN32
186 check(loc,
187 SV("%b=' 1'\t%h=' 1'\t%B='1月'\t%m='01'\t%Om='01'\n"),
188 lfmt,
189 std::chrono::local_seconds(0s)); // 00:00:00 UTC Thursday, 1 January 1970
191 check(loc,
192 SV("%b=' 5'\t%h=' 5'\t%B='5月'\t%m='05'\t%Om='05'\n"),
193 lfmt,
194 std::chrono::local_seconds(2'000'000'000s)); // 03:33:20 UTC on Wednesday, 18 May 2033
195 #elif defined(__FreeBSD__) // _WIN32
196 check(loc,
197 SV("%b=' 1月'\t%h=' 1月'\t%B='1月'\t%m='01'\t%Om='01'\n"),
198 lfmt,
199 std::chrono::local_seconds(0s)); // 00:00:00 UTC Thursday, 1 January 1970
201 check(loc,
202 SV("%b=' 5月'\t%h=' 5月'\t%B='5月'\t%m='05'\t%Om='05'\n"),
203 lfmt,
204 std::chrono::local_seconds(2'000'000'000s)); // 03:33:20 UTC on Wednesday, 18 May 2033
205 #else // _WIN32
206 check(loc,
207 SV("%b=' 1月'\t%h=' 1月'\t%B='1月'\t%m='01'\t%Om='一'\n"),
208 lfmt,
209 std::chrono::local_seconds(0s)); // 00:00:00 UTC Thursday, 1 January 1970
211 check(loc,
212 SV("%b=' 5月'\t%h=' 5月'\t%B='5月'\t%m='05'\t%Om='五'\n"),
213 lfmt,
214 std::chrono::local_seconds(2'000'000'000s)); // 03:33:20 UTC on Wednesday, 18 May 2033
215 #endif // _WIN32
217 std::locale::global(std::locale::classic());
220 template <class CharT>
221 static void test_valid_values_day() {
222 using namespace std::literals::chrono_literals;
224 constexpr std::basic_string_view<CharT> fmt = SV("{:%%d='%d'%t%%Od='%Od'%t%%e='%e'%t%%Oe='%Oe'%n}");
225 constexpr std::basic_string_view<CharT> lfmt = SV("{:L%%d='%d'%t%%Od='%Od'%t%%e='%e'%t%%Oe='%Oe'%n}");
227 const std::locale loc(LOCALE_ja_JP_UTF_8);
228 std::locale::global(std::locale(LOCALE_fr_FR_UTF_8));
230 // Non localized output using C-locale
231 check(SV("%d='01'\t%Od='01'\t%e=' 1'\t%Oe=' 1'\n"),
232 fmt,
233 std::chrono::local_seconds(0s)); // 00:00:00 UTC Thursday, 1 January 1970
235 check(SV("%d='13'\t%Od='13'\t%e='13'\t%Oe='13'\n"),
236 fmt,
237 std::chrono::local_seconds(1'234'567'890s)); // 23:31:30 UTC on Friday, 13 February 2009
239 // Use the global locale (fr_FR)
240 check(SV("%d='01'\t%Od='01'\t%e=' 1'\t%Oe=' 1'\n"),
241 lfmt,
242 std::chrono::local_seconds(0s)); // 00:00:00 UTC Thursday, 1 January 1970
244 check(SV("%d='13'\t%Od='13'\t%e='13'\t%Oe='13'\n"),
245 lfmt,
246 std::chrono::local_seconds(1'234'567'890s)); // 23:31:30 UTC on Friday, 13 February 2009
248 // Use supplied locale (ja_JP). This locale has a different alternate.
249 #if defined(_WIN32) || defined(__APPLE__) || defined(_AIX) || defined(__FreeBSD__)
250 check(loc,
251 SV("%d='01'\t%Od='01'\t%e=' 1'\t%Oe=' 1'\n"),
252 lfmt,
253 std::chrono::local_seconds(0s)); // 00:00:00 UTC Thursday, 1 January 1970
255 check(loc,
256 SV("%d='13'\t%Od='13'\t%e='13'\t%Oe='13'\n"),
257 lfmt,
258 std::chrono::local_seconds(1'234'567'890s)); // 23:31:30 UTC on Friday, 13 February 2009
259 #else // defined(_WIN32) || defined(__APPLE__) || defined(_AIX) || defined(__FreeBSD__)
260 check(loc,
261 SV("%d='01'\t%Od='一'\t%e=' 1'\t%Oe='一'\n"),
262 lfmt,
263 std::chrono::local_seconds(0s)); // 00:00:00 UTC Thursday, 1 January 1970
265 check(loc,
266 SV("%d='13'\t%Od='十三'\t%e='13'\t%Oe='十三'\n"),
267 lfmt,
268 std::chrono::local_seconds(1'234'567'890s)); // 23:31:30 UTC on Friday, 13 February 2009
270 #endif // defined(_WIN32) || defined(__APPLE__) || defined(_AIX) || defined(__FreeBSD__)
272 std::locale::global(std::locale::classic());
275 template <class CharT>
276 static void test_valid_values_weekday() {
277 using namespace std::literals::chrono_literals;
279 constexpr std::basic_string_view<CharT> fmt =
280 SV("{:%%a='%a'%t%%A='%A'%t%%u='%u'%t%%Ou='%Ou'%t%%w='%w'%t%%Ow='%Ow'%n}");
281 constexpr std::basic_string_view<CharT> lfmt =
282 SV("{:L%%a='%a'%t%%A='%A'%t%%u='%u'%t%%Ou='%Ou'%t%%w='%w'%t%%Ow='%Ow'%n}");
284 const std::locale loc(LOCALE_ja_JP_UTF_8);
285 std::locale::global(std::locale(LOCALE_fr_FR_UTF_8));
287 // Non localized output using C-locale
288 check(SV("%a='Thu'\t%A='Thursday'\t%u='4'\t%Ou='4'\t%w='4'\t%Ow='4'\n"),
289 fmt,
290 std::chrono::local_seconds(0s)); // 00:00:00 UTC Thursday, 1 January 1970
292 check(SV("%a='Sun'\t%A='Sunday'\t%u='7'\t%Ou='7'\t%w='0'\t%Ow='0'\n"),
293 fmt,
294 std::chrono::local_seconds(4'294'967'295s)); // 06:28:15 UTC on Sunday, 7 February 2106
296 // Use the global locale (fr_FR)
297 #if defined(__APPLE__)
298 check(SV("%a='Jeu'\t%A='Jeudi'\t%u='4'\t%Ou='4'\t%w='4'\t%Ow='4'\n"),
299 lfmt,
300 std::chrono::local_seconds(0s)); // 00:00:00 UTC Thursday, 1 January 1970
302 check(SV("%a='Dim'\t%A='Dimanche'\t%u='7'\t%Ou='7'\t%w='0'\t%Ow='0'\n"),
303 lfmt,
304 std::chrono::local_seconds(4'294'967'295s)); // 06:28:15 UTC on Sunday, 7 February 2106
305 #else
306 check(SV("%a='jeu.'\t%A='jeudi'\t%u='4'\t%Ou='4'\t%w='4'\t%Ow='4'\n"),
307 lfmt,
308 std::chrono::local_seconds(0s)); // 00:00:00 UTC Thursday, 1 January 1970
310 check(SV("%a='dim.'\t%A='dimanche'\t%u='7'\t%Ou='7'\t%w='0'\t%Ow='0'\n"),
311 lfmt,
312 std::chrono::local_seconds(4'294'967'295s)); // 06:28:15 UTC on Sunday, 7 February 2106
313 #endif
315 // Use supplied locale (ja_JP).
316 // This locale has a different alternate, but not on all platforms
317 #if defined(_WIN32) || defined(__APPLE__) || defined(_AIX) || defined(__FreeBSD__)
318 check(loc,
319 SV("%a='木'\t%A='木曜日'\t%u='4'\t%Ou='4'\t%w='4'\t%Ow='4'\n"),
320 lfmt,
321 std::chrono::local_seconds(0s)); // 00:00:00 UTC Thursday, 1 January 1970
323 check(loc,
324 SV("%a='日'\t%A='日曜日'\t%u='7'\t%Ou='7'\t%w='0'\t%Ow='0'\n"),
325 lfmt,
326 std::chrono::local_seconds(4'294'967'295s)); // 06:28:15 UTC on Sunday, 7 February 2106
327 #else // defined(_WIN32) || defined(__APPLE__) || defined(_AIX) || defined(__FreeBSD__)
328 check(loc,
329 SV("%a='木'\t%A='木曜日'\t%u='4'\t%Ou='四'\t%w='4'\t%Ow='四'\n"),
330 lfmt,
331 std::chrono::local_seconds(0s)); // 00:00:00 UTC Thursday, 1 January 1970
333 check(loc,
334 SV("%a='日'\t%A='日曜日'\t%u='7'\t%Ou='七'\t%w='0'\t%Ow='〇'\n"),
335 lfmt,
336 std::chrono::local_seconds(4'294'967'295s)); // 06:28:15 UTC on Sunday, 7 February 2106
337 #endif // defined(_WIN32) || defined(__APPLE__) || defined(_AIX) || defined(__FreeBSD__)
339 std::locale::global(std::locale::classic());
342 template <class CharT>
343 static void test_valid_values_day_of_year() {
344 using namespace std::literals::chrono_literals;
346 constexpr std::basic_string_view<CharT> fmt = SV("{:%%j='%j'%n}");
347 constexpr std::basic_string_view<CharT> lfmt = SV("{:L%%j='%j'%n}");
349 const std::locale loc(LOCALE_ja_JP_UTF_8);
350 std::locale::global(std::locale(LOCALE_fr_FR_UTF_8));
352 // Non localized output using C-locale
353 check(SV("%j='001'\n"), fmt, std::chrono::local_seconds(0s)); // 00:00:00 UTC Thursday, 1 January 1970
354 check(SV("%j='138'\n"), fmt, std::chrono::local_seconds(2'000'000'000s)); // 03:33:20 UTC on Wednesday, 18 May 2033
356 // Use the global locale (fr_FR)
357 check(SV("%j='001'\n"), lfmt, std::chrono::local_seconds(0s)); // 00:00:00 UTC Thursday, 1 January 1970
358 check(SV("%j='138'\n"), lfmt, std::chrono::local_seconds(2'000'000'000s)); // 03:33:20 UTC on Wednesday, 18 May 2033
360 // Use supplied locale (ja_JP). This locale has a different alternate.
361 check(loc, SV("%j='001'\n"), lfmt, std::chrono::local_seconds(0s)); // 00:00:00 UTC Thursday, 1 January 1970
363 check(loc,
364 SV("%j='138'\n"),
365 lfmt,
366 std::chrono::local_seconds(2'000'000'000s)); // 03:33:20 UTC on Wednesday, 18 May 2033
368 std::locale::global(std::locale::classic());
371 template <class CharT>
372 static void test_valid_values_week() {
373 using namespace std::literals::chrono_literals;
375 constexpr std::basic_string_view<CharT> fmt = SV("{:%%U='%U'%t%%OU='%OU'%t%%W='%W'%t%%OW='%OW'%n}");
376 constexpr std::basic_string_view<CharT> lfmt = SV("{:L%%U='%U'%t%%OU='%OU'%t%%W='%W'%t%%OW='%OW'%n}");
378 const std::locale loc(LOCALE_ja_JP_UTF_8);
379 std::locale::global(std::locale(LOCALE_fr_FR_UTF_8));
381 // Non localized output using C-locale
382 check(SV("%U='00'\t%OU='00'\t%W='00'\t%OW='00'\n"),
383 fmt,
384 std::chrono::local_seconds(0s)); // 00:00:00 UTC Thursday, 1 January 1970
386 check(SV("%U='20'\t%OU='20'\t%W='20'\t%OW='20'\n"),
387 fmt,
388 std::chrono::local_seconds(2'000'000'000s)); // 03:33:20 UTC on Wednesday, 18 May 2033
390 // Use the global locale (fr_FR)
391 check(SV("%U='00'\t%OU='00'\t%W='00'\t%OW='00'\n"),
392 lfmt,
393 std::chrono::local_seconds(0s)); // 00:00:00 UTC Thursday, 1 January 1970
395 check(SV("%U='20'\t%OU='20'\t%W='20'\t%OW='20'\n"),
396 lfmt,
397 std::chrono::local_seconds(2'000'000'000s)); // 03:33:20 UTC on Wednesday, 18 May 2033
399 // Use supplied locale (ja_JP). This locale has a different alternate.
400 #if defined(_WIN32) || defined(__APPLE__) || defined(_AIX) || defined(__FreeBSD__)
401 check(loc,
402 SV("%U='00'\t%OU='00'\t%W='00'\t%OW='00'\n"),
403 lfmt,
404 std::chrono::local_seconds(0s)); // 00:00:00 UTC Thursday, 1 January 1970
406 check(loc,
407 SV("%U='20'\t%OU='20'\t%W='20'\t%OW='20'\n"),
408 lfmt,
409 std::chrono::local_seconds(2'000'000'000s)); // 03:33:20 UTC on Wednesday, 18 May 2033
410 #else // defined(_WIN32) || defined(__APPLE__) || defined(_AIX) || defined(__FreeBSD__)
411 check(loc,
412 SV("%U='00'\t%OU='〇'\t%W='00'\t%OW='〇'\n"),
413 lfmt,
414 std::chrono::local_seconds(0s)); // 00:00:00 UTC Thursday, 1 January 1970
416 check(loc,
417 SV("%U='20'\t%OU='二十'\t%W='20'\t%OW='二十'\n"),
418 lfmt,
419 std::chrono::local_seconds(2'000'000'000s)); // 03:33:20 UTC on Wednesday, 18 May 2033
420 #endif // defined(_WIN32) || defined(__APPLE__) || defined(_AIX) || defined(__FreeBSD__)
421 std::locale::global(std::locale::classic());
424 template <class CharT>
425 static void test_valid_values_iso_8601_week() {
426 using namespace std::literals::chrono_literals;
428 constexpr std::basic_string_view<CharT> fmt = SV("{:%%g='%g'%t%%G='%G'%t%%V='%V'%t%%OV='%OV'%n}");
429 constexpr std::basic_string_view<CharT> lfmt = SV("{:L%%g='%g'%t%%G='%G'%t%%V='%V'%t%%OV='%OV'%n}");
431 const std::locale loc(LOCALE_ja_JP_UTF_8);
432 std::locale::global(std::locale(LOCALE_fr_FR_UTF_8));
434 // Non localized output using C-locale
435 check(SV("%g='70'\t%G='1970'\t%V='01'\t%OV='01'\n"),
436 fmt,
437 std::chrono::local_seconds(0s)); // 00:00:00 UTC Thursday, 1 January 1970
439 check(SV("%g='09'\t%G='2009'\t%V='07'\t%OV='07'\n"),
440 fmt,
441 std::chrono::local_seconds(1'234'567'890s)); // 23:31:30 UTC on Friday, 13 February 2009
443 // Use the global locale (fr_FR)
444 check(SV("%g='70'\t%G='1970'\t%V='01'\t%OV='01'\n"),
445 lfmt,
446 std::chrono::local_seconds(0s)); // 00:00:00 UTC Thursday, 1 January 1970
448 check(SV("%g='09'\t%G='2009'\t%V='07'\t%OV='07'\n"),
449 lfmt,
450 std::chrono::local_seconds(1'234'567'890s)); // 23:31:30 UTC on Friday, 13 February 2009
452 // Use supplied locale (ja_JP). This locale has a different alternate.
453 #if defined(_WIN32) || defined(__APPLE__) || defined(_AIX) || defined(__FreeBSD__)
454 check(loc,
455 SV("%g='70'\t%G='1970'\t%V='01'\t%OV='01'\n"),
456 lfmt,
457 std::chrono::local_seconds(0s)); // 00:00:00 UTC Thursday, 1 January 1970
459 check(loc,
460 SV("%g='09'\t%G='2009'\t%V='07'\t%OV='07'\n"),
461 lfmt,
462 std::chrono::local_seconds(1'234'567'890s)); // 23:31:30 UTC on Friday, 13 February 2009
463 #else // defined(_WIN32) || defined(__APPLE__) || defined(_AIX) || defined(__FreeBSD__)
464 check(loc,
465 SV("%g='70'\t%G='1970'\t%V='01'\t%OV='一'\n"),
466 lfmt,
467 std::chrono::local_seconds(0s)); // 00:00:00 UTC Thursday, 1 January 1970
469 check(loc,
470 SV("%g='09'\t%G='2009'\t%V='07'\t%OV='七'\n"),
471 lfmt,
472 std::chrono::local_seconds(1'234'567'890s)); // 23:31:30 UTC on Friday, 13 February 2009
473 #endif // defined(_WIN32) || defined(__APPLE__) || defined(_AIX) || defined(__FreeBSD__)
475 std::locale::global(std::locale::classic());
478 template <class CharT>
479 static void test_valid_values_date() {
480 using namespace std::literals::chrono_literals;
482 constexpr std::basic_string_view<CharT> fmt = SV("{:%%D='%D'%t%%F='%F'%t%%x='%x'%t%%Ex='%Ex'%n}");
483 constexpr std::basic_string_view<CharT> lfmt = SV("{:L%%D='%D'%t%%F='%F'%t%%x='%x'%t%%Ex='%Ex'%n}");
485 const std::locale loc(LOCALE_ja_JP_UTF_8);
486 std::locale::global(std::locale(LOCALE_fr_FR_UTF_8));
488 // Non localized output using C-locale
489 check(SV("%D='01/01/70'\t%F='1970-01-01'\t%x='01/01/70'\t%Ex='01/01/70'\n"),
490 fmt,
491 std::chrono::local_seconds(0s)); // 00:00:00 UTC Thursday, 1 January 1970
493 check(SV("%D='02/13/09'\t%F='2009-02-13'\t%x='02/13/09'\t%Ex='02/13/09'\n"),
494 fmt,
495 std::chrono::local_seconds(1'234'567'890s)); // 23:31:30 UTC on Friday, 13 February 2009
497 // Use the global locale (fr_FR)
498 #if defined(__APPLE__) || defined(__FreeBSD__)
499 check(SV("%D='01/01/70'\t%F='1970-01-01'\t%x='01.01.1970'\t%Ex='01.01.1970'\n"),
500 lfmt,
501 std::chrono::local_seconds(0s)); // 00:00:00 UTC Thursday, 1 January 1970
503 check(SV("%D='02/13/09'\t%F='2009-02-13'\t%x='13.02.2009'\t%Ex='13.02.2009'\n"),
504 lfmt,
505 std::chrono::local_seconds(1'234'567'890s)); // 23:31:30 UTC on Friday, 13 February 2009
506 #else
507 check(SV("%D='01/01/70'\t%F='1970-01-01'\t%x='01/01/1970'\t%Ex='01/01/1970'\n"),
508 lfmt,
509 std::chrono::local_seconds(0s)); // 00:00:00 UTC Thursday, 1 January 1970
511 check(SV("%D='02/13/09'\t%F='2009-02-13'\t%x='13/02/2009'\t%Ex='13/02/2009'\n"),
512 lfmt,
513 std::chrono::local_seconds(1'234'567'890s)); // 23:31:30 UTC on Friday, 13 February 2009
514 #endif
516 // Use supplied locale (ja_JP). This locale has a different alternate.
517 #if defined(_WIN32) || defined(__APPLE__) || defined(_AIX) || defined(__FreeBSD__)
518 check(loc,
519 SV("%D='01/01/70'\t%F='1970-01-01'\t%x='1970/01/01'\t%Ex='1970/01/01'\n"),
520 lfmt,
521 std::chrono::local_seconds(0s)); // 00:00:00 UTC Thursday, 1 January 1970
523 check(loc,
524 SV("%D='02/13/09'\t%F='2009-02-13'\t%x='2009/02/13'\t%Ex='2009/02/13'\n"),
525 lfmt,
526 std::chrono::local_seconds(1'234'567'890s)); // 23:31:30 UTC on Friday, 13 February 2009
527 #else // defined(_WIN32) || defined(__APPLE__) || defined(_AIX) || defined(__FreeBSD__)
528 check(loc,
529 SV("%D='01/01/70'\t%F='1970-01-01'\t%x='1970年01月01日'\t%Ex='昭和45年01月01日'\n"),
530 lfmt,
531 std::chrono::local_seconds(0s)); // 00:00:00 UTC Thursday, 1 January 1970
533 check(loc,
534 SV("%D='02/13/09'\t%F='2009-02-13'\t%x='2009年02月13日'\t%Ex='平成21年02月13日'\n"),
535 lfmt,
536 std::chrono::local_seconds(1'234'567'890s)); // 23:31:30 UTC on Friday, 13 February 2009
537 #endif // defined(_WIN32) || defined(__APPLE__) || defined(_AIX) || defined(__FreeBSD__)
539 std::locale::global(std::locale::classic());
542 template <class CharT>
543 static void test_valid_values_time() {
544 using namespace std::literals::chrono_literals;
546 constexpr std::basic_string_view<CharT> fmt = SV(
547 "{:"
548 "%%H='%H'%t"
549 "%%OH='%OH'%t"
550 "%%I='%I'%t"
551 "%%OI='%OI'%t"
552 "%%M='%M'%t"
553 "%%OM='%OM'%t"
554 "%%S='%S'%t"
555 "%%OS='%OS'%t"
556 "%%p='%p'%t"
557 "%%R='%R'%t"
558 "%%T='%T'%t"
559 "%%r='%r'%t"
560 "%%X='%X'%t"
561 "%%EX='%EX'%t"
562 "%n}");
563 constexpr std::basic_string_view<CharT> lfmt = SV(
564 "{:L"
565 "%%H='%H'%t"
566 "%%OH='%OH'%t"
567 "%%I='%I'%t"
568 "%%OI='%OI'%t"
569 "%%M='%M'%t"
570 "%%OM='%OM'%t"
571 "%%S='%S'%t"
572 "%%OS='%OS'%t"
573 "%%p='%p'%t"
574 "%%R='%R'%t"
575 "%%T='%T'%t"
576 "%%r='%r'%t"
577 "%%X='%X'%t"
578 "%%EX='%EX'%t"
579 "%n}");
581 const std::locale loc(LOCALE_ja_JP_UTF_8);
582 std::locale::global(std::locale(LOCALE_fr_FR_UTF_8));
584 // Non localized output using C-locale
585 check(SV("%H='00'\t"
586 "%OH='00'\t"
587 "%I='12'\t"
588 "%OI='12'\t"
589 "%M='00'\t"
590 "%OM='00'\t"
591 "%S='00'\t"
592 "%OS='00'\t"
593 "%p='AM'\t"
594 "%R='00:00'\t"
595 "%T='00:00:00'\t"
596 "%r='12:00:00 AM'\t"
597 "%X='00:00:00'\t"
598 "%EX='00:00:00'\t"
599 "\n"),
600 fmt,
601 std::chrono::local_seconds(0s)); // 00:00:00 UTC Thursday, 1 January 1970
603 check(SV("%H='23'\t"
604 "%OH='23'\t"
605 "%I='11'\t"
606 "%OI='11'\t"
607 "%M='31'\t"
608 "%OM='31'\t"
609 "%S='30.123'\t"
610 "%OS='30.123'\t"
611 "%p='PM'\t"
612 "%R='23:31'\t"
613 "%T='23:31:30.123'\t"
614 "%r='11:31:30 PM'\t"
615 "%X='23:31:30'\t"
616 "%EX='23:31:30'\t"
617 "\n"),
618 fmt,
619 std::chrono::local_time<std::chrono::milliseconds>(
620 1'234'567'890'123ms)); // 23:31:30 UTC on Friday, 13 February 2009
621 // Use the global locale (fr_FR)
622 check(SV("%H='00'\t"
623 "%OH='00'\t"
624 "%I='12'\t"
625 "%OI='12'\t"
626 "%M='00'\t"
627 "%OM='00'\t"
628 "%S='00'\t"
629 "%OS='00'\t"
630 #if defined(_AIX)
631 "%p='AM'\t"
632 #else
633 "%p=''\t"
634 #endif
635 "%R='00:00'\t"
636 "%T='00:00:00'\t"
637 #ifdef _WIN32
638 "%r='00:00:00'\t"
639 #elif defined(_AIX)
640 "%r='12:00:00 AM'\t"
641 #elif defined(__APPLE__) || defined(__FreeBSD__)
642 "%r=''\t"
643 #else
644 "%r='12:00:00 '\t"
645 #endif
646 "%X='00:00:00'\t"
647 "%EX='00:00:00'\t"
648 "\n"),
649 lfmt,
650 std::chrono::local_seconds(0s)); // 00:00:00 UTC Thursday, 1 January 1970
652 check(SV("%H='23'\t"
653 "%OH='23'\t"
654 "%I='11'\t"
655 "%OI='11'\t"
656 "%M='31'\t"
657 "%OM='31'\t"
658 "%S='30,123'\t"
659 "%OS='30,123'\t"
660 #if defined(_AIX)
661 "%p='PM'\t"
662 #else
663 "%p=''\t"
664 #endif
665 "%R='23:31'\t"
666 "%T='23:31:30,123'\t"
667 #ifdef _WIN32
668 "%r='23:31:30'\t"
669 #elif defined(_AIX)
670 "%r='11:31:30 PM'\t"
671 #elif defined(__APPLE__) || defined(__FreeBSD__)
672 "%r=''\t"
673 #else
674 "%r='11:31:30 '\t"
675 #endif
676 "%X='23:31:30'\t"
677 "%EX='23:31:30'\t"
678 "\n"),
679 lfmt,
680 std::chrono::local_time<std::chrono::milliseconds>(
681 1'234'567'890'123ms)); // 23:31:30 UTC on Friday, 13 February 2009
683 // Use supplied locale (ja_JP). This locale has a different alternate.a
684 #if defined(__APPLE__) || defined(_AIX) || defined(_WIN32) || defined(__FreeBSD__)
685 check(loc,
686 SV("%H='00'\t"
687 "%OH='00'\t"
688 "%I='12'\t"
689 "%OI='12'\t"
690 "%M='00'\t"
691 "%OM='00'\t"
692 "%S='00'\t"
693 "%OS='00'\t"
694 # if defined(__APPLE__)
695 "%p='AM'\t"
696 # else
697 "%p='午前'\t"
698 # endif
699 "%R='00:00'\t"
700 "%T='00:00:00'\t"
701 # if defined(__APPLE__) || defined(__FreeBSD__)
702 # if defined(__APPLE__)
703 "%r='12:00:00 AM'\t"
704 # else
705 "%r='12:00:00 午前'\t"
706 # endif
707 "%X='00時00分00秒'\t"
708 "%EX='00時00分00秒'\t"
709 # elif defined(_WIN32)
710 "%r='0:00:00'\t"
711 "%X='0:00:00'\t"
712 "%EX='0:00:00'\t"
713 # else
714 "%r='午前12:00:00'\t"
715 "%X='00:00:00'\t"
716 "%EX='00:00:00'\t"
717 # endif
718 "\n"),
719 lfmt,
720 std::chrono::hh_mm_ss(0s));
722 check(loc,
723 SV("%H='23'\t"
724 "%OH='23'\t"
725 "%I='11'\t"
726 "%OI='11'\t"
727 "%M='31'\t"
728 "%OM='31'\t"
729 "%S='30.123'\t"
730 "%OS='30.123'\t"
731 # if defined(__APPLE__)
732 "%p='PM'\t"
733 # else
734 "%p='午後'\t"
735 # endif
736 "%R='23:31'\t"
737 "%T='23:31:30.123'\t"
738 # if defined(__APPLE__) || defined(__FreeBSD__)
739 # if defined(__APPLE__)
740 "%r='11:31:30 PM'\t"
741 # else
742 "%r='11:31:30 午後'\t"
743 # endif
744 "%X='23時31分30秒'\t"
745 "%EX='23時31分30秒'\t"
746 # elif defined(_WIN32)
747 "%r='23:31:30'\t"
748 "%X='23:31:30'\t"
749 "%EX='23:31:30'\t"
750 # else
751 "%r='午後11:31:30'\t"
752 "%X='23:31:30'\t"
753 "%EX='23:31:30'\t"
754 # endif
755 "\n"),
756 lfmt,
757 std::chrono::hh_mm_ss(23h + 31min + 30s + 123ms));
758 #else // defined(__APPLE__) || defined(_AIX) || defined(_WIN32) || defined(__FreeBSD__)
759 check(loc,
760 SV("%H='00'\t"
761 "%OH='〇'\t"
762 "%I='12'\t"
763 "%OI='十二'\t"
764 "%M='00'\t"
765 "%OM='〇'\t"
766 "%S='00'\t"
767 "%OS='〇'\t"
768 "%p='午前'\t"
769 "%R='00:00'\t"
770 "%T='00:00:00'\t"
771 "%r='午前12時00分00秒'\t"
772 "%X='00時00分00秒'\t"
773 "%EX='00時00分00秒'\t"
774 "\n"),
775 lfmt,
776 std::chrono::local_seconds(0s)); // 00:00:00 UTC Thursday, 1 January 1970
778 check(loc,
779 SV("%H='23'\t"
780 "%OH='二十三'\t"
781 "%I='11'\t"
782 "%OI='十一'\t"
783 "%M='31'\t"
784 "%OM='三十一'\t"
785 "%S='30.123'\t"
786 "%OS='三十.123'\t"
787 "%p='午後'\t"
788 "%R='23:31'\t"
789 "%T='23:31:30.123'\t"
790 "%r='午後11時31分30秒'\t"
791 "%X='23時31分30秒'\t"
792 "%EX='23時31分30秒'\t"
793 "\n"),
794 lfmt,
795 std::chrono::local_time<std::chrono::milliseconds>(
796 1'234'567'890'123ms)); // 23:31:30 UTC on Friday, 13 February 2009
797 #endif // defined(__APPLE__) || defined(_AIX) || defined(_WIN32) || defined(__FreeBSD__)
799 std::locale::global(std::locale::classic());
802 template <class CharT>
803 static void test_valid_values_date_time() {
804 using namespace std::literals::chrono_literals;
806 constexpr std::basic_string_view<CharT> fmt = SV("{:%%c='%c'%t%%Ec='%Ec'%n}");
807 constexpr std::basic_string_view<CharT> lfmt = SV("{:L%%c='%c'%t%%Ec='%Ec'%n}");
809 const std::locale loc(LOCALE_ja_JP_UTF_8);
810 std::locale::global(std::locale(LOCALE_fr_FR_UTF_8));
812 // Non localized output using C-locale
813 check(SV("%c='Thu Jan 1 00:00:00 1970'\t%Ec='Thu Jan 1 00:00:00 1970'\n"),
814 fmt,
815 std::chrono::local_seconds(0s)); // 00:00:00 UTC Thursday, 1 January 1970
817 check(SV("%c='Fri Feb 13 23:31:30 2009'\t%Ec='Fri Feb 13 23:31:30 2009'\n"),
818 fmt,
819 std::chrono::local_seconds(1'234'567'890s)); // 23:31:30 UTC on Friday, 13 February 2009
821 // Use the global locale (fr_FR)
822 check(
823 // https://sourceware.org/bugzilla/show_bug.cgi?id=24054
824 #if defined(__powerpc__) && defined(__linux__)
825 SV("%c='jeu. 01 janv. 1970 00:00:00 UTC'\t%Ec='jeu. 01 janv. 1970 00:00:00 UTC'\n"),
826 #elif defined(__GLIBC__) && __GLIBC__ <= 2 && __GLIBC_MINOR__ < 29
827 SV("%c='jeu. 01 janv. 1970 00:00:00 GMT'\t%Ec='jeu. 01 janv. 1970 00:00:00 GMT'\n"),
828 #elif defined(_AIX)
829 SV("%c=' 1 janvier 1970 à 00:00:00 UTC'\t%Ec=' 1 janvier 1970 à 00:00:00 UTC'\n"),
830 #elif defined(__APPLE__)
831 SV("%c='Jeu 1 jan 00:00:00 1970'\t%Ec='Jeu 1 jan 00:00:00 1970'\n"),
832 #elif defined(_WIN32)
833 SV("%c='01/01/1970 00:00:00'\t%Ec='01/01/1970 00:00:00'\n"),
834 #elif defined(__FreeBSD__)
835 SV("%c='jeu. 1 janv. 00:00:00 1970'\t%Ec='jeu. 1 janv. 00:00:00 1970'\n"),
836 #else
837 SV("%c='jeu. 01 janv. 1970 00:00:00'\t%Ec='jeu. 01 janv. 1970 00:00:00'\n"),
838 #endif
839 lfmt,
840 std::chrono::local_seconds(0s)); // 00:00:00 UTC Thursday, 1 January 1970
842 check(
843 // https://sourceware.org/bugzilla/show_bug.cgi?id=24054
844 #if defined(__powerpc__) && defined(__linux__)
845 SV("%c='ven. 13 févr. 2009 23:31:30 UTC'\t%Ec='ven. 13 févr. 2009 23:31:30 UTC'\n"),
846 #elif defined(__GLIBC__) && __GLIBC__ <= 2 && __GLIBC_MINOR__ < 29
847 SV("%c='ven. 13 févr. 2009 23:31:30 GMT'\t%Ec='ven. 13 févr. 2009 23:31:30 GMT'\n"),
848 #elif defined(_AIX)
849 SV("%c='13 février 2009 à 23:31:30 UTC'\t%Ec='13 février 2009 à 23:31:30 UTC'\n"),
850 #elif defined(__APPLE__)
851 SV("%c='Ven 13 fév 23:31:30 2009'\t%Ec='Ven 13 fév 23:31:30 2009'\n"),
852 #elif defined(_WIN32)
853 SV("%c='13/02/2009 23:31:30'\t%Ec='13/02/2009 23:31:30'\n"),
854 #elif defined(__FreeBSD__)
855 SV("%c='ven. 13 févr. 23:31:30 2009'\t%Ec='ven. 13 févr. 23:31:30 2009'\n"),
856 #else
857 SV("%c='ven. 13 févr. 2009 23:31:30'\t%Ec='ven. 13 févr. 2009 23:31:30'\n"),
858 #endif
859 lfmt,
860 std::chrono::local_seconds(1'234'567'890s)); // 23:31:30 UTC on Friday, 13 February 2009
862 // Use supplied locale (ja_JP). This locale has a different alternate.a
863 #if defined(__APPLE__) || defined(__FreeBSD__)
864 check(loc,
865 SV("%c='木 1/ 1 00:00:00 1970'\t%Ec='木 1/ 1 00:00:00 1970'\n"),
866 lfmt,
867 std::chrono::local_seconds(0s)); // 00:00:00 UTC Thursday, 1 January 1970
868 check(loc,
869 SV("%c='金 2/13 23:31:30 2009'\t%Ec='金 2/13 23:31:30 2009'\n"),
870 lfmt,
871 std::chrono::local_seconds(1'234'567'890s)); // 23:31:30 UTC on Friday, 13 February 2009
872 #elif defined(_AIX) // defined(__APPLE__)|| defined(__FreeBSD__)
873 check(loc,
874 SV("%c='1970年01月 1日 00:00:00 UTC'\t%Ec='1970年01月 1日 00:00:00 UTC'\n"),
875 lfmt,
876 std::chrono::local_seconds(0s)); // 00:00:00 UTC Thursday, 1 January 1970
877 check(loc,
878 SV("%c='2009年02月13日 23:31:30 UTC'\t%Ec='2009年02月13日 23:31:30 UTC'\n"),
879 lfmt,
880 std::chrono::local_seconds(1'234'567'890s)); // 23:31:30 UTC on Friday, 13 February 2009
881 #elif defined(_WIN32) // defined(__APPLE__)|| defined(__FreeBSD__)
882 check(loc,
883 SV("%c='1970/01/01 0:00:00'\t%Ec='1970/01/01 0:00:00'\n"),
884 lfmt,
885 std::chrono::sys_seconds(0s)); // 00:00:00 UTC Thursday, 1 January 1970
886 check(loc,
887 SV("%c='2009/02/13 23:31:30'\t%Ec='2009/02/13 23:31:30'\n"),
888 lfmt,
889 std::chrono::sys_seconds(1'234'567'890s)); // 23:31:30 UTC on Friday, 13 February 2009
890 #else // defined(__APPLE__)|| defined(__FreeBSD__)
891 check(loc,
892 SV("%c='1970年01月01日 00時00分00秒'\t%Ec='昭和45年01月01日 00時00分00秒'\n"),
893 lfmt,
894 std::chrono::local_seconds(0s)); // 00:00:00 UTC Thursday, 1 January 1970
896 check(loc,
897 SV("%c='2009年02月13日 23時31分30秒'\t%Ec='平成21年02月13日 23時31分30秒'\n"),
898 lfmt,
899 std::chrono::local_seconds(1'234'567'890s)); // 23:31:30 UTC on Friday, 13 February 2009
900 #endif // defined(__APPLE__)|| defined(__FreeBSD__)
902 std::locale::global(std::locale::classic());
905 template <class CharT>
906 static void test_valid_values() {
907 test_valid_values_year<CharT>();
908 test_valid_values_month<CharT>();
909 test_valid_values_day<CharT>();
910 test_valid_values_weekday<CharT>();
911 test_valid_values_day_of_year<CharT>();
912 test_valid_values_week<CharT>();
913 test_valid_values_iso_8601_week<CharT>();
914 test_valid_values_date<CharT>();
915 test_valid_values_time<CharT>();
916 test_valid_values_date_time<CharT>();
919 template <class CharT>
920 static void test() {
921 using namespace std::literals::chrono_literals;
923 test_no_chrono_specs<CharT>();
924 test_valid_values<CharT>();
925 check_invalid_types<CharT>(
927 SV("a"), SV("A"), SV("b"), SV("B"), SV("c"), SV("C"), SV("d"), SV("D"), SV("e"), SV("F"), SV("g"),
928 SV("G"), SV("h"), SV("H"), SV("I"), SV("j"), SV("m"), SV("M"), SV("p"), SV("r"), SV("R"), SV("S"),
929 SV("T"), SV("u"), SV("U"), SV("V"), SV("w"), SV("W"), SV("x"), SV("X"), SV("y"), SV("Y"), SV("Ec"),
930 SV("EC"), SV("Ex"), SV("EX"), SV("Ey"), SV("EY"), SV("Od"), SV("Oe"), SV("OH"), SV("OI"), SV("Om"), SV("OM"),
931 SV("OS"), SV("Ou"), SV("OU"), SV("OV"), SV("Ow"), SV("OW"), SV("Oy"),
933 std::chrono::local_seconds(0s));
935 check_exception("The format specifier expects a '%' or a '}'", SV("{:A"), std::chrono::local_seconds(0s));
936 check_exception("The chrono specifiers contain a '{'", SV("{:%%{"), std::chrono::local_seconds(0s));
937 check_exception("End of input while parsing a conversion specifier", SV("{:%"), std::chrono::local_seconds(0s));
938 check_exception("End of input while parsing the modifier E", SV("{:%E"), std::chrono::local_seconds(0s));
939 check_exception("End of input while parsing the modifier O", SV("{:%O"), std::chrono::local_seconds(0s));
941 // Precision not allowed
942 check_exception("The format specifier expects a '%' or a '}'", SV("{:.3}"), std::chrono::local_seconds(0s));
945 int main(int, char**) {
946 test<char>();
948 #ifndef TEST_HAS_NO_WIDE_CHARACTERS
949 test<wchar_t>();
950 #endif
952 return 0;