Debian Codegraph @

libcxx/test/std/time/time.syn/formatter.file_time.pass.cpp

raw
1 //===----------------------------------------------------------------------===//
2 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
3 // See https://llvm.org/LICENSE.txt for license information.
4 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
5 //
6 //===----------------------------------------------------------------------===//
7
8 // UNSUPPORTED: c++03, c++11, c++14, c++17
9 // UNSUPPORTED: no-localization
10 // UNSUPPORTED: GCC-ALWAYS_INLINE-FIXME
11
12 // TODO FMT This test should not require std::to_chars(floating-point)
13 // XFAIL: availability-fp_to_chars-missing
14
15 // REQUIRES: locale.fr_FR.UTF-8
16 // REQUIRES: locale.ja_JP.UTF-8
17
18 // <chrono>
19 //
20 // template<class charT> struct formatter<chrono::file_time, charT>;
21
22 #include <chrono>
23 #include <format>
24
25 #include <cassert>
26 #include <concepts>
27 #include <locale>
28 #include <iostream>
29 #include <type_traits>
30
31 #include "formatter_tests.h"
32 #include "make_string.h"
33 #include "platform_support.h" // locale name macros
34 #include "test_macros.h"
35
36 // Modeled after the system clock's usings, this make adapting the
37 // tests easier.
38 template <class Duration>
39 using file_time = std::chrono::time_point<std::chrono::file_clock, Duration>;
40 using file_seconds = file_time<std::chrono::seconds>;
41 using file_days = file_time<std::chrono::days>;
42
43 template <class CharT>
44 static void test_no_chrono_specs() {
45 using namespace std::literals::chrono_literals;
46
47 std::locale::global(std::locale(LOCALE_fr_FR_UTF_8));
48
49 // Non localized output
50
51 // [time.syn]
52 // using nanoseconds = duration<signed integer type of at least 64 bits, nano>;
53 // using microseconds = duration<signed integer type of at least 55 bits, micro>;
54 // using milliseconds = duration<signed integer type of at least 45 bits, milli>;
55 // using seconds = duration<signed integer type of at least 35 bits>;
56 // using minutes = duration<signed integer type of at least 29 bits, ratio< 60>>;
57 // using hours = duration<signed integer type of at least 23 bits, ratio<3600>>;
58 check(SV("1425-08-04 22:06:56"), SV("{}"), file_seconds(-17'179'869'184s)); // Minimum value for 35 bits.
59 check(SV("1901-12-13 20:45:52"), SV("{}"), file_seconds(-2'147'483'648s));
60
61 check(SV("1969-12-31 00:00:00"), SV("{}"), file_seconds(-24h));
62 check(SV("1969-12-31 06:00:00"), SV("{}"), file_seconds(-18h));
63 check(SV("1969-12-31 12:00:00"), SV("{}"), file_seconds(-12h));
64 check(SV("1969-12-31 18:00:00"), SV("{}"), file_seconds(-6h));
65 check(SV("1969-12-31 23:59:59"), SV("{}"), file_seconds(-1s));
66
67 check(SV("1970-01-01 00:00:00"), SV("{}"), file_seconds(0s));
68 check(SV("2000-01-01 00:00:00"), SV("{}"), file_seconds(946'684'800s));
69 check(SV("2000-01-01 01:02:03"), SV("{}"), file_seconds(946'688'523s));
70
71 check(SV("2038-01-19 03:14:07"), SV("{}"), file_seconds(2'147'483'647s));
72 check(SV("2514-05-30 01:53:03"), SV("{}"), file_seconds(17'179'869'183s)); // Maximum value for 35 bits.
73
74 check(SV("2000-01-01 01:02:03.123"), SV("{}"), file_time<std::chrono::milliseconds>(946'688'523'123ms));
75
76 std::locale::global(std::locale::classic());
77 }
78
79 template <class CharT>
80 static void test_valid_values_year() {
81 using namespace std::literals::chrono_literals;
82
83 constexpr std::basic_string_view<CharT> fmt =
84 SV("{:%%C='%C'%t%%EC='%EC'%t%%y='%y'%t%%Oy='%Oy'%t%%Ey='%Ey'%t%%Y='%Y'%t%%EY='%EY'%n}");
85 constexpr std::basic_string_view<CharT> lfmt =
86 SV("{:L%%C='%C'%t%%EC='%EC'%t%%y='%y'%t%%Oy='%Oy'%t%%Ey='%Ey'%t%%Y='%Y'%t%%EY='%EY'%n}");
87
88 const std::locale loc(LOCALE_ja_JP_UTF_8);
89 std::locale::global(std::locale(LOCALE_fr_FR_UTF_8));
90
91 // Non localized output using C-locale
92 check(SV("%C='19'\t%EC='19'\t%y='70'\t%Oy='70'\t%Ey='70'\t%Y='1970'\t%EY='1970'\n"),
93 fmt,
94 file_seconds(0s)); // 00:00:00 UTC Thursday, 1 January 1970
95
96 check(SV("%C='20'\t%EC='20'\t%y='09'\t%Oy='09'\t%Ey='09'\t%Y='2009'\t%EY='2009'\n"),
97 fmt,
98 file_seconds(1'234'567'890s)); // 23:31:30 UTC on Friday, 13 February 2009
99
100 // Use the global locale (fr_FR)
101 check(SV("%C='19'\t%EC='19'\t%y='70'\t%Oy='70'\t%Ey='70'\t%Y='1970'\t%EY='1970'\n"),
102 lfmt,
103 file_seconds(0s)); // 00:00:00 UTC Thursday, 1 January 1970
104
105 check(SV("%C='20'\t%EC='20'\t%y='09'\t%Oy='09'\t%Ey='09'\t%Y='2009'\t%EY='2009'\n"),
106 lfmt,
107 file_seconds(1'234'567'890s)); // 23:31:30 UTC on Friday, 13 February 2009
108
109 // Use supplied locale (ja_JP). This locale has a different alternate.
110 #if defined(_WIN32) || defined(__APPLE__) || defined(_AIX) || defined(__FreeBSD__)
111
112 check(loc,
113 SV("%C='19'\t%EC='19'\t%y='70'\t%Oy='70'\t%Ey='70'\t%Y='1970'\t%EY='1970'\n"),
114 lfmt,
115 file_seconds(0s)); // 00:00:00 UTC Thursday, 1 January 1970
116
117 check(loc,
118 SV("%C='20'\t%EC='20'\t%y='09'\t%Oy='09'\t%Ey='09'\t%Y='2009'\t%EY='2009'\n"),
119 lfmt,
120 file_seconds(1'234'567'890s)); // 23:31:30 UTC on Friday, 13 February 2009
121 #else // defined(_WIN32) || defined(__APPLE__) || defined(_AIX)|| defined(__FreeBSD__)
122
123 check(loc,
124 SV("%C='19'\t%EC='昭和'\t%y='70'\t%Oy='七十'\t%Ey='45'\t%Y='1970'\t%EY='昭和45年'\n"),
125 lfmt,
126 file_seconds(0s)); // 00:00:00 UTC Thursday, 1 January 1970
127
128 check(loc,
129 SV("%C='20'\t%EC='平成'\t%y='09'\t%Oy='九'\t%Ey='21'\t%Y='2009'\t%EY='平成21年'\n"),
130 lfmt,
131 file_seconds(1'234'567'890s)); // 23:31:30 UTC on Friday, 13 February 2009
132 #endif // defined(_WIN32) || defined(__APPLE__) || defined(_AIX)|| defined(__FreeBSD__)
133
134 std::locale::global(std::locale::classic());
135 }
136
137 template <class CharT>
138 static void test_valid_values_month() {
139 using namespace std::literals::chrono_literals;
140
141 constexpr std::basic_string_view<CharT> fmt = SV("{:%%b='%b'%t%%h='%h'%t%%B='%B'%t%%m='%m'%t%%Om='%Om'%n}");
142 constexpr std::basic_string_view<CharT> lfmt = SV("{:L%%b='%b'%t%%h='%h'%t%%B='%B'%t%%m='%m'%t%%Om='%Om'%n}");
143
144 const std::locale loc(LOCALE_ja_JP_UTF_8);
145 std::locale::global(std::locale(LOCALE_fr_FR_UTF_8));
146
147 // Non localized output using C-locale
148 check(SV("%b='Jan'\t%h='Jan'\t%B='January'\t%m='01'\t%Om='01'\n"),
149 fmt,
150 file_seconds(0s)); // 00:00:00 UTC Thursday, 1 January 1970
151
152 check(SV("%b='May'\t%h='May'\t%B='May'\t%m='05'\t%Om='05'\n"),
153 fmt,
154 file_seconds(2'000'000'000s)); // 03:33:20 UTC on Wednesday, 18 May 2033
155
156 // Use the global locale (fr_FR)
157 #if defined(__APPLE__)
158 check(SV("%b='jan'\t%h='jan'\t%B='janvier'\t%m='01'\t%Om='01'\n"),
159 lfmt,
160 file_seconds(0s)); // 00:00:00 UTC Thursday, 1 January 1970
161 #else
162 check(SV("%b='janv.'\t%h='janv.'\t%B='janvier'\t%m='01'\t%Om='01'\n"),
163 lfmt,
164 file_seconds(0s)); // 00:00:00 UTC Thursday, 1 January 1970
165 #endif
166
167 check(SV("%b='mai'\t%h='mai'\t%B='mai'\t%m='05'\t%Om='05'\n"),
168 lfmt,
169 file_seconds(2'000'000'000s)); // 03:33:20 UTC on Wednesday, 18 May 2033
170
171 // Use supplied locale (ja_JP). This locale has a different alternate.
172 #ifdef _WIN32
173 check(loc,
174 SV("%b='1'\t%h='1'\t%B='1月'\t%m='01'\t%Om='01'\n"),
175 lfmt,
176 file_seconds(0s)); // 00:00:00 UTC Thursday, 1 January 1970
177
178 check(loc,
179 SV("%b='5'\t%h='5'\t%B='5月'\t%m='05'\t%Om='05'\n"),
180 lfmt,
181 file_seconds(2'000'000'000s)); // 03:33:20 UTC on Wednesday, 18 May 2033
182 #elif defined(_AIX) // _WIN32
183 check(loc,
184 SV("%b='1月'\t%h='1月'\t%B='1月'\t%m='01'\t%Om='01'\n"),
185 lfmt,
186 file_seconds(0s)); // 00:00:00 UTC Thursday, 1 January 1970
187
188 check(loc,
189 SV("%b='5月'\t%h='5月'\t%B='5月'\t%m='05'\t%Om='05'\n"),
190 lfmt,
191 file_seconds(2'000'000'000s)); // 03:33:20 UTC on Wednesday, 18 May 2033
192 #elif defined(__APPLE__) // _WIN32
193 check(loc,
194 SV("%b=' 1'\t%h=' 1'\t%B='1月'\t%m='01'\t%Om='01'\n"),
195 lfmt,
196 file_seconds(0s)); // 00:00:00 UTC Thursday, 1 January 1970
197
198 check(loc,
199 SV("%b=' 5'\t%h=' 5'\t%B='5月'\t%m='05'\t%Om='05'\n"),
200 lfmt,
201 file_seconds(2'000'000'000s)); // 03:33:20 UTC on Wednesday, 18 May 2033
202 #elif defined(__FreeBSD__) // _WIN32
203 check(loc,
204 SV("%b=' 1月'\t%h=' 1月'\t%B='1月'\t%m='01'\t%Om='01'\n"),
205 lfmt,
206 file_seconds(0s)); // 00:00:00 UTC Thursday, 1 January 1970
207
208 check(loc,
209 SV("%b=' 5月'\t%h=' 5月'\t%B='5月'\t%m='05'\t%Om='05'\n"),
210 lfmt,
211 file_seconds(2'000'000'000s)); // 03:33:20 UTC on Wednesday, 18 May 2033
212 #else // _WIN32
213 check(loc,
214 SV("%b=' 1月'\t%h=' 1月'\t%B='1月'\t%m='01'\t%Om='一'\n"),
215 lfmt,
216 file_seconds(0s)); // 00:00:00 UTC Thursday, 1 January 1970
217
218 check(loc,
219 SV("%b=' 5月'\t%h=' 5月'\t%B='5月'\t%m='05'\t%Om='五'\n"),
220 lfmt,
221 file_seconds(2'000'000'000s)); // 03:33:20 UTC on Wednesday, 18 May 2033
222 #endif // _WIN32
223
224 std::locale::global(std::locale::classic());
225 }
226
227 template <class CharT>
228 static void test_valid_values_day() {
229 using namespace std::literals::chrono_literals;
230
231 constexpr std::basic_string_view<CharT> fmt = SV("{:%%d='%d'%t%%Od='%Od'%t%%e='%e'%t%%Oe='%Oe'%n}");
232 constexpr std::basic_string_view<CharT> lfmt = SV("{:L%%d='%d'%t%%Od='%Od'%t%%e='%e'%t%%Oe='%Oe'%n}");
233
234 const std::locale loc(LOCALE_ja_JP_UTF_8);
235 std::locale::global(std::locale(LOCALE_fr_FR_UTF_8));
236
237 // Non localized output using C-locale
238 check(SV("%d='01'\t%Od='01'\t%e=' 1'\t%Oe=' 1'\n"), fmt,
239 file_seconds(0s)); // 00:00:00 UTC Thursday, 1 January 1970
240
241 check(SV("%d='13'\t%Od='13'\t%e='13'\t%Oe='13'\n"),
242 fmt,
243 file_seconds(1'234'567'890s)); // 23:31:30 UTC on Friday, 13 February 2009
244
245 // Use the global locale (fr_FR)
246 check(SV("%d='01'\t%Od='01'\t%e=' 1'\t%Oe=' 1'\n"), lfmt,
247 file_seconds(0s)); // 00:00:00 UTC Thursday, 1 January 1970
248
249 check(SV("%d='13'\t%Od='13'\t%e='13'\t%Oe='13'\n"),
250 lfmt,
251 file_seconds(1'234'567'890s)); // 23:31:30 UTC on Friday, 13 February 2009
252
253 // Use supplied locale (ja_JP). This locale has a different alternate.
254 #if defined(_WIN32) || defined(__APPLE__) || defined(_AIX) || defined(__FreeBSD__)
255 check(loc,
256 SV("%d='01'\t%Od='01'\t%e=' 1'\t%Oe=' 1'\n"),
257 lfmt,
258 file_seconds(0s)); // 00:00:00 UTC Thursday, 1 January 1970
259
260 check(loc,
261 SV("%d='13'\t%Od='13'\t%e='13'\t%Oe='13'\n"),
262 lfmt,
263 file_seconds(1'234'567'890s)); // 23:31:30 UTC on Friday, 13 February 2009
264 #else // defined(_WIN32) || defined(__APPLE__) || defined(_AIX) || defined(__FreeBSD__)
265 check(loc,
266 SV("%d='01'\t%Od='一'\t%e=' 1'\t%Oe='一'\n"),
267 lfmt,
268 file_seconds(0s)); // 00:00:00 UTC Thursday, 1 January 1970
269
270 check(loc,
271 SV("%d='13'\t%Od='十三'\t%e='13'\t%Oe='十三'\n"),
272 lfmt,
273 file_seconds(1'234'567'890s)); // 23:31:30 UTC on Friday, 13 February 2009
274
275 #endif // defined(_WIN32) || defined(__APPLE__) || defined(_AIX) || defined(__FreeBSD__)
276
277 std::locale::global(std::locale::classic());
278 }
279
280 template <class CharT>
281 static void test_valid_values_weekday() {
282 using namespace std::literals::chrono_literals;
283
284 constexpr std::basic_string_view<CharT> fmt =
285 SV("{:%%a='%a'%t%%A='%A'%t%%u='%u'%t%%Ou='%Ou'%t%%w='%w'%t%%Ow='%Ow'%n}");
286 constexpr std::basic_string_view<CharT> lfmt =
287 SV("{:L%%a='%a'%t%%A='%A'%t%%u='%u'%t%%Ou='%Ou'%t%%w='%w'%t%%Ow='%Ow'%n}");
288
289 const std::locale loc(LOCALE_ja_JP_UTF_8);
290 std::locale::global(std::locale(LOCALE_fr_FR_UTF_8));
291
292 // Non localized output using C-locale
293 check(SV("%a='Thu'\t%A='Thursday'\t%u='4'\t%Ou='4'\t%w='4'\t%Ow='4'\n"),
294 fmt,
295 file_seconds(0s)); // 00:00:00 UTC Thursday, 1 January 1970
296
297 check(SV("%a='Sun'\t%A='Sunday'\t%u='7'\t%Ou='7'\t%w='0'\t%Ow='0'\n"),
298 fmt,
299 file_seconds(4'294'967'295s)); // 06:28:15 UTC on Sunday, 7 February 2106
300
301 // Use the global locale (fr_FR)
302 #if defined(__APPLE__)
303 check(SV("%a='Jeu'\t%A='Jeudi'\t%u='4'\t%Ou='4'\t%w='4'\t%Ow='4'\n"),
304 lfmt,
305 file_seconds(0s)); // 00:00:00 UTC Thursday, 1 January 1970
306
307 check(SV("%a='Dim'\t%A='Dimanche'\t%u='7'\t%Ou='7'\t%w='0'\t%Ow='0'\n"),
308 lfmt,
309 file_seconds(4'294'967'295s)); // 06:28:15 UTC on Sunday, 7 February 2106
310 #else
311 check(SV("%a='jeu.'\t%A='jeudi'\t%u='4'\t%Ou='4'\t%w='4'\t%Ow='4'\n"),
312 lfmt,
313 file_seconds(0s)); // 00:00:00 UTC Thursday, 1 January 1970
314
315 check(SV("%a='dim.'\t%A='dimanche'\t%u='7'\t%Ou='7'\t%w='0'\t%Ow='0'\n"),
316 lfmt,
317 file_seconds(4'294'967'295s)); // 06:28:15 UTC on Sunday, 7 February 2106
318 #endif
319
320 // Use supplied locale (ja_JP).
321 // This locale has a different alternate, but not on all platforms
322 #if defined(_WIN32) || defined(__APPLE__) || defined(_AIX) || defined(__FreeBSD__)
323 check(loc,
324 SV("%a='木'\t%A='木曜日'\t%u='4'\t%Ou='4'\t%w='4'\t%Ow='4'\n"),
325 lfmt,
326 file_seconds(0s)); // 00:00:00 UTC Thursday, 1 January 1970
327
328 check(loc,
329 SV("%a='日'\t%A='日曜日'\t%u='7'\t%Ou='7'\t%w='0'\t%Ow='0'\n"),
330 lfmt,
331 file_seconds(4'294'967'295s)); // 06:28:15 UTC on Sunday, 7 February 2106
332 #else // defined(_WIN32) || defined(__APPLE__) || defined(_AIX) || defined(__FreeBSD__)
333 check(loc,
334 SV("%a='木'\t%A='木曜日'\t%u='4'\t%Ou='四'\t%w='4'\t%Ow='四'\n"),
335 lfmt,
336 file_seconds(0s)); // 00:00:00 UTC Thursday, 1 January 1970
337
338 check(loc,
339 SV("%a='日'\t%A='日曜日'\t%u='7'\t%Ou='七'\t%w='0'\t%Ow='〇'\n"),
340 lfmt,
341 file_seconds(4'294'967'295s)); // 06:28:15 UTC on Sunday, 7 February 2106
342 #endif // defined(_WIN32) || defined(__APPLE__) || defined(_AIX) || defined(__FreeBSD__)
343
344 std::locale::global(std::locale::classic());
345 }
346
347 template <class CharT>
348 static void test_valid_values_day_of_year() {
349 using namespace std::literals::chrono_literals;
350
351 constexpr std::basic_string_view<CharT> fmt = SV("{:%%j='%j'%n}");
352 constexpr std::basic_string_view<CharT> lfmt = SV("{:L%%j='%j'%n}");
353
354 const std::locale loc(LOCALE_ja_JP_UTF_8);
355 std::locale::global(std::locale(LOCALE_fr_FR_UTF_8));
356
357 // Non localized output using C-locale
358 check(SV("%j='001'\n"), fmt, file_seconds(0s)); // 00:00:00 UTC Thursday, 1 January 1970
359 check(SV("%j='138'\n"), fmt, file_seconds(2'000'000'000s)); // 03:33:20 UTC on Wednesday, 18 May 2033
360
361 // Use the global locale (fr_FR)
362 check(SV("%j='001'\n"), lfmt, file_seconds(0s)); // 00:00:00 UTC Thursday, 1 January 1970
363 check(SV("%j='138'\n"), lfmt, file_seconds(2'000'000'000s)); // 03:33:20 UTC on Wednesday, 18 May 2033
364
365 // Use supplied locale (ja_JP). This locale has a different alternate.
366 check(loc, SV("%j='001'\n"), lfmt, file_seconds(0s)); // 00:00:00 UTC Thursday, 1 January 1970
367
368 check(loc, SV("%j='138'\n"), lfmt, file_seconds(2'000'000'000s)); // 03:33:20 UTC on Wednesday, 18 May 2033
369
370 std::locale::global(std::locale::classic());
371 }
372
373 template <class CharT>
374 static void test_valid_values_week() {
375 using namespace std::literals::chrono_literals;
376
377 constexpr std::basic_string_view<CharT> fmt = SV("{:%%U='%U'%t%%OU='%OU'%t%%W='%W'%t%%OW='%OW'%n}");
378 constexpr std::basic_string_view<CharT> lfmt = SV("{:L%%U='%U'%t%%OU='%OU'%t%%W='%W'%t%%OW='%OW'%n}");
379
380 const std::locale loc(LOCALE_ja_JP_UTF_8);
381 std::locale::global(std::locale(LOCALE_fr_FR_UTF_8));
382
383 // Non localized output using C-locale
384 check(SV("%U='00'\t%OU='00'\t%W='00'\t%OW='00'\n"), fmt,
385 file_seconds(0s)); // 00:00:00 UTC Thursday, 1 January 1970
386
387 check(SV("%U='20'\t%OU='20'\t%W='20'\t%OW='20'\n"),
388 fmt,
389 file_seconds(2'000'000'000s)); // 03:33:20 UTC on Wednesday, 18 May 2033
390
391 // Use the global locale (fr_FR)
392 check(SV("%U='00'\t%OU='00'\t%W='00'\t%OW='00'\n"), lfmt,
393 file_seconds(0s)); // 00:00:00 UTC Thursday, 1 January 1970
394
395 check(SV("%U='20'\t%OU='20'\t%W='20'\t%OW='20'\n"),
396 lfmt,
397 file_seconds(2'000'000'000s)); // 03:33:20 UTC on Wednesday, 18 May 2033
398
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 file_seconds(0s)); // 00:00:00 UTC Thursday, 1 January 1970
405
406 check(loc,
407 SV("%U='20'\t%OU='20'\t%W='20'\t%OW='20'\n"),
408 lfmt,
409 file_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 file_seconds(0s)); // 00:00:00 UTC Thursday, 1 January 1970
415
416 check(loc,
417 SV("%U='20'\t%OU='二十'\t%W='20'\t%OW='二十'\n"),
418 lfmt,
419 file_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());
422 }
423
424 template <class CharT>
425 static void test_valid_values_iso_8601_week() {
426 using namespace std::literals::chrono_literals;
427
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}");
430
431 const std::locale loc(LOCALE_ja_JP_UTF_8);
432 std::locale::global(std::locale(LOCALE_fr_FR_UTF_8));
433
434 // Non localized output using C-locale
435 check(SV("%g='70'\t%G='1970'\t%V='01'\t%OV='01'\n"), fmt,
436 file_seconds(0s)); // 00:00:00 UTC Thursday, 1 January 1970
437
438 check(SV("%g='09'\t%G='2009'\t%V='07'\t%OV='07'\n"),
439 fmt,
440 file_seconds(1'234'567'890s)); // 23:31:30 UTC on Friday, 13 February 2009
441
442 // Use the global locale (fr_FR)
443 check(SV("%g='70'\t%G='1970'\t%V='01'\t%OV='01'\n"), lfmt,
444 file_seconds(0s)); // 00:00:00 UTC Thursday, 1 January 1970
445
446 check(SV("%g='09'\t%G='2009'\t%V='07'\t%OV='07'\n"),
447 lfmt,
448 file_seconds(1'234'567'890s)); // 23:31:30 UTC on Friday, 13 February 2009
449
450 // Use supplied locale (ja_JP). This locale has a different alternate.
451 #if defined(_WIN32) || defined(__APPLE__) || defined(_AIX) || defined(__FreeBSD__)
452 check(loc,
453 SV("%g='70'\t%G='1970'\t%V='01'\t%OV='01'\n"),
454 lfmt,
455 file_seconds(0s)); // 00:00:00 UTC Thursday, 1 January 1970
456
457 check(loc,
458 SV("%g='09'\t%G='2009'\t%V='07'\t%OV='07'\n"),
459 lfmt,
460 file_seconds(1'234'567'890s)); // 23:31:30 UTC on Friday, 13 February 2009
461 #else // defined(_WIN32) || defined(__APPLE__) || defined(_AIX) || defined(__FreeBSD__)
462 check(loc,
463 SV("%g='70'\t%G='1970'\t%V='01'\t%OV='一'\n"),
464 lfmt,
465 file_seconds(0s)); // 00:00:00 UTC Thursday, 1 January 1970
466
467 check(loc,
468 SV("%g='09'\t%G='2009'\t%V='07'\t%OV='七'\n"),
469 lfmt,
470 file_seconds(1'234'567'890s)); // 23:31:30 UTC on Friday, 13 February 2009
471 #endif // defined(_WIN32) || defined(__APPLE__) || defined(_AIX) || defined(__FreeBSD__)
472
473 std::locale::global(std::locale::classic());
474 }
475
476 template <class CharT>
477 static void test_valid_values_date() {
478 using namespace std::literals::chrono_literals;
479
480 constexpr std::basic_string_view<CharT> fmt = SV("{:%%D='%D'%t%%F='%F'%t%%x='%x'%t%%Ex='%Ex'%n}");
481 constexpr std::basic_string_view<CharT> lfmt = SV("{:L%%D='%D'%t%%F='%F'%t%%x='%x'%t%%Ex='%Ex'%n}");
482
483 const std::locale loc(LOCALE_ja_JP_UTF_8);
484 std::locale::global(std::locale(LOCALE_fr_FR_UTF_8));
485
486 // Non localized output using C-locale
487 check(SV("%D='01/01/70'\t%F='1970-01-01'\t%x='01/01/70'\t%Ex='01/01/70'\n"),
488 fmt,
489 file_seconds(0s)); // 00:00:00 UTC Thursday, 1 January 1970
490
491 check(SV("%D='02/13/09'\t%F='2009-02-13'\t%x='02/13/09'\t%Ex='02/13/09'\n"),
492 fmt,
493 file_seconds(1'234'567'890s)); // 23:31:30 UTC on Friday, 13 February 2009
494
495 // Use the global locale (fr_FR)
496 #if defined(__APPLE__) || defined(__FreeBSD__)
497 check(SV("%D='01/01/70'\t%F='1970-01-01'\t%x='01.01.1970'\t%Ex='01.01.1970'\n"),
498 lfmt,
499 file_seconds(0s)); // 00:00:00 UTC Thursday, 1 January 1970
500
501 check(SV("%D='02/13/09'\t%F='2009-02-13'\t%x='13.02.2009'\t%Ex='13.02.2009'\n"),
502 lfmt,
503 file_seconds(1'234'567'890s)); // 23:31:30 UTC on Friday, 13 February 2009
504 #else
505 check(SV("%D='01/01/70'\t%F='1970-01-01'\t%x='01/01/1970'\t%Ex='01/01/1970'\n"),
506 lfmt,
507 file_seconds(0s)); // 00:00:00 UTC Thursday, 1 January 1970
508
509 check(SV("%D='02/13/09'\t%F='2009-02-13'\t%x='13/02/2009'\t%Ex='13/02/2009'\n"),
510 lfmt,
511 file_seconds(1'234'567'890s)); // 23:31:30 UTC on Friday, 13 February 2009
512 #endif
513
514 // Use supplied locale (ja_JP). This locale has a different alternate.
515 #if defined(_WIN32) || defined(__APPLE__) || defined(_AIX) || defined(__FreeBSD__)
516 check(loc,
517 SV("%D='01/01/70'\t%F='1970-01-01'\t%x='1970/01/01'\t%Ex='1970/01/01'\n"),
518 lfmt,
519 file_seconds(0s)); // 00:00:00 UTC Thursday, 1 January 1970
520
521 check(loc,
522 SV("%D='02/13/09'\t%F='2009-02-13'\t%x='2009/02/13'\t%Ex='2009/02/13'\n"),
523 lfmt,
524 file_seconds(1'234'567'890s)); // 23:31:30 UTC on Friday, 13 February 2009
525 #else // defined(_WIN32) || defined(__APPLE__) || defined(_AIX) || defined(__FreeBSD__)
526 check(loc,
527 SV("%D='01/01/70'\t%F='1970-01-01'\t%x='1970年01月01日'\t%Ex='昭和45年01月01日'\n"),
528 lfmt,
529 file_seconds(0s)); // 00:00:00 UTC Thursday, 1 January 1970
530
531 check(loc,
532 SV("%D='02/13/09'\t%F='2009-02-13'\t%x='2009年02月13日'\t%Ex='平成21年02月13日'\n"),
533 lfmt,
534 file_seconds(1'234'567'890s)); // 23:31:30 UTC on Friday, 13 February 2009
535 #endif // defined(_WIN32) || defined(__APPLE__) || defined(_AIX) || defined(__FreeBSD__)
536
537 std::locale::global(std::locale::classic());
538 }
539
540 template <class CharT>
541 static void test_valid_values_time() {
542 using namespace std::literals::chrono_literals;
543
544 constexpr std::basic_string_view<CharT> fmt = SV(
545 "{:"
546 "%%H='%H'%t"
547 "%%OH='%OH'%t"
548 "%%I='%I'%t"
549 "%%OI='%OI'%t"
550 "%%M='%M'%t"
551 "%%OM='%OM'%t"
552 "%%S='%S'%t"
553 "%%OS='%OS'%t"
554 "%%p='%p'%t"
555 "%%R='%R'%t"
556 "%%T='%T'%t"
557 "%%r='%r'%t"
558 "%%X='%X'%t"
559 "%%EX='%EX'%t"
560 "%n}");
561 constexpr std::basic_string_view<CharT> lfmt = SV(
562 "{:L"
563 "%%H='%H'%t"
564 "%%OH='%OH'%t"
565 "%%I='%I'%t"
566 "%%OI='%OI'%t"
567 "%%M='%M'%t"
568 "%%OM='%OM'%t"
569 "%%S='%S'%t"
570 "%%OS='%OS'%t"
571 "%%p='%p'%t"
572 "%%R='%R'%t"
573 "%%T='%T'%t"
574 "%%r='%r'%t"
575 "%%X='%X'%t"
576 "%%EX='%EX'%t"
577 "%n}");
578
579 const std::locale loc(LOCALE_ja_JP_UTF_8);
580 std::locale::global(std::locale(LOCALE_fr_FR_UTF_8));
581
582 // Non localized output using C-locale
583 check(SV("%H='00'\t"
584 "%OH='00'\t"
585 "%I='12'\t"
586 "%OI='12'\t"
587 "%M='00'\t"
588 "%OM='00'\t"
589 "%S='00'\t"
590 "%OS='00'\t"
591 "%p='AM'\t"
592 "%R='00:00'\t"
593 "%T='00:00:00'\t"
594 "%r='12:00:00 AM'\t"
595 "%X='00:00:00'\t"
596 "%EX='00:00:00'\t"
597 "\n"),
598 fmt,
599 file_seconds(0s)); // 00:00:00 UTC Thursday, 1 January 1970
600
601 check(SV("%H='23'\t"
602 "%OH='23'\t"
603 "%I='11'\t"
604 "%OI='11'\t"
605 "%M='31'\t"
606 "%OM='31'\t"
607 "%S='30.123'\t"
608 "%OS='30.123'\t"
609 "%p='PM'\t"
610 "%R='23:31'\t"
611 "%T='23:31:30.123'\t"
612 "%r='11:31:30 PM'\t"
613 "%X='23:31:30'\t"
614 "%EX='23:31:30'\t"
615 "\n"),
616 fmt,
617 std::chrono::sys_time<std::chrono::milliseconds>(
618 1'234'567'890'123ms)); // 23:31:30 UTC on Friday, 13 February 2009
619 // Use the global locale (fr_FR)
620 check(SV("%H='00'\t"
621 "%OH='00'\t"
622 "%I='12'\t"
623 "%OI='12'\t"
624 "%M='00'\t"
625 "%OM='00'\t"
626 "%S='00'\t"
627 "%OS='00'\t"
628 #if defined(_AIX)
629 "%p='AM'\t"
630 #else
631 "%p=''\t"
632 #endif
633 "%R='00:00'\t"
634 "%T='00:00:00'\t"
635 #ifdef _WIN32
636 "%r='00:00:00'\t"
637 #elif defined(_AIX)
638 "%r='12:00:00 AM'\t"
639 #elif defined(__APPLE__) || defined(__FreeBSD__)
640 "%r=''\t"
641 #else
642 "%r='12:00:00 '\t"
643 #endif
644 "%X='00:00:00'\t"
645 "%EX='00:00:00'\t"
646 "\n"),
647 lfmt,
648 file_seconds(0s)); // 00:00:00 UTC Thursday, 1 January 1970
649
650 check(SV("%H='23'\t"
651 "%OH='23'\t"
652 "%I='11'\t"
653 "%OI='11'\t"
654 "%M='31'\t"
655 "%OM='31'\t"
656 "%S='30,123'\t"
657 "%OS='30,123'\t"
658 #if defined(_AIX)
659 "%p='PM'\t"
660 #else
661 "%p=''\t"
662 #endif
663 "%R='23:31'\t"
664 "%T='23:31:30,123'\t"
665 #ifdef _WIN32
666 "%r='23:31:30'\t"
667 #elif defined(_AIX)
668 "%r='11:31:30 PM'\t"
669 #elif defined(__APPLE__) || defined(__FreeBSD__)
670 "%r=''\t"
671 #elif defined(_WIN32)
672 "%r='23:31:30 '\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::sys_time<std::chrono::milliseconds>(
681 1'234'567'890'123ms)); // 23:31:30 UTC on Friday, 13 February 2009
682
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));
721
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 file_seconds(0s)); // 00:00:00 UTC Thursday, 1 January 1970
777
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::sys_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__)
798
799 std::locale::global(std::locale::classic());
800 }
801
802 template <class CharT>
803 static void test_valid_values_date_time() {
804 using namespace std::literals::chrono_literals;
805
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}");
808
809 const std::locale loc(LOCALE_ja_JP_UTF_8);
810 std::locale::global(std::locale(LOCALE_fr_FR_UTF_8));
811
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 file_seconds(0s)); // 00:00:00 UTC Thursday, 1 January 1970
816
817 check(SV("%c='Fri Feb 13 23:31:30 2009'\t%Ec='Fri Feb 13 23:31:30 2009'\n"),
818 fmt,
819 file_seconds(1'234'567'890s)); // 23:31:30 UTC on Friday, 13 February 2009
820
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 file_seconds(0s)); // 00:00:00 UTC Thursday, 1 January 1970
841
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 file_seconds(1'234'567'890s)); // 23:31:30 UTC on Friday, 13 February 2009
861
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 file_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 file_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 file_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 file_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 file_seconds(0s)); // 00:00:00 UTC Thursday, 1 January 1970
895
896 check(loc,
897 SV("%c='2009年02月13日 23時31分30秒'\t%Ec='平成21年02月13日 23時31分30秒'\n"),
898 lfmt,
899 file_seconds(1'234'567'890s)); // 23:31:30 UTC on Friday, 13 February 2009
900 #endif // defined(__APPLE__)|| defined(__FreeBSD__)
901
902 std::locale::global(std::locale::classic());
903 }
904
905 template <class CharT>
906 static void test_valid_values_time_zone() {
907 using namespace std::literals::chrono_literals;
908
909 constexpr std::basic_string_view<CharT> fmt = SV("{:%%z='%z'%t%%Ez='%Ez'%t%%Oz='%Oz'%t%%Z='%Z'%n}");
910 constexpr std::basic_string_view<CharT> lfmt = SV("{:L%%z='%z'%t%%Ez='%Ez'%t%%Oz='%Oz'%t%%Z='%Z'%n}");
911
912 const std::locale loc(LOCALE_ja_JP_UTF_8);
913 std::locale::global(std::locale(LOCALE_fr_FR_UTF_8));
914
915 // Non localized output using C-locale
916 check(SV("%z='+0000'\t%Ez='+00:00'\t%Oz='+00:00'\t%Z='UTC'\n"),
917 fmt,
918 file_seconds(0s)); // 00:00:00 UTC Thursday, 1 January 1970
919
920 // Use the global locale (fr_FR)
921 check(SV("%z='+0000'\t%Ez='+00:00'\t%Oz='+00:00'\t%Z='UTC'\n"),
922 lfmt,
923 file_seconds(0s)); // 00:00:00 UTC Thursday, 1 January 1970
924
925 // Use supplied locale (ja_JP).
926 check(loc,
927 SV("%z='+0000'\t%Ez='+00:00'\t%Oz='+00:00'\t%Z='UTC'\n"),
928 lfmt,
929 file_seconds(0s)); // 00:00:00 UTC Thursday, 1 January 1970
930
931 std::locale::global(std::locale::classic());
932 }
933
934 template <class CharT>
935 static void test_valid_values() {
936 test_valid_values_year<CharT>();
937 test_valid_values_month<CharT>();
938 test_valid_values_day<CharT>();
939 test_valid_values_weekday<CharT>();
940 test_valid_values_day_of_year<CharT>();
941 test_valid_values_week<CharT>();
942 test_valid_values_iso_8601_week<CharT>();
943 test_valid_values_date<CharT>();
944 test_valid_values_time<CharT>();
945 test_valid_values_date_time<CharT>();
946 test_valid_values_time_zone<CharT>();
947 }
948
949 template <class CharT>
950 static void test() {
951 using namespace std::literals::chrono_literals;
952
953 test_no_chrono_specs<CharT>();
954 test_valid_values<CharT>();
955
956 check_invalid_types<CharT>(
957 {SV("a"), SV("A"), SV("b"), SV("B"), SV("c"), SV("C"), SV("d"), SV("D"), SV("e"), SV("F"), SV("g"),
958 SV("G"), SV("h"), SV("H"), SV("I"), SV("j"), SV("m"), SV("M"), SV("p"), SV("r"), SV("R"), SV("S"),
959 SV("T"), SV("u"), SV("U"), SV("V"), SV("w"), SV("W"), SV("x"), SV("X"), SV("y"), SV("Y"), SV("z"),
960 SV("Z"), SV("Ec"), SV("EC"), SV("Ex"), SV("EX"), SV("Ey"), SV("EY"), SV("Ez"), SV("Od"), SV("Oe"), SV("OH"),
961 SV("OI"), SV("Om"), SV("OM"), SV("OS"), SV("Ou"), SV("OU"), SV("OV"), SV("Ow"), SV("OW"), SV("Oy"), SV("Oz")},
962 file_seconds(0s));
963
964 check_exception("The format specifier expects a '%' or a '}'", SV("{:A"), file_seconds(0s));
965 check_exception("The chrono specifiers contain a '{'", SV("{:%%{"), file_seconds(0s));
966 check_exception("End of input while parsing a conversion specifier", SV("{:%"), file_seconds(0s));
967 check_exception("End of input while parsing the modifier E", SV("{:%E"), file_seconds(0s));
968 check_exception("End of input while parsing the modifier O", SV("{:%O"), file_seconds(0s));
969
970 // Precision not allowed
971 check_exception("The format specifier expects a '%' or a '}'", SV("{:.3}"), file_seconds(0s));
972 }
973
974 int main(int, char**) {
975 test<char>();
976
977 #ifndef TEST_HAS_NO_WIDE_CHARACTERS
978 test<wchar_t>();
979 #endif
980
981 return 0;
982 }