772 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::month_weekday, 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 "string_literal.h"36#include "test_macros.h"37 38template <class CharT>39static void test_no_chrono_specs() {40 // Month: valid, weekday: valid, index: invalid41 check(SV("Jan/Sun[0 is not a valid index]"),42 SV("{}"),43 std::chrono::month_weekday{std::chrono::month{1}, std::chrono::weekday_indexed{std::chrono::weekday{0}, 0}});44 check(SV("*Jan/Sun[0 is not a valid index]*"),45 SV("{:*^33}"),46 std::chrono::month_weekday{std::chrono::month{1}, std::chrono::weekday_indexed{std::chrono::weekday{0}, 0}});47 check(SV("*Jan/Sun[0 is not a valid index]"),48 SV("{:*>32}"),49 std::chrono::month_weekday{std::chrono::month{1}, std::chrono::weekday_indexed{std::chrono::weekday{0}, 0}});50 51 // Month: valid, weekday: invalid, index: valid52 check(SV("Jan/8 is not a valid weekday[1]"),53 SV("{}"),54 std::chrono::month_weekday{std::chrono::month{1}, std::chrono::weekday_indexed{std::chrono::weekday{8}, 1}});55 check(SV("*Jan/8 is not a valid weekday[1]*"),56 SV("{:*^33}"),57 std::chrono::month_weekday{std::chrono::month{1}, std::chrono::weekday_indexed{std::chrono::weekday{8}, 1}});58 check(SV("*Jan/8 is not a valid weekday[1]"),59 SV("{:*>32}"),60 std::chrono::month_weekday{std::chrono::month{1}, std::chrono::weekday_indexed{std::chrono::weekday{8}, 1}});61 62 // Month: valid, weekday: invalid, index: invalid63 check(SV("Jan/8 is not a valid weekday[0 is not a valid index]"),64 SV("{}"),65 std::chrono::month_weekday{std::chrono::month{1}, std::chrono::weekday_indexed{std::chrono::weekday{8}, 0}});66 check(SV("*Jan/8 is not a valid weekday[0 is not a valid index]*"),67 SV("{:*^54}"),68 std::chrono::month_weekday{std::chrono::month{1}, std::chrono::weekday_indexed{std::chrono::weekday{8}, 0}});69 check(SV("*Jan/8 is not a valid weekday[0 is not a valid index]"),70 SV("{:*>53}"),71 std::chrono::month_weekday{std::chrono::month{1}, std::chrono::weekday_indexed{std::chrono::weekday{8}, 0}});72 73 // Month: invalid, weekday: valid, index: valid74 check(SV("0 is not a valid month/Sun[1]"),75 SV("{}"),76 std::chrono::month_weekday{std::chrono::month{0}, std::chrono::weekday_indexed{std::chrono::weekday{0}, 1}});77 check(SV("*0 is not a valid month/Sun[1]*"),78 SV("{:*^31}"),79 std::chrono::month_weekday{std::chrono::month{0}, std::chrono::weekday_indexed{std::chrono::weekday{0}, 1}});80 check(SV("*0 is not a valid month/Sun[1]"),81 SV("{:*>30}"),82 std::chrono::month_weekday{std::chrono::month{0}, std::chrono::weekday_indexed{std::chrono::weekday{0}, 1}});83 84 // Month: invalid, weekday: valid, index: invalid85 check(SV("0 is not a valid month/Sun[0 is not a valid index]"),86 SV("{}"),87 std::chrono::month_weekday{std::chrono::month{0}, std::chrono::weekday_indexed{std::chrono::weekday{0}, 0}});88 check(SV("*0 is not a valid month/Sun[0 is not a valid index]*"),89 SV("{:*^52}"),90 std::chrono::month_weekday{std::chrono::month{0}, std::chrono::weekday_indexed{std::chrono::weekday{0}, 0}});91 check(SV("*0 is not a valid month/Sun[0 is not a valid index]"),92 SV("{:*>51}"),93 std::chrono::month_weekday{std::chrono::month{0}, std::chrono::weekday_indexed{std::chrono::weekday{0}, 0}});94 95 // Month: invalid, weekday: invalid, index: valid96 check(SV("0 is not a valid month/8 is not a valid weekday[1]"),97 SV("{}"),98 std::chrono::month_weekday{std::chrono::month{0}, std::chrono::weekday_indexed{std::chrono::weekday{8}, 1}});99 check(SV("*0 is not a valid month/8 is not a valid weekday[1]*"),100 SV("{:*^52}"),101 std::chrono::month_weekday{std::chrono::month{0}, std::chrono::weekday_indexed{std::chrono::weekday{8}, 1}});102 check(SV("*0 is not a valid month/8 is not a valid weekday[1]"),103 SV("{:*>51}"),104 std::chrono::month_weekday{std::chrono::month{0}, std::chrono::weekday_indexed{std::chrono::weekday{8}, 1}});105 106 // Month: invalid, weekday: valid, index: invalid107 check(SV("0 is not a valid month/8 is not a valid weekday[0 is not a valid index]"),108 SV("{}"),109 std::chrono::month_weekday{std::chrono::month{0}, std::chrono::weekday_indexed{std::chrono::weekday{8}, 0}});110 check(SV("*0 is not a valid month/8 is not a valid weekday[0 is not a valid index]*"),111 SV("{:*^73}"),112 std::chrono::month_weekday{std::chrono::month{0}, std::chrono::weekday_indexed{std::chrono::weekday{8}, 0}});113 check(SV("*0 is not a valid month/8 is not a valid weekday[0 is not a valid index]"),114 SV("{:*>72}"),115 std::chrono::month_weekday{std::chrono::month{0}, std::chrono::weekday_indexed{std::chrono::weekday{8}, 0}});116}117 118template <class CharT>119static void test_invalid_values() {120 // Test that %a, %b, %h, %a, and %B throw an exception.121 check_exception(122 "Formatting a weekday name needs a valid weekday",123 SV("{:%a}"),124 std::chrono::month_weekday{std::chrono::month{1}, std::chrono::weekday_indexed{std::chrono::weekday{8}, 1}});125 check_exception(126 "Formatting a weekday name needs a valid weekday",127 SV("{:%a}"),128 std::chrono::month_weekday{std::chrono::month{1}, std::chrono::weekday_indexed{std::chrono::weekday{255}, 1}});129 130 check_exception(131 "Formatting a month name from an invalid month number",132 SV("{:%b}"),133 std::chrono::month_weekday{std::chrono::month{0}, std::chrono::weekday_indexed{std::chrono::weekday{0}, 1}});134 check_exception(135 "Formatting a month name from an invalid month number",136 SV("{:%b}"),137 std::chrono::month_weekday{std::chrono::month{13}, std::chrono::weekday_indexed{std::chrono::weekday{0}, 1}});138 check_exception(139 "Formatting a month name from an invalid month number",140 SV("{:%b}"),141 std::chrono::month_weekday{std::chrono::month{255}, std::chrono::weekday_indexed{std::chrono::weekday{0}, 1}});142 143 check_exception(144 "Formatting a month name from an invalid month number",145 SV("{:%h}"),146 std::chrono::month_weekday{std::chrono::month{0}, std::chrono::weekday_indexed{std::chrono::weekday{0}, 1}});147 check_exception(148 "Formatting a month name from an invalid month number",149 SV("{:%h}"),150 std::chrono::month_weekday{std::chrono::month{13}, std::chrono::weekday_indexed{std::chrono::weekday{0}, 1}});151 check_exception(152 "Formatting a month name from an invalid month number",153 SV("{:%h}"),154 std::chrono::month_weekday{std::chrono::month{255}, std::chrono::weekday_indexed{std::chrono::weekday{0}, 1}});155 156 check_exception(157 "Formatting a weekday name needs a valid weekday",158 SV("{:%A}"),159 std::chrono::month_weekday{std::chrono::month{1}, std::chrono::weekday_indexed{std::chrono::weekday{8}, 1}});160 check_exception(161 "Formatting a weekday name needs a valid weekday",162 SV("{:%A}"),163 std::chrono::month_weekday{std::chrono::month{1}, std::chrono::weekday_indexed{std::chrono::weekday{255}, 1}});164 165 check_exception(166 "Formatting a month name from an invalid month number",167 SV("{:%B}"),168 std::chrono::month_weekday{std::chrono::month{0}, std::chrono::weekday_indexed{std::chrono::weekday{0}, 1}});169 check_exception(170 "Formatting a month name from an invalid month number",171 SV("{:%B}"),172 std::chrono::month_weekday{std::chrono::month{13}, std::chrono::weekday_indexed{std::chrono::weekday{0}, 1}});173 check_exception(174 "Formatting a month name from an invalid month number",175 SV("{:%B}"),176 std::chrono::month_weekday{std::chrono::month{255}, std::chrono::weekday_indexed{std::chrono::weekday{0}, 1}});177}178 179template <class CharT>180static void test_valid_month() {181 constexpr std::basic_string_view<CharT> fmt = SV("{:%%b='%b'%t%%B='%B'%t%%h='%h'%t%%m='%m'%t%%Om='%Om'%n}");182 constexpr std::basic_string_view<CharT> lfmt = SV("{:L%%b='%b'%t%%B='%B'%t%%h='%h'%t%%m='%m'%t%%Om='%Om'%n}");183 184 const std::locale loc(LOCALE_ja_JP_UTF_8);185 std::locale::global(std::locale(LOCALE_fr_FR_UTF_8));186 187 // Non localized output using C-locale188 check(SV("%b='Jan'\t%B='January'\t%h='Jan'\t%m='01'\t%Om='01'\n"),189 fmt,190 std::chrono::month_weekday{std::chrono::January, std::chrono::weekday_indexed{std::chrono::weekday{0}, 1}});191 check(SV("%b='Feb'\t%B='February'\t%h='Feb'\t%m='02'\t%Om='02'\n"),192 fmt,193 std::chrono::month_weekday{std::chrono::February, std::chrono::weekday_indexed{std::chrono::weekday{0}, 1}});194 check(SV("%b='Mar'\t%B='March'\t%h='Mar'\t%m='03'\t%Om='03'\n"),195 fmt,196 std::chrono::month_weekday{std::chrono::March, std::chrono::weekday_indexed{std::chrono::weekday{0}, 1}});197 check(SV("%b='Apr'\t%B='April'\t%h='Apr'\t%m='04'\t%Om='04'\n"),198 fmt,199 std::chrono::month_weekday{std::chrono::April, std::chrono::weekday_indexed{std::chrono::weekday{0}, 1}});200 check(SV("%b='May'\t%B='May'\t%h='May'\t%m='05'\t%Om='05'\n"),201 fmt,202 std::chrono::month_weekday{std::chrono::May, std::chrono::weekday_indexed{std::chrono::weekday{0}, 1}});203 check(SV("%b='Jun'\t%B='June'\t%h='Jun'\t%m='06'\t%Om='06'\n"),204 fmt,205 std::chrono::month_weekday{std::chrono::June, std::chrono::weekday_indexed{std::chrono::weekday{0}, 1}});206 check(SV("%b='Jul'\t%B='July'\t%h='Jul'\t%m='07'\t%Om='07'\n"),207 fmt,208 std::chrono::month_weekday{std::chrono::July, std::chrono::weekday_indexed{std::chrono::weekday{0}, 1}});209 check(SV("%b='Aug'\t%B='August'\t%h='Aug'\t%m='08'\t%Om='08'\n"),210 fmt,211 std::chrono::month_weekday{std::chrono::August, std::chrono::weekday_indexed{std::chrono::weekday{0}, 1}});212 check(SV("%b='Sep'\t%B='September'\t%h='Sep'\t%m='09'\t%Om='09'\n"),213 fmt,214 std::chrono::month_weekday{std::chrono::September, std::chrono::weekday_indexed{std::chrono::weekday{0}, 1}});215 check(SV("%b='Oct'\t%B='October'\t%h='Oct'\t%m='10'\t%Om='10'\n"),216 fmt,217 std::chrono::month_weekday{std::chrono::October, std::chrono::weekday_indexed{std::chrono::weekday{0}, 1}});218 check(SV("%b='Nov'\t%B='November'\t%h='Nov'\t%m='11'\t%Om='11'\n"),219 fmt,220 std::chrono::month_weekday{std::chrono::November, std::chrono::weekday_indexed{std::chrono::weekday{0}, 1}});221 check(SV("%b='Dec'\t%B='December'\t%h='Dec'\t%m='12'\t%Om='12'\n"),222 fmt,223 std::chrono::month_weekday{std::chrono::December, std::chrono::weekday_indexed{std::chrono::weekday{0}, 1}});224 225 // Use the global locale (fr_FR)226#if defined(__APPLE__)227 check(SV("%b='jan'\t%B='janvier'\t%h='jan'\t%m='01'\t%Om='01'\n"),228 lfmt,229 std::chrono::month_weekday{std::chrono::January, std::chrono::weekday_indexed{std::chrono::weekday{0}, 1}});230 check(SV("%b='fév'\t%B='février'\t%h='fév'\t%m='02'\t%Om='02'\n"),231 lfmt,232 std::chrono::month_weekday{std::chrono::February, std::chrono::weekday_indexed{std::chrono::weekday{0}, 1}});233 check(SV("%b='mar'\t%B='mars'\t%h='mar'\t%m='03'\t%Om='03'\n"),234 lfmt,235 std::chrono::month_weekday{std::chrono::March, std::chrono::weekday_indexed{std::chrono::weekday{0}, 1}});236 check(SV("%b='avr'\t%B='avril'\t%h='avr'\t%m='04'\t%Om='04'\n"),237 lfmt,238 std::chrono::month_weekday{std::chrono::April, std::chrono::weekday_indexed{std::chrono::weekday{0}, 1}});239 check(SV("%b='mai'\t%B='mai'\t%h='mai'\t%m='05'\t%Om='05'\n"),240 lfmt,241 std::chrono::month_weekday{std::chrono::May, std::chrono::weekday_indexed{std::chrono::weekday{0}, 1}});242 check(SV("%b='jui'\t%B='juin'\t%h='jui'\t%m='06'\t%Om='06'\n"),243 lfmt,244 std::chrono::month_weekday{std::chrono::June, std::chrono::weekday_indexed{std::chrono::weekday{0}, 1}});245 check(SV("%b='jul'\t%B='juillet'\t%h='jul'\t%m='07'\t%Om='07'\n"),246 lfmt,247 std::chrono::month_weekday{std::chrono::July, std::chrono::weekday_indexed{std::chrono::weekday{0}, 1}});248 check(SV("%b='aoû'\t%B='août'\t%h='aoû'\t%m='08'\t%Om='08'\n"),249 lfmt,250 std::chrono::month_weekday{std::chrono::August, std::chrono::weekday_indexed{std::chrono::weekday{0}, 1}});251 check(SV("%b='sep'\t%B='septembre'\t%h='sep'\t%m='09'\t%Om='09'\n"),252 lfmt,253 std::chrono::month_weekday{std::chrono::September, std::chrono::weekday_indexed{std::chrono::weekday{0}, 1}});254 check(SV("%b='oct'\t%B='octobre'\t%h='oct'\t%m='10'\t%Om='10'\n"),255 lfmt,256 std::chrono::month_weekday{std::chrono::October, std::chrono::weekday_indexed{std::chrono::weekday{0}, 1}});257 check(SV("%b='nov'\t%B='novembre'\t%h='nov'\t%m='11'\t%Om='11'\n"),258 lfmt,259 std::chrono::month_weekday{std::chrono::November, std::chrono::weekday_indexed{std::chrono::weekday{0}, 1}});260 check(SV("%b='déc'\t%B='décembre'\t%h='déc'\t%m='12'\t%Om='12'\n"),261 lfmt,262 std::chrono::month_weekday{std::chrono::December, std::chrono::weekday_indexed{std::chrono::weekday{0}, 1}});263#else // defined(__APPLE__)264 check(SV("%b='janv.'\t%B='janvier'\t%h='janv.'\t%m='01'\t%Om='01'\n"),265 lfmt,266 std::chrono::month_weekday{std::chrono::January, std::chrono::weekday_indexed{std::chrono::weekday{0}, 1}});267 check(SV("%b='févr.'\t%B='février'\t%h='févr.'\t%m='02'\t%Om='02'\n"),268 lfmt,269 std::chrono::month_weekday{std::chrono::February, std::chrono::weekday_indexed{std::chrono::weekday{0}, 1}});270 check(SV("%b='mars'\t%B='mars'\t%h='mars'\t%m='03'\t%Om='03'\n"),271 lfmt,272 std::chrono::month_weekday{std::chrono::March, std::chrono::weekday_indexed{std::chrono::weekday{0}, 1}});273 check(274# if defined(_WIN32) || defined(_AIX) || defined(__FreeBSD__)275 SV("%b='avr.'\t%B='avril'\t%h='avr.'\t%m='04'\t%Om='04'\n"),276# else // defined(_WIN32) || defined(_AIX) || defined(__FreeBSD__)277 SV("%b='avril'\t%B='avril'\t%h='avril'\t%m='04'\t%Om='04'\n"),278# endif // defined(_WIN32) || defined(_AIX) || defined(__FreeBSD__)279 lfmt,280 std::chrono::month_weekday{std::chrono::April, std::chrono::weekday_indexed{std::chrono::weekday{0}, 1}});281 check(SV("%b='mai'\t%B='mai'\t%h='mai'\t%m='05'\t%Om='05'\n"),282 lfmt,283 std::chrono::month_weekday{std::chrono::May, std::chrono::weekday_indexed{std::chrono::weekday{0}, 1}});284 check(SV("%b='juin'\t%B='juin'\t%h='juin'\t%m='06'\t%Om='06'\n"),285 lfmt,286 std::chrono::month_weekday{std::chrono::June, std::chrono::weekday_indexed{std::chrono::weekday{0}, 1}});287 check(SV("%b='juil.'\t%B='juillet'\t%h='juil.'\t%m='07'\t%Om='07'\n"),288 lfmt,289 std::chrono::month_weekday{std::chrono::July, std::chrono::weekday_indexed{std::chrono::weekday{0}, 1}});290 check(SV("%b='août'\t%B='août'\t%h='août'\t%m='08'\t%Om='08'\n"),291 lfmt,292 std::chrono::month_weekday{std::chrono::August, std::chrono::weekday_indexed{std::chrono::weekday{0}, 1}});293 check(SV("%b='sept.'\t%B='septembre'\t%h='sept.'\t%m='09'\t%Om='09'\n"),294 lfmt,295 std::chrono::month_weekday{std::chrono::September, std::chrono::weekday_indexed{std::chrono::weekday{0}, 1}});296 check(SV("%b='oct.'\t%B='octobre'\t%h='oct.'\t%m='10'\t%Om='10'\n"),297 lfmt,298 std::chrono::month_weekday{std::chrono::October, std::chrono::weekday_indexed{std::chrono::weekday{0}, 1}});299 check(SV("%b='nov.'\t%B='novembre'\t%h='nov.'\t%m='11'\t%Om='11'\n"),300 lfmt,301 std::chrono::month_weekday{std::chrono::November, std::chrono::weekday_indexed{std::chrono::weekday{0}, 1}});302 check(SV("%b='déc.'\t%B='décembre'\t%h='déc.'\t%m='12'\t%Om='12'\n"),303 lfmt,304 std::chrono::month_weekday{std::chrono::December, std::chrono::weekday_indexed{std::chrono::weekday{0}, 1}});305#endif // defined(__APPLE__)306 307 // Use supplied locale (ja_JP)308#ifdef _WIN32309 check(loc,310 SV("%b='1'\t%B='1月'\t%h='1'\t%m='01'\t%Om='01'\n"),311 lfmt,312 std::chrono::month_weekday{std::chrono::January, std::chrono::weekday_indexed{std::chrono::weekday{0}, 1}});313 check(loc,314 SV("%b='2'\t%B='2月'\t%h='2'\t%m='02'\t%Om='02'\n"),315 lfmt,316 std::chrono::month_weekday{std::chrono::February, std::chrono::weekday_indexed{std::chrono::weekday{0}, 1}});317 check(loc,318 SV("%b='3'\t%B='3月'\t%h='3'\t%m='03'\t%Om='03'\n"),319 lfmt,320 std::chrono::month_weekday{std::chrono::March, std::chrono::weekday_indexed{std::chrono::weekday{0}, 1}});321 check(loc,322 SV("%b='4'\t%B='4月'\t%h='4'\t%m='04'\t%Om='04'\n"),323 lfmt,324 std::chrono::month_weekday{std::chrono::April, std::chrono::weekday_indexed{std::chrono::weekday{0}, 1}});325 check(loc,326 SV("%b='5'\t%B='5月'\t%h='5'\t%m='05'\t%Om='05'\n"),327 lfmt,328 std::chrono::month_weekday{std::chrono::May, std::chrono::weekday_indexed{std::chrono::weekday{0}, 1}});329 check(loc,330 SV("%b='6'\t%B='6月'\t%h='6'\t%m='06'\t%Om='06'\n"),331 lfmt,332 std::chrono::month_weekday{std::chrono::June, std::chrono::weekday_indexed{std::chrono::weekday{0}, 1}});333 check(loc,334 SV("%b='7'\t%B='7月'\t%h='7'\t%m='07'\t%Om='07'\n"),335 lfmt,336 std::chrono::month_weekday{std::chrono::July, std::chrono::weekday_indexed{std::chrono::weekday{0}, 1}});337 check(loc,338 SV("%b='8'\t%B='8月'\t%h='8'\t%m='08'\t%Om='08'\n"),339 lfmt,340 std::chrono::month_weekday{std::chrono::August, std::chrono::weekday_indexed{std::chrono::weekday{0}, 1}});341 check(loc,342 SV("%b='9'\t%B='9月'\t%h='9'\t%m='09'\t%Om='09'\n"),343 lfmt,344 std::chrono::month_weekday{std::chrono::September, std::chrono::weekday_indexed{std::chrono::weekday{0}, 1}});345 check(loc,346 SV("%b='10'\t%B='10月'\t%h='10'\t%m='10'\t%Om='10'\n"),347 lfmt,348 std::chrono::month_weekday{std::chrono::October, std::chrono::weekday_indexed{std::chrono::weekday{0}, 1}});349 check(loc,350 SV("%b='11'\t%B='11月'\t%h='11'\t%m='11'\t%Om='11'\n"),351 lfmt,352 std::chrono::month_weekday{std::chrono::November, std::chrono::weekday_indexed{std::chrono::weekday{0}, 1}});353 check(loc,354 SV("%b='12'\t%B='12月'\t%h='12'\t%m='12'\t%Om='12'\n"),355 lfmt,356 std::chrono::month_weekday{std::chrono::December, std::chrono::weekday_indexed{std::chrono::weekday{0}, 1}});357#elif defined(__APPLE__) // defined(_WIN32)358 check(loc,359 SV("%b=' 1'\t%B='1月'\t%h=' 1'\t%m='01'\t%Om='01'\n"),360 lfmt,361 std::chrono::month_weekday{std::chrono::January, std::chrono::weekday_indexed{std::chrono::weekday{0}, 1}});362 check(loc,363 SV("%b=' 2'\t%B='2月'\t%h=' 2'\t%m='02'\t%Om='02'\n"),364 lfmt,365 std::chrono::month_weekday{std::chrono::February, std::chrono::weekday_indexed{std::chrono::weekday{0}, 1}});366 check(loc,367 SV("%b=' 3'\t%B='3月'\t%h=' 3'\t%m='03'\t%Om='03'\n"),368 lfmt,369 std::chrono::month_weekday{std::chrono::March, std::chrono::weekday_indexed{std::chrono::weekday{0}, 1}});370 check(loc,371 SV("%b=' 4'\t%B='4月'\t%h=' 4'\t%m='04'\t%Om='04'\n"),372 lfmt,373 std::chrono::month_weekday{std::chrono::April, std::chrono::weekday_indexed{std::chrono::weekday{0}, 1}});374 check(loc,375 SV("%b=' 5'\t%B='5月'\t%h=' 5'\t%m='05'\t%Om='05'\n"),376 lfmt,377 std::chrono::month_weekday{std::chrono::May, std::chrono::weekday_indexed{std::chrono::weekday{0}, 1}});378 check(loc,379 SV("%b=' 6'\t%B='6月'\t%h=' 6'\t%m='06'\t%Om='06'\n"),380 lfmt,381 std::chrono::month_weekday{std::chrono::June, std::chrono::weekday_indexed{std::chrono::weekday{0}, 1}});382 check(loc,383 SV("%b=' 7'\t%B='7月'\t%h=' 7'\t%m='07'\t%Om='07'\n"),384 lfmt,385 std::chrono::month_weekday{std::chrono::July, std::chrono::weekday_indexed{std::chrono::weekday{0}, 1}});386 check(loc,387 SV("%b=' 8'\t%B='8月'\t%h=' 8'\t%m='08'\t%Om='08'\n"),388 lfmt,389 std::chrono::month_weekday{std::chrono::August, std::chrono::weekday_indexed{std::chrono::weekday{0}, 1}});390 check(loc,391 SV("%b=' 9'\t%B='9月'\t%h=' 9'\t%m='09'\t%Om='09'\n"),392 lfmt,393 std::chrono::month_weekday{std::chrono::September, std::chrono::weekday_indexed{std::chrono::weekday{0}, 1}});394 check(loc,395 SV("%b='10'\t%B='10月'\t%h='10'\t%m='10'\t%Om='10'\n"),396 lfmt,397 std::chrono::month_weekday{std::chrono::October, std::chrono::weekday_indexed{std::chrono::weekday{0}, 1}});398 check(loc,399 SV("%b='11'\t%B='11月'\t%h='11'\t%m='11'\t%Om='11'\n"),400 lfmt,401 std::chrono::month_weekday{std::chrono::November, std::chrono::weekday_indexed{std::chrono::weekday{0}, 1}});402 check(loc,403 SV("%b='12'\t%B='12月'\t%h='12'\t%m='12'\t%Om='12'\n"),404 lfmt,405 std::chrono::month_weekday{std::chrono::December, std::chrono::weekday_indexed{std::chrono::weekday{0}, 1}});406#elif defined(_AIX) // _WIN32407 check(loc,408 SV("%b='1月'\t%B='1月'\t%h='1月'\t%m='01'\t%Om='01'\n"),409 lfmt,410 std::chrono::month_weekday{std::chrono::January, std::chrono::weekday_indexed{std::chrono::weekday{0}, 1}});411 check(loc,412 SV("%b='2月'\t%B='2月'\t%h='2月'\t%m='02'\t%Om='02'\n"),413 lfmt,414 std::chrono::month_weekday{std::chrono::February, std::chrono::weekday_indexed{std::chrono::weekday{0}, 1}});415 check(loc,416 SV("%b='3月'\t%B='3月'\t%h='3月'\t%m='03'\t%Om='03'\n"),417 lfmt,418 std::chrono::month_weekday{std::chrono::March, std::chrono::weekday_indexed{std::chrono::weekday{0}, 1}});419 check(loc,420 SV("%b='4月'\t%B='4月'\t%h='4月'\t%m='04'\t%Om='04'\n"),421 lfmt,422 std::chrono::month_weekday{std::chrono::April, std::chrono::weekday_indexed{std::chrono::weekday{0}, 1}});423 check(loc,424 SV("%b='5月'\t%B='5月'\t%h='5月'\t%m='05'\t%Om='05'\n"),425 lfmt,426 std::chrono::month_weekday{std::chrono::May, std::chrono::weekday_indexed{std::chrono::weekday{0}, 1}});427 check(loc,428 SV("%b='6月'\t%B='6月'\t%h='6月'\t%m='06'\t%Om='06'\n"),429 lfmt,430 std::chrono::month_weekday{std::chrono::June, std::chrono::weekday_indexed{std::chrono::weekday{0}, 1}});431 check(loc,432 SV("%b='7月'\t%B='7月'\t%h='7月'\t%m='07'\t%Om='07'\n"),433 lfmt,434 std::chrono::month_weekday{std::chrono::July, std::chrono::weekday_indexed{std::chrono::weekday{0}, 1}});435 check(loc,436 SV("%b='8月'\t%B='8月'\t%h='8月'\t%m='08'\t%Om='08'\n"),437 lfmt,438 std::chrono::month_weekday{std::chrono::August, std::chrono::weekday_indexed{std::chrono::weekday{0}, 1}});439 check(loc,440 SV("%b='9月'\t%B='9月'\t%h='9月'\t%m='09'\t%Om='09'\n"),441 lfmt,442 std::chrono::month_weekday{std::chrono::September, std::chrono::weekday_indexed{std::chrono::weekday{0}, 1}});443 check(loc,444 SV("%b='10月'\t%B='10月'\t%h='10月'\t%m='10'\t%Om='10'\n"),445 lfmt,446 std::chrono::month_weekday{std::chrono::October, std::chrono::weekday_indexed{std::chrono::weekday{0}, 1}});447 check(loc,448 SV("%b='11月'\t%B='11月'\t%h='11月'\t%m='11'\t%Om='11'\n"),449 lfmt,450 std::chrono::month_weekday{std::chrono::November, std::chrono::weekday_indexed{std::chrono::weekday{0}, 1}});451 check(loc,452 SV("%b='12月'\t%B='12月'\t%h='12月'\t%m='12'\t%Om='12'\n"),453 lfmt,454 std::chrono::month_weekday{std::chrono::December, std::chrono::weekday_indexed{std::chrono::weekday{0}, 1}});455#elif defined(__FreeBSD__) // _WIN32456 check(loc,457 SV("%b=' 1月'\t%B='1月'\t%h=' 1月'\t%m='01'\t%Om='01'\n"),458 lfmt,459 std::chrono::month_weekday{std::chrono::January, std::chrono::weekday_indexed{std::chrono::weekday{0}, 1}});460 check(loc,461 SV("%b=' 2月'\t%B='2月'\t%h=' 2月'\t%m='02'\t%Om='02'\n"),462 lfmt,463 std::chrono::month_weekday{std::chrono::February, std::chrono::weekday_indexed{std::chrono::weekday{0}, 1}});464 check(loc,465 SV("%b=' 3月'\t%B='3月'\t%h=' 3月'\t%m='03'\t%Om='03'\n"),466 lfmt,467 std::chrono::month_weekday{std::chrono::March, std::chrono::weekday_indexed{std::chrono::weekday{0}, 1}});468 check(loc,469 SV("%b=' 4月'\t%B='4月'\t%h=' 4月'\t%m='04'\t%Om='04'\n"),470 lfmt,471 std::chrono::month_weekday{std::chrono::April, std::chrono::weekday_indexed{std::chrono::weekday{0}, 1}});472 check(loc,473 SV("%b=' 5月'\t%B='5月'\t%h=' 5月'\t%m='05'\t%Om='05'\n"),474 lfmt,475 std::chrono::month_weekday{std::chrono::May, std::chrono::weekday_indexed{std::chrono::weekday{0}, 1}});476 check(loc,477 SV("%b=' 6月'\t%B='6月'\t%h=' 6月'\t%m='06'\t%Om='06'\n"),478 lfmt,479 std::chrono::month_weekday{std::chrono::June, std::chrono::weekday_indexed{std::chrono::weekday{0}, 1}});480 check(loc,481 SV("%b=' 7月'\t%B='7月'\t%h=' 7月'\t%m='07'\t%Om='07'\n"),482 lfmt,483 std::chrono::month_weekday{std::chrono::July, std::chrono::weekday_indexed{std::chrono::weekday{0}, 1}});484 check(loc,485 SV("%b=' 8月'\t%B='8月'\t%h=' 8月'\t%m='08'\t%Om='08'\n"),486 lfmt,487 std::chrono::month_weekday{std::chrono::August, std::chrono::weekday_indexed{std::chrono::weekday{0}, 1}});488 check(loc,489 SV("%b=' 9月'\t%B='9月'\t%h=' 9月'\t%m='09'\t%Om='09'\n"),490 lfmt,491 std::chrono::month_weekday{std::chrono::September, std::chrono::weekday_indexed{std::chrono::weekday{0}, 1}});492 check(loc,493 SV("%b='10月'\t%B='10月'\t%h='10月'\t%m='10'\t%Om='10'\n"),494 lfmt,495 std::chrono::month_weekday{std::chrono::October, std::chrono::weekday_indexed{std::chrono::weekday{0}, 1}});496 check(loc,497 SV("%b='11月'\t%B='11月'\t%h='11月'\t%m='11'\t%Om='11'\n"),498 lfmt,499 std::chrono::month_weekday{std::chrono::November, std::chrono::weekday_indexed{std::chrono::weekday{0}, 1}});500 check(loc,501 SV("%b='12月'\t%B='12月'\t%h='12月'\t%m='12'\t%Om='12'\n"),502 lfmt,503 std::chrono::month_weekday{std::chrono::December, std::chrono::weekday_indexed{std::chrono::weekday{0}, 1}});504#else // _WIN32505 check(loc,506 SV("%b=' 1月'\t%B='1月'\t%h=' 1月'\t%m='01'\t%Om='一'\n"),507 lfmt,508 std::chrono::month_weekday{std::chrono::January, std::chrono::weekday_indexed{std::chrono::weekday{0}, 1}});509 check(loc,510 SV("%b=' 2月'\t%B='2月'\t%h=' 2月'\t%m='02'\t%Om='二'\n"),511 lfmt,512 std::chrono::month_weekday{std::chrono::February, std::chrono::weekday_indexed{std::chrono::weekday{0}, 1}});513 check(loc,514 SV("%b=' 3月'\t%B='3月'\t%h=' 3月'\t%m='03'\t%Om='三'\n"),515 lfmt,516 std::chrono::month_weekday{std::chrono::March, std::chrono::weekday_indexed{std::chrono::weekday{0}, 1}});517 check(loc,518 SV("%b=' 4月'\t%B='4月'\t%h=' 4月'\t%m='04'\t%Om='四'\n"),519 lfmt,520 std::chrono::month_weekday{std::chrono::April, std::chrono::weekday_indexed{std::chrono::weekday{0}, 1}});521 check(loc,522 SV("%b=' 5月'\t%B='5月'\t%h=' 5月'\t%m='05'\t%Om='五'\n"),523 lfmt,524 std::chrono::month_weekday{std::chrono::May, std::chrono::weekday_indexed{std::chrono::weekday{0}, 1}});525 check(loc,526 SV("%b=' 6月'\t%B='6月'\t%h=' 6月'\t%m='06'\t%Om='六'\n"),527 lfmt,528 std::chrono::month_weekday{std::chrono::June, std::chrono::weekday_indexed{std::chrono::weekday{0}, 1}});529 check(loc,530 SV("%b=' 7月'\t%B='7月'\t%h=' 7月'\t%m='07'\t%Om='七'\n"),531 lfmt,532 std::chrono::month_weekday{std::chrono::July, std::chrono::weekday_indexed{std::chrono::weekday{0}, 1}});533 check(loc,534 SV("%b=' 8月'\t%B='8月'\t%h=' 8月'\t%m='08'\t%Om='八'\n"),535 lfmt,536 std::chrono::month_weekday{std::chrono::August, std::chrono::weekday_indexed{std::chrono::weekday{0}, 1}});537 check(loc,538 SV("%b=' 9月'\t%B='9月'\t%h=' 9月'\t%m='09'\t%Om='九'\n"),539 lfmt,540 std::chrono::month_weekday{std::chrono::September, std::chrono::weekday_indexed{std::chrono::weekday{0}, 1}});541 check(loc,542 SV("%b='10月'\t%B='10月'\t%h='10月'\t%m='10'\t%Om='十'\n"),543 lfmt,544 std::chrono::month_weekday{std::chrono::October, std::chrono::weekday_indexed{std::chrono::weekday{0}, 1}});545 check(loc,546 SV("%b='11月'\t%B='11月'\t%h='11月'\t%m='11'\t%Om='十一'\n"),547 lfmt,548 std::chrono::month_weekday{std::chrono::November, std::chrono::weekday_indexed{std::chrono::weekday{0}, 1}});549 check(loc,550 SV("%b='12月'\t%B='12月'\t%h='12月'\t%m='12'\t%Om='十二'\n"),551 lfmt,552 std::chrono::month_weekday{std::chrono::December, std::chrono::weekday_indexed{std::chrono::weekday{0}, 1}});553#endif // _WIN32554 555 std::locale::global(std::locale::classic());556}557 558template <class CharT>559static void test_valid_weekday() {560 constexpr std::basic_string_view<CharT> fmt =561 SV("{:%%u='%u'%t%%Ou='%Ou'%t%%w='%w'%t%%Ow='%Ow'%t%%a='%a'%t%%A='%A'%n}");562 constexpr std::basic_string_view<CharT> lfmt =563 SV("{:L%%u='%u'%t%%Ou='%Ou'%t%%w='%w'%t%%Ow='%Ow'%t%%a='%a'%t%%A='%A'%n}");564 565 const std::locale loc(LOCALE_ja_JP_UTF_8);566 std::locale::global(std::locale(LOCALE_fr_FR_UTF_8));567 568 // Non localized output using C-locale569 check(SV("%u='7'\t%Ou='7'\t%w='0'\t%Ow='0'\t%a='Sun'\t%A='Sunday'\n"),570 fmt,571 std::chrono::month_weekday{std::chrono::January, std::chrono::weekday_indexed{std::chrono::weekday{0}, 1}});572 check(SV("%u='1'\t%Ou='1'\t%w='1'\t%Ow='1'\t%a='Mon'\t%A='Monday'\n"),573 fmt,574 std::chrono::month_weekday{std::chrono::January, std::chrono::weekday_indexed{std::chrono::weekday{1}, 1}});575 check(SV("%u='2'\t%Ou='2'\t%w='2'\t%Ow='2'\t%a='Tue'\t%A='Tuesday'\n"),576 fmt,577 std::chrono::month_weekday{std::chrono::January, std::chrono::weekday_indexed{std::chrono::weekday{2}, 1}});578 check(SV("%u='3'\t%Ou='3'\t%w='3'\t%Ow='3'\t%a='Wed'\t%A='Wednesday'\n"),579 fmt,580 std::chrono::month_weekday{std::chrono::January, std::chrono::weekday_indexed{std::chrono::weekday{3}, 1}});581 check(SV("%u='4'\t%Ou='4'\t%w='4'\t%Ow='4'\t%a='Thu'\t%A='Thursday'\n"),582 fmt,583 std::chrono::month_weekday{std::chrono::January, std::chrono::weekday_indexed{std::chrono::weekday{4}, 1}});584 check(SV("%u='5'\t%Ou='5'\t%w='5'\t%Ow='5'\t%a='Fri'\t%A='Friday'\n"),585 fmt,586 std::chrono::month_weekday{std::chrono::January, std::chrono::weekday_indexed{std::chrono::weekday{5}, 1}});587 check(SV("%u='6'\t%Ou='6'\t%w='6'\t%Ow='6'\t%a='Sat'\t%A='Saturday'\n"),588 fmt,589 std::chrono::month_weekday{std::chrono::January, std::chrono::weekday_indexed{std::chrono::weekday{6}, 1}});590 check(SV("%u='7'\t%Ou='7'\t%w='0'\t%Ow='0'\t%a='Sun'\t%A='Sunday'\n"),591 fmt,592 std::chrono::month_weekday{std::chrono::January, std::chrono::weekday_indexed{std::chrono::weekday{7}, 1}});593 594 // Use the global locale (fr_FR)595#if defined(__APPLE__)596 check(SV("%u='7'\t%Ou='7'\t%w='0'\t%Ow='0'\t%a='Dim'\t%A='Dimanche'\n"),597 lfmt,598 std::chrono::month_weekday{std::chrono::January, std::chrono::weekday_indexed{std::chrono::weekday{0}, 1}});599 check(SV("%u='1'\t%Ou='1'\t%w='1'\t%Ow='1'\t%a='Lun'\t%A='Lundi'\n"),600 lfmt,601 std::chrono::month_weekday{std::chrono::January, std::chrono::weekday_indexed{std::chrono::weekday{1}, 1}});602 check(SV("%u='2'\t%Ou='2'\t%w='2'\t%Ow='2'\t%a='Mar'\t%A='Mardi'\n"),603 lfmt,604 std::chrono::month_weekday{std::chrono::January, std::chrono::weekday_indexed{std::chrono::weekday{2}, 1}});605 check(SV("%u='3'\t%Ou='3'\t%w='3'\t%Ow='3'\t%a='Mer'\t%A='Mercredi'\n"),606 lfmt,607 std::chrono::month_weekday{std::chrono::January, std::chrono::weekday_indexed{std::chrono::weekday{3}, 1}});608 check(SV("%u='4'\t%Ou='4'\t%w='4'\t%Ow='4'\t%a='Jeu'\t%A='Jeudi'\n"),609 lfmt,610 std::chrono::month_weekday{std::chrono::January, std::chrono::weekday_indexed{std::chrono::weekday{4}, 1}});611 check(SV("%u='5'\t%Ou='5'\t%w='5'\t%Ow='5'\t%a='Ven'\t%A='Vendredi'\n"),612 lfmt,613 std::chrono::month_weekday{std::chrono::January, std::chrono::weekday_indexed{std::chrono::weekday{5}, 1}});614 check(SV("%u='6'\t%Ou='6'\t%w='6'\t%Ow='6'\t%a='Sam'\t%A='Samedi'\n"),615 lfmt,616 std::chrono::month_weekday{std::chrono::January, std::chrono::weekday_indexed{std::chrono::weekday{6}, 1}});617 check(SV("%u='7'\t%Ou='7'\t%w='0'\t%Ow='0'\t%a='Dim'\t%A='Dimanche'\n"),618 lfmt,619 std::chrono::month_weekday{std::chrono::January, std::chrono::weekday_indexed{std::chrono::weekday{7}, 1}});620#else // defined(__APPLE__)621 check(SV("%u='7'\t%Ou='7'\t%w='0'\t%Ow='0'\t%a='dim.'\t%A='dimanche'\n"),622 lfmt,623 std::chrono::month_weekday{std::chrono::January, std::chrono::weekday_indexed{std::chrono::weekday{0}, 1}});624 check(SV("%u='1'\t%Ou='1'\t%w='1'\t%Ow='1'\t%a='lun.'\t%A='lundi'\n"),625 lfmt,626 std::chrono::month_weekday{std::chrono::January, std::chrono::weekday_indexed{std::chrono::weekday{1}, 1}});627 check(SV("%u='2'\t%Ou='2'\t%w='2'\t%Ow='2'\t%a='mar.'\t%A='mardi'\n"),628 lfmt,629 std::chrono::month_weekday{std::chrono::January, std::chrono::weekday_indexed{std::chrono::weekday{2}, 1}});630 check(SV("%u='3'\t%Ou='3'\t%w='3'\t%Ow='3'\t%a='mer.'\t%A='mercredi'\n"),631 lfmt,632 std::chrono::month_weekday{std::chrono::January, std::chrono::weekday_indexed{std::chrono::weekday{3}, 1}});633 check(SV("%u='4'\t%Ou='4'\t%w='4'\t%Ow='4'\t%a='jeu.'\t%A='jeudi'\n"),634 lfmt,635 std::chrono::month_weekday{std::chrono::January, std::chrono::weekday_indexed{std::chrono::weekday{4}, 1}});636 check(SV("%u='5'\t%Ou='5'\t%w='5'\t%Ow='5'\t%a='ven.'\t%A='vendredi'\n"),637 lfmt,638 std::chrono::month_weekday{std::chrono::January, std::chrono::weekday_indexed{std::chrono::weekday{5}, 1}});639 check(SV("%u='6'\t%Ou='6'\t%w='6'\t%Ow='6'\t%a='sam.'\t%A='samedi'\n"),640 lfmt,641 std::chrono::month_weekday{std::chrono::January, std::chrono::weekday_indexed{std::chrono::weekday{6}, 1}});642 check(SV("%u='7'\t%Ou='7'\t%w='0'\t%Ow='0'\t%a='dim.'\t%A='dimanche'\n"),643 lfmt,644 std::chrono::month_weekday{std::chrono::January, std::chrono::weekday_indexed{std::chrono::weekday{7}, 1}});645#endif // defined(__APPLE__)646 647 // Use supplied locale (ja_JP).648 // This locale has a different alternate, but not on all platforms649#if defined(_WIN32) || defined(__APPLE__) || defined(_AIX) || defined(__FreeBSD__)650 check(loc,651 SV("%u='7'\t%Ou='7'\t%w='0'\t%Ow='0'\t%a='日'\t%A='日曜日'\n"),652 lfmt,653 std::chrono::month_weekday{std::chrono::January, std::chrono::weekday_indexed{std::chrono::weekday{0}, 1}});654 check(loc,655 SV("%u='1'\t%Ou='1'\t%w='1'\t%Ow='1'\t%a='月'\t%A='月曜日'\n"),656 lfmt,657 std::chrono::month_weekday{std::chrono::January, std::chrono::weekday_indexed{std::chrono::weekday{1}, 1}});658 check(loc,659 SV("%u='2'\t%Ou='2'\t%w='2'\t%Ow='2'\t%a='火'\t%A='火曜日'\n"),660 lfmt,661 std::chrono::month_weekday{std::chrono::January, std::chrono::weekday_indexed{std::chrono::weekday{2}, 1}});662 check(loc,663 SV("%u='3'\t%Ou='3'\t%w='3'\t%Ow='3'\t%a='水'\t%A='水曜日'\n"),664 lfmt,665 std::chrono::month_weekday{std::chrono::January, std::chrono::weekday_indexed{std::chrono::weekday{3}, 1}});666 check(loc,667 SV("%u='4'\t%Ou='4'\t%w='4'\t%Ow='4'\t%a='木'\t%A='木曜日'\n"),668 lfmt,669 std::chrono::month_weekday{std::chrono::January, std::chrono::weekday_indexed{std::chrono::weekday{4}, 1}});670 check(loc,671 SV("%u='5'\t%Ou='5'\t%w='5'\t%Ow='5'\t%a='金'\t%A='金曜日'\n"),672 lfmt,673 std::chrono::month_weekday{std::chrono::January, std::chrono::weekday_indexed{std::chrono::weekday{5}, 1}});674 check(loc,675 SV("%u='6'\t%Ou='6'\t%w='6'\t%Ow='6'\t%a='土'\t%A='土曜日'\n"),676 lfmt,677 std::chrono::month_weekday{std::chrono::January, std::chrono::weekday_indexed{std::chrono::weekday{6}, 1}});678 check(loc,679 SV("%u='7'\t%Ou='7'\t%w='0'\t%Ow='0'\t%a='日'\t%A='日曜日'\n"),680 lfmt,681 std::chrono::month_weekday{std::chrono::January, std::chrono::weekday_indexed{std::chrono::weekday{7}, 1}});682#else // defined(_WIN32) || defined(__APPLE__) || defined(_AIX) || defined(__FreeBSD__)683 check(loc,684 SV("%u='7'\t%Ou='七'\t%w='0'\t%Ow='〇'\t%a='日'\t%A='日曜日'\n"),685 lfmt,686 std::chrono::month_weekday{std::chrono::January, std::chrono::weekday_indexed{std::chrono::weekday{0}, 1}});687 check(loc,688 SV("%u='1'\t%Ou='一'\t%w='1'\t%Ow='一'\t%a='月'\t%A='月曜日'\n"),689 lfmt,690 std::chrono::month_weekday{std::chrono::January, std::chrono::weekday_indexed{std::chrono::weekday{1}, 1}});691 check(loc,692 SV("%u='2'\t%Ou='二'\t%w='2'\t%Ow='二'\t%a='火'\t%A='火曜日'\n"),693 lfmt,694 std::chrono::month_weekday{std::chrono::January, std::chrono::weekday_indexed{std::chrono::weekday{2}, 1}});695 check(loc,696 SV("%u='3'\t%Ou='三'\t%w='3'\t%Ow='三'\t%a='水'\t%A='水曜日'\n"),697 lfmt,698 std::chrono::month_weekday{std::chrono::January, std::chrono::weekday_indexed{std::chrono::weekday{3}, 1}});699 check(loc,700 SV("%u='4'\t%Ou='四'\t%w='4'\t%Ow='四'\t%a='木'\t%A='木曜日'\n"),701 lfmt,702 std::chrono::month_weekday{std::chrono::January, std::chrono::weekday_indexed{std::chrono::weekday{4}, 1}});703 check(loc,704 SV("%u='5'\t%Ou='五'\t%w='5'\t%Ow='五'\t%a='金'\t%A='金曜日'\n"),705 lfmt,706 std::chrono::month_weekday{std::chrono::January, std::chrono::weekday_indexed{std::chrono::weekday{5}, 1}});707 check(loc,708 SV("%u='6'\t%Ou='六'\t%w='6'\t%Ow='六'\t%a='土'\t%A='土曜日'\n"),709 lfmt,710 std::chrono::month_weekday{std::chrono::January, std::chrono::weekday_indexed{std::chrono::weekday{6}, 1}});711 check(loc,712 SV("%u='7'\t%Ou='七'\t%w='0'\t%Ow='〇'\t%a='日'\t%A='日曜日'\n"),713 lfmt,714 std::chrono::month_weekday{std::chrono::January, std::chrono::weekday_indexed{std::chrono::weekday{7}, 1}});715#endif // defined(_WIN32) || defined(__APPLE__) || defined(_AIX) || defined(__FreeBSD__)716 717 std::locale::global(std::locale::classic());718}719 720template <class CharT>721static void test_valid_values() {722 test_valid_month<CharT>();723 test_valid_weekday<CharT>();724}725 726template <class CharT>727static void test() {728 test_no_chrono_specs<CharT>();729 test_invalid_values<CharT>();730 test_valid_values<CharT>();731 check_invalid_types<CharT>(732 {SV("a"), SV("A"), SV("b"), SV("B"), SV("h"), SV("m"), SV("u"), SV("w"), SV("Om"), SV("Ou"), SV("Ow")},733 std::chrono::month_weekday{std::chrono::January, std::chrono::weekday_indexed{std::chrono::weekday{0}, 1}});734 735 check_exception(736 "The format specifier expects a '%' or a '}'",737 SV("{:A"),738 std::chrono::month_weekday{std::chrono::January, std::chrono::weekday_indexed{std::chrono::weekday{0}, 1}});739 check_exception(740 "The chrono specifiers contain a '{'",741 SV("{:%%{"),742 std::chrono::month_weekday{std::chrono::January, std::chrono::weekday_indexed{std::chrono::weekday{0}, 1}});743 check_exception(744 "End of input while parsing a conversion specifier",745 SV("{:%"),746 std::chrono::month_weekday{std::chrono::January, std::chrono::weekday_indexed{std::chrono::weekday{0}, 1}});747 check_exception(748 "End of input while parsing the modifier E",749 SV("{:%E"),750 std::chrono::month_weekday{std::chrono::January, std::chrono::weekday_indexed{std::chrono::weekday{0}, 1}});751 check_exception(752 "End of input while parsing the modifier O",753 SV("{:%O"),754 std::chrono::month_weekday{std::chrono::January, std::chrono::weekday_indexed{std::chrono::weekday{0}, 1}});755 756 // Precision not allowed757 check_exception(758 "The format specifier expects a '%' or a '}'",759 SV("{:.3}"),760 std::chrono::month_weekday{std::chrono::January, std::chrono::weekday_indexed{std::chrono::weekday{0}, 1}});761}762 763int main(int, char**) {764 test<char>();765 766#ifndef TEST_HAS_NO_WIDE_CHARACTERS767 test<wchar_t>();768#endif769 770 return 0;771}772