991 lines · cpp
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-exception5//6//===----------------------------------------------------------------------===//7 8// REQUIRES: std-at-least-c++209// UNSUPPORTED: no-filesystem, no-localization, no-tzdb10// UNSUPPORTED: GCC-ALWAYS_INLINE-FIXME11 12// TODO FMT This test should not require std::to_chars(floating-point)13// XFAIL: availability-fp_to_chars-missing14 15// XFAIL: libcpp-has-no-experimental-tzdb16// XFAIL: availability-tzdb-missing17 18// REQUIRES: locale.fr_FR.UTF-819// REQUIRES: locale.ja_JP.UTF-820 21// <chrono>22 23// template<class Duration, class charT>24// struct formatter<chrono::gps_time<Duration>, charT>;25 26#include <chrono>27#include <format>28 29#include <cassert>30#include <concepts>31#include <locale>32#include <iostream>33#include <type_traits>34 35#include "formatter_tests.h"36#include "make_string.h"37#include "platform_support.h" // locale name macros38#include "test_macros.h"39 40template <class CharT>41static void test_no_chrono_specs() {42 using namespace std::literals::chrono_literals;43 namespace cr = std::chrono;44 45 std::locale::global(std::locale(LOCALE_fr_FR_UTF_8));46 47 // Non localized output48 49 // [time.syn]50 // using nanoseconds = duration<signed integer type of at least 64 bits, nano>;51 // using microseconds = duration<signed integer type of at least 55 bits, micro>;52 // using milliseconds = duration<signed integer type of at least 45 bits, milli>;53 // using seconds = duration<signed integer type of at least 35 bits>;54 // using minutes = duration<signed integer type of at least 29 bits, ratio< 60>>;55 // using hours = duration<signed integer type of at least 23 bits, ratio<3600>>;56 check(SV("1435-08-09 22:07:05"), SV("{}"), cr::gps_seconds(-17'179'869'184s)); // Minimum value for 35 bits.57 check(SV("1911-12-18 20:46:01"), SV("{}"), cr::gps_seconds(-2'147'483'648s));58 59 check(SV("1980-01-05 00:00:00"), SV("{}"), cr::gps_seconds(-24h));60 check(SV("1980-01-05 06:00:00"), SV("{}"), cr::gps_seconds(-18h));61 check(SV("1980-01-05 12:00:00"), SV("{}"), cr::gps_seconds(-12h));62 check(SV("1980-01-05 18:00:00"), SV("{}"), cr::gps_seconds(-6h));63 check(SV("1980-01-05 23:59:59"), SV("{}"), cr::gps_seconds(-1s));64 65 check(SV("1980-01-06 00:00:00"), SV("{}"), cr::gps_seconds(0s));66 check(SV("2010-01-04 23:59:45"), SV("{}"), cr::gps_seconds(946'684'800s));67 check(SV("2010-01-05 01:01:48"), SV("{}"), cr::gps_seconds(946'688'523s));68 69 check(SV("2048-01-24 03:13:49"), SV("{}"), cr::gps_seconds(2'147'483'647s));70 check(SV("2524-06-03 01:52:45"), SV("{}"), cr::gps_seconds(17'179'869'183s)); // Maximum value for 35 bits.71 72 check(SV("2010-01-05 01:01:48.123"), SV("{}"), cr::gps_time<cr::milliseconds>(946'688'523'123ms));73 74 std::locale::global(std::locale::classic());75}76 77template <class CharT>78static void test_valid_values_year() {79 using namespace std::literals::chrono_literals;80 namespace cr = std::chrono;81 82 constexpr std::basic_string_view<CharT> fmt =83 SV("{:%%C='%C'%t%%EC='%EC'%t%%y='%y'%t%%Oy='%Oy'%t%%Ey='%Ey'%t%%Y='%Y'%t%%EY='%EY'%n}");84 constexpr std::basic_string_view<CharT> lfmt =85 SV("{:L%%C='%C'%t%%EC='%EC'%t%%y='%y'%t%%Oy='%Oy'%t%%Ey='%Ey'%t%%Y='%Y'%t%%EY='%EY'%n}");86 87 const std::locale loc(LOCALE_ja_JP_UTF_8);88 std::locale::global(std::locale(LOCALE_fr_FR_UTF_8));89 90 // Non localized output using C-locale91 check(SV("%C='19'\t%EC='19'\t%y='80'\t%Oy='80'\t%Ey='80'\t%Y='1980'\t%EY='1980'\n"),92 fmt,93 cr::gps_seconds(0s)); // 00:00:00 GPS Sunday, 6 January 198094 95 check(SV("%C='20'\t%EC='20'\t%y='09'\t%Oy='09'\t%Ey='09'\t%Y='2009'\t%EY='2009'\n"),96 fmt,97 cr::gps_seconds(918'603'105s)); // 23:31:30 GPS Friday, 13 February 200998 99 // Use the global locale (fr_FR)100 check(SV("%C='19'\t%EC='19'\t%y='80'\t%Oy='80'\t%Ey='80'\t%Y='1980'\t%EY='1980'\n"),101 lfmt,102 cr::gps_seconds(0s)); // 00:00:00 GPS Sunday, 6 January 1980103 104 check(SV("%C='20'\t%EC='20'\t%y='09'\t%Oy='09'\t%Ey='09'\t%Y='2009'\t%EY='2009'\n"),105 lfmt,106 cr::gps_seconds(918'603'105s)); // 23:31:30 GPS Friday, 13 February 2009107 108 // Use supplied locale (ja_JP). This locale has a different alternate.109#if defined(_WIN32) || defined(__APPLE__) || defined(_AIX) || defined(__FreeBSD__)110 check(loc,111 SV("%C='19'\t%EC='19'\t%y='80'\t%Oy='80'\t%Ey='80'\t%Y='1980'\t%EY='1980'\n"),112 lfmt,113 cr::gps_seconds(0s)); // 00:00:00 GPS Sunday, 6 January 1980114 115 check(loc,116 SV("%C='20'\t%EC='20'\t%y='09'\t%Oy='09'\t%Ey='09'\t%Y='2009'\t%EY='2009'\n"),117 lfmt,118 cr::gps_seconds(918'603'105s)); // 23:31:30 GPS Friday, 13 February 2009119#else // defined(_WIN32) || defined(__APPLE__) || defined(_AIX)||defined(__FreeBSD__)120 check(loc,121 SV("%C='19'\t%EC='昭和'\t%y='80'\t%Oy='八十'\t%Ey='55'\t%Y='1980'\t%EY='昭和55年'\n"),122 lfmt,123 cr::gps_seconds(0s)); // 00:00:00 GPS Sunday, 6 January 1980124 125 check(loc,126 SV("%C='20'\t%EC='平成'\t%y='09'\t%Oy='九'\t%Ey='21'\t%Y='2009'\t%EY='平成21年'\n"),127 lfmt,128 cr::gps_seconds(918'603'105s)); // 23:31:30 GPS Friday, 13 February 2009129#endif // defined(_WIN32) || defined(__APPLE__) || defined(_AIX)||defined(__FreeBSD__)130 131 std::locale::global(std::locale::classic());132}133 134template <class CharT>135static void test_valid_values_month() {136 using namespace std::literals::chrono_literals;137 namespace cr = std::chrono;138 139 constexpr std::basic_string_view<CharT> fmt = SV("{:%%b='%b'%t%%h='%h'%t%%B='%B'%t%%m='%m'%t%%Om='%Om'%n}");140 constexpr std::basic_string_view<CharT> lfmt = SV("{:L%%b='%b'%t%%h='%h'%t%%B='%B'%t%%m='%m'%t%%Om='%Om'%n}");141 142 const std::locale loc(LOCALE_ja_JP_UTF_8);143 std::locale::global(std::locale(LOCALE_fr_FR_UTF_8));144 145 // Non localized output using C-locale146 check(SV("%b='Jan'\t%h='Jan'\t%B='January'\t%m='01'\t%Om='01'\n"),147 fmt,148 cr::gps_seconds(0s)); // 00:00:00 GPS Sunday, 6 January 1980149 150 check(SV("%b='May'\t%h='May'\t%B='May'\t%m='05'\t%Om='05'\n"),151 fmt,152 cr::gps_seconds(1'684'035'218s)); // 03:33:20 GPS on Wednesday, 18 May 2033153 154 // Use the global locale (fr_FR)155#if defined(__APPLE__)156 check(SV("%b='jan'\t%h='jan'\t%B='janvier'\t%m='01'\t%Om='01'\n"),157 lfmt,158 cr::gps_seconds(0s)); // 00:00:00 GPS Sunday, 6 January 1980159#else160 check(SV("%b='janv.'\t%h='janv.'\t%B='janvier'\t%m='01'\t%Om='01'\n"),161 lfmt,162 cr::gps_seconds(0s)); // 00:00:00 GPS Sunday, 6 January 1980163#endif164 165 check(SV("%b='mai'\t%h='mai'\t%B='mai'\t%m='05'\t%Om='05'\n"),166 lfmt,167 cr::gps_seconds(1'684'035'218s)); // 03:33:20 GPS on Wednesday, 18 May 2033168 169 // Use supplied locale (ja_JP). This locale has a different alternate.170#ifdef _WIN32171 check(loc,172 SV("%b='1'\t%h='1'\t%B='1月'\t%m='01'\t%Om='01'\n"),173 lfmt,174 cr::gps_seconds(0s)); // 00:00:00 GPS Sunday, 6 January 1980175 176 check(loc,177 SV("%b='5'\t%h='5'\t%B='5月'\t%m='05'\t%Om='05'\n"),178 lfmt,179 cr::gps_seconds(1'684'035'218s)); // 03:33:20 GPS Wednesday, 18 May 2033180#elif defined(_AIX) // _WIN32181 check(loc,182 SV("%b='1月'\t%h='1月'\t%B='1月'\t%m='01'\t%Om='01'\n"),183 lfmt,184 cr::gps_seconds(0s)); // 00:00:00 GPS Sunday, 6 January 1980185 186 check(loc,187 SV("%b='5月'\t%h='5月'\t%B='5月'\t%m='05'\t%Om='05'\n"),188 lfmt,189 cr::gps_seconds(1'684'035'218s)); // 03:33:20 GPS Wednesday, 18 May 2033190#elif defined(__APPLE__) // _WIN32191 check(loc,192 SV("%b=' 1'\t%h=' 1'\t%B='1月'\t%m='01'\t%Om='01'\n"),193 lfmt,194 cr::gps_seconds(0s)); // 00:00:00 GPS Sunday, 6 January 1980195 196 check(loc,197 SV("%b=' 5'\t%h=' 5'\t%B='5月'\t%m='05'\t%Om='05'\n"),198 lfmt,199 cr::gps_seconds(1'684'035'218s)); // 03:33:20 GPS Wednesday, 18 May 2033200#elif defined(__FreeBSD__) // _WIN32201 check(loc,202 SV("%b=' 1月'\t%h=' 1月'\t%B='1月'\t%m='01'\t%Om='01'\n"),203 lfmt,204 cr::gps_seconds(0s)); // 00:00:00 GPS Sunday, 6 January 1980205 206 check(loc,207 SV("%b=' 5月'\t%h=' 5月'\t%B='5月'\t%m='05'\t%Om='05'\n"),208 lfmt,209 cr::gps_seconds(1'684'035'218s)); // 03:33:20 GPS Wednesday, 18 May 2033210#else // _WIN32211 check(loc,212 SV("%b=' 1月'\t%h=' 1月'\t%B='1月'\t%m='01'\t%Om='一'\n"),213 lfmt,214 cr::gps_seconds(0s)); // 00:00:00 GPS Sunday, 6 January 1980215 216 check(loc,217 SV("%b=' 5月'\t%h=' 5月'\t%B='5月'\t%m='05'\t%Om='五'\n"),218 lfmt,219 cr::gps_seconds(1'684'035'218s)); // 03:33:20 GPS Wednesday, 18 May 2033220#endif // _WIN32221 222 std::locale::global(std::locale::classic());223}224 225template <class CharT>226static void test_valid_values_day() {227 using namespace std::literals::chrono_literals;228 namespace cr = std::chrono;229 230 constexpr std::basic_string_view<CharT> fmt = SV("{:%%d='%d'%t%%Od='%Od'%t%%e='%e'%t%%Oe='%Oe'%n}");231 constexpr std::basic_string_view<CharT> lfmt = SV("{:L%%d='%d'%t%%Od='%Od'%t%%e='%e'%t%%Oe='%Oe'%n}");232 233 const std::locale loc(LOCALE_ja_JP_UTF_8);234 std::locale::global(std::locale(LOCALE_fr_FR_UTF_8));235 236 // Non localized output using C-locale237 check(SV("%d='06'\t%Od='06'\t%e=' 6'\t%Oe=' 6'\n"), fmt,238 cr::gps_seconds(0s)); // 00:00:00 GPS Sunday, 6 January 1980239 240 check(SV("%d='13'\t%Od='13'\t%e='13'\t%Oe='13'\n"),241 fmt,242 cr::gps_seconds(918'603'105s)); // 23:31:30 GPS Friday, 13 February 2009243 244 // Use the global locale (fr_FR)245 check(SV("%d='06'\t%Od='06'\t%e=' 6'\t%Oe=' 6'\n"), lfmt,246 cr::gps_seconds(0s)); // 00:00:00 GPS Sunday, 6 January 1980247 248 check(SV("%d='13'\t%Od='13'\t%e='13'\t%Oe='13'\n"),249 lfmt,250 cr::gps_seconds(918'603'105s)); // 23:31:30 GPS Friday, 13 February 2009251 252 // Use the global locale (fr_FR)253 check(SV("%d='06'\t%Od='06'\t%e=' 6'\t%Oe=' 6'\n"), lfmt,254 cr::gps_seconds(0s)); // 00:00:00 GPS Sunday, 6 January 1980255 256 // Use supplied locale (ja_JP). This locale has a different alternate.257#if defined(_WIN32) || defined(__APPLE__) || defined(_AIX) || defined(__FreeBSD__)258 check(loc,259 SV("%d='06'\t%Od='06'\t%e=' 6'\t%Oe=' 6'\n"),260 lfmt,261 cr::gps_seconds(0s)); // 00:00:00 GPS Sunday, 6 January 1980262 263 check(loc,264 SV("%d='13'\t%Od='13'\t%e='13'\t%Oe='13'\n"),265 lfmt,266 cr::gps_seconds(918'603'105s)); // 23:31:30 GPS Friday, 13 February 2009267 268#else // defined(_WIN32) || defined(__APPLE__) || defined(_AIX) || defined(__FreeBSD__)269 check(loc,270 SV("%d='06'\t%Od='六'\t%e=' 6'\t%Oe='六'\n"),271 lfmt,272 cr::gps_seconds(0s)); // 00:00:00 GPS Sunday, 6 January 1980273 274 check(loc,275 SV("%d='13'\t%Od='十三'\t%e='13'\t%Oe='十三'\n"),276 lfmt,277 cr::gps_seconds(918'603'105s)); // 23:31:30 GPS Friday, 13 February 2009278 279#endif // defined(_WIN32) || defined(__APPLE__) || defined(_AIX) || defined(__FreeBSD__)280 281 std::locale::global(std::locale::classic());282}283 284template <class CharT>285static void test_valid_values_weekday() {286 using namespace std::literals::chrono_literals;287 namespace cr = std::chrono;288 289 constexpr std::basic_string_view<CharT> fmt =290 SV("{:%%a='%a'%t%%A='%A'%t%%u='%u'%t%%Ou='%Ou'%t%%w='%w'%t%%Ow='%Ow'%n}");291 constexpr std::basic_string_view<CharT> lfmt =292 SV("{:L%%a='%a'%t%%A='%A'%t%%u='%u'%t%%Ou='%Ou'%t%%w='%w'%t%%Ow='%Ow'%n}");293 294 const std::locale loc(LOCALE_ja_JP_UTF_8);295 std::locale::global(std::locale(LOCALE_fr_FR_UTF_8));296 297 // Non localized output using C-locale298 check(SV("%a='Sun'\t%A='Sunday'\t%u='7'\t%Ou='7'\t%w='0'\t%Ow='0'\n"),299 fmt,300 cr::gps_seconds(0s)); // 00:00:00 GPS Sunday, 6 January 1980301 302 check(SV("%a='Sun'\t%A='Sunday'\t%u='7'\t%Ou='7'\t%w='0'\t%Ow='0'\n"),303 fmt,304 cr::gps_seconds(3'979'002'513s)); // 06:28:15 GPS on Sunday, 7 February 2106305 306 // Use the global locale (fr_FR)307#if defined(__APPLE__)308 check(SV("%a='Dim'\t%A='Dimanche'\t%u='7'\t%Ou='7'\t%w='0'\t%Ow='0'\n"),309 lfmt,310 cr::gps_seconds(0s)); // 00:00:00 GPS Sunday, 6 January 1980311 312 check(SV("%a='Dim'\t%A='Dimanche'\t%u='7'\t%Ou='7'\t%w='0'\t%Ow='0'\n"),313 lfmt,314 cr::gps_seconds(3'979'002'513s)); // 06:28:15 GPS on Sunday, 7 February 2106315#else316 check(SV("%a='dim.'\t%A='dimanche'\t%u='7'\t%Ou='7'\t%w='0'\t%Ow='0'\n"),317 lfmt,318 cr::gps_seconds(0s)); // 00:00:00 GPS Sunday, 6 January 1980319 320 check(SV("%a='dim.'\t%A='dimanche'\t%u='7'\t%Ou='7'\t%w='0'\t%Ow='0'\n"),321 lfmt,322 cr::gps_seconds(3'979'002'513s)); // 06:28:15 GPS on Sunday, 7 February 2106323#endif324 325 // Use supplied locale (ja_JP).326 // This locale has a different alternate, but not on all platforms327#if defined(_WIN32) || defined(__APPLE__) || defined(_AIX) || defined(__FreeBSD__)328 check(loc,329 SV("%a='日'\t%A='日曜日'\t%u='7'\t%Ou='7'\t%w='0'\t%Ow='0'\n"),330 lfmt,331 cr::gps_seconds(0s)); // 00:00:00 GPS Sunday, 6 January 1980332 333 check(loc,334 SV("%a='日'\t%A='日曜日'\t%u='7'\t%Ou='7'\t%w='0'\t%Ow='0'\n"),335 lfmt,336 cr::gps_seconds(3'979'002'513s)); // 06:28:15 GPS on Sunday, 7 February 2106337#else // defined(_WIN32) || defined(__APPLE__) || defined(_AIX) || defined(__FreeBSD__)338 check(loc,339 SV("%a='日'\t%A='日曜日'\t%u='7'\t%Ou='七'\t%w='0'\t%Ow='〇'\n"),340 lfmt,341 cr::gps_seconds(0s)); // 00:00:00 GPS Sunday, 6 January 1980342 343 check(loc,344 SV("%a='日'\t%A='日曜日'\t%u='7'\t%Ou='七'\t%w='0'\t%Ow='〇'\n"),345 lfmt,346 cr::gps_seconds(3'979'002'513s)); // 06:28:15 GPS on Sunday, 7 February 2106347#endif // defined(_WIN32) || defined(__APPLE__) || defined(_AIX) || defined(__FreeBSD__)348 349 std::locale::global(std::locale::classic());350}351 352template <class CharT>353static void test_valid_values_day_of_year() {354 using namespace std::literals::chrono_literals;355 namespace cr = std::chrono;356 357 constexpr std::basic_string_view<CharT> fmt = SV("{:%%j='%j'%n}");358 constexpr std::basic_string_view<CharT> lfmt = SV("{:L%%j='%j'%n}");359 360 const std::locale loc(LOCALE_ja_JP_UTF_8);361 std::locale::global(std::locale(LOCALE_fr_FR_UTF_8));362 363 // Non localized output using C-locale364 check(SV("%j='006'\n"), fmt, cr::gps_seconds(0s)); // 00:00:00 GPS Sunday, 6 January 1980365 check(SV("%j='138'\n"), fmt, cr::gps_seconds(1'684'035'218s)); // 03:33:20 GPS Wednesday, 18 May 2033366 367 // Use the global locale (fr_FR)368 check(SV("%j='006'\n"), lfmt, cr::gps_seconds(0s)); // 00:00:00 GPS Sunday, 6 January 1980369 check(SV("%j='138'\n"), lfmt, cr::gps_seconds(1'684'035'218s)); // 03:33:20 GPS Wednesday, 18 May 2033370 371 // Use supplied locale (ja_JP). This locale has a different alternate.372 check(loc, SV("%j='006'\n"), lfmt, cr::gps_seconds(0s)); // 00:00:00 GPS Sunday, 6 January 1980373 check(loc, SV("%j='138'\n"), lfmt, cr::gps_seconds(1'684'035'218s)); // 03:33:20 GPS Wednesday, 18 May 2033374 375 std::locale::global(std::locale::classic());376}377 378template <class CharT>379static void test_valid_values_week() {380 using namespace std::literals::chrono_literals;381 namespace cr = std::chrono;382 383 constexpr std::basic_string_view<CharT> fmt = SV("{:%%U='%U'%t%%OU='%OU'%t%%W='%W'%t%%OW='%OW'%n}");384 constexpr std::basic_string_view<CharT> lfmt = SV("{:L%%U='%U'%t%%OU='%OU'%t%%W='%W'%t%%OW='%OW'%n}");385 386 const std::locale loc(LOCALE_ja_JP_UTF_8);387 std::locale::global(std::locale(LOCALE_fr_FR_UTF_8));388 389 // Non localized output using C-locale390 check(SV("%U='01'\t%OU='01'\t%W='00'\t%OW='00'\n"), fmt,391 cr::gps_seconds(0s)); // 00:00:00 GPS Sunday, 6 January 1980392 393 check(SV("%U='20'\t%OU='20'\t%W='20'\t%OW='20'\n"),394 fmt,395 cr::gps_seconds(1'684'035'218s)); // 03:33:20 GPS Wednesday, 18 May 2033396 397 // Use the global locale (fr_FR)398 check(SV("%U='01'\t%OU='01'\t%W='00'\t%OW='00'\n"), lfmt,399 cr::gps_seconds(0s)); // 00:00:00 GPS Sunday, 6 January 1980400 401 check(SV("%U='20'\t%OU='20'\t%W='20'\t%OW='20'\n"),402 lfmt,403 cr::gps_seconds(1'684'035'218s)); // 03:33:20 GPS Wednesday, 18 May 2033404 405 // Use supplied locale (ja_JP). This locale has a different alternate.406#if defined(_WIN32) || defined(__APPLE__) || defined(_AIX) || defined(__FreeBSD__)407 check(loc,408 SV("%U='01'\t%OU='001\t%W='00'\t%OW='00'\n"),409 lfmt,410 cr::gps_seconds(0s)); // 00:00:00 GPS Sunday, 6 January 1980411 412 check(loc,413 SV("%U='20'\t%OU='20'\t%W='20'\t%OW='20'\n"),414 lfmt,415 cr::gps_seconds(1'684'035'218s)); // 03:33:20 GPS Wednesday, 18 May 2033416#else // defined(_WIN32) || defined(__APPLE__) || defined(_AIX) || defined(__FreeBSD__)417 check(loc,418 SV("%U='01'\t%OU='一'\t%W='00'\t%OW='〇'\n"),419 lfmt,420 cr::gps_seconds(0s)); // 00:00:00 GPS Sunday, 6 January 1980421 422 check(loc,423 SV("%U='20'\t%OU='二十'\t%W='20'\t%OW='二十'\n"),424 lfmt,425 cr::gps_seconds(1'684'035'218s)); // 03:33:20 GPS Wednesday, 18 May 2033426#endif // defined(_WIN32) || defined(__APPLE__) || defined(_AIX) || defined(__FreeBSD__)427 std::locale::global(std::locale::classic());428}429 430template <class CharT>431static void test_valid_values_iso_8601_week() {432 using namespace std::literals::chrono_literals;433 namespace cr = std::chrono;434 435 constexpr std::basic_string_view<CharT> fmt = SV("{:%%g='%g'%t%%G='%G'%t%%V='%V'%t%%OV='%OV'%n}");436 constexpr std::basic_string_view<CharT> lfmt = SV("{:L%%g='%g'%t%%G='%G'%t%%V='%V'%t%%OV='%OV'%n}");437 438 const std::locale loc(LOCALE_ja_JP_UTF_8);439 std::locale::global(std::locale(LOCALE_fr_FR_UTF_8));440 441 // Non localized output using C-locale442 check(SV("%g='80'\t%G='1980'\t%V='01'\t%OV='01'\n"), fmt,443 cr::gps_seconds(0s)); // 00:00:00 GPS Sunday, 6 January 1980444 445 check(SV("%g='09'\t%G='2009'\t%V='07'\t%OV='07'\n"),446 fmt,447 cr::gps_seconds(918'603'105s)); // 23:31:30 GPS Friday, 13 February 2009448 449 // Use the global locale (fr_FR)450 check(SV("%g='80'\t%G='1980'\t%V='01'\t%OV='01'\n"),451 lfmt,452 cr::gps_seconds(0s)); // 00:00:00 GPS Sunday, 6 January 1980453 454 check(SV("%g='09'\t%G='2009'\t%V='07'\t%OV='07'\n"),455 lfmt,456 cr::gps_seconds(918'603'105s)); // 23:31:30 GPS Friday, 13 February 2009457 458 // Use supplied locale (ja_JP). This locale has a different alternate.459#if defined(_WIN32) || defined(__APPLE__) || defined(_AIX) || defined(__FreeBSD__)460 check(loc,461 SV("%g='80'\t%G='1980'\t%V='01'\t%OV='01'\n"),462 lfmt,463 cr::gps_seconds(0s)); // 00:00:00 GPS Sunday, 6 January 1980464 465 check(loc,466 SV("%g='09'\t%G='2009'\t%V='07'\t%OV='07'\n"),467 lfmt,468 cr::gps_seconds(918'603'105s)); // 23:31:30 GPS Friday, 13 February 2009469#else // defined(_WIN32) || defined(__APPLE__) || defined(_AIX) || defined(__FreeBSD__)470 check(loc,471 SV("%g='80'\t%G='1980'\t%V='01'\t%OV='一'\n"),472 lfmt,473 cr::gps_seconds(0s)); // 00:00:00 GPS Sunday, 6 January 1980474 475 check(loc,476 SV("%g='09'\t%G='2009'\t%V='07'\t%OV='七'\n"),477 lfmt,478 cr::gps_seconds(918'603'105s)); // 23:31:30 GPS Friday, 13 February 2009479#endif // defined(_WIN32) || defined(__APPLE__) || defined(_AIX) || defined(__FreeBSD__)480 481 std::locale::global(std::locale::classic());482}483 484template <class CharT>485static void test_valid_values_date() {486 using namespace std::literals::chrono_literals;487 namespace cr = std::chrono;488 489 constexpr std::basic_string_view<CharT> fmt = SV("{:%%D='%D'%t%%F='%F'%t%%x='%x'%t%%Ex='%Ex'%n}");490 constexpr std::basic_string_view<CharT> lfmt = SV("{:L%%D='%D'%t%%F='%F'%t%%x='%x'%t%%Ex='%Ex'%n}");491 492 const std::locale loc(LOCALE_ja_JP_UTF_8);493 std::locale::global(std::locale(LOCALE_fr_FR_UTF_8));494 495 // Non localized output using C-locale496 check(SV("%D='01/06/80'\t%F='1980-01-06'\t%x='01/06/80'\t%Ex='01/06/80'\n"),497 fmt,498 cr::gps_seconds(0s)); // 00:00:00 GPS Sunday, 6 January 1980499 500 check(SV("%D='02/13/09'\t%F='2009-02-13'\t%x='02/13/09'\t%Ex='02/13/09'\n"),501 fmt,502 cr::gps_seconds(918'603'105s)); // 23:31:30 GPS Friday, 13 February 2009503 504 // Use the global locale (fr_FR)505#if defined(__APPLE__) || defined(__FreeBSD__)506 check(SV("%D='01/06/80'\t%F='1980-01-01'\t%x='06.01.1980'\t%Ex='06.01.1980'\n"),507 lfmt,508 cr::gps_seconds(0s)); // 00:00:00 GPS Sunday, 6 January 1980509 510 check(SV("%D='02/13/09'\t%F='2009-02-13'\t%x='13.02.2009'\t%Ex='13.02.2009'\n"),511 lfmt,512 cr::gps_seconds(918'603'105s)); // 23:31:30 GPS Friday, 13 February 2009513#else514 check(SV("%D='01/06/80'\t%F='1980-01-06'\t%x='06/01/1980'\t%Ex='06/01/1980'\n"),515 lfmt,516 cr::gps_seconds(0s)); // 00:00:00 GPS Sunday, 6 January 1980517 518 check(SV("%D='02/13/09'\t%F='2009-02-13'\t%x='13/02/2009'\t%Ex='13/02/2009'\n"),519 lfmt,520 cr::gps_seconds(918'603'105s)); // 23:31:30 GPS Friday, 13 February 2009521#endif522 523 // Use supplied locale (ja_JP). This locale has a different alternate.524#if defined(_WIN32) || defined(__APPLE__) || defined(_AIX) || defined(__FreeBSD__)525 check(loc,526 SV("%D='01/06/80'\t%F='1980-01-06'\t%x='1980/01/06'\t%Ex='1980/01/06'\n"),527 lfmt,528 cr::gps_seconds(0s)); // 00:00:00 GPS Sunday, 6 January 1980529 530 check(loc,531 SV("%D='02/13/09'\t%F='2009-02-13'\t%x='2009/02/13'\t%Ex='2009/02/13'\n"),532 lfmt,533 cr::gps_seconds(918'603'105s)); // 23:31:30 GPS Friday, 13 February 2009534#else // defined(_WIN32) || defined(__APPLE__) || defined(_AIX) || defined(__FreeBSD__)535 check(loc,536 SV("%D='01/06/80'\t%F='1980-01-06'\t%x='1980年01月06日'\t%Ex='昭和55年01月06日'\n"),537 lfmt,538 cr::gps_seconds(0s)); // 00:00:00 GPS Sunday, 6 January 1980539 540 check(loc,541 SV("%D='02/13/09'\t%F='2009-02-13'\t%x='2009年02月13日'\t%Ex='平成21年02月13日'\n"),542 lfmt,543 cr::gps_seconds(918'603'105s)); // 23:31:30 GPS Friday, 13 February 2009544#endif // defined(_WIN32) || defined(__APPLE__) || defined(_AIX) || defined(__FreeBSD__)545 546 std::locale::global(std::locale::classic());547}548 549template <class CharT>550static void test_valid_values_time() {551 using namespace std::literals::chrono_literals;552 namespace cr = std::chrono;553 554 constexpr std::basic_string_view<CharT> fmt = SV(555 "{:"556 "%%H='%H'%t"557 "%%OH='%OH'%t"558 "%%I='%I'%t"559 "%%OI='%OI'%t"560 "%%M='%M'%t"561 "%%OM='%OM'%t"562 "%%S='%S'%t"563 "%%OS='%OS'%t"564 "%%p='%p'%t"565 "%%R='%R'%t"566 "%%T='%T'%t"567 "%%r='%r'%t"568 "%%X='%X'%t"569 "%%EX='%EX'%t"570 "%n}");571 constexpr std::basic_string_view<CharT> lfmt = SV(572 "{:L"573 "%%H='%H'%t"574 "%%OH='%OH'%t"575 "%%I='%I'%t"576 "%%OI='%OI'%t"577 "%%M='%M'%t"578 "%%OM='%OM'%t"579 "%%S='%S'%t"580 "%%OS='%OS'%t"581 "%%p='%p'%t"582 "%%R='%R'%t"583 "%%T='%T'%t"584 "%%r='%r'%t"585 "%%X='%X'%t"586 "%%EX='%EX'%t"587 "%n}");588 589 const std::locale loc(LOCALE_ja_JP_UTF_8);590 std::locale::global(std::locale(LOCALE_fr_FR_UTF_8));591 592 // Non localized output using C-locale593 check(SV("%H='00'\t"594 "%OH='00'\t"595 "%I='12'\t"596 "%OI='12'\t"597 "%M='00'\t"598 "%OM='00'\t"599 "%S='00'\t"600 "%OS='00'\t"601 "%p='AM'\t"602 "%R='00:00'\t"603 "%T='00:00:00'\t"604 "%r='12:00:00 AM'\t"605 "%X='00:00:00'\t"606 "%EX='00:00:00'\t"607 "\n"),608 fmt,609 cr::gps_seconds(0s)); // 00:00:00 GPS Sunday, 6 January 1980610 611 check(SV("%H='23'\t"612 "%OH='23'\t"613 "%I='11'\t"614 "%OI='11'\t"615 "%M='31'\t"616 "%OM='31'\t"617 "%S='30.123'\t"618 "%OS='30.123'\t"619 "%p='PM'\t"620 "%R='23:31'\t"621 "%T='23:31:30.123'\t"622 "%r='11:31:30 PM'\t"623 "%X='23:31:30'\t"624 "%EX='23:31:30'\t"625 "\n"),626 fmt,627 cr::gps_time<cr::milliseconds>(918'603'105'123ms)); // 23:31:30 GPS Friday, 13 February 2009628 629 // Use the global locale (fr_FR)630 check(SV("%H='00'\t"631 "%OH='00'\t"632 "%I='12'\t"633 "%OI='12'\t"634 "%M='00'\t"635 "%OM='00'\t"636 "%S='00'\t"637 "%OS='00'\t"638#if defined(_AIX)639 "%p='AM'\t"640#else641 "%p=''\t"642#endif643 "%R='00:00'\t"644 "%T='00:00:00'\t"645#ifdef _WIN32646 "%r='00:00:00'\t"647#elif defined(_AIX)648 "%r='12:00:00 AM'\t"649#elif defined(__APPLE__) || defined(__FreeBSD__)650 "%r=''\t"651#else652 "%r='12:00:00 '\t"653#endif654 "%X='00:00:00'\t"655 "%EX='00:00:00'\t"656 "\n"),657 lfmt,658 cr::gps_seconds(0s)); // 00:00:00 GPS Sunday, 6 January 1980659 660 check(SV("%H='23'\t"661 "%OH='23'\t"662 "%I='11'\t"663 "%OI='11'\t"664 "%M='31'\t"665 "%OM='31'\t"666 "%S='30,123'\t"667 "%OS='30,123'\t"668#if defined(_AIX)669 "%p='PM'\t"670#else671 "%p=''\t"672#endif673 "%R='23:31'\t"674 "%T='23:31:30,123'\t"675#ifdef _WIN32676 "%r='23:31:30'\t"677#elif defined(_AIX)678 "%r='11:31:30 PM'\t"679#elif defined(__APPLE__) || defined(__FreeBSD__)680 "%r=''\t"681#else682 "%r='11:31:30 '\t"683#endif684 "%X='23:31:30'\t"685 "%EX='23:31:30'\t"686 "\n"),687 lfmt,688 cr::gps_time<cr::milliseconds>(918'603'105'123ms)); // 23:31:30 GPS Friday, 13 February 2009689 690 // Use supplied locale (ja_JP). This locale has a different alternate.691#if defined(__APPLE__) || defined(_AIX) || defined(_WIN32) || defined(__FreeBSD__)692 check(loc,693 SV("%H='00'\t"694 "%OH='00'\t"695 "%I='12'\t"696 "%OI='12'\t"697 "%M='00'\t"698 "%OM='00'\t"699 "%S='00'\t"700 "%OS='00'\t"701# if defined(__APPLE__)702 "%p='AM'\t"703# else704 "%p='午前'\t"705# endif706 "%R='00:00'\t"707 "%T='00:00:00'\t"708# if defined(__APPLE__) || defined(__FreeBSD__)709# if defined(__APPLE__)710 "%r='12:00:00 AM'\t"711# else712 "%r='12:00:00 午前'\t"713# endif714 "%X='00時00分00秒'\t"715 "%EX='00時00分00秒'\t"716# elif defined(_WIN32)717 "%r='0:00:00'\t"718 "%X='0:00:00'\t"719 "%EX='0:00:00'\t"720# else721 "%r='午前12:00:00'\t"722 "%X='00:00:00'\t"723 "%EX='00:00:00'\t"724# endif725 "\n"),726 lfmt,727 cr::hh_mm_ss(0s));728 729 check(loc,730 SV("%H='23'\t"731 "%OH='23'\t"732 "%I='11'\t"733 "%OI='11'\t"734 "%M='31'\t"735 "%OM='31'\t"736 "%S='30.123'\t"737 "%OS='30.123'\t"738# if defined(__APPLE__)739 "%p='PM'\t"740# else741 "%p='午後'\t"742# endif743 "%R='23:31'\t"744 "%T='23:31:30.123'\t"745# if defined(__APPLE__) || defined(__FreeBSD__)746# if defined(__APPLE__)747 "%r='11:31:30 PM'\t"748# else749 "%r='11:31:30 午後'\t"750# endif751 "%X='23時31分30秒'\t"752 "%EX='23時31分30秒'\t"753# elif defined(_WIN32)754 "%r='23:31:30'\t"755 "%X='23:31:30'\t"756 "%EX='23:31:30'\t"757# else758 "%r='午後11:31:30'\t"759 "%X='23:31:30'\t"760 "%EX='23:31:30'\t"761# endif762 "\n"),763 lfmt,764 cr::hh_mm_ss(23h + 31min + 30s + 123ms));765#else // defined(__APPLE__) || defined(_AIX) || defined(_WIN32) || defined(__FreeBSD__)766 check(loc,767 SV("%H='00'\t"768 "%OH='〇'\t"769 "%I='12'\t"770 "%OI='十二'\t"771 "%M='00'\t"772 "%OM='〇'\t"773 "%S='00'\t"774 "%OS='〇'\t"775 "%p='午前'\t"776 "%R='00:00'\t"777 "%T='00:00:00'\t"778 "%r='午前12時00分00秒'\t"779 "%X='00時00分00秒'\t"780 "%EX='00時00分00秒'\t"781 "\n"),782 lfmt,783 cr::gps_seconds(0s)); // 00:00:00 GPS Sunday, 6 January 1980784 785 check(loc,786 SV("%H='23'\t"787 "%OH='二十三'\t"788 "%I='11'\t"789 "%OI='十一'\t"790 "%M='31'\t"791 "%OM='三十一'\t"792 "%S='30.123'\t"793 "%OS='三十.123'\t"794 "%p='午後'\t"795 "%R='23:31'\t"796 "%T='23:31:30.123'\t"797 "%r='午後11時31分30秒'\t"798 "%X='23時31分30秒'\t"799 "%EX='23時31分30秒'\t"800 "\n"),801 lfmt,802 cr::gps_time<cr::milliseconds>(918'603'105'123ms)); // 23:31:30 GPS Friday, 13 February 2009803#endif // defined(__APPLE__) || defined(_AIX) || defined(_WIN32) || defined(__FreeBSD__)804 805 std::locale::global(std::locale::classic());806}807 808template <class CharT>809static void test_valid_values_date_time() {810 using namespace std::literals::chrono_literals;811 namespace cr = std::chrono;812 813 constexpr std::basic_string_view<CharT> fmt = SV("{:%%c='%c'%t%%Ec='%Ec'%n}");814 constexpr std::basic_string_view<CharT> lfmt = SV("{:L%%c='%c'%t%%Ec='%Ec'%n}");815 816 const std::locale loc(LOCALE_ja_JP_UTF_8);817 std::locale::global(std::locale(LOCALE_fr_FR_UTF_8));818 819 // Non localized output using C-locale820 check(SV("%c='Sun Jan 6 00:00:00 1980'\t%Ec='Sun Jan 6 00:00:00 1980'\n"),821 fmt,822 cr::gps_seconds(0s)); // 00:00:00 GPS Sunday, 6 January 1980823 824 check(SV("%c='Fri Feb 13 23:31:30 2009'\t%Ec='Fri Feb 13 23:31:30 2009'\n"),825 fmt,826 cr::gps_seconds(918'603'105s)); // 23:31:30 GPS Friday, 13 February 2009827 828 // Use the global locale (fr_FR)829 check(830// https://sourceware.org/bugzilla/show_bug.cgi?id=24054831#if defined(__powerpc__) && defined(__linux__)832 SV("%c='dim. 06 janv. 1980 00:00:00 GPS'\t%Ec='dim. 06 janv. 1958 00:00:00 GPS'\n"),833#elif defined(__GLIBC__) && __GLIBC__ <= 2 && __GLIBC_MINOR__ < 29834 SV("%c='dim. 06 janv. 1980 00:00:00 GMT'\t%Ec='dim. 06 janv. 1980 00:00:00 GMT'\n"),835#elif defined(_AIX)836 SV("%c=' 1 janvier 1980 à 00:00:00 GPS'\t%Ec=' 6 janvier 1980 à 00:00:00 GPS'\n"),837#elif defined(__APPLE__)838 SV("%c='Dim 6 jan 00:00:00 1980'\t%Ec='Dim 6 jan 00:00:00 1980'\n"),839#elif defined(_WIN32)840 SV("%c='06/01/1980 00:00:00'\t%Ec='06/01/1980 00:00:00'\n"),841#elif defined(__FreeBSD__)842 SV("%c='dim. 6 janv. 00:00:00 1980'\t%Ec='dim. 6 janv. 00:00:00 1980'\n"),843#else844 SV("%c='dim. 06 janv. 1980 00:00:00'\t%Ec='dim. 06 janv. 1980 00:00:00'\n"),845#endif846 lfmt,847 cr::gps_seconds(0s)); // 00:00:00 GPS Sunday, 6 January 1980848 849 check(850// https://sourceware.org/bugzilla/show_bug.cgi?id=24054851#if defined(__powerpc__) && defined(__linux__)852 SV("%c='ven. 13 févr. 2009 23:31:30 GPS'\t%Ec='ven. 13 févr. 2009 23:31:30 GPS'\n"),853#elif defined(__GLIBC__) && __GLIBC__ <= 2 && __GLIBC_MINOR__ < 29854 SV("%c='ven. 13 févr. 2009 23:31:30 GMT'\t%Ec='ven. 13 févr. 2009 23:31:30 GMT'\n"),855#elif defined(_AIX)856 SV("%c='13 février 2009 à 23:31:30 GPS'\t%Ec='13 février 2009 à 23:31:30 GPS'\n"),857#elif defined(__APPLE__)858 SV("%c='Ven 13 fév 23:31:30 2009'\t%Ec='Ven 13 fév 23:31:30 2009'\n"),859#elif defined(_WIN32)860 SV("%c='13/02/2009 23:31:30'\t%Ec='13/02/2009 23:31:30'\n"),861#elif defined(__FreeBSD__)862 SV("%c='ven. 13 févr. 23:31:30 2009'\t%Ec='ven. 13 févr. 23:31:30 2009'\n"),863#else864 SV("%c='ven. 13 févr. 2009 23:31:30'\t%Ec='ven. 13 févr. 2009 23:31:30'\n"),865#endif866 lfmt,867 cr::gps_seconds(918'603'105s)); // 23:31:30 GPS Friday, 13 February 2009868 869 // Use supplied locale (ja_JP). This locale has a different alternate.a870#if defined(__APPLE__) || defined(__FreeBSD__)871 check(loc,872 SV("%c='水 1/ 6 00:00:00 1980'\t%Ec='水 1/ 6 00:00:00 1980'\n"),873 lfmt,874 cr::gps_seconds(0s)); // 00:00:00 GPS Sunday, 6 January 1980875 check(loc,876 SV("%c='金 2/13 23:31:30 2009'\t%Ec='金 2/13 23:31:30 2009'\n"),877 lfmt,878 cr::gps_seconds(918'603'105s)); // 23:31:30 GPS Friday, 13 February 2009879#elif defined(_AIX) // defined(__APPLE__)|| defined(__FreeBSD__)880 check(loc,881 SV("%c='1980年01月 6日 00:00:00 GPS'\t%Ec='1980年01月 6日 00:00:00 GPS'\n"),882 lfmt,883 cr::gps_seconds(0s)); // 00:00:00 GPS Sunday, 6 January 1980884 check(loc,885 SV("%c='2009年02月13日 23:31:30 GPS'\t%Ec='2009年02月13日 23:31:30 GPS'\n"),886 lfmt,887 cr::gps_seconds(918'603'105s)); // 23:31:30 GPS Friday, 13 February 2009888#elif defined(_WIN32) // defined(__APPLE__)|| defined(__FreeBSD__)889 check(loc,890 SV("%c='1980/01/06 0:00:00'\t%Ec='1980/01/06 0:00:00'\n"),891 lfmt,892 cr::gps_seconds(0s)); // 00:00:00 GPS Sunday, 6 January 1980893 check(loc,894 SV("%c='2009/02/13 23:31:30'\t%Ec='2009/02/13 23:31:30'\n"),895 lfmt,896 cr::gps_seconds(918'603'105s)); // 23:31:30 GPS Friday, 13 February 2009897#else // defined(__APPLE__)|| defined(__FreeBSD__)898 check(loc,899 SV("%c='1980年01月06日 00時00分00秒'\t%Ec='昭和55年01月06日 00時00分00秒'\n"),900 lfmt,901 cr::gps_seconds(0s)); // 00:00:00 GPS Sunday, 6 January 1980902 903 check(loc,904 SV("%c='2009年02月13日 23時31分30秒'\t%Ec='平成21年02月13日 23時31分30秒'\n"),905 lfmt,906 cr::gps_seconds(918'603'105s)); // 23:31:30 GPS Friday, 13 February 2009907#endif // defined(__APPLE__)|| defined(__FreeBSD__)908 909 std::locale::global(std::locale::classic());910}911 912template <class CharT>913static void test_valid_values_time_zone() {914 using namespace std::literals::chrono_literals;915 namespace cr = std::chrono;916 917 constexpr std::basic_string_view<CharT> fmt = SV("{:%%z='%z'%t%%Ez='%Ez'%t%%Oz='%Oz'%t%%Z='%Z'%n}");918 constexpr std::basic_string_view<CharT> lfmt = SV("{:L%%z='%z'%t%%Ez='%Ez'%t%%Oz='%Oz'%t%%Z='%Z'%n}");919 920 const std::locale loc(LOCALE_ja_JP_UTF_8);921 std::locale::global(std::locale(LOCALE_fr_FR_UTF_8));922 923 // Non localized output using C-locale924 check(SV("%z='+0000'\t%Ez='+00:00'\t%Oz='+00:00'\t%Z='GPS'\n"),925 fmt,926 cr::gps_seconds(0s)); // 00:00:00 GPS Sunday, 6 January 1980927 928 // Use the global locale (fr_FR)929 check(SV("%z='+0000'\t%Ez='+00:00'\t%Oz='+00:00'\t%Z='GPS'\n"),930 lfmt,931 cr::gps_seconds(0s)); // 00:00:00 GPS Sunday, 6 January 1980932 933 // Use supplied locale (ja_JP).934 check(loc,935 SV("%z='+0000'\t%Ez='+00:00'\t%Oz='+00:00'\t%Z='GPS'\n"),936 lfmt,937 cr::gps_seconds(0s)); // 00:00:00 GPS Sunday, 6 January 1980938 939 std::locale::global(std::locale::classic());940}941 942template <class CharT>943static void test_valid_values() {944 test_valid_values_year<CharT>();945 test_valid_values_month<CharT>();946 test_valid_values_day<CharT>();947 test_valid_values_weekday<CharT>();948 test_valid_values_day_of_year<CharT>();949 test_valid_values_week<CharT>();950 test_valid_values_iso_8601_week<CharT>();951 test_valid_values_date<CharT>();952 test_valid_values_time<CharT>();953 test_valid_values_date_time<CharT>();954 test_valid_values_time_zone<CharT>();955}956 957template <class CharT>958static void test() {959 using namespace std::literals::chrono_literals;960 namespace cr = std::chrono;961 962 test_no_chrono_specs<CharT>();963 test_valid_values<CharT>();964 check_invalid_types<CharT>(965 {SV("a"), SV("A"), SV("b"), SV("B"), SV("c"), SV("C"), SV("d"), SV("D"), SV("e"), SV("F"), SV("g"),966 SV("G"), SV("h"), SV("H"), SV("I"), SV("j"), SV("m"), SV("M"), SV("p"), SV("r"), SV("R"), SV("S"),967 SV("T"), SV("u"), SV("U"), SV("V"), SV("w"), SV("W"), SV("x"), SV("X"), SV("y"), SV("Y"), SV("z"),968 SV("Z"), SV("Ec"), SV("EC"), SV("Ex"), SV("EX"), SV("Ey"), SV("EY"), SV("Ez"), SV("Od"), SV("Oe"), SV("OH"),969 SV("OI"), SV("Om"), SV("OM"), SV("OS"), SV("Ou"), SV("OU"), SV("OV"), SV("Ow"), SV("OW"), SV("Oy"), SV("Oz")},970 cr::gps_seconds(0s));971 972 check_exception("The format specifier expects a '%' or a '}'", SV("{:A"), cr::gps_seconds(0s));973 check_exception("The chrono specifiers contain a '{'", SV("{:%%{"), cr::gps_seconds(0s));974 check_exception("End of input while parsing a conversion specifier", SV("{:%"), cr::gps_seconds(0s));975 check_exception("End of input while parsing the modifier E", SV("{:%E"), cr::gps_seconds(0s));976 check_exception("End of input while parsing the modifier O", SV("{:%O"), cr::gps_seconds(0s));977 978 // Precision not allowed979 check_exception("The format specifier expects a '%' or a '}'", SV("{:.3}"), cr::gps_seconds(0s));980}981 982int main(int, char**) {983 test<char>();984 985#ifndef TEST_HAS_NO_WIDE_CHARACTERS986 test<wchar_t>();987#endif988 989 return 0;990}991