brintos

brintos / llvm-project-archived public Read only

0
0
Text · 36.4 KiB · 9238f3d Raw
963 lines · cpp
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-exception6//7//===----------------------------------------------------------------------===//8 9// UNSUPPORTED: c++03, c++11, c++14, c++1710// UNSUPPORTED: no-localization11// UNSUPPORTED: GCC-ALWAYS_INLINE-FIXME12 13// TODO FMT This test should not require std::to_chars(floating-point)14// XFAIL: availability-fp_to_chars-missing15 16// REQUIRES: locale.fr_FR.UTF-817// REQUIRES: locale.ja_JP.UTF-818 19// <chrono>20//21// template<class charT> struct formatter<chrono::day, charT>;22 23#include <chrono>24#include <format>25 26#include <cassert>27#include <concepts>28#include <locale>29#include <iostream>30#include <type_traits>31 32#include "formatter_tests.h"33#include "make_string.h"34#include "platform_support.h" // locale name macros35#include "test_macros.h"36 37template <class CharT>38static void test_no_chrono_specs() {39  using namespace std::literals::chrono_literals;40 41  std::locale::global(std::locale(LOCALE_fr_FR_UTF_8));42 43  // Non localized output44 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(SV("1425-08-04 22:06:56"), SV("{}"), std::chrono::sys_seconds(-17'179'869'184s)); // Minimum value for 35 bits.53  check(SV("1901-12-13 20:45:52"), SV("{}"), std::chrono::sys_seconds(-2'147'483'648s));54 55  check(SV("1969-12-31 00:00:00"), SV("{}"), std::chrono::sys_seconds(-24h));56  check(SV("1969-12-31 06:00:00"), SV("{}"), std::chrono::sys_seconds(-18h));57  check(SV("1969-12-31 12:00:00"), SV("{}"), std::chrono::sys_seconds(-12h));58  check(SV("1969-12-31 18:00:00"), SV("{}"), std::chrono::sys_seconds(-6h));59  check(SV("1969-12-31 23:59:59"), SV("{}"), std::chrono::sys_seconds(-1s));60 61  check(SV("1970-01-01 00:00:00"), SV("{}"), std::chrono::sys_seconds(0s));62  check(SV("2000-01-01 00:00:00"), SV("{}"), std::chrono::sys_seconds(946'684'800s));63  check(SV("2000-01-01 01:02:03"), SV("{}"), std::chrono::sys_seconds(946'688'523s));64 65  check(SV("2038-01-19 03:14:07"), SV("{}"), std::chrono::sys_seconds(2'147'483'647s));66  check(SV("2514-05-30 01:53:03"), SV("{}"), std::chrono::sys_seconds(17'179'869'183s)); // Maximum value for 35 bits.67 68  check(SV("2000-01-01 01:02:03.123"), SV("{}"), std::chrono::sys_time<std::chrono::milliseconds>(946'688'523'123ms));69 70  std::locale::global(std::locale::classic());71}72 73template <class CharT>74static void test_valid_values_year() {75  using namespace std::literals::chrono_literals;76 77  constexpr std::basic_string_view<CharT> fmt =78      SV("{:%%C='%C'%t%%EC='%EC'%t%%y='%y'%t%%Oy='%Oy'%t%%Ey='%Ey'%t%%Y='%Y'%t%%EY='%EY'%n}");79  constexpr std::basic_string_view<CharT> lfmt =80      SV("{:L%%C='%C'%t%%EC='%EC'%t%%y='%y'%t%%Oy='%Oy'%t%%Ey='%Ey'%t%%Y='%Y'%t%%EY='%EY'%n}");81 82  const std::locale loc(LOCALE_ja_JP_UTF_8);83  std::locale::global(std::locale(LOCALE_fr_FR_UTF_8));84 85  // Non localized output using C-locale86  check(SV("%C='19'\t%EC='19'\t%y='70'\t%Oy='70'\t%Ey='70'\t%Y='1970'\t%EY='1970'\n"),87        fmt,88        std::chrono::sys_seconds(0s)); // 00:00:00 UTC Thursday, 1 January 197089 90  check(SV("%C='20'\t%EC='20'\t%y='09'\t%Oy='09'\t%Ey='09'\t%Y='2009'\t%EY='2009'\n"),91        fmt,92        std::chrono::sys_seconds(1'234'567'890s)); // 23:31:30 UTC on Friday, 13 February 200993 94  // Use the global locale (fr_FR)95  check(SV("%C='19'\t%EC='19'\t%y='70'\t%Oy='70'\t%Ey='70'\t%Y='1970'\t%EY='1970'\n"),96        lfmt,97        std::chrono::sys_seconds(0s)); // 00:00:00 UTC Thursday, 1 January 197098 99  check(SV("%C='20'\t%EC='20'\t%y='09'\t%Oy='09'\t%Ey='09'\t%Y='2009'\t%EY='2009'\n"),100        lfmt,101        std::chrono::sys_seconds(1'234'567'890s)); // 23:31:30 UTC on Friday, 13 February 2009102 103  // Use supplied locale (ja_JP). This locale has a different alternate.104#if defined(_WIN32) || defined(__APPLE__) || defined(_AIX) || defined(__FreeBSD__)105  check(loc,106        SV("%C='19'\t%EC='19'\t%y='70'\t%Oy='70'\t%Ey='70'\t%Y='1970'\t%EY='1970'\n"),107        lfmt,108        std::chrono::sys_seconds(0s)); // 00:00:00 UTC Thursday, 1 January 1970109 110  check(loc,111        SV("%C='20'\t%EC='20'\t%y='09'\t%Oy='09'\t%Ey='09'\t%Y='2009'\t%EY='2009'\n"),112        lfmt,113        std::chrono::sys_seconds(1'234'567'890s)); // 23:31:30 UTC on Friday, 13 February 2009114#else  // defined(_WIN32) || defined(__APPLE__) || defined(_AIX)||defined(__FreeBSD__)115  check(loc,116        SV("%C='19'\t%EC='昭和'\t%y='70'\t%Oy='七十'\t%Ey='45'\t%Y='1970'\t%EY='昭和45年'\n"),117        lfmt,118        std::chrono::sys_seconds(0s)); // 00:00:00 UTC Thursday, 1 January 1970119 120  check(loc,121        SV("%C='20'\t%EC='平成'\t%y='09'\t%Oy='九'\t%Ey='21'\t%Y='2009'\t%EY='平成21年'\n"),122        lfmt,123        std::chrono::sys_seconds(1'234'567'890s)); // 23:31:30 UTC on Friday, 13 February 2009124#endif // defined(_WIN32) || defined(__APPLE__) || defined(_AIX)||defined(__FreeBSD__)125 126  std::locale::global(std::locale::classic());127}128 129template <class CharT>130static void test_valid_values_month() {131  using namespace std::literals::chrono_literals;132 133  constexpr std::basic_string_view<CharT> fmt  = SV("{:%%b='%b'%t%%h='%h'%t%%B='%B'%t%%m='%m'%t%%Om='%Om'%n}");134  constexpr std::basic_string_view<CharT> lfmt = SV("{:L%%b='%b'%t%%h='%h'%t%%B='%B'%t%%m='%m'%t%%Om='%Om'%n}");135 136  const std::locale loc(LOCALE_ja_JP_UTF_8);137  std::locale::global(std::locale(LOCALE_fr_FR_UTF_8));138 139  // Non localized output using C-locale140  check(SV("%b='Jan'\t%h='Jan'\t%B='January'\t%m='01'\t%Om='01'\n"),141        fmt,142        std::chrono::sys_seconds(0s)); // 00:00:00 UTC Thursday, 1 January 1970143 144  check(SV("%b='May'\t%h='May'\t%B='May'\t%m='05'\t%Om='05'\n"),145        fmt,146        std::chrono::sys_seconds(2'000'000'000s)); // 03:33:20 UTC on Wednesday, 18 May 2033147 148  // Use the global locale (fr_FR)149#if defined(__APPLE__)150  check(SV("%b='jan'\t%h='jan'\t%B='janvier'\t%m='01'\t%Om='01'\n"),151        lfmt,152        std::chrono::sys_seconds(0s)); // 00:00:00 UTC Thursday, 1 January 1970153#else154  check(SV("%b='janv.'\t%h='janv.'\t%B='janvier'\t%m='01'\t%Om='01'\n"),155        lfmt,156        std::chrono::sys_seconds(0s)); // 00:00:00 UTC Thursday, 1 January 1970157#endif158 159  check(SV("%b='mai'\t%h='mai'\t%B='mai'\t%m='05'\t%Om='05'\n"),160        lfmt,161        std::chrono::sys_seconds(2'000'000'000s)); // 03:33:20 UTC on Wednesday, 18 May 2033162 163  // Use supplied locale (ja_JP). This locale has a different alternate.164#ifdef _WIN32165  check(loc,166        SV("%b='1'\t%h='1'\t%B='1月'\t%m='01'\t%Om='01'\n"),167        lfmt,168        std::chrono::sys_seconds(0s)); // 00:00:00 UTC Thursday, 1 January 1970169 170  check(loc,171        SV("%b='5'\t%h='5'\t%B='5月'\t%m='05'\t%Om='05'\n"),172        lfmt,173        std::chrono::sys_seconds(2'000'000'000s)); // 03:33:20 UTC on Wednesday, 18 May 2033174#elif defined(_AIX)                                // _WIN32175  check(loc,176        SV("%b='1月'\t%h='1月'\t%B='1月'\t%m='01'\t%Om='01'\n"),177        lfmt,178        std::chrono::sys_seconds(0s)); // 00:00:00 UTC Thursday, 1 January 1970179 180  check(loc,181        SV("%b='5月'\t%h='5月'\t%B='5月'\t%m='05'\t%Om='05'\n"),182        lfmt,183        std::chrono::sys_seconds(2'000'000'000s)); // 03:33:20 UTC on Wednesday, 18 May 2033184#elif defined(__APPLE__)                           // _WIN32185  check(loc,186        SV("%b=' 1'\t%h=' 1'\t%B='1月'\t%m='01'\t%Om='01'\n"),187        lfmt,188        std::chrono::sys_seconds(0s)); // 00:00:00 UTC Thursday, 1 January 1970189 190  check(loc,191        SV("%b=' 5'\t%h=' 5'\t%B='5月'\t%m='05'\t%Om='05'\n"),192        lfmt,193        std::chrono::sys_seconds(2'000'000'000s)); // 03:33:20 UTC on Wednesday, 18 May 2033194#elif defined(__FreeBSD__)                         // _WIN32195  check(loc,196        SV("%b=' 1月'\t%h=' 1月'\t%B='1月'\t%m='01'\t%Om='01'\n"),197        lfmt,198        std::chrono::sys_seconds(0s)); // 00:00:00 UTC Thursday, 1 January 1970199 200  check(loc,201        SV("%b=' 5月'\t%h=' 5月'\t%B='5月'\t%m='05'\t%Om='05'\n"),202        lfmt,203        std::chrono::sys_seconds(2'000'000'000s)); // 03:33:20 UTC on Wednesday, 18 May 2033204#else                                              // _WIN32205  check(loc,206        SV("%b=' 1月'\t%h=' 1月'\t%B='1月'\t%m='01'\t%Om='一'\n"),207        lfmt,208        std::chrono::sys_seconds(0s)); // 00:00:00 UTC Thursday, 1 January 1970209 210  check(loc,211        SV("%b=' 5月'\t%h=' 5月'\t%B='5月'\t%m='05'\t%Om='五'\n"),212        lfmt,213        std::chrono::sys_seconds(2'000'000'000s)); // 03:33:20 UTC on Wednesday, 18 May 2033214#endif                                             // _WIN32215 216  std::locale::global(std::locale::classic());217}218 219template <class CharT>220static void test_valid_values_day() {221  using namespace std::literals::chrono_literals;222 223  constexpr std::basic_string_view<CharT> fmt  = SV("{:%%d='%d'%t%%Od='%Od'%t%%e='%e'%t%%Oe='%Oe'%n}");224  constexpr std::basic_string_view<CharT> lfmt = SV("{:L%%d='%d'%t%%Od='%Od'%t%%e='%e'%t%%Oe='%Oe'%n}");225 226  const std::locale loc(LOCALE_ja_JP_UTF_8);227  std::locale::global(std::locale(LOCALE_fr_FR_UTF_8));228 229  // Non localized output using C-locale230  check(SV("%d='01'\t%Od='01'\t%e=' 1'\t%Oe=' 1'\n"),231        fmt,232        std::chrono::sys_seconds(0s)); // 00:00:00 UTC Thursday, 1 January 1970233 234  check(SV("%d='13'\t%Od='13'\t%e='13'\t%Oe='13'\n"),235        fmt,236        std::chrono::sys_seconds(1'234'567'890s)); // 23:31:30 UTC on Friday, 13 February 2009237 238  // Use the global locale (fr_FR)239  check(SV("%d='01'\t%Od='01'\t%e=' 1'\t%Oe=' 1'\n"),240        lfmt,241        std::chrono::sys_seconds(0s)); // 00:00:00 UTC Thursday, 1 January 1970242 243  check(SV("%d='13'\t%Od='13'\t%e='13'\t%Oe='13'\n"),244        lfmt,245        std::chrono::sys_seconds(1'234'567'890s)); // 23:31:30 UTC on Friday, 13 February 2009246 247  // Use supplied locale (ja_JP). This locale has a different alternate.248#if defined(_WIN32) || defined(__APPLE__) || defined(_AIX) || defined(__FreeBSD__)249  check(loc,250        SV("%d='01'\t%Od='01'\t%e=' 1'\t%Oe=' 1'\n"),251        lfmt,252        std::chrono::sys_seconds(0s)); // 00:00:00 UTC Thursday, 1 January 1970253 254  check(loc,255        SV("%d='13'\t%Od='13'\t%e='13'\t%Oe='13'\n"),256        lfmt,257        std::chrono::sys_seconds(1'234'567'890s)); // 23:31:30 UTC on Friday, 13 February 2009258#else // defined(_WIN32) || defined(__APPLE__) || defined(_AIX) || defined(__FreeBSD__)259  check(loc,260        SV("%d='01'\t%Od='一'\t%e=' 1'\t%Oe='一'\n"),261        lfmt,262        std::chrono::sys_seconds(0s)); // 00:00:00 UTC Thursday, 1 January 1970263 264  check(loc,265        SV("%d='13'\t%Od='十三'\t%e='13'\t%Oe='十三'\n"),266        lfmt,267        std::chrono::sys_seconds(1'234'567'890s)); // 23:31:30 UTC on Friday, 13 February 2009268 269#endif // defined(_WIN32) || defined(__APPLE__) || defined(_AIX) || defined(__FreeBSD__)270 271  std::locale::global(std::locale::classic());272}273 274template <class CharT>275static void test_valid_values_weekday() {276  using namespace std::literals::chrono_literals;277 278  constexpr std::basic_string_view<CharT> fmt =279      SV("{:%%a='%a'%t%%A='%A'%t%%u='%u'%t%%Ou='%Ou'%t%%w='%w'%t%%Ow='%Ow'%n}");280  constexpr std::basic_string_view<CharT> lfmt =281      SV("{:L%%a='%a'%t%%A='%A'%t%%u='%u'%t%%Ou='%Ou'%t%%w='%w'%t%%Ow='%Ow'%n}");282 283  const std::locale loc(LOCALE_ja_JP_UTF_8);284  std::locale::global(std::locale(LOCALE_fr_FR_UTF_8));285 286  // Non localized output using C-locale287  check(SV("%a='Thu'\t%A='Thursday'\t%u='4'\t%Ou='4'\t%w='4'\t%Ow='4'\n"),288        fmt,289        std::chrono::sys_seconds(0s)); // 00:00:00 UTC Thursday, 1 January 1970290 291  check(SV("%a='Sun'\t%A='Sunday'\t%u='7'\t%Ou='7'\t%w='0'\t%Ow='0'\n"),292        fmt,293        std::chrono::sys_seconds(4'294'967'295s)); // 06:28:15 UTC on Sunday, 7 February 2106294 295  // Use the global locale (fr_FR)296#if defined(__APPLE__)297  check(SV("%a='Jeu'\t%A='Jeudi'\t%u='4'\t%Ou='4'\t%w='4'\t%Ow='4'\n"),298        lfmt,299        std::chrono::sys_seconds(0s)); // 00:00:00 UTC Thursday, 1 January 1970300 301  check(SV("%a='Dim'\t%A='Dimanche'\t%u='7'\t%Ou='7'\t%w='0'\t%Ow='0'\n"),302        lfmt,303        std::chrono::sys_seconds(4'294'967'295s)); // 06:28:15 UTC on Sunday, 7 February 2106304#else305  check(SV("%a='jeu.'\t%A='jeudi'\t%u='4'\t%Ou='4'\t%w='4'\t%Ow='4'\n"),306        lfmt,307        std::chrono::sys_seconds(0s)); // 00:00:00 UTC Thursday, 1 January 1970308 309  check(SV("%a='dim.'\t%A='dimanche'\t%u='7'\t%Ou='7'\t%w='0'\t%Ow='0'\n"),310        lfmt,311        std::chrono::sys_seconds(4'294'967'295s)); // 06:28:15 UTC on Sunday, 7 February 2106312#endif313 314  // Use supplied locale (ja_JP).315  // This locale has a different alternate, but not on all platforms316#if defined(_WIN32) || defined(__APPLE__) || defined(_AIX) || defined(__FreeBSD__)317  check(loc,318        SV("%a='木'\t%A='木曜日'\t%u='4'\t%Ou='4'\t%w='4'\t%Ow='4'\n"),319        lfmt,320        std::chrono::sys_seconds(0s)); // 00:00:00 UTC Thursday, 1 January 1970321 322  check(loc,323        SV("%a='日'\t%A='日曜日'\t%u='7'\t%Ou='7'\t%w='0'\t%Ow='0'\n"),324        lfmt,325        std::chrono::sys_seconds(4'294'967'295s)); // 06:28:15 UTC on Sunday, 7 February 2106326#else  // defined(_WIN32) || defined(__APPLE__) || defined(_AIX) || defined(__FreeBSD__)327  check(loc,328        SV("%a='木'\t%A='木曜日'\t%u='4'\t%Ou='四'\t%w='4'\t%Ow='四'\n"),329        lfmt,330        std::chrono::sys_seconds(0s)); // 00:00:00 UTC Thursday, 1 January 1970331 332  check(loc,333        SV("%a='日'\t%A='日曜日'\t%u='7'\t%Ou='七'\t%w='0'\t%Ow='〇'\n"),334        lfmt,335        std::chrono::sys_seconds(4'294'967'295s)); // 06:28:15 UTC on Sunday, 7 February 2106336#endif // defined(_WIN32) || defined(__APPLE__) || defined(_AIX) || defined(__FreeBSD__)337 338  std::locale::global(std::locale::classic());339}340 341template <class CharT>342static void test_valid_values_day_of_year() {343  using namespace std::literals::chrono_literals;344 345  constexpr std::basic_string_view<CharT> fmt  = SV("{:%%j='%j'%n}");346  constexpr std::basic_string_view<CharT> lfmt = SV("{:L%%j='%j'%n}");347 348  const std::locale loc(LOCALE_ja_JP_UTF_8);349  std::locale::global(std::locale(LOCALE_fr_FR_UTF_8));350 351  // Non localized output using C-locale352  check(SV("%j='001'\n"), fmt, std::chrono::sys_seconds(0s));             // 00:00:00 UTC Thursday, 1 January 1970353  check(SV("%j='138'\n"), fmt, std::chrono::sys_seconds(2'000'000'000s)); // 03:33:20 UTC on Wednesday, 18 May 2033354 355  // Use the global locale (fr_FR)356  check(SV("%j='001'\n"), lfmt, std::chrono::sys_seconds(0s));             // 00:00:00 UTC Thursday, 1 January 1970357  check(SV("%j='138'\n"), lfmt, std::chrono::sys_seconds(2'000'000'000s)); // 03:33:20 UTC on Wednesday, 18 May 2033358 359  // Use supplied locale (ja_JP). This locale has a different alternate.360  check(loc, SV("%j='001'\n"), lfmt, std::chrono::sys_seconds(0s)); // 00:00:00 UTC Thursday, 1 January 1970361 362  check(363      loc, SV("%j='138'\n"), lfmt, std::chrono::sys_seconds(2'000'000'000s)); // 03:33:20 UTC on Wednesday, 18 May 2033364 365  std::locale::global(std::locale::classic());366}367 368template <class CharT>369static void test_valid_values_week() {370  using namespace std::literals::chrono_literals;371 372  constexpr std::basic_string_view<CharT> fmt  = SV("{:%%U='%U'%t%%OU='%OU'%t%%W='%W'%t%%OW='%OW'%n}");373  constexpr std::basic_string_view<CharT> lfmt = SV("{:L%%U='%U'%t%%OU='%OU'%t%%W='%W'%t%%OW='%OW'%n}");374 375  const std::locale loc(LOCALE_ja_JP_UTF_8);376  std::locale::global(std::locale(LOCALE_fr_FR_UTF_8));377 378  // Non localized output using C-locale379  check(SV("%U='00'\t%OU='00'\t%W='00'\t%OW='00'\n"),380        fmt,381        std::chrono::sys_seconds(0s)); // 00:00:00 UTC Thursday, 1 January 1970382 383  check(SV("%U='20'\t%OU='20'\t%W='20'\t%OW='20'\n"),384        fmt,385        std::chrono::sys_seconds(2'000'000'000s)); // 03:33:20 UTC on Wednesday, 18 May 2033386 387  // Use the global locale (fr_FR)388  check(SV("%U='00'\t%OU='00'\t%W='00'\t%OW='00'\n"),389        lfmt,390        std::chrono::sys_seconds(0s)); // 00:00:00 UTC Thursday, 1 January 1970391 392  check(SV("%U='20'\t%OU='20'\t%W='20'\t%OW='20'\n"),393        lfmt,394        std::chrono::sys_seconds(2'000'000'000s)); // 03:33:20 UTC on Wednesday, 18 May 2033395 396  // Use supplied locale (ja_JP). This locale has a different alternate.397#if defined(_WIN32) || defined(__APPLE__) || defined(_AIX) || defined(__FreeBSD__)398  check(loc,399        SV("%U='00'\t%OU='00'\t%W='00'\t%OW='00'\n"),400        lfmt,401        std::chrono::sys_seconds(0s)); // 00:00:00 UTC Thursday, 1 January 1970402 403  check(loc,404        SV("%U='20'\t%OU='20'\t%W='20'\t%OW='20'\n"),405        lfmt,406        std::chrono::sys_seconds(2'000'000'000s)); // 03:33:20 UTC on Wednesday, 18 May 2033407#else  // defined(_WIN32) || defined(__APPLE__) || defined(_AIX) || defined(__FreeBSD__)408  check(loc,409        SV("%U='00'\t%OU='〇'\t%W='00'\t%OW='〇'\n"),410        lfmt,411        std::chrono::sys_seconds(0s)); // 00:00:00 UTC Thursday, 1 January 1970412 413  check(loc,414        SV("%U='20'\t%OU='二十'\t%W='20'\t%OW='二十'\n"),415        lfmt,416        std::chrono::sys_seconds(2'000'000'000s)); // 03:33:20 UTC on Wednesday, 18 May 2033417#endif // defined(_WIN32) || defined(__APPLE__) || defined(_AIX) || defined(__FreeBSD__)418  std::locale::global(std::locale::classic());419}420 421template <class CharT>422static void test_valid_values_iso_8601_week() {423  using namespace std::literals::chrono_literals;424 425  constexpr std::basic_string_view<CharT> fmt  = SV("{:%%g='%g'%t%%G='%G'%t%%V='%V'%t%%OV='%OV'%n}");426  constexpr std::basic_string_view<CharT> lfmt = SV("{:L%%g='%g'%t%%G='%G'%t%%V='%V'%t%%OV='%OV'%n}");427 428  const std::locale loc(LOCALE_ja_JP_UTF_8);429  std::locale::global(std::locale(LOCALE_fr_FR_UTF_8));430 431  // Non localized output using C-locale432  check(SV("%g='70'\t%G='1970'\t%V='01'\t%OV='01'\n"),433        fmt,434        std::chrono::sys_seconds(0s)); // 00:00:00 UTC Thursday, 1 January 1970435 436  check(SV("%g='09'\t%G='2009'\t%V='07'\t%OV='07'\n"),437        fmt,438        std::chrono::sys_seconds(1'234'567'890s)); // 23:31:30 UTC on Friday, 13 February 2009439 440  // Use the global locale (fr_FR)441  check(SV("%g='70'\t%G='1970'\t%V='01'\t%OV='01'\n"),442        lfmt,443        std::chrono::sys_seconds(0s)); // 00:00:00 UTC Thursday, 1 January 1970444 445  check(SV("%g='09'\t%G='2009'\t%V='07'\t%OV='07'\n"),446        lfmt,447        std::chrono::sys_seconds(1'234'567'890s)); // 23:31:30 UTC on Friday, 13 February 2009448 449  // Use supplied locale (ja_JP). This locale has a different alternate.450#if defined(_WIN32) || defined(__APPLE__) || defined(_AIX) || defined(__FreeBSD__)451  check(loc,452        SV("%g='70'\t%G='1970'\t%V='01'\t%OV='01'\n"),453        lfmt,454        std::chrono::sys_seconds(0s)); // 00:00:00 UTC Thursday, 1 January 1970455 456  check(loc,457        SV("%g='09'\t%G='2009'\t%V='07'\t%OV='07'\n"),458        lfmt,459        std::chrono::sys_seconds(1'234'567'890s)); // 23:31:30 UTC on Friday, 13 February 2009460#else  // defined(_WIN32) || defined(__APPLE__) || defined(_AIX) || defined(__FreeBSD__)461  check(loc,462        SV("%g='70'\t%G='1970'\t%V='01'\t%OV='一'\n"),463        lfmt,464        std::chrono::sys_seconds(0s)); // 00:00:00 UTC Thursday, 1 January 1970465 466  check(loc,467        SV("%g='09'\t%G='2009'\t%V='07'\t%OV='七'\n"),468        lfmt,469        std::chrono::sys_seconds(1'234'567'890s)); // 23:31:30 UTC on Friday, 13 February 2009470#endif // defined(_WIN32) || defined(__APPLE__) || defined(_AIX) || defined(__FreeBSD__)471 472  std::locale::global(std::locale::classic());473}474 475template <class CharT>476static void test_valid_values_date() {477  using namespace std::literals::chrono_literals;478 479  constexpr std::basic_string_view<CharT> fmt  = SV("{:%%D='%D'%t%%F='%F'%t%%x='%x'%t%%Ex='%Ex'%n}");480  constexpr std::basic_string_view<CharT> lfmt = SV("{:L%%D='%D'%t%%F='%F'%t%%x='%x'%t%%Ex='%Ex'%n}");481 482  const std::locale loc(LOCALE_ja_JP_UTF_8);483  std::locale::global(std::locale(LOCALE_fr_FR_UTF_8));484 485  // Non localized output using C-locale486  check(SV("%D='01/01/70'\t%F='1970-01-01'\t%x='01/01/70'\t%Ex='01/01/70'\n"),487        fmt,488        std::chrono::sys_seconds(0s)); // 00:00:00 UTC Thursday, 1 January 1970489 490  check(SV("%D='02/13/09'\t%F='2009-02-13'\t%x='02/13/09'\t%Ex='02/13/09'\n"),491        fmt,492        std::chrono::sys_seconds(1'234'567'890s)); // 23:31:30 UTC on Friday, 13 February 2009493 494  // Use the global locale (fr_FR)495#if defined(__APPLE__) || defined(__FreeBSD__)496  check(SV("%D='01/01/70'\t%F='1970-01-01'\t%x='01.01.1970'\t%Ex='01.01.1970'\n"),497        lfmt,498        std::chrono::sys_seconds(0s)); // 00:00:00 UTC Thursday, 1 January 1970499 500  check(SV("%D='02/13/09'\t%F='2009-02-13'\t%x='13.02.2009'\t%Ex='13.02.2009'\n"),501        lfmt,502        std::chrono::sys_seconds(1'234'567'890s)); // 23:31:30 UTC on Friday, 13 February 2009503#else504  check(SV("%D='01/01/70'\t%F='1970-01-01'\t%x='01/01/1970'\t%Ex='01/01/1970'\n"),505        lfmt,506        std::chrono::sys_seconds(0s)); // 00:00:00 UTC Thursday, 1 January 1970507 508  check(SV("%D='02/13/09'\t%F='2009-02-13'\t%x='13/02/2009'\t%Ex='13/02/2009'\n"),509        lfmt,510        std::chrono::sys_seconds(1'234'567'890s)); // 23:31:30 UTC on Friday, 13 February 2009511#endif512 513  // Use supplied locale (ja_JP). This locale has a different alternate.514#if defined(_WIN32) || defined(__APPLE__) || defined(_AIX) || defined(__FreeBSD__)515  check(loc,516        SV("%D='01/01/70'\t%F='1970-01-01'\t%x='1970/01/01'\t%Ex='1970/01/01'\n"),517        lfmt,518        std::chrono::sys_seconds(0s)); // 00:00:00 UTC Thursday, 1 January 1970519 520  check(loc,521        SV("%D='02/13/09'\t%F='2009-02-13'\t%x='2009/02/13'\t%Ex='2009/02/13'\n"),522        lfmt,523        std::chrono::sys_seconds(1'234'567'890s)); // 23:31:30 UTC on Friday, 13 February 2009524#else  // defined(_WIN32) || defined(__APPLE__) || defined(_AIX) || defined(__FreeBSD__)525  check(loc,526        SV("%D='01/01/70'\t%F='1970-01-01'\t%x='1970年01月01日'\t%Ex='昭和45年01月01日'\n"),527        lfmt,528        std::chrono::sys_seconds(0s)); // 00:00:00 UTC Thursday, 1 January 1970529 530  check(loc,531        SV("%D='02/13/09'\t%F='2009-02-13'\t%x='2009年02月13日'\t%Ex='平成21年02月13日'\n"),532        lfmt,533        std::chrono::sys_seconds(1'234'567'890s)); // 23:31:30 UTC on Friday, 13 February 2009534#endif // defined(_WIN32) || defined(__APPLE__) || defined(_AIX) || defined(__FreeBSD__)535 536  std::locale::global(std::locale::classic());537}538 539template <class CharT>540static void test_valid_values_time() {541  using namespace std::literals::chrono_literals;542 543  constexpr std::basic_string_view<CharT> fmt = SV(544      "{:"545      "%%H='%H'%t"546      "%%OH='%OH'%t"547      "%%I='%I'%t"548      "%%OI='%OI'%t"549      "%%M='%M'%t"550      "%%OM='%OM'%t"551      "%%S='%S'%t"552      "%%OS='%OS'%t"553      "%%p='%p'%t"554      "%%R='%R'%t"555      "%%T='%T'%t"556      "%%r='%r'%t"557      "%%X='%X'%t"558      "%%EX='%EX'%t"559      "%n}");560  constexpr std::basic_string_view<CharT> lfmt = SV(561      "{:L"562      "%%H='%H'%t"563      "%%OH='%OH'%t"564      "%%I='%I'%t"565      "%%OI='%OI'%t"566      "%%M='%M'%t"567      "%%OM='%OM'%t"568      "%%S='%S'%t"569      "%%OS='%OS'%t"570      "%%p='%p'%t"571      "%%R='%R'%t"572      "%%T='%T'%t"573      "%%r='%r'%t"574      "%%X='%X'%t"575      "%%EX='%EX'%t"576      "%n}");577 578  const std::locale loc(LOCALE_ja_JP_UTF_8);579  std::locale::global(std::locale(LOCALE_fr_FR_UTF_8));580 581  // Non localized output using C-locale582  check(SV("%H='00'\t"583           "%OH='00'\t"584           "%I='12'\t"585           "%OI='12'\t"586           "%M='00'\t"587           "%OM='00'\t"588           "%S='00'\t"589           "%OS='00'\t"590           "%p='AM'\t"591           "%R='00:00'\t"592           "%T='00:00:00'\t"593           "%r='12:00:00 AM'\t"594           "%X='00:00:00'\t"595           "%EX='00:00:00'\t"596           "\n"),597        fmt,598        std::chrono::sys_seconds(0s)); // 00:00:00 UTC Thursday, 1 January 1970599 600  check(SV("%H='23'\t"601           "%OH='23'\t"602           "%I='11'\t"603           "%OI='11'\t"604           "%M='31'\t"605           "%OM='31'\t"606           "%S='30.123'\t"607           "%OS='30.123'\t"608           "%p='PM'\t"609           "%R='23:31'\t"610           "%T='23:31:30.123'\t"611           "%r='11:31:30 PM'\t"612           "%X='23:31:30'\t"613           "%EX='23:31:30'\t"614           "\n"),615        fmt,616        std::chrono::sys_time<std::chrono::milliseconds>(617            1'234'567'890'123ms)); // 23:31:30 UTC on Friday, 13 February 2009618  // Use the global locale (fr_FR)619  check(SV("%H='00'\t"620           "%OH='00'\t"621           "%I='12'\t"622           "%OI='12'\t"623           "%M='00'\t"624           "%OM='00'\t"625           "%S='00'\t"626           "%OS='00'\t"627#if defined(_AIX)628           "%p='AM'\t"629#else630           "%p=''\t"631#endif632           "%R='00:00'\t"633           "%T='00:00:00'\t"634#ifdef _WIN32635           "%r='00:00:00'\t"636#elif defined(_AIX)637           "%r='12:00:00 AM'\t"638#elif defined(__APPLE__) || defined(__FreeBSD__)639           "%r=''\t"640#else641           "%r='12:00:00 '\t"642#endif643           "%X='00:00:00'\t"644           "%EX='00:00:00'\t"645           "\n"),646        lfmt,647        std::chrono::sys_seconds(0s)); // 00:00:00 UTC Thursday, 1 January 1970648 649  check(SV("%H='23'\t"650           "%OH='23'\t"651           "%I='11'\t"652           "%OI='11'\t"653           "%M='31'\t"654           "%OM='31'\t"655           "%S='30,123'\t"656           "%OS='30,123'\t"657#if defined(_AIX)658           "%p='PM'\t"659#else660           "%p=''\t"661#endif662           "%R='23:31'\t"663           "%T='23:31:30,123'\t"664#ifdef _WIN32665           "%r='23:31:30'\t"666#elif defined(_AIX)667           "%r='11:31:30 PM'\t"668#elif defined(__APPLE__) || defined(__FreeBSD__)669           "%r=''\t"670#else671           "%r='11:31:30 '\t"672#endif673           "%X='23:31:30'\t"674           "%EX='23:31:30'\t"675           "\n"),676        lfmt,677        std::chrono::sys_time<std::chrono::milliseconds>(678            1'234'567'890'123ms)); // 23:31:30 UTC on Friday, 13 February 2009679 680  // Use supplied locale (ja_JP). This locale has a different alternate.681#if defined(__APPLE__) || defined(_AIX) || defined(_WIN32) || defined(__FreeBSD__)682  check(loc,683        SV("%H='00'\t"684           "%OH='00'\t"685           "%I='12'\t"686           "%OI='12'\t"687           "%M='00'\t"688           "%OM='00'\t"689           "%S='00'\t"690           "%OS='00'\t"691           "%p='午前'\t"692           "%R='00:00'\t"693           "%T='00:00:00'\t"694#  if defined(__APPLE__) || defined(__FreeBSD__)695           "%r='12:00:00 午前'\t"696           "%X='00時00分00秒'\t"697           "%EX='00時00分00秒'\t"698#  elif defined(_WIN32)699           "%r='0:00:00'\t"700           "%X='0:00:00'\t"701           "%EX='0:00:00'\t"702#  else703           "%r='午前12:00:00'\t"704           "%X='00:00:00'\t"705           "%EX='00:00:00'\t"706#  endif707           "\n"),708        lfmt,709        std::chrono::hh_mm_ss(0s));710 711  check(loc,712        SV("%H='23'\t"713           "%OH='23'\t"714           "%I='11'\t"715           "%OI='11'\t"716           "%M='31'\t"717           "%OM='31'\t"718           "%S='30.123'\t"719           "%OS='30.123'\t"720           "%p='午後'\t"721           "%R='23:31'\t"722           "%T='23:31:30.123'\t"723#  if defined(__APPLE__) || defined(__FreeBSD__)724           "%r='11:31:30 午後'\t"725           "%X='23時31分30秒'\t"726           "%EX='23時31分30秒'\t"727#  elif defined(_WIN32)728           "%r='23:31:30'\t"729           "%X='23:31:30'\t"730           "%EX='23:31:30'\t"731#  else732           "%r='午後11:31:30'\t"733           "%X='23:31:30'\t"734           "%EX='23:31:30'\t"735#  endif736           "\n"),737        lfmt,738        std::chrono::hh_mm_ss(23h + 31min + 30s + 123ms));739#else  // defined(__APPLE__) || defined(_AIX) || defined(_WIN32) || defined(__FreeBSD__)740  check(loc,741        SV("%H='00'\t"742           "%OH='〇'\t"743           "%I='12'\t"744           "%OI='十二'\t"745           "%M='00'\t"746           "%OM='〇'\t"747           "%S='00'\t"748           "%OS='〇'\t"749           "%p='午前'\t"750           "%R='00:00'\t"751           "%T='00:00:00'\t"752           "%r='午前12時00分00秒'\t"753           "%X='00時00分00秒'\t"754           "%EX='00時00分00秒'\t"755           "\n"),756        lfmt,757        std::chrono::sys_seconds(0s)); // 00:00:00 UTC Thursday, 1 January 1970758 759  check(loc,760        SV("%H='23'\t"761           "%OH='二十三'\t"762           "%I='11'\t"763           "%OI='十一'\t"764           "%M='31'\t"765           "%OM='三十一'\t"766           "%S='30.123'\t"767           "%OS='三十.123'\t"768           "%p='午後'\t"769           "%R='23:31'\t"770           "%T='23:31:30.123'\t"771           "%r='午後11時31分30秒'\t"772           "%X='23時31分30秒'\t"773           "%EX='23時31分30秒'\t"774           "\n"),775        lfmt,776        std::chrono::sys_time<std::chrono::milliseconds>(777            1'234'567'890'123ms)); // 23:31:30 UTC on Friday, 13 February 2009778#endif // defined(__APPLE__) || defined(_AIX) || defined(_WIN32) || defined(__FreeBSD__)779 780  std::locale::global(std::locale::classic());781}782 783template <class CharT>784static void test_valid_values_date_time() {785  using namespace std::literals::chrono_literals;786 787  constexpr std::basic_string_view<CharT> fmt  = SV("{:%%c='%c'%t%%Ec='%Ec'%n}");788  constexpr std::basic_string_view<CharT> lfmt = SV("{:L%%c='%c'%t%%Ec='%Ec'%n}");789 790  const std::locale loc(LOCALE_ja_JP_UTF_8);791  std::locale::global(std::locale(LOCALE_fr_FR_UTF_8));792 793  // Non localized output using C-locale794  check(SV("%c='Thu Jan  1 00:00:00 1970'\t%Ec='Thu Jan  1 00:00:00 1970'\n"),795        fmt,796        std::chrono::sys_seconds(0s)); // 00:00:00 UTC Thursday, 1 January 1970797 798  check(SV("%c='Fri Feb 13 23:31:30 2009'\t%Ec='Fri Feb 13 23:31:30 2009'\n"),799        fmt,800        std::chrono::sys_seconds(1'234'567'890s)); // 23:31:30 UTC on Friday, 13 February 2009801 802  // Use the global locale (fr_FR)803  check(804// https://sourceware.org/bugzilla/show_bug.cgi?id=24054805#if defined(__powerpc__) && defined(__linux__)806      SV("%c='jeu. 01 janv. 1970 00:00:00 UTC'\t%Ec='jeu. 01 janv. 1970 00:00:00 UTC'\n"),807#elif defined(__GLIBC__) && __GLIBC__ <= 2 && __GLIBC_MINOR__ < 29808      SV("%c='jeu. 01 janv. 1970 00:00:00 GMT'\t%Ec='jeu. 01 janv. 1970 00:00:00 GMT'\n"),809#elif defined(_AIX)810      SV("%c=' 1 janvier 1970 à 00:00:00 UTC'\t%Ec=' 1 janvier 1970 à 00:00:00 UTC'\n"),811#elif defined(__APPLE__)812      SV("%c='Jeu  1 jan 00:00:00 1970'\t%Ec='Jeu  1 jan 00:00:00 1970'\n"),813#elif defined(_WIN32)814      SV("%c='01/01/1970 00:00:00'\t%Ec='01/01/1970 00:00:00'\n"),815#elif defined(__FreeBSD__)816      SV("%c='jeu.  1 janv. 00:00:00 1970'\t%Ec='jeu.  1 janv. 00:00:00 1970'\n"),817#else818      SV("%c='jeu. 01 janv. 1970 00:00:00'\t%Ec='jeu. 01 janv. 1970 00:00:00'\n"),819#endif820      lfmt,821      std::chrono::sys_seconds(0s)); // 00:00:00 UTC Thursday, 1 January 1970822 823  check(824// https://sourceware.org/bugzilla/show_bug.cgi?id=24054825#if defined(__powerpc__) && defined(__linux__)826      SV("%c='ven. 13 févr. 2009 23:31:30 UTC'\t%Ec='ven. 13 févr. 2009 23:31:30 UTC'\n"),827#elif defined(__GLIBC__) && __GLIBC__ <= 2 && __GLIBC_MINOR__ < 29828      SV("%c='ven. 13 févr. 2009 23:31:30 GMT'\t%Ec='ven. 13 févr. 2009 23:31:30 GMT'\n"),829#elif defined(_AIX)830      SV("%c='13 février 2009 à 23:31:30 UTC'\t%Ec='13 février 2009 à 23:31:30 UTC'\n"),831#elif defined(__APPLE__)832      SV("%c='Ven 13 fév 23:31:30 2009'\t%Ec='Ven 13 fév 23:31:30 2009'\n"),833#elif defined(_WIN32)834      SV("%c='13/02/2009 23:31:30'\t%Ec='13/02/2009 23:31:30'\n"),835#elif defined(__FreeBSD__)836      SV("%c='ven. 13 févr. 23:31:30 2009'\t%Ec='ven. 13 févr. 23:31:30 2009'\n"),837#else838      SV("%c='ven. 13 févr. 2009 23:31:30'\t%Ec='ven. 13 févr. 2009 23:31:30'\n"),839#endif840      lfmt,841      std::chrono::sys_seconds(1'234'567'890s)); // 23:31:30 UTC on Friday, 13 February 2009842 843  // Use supplied locale (ja_JP). This locale has a different alternate.a844#if defined(__APPLE__) || defined(__FreeBSD__)845  check(loc,846        SV("%c='木  1/ 1 00:00:00 1970'\t%Ec='木  1/ 1 00:00:00 1970'\n"),847        lfmt,848        std::chrono::sys_seconds(0s)); // 00:00:00 UTC Thursday, 1 January 1970849  check(loc,850        SV("%c='金  2/13 23:31:30 2009'\t%Ec='金  2/13 23:31:30 2009'\n"),851        lfmt,852        std::chrono::sys_seconds(1'234'567'890s)); // 23:31:30 UTC on Friday, 13 February 2009853#elif defined(_AIX)                                // defined(__APPLE__)|| defined(__FreeBSD__)854  check(loc,855        SV("%c='1970年01月 1日 00:00:00 UTC'\t%Ec='1970年01月 1日 00:00:00 UTC'\n"),856        lfmt,857        std::chrono::sys_seconds(0s)); // 00:00:00 UTC Thursday, 1 January 1970858  check(loc,859        SV("%c='2009年02月13日 23:31:30 UTC'\t%Ec='2009年02月13日 23:31:30 UTC'\n"),860        lfmt,861        std::chrono::sys_seconds(1'234'567'890s)); // 23:31:30 UTC on Friday, 13 February 2009862#elif defined(_WIN32)                              // defined(__APPLE__)|| defined(__FreeBSD__)863  check(loc,864        SV("%c='1970/01/01 0:00:00'\t%Ec='1970/01/01 0:00:00'\n"),865        lfmt,866        std::chrono::sys_seconds(0s)); // 00:00:00 UTC Thursday, 1 January 1970867  check(loc,868        SV("%c='2009/02/13 23:31:30'\t%Ec='2009/02/13 23:31:30'\n"),869        lfmt,870        std::chrono::sys_seconds(1'234'567'890s)); // 23:31:30 UTC on Friday, 13 February 2009871#else                                              // defined(__APPLE__)|| defined(__FreeBSD__)872  check(loc,873        SV("%c='1970年01月01日 00時00分00秒'\t%Ec='昭和45年01月01日 00時00分00秒'\n"),874        lfmt,875        std::chrono::sys_seconds(0s)); // 00:00:00 UTC Thursday, 1 January 1970876 877  check(loc,878        SV("%c='2009年02月13日 23時31分30秒'\t%Ec='平成21年02月13日 23時31分30秒'\n"),879        lfmt,880        std::chrono::sys_seconds(1'234'567'890s)); // 23:31:30 UTC on Friday, 13 February 2009881#endif                                             // defined(__APPLE__)|| defined(__FreeBSD__)882 883  std::locale::global(std::locale::classic());884}885 886template <class CharT>887static void test_valid_values_time_zone() {888  using namespace std::literals::chrono_literals;889 890  constexpr std::basic_string_view<CharT> fmt  = SV("{:%%z='%z'%t%%Ez='%Ez'%t%%Oz='%Oz'%t%%Z='%Z'%n}");891  constexpr std::basic_string_view<CharT> lfmt = SV("{:L%%z='%z'%t%%Ez='%Ez'%t%%Oz='%Oz'%t%%Z='%Z'%n}");892 893  const std::locale loc(LOCALE_ja_JP_UTF_8);894  std::locale::global(std::locale(LOCALE_fr_FR_UTF_8));895 896  // Non localized output using C-locale897  check(SV("%z='+0000'\t%Ez='+00:00'\t%Oz='+00:00'\t%Z='UTC'\n"),898        fmt,899        std::chrono::sys_seconds(0s)); // 00:00:00 UTC Thursday, 1 January 1970900 901  // Use the global locale (fr_FR)902  check(SV("%z='+0000'\t%Ez='+00:00'\t%Oz='+00:00'\t%Z='UTC'\n"),903        lfmt,904        std::chrono::sys_seconds(0s)); // 00:00:00 UTC Thursday, 1 January 1970905 906  // Use supplied locale (ja_JP).907  check(loc,908        SV("%z='+0000'\t%Ez='+00:00'\t%Oz='+00:00'\t%Z='UTC'\n"),909        lfmt,910        std::chrono::sys_seconds(0s)); // 00:00:00 UTC Thursday, 1 January 1970911 912  std::locale::global(std::locale::classic());913}914 915template <class CharT>916static void test_valid_values() {917  test_valid_values_year<CharT>();918  test_valid_values_month<CharT>();919  test_valid_values_day<CharT>();920  test_valid_values_weekday<CharT>();921  test_valid_values_day_of_year<CharT>();922  test_valid_values_week<CharT>();923  test_valid_values_iso_8601_week<CharT>();924  test_valid_values_date<CharT>();925  test_valid_values_time<CharT>();926  test_valid_values_date_time<CharT>();927  test_valid_values_time_zone<CharT>();928}929 930template <class CharT>931static void test() {932  using namespace std::literals::chrono_literals;933 934  test_no_chrono_specs<CharT>();935  test_valid_values<CharT>();936  check_invalid_types<CharT>(937      {SV("a"),  SV("A"),  SV("b"),  SV("B"),  SV("c"),  SV("C"),  SV("d"),  SV("D"),  SV("e"),  SV("F"),  SV("g"),938       SV("G"),  SV("h"),  SV("H"),  SV("I"),  SV("j"),  SV("m"),  SV("M"),  SV("p"),  SV("r"),  SV("R"),  SV("S"),939       SV("T"),  SV("u"),  SV("U"),  SV("V"),  SV("w"),  SV("W"),  SV("x"),  SV("X"),  SV("y"),  SV("Y"),  SV("z"),940       SV("Z"),  SV("Ec"), SV("EC"), SV("Ex"), SV("EX"), SV("Ey"), SV("EY"), SV("Ez"), SV("Od"), SV("Oe"), SV("OH"),941       SV("OI"), SV("Om"), SV("OM"), SV("OS"), SV("Ou"), SV("OU"), SV("OV"), SV("Ow"), SV("OW"), SV("Oy"), SV("Oz")},942      std::chrono::sys_seconds(0s));943 944  check_exception("The format specifier expects a '%' or a '}'", SV("{:A"), std::chrono::sys_seconds(0s));945  check_exception("The chrono specifiers contain a '{'", SV("{:%%{"), std::chrono::sys_seconds(0s));946  check_exception("End of input while parsing a conversion specifier", SV("{:%"), std::chrono::sys_seconds(0s));947  check_exception("End of input while parsing the modifier E", SV("{:%E"), std::chrono::sys_seconds(0s));948  check_exception("End of input while parsing the modifier O", SV("{:%O"), std::chrono::sys_seconds(0s));949 950  // Precision not allowed951  check_exception("The format specifier expects a '%' or a '}'", SV("{:.3}"), std::chrono::sys_seconds(0s));952}953 954int main(int, char**) {955  test<char>();956 957#ifndef TEST_HAS_NO_WIDE_CHARACTERS958  test<wchar_t>();959#endif960 961  return 0;962}963