| 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-exception |
| 6 | // |
| 7 | //===----------------------------------------------------------------------===// |
| 8 | |
| 9 | // UNSUPPORTED: c++03, c++11, c++14, c++17 |
| 10 | // UNSUPPORTED: no-localization |
| 11 | // UNSUPPORTED: GCC-ALWAYS_INLINE-FIXME |
| 12 | |
| 13 | // TODO FMT This test should not require std::to_chars(floating-point) |
| 14 | // XFAIL: availability-fp_to_chars-missing |
| 15 | |
| 16 | // REQUIRES: locale.fr_FR.UTF-8 |
| 17 | // REQUIRES: locale.ja_JP.UTF-8 |
| 18 | |
| 19 | // <chrono> |
| 20 | |
| 21 | // class month_weekday_last; |
| 22 | |
| 23 | // template<class charT, class traits> |
| 24 | // basic_ostream<charT, traits>& |
| 25 | // operator<<(basic_ostream<charT, traits>& os, const month_weekday_last& mwdl); |
| 26 | |
| 27 | #include <chrono> |
| 28 | #include <cassert> |
| 29 | #include <sstream> |
| 30 | |
| 31 | #include "make_string.h" |
| 32 | #include "platform_support.h" // locale name macros |
| 33 | #include "test_macros.h" |
| 34 | #include "assert_macros.h" |
| 35 | #include "concat_macros.h" |
| 36 | |
| 37 | #define SV(S) MAKE_STRING_VIEW(CharT, S) |
| 38 | |
| 39 | #define TEST_EQUAL(OUT, EXPECTED) \ |
| 40 | TEST_REQUIRE(OUT == EXPECTED, \ |
| 41 | TEST_WRITE_CONCATENATED( \ |
| 42 | "\nExpression ", #OUT, "\nExpected output ", EXPECTED, "\nActual output ", OUT, '\n')); |
| 43 | |
| 44 | template <class CharT> |
| 45 | static std::basic_string<CharT> stream_c_locale(std::chrono::month_weekday_last mwdl) { |
| 46 | std::basic_stringstream<CharT> sstr; |
| 47 | sstr << mwdl; |
| 48 | return sstr.str(); |
| 49 | } |
| 50 | |
| 51 | template <class CharT> |
| 52 | static std::basic_string<CharT> stream_fr_FR_locale(std::chrono::month_weekday_last mwdl) { |
| 53 | std::basic_stringstream<CharT> sstr; |
| 54 | const std::locale locale(LOCALE_fr_FR_UTF_8); |
| 55 | sstr.imbue(locale); |
| 56 | sstr << mwdl; |
| 57 | return sstr.str(); |
| 58 | } |
| 59 | |
| 60 | template <class CharT> |
| 61 | static std::basic_string<CharT> stream_ja_JP_locale(std::chrono::month_weekday_last mwdl) { |
| 62 | std::basic_stringstream<CharT> sstr; |
| 63 | const std::locale locale(LOCALE_ja_JP_UTF_8); |
| 64 | sstr.imbue(locale); |
| 65 | sstr << mwdl; |
| 66 | return sstr.str(); |
| 67 | } |
| 68 | |
| 69 | template <class CharT> |
| 70 | static void test() { |
| 71 | TEST_EQUAL(stream_c_locale<CharT>(std::chrono::month_weekday_last{ |
| 72 | std::chrono::month{0}, std::chrono::weekday_last{std::chrono::weekday{0}}}), |
| 73 | SV("0 is not a valid month/Sun[last]" )); |
| 74 | TEST_EQUAL(stream_c_locale<CharT>(std::chrono::month_weekday_last{ |
| 75 | std::chrono::month{1}, std::chrono::weekday_last{std::chrono::weekday{0}}}), |
| 76 | SV("Jan/Sun[last]" )); |
| 77 | TEST_EQUAL(stream_c_locale<CharT>(std::chrono::month_weekday_last{ |
| 78 | std::chrono::month{2}, std::chrono::weekday_last{std::chrono::weekday{1}}}), |
| 79 | SV("Feb/Mon[last]" )); |
| 80 | TEST_EQUAL(stream_c_locale<CharT>(std::chrono::month_weekday_last{ |
| 81 | std::chrono::month{3}, std::chrono::weekday_last{std::chrono::weekday{2}}}), |
| 82 | SV("Mar/Tue[last]" )); |
| 83 | TEST_EQUAL(stream_c_locale<CharT>(std::chrono::month_weekday_last{ |
| 84 | std::chrono::month{4}, std::chrono::weekday_last{std::chrono::weekday{3}}}), |
| 85 | SV("Apr/Wed[last]" )); |
| 86 | TEST_EQUAL(stream_c_locale<CharT>(std::chrono::month_weekday_last{ |
| 87 | std::chrono::month{5}, std::chrono::weekday_last{std::chrono::weekday{4}}}), |
| 88 | SV("May/Thu[last]" )); |
| 89 | TEST_EQUAL(stream_c_locale<CharT>(std::chrono::month_weekday_last{ |
| 90 | std::chrono::month{6}, std::chrono::weekday_last{std::chrono::weekday{5}}}), |
| 91 | SV("Jun/Fri[last]" )); |
| 92 | TEST_EQUAL(stream_c_locale<CharT>(std::chrono::month_weekday_last{ |
| 93 | std::chrono::month{7}, std::chrono::weekday_last{std::chrono::weekday{6}}}), |
| 94 | SV("Jul/Sat[last]" )); |
| 95 | TEST_EQUAL(stream_c_locale<CharT>(std::chrono::month_weekday_last{ |
| 96 | std::chrono::month{8}, std::chrono::weekday_last{std::chrono::weekday{7}}}), |
| 97 | SV("Aug/Sun[last]" )); |
| 98 | TEST_EQUAL(stream_c_locale<CharT>(std::chrono::month_weekday_last{ |
| 99 | std::chrono::month{9}, std::chrono::weekday_last{std::chrono::weekday{8}}}), |
| 100 | SV("Sep/8 is not a valid weekday[last]" )); |
| 101 | TEST_EQUAL(stream_c_locale<CharT>(std::chrono::month_weekday_last{ |
| 102 | std::chrono::month{10}, std::chrono::weekday_last{std::chrono::weekday{0}}}), |
| 103 | SV("Oct/Sun[last]" )); |
| 104 | TEST_EQUAL(stream_c_locale<CharT>(std::chrono::month_weekday_last{ |
| 105 | std::chrono::month{11}, std::chrono::weekday_last{std::chrono::weekday{0}}}), |
| 106 | SV("Nov/Sun[last]" )); |
| 107 | TEST_EQUAL(stream_c_locale<CharT>(std::chrono::month_weekday_last{ |
| 108 | std::chrono::month{12}, std::chrono::weekday_last{std::chrono::weekday{0}}}), |
| 109 | SV("Dec/Sun[last]" )); |
| 110 | TEST_EQUAL(stream_c_locale<CharT>(std::chrono::month_weekday_last{ |
| 111 | std::chrono::month{13}, std::chrono::weekday_last{std::chrono::weekday{0}}}), |
| 112 | SV("13 is not a valid month/Sun[last]" )); |
| 113 | TEST_EQUAL(stream_c_locale<CharT>(std::chrono::month_weekday_last{ |
| 114 | std::chrono::month{255}, std::chrono::weekday_last{std::chrono::weekday{8}}}), |
| 115 | SV("255 is not a valid month/8 is not a valid weekday[last]" )); |
| 116 | |
| 117 | #if defined(__APPLE__) |
| 118 | TEST_EQUAL(stream_fr_FR_locale<CharT>(std::chrono::month_weekday_last{ |
| 119 | std::chrono::month{0}, std::chrono::weekday_last{std::chrono::weekday{0}}}), |
| 120 | SV("0 is not a valid month/Dim[last]" )); |
| 121 | TEST_EQUAL(stream_fr_FR_locale<CharT>(std::chrono::month_weekday_last{ |
| 122 | std::chrono::month{1}, std::chrono::weekday_last{std::chrono::weekday{0}}}), |
| 123 | SV("jan/Dim[last]" )); |
| 124 | TEST_EQUAL(stream_fr_FR_locale<CharT>(std::chrono::month_weekday_last{ |
| 125 | std::chrono::month{2}, std::chrono::weekday_last{std::chrono::weekday{1}}}), |
| 126 | SV("fév/Lun[last]" )); |
| 127 | TEST_EQUAL(stream_fr_FR_locale<CharT>(std::chrono::month_weekday_last{ |
| 128 | std::chrono::month{3}, std::chrono::weekday_last{std::chrono::weekday{2}}}), |
| 129 | SV("mar/Mar[last]" )); |
| 130 | TEST_EQUAL(stream_fr_FR_locale<CharT>(std::chrono::month_weekday_last{ |
| 131 | std::chrono::month{4}, std::chrono::weekday_last{std::chrono::weekday{3}}}), |
| 132 | SV("avr/Mer[last]" )); |
| 133 | TEST_EQUAL(stream_fr_FR_locale<CharT>(std::chrono::month_weekday_last{ |
| 134 | std::chrono::month{5}, std::chrono::weekday_last{std::chrono::weekday{4}}}), |
| 135 | SV("mai/Jeu[last]" )); |
| 136 | TEST_EQUAL(stream_fr_FR_locale<CharT>(std::chrono::month_weekday_last{ |
| 137 | std::chrono::month{6}, std::chrono::weekday_last{std::chrono::weekday{5}}}), |
| 138 | SV("jui/Ven[last]" )); |
| 139 | TEST_EQUAL(stream_fr_FR_locale<CharT>(std::chrono::month_weekday_last{ |
| 140 | std::chrono::month{7}, std::chrono::weekday_last{std::chrono::weekday{6}}}), |
| 141 | SV("jul/Sam[last]" )); |
| 142 | TEST_EQUAL(stream_fr_FR_locale<CharT>(std::chrono::month_weekday_last{ |
| 143 | std::chrono::month{8}, std::chrono::weekday_last{std::chrono::weekday{7}}}), |
| 144 | SV("aoû/Dim[last]" )); |
| 145 | TEST_EQUAL(stream_fr_FR_locale<CharT>(std::chrono::month_weekday_last{ |
| 146 | std::chrono::month{9}, std::chrono::weekday_last{std::chrono::weekday{8}}}), |
| 147 | SV("sep/8 is not a valid weekday[last]" )); |
| 148 | TEST_EQUAL(stream_fr_FR_locale<CharT>(std::chrono::month_weekday_last{ |
| 149 | std::chrono::month{10}, std::chrono::weekday_last{std::chrono::weekday{0}}}), |
| 150 | SV("oct/Dim[last]" )); |
| 151 | TEST_EQUAL(stream_fr_FR_locale<CharT>(std::chrono::month_weekday_last{ |
| 152 | std::chrono::month{11}, std::chrono::weekday_last{std::chrono::weekday{0}}}), |
| 153 | SV("nov/Dim[last]" )); |
| 154 | TEST_EQUAL(stream_fr_FR_locale<CharT>(std::chrono::month_weekday_last{ |
| 155 | std::chrono::month{12}, std::chrono::weekday_last{std::chrono::weekday{0}}}), |
| 156 | SV("déc/Dim[last]" )); |
| 157 | TEST_EQUAL(stream_fr_FR_locale<CharT>(std::chrono::month_weekday_last{ |
| 158 | std::chrono::month{13}, std::chrono::weekday_last{std::chrono::weekday{0}}}), |
| 159 | SV("13 is not a valid month/Dim[last]" )); |
| 160 | #else // defined(__APPLE__) |
| 161 | TEST_EQUAL(stream_fr_FR_locale<CharT>(std::chrono::month_weekday_last{ |
| 162 | std::chrono::month{0}, std::chrono::weekday_last{std::chrono::weekday{0}}}), |
| 163 | SV("0 is not a valid month/dim.[last]" )); |
| 164 | TEST_EQUAL(stream_fr_FR_locale<CharT>(std::chrono::month_weekday_last{ |
| 165 | std::chrono::month{1}, std::chrono::weekday_last{std::chrono::weekday{0}}}), |
| 166 | SV("janv./dim.[last]" )); |
| 167 | TEST_EQUAL(stream_fr_FR_locale<CharT>(std::chrono::month_weekday_last{ |
| 168 | std::chrono::month{2}, std::chrono::weekday_last{std::chrono::weekday{1}}}), |
| 169 | SV("févr./lun.[last]" )); |
| 170 | TEST_EQUAL(stream_fr_FR_locale<CharT>(std::chrono::month_weekday_last{ |
| 171 | std::chrono::month{3}, std::chrono::weekday_last{std::chrono::weekday{2}}}), |
| 172 | SV("mars/mar.[last]" )); |
| 173 | # if defined(_WIN32) || defined(_AIX) || defined(__FreeBSD__) |
| 174 | TEST_EQUAL(stream_fr_FR_locale<CharT>(std::chrono::month_weekday_last{ |
| 175 | std::chrono::month{4}, std::chrono::weekday_last{std::chrono::weekday{3}}}), |
| 176 | SV("avr./mer.[last]" )); |
| 177 | # else // defined(_WIN32) || defined(_AIX) || defined(__FreeBSD__) |
| 178 | TEST_EQUAL(stream_fr_FR_locale<CharT>(std::chrono::month_weekday_last{ |
| 179 | std::chrono::month{4}, std::chrono::weekday_last{std::chrono::weekday{3}}}), |
| 180 | SV("avril/mer.[last]" )); |
| 181 | # endif // defined(_WIN32) || defined(_AIX) || defined(__FreeBSD__) |
| 182 | TEST_EQUAL(stream_fr_FR_locale<CharT>(std::chrono::month_weekday_last{ |
| 183 | std::chrono::month{5}, std::chrono::weekday_last{std::chrono::weekday{4}}}), |
| 184 | SV("mai/jeu.[last]" )); |
| 185 | TEST_EQUAL(stream_fr_FR_locale<CharT>(std::chrono::month_weekday_last{ |
| 186 | std::chrono::month{6}, std::chrono::weekday_last{std::chrono::weekday{5}}}), |
| 187 | SV("juin/ven.[last]" )); |
| 188 | TEST_EQUAL(stream_fr_FR_locale<CharT>(std::chrono::month_weekday_last{ |
| 189 | std::chrono::month{7}, std::chrono::weekday_last{std::chrono::weekday{6}}}), |
| 190 | SV("juil./sam.[last]" )); |
| 191 | TEST_EQUAL(stream_fr_FR_locale<CharT>(std::chrono::month_weekday_last{ |
| 192 | std::chrono::month{8}, std::chrono::weekday_last{std::chrono::weekday{7}}}), |
| 193 | SV("août/dim.[last]" )); |
| 194 | TEST_EQUAL(stream_fr_FR_locale<CharT>(std::chrono::month_weekday_last{ |
| 195 | std::chrono::month{9}, std::chrono::weekday_last{std::chrono::weekday{8}}}), |
| 196 | SV("sept./8 is not a valid weekday[last]" )); |
| 197 | TEST_EQUAL(stream_fr_FR_locale<CharT>(std::chrono::month_weekday_last{ |
| 198 | std::chrono::month{10}, std::chrono::weekday_last{std::chrono::weekday{0}}}), |
| 199 | SV("oct./dim.[last]" )); |
| 200 | TEST_EQUAL(stream_fr_FR_locale<CharT>(std::chrono::month_weekday_last{ |
| 201 | std::chrono::month{11}, std::chrono::weekday_last{std::chrono::weekday{0}}}), |
| 202 | SV("nov./dim.[last]" )); |
| 203 | TEST_EQUAL(stream_fr_FR_locale<CharT>(std::chrono::month_weekday_last{ |
| 204 | std::chrono::month{12}, std::chrono::weekday_last{std::chrono::weekday{0}}}), |
| 205 | SV("déc./dim.[last]" )); |
| 206 | TEST_EQUAL(stream_fr_FR_locale<CharT>(std::chrono::month_weekday_last{ |
| 207 | std::chrono::month{13}, std::chrono::weekday_last{std::chrono::weekday{0}}}), |
| 208 | SV("13 is not a valid month/dim.[last]" )); |
| 209 | #endif // defined(__APPLE__) |
| 210 | TEST_EQUAL(stream_fr_FR_locale<CharT>(std::chrono::month_weekday_last{ |
| 211 | std::chrono::month{255}, std::chrono::weekday_last{std::chrono::weekday{8}}}), |
| 212 | SV("255 is not a valid month/8 is not a valid weekday[last]" )); |
| 213 | |
| 214 | #if defined(__APPLE__) || defined(_WIN32) |
| 215 | TEST_EQUAL(stream_ja_JP_locale<CharT>(std::chrono::month_weekday_last{ |
| 216 | std::chrono::month{0}, std::chrono::weekday_last{std::chrono::weekday{0}}}), |
| 217 | SV("0 is not a valid month/日[last]" )); |
| 218 | # if defined(__APPLE__) |
| 219 | TEST_EQUAL(stream_ja_JP_locale<CharT>(std::chrono::month_weekday_last{ |
| 220 | std::chrono::month{1}, std::chrono::weekday_last{std::chrono::weekday{0}}}), |
| 221 | SV(" 1/日[last]" )); |
| 222 | TEST_EQUAL(stream_ja_JP_locale<CharT>(std::chrono::month_weekday_last{ |
| 223 | std::chrono::month{2}, std::chrono::weekday_last{std::chrono::weekday{1}}}), |
| 224 | SV(" 2/月[last]" )); |
| 225 | TEST_EQUAL(stream_ja_JP_locale<CharT>(std::chrono::month_weekday_last{ |
| 226 | std::chrono::month{3}, std::chrono::weekday_last{std::chrono::weekday{2}}}), |
| 227 | SV(" 3/火[last]" )); |
| 228 | TEST_EQUAL(stream_ja_JP_locale<CharT>(std::chrono::month_weekday_last{ |
| 229 | std::chrono::month{4}, std::chrono::weekday_last{std::chrono::weekday{3}}}), |
| 230 | SV(" 4/水[last]" )); |
| 231 | TEST_EQUAL(stream_ja_JP_locale<CharT>(std::chrono::month_weekday_last{ |
| 232 | std::chrono::month{5}, std::chrono::weekday_last{std::chrono::weekday{4}}}), |
| 233 | SV(" 5/木[last]" )); |
| 234 | TEST_EQUAL(stream_ja_JP_locale<CharT>(std::chrono::month_weekday_last{ |
| 235 | std::chrono::month{6}, std::chrono::weekday_last{std::chrono::weekday{5}}}), |
| 236 | SV(" 6/金[last]" )); |
| 237 | TEST_EQUAL(stream_ja_JP_locale<CharT>(std::chrono::month_weekday_last{ |
| 238 | std::chrono::month{7}, std::chrono::weekday_last{std::chrono::weekday{6}}}), |
| 239 | SV(" 7/土[last]" )); |
| 240 | TEST_EQUAL(stream_ja_JP_locale<CharT>(std::chrono::month_weekday_last{ |
| 241 | std::chrono::month{8}, std::chrono::weekday_last{std::chrono::weekday{7}}}), |
| 242 | SV(" 8/日[last]" )); |
| 243 | TEST_EQUAL(stream_ja_JP_locale<CharT>(std::chrono::month_weekday_last{ |
| 244 | std::chrono::month{9}, std::chrono::weekday_last{std::chrono::weekday{8}}}), |
| 245 | SV(" 9/8 is not a valid weekday[last]" )); |
| 246 | # else // defined(__APPLE__) |
| 247 | TEST_EQUAL(stream_ja_JP_locale<CharT>(std::chrono::month_weekday_last{ |
| 248 | std::chrono::month{1}, std::chrono::weekday_last{std::chrono::weekday{0}}}), |
| 249 | SV("1/日[last]" )); |
| 250 | TEST_EQUAL(stream_ja_JP_locale<CharT>(std::chrono::month_weekday_last{ |
| 251 | std::chrono::month{2}, std::chrono::weekday_last{std::chrono::weekday{1}}}), |
| 252 | SV("2/月[last]" )); |
| 253 | TEST_EQUAL(stream_ja_JP_locale<CharT>(std::chrono::month_weekday_last{ |
| 254 | std::chrono::month{3}, std::chrono::weekday_last{std::chrono::weekday{2}}}), |
| 255 | SV("3/火[last]" )); |
| 256 | TEST_EQUAL(stream_ja_JP_locale<CharT>(std::chrono::month_weekday_last{ |
| 257 | std::chrono::month{4}, std::chrono::weekday_last{std::chrono::weekday{3}}}), |
| 258 | SV("4/水[last]" )); |
| 259 | TEST_EQUAL(stream_ja_JP_locale<CharT>(std::chrono::month_weekday_last{ |
| 260 | std::chrono::month{5}, std::chrono::weekday_last{std::chrono::weekday{4}}}), |
| 261 | SV("5/木[last]" )); |
| 262 | TEST_EQUAL(stream_ja_JP_locale<CharT>(std::chrono::month_weekday_last{ |
| 263 | std::chrono::month{6}, std::chrono::weekday_last{std::chrono::weekday{5}}}), |
| 264 | SV("6/金[last]" )); |
| 265 | TEST_EQUAL(stream_ja_JP_locale<CharT>(std::chrono::month_weekday_last{ |
| 266 | std::chrono::month{7}, std::chrono::weekday_last{std::chrono::weekday{6}}}), |
| 267 | SV("7/土[last]" )); |
| 268 | TEST_EQUAL(stream_ja_JP_locale<CharT>(std::chrono::month_weekday_last{ |
| 269 | std::chrono::month{8}, std::chrono::weekday_last{std::chrono::weekday{7}}}), |
| 270 | SV("8/日[last]" )); |
| 271 | TEST_EQUAL(stream_ja_JP_locale<CharT>(std::chrono::month_weekday_last{ |
| 272 | std::chrono::month{9}, std::chrono::weekday_last{std::chrono::weekday{8}}}), |
| 273 | SV("9/8 is not a valid weekday[last]" )); |
| 274 | # endif // defined(__APPLE__) |
| 275 | TEST_EQUAL(stream_ja_JP_locale<CharT>(std::chrono::month_weekday_last{ |
| 276 | std::chrono::month{10}, std::chrono::weekday_last{std::chrono::weekday{0}}}), |
| 277 | SV("10/日[last]" )); |
| 278 | TEST_EQUAL(stream_ja_JP_locale<CharT>(std::chrono::month_weekday_last{ |
| 279 | std::chrono::month{11}, std::chrono::weekday_last{std::chrono::weekday{0}}}), |
| 280 | SV("11/日[last]" )); |
| 281 | TEST_EQUAL(stream_ja_JP_locale<CharT>(std::chrono::month_weekday_last{ |
| 282 | std::chrono::month{12}, std::chrono::weekday_last{std::chrono::weekday{0}}}), |
| 283 | SV("12/日[last]" )); |
| 284 | #else // defined(__APPLE__) || defined(_WIN32) |
| 285 | # if defined(_AIX) |
| 286 | TEST_EQUAL(stream_ja_JP_locale<CharT>(std::chrono::month_weekday_last{ |
| 287 | std::chrono::month{0}, std::chrono::weekday_last{std::chrono::weekday{0}}}), |
| 288 | SV("0 is not a valid month/日[last]" )); |
| 289 | TEST_EQUAL(stream_ja_JP_locale<CharT>(std::chrono::month_weekday_last{ |
| 290 | std::chrono::month{1}, std::chrono::weekday_last{std::chrono::weekday{0}}}), |
| 291 | SV("1月/日[last]" )); |
| 292 | TEST_EQUAL(stream_ja_JP_locale<CharT>(std::chrono::month_weekday_last{ |
| 293 | std::chrono::month{2}, std::chrono::weekday_last{std::chrono::weekday{1}}}), |
| 294 | SV("2月/月[last]" )); |
| 295 | TEST_EQUAL(stream_ja_JP_locale<CharT>(std::chrono::month_weekday_last{ |
| 296 | std::chrono::month{3}, std::chrono::weekday_last{std::chrono::weekday{2}}}), |
| 297 | SV("3月/火[last]" )); |
| 298 | TEST_EQUAL(stream_ja_JP_locale<CharT>(std::chrono::month_weekday_last{ |
| 299 | std::chrono::month{4}, std::chrono::weekday_last{std::chrono::weekday{3}}}), |
| 300 | SV("4月/水[last]" )); |
| 301 | TEST_EQUAL(stream_ja_JP_locale<CharT>(std::chrono::month_weekday_last{ |
| 302 | std::chrono::month{5}, std::chrono::weekday_last{std::chrono::weekday{4}}}), |
| 303 | SV("5月/木[last]" )); |
| 304 | TEST_EQUAL(stream_ja_JP_locale<CharT>(std::chrono::month_weekday_last{ |
| 305 | std::chrono::month{6}, std::chrono::weekday_last{std::chrono::weekday{5}}}), |
| 306 | SV("6月/金[last]" )); |
| 307 | TEST_EQUAL(stream_ja_JP_locale<CharT>(std::chrono::month_weekday_last{ |
| 308 | std::chrono::month{7}, std::chrono::weekday_last{std::chrono::weekday{6}}}), |
| 309 | SV("7月/土[last]" )); |
| 310 | TEST_EQUAL(stream_ja_JP_locale<CharT>(std::chrono::month_weekday_last{ |
| 311 | std::chrono::month{8}, std::chrono::weekday_last{std::chrono::weekday{7}}}), |
| 312 | SV("8月/日[last]" )); |
| 313 | TEST_EQUAL(stream_ja_JP_locale<CharT>(std::chrono::month_weekday_last{ |
| 314 | std::chrono::month{9}, std::chrono::weekday_last{std::chrono::weekday{8}}}), |
| 315 | SV("9月/8 is not a valid weekday[last]" )); |
| 316 | # else // defined(_AIX) |
| 317 | TEST_EQUAL(stream_ja_JP_locale<CharT>(std::chrono::month_weekday_last{ |
| 318 | std::chrono::month{0}, std::chrono::weekday_last{std::chrono::weekday{0}}}), |
| 319 | SV("0 is not a valid month/日[last]" )); |
| 320 | TEST_EQUAL(stream_ja_JP_locale<CharT>(std::chrono::month_weekday_last{ |
| 321 | std::chrono::month{1}, std::chrono::weekday_last{std::chrono::weekday{0}}}), |
| 322 | SV(" 1月/日[last]" )); |
| 323 | TEST_EQUAL(stream_ja_JP_locale<CharT>(std::chrono::month_weekday_last{ |
| 324 | std::chrono::month{2}, std::chrono::weekday_last{std::chrono::weekday{1}}}), |
| 325 | SV(" 2月/月[last]" )); |
| 326 | TEST_EQUAL(stream_ja_JP_locale<CharT>(std::chrono::month_weekday_last{ |
| 327 | std::chrono::month{3}, std::chrono::weekday_last{std::chrono::weekday{2}}}), |
| 328 | SV(" 3月/火[last]" )); |
| 329 | TEST_EQUAL(stream_ja_JP_locale<CharT>(std::chrono::month_weekday_last{ |
| 330 | std::chrono::month{4}, std::chrono::weekday_last{std::chrono::weekday{3}}}), |
| 331 | SV(" 4月/水[last]" )); |
| 332 | TEST_EQUAL(stream_ja_JP_locale<CharT>(std::chrono::month_weekday_last{ |
| 333 | std::chrono::month{5}, std::chrono::weekday_last{std::chrono::weekday{4}}}), |
| 334 | SV(" 5月/木[last]" )); |
| 335 | TEST_EQUAL(stream_ja_JP_locale<CharT>(std::chrono::month_weekday_last{ |
| 336 | std::chrono::month{6}, std::chrono::weekday_last{std::chrono::weekday{5}}}), |
| 337 | SV(" 6月/金[last]" )); |
| 338 | TEST_EQUAL(stream_ja_JP_locale<CharT>(std::chrono::month_weekday_last{ |
| 339 | std::chrono::month{7}, std::chrono::weekday_last{std::chrono::weekday{6}}}), |
| 340 | SV(" 7月/土[last]" )); |
| 341 | TEST_EQUAL(stream_ja_JP_locale<CharT>(std::chrono::month_weekday_last{ |
| 342 | std::chrono::month{8}, std::chrono::weekday_last{std::chrono::weekday{7}}}), |
| 343 | SV(" 8月/日[last]" )); |
| 344 | TEST_EQUAL(stream_ja_JP_locale<CharT>(std::chrono::month_weekday_last{ |
| 345 | std::chrono::month{9}, std::chrono::weekday_last{std::chrono::weekday{8}}}), |
| 346 | SV(" 9月/8 is not a valid weekday[last]" )); |
| 347 | # endif // defined(_AIX) |
| 348 | TEST_EQUAL(stream_ja_JP_locale<CharT>(std::chrono::month_weekday_last{ |
| 349 | std::chrono::month{10}, std::chrono::weekday_last{std::chrono::weekday{0}}}), |
| 350 | SV("10月/日[last]" )); |
| 351 | TEST_EQUAL(stream_ja_JP_locale<CharT>(std::chrono::month_weekday_last{ |
| 352 | std::chrono::month{11}, std::chrono::weekday_last{std::chrono::weekday{0}}}), |
| 353 | SV("11月/日[last]" )); |
| 354 | TEST_EQUAL(stream_ja_JP_locale<CharT>(std::chrono::month_weekday_last{ |
| 355 | std::chrono::month{12}, std::chrono::weekday_last{std::chrono::weekday{0}}}), |
| 356 | SV("12月/日[last]" )); |
| 357 | #endif // defined(__APPLE__) || defined(_WIN32) |
| 358 | TEST_EQUAL(stream_ja_JP_locale<CharT>(std::chrono::month_weekday_last{ |
| 359 | std::chrono::month{13}, std::chrono::weekday_last{std::chrono::weekday{0}}}), |
| 360 | SV("13 is not a valid month/日[last]" )); |
| 361 | TEST_EQUAL(stream_ja_JP_locale<CharT>(std::chrono::month_weekday_last{ |
| 362 | std::chrono::month{255}, std::chrono::weekday_last{std::chrono::weekday{8}}}), |
| 363 | SV("255 is not a valid month/8 is not a valid weekday[last]" )); |
| 364 | } |
| 365 | |
| 366 | int main(int, char**) { |
| 367 | test<char>(); |
| 368 | |
| 369 | #ifndef TEST_HAS_NO_WIDE_CHARACTERS |
| 370 | test<wchar_t>(); |
| 371 | #endif |
| 372 | |
| 373 | return 0; |
| 374 | } |
| 375 | |