brintos

brintos / llvm-project-archived public Read only

0
0
Text · 40.0 KiB · f1f7deb Raw
1173 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// XFAIL: availability-fp_to_chars-missing14 15// REQUIRES: locale.fr_FR.UTF-816// REQUIRES: locale.ja_JP.UTF-817 18// <chrono>19 20//  template<class Rep, class Period, class charT>21//    struct formatter<chrono::duration<Rep, Period>, charT>;22 23#include <chrono>24#include <format>25 26#include <cassert>27#include <concepts>28#include <locale>29#include <iostream>30#include <ratio>31#include <type_traits>32 33#include "formatter_tests.h"34#include "make_string.h"35#include "platform_support.h" // locale name macros36#include "test_macros.h"37 38template <class CharT>39static void test_no_chrono_specs() {40  using namespace std::literals::chrono_literals;41 42  check(SV("1as"), SV("{}"), std::chrono::duration<int, std::atto>(1));43  check(SV("1fs"), SV("{}"), std::chrono::duration<int, std::femto>(1));44  check(SV("1ps"), SV("{}"), std::chrono::duration<int, std::pico>(1));45  check(SV("1ns"), SV("{}"), 1ns);46#ifndef TEST_HAS_NO_UNICODE47  check(SV("1\u00b5s"), SV("{}"), 1us);48#else49  check(SV("1us"), SV("{}"), 1us);50#endif51  check(SV("1ms"), SV("{}"), 1ms);52  check(SV("1cs"), SV("{}"), std::chrono::duration<int, std::centi>(1));53  check(SV("1ds"), SV("{}"), std::chrono::duration<int, std::deci>(1));54 55  check(SV("1s"), SV("{}"), 1s);56 57  check(SV("1das"), SV("{}"), std::chrono::duration<int, std::deca>(1));58  check(SV("1hs"), SV("{}"), std::chrono::duration<int, std::hecto>(1));59  check(SV("1ks"), SV("{}"), std::chrono::duration<int, std::kilo>(1));60  check(SV("1Ms"), SV("{}"), std::chrono::duration<int, std::mega>(1));61  check(SV("1Gs"), SV("{}"), std::chrono::duration<int, std::giga>(1));62  check(SV("1Ts"), SV("{}"), std::chrono::duration<int, std::tera>(1));63  check(SV("1Ps"), SV("{}"), std::chrono::duration<int, std::peta>(1));64  check(SV("1Es"), SV("{}"), std::chrono::duration<int, std::exa>(1));65 66  check(SV("1min"), SV("{}"), 1min);67  check(SV("1h"), SV("{}"), 1h);68  check(SV("1d"), SV("{}"), std::chrono::duration<int, std::ratio<86400>>(1));69 70  check(SV("1[42]s"), SV("{}"), std::chrono::duration<int, std::ratio<42>>(1));71  check(SV("1[11]s"), SV("{}"), std::chrono::duration<int, std::ratio<33, 3>>(1));72  check(SV("1[11/9]s"), SV("{}"), std::chrono::duration<int, std::ratio<11, 9>>(1));73}74 75template <class CharT>76static void test_valid_positive_integral_values() {77  using namespace std::literals::chrono_literals;78 79  constexpr std::basic_string_view<CharT> fmt = SV(80      "{:"81      "%%H='%H'%t"82      "%%OH='%OH'%t"83      "%%I='%I'%t"84      "%%OI='%OI'%t"85      "%%M='%M'%t"86      "%%OM='%OM'%t"87      "%%S='%S'%t"88      "%%OS='%OS'%t"89      "%%p='%p'%t"90      "%%R='%R'%t"91      "%%T='%T'%t"92      "%%r='%r'%t"93      "%%X='%X'%t"94      "%%EX='%EX'%t"95      "%%j='%j'%t"96      "%%Q='%Q'%t"97      "%%q='%q'%t"98      "%n}");99  constexpr std::basic_string_view<CharT> lfmt = SV(100      "{:L"101      "%%H='%H'%t"102      "%%OH='%OH'%t"103      "%%I='%I'%t"104      "%%OI='%OI'%t"105      "%%M='%M'%t"106      "%%OM='%OM'%t"107      "%%S='%S'%t"108      "%%OS='%OS'%t"109      "%%p='%p'%t"110      "%%R='%R'%t"111      "%%T='%T'%t"112      "%%r='%r'%t"113      "%%X='%X'%t"114      "%%EX='%EX'%t"115      "%%j='%j'%t"116      "%%Q='%Q'%t"117      "%%q='%q'%t"118      "%n}");119 120  const std::locale loc(LOCALE_ja_JP_UTF_8);121  std::locale::global(std::locale(LOCALE_fr_FR_UTF_8));122 123  // Non localized output using C-locale124  check(SV("%H='00'\t"125           "%OH='00'\t"126           "%I='12'\t"127           "%OI='12'\t"128           "%M='00'\t"129           "%OM='00'\t"130           "%S='00'\t"131           "%OS='00'\t"132           "%p='AM'\t"133           "%R='00:00'\t"134           "%T='00:00:00'\t"135           "%r='12:00:00 AM'\t"136           "%X='00:00:00'\t"137           "%EX='00:00:00'\t"138           "%j='0'\t"139           "%Q='0'\t"140           "%q='s'\t"141           "\n"),142        fmt,143        0s);144 145  check(SV("%H='11'\t"146           "%OH='11'\t"147           "%I='11'\t"148           "%OI='11'\t"149           "%M='59'\t"150           "%OM='59'\t"151           "%S='59'\t"152           "%OS='59'\t"153           "%p='AM'\t"154           "%R='11:59'\t"155           "%T='11:59:59'\t"156           "%r='11:59:59 AM'\t"157           "%X='11:59:59'\t"158           "%EX='11:59:59'\t"159           "%j='0'\t"160           "%Q='43199'\t"161           "%q='s'\t"162           "\n"),163        fmt,164        11h + 59min + 59s);165 166  check(SV("%H='12'\t"167           "%OH='12'\t"168           "%I='12'\t"169           "%OI='12'\t"170           "%M='00'\t"171           "%OM='00'\t"172           "%S='00'\t"173           "%OS='00'\t"174           "%p='PM'\t"175           "%R='12:00'\t"176           "%T='12:00:00'\t"177           "%r='12:00:00 PM'\t"178           "%X='12:00:00'\t"179           "%EX='12:00:00'\t"180           "%j='0'\t"181           "%Q='12'\t"182           "%q='h'\t"183           "\n"),184        fmt,185        12h);186 187  check(SV("%H='23'\t"188           "%OH='23'\t"189           "%I='11'\t"190           "%OI='11'\t"191           "%M='59'\t"192           "%OM='59'\t"193           "%S='59'\t"194           "%OS='59'\t"195           "%p='PM'\t"196           "%R='23:59'\t"197           "%T='23:59:59'\t"198           "%r='11:59:59 PM'\t"199           "%X='23:59:59'\t"200           "%EX='23:59:59'\t"201           "%j='0'\t"202           "%Q='86399'\t"203           "%q='s'\t"204           "\n"),205        fmt,206        23h + 59min + 59s);207 208  check(SV("%H='00'\t"209           "%OH='00'\t"210           "%I='12'\t"211           "%OI='12'\t"212           "%M='00'\t"213           "%OM='00'\t"214           "%S='00'\t"215           "%OS='00'\t"216           "%p='AM'\t"217           "%R='00:00'\t"218           "%T='00:00:00'\t"219           "%r='12:00:00 AM'\t"220           "%X='00:00:00'\t"221           "%EX='00:00:00'\t"222           "%j='7'\t"223           "%Q='7'\t"224           "%q='d'\t"225           "\n"),226        fmt,227        std::chrono::duration<int, std::ratio<86400>>(7));228 229  // Use the global locale (fr_FR)230  check(SV("%H='00'\t"231           "%OH='00'\t"232           "%I='12'\t"233           "%OI='12'\t"234           "%M='00'\t"235           "%OM='00'\t"236           "%S='00'\t"237           "%OS='00'\t"238#if defined(_AIX)239           "%p='AM'\t"240#else241           "%p=''\t"242#endif243           "%R='00:00'\t"244           "%T='00:00:00'\t"245#ifdef _WIN32246           "%r='00:00:00'\t"247#elif defined(_AIX)248           "%r='12:00:00 AM'\t"249#elif defined(__APPLE__) || defined(__FreeBSD__)250           "%r=''\t"251#else252           "%r='12:00:00 '\t"253#endif254           "%X='00:00:00'\t"255           "%EX='00:00:00'\t"256           "%j='0'\t"257           "%Q='0'\t"258           "%q='s'\t"259           "\n"),260        lfmt,261        0s);262 263  check(SV("%H='11'\t"264           "%OH='11'\t"265           "%I='11'\t"266           "%OI='11'\t"267           "%M='59'\t"268           "%OM='59'\t"269           "%S='59'\t"270           "%OS='59'\t"271#if defined(_AIX)272           "%p='AM'\t"273#else274           "%p=''\t"275#endif276           "%R='11:59'\t"277           "%T='11:59:59'\t"278#ifdef _WIN32279           "%r='11:59:59'\t"280#elif defined(_AIX)281           "%r='11:59:59 AM'\t"282#elif defined(__APPLE__) || defined(__FreeBSD__)283           "%r=''\t"284#else285           "%r='11:59:59 '\t"286#endif287           "%X='11:59:59'\t"288           "%EX='11:59:59'\t"289           "%j='0'\t"290           "%Q='43199'\t"291           "%q='s'\t"292           "\n"),293        lfmt,294        11h + 59min + 59s);295 296  check(SV("%H='12'\t"297           "%OH='12'\t"298           "%I='12'\t"299           "%OI='12'\t"300           "%M='00'\t"301           "%OM='00'\t"302           "%S='00'\t"303           "%OS='00'\t"304#if defined(_AIX)305           "%p='PM'\t"306#else307           "%p=''\t"308#endif309           "%R='12:00'\t"310           "%T='12:00:00'\t"311#ifdef _WIN32312           "%r='12:00:00'\t"313#elif defined(_AIX)314           "%r='12:00:00 PM'\t"315#elif defined(__APPLE__) || defined(__FreeBSD__)316           "%r=''\t"317#else318           "%r='12:00:00 '\t"319#endif320           "%X='12:00:00'\t"321           "%EX='12:00:00'\t"322           "%j='0'\t"323           "%Q='12'\t"324           "%q='h'\t"325           "\n"),326        lfmt,327        12h);328 329  check(SV("%H='23'\t"330           "%OH='23'\t"331           "%I='11'\t"332           "%OI='11'\t"333           "%M='59'\t"334           "%OM='59'\t"335           "%S='59'\t"336           "%OS='59'\t"337#if defined(_AIX)338           "%p='PM'\t"339#else340           "%p=''\t"341#endif342           "%R='23:59'\t"343           "%T='23:59:59'\t"344#if defined(_AIX)345           "%r='11:59:59 PM'\t"346#elif defined(__APPLE__) || defined(__FreeBSD__)347           "%r=''\t"348#elif defined(_WIN32)349           "%r='23:59:59'\t"350#else351           "%r='11:59:59 '\t"352#endif353           "%X='23:59:59'\t"354           "%EX='23:59:59'\t"355           "%j='0'\t"356           "%Q='86399'\t"357           "%q='s'\t"358           "\n"),359        lfmt,360        23h + 59min + 59s);361 362  check(SV("%H='00'\t"363           "%OH='00'\t"364           "%I='12'\t"365           "%OI='12'\t"366           "%M='00'\t"367           "%OM='00'\t"368           "%S='00'\t"369           "%OS='00'\t"370#if defined(_AIX)371           "%p='AM'\t"372#else373           "%p=''\t"374#endif375           "%R='00:00'\t"376           "%T='00:00:00'\t"377#ifdef _WIN32378           "%r='00:00:00'\t"379#elif defined(_AIX)380           "%r='12:00:00 AM'\t"381#elif defined(__APPLE__) || defined(__FreeBSD__)382           "%r=''\t"383#elif defined(_WIN32)384           "%r='12:00:00'\t"385#else386           "%r='12:00:00 '\t"387#endif388           "%X='00:00:00'\t"389           "%EX='00:00:00'\t"390           "%j='7'\t"391           "%Q='7'\t"392           "%q='d'\t"393           "\n"),394        lfmt,395        std::chrono::duration<int, std::ratio<86400>>(7));396 397  // Use supplied locale (ja_JP). This locale has a different alternate.398#if defined(__APPLE__) || defined(_AIX) || defined(_WIN32) || defined(__FreeBSD__)399  check(loc,400        SV("%H='00'\t"401           "%OH='00'\t"402           "%I='12'\t"403           "%OI='12'\t"404           "%M='00'\t"405           "%OM='00'\t"406           "%S='00'\t"407           "%OS='00'\t"408           "%p='午前'\t"409           "%R='00:00'\t"410           "%T='00:00:00'\t"411#  if defined(__APPLE__) || defined(__FreeBSD__)412           "%r='12:00:00 午前'\t"413           "%X='00時00分00秒'\t"414           "%EX='00時00分00秒'\t"415#  elif defined(_WIN32)416           "%r='0:00:00'\t"417           "%X='0:00:00'\t"418           "%EX='0:00:00'\t"419#  else420           "%r='午前12:00:00'\t"421           "%X='00:00:00'\t"422           "%EX='00:00:00'\t"423#  endif424           "%j='0'\t"425           "%Q='0'\t"426           "%q='s'\t"427           "\n"),428        lfmt,429        0s);430 431  check(loc,432        SV("%H='11'\t"433           "%OH='11'\t"434           "%I='11'\t"435           "%OI='11'\t"436           "%M='59'\t"437           "%OM='59'\t"438           "%S='59'\t"439           "%OS='59'\t"440           "%p='午前'\t"441           "%R='11:59'\t"442           "%T='11:59:59'\t"443#  if defined(__APPLE__) || defined(__FreeBSD__)444           "%r='11:59:59 午前'\t"445           "%X='11時59分59秒'\t"446           "%EX='11時59分59秒'\t"447#  elif defined(_WIN32)448           "%r='11:59:59'\t"449           "%X='11:59:59'\t"450           "%EX='11:59:59'\t"451#  else452           "%r='午前11:59:59'\t"453           "%X='11:59:59'\t"454           "%EX='11:59:59'\t"455#  endif456           "%j='0'\t"457           "%Q='43199'\t"458           "%q='s'\t"459           "\n"),460        lfmt,461        11h + 59min + 59s);462 463  check(loc,464        SV("%H='12'\t"465           "%OH='12'\t"466           "%I='12'\t"467           "%OI='12'\t"468           "%M='00'\t"469           "%OM='00'\t"470           "%S='00'\t"471           "%OS='00'\t"472           "%p='午後'\t"473           "%R='12:00'\t"474           "%T='12:00:00'\t"475#  if defined(__APPLE__) || defined(__FreeBSD__)476           "%r='12:00:00 午後'\t"477           "%X='12時00分00秒'\t"478           "%EX='12時00分00秒'\t"479#  else480#    ifdef _WIN32481           "%r='12:00:00'\t"482#    else483           "%r='午後12:00:00'\t"484#    endif485           "%X='12:00:00'\t"486           "%EX='12:00:00'\t"487#  endif488           "%j='0'\t"489           "%Q='12'\t"490           "%q='h'\t"491           "\n"),492        lfmt,493        12h);494 495  check(loc,496        SV("%H='23'\t"497           "%OH='23'\t"498           "%I='11'\t"499           "%OI='11'\t"500           "%M='59'\t"501           "%OM='59'\t"502           "%S='59'\t"503           "%OS='59'\t"504           "%p='午後'\t"505           "%R='23:59'\t"506           "%T='23:59:59'\t"507#  if defined(__APPLE__) || defined(__FreeBSD__)508           "%r='11:59:59 午後'\t"509           "%X='23時59分59秒'\t"510           "%EX='23時59分59秒'\t"511#  else512#    ifdef _WIN32513           "%r='23:59:59'\t"514#    else515           "%r='午後11:59:59'\t"516#    endif517           "%X='23:59:59'\t"518           "%EX='23:59:59'\t"519#  endif520           "%j='0'\t"521           "%Q='86399'\t"522           "%q='s'\t"523           "\n"),524        lfmt,525        23h + 59min + 59s);526 527  check(loc,528        SV("%H='00'\t"529           "%OH='00'\t"530           "%I='12'\t"531           "%OI='12'\t"532           "%M='00'\t"533           "%OM='00'\t"534           "%S='00'\t"535           "%OS='00'\t"536           "%p='午前'\t"537           "%R='00:00'\t"538           "%T='00:00:00'\t"539#  if defined(__APPLE__) || defined(__FreeBSD__)540           "%r='12:00:00 午前'\t"541           "%X='00時00分00秒'\t"542           "%EX='00時00分00秒'\t"543#  elif defined(_WIN32)544           "%r='0:00:00'\t"545           "%X='0:00:00'\t"546           "%EX='0:00:00'\t"547#  else548           "%r='午前12:00:00'\t"549           "%X='00:00:00'\t"550           "%EX='00:00:00'\t"551#  endif552           "%j='7'\t"553           "%Q='7'\t"554           "%q='d'\t"555           "\n"),556        lfmt,557        std::chrono::duration<int, std::ratio<86400>>(7));558#else  // defined(__APPLE__) || defined(_AIX) || defined(_WIN32)559  check(loc,560        SV("%H='00'\t"561           "%OH='〇'\t"562           "%I='12'\t"563           "%OI='十二'\t"564           "%M='00'\t"565           "%OM='〇'\t"566           "%S='00'\t"567           "%OS='〇'\t"568           "%p='午前'\t"569           "%R='00:00'\t"570           "%T='00:00:00'\t"571           "%r='午前12時00分00秒'\t"572           "%X='00時00分00秒'\t"573           "%EX='00時00分00秒'\t"574           "%j='0'\t"575           "%Q='0'\t"576           "%q='s'\t"577           "\n"),578        lfmt,579        0s);580 581  check(loc,582        SV("%H='11'\t"583           "%OH='十一'\t"584           "%I='11'\t"585           "%OI='十一'\t"586           "%M='59'\t"587           "%OM='五十九'\t"588           "%S='59'\t"589           "%OS='五十九'\t"590           "%p='午前'\t"591           "%R='11:59'\t"592           "%T='11:59:59'\t"593           "%r='午前11時59分59秒'\t"594           "%X='11時59分59秒'\t"595           "%EX='11時59分59秒'\t"596           "%j='0'\t"597           "%Q='43199'\t"598           "%q='s'\t"599           "\n"),600        lfmt,601        11h + 59min + 59s);602 603  check(loc,604        SV("%H='12'\t"605           "%OH='十二'\t"606           "%I='12'\t"607           "%OI='十二'\t"608           "%M='00'\t"609           "%OM='〇'\t"610           "%S='00'\t"611           "%OS='〇'\t"612           "%p='午後'\t"613           "%R='12:00'\t"614           "%T='12:00:00'\t"615           "%r='午後12時00分00秒'\t"616           "%X='12時00分00秒'\t"617           "%EX='12時00分00秒'\t"618           "%j='0'\t"619           "%Q='12'\t"620           "%q='h'\t"621           "\n"),622        lfmt,623        12h);624 625  check(loc,626        SV("%H='23'\t"627           "%OH='二十三'\t"628           "%I='11'\t"629           "%OI='十一'\t"630           "%M='59'\t"631           "%OM='五十九'\t"632           "%S='59'\t"633           "%OS='五十九'\t"634           "%p='午後'\t"635           "%R='23:59'\t"636           "%T='23:59:59'\t"637           "%r='午後11時59分59秒'\t"638           "%X='23時59分59秒'\t"639           "%EX='23時59分59秒'\t"640           "%j='0'\t"641           "%Q='86399'\t"642           "%q='s'\t"643           "\n"),644        lfmt,645        23h + 59min + 59s);646 647  check(loc,648        SV("%H='00'\t"649           "%OH='〇'\t"650           "%I='12'\t"651           "%OI='十二'\t"652           "%M='00'\t"653           "%OM='〇'\t"654           "%S='00'\t"655           "%OS='〇'\t"656           "%p='午前'\t"657           "%R='00:00'\t"658           "%T='00:00:00'\t"659           "%r='午前12時00分00秒'\t"660           "%X='00時00分00秒'\t"661           "%EX='00時00分00秒'\t"662           "%j='7'\t"663           "%Q='7'\t"664           "%q='d'\t"665           "\n"),666        lfmt,667        std::chrono::duration<int, std::ratio<86400>>(7));668#endif // defined(__APPLE__) || defined(_AIX) || defined(_WIN32)669 670  std::locale::global(std::locale::classic());671}672 673template <class CharT>674static void test_valid_negative_integral_values() {675  // [time.format]/4 The result of formatting a std::chrono::duration instance676  // holding a negative value, or an hh_mm_ss object h for which677  // h.is_negative() is true, is equivalent to the output of the corresponding678  // positive value, with a STATICALLY-WIDEN<charT>("-") character sequence679  // placed before the replacement of the initial conversion specifier.680  //681  // Note in this case %% is the initial conversion specifier.682  using namespace std::literals::chrono_literals;683 684  constexpr std::basic_string_view<CharT> fmt = SV(685      "{:"686      "%%H='%H'%t"687      "%%OH='%OH'%t"688      "%%I='%I'%t"689      "%%OI='%OI'%t"690      "%%M='%M'%t"691      "%%OM='%OM'%t"692      "%%S='%S'%t"693      "%%OS='%OS'%t"694      "%%p='%p'%t"695      "%%R='%R'%t"696      "%%T='%T'%t"697      "%%r='%r'%t"698      "%%X='%X'%t"699      "%%EX='%EX'%t"700      "%%j='%j'%t"701      "%%Q='%Q'%t"702      "%%q='%q'%t"703      "%n}");704  constexpr std::basic_string_view<CharT> lfmt = SV(705      "{:L"706      "%%H='%H'%t"707      "%%OH='%OH'%t"708      "%%I='%I'%t"709      "%%OI='%OI'%t"710      "%%M='%M'%t"711      "%%OM='%OM'%t"712      "%%S='%S'%t"713      "%%OS='%OS'%t"714      "%%p='%p'%t"715      "%%R='%R'%t"716      "%%T='%T'%t"717      "%%r='%r'%t"718      "%%X='%X'%t"719      "%%EX='%EX'%t"720      "%%j='%j'%t"721      "%%Q='%Q'%t"722      "%%q='%q'%t"723      "%n}");724 725  const std::locale loc(LOCALE_ja_JP_UTF_8);726  std::locale::global(std::locale(LOCALE_fr_FR_UTF_8));727 728  // Non localized output using C-locale729  check(SV("-%H='23'\t"730           "%OH='23'\t"731           "%I='11'\t"732           "%OI='11'\t"733           "%M='59'\t"734           "%OM='59'\t"735           "%S='59'\t"736           "%OS='59'\t"737           "%p='PM'\t"738           "%R='23:59'\t"739           "%T='23:59:59'\t"740           "%r='11:59:59 PM'\t"741           "%X='23:59:59'\t"742           "%EX='23:59:59'\t"743           "%j='0'\t"744           "%Q='86399'\t"745           "%q='s'\t"746           "\n"),747        fmt,748        -(23h + 59min + 59s));749 750  // Use the global locale (fr_FR)751  check(SV("-%H='23'\t"752           "%OH='23'\t"753           "%I='11'\t"754           "%OI='11'\t"755           "%M='59'\t"756           "%OM='59'\t"757           "%S='59'\t"758           "%OS='59'\t"759#if defined(_AIX)760           "%p='PM'\t"761#else762           "%p=''\t"763#endif764           "%R='23:59'\t"765           "%T='23:59:59'\t"766#if defined(_AIX)767           "%r='11:59:59 PM'\t"768#elif defined(__APPLE__) || defined(__FreeBSD__)769           "%r=''\t"770#elif defined(_WIN32)771           "%r='23:59:59'\t"772#else773           "%r='11:59:59 '\t"774#endif775           "%X='23:59:59'\t"776           "%EX='23:59:59'\t"777           "%j='0'\t"778           "%Q='86399'\t"779           "%q='s'\t"780           "\n"),781        lfmt,782        -(23h + 59min + 59s));783 784  // Use supplied locale (ja_JP). This locale has a different alternate.785#if defined(__APPLE__) || defined(_AIX) || defined(_WIN32) || defined(__FreeBSD__)786  check(loc,787        SV("-%H='23'\t"788           "%OH='23'\t"789           "%I='11'\t"790           "%OI='11'\t"791           "%M='59'\t"792           "%OM='59'\t"793           "%S='59'\t"794           "%OS='59'\t"795           "%p='午後'\t"796           "%R='23:59'\t"797           "%T='23:59:59'\t"798#  if defined(__APPLE__) || defined(__FreeBSD__)799           "%r='11:59:59 午後'\t"800           "%X='23時59分59秒'\t"801           "%EX='23時59分59秒'\t"802#  elif defined(_WIN32)803           "%r='23:59:59'\t"804           "%X='23:59:59'\t"805           "%EX='23:59:59'\t"806#  else807           "%r='午後11:59:59'\t"808           "%X='23:59:59'\t"809           "%EX='23:59:59'\t"810#  endif811           "%j='0'\t"812           "%Q='86399'\t"813           "%q='s'\t"814           "\n"),815        lfmt,816        -(23h + 59min + 59s));817#else  // defined(__APPLE__) || defined(_AIX) || defined(_WIN32)|| defined(__FreeBSD__)818  check(loc,819        SV("-%H='23'\t"820           "%OH='二十三'\t"821           "%I='11'\t"822           "%OI='十一'\t"823           "%M='59'\t"824           "%OM='五十九'\t"825           "%S='59'\t"826           "%OS='五十九'\t"827           "%p='午後'\t"828           "%R='23:59'\t"829           "%T='23:59:59'\t"830           "%r='午後11時59分59秒'\t"831           "%X='23時59分59秒'\t"832           "%EX='23時59分59秒'\t"833           "%j='0'\t"834           "%Q='86399'\t"835           "%q='s'\t"836           "\n"),837        lfmt,838        -(23h + 59min + 59s));839#endif // defined(__APPLE__) || defined(_AIX) || defined(_WIN32)|| defined(__FreeBSD__)840  std::locale::global(std::locale::classic());841}842 843template <class CharT>844static void test_valid_fractional_values() {845  using namespace std::literals::chrono_literals;846 847  const std::locale loc(LOCALE_ja_JP_UTF_8);848  std::locale::global(std::locale(LOCALE_fr_FR_UTF_8));849 850  // Non localized output using C-locale851  check(SV("00.000000001"), SV("{:%S}"), 1ns);852  check(SV("00.000000501"), SV("{:%S}"), 501ns);853  check(SV("00.000001000"), SV("{:%S}"), 1000ns);854  check(SV("00.000000000001"), SV("{:%S}"), std::chrono::duration<int, std::pico>(1));855  check(SV("00.000000000000001"), SV("{:%S}"), std::chrono::duration<int, std::femto>(1));856  check(SV("00.000000000000000001"), SV("{:%S}"), std::chrono::duration<int, std::atto>(1));857 858  check(SV("00.001"), SV("{:%S}"), 1ms);859  check(SV("00.01"), SV("{:%S}"), std::chrono::duration<int, std::centi>(1));860  check(SV("00.1"), SV("{:%S}"), std::chrono::duration<int, std::deci>(1));861  check(SV("01.1"), SV("{:%S}"), std::chrono::duration<int, std::deci>(11));862 863  check(SV("00.001"), SV("{:%S}"), std::chrono::duration<float, std::milli>(1.123456789));864  check(SV("00.011"), SV("{:%S}"), std::chrono::duration<double, std::milli>(11.123456789));865  check(SV("01"), SV("{:%S}"), std::chrono::duration<long double>(61.123456789));866 867  check(SV("00.000000001"), SV("{:%OS}"), 1ns);868  check(SV("00.000000501"), SV("{:%OS}"), 501ns);869  check(SV("00.000001000"), SV("{:%OS}"), 1000ns);870  check(SV("00.000000000001"), SV("{:%OS}"), std::chrono::duration<int, std::pico>(1));871  check(SV("00.000000000000001"), SV("{:%OS}"), std::chrono::duration<int, std::femto>(1));872  check(SV("00.000000000000000001"), SV("{:%OS}"), std::chrono::duration<int, std::atto>(1));873 874  check(SV("00.001"), SV("{:%OS}"), 1ms);875  check(SV("00.01"), SV("{:%OS}"), std::chrono::duration<int, std::centi>(1));876  check(SV("00.1"), SV("{:%OS}"), std::chrono::duration<int, std::deci>(1));877  check(SV("01.1"), SV("{:%OS}"), std::chrono::duration<int, std::deci>(11));878 879  check(SV("00.001"), SV("{:%OS}"), std::chrono::duration<float, std::milli>(1.123456789));880  check(SV("00.011"), SV("{:%OS}"), std::chrono::duration<double, std::milli>(11.123456789));881  check(SV("01"), SV("{:%OS}"), std::chrono::duration<long double>(61.123456789));882 883  check(SV("01:05:06.000000001"), SV("{:%T}"), 1h + 5min + 6s + 1ns);884  check(SV("01:05:06.000000501"), SV("{:%T}"), 1h + 5min + 6s + 501ns);885  check(SV("01:05:06.000001000"), SV("{:%T}"), 1h + 5min + 6s + 1000ns);886 887  check(SV("01:05:06.001"), SV("{:%T}"), 1h + 5min + 6s + 1ms);888  check(SV("01:05:06.01"), SV("{:%T}"), 1h + 5min + 6s + std::chrono::duration<int, std::centi>(1));889  check(SV("01:05:06.1"), SV("{:%T}"), 1h + 5min + 6s + std::chrono::duration<int, std::deci>(1));890  check(SV("01:05:07.1"), SV("{:%T}"), 1h + 5min + 6s + std::chrono::duration<int, std::deci>(11));891 892  check(893      SV("00:01:02"), SV("{:%T}"), std::chrono::duration<float, std::ratio<60>>(1) + std::chrono::duration<float>(2.5));894  check(SV("01:05:11"),895        SV("{:%T}"),896        std::chrono::duration<double, std::ratio<3600>>(1) + std::chrono::duration<double, std::ratio<60>>(5) +897            std::chrono::duration<double>(11.123456789));898  check(SV("01:06:01"),899        SV("{:%T}"),900        std::chrono::duration<long double, std::ratio<3600>>(1) +901            std::chrono::duration<long double, std::ratio<60>>(5) + std::chrono::duration<long double>(61.123456789));902 903  check(SV("0"), SV("{:%j}"), std::chrono::duration<float, std::milli>(1.));904  check(SV("1"), SV("{:%j}"), std::chrono::duration<double, std::milli>(86'400'000));905  check(SV("1"), SV("{:%j}"), std::chrono::duration<long double, std::ratio<7 * 24 * 3600>>(0.14285714286));906 907  check(SV("1000000"), SV("{:%Q}"), 1'000'000s);908  check(SV("1"), SV("{:%Q}"), std::chrono::duration<float, std::milli>(1.));909  check(SV("1.123456789"), SV("{:.6%Q}"), std::chrono::duration<double, std::milli>(1.123456789));910  check(SV("1.123456789"), SV("{:.9%Q}"), std::chrono::duration<long double, std::milli>(1.123456789));911 912  // Use the global locale (fr_FR)913  check(SV("00,000000001"), SV("{:L%S}"), 1ns);914  check(SV("00,000000501"), SV("{:L%S}"), 501ns);915  check(SV("00,000001000"), SV("{:L%S}"), 1000ns);916  check(SV("00,000000000001"), SV("{:L%S}"), std::chrono::duration<int, std::pico>(1));917  check(SV("00,000000000000001"), SV("{:L%S}"), std::chrono::duration<int, std::femto>(1));918  check(SV("00,000000000000000001"), SV("{:L%S}"), std::chrono::duration<int, std::atto>(1));919 920  check(SV("00,001"), SV("{:L%S}"), 1ms);921  check(SV("00,01"), SV("{:L%S}"), std::chrono::duration<int, std::centi>(1));922  check(SV("00,1"), SV("{:L%S}"), std::chrono::duration<int, std::deci>(1));923  check(SV("01,1"), SV("{:L%S}"), std::chrono::duration<int, std::deci>(11));924 925  check(SV("00,001"), SV("{:L%S}"), std::chrono::duration<float, std::milli>(1.123456789));926  check(SV("00,011"), SV("{:L%S}"), std::chrono::duration<double, std::milli>(11.123456789));927  check(SV("01"), SV("{:L%S}"), std::chrono::duration<long double>(61.123456789));928 929  check(SV("00,000000001"), SV("{:L%OS}"), 1ns);930  check(SV("00,000000501"), SV("{:L%OS}"), 501ns);931  check(SV("00,000001000"), SV("{:L%OS}"), 1000ns);932  check(SV("00,000000000001"), SV("{:L%OS}"), std::chrono::duration<int, std::pico>(1));933  check(SV("00,000000000000001"), SV("{:L%OS}"), std::chrono::duration<int, std::femto>(1));934  check(SV("00,000000000000000001"), SV("{:L%OS}"), std::chrono::duration<int, std::atto>(1));935 936  check(SV("00,001"), SV("{:L%OS}"), 1ms);937  check(SV("00,01"), SV("{:L%OS}"), std::chrono::duration<int, std::centi>(1));938  check(SV("00,1"), SV("{:L%OS}"), std::chrono::duration<int, std::deci>(1));939  check(SV("01,1"), SV("{:L%OS}"), std::chrono::duration<int, std::deci>(11));940 941  check(SV("00,001"), SV("{:L%OS}"), std::chrono::duration<float, std::milli>(1.123456789));942  check(SV("00,011"), SV("{:L%OS}"), std::chrono::duration<double, std::milli>(11.123456789));943  check(SV("01"), SV("{:L%OS}"), std::chrono::duration<long double>(61.123456789));944 945  check(SV("01:05:06,000000001"), SV("{:L%T}"), 1h + 5min + 6s + 1ns);946  check(SV("01:05:06,000000501"), SV("{:L%T}"), 1h + 5min + 6s + 501ns);947  check(SV("01:05:06,000001000"), SV("{:L%T}"), 1h + 5min + 6s + 1000ns);948 949  check(SV("01:05:06,001"), SV("{:L%T}"), 1h + 5min + 6s + 1ms);950  check(SV("01:05:06,01"), SV("{:L%T}"), 1h + 5min + 6s + std::chrono::duration<int, std::centi>(1));951  check(SV("01:05:06,1"), SV("{:L%T}"), 1h + 5min + 6s + std::chrono::duration<int, std::deci>(1));952  check(SV("01:05:07,1"), SV("{:L%T}"), 1h + 5min + 6s + std::chrono::duration<int, std::deci>(11));953 954  check(SV("00:01:02"),955        SV("{:L%T}"),956        std::chrono::duration<float, std::ratio<60>>(1) + std::chrono::duration<float>(2.5));957  check(SV("01:05:11"),958        SV("{:L%T}"),959        std::chrono::duration<double, std::ratio<3600>>(1) + std::chrono::duration<double, std::ratio<60>>(5) +960            std::chrono::duration<double>(11.123456789));961  check(SV("01:06:01"),962        SV("{:L%T}"),963        std::chrono::duration<long double, std::ratio<3600>>(1) +964            std::chrono::duration<long double, std::ratio<60>>(5) + std::chrono::duration<long double>(61.123456789));965 966  check(SV("0"), SV("{:L%j}"), std::chrono::duration<float, std::milli>(1.));967  check(SV("1"), SV("{:L%j}"), std::chrono::duration<double, std::milli>(86'400'000));968  check(SV("1"), SV("{:L%j}"), std::chrono::duration<long double, std::ratio<7 * 24 * 3600>>(0.14285714286));969 970  check(SV("1000000"), SV("{:L%Q}"), 1'000'000s); // The Standard mandates not localized.971  check(SV("1"), SV("{:L%Q}"), std::chrono::duration<float, std::milli>(1.));972  check(SV("1.123456789"), SV("{:.6L%Q}"), std::chrono::duration<double, std::milli>(1.123456789));973  check(SV("1.123456789"), SV("{:.9L%Q}"), std::chrono::duration<long double, std::milli>(1.123456789));974 975  // Use supplied locale (ja_JP). This locale has a different alternate.976  check(loc, SV("00.000000001"), SV("{:L%S}"), 1ns);977  check(loc, SV("00.000000501"), SV("{:L%S}"), 501ns);978  check(loc, SV("00.000001000"), SV("{:L%S}"), 1000ns);979  check(loc, SV("00.000000000001"), SV("{:L%S}"), std::chrono::duration<int, std::pico>(1));980  check(loc, SV("00.000000000000001"), SV("{:L%S}"), std::chrono::duration<int, std::femto>(1));981  check(loc, SV("00.000000000000000001"), SV("{:L%S}"), std::chrono::duration<int, std::atto>(1));982 983  check(loc, SV("00.001"), SV("{:L%S}"), 1ms);984  check(loc, SV("00.01"), SV("{:L%S}"), std::chrono::duration<int, std::centi>(1));985  check(loc, SV("00.1"), SV("{:L%S}"), std::chrono::duration<int, std::deci>(1));986  check(loc, SV("01.1"), SV("{:L%S}"), std::chrono::duration<int, std::deci>(11));987 988  check(loc, SV("00.001"), SV("{:L%S}"), std::chrono::duration<float, std::milli>(1.123456789));989  check(loc, SV("00.011"), SV("{:L%S}"), std::chrono::duration<double, std::milli>(11.123456789));990  check(loc, SV("01"), SV("{:L%S}"), std::chrono::duration<long double>(61.123456789));991 992#if defined(__APPLE__) || defined(_AIX) || defined(_WIN32) || defined(__FreeBSD__)993 994  check(SV("00.000000001"), SV("{:%OS}"), 1ns);995  check(SV("00.000000501"), SV("{:%OS}"), 501ns);996  check(SV("00.000001000"), SV("{:%OS}"), 1000ns);997  check(SV("00.000000000001"), SV("{:%OS}"), std::chrono::duration<int, std::pico>(1));998  check(SV("00.000000000000001"), SV("{:%OS}"), std::chrono::duration<int, std::femto>(1));999  check(SV("00.000000000000000001"), SV("{:%OS}"), std::chrono::duration<int, std::atto>(1));1000 1001  check(SV("00.001"), SV("{:%OS}"), 1ms);1002  check(SV("00.01"), SV("{:%OS}"), std::chrono::duration<int, std::centi>(1));1003  check(SV("00.1"), SV("{:%OS}"), std::chrono::duration<int, std::deci>(1));1004  check(SV("01.1"), SV("{:%OS}"), std::chrono::duration<int, std::deci>(11));1005 1006  check(SV("00.001"), SV("{:%OS}"), std::chrono::duration<float, std::milli>(1.123456789));1007  check(SV("00.011"), SV("{:%OS}"), std::chrono::duration<double, std::milli>(11.123456789));1008  check(SV("01"), SV("{:%OS}"), std::chrono::duration<long double>(61.123456789));1009#else  // defined(__APPLE__) || defined(_AIX) || defined(_WIN32)|| defined(__FreeBSD__)1010 1011  check(loc, SV("〇.000000001"), SV("{:L%OS}"), 1ns);1012  check(loc, SV("〇.000000501"), SV("{:L%OS}"), 501ns);1013  check(loc, SV("〇.000001000"), SV("{:L%OS}"), 1000ns);1014  check(loc, SV("〇.000000000001"), SV("{:L%OS}"), std::chrono::duration<int, std::pico>(1));1015  check(loc, SV("〇.000000000000001"), SV("{:L%OS}"), std::chrono::duration<int, std::femto>(1));1016  check(loc, SV("〇.000000000000000001"), SV("{:L%OS}"), std::chrono::duration<int, std::atto>(1));1017 1018  check(loc, SV("〇.001"), SV("{:L%OS}"), 1ms);1019  check(loc, SV("〇.01"), SV("{:L%OS}"), std::chrono::duration<int, std::centi>(1));1020  check(loc, SV("〇.1"), SV("{:L%OS}"), std::chrono::duration<int, std::deci>(1));1021  check(loc, SV("一.1"), SV("{:L%OS}"), std::chrono::duration<int, std::deci>(11));1022 1023  check(loc, SV("〇.001"), SV("{:L%OS}"), std::chrono::duration<float, std::milli>(1.123456789));1024  check(loc, SV("〇.011"), SV("{:L%OS}"), std::chrono::duration<double, std::milli>(11.123456789));1025  check(loc, SV("一"), SV("{:L%OS}"), std::chrono::duration<long double>(61.123456789));1026#endif // defined(__APPLE__) || defined(_AIX) || defined(_WIN32)|| defined(__FreeBSD__)1027 1028  check(loc, SV("01:05:06.000000001"), SV("{:L%T}"), 1h + 5min + 6s + 1ns);1029  check(loc, SV("01:05:06.000000501"), SV("{:L%T}"), 1h + 5min + 6s + 501ns);1030  check(loc, SV("01:05:06.000001000"), SV("{:L%T}"), 1h + 5min + 6s + 1000ns);1031 1032  check(loc, SV("01:05:06.001"), SV("{:L%T}"), 1h + 5min + 6s + 1ms);1033  check(loc, SV("01:05:06.01"), SV("{:L%T}"), 1h + 5min + 6s + std::chrono::duration<int, std::centi>(1));1034  check(loc, SV("01:05:06.1"), SV("{:L%T}"), 1h + 5min + 6s + std::chrono::duration<int, std::deci>(1));1035  check(loc, SV("01:05:07.1"), SV("{:L%T}"), 1h + 5min + 6s + std::chrono::duration<int, std::deci>(11));1036 1037  check(loc,1038        SV("00:01:02"),1039        SV("{:L%T}"),1040        std::chrono::duration<float, std::ratio<60>>(1) + std::chrono::duration<float>(2.5));1041  check(loc,1042        SV("01:05:11"),1043        SV("{:L%T}"),1044        std::chrono::duration<double, std::ratio<3600>>(1) + std::chrono::duration<double, std::ratio<60>>(5) +1045            std::chrono::duration<double>(11.123456789));1046  check(loc,1047        SV("01:06:01"),1048        SV("{:L%T}"),1049        std::chrono::duration<long double, std::ratio<3600>>(1) +1050            std::chrono::duration<long double, std::ratio<60>>(5) + std::chrono::duration<long double>(61.123456789));1051 1052  check(loc, SV("0"), SV("{:L%j}"), std::chrono::duration<float, std::milli>(1.));1053  check(loc, SV("1"), SV("{:L%j}"), std::chrono::duration<double, std::milli>(86'400'000));1054  check(loc, SV("1"), SV("{:L%j}"), std::chrono::duration<long double, std::ratio<7 * 24 * 3600>>(0.14285714286));1055 1056  check(loc, SV("1000000"), SV("{:L%Q}"), 1'000'000s); // The Standard mandates not localized.1057  check(loc, SV("1"), SV("{:L%Q}"), std::chrono::duration<float, std::milli>(1.));1058  check(loc, SV("1.123456789"), SV("{:.6L%Q}"), std::chrono::duration<double, std::milli>(1.123456789));1059  check(loc, SV("1.123456789"), SV("{:.9L%Q}"), std::chrono::duration<long double, std::milli>(1.123456789));1060 1061  std::locale::global(std::locale::classic());1062}1063 1064template <class CharT>1065static void test_valid_values() {1066  test_valid_positive_integral_values<CharT>();1067  test_valid_negative_integral_values<CharT>();1068  test_valid_fractional_values<CharT>();1069}1070 1071template <class CharT>1072static void test_pr62082() {1073  // Examples in https://llvm.org/PR620821074  check(SV("39.223300"), SV("{:%S}"), std::chrono::duration<int, std::ratio<101, 103>>{40});1075  check(SV("01.4755859375"), SV("{:%S}"), std::chrono::duration<int, std::ratio<1, 1024>>{1511});1076 1077  // Test with all possible number of decimals [0, 18]. When it does not1078  // fit in 18 decimals it uses 6.1079  check(SV("05"), SV("{:%S}"), std::chrono::duration<float, std::ratio<1, 1>>{5}); // 01080 1081  check(SV("05.0"), SV("{:%S}"), std::chrono::duration<float, std::ratio<1, 2>>{10}); // 11082  check(SV("05.5"), SV("{:%S}"), std::chrono::duration<int, std::ratio<1, 2>>{11});   // 11083 1084  check(SV("01.00"), SV("{:%S}"), std::chrono::duration<int, std::ratio<1, 4>>{4});         // 21085  check(SV("01.50"), SV("{:%S}"), std::chrono::duration<double, std::ratio<1, 4>>{6});      // 21086  check(SV("01.75"), SV("{:%S}"), std::chrono::duration<long double, std::ratio<1, 4>>{7}); // 21087 1088  check(SV("01.000"), SV("{:%S}"), std::chrono::duration<int, std::ratio<1, 8>>{8});                          // 31089  check(SV("01.0000"), SV("{:%S}"), std::chrono::duration<int, std::ratio<1, 16>>{16});                       // 41090  check(SV("01.00000"), SV("{:%S}"), std::chrono::duration<int, std::ratio<1, 32>>{32});                      // 51091  check(SV("01.000000"), SV("{:%S}"), std::chrono::duration<int, std::ratio<1, 64>>{64});                     // 61092  check(SV("01.0000000"), SV("{:%S}"), std::chrono::duration<int, std::ratio<1, 128>>{128});                  // 71093  check(SV("01.00000000"), SV("{:%S}"), std::chrono::duration<int, std::ratio<1, 256>>{256});                 // 81094  check(SV("01.000000000"), SV("{:%S}"), std::chrono::duration<int, std::ratio<1, 512>>{512});                // 91095  check(SV("01.0000000000"), SV("{:%S}"), std::chrono::duration<int, std::ratio<1, 1024>>{1024});             // 101096  check(SV("01.00000000000"), SV("{:%S}"), std::chrono::duration<int, std::ratio<1, 2048>>{2048});            // 111097  check(SV("01.000000000000"), SV("{:%S}"), std::chrono::duration<int, std::ratio<1, 4096>>{4096});           // 121098  check(SV("01.0000000000000"), SV("{:%S}"), std::chrono::duration<int, std::ratio<1, 8192>>{8192});          // 131099  check(SV("01.00000000000000"), SV("{:%S}"), std::chrono::duration<int, std::ratio<1, 16384>>{16384});       // 141100  check(SV("01.000000000000000"), SV("{:%S}"), std::chrono::duration<int, std::ratio<1, 32768>>{32768});      // 151101  check(SV("01.0000000000000000"), SV("{:%S}"), std::chrono::duration<int, std::ratio<1, 65536>>{65536});     // 161102  check(SV("01.00000000000000000"), SV("{:%S}"), std::chrono::duration<int, std::ratio<1, 131072>>{131072});  // 171103  check(SV("01.000000000000000000"), SV("{:%S}"), std::chrono::duration<int, std::ratio<1, 262144>>{262144}); // 181104  check(SV("01.000000"), SV("{:%S}"), std::chrono::duration<int, std::ratio<1, 524288>>{524288});             // 19 -> 61105 1106  // Infinite number of decimals will use 6 decimals.1107  check(SV("00.111111"), SV("{:%S}"), std::chrono::duration<int, std::ratio<1, 9>>{1});1108  check(SV("00.111111"), SV("{:%S}"), std::chrono::duration<float, std::ratio<1, 9>>{1});1109  check(SV("00.111111"), SV("{:%S}"), std::chrono::duration<double, std::ratio<1, 9>>{1});1110  check(SV("00.111111"), SV("{:%S}"), std::chrono::duration<long double, std::ratio<1, 9>>{1});1111}1112 1113template <class CharT>1114static void test_unsigned_duration() {1115  // Reported in https://llvm.org/PR968201116  using namespace std::literals::chrono_literals;1117 1118  check(SV("1as"), SV("{}"), std::chrono::duration<unsigned short, std::atto>(1));1119  check(SV("1fs"), SV("{}"), std::chrono::duration<unsigned, std::femto>(1));1120  check(SV("1ps"), SV("{}"), std::chrono::duration<unsigned long, std::pico>(1));1121  check(SV("1ns"), SV("{}"), std::chrono::duration<unsigned long long, std::nano>(1));1122}1123 1124template <class CharT>1125static void test() {1126  using namespace std::literals::chrono_literals;1127 1128  test_no_chrono_specs<CharT>();1129  test_valid_values<CharT>();1130  test_unsigned_duration<CharT>();1131  test_pr62082<CharT>();1132 1133  check_invalid_types<CharT>(1134      {SV("H"), SV("I"), SV("j"), SV("M"), SV("n"), SV("O"),  SV("p"),  SV("q"),  SV("Q"),  SV("r"),1135       SV("R"), SV("S"), SV("t"), SV("T"), SV("X"), SV("EX"), SV("OH"), SV("OI"), SV("OM"), SV("OS")},1136      0ms);1137 1138  check_exception("The format specifier expects a '%' or a '}'", SV("{:A"), 0ms);1139  check_exception("The chrono specifiers contain a '{'", SV("{:%%{"), 0ms);1140  check_exception("End of input while parsing a conversion specifier", SV("{:%"), 0ms);1141  check_exception("End of input while parsing the modifier E", SV("{:%E"), 0ms);1142  check_exception("End of input while parsing the modifier O", SV("{:%O"), 0ms);1143 1144  // Make sure the required values work, based on their minimum number of required bits per [time.syn].1145  check(SV("23:47:16.854775807"),1146        SV("{:%T}"),1147        std::chrono::nanoseconds{0x7fff'ffff'ffff'ffffll}); // 64 bit signed value max1148  check(SV("23:35:09.481983"),1149        SV("{:%T}"),1150        std::chrono::microseconds{0x003f'ffff'ffff'ffffll});                                 // 55 bit signed value max1151  check(SV("06:20:44.415"), SV("{:%T}"), std::chrono::milliseconds{0x0000'fff'ffff'ffffll}); // 45 bit signed value max1152  check(SV("01:53:03"), SV("{:%T}"), std::chrono::seconds{0x0000'0003'ffff'ffffll});         // 35 bit signed value max1153  check(SV("12:15:00"), SV("{:%T}"), std::chrono::minutes{0x0fff'ffff});                     // 29 bit signed value max1154  check(SV("15:00:00"), SV("{:%T}"), std::chrono::hours{0x003f'ffff});                       // 23 bit signed value max1155  check(SV("00:00:00"), SV("{:%T}"), std::chrono::days{0x0ff'ffff});                         // 25 bit signed value max1156  check(SV("00:00:00"), SV("{:%T}"), std::chrono::weeks{0x003f'ffff});                       // 22 bit signed value max1157  check(SV("21:11:42"), SV("{:%T}"), std::chrono::months{0x0007'ffff});                      // 20 bit signed value max1158  check(SV("05:42:00"), SV("{:%T}"), std::chrono::years{0xffff});                            // 17 bit signed value max1159 1160  // Precision not allowed1161  check_exception("The format specifier expects a '%' or a '}'", SV("{:.3}"), 0ms);1162}1163 1164int main(int, char**) {1165  test<char>();1166 1167#ifndef TEST_HAS_NO_WIDE_CHARACTERS1168  test<wchar_t>();1169#endif1170 1171  return 0;1172}1173