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