diff --git a/libcxx/include/__format/unicode.h b/libcxx/include/__format/unicode.h --- a/libcxx/include/__format/unicode.h +++ b/libcxx/include/__format/unicode.h @@ -87,17 +87,15 @@ } // https://www.unicode.org/glossary/#surrogate_code_point -[[nodiscard]] _LIBCPP_HIDE_FROM_ABI inline constexpr bool __is_surrogate(char32_t __value) { +[[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr bool __is_surrogate(char32_t __value) { return __value >= 0xd800 && __value <= 0xdfff; } // https://www.unicode.org/glossary/#code_point -[[nodiscard]] _LIBCPP_HIDE_FROM_ABI inline constexpr bool __is_code_point(char32_t __value) { - return __value <= 0x10ffff; -} +[[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr bool __is_code_point(char32_t __value) { return __value <= 0x10ffff; } // https://www.unicode.org/glossary/#unicode_scalar_value -[[nodiscard]] _LIBCPP_HIDE_FROM_ABI inline constexpr bool __is_scalar_value(char32_t __value) { +[[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr bool __is_scalar_value(char32_t __value) { return __unicode::__is_code_point(__value) && !__unicode::__is_surrogate(__value); } diff --git a/libcxx/test/std/time/time.hms/time.hms.nonmembers/ostream.pass.cpp b/libcxx/test/std/time/time.hms/time.hms.nonmembers/ostream.pass.cpp --- a/libcxx/test/std/time/time.hms/time.hms.nonmembers/ostream.pass.cpp +++ b/libcxx/test/std/time/time.hms/time.hms.nonmembers/ostream.pass.cpp @@ -13,9 +13,6 @@ // TODO FMT Evaluate gcc-12 status // UNSUPPORTED: gcc-12 -// TODO FMT Investigate Windows issues. -// UNSUPPORTED: msvc, target={{.+}}-windows-gnu - // XFAIL: availability-fp_to_chars-missing // REQUIRES: locale.fr_FR.UTF-8 diff --git a/libcxx/test/std/time/time.cal/time.cal.day/time.cal.day.nonmembers/ostream.pass.cpp b/libcxx/test/std/time/time.cal/time.cal.day/time.cal.day.nonmembers/ostream.pass.cpp --- a/libcxx/test/std/time/time.cal/time.cal.day/time.cal.day.nonmembers/ostream.pass.cpp +++ b/libcxx/test/std/time/time.cal/time.cal.day/time.cal.day.nonmembers/ostream.pass.cpp @@ -10,8 +10,6 @@ // UNSUPPORTED: no-localization // UNSUPPORTED: libcpp-has-no-incomplete-format -// TODO FMT Investigate Windows issues. -// UNSUPPORTED msvc, target={{.+}}-windows-gnu // TODO FMT Evaluate gcc-12 status // UNSUPPORTED: gcc-12 diff --git a/libcxx/test/std/time/time.cal/time.cal.md/time.cal.md.nonmembers/ostream.pass.cpp b/libcxx/test/std/time/time.cal/time.cal.md/time.cal.md.nonmembers/ostream.pass.cpp --- a/libcxx/test/std/time/time.cal/time.cal.md/time.cal.md.nonmembers/ostream.pass.cpp +++ b/libcxx/test/std/time/time.cal/time.cal.md/time.cal.md.nonmembers/ostream.pass.cpp @@ -10,9 +10,6 @@ // UNSUPPORTED: no-localization // UNSUPPORTED: libcpp-has-no-incomplete-format -// TODO FMT Investigate Windows issues. -// UNSUPPORTED: msvc, target={{.+}}-windows-gnu - // TODO FMT It seems GCC uses too much memory in the CI and fails. // UNSUPPORTED: gcc-12 @@ -36,9 +33,16 @@ #include "make_string.h" #include "platform_support.h" // locale name macros #include "test_macros.h" +#include "assert_macros.h" +#include "concat_macros.h" #define SV(S) MAKE_STRING_VIEW(CharT, S) +#define TEST_EQUAL(OUT, EXPECTED) \ + TEST_REQUIRE(OUT == EXPECTED, \ + TEST_WRITE_CONCATENATED( \ + "\nExpression ", #OUT, "\nExpected output ", EXPECTED, "\nActual output ", OUT, '\n')); + template static std::basic_string stream_c_locale(std::chrono::month_day md) { std::basic_stringstream sstr; @@ -68,63 +72,70 @@ static void test() { using namespace std::literals::chrono_literals; - assert(stream_c_locale(std::chrono::month_day{std::chrono::month{0}, 0d}) == - SV("0 is not a valid month/00 is not a valid day")); - assert(stream_c_locale(std::chrono::month_day{std::chrono::month{0}, 1d}) == SV("0 is not a valid month/01")); - assert(stream_c_locale(std::chrono::month_day{std::chrono::month{1}, 255d}) == - SV("Jan/255 is not a valid day")); - assert(stream_c_locale(std::chrono::month_day{std::chrono::month{1}, 31d}) == SV("Jan/31")); + TEST_EQUAL(stream_c_locale(std::chrono::month_day{std::chrono::month{0}, 0d}), + SV("0 is not a valid month/00 is not a valid day")); + TEST_EQUAL(stream_c_locale(std::chrono::month_day{std::chrono::month{0}, 1d}), + SV("0 is not a valid month/01")); + TEST_EQUAL(stream_c_locale(std::chrono::month_day{std::chrono::month{1}, 255d}), + SV("Jan/255 is not a valid day")); + TEST_EQUAL(stream_c_locale(std::chrono::month_day{std::chrono::month{1}, 31d}), SV("Jan/31")); // February is considered valid with 29 days; it lacks the year information // to do a proper validation. - assert(stream_c_locale(std::chrono::month_day{std::chrono::month{2}, 29d}) == SV("Feb/29")); + TEST_EQUAL(stream_c_locale(std::chrono::month_day{std::chrono::month{2}, 29d}), SV("Feb/29")); // The month_day stream operator has no validation, this means never validate // dates don't get // Jun/31 is not a valid month day // which is inconsistent with other stream operators. // TODO FMT file an issue about this. - assert(stream_c_locale(std::chrono::month_day{std::chrono::month{6}, 31d}) == SV("Jun/31")); + TEST_EQUAL(stream_c_locale(std::chrono::month_day{std::chrono::month{6}, 31d}), SV("Jun/31")); - assert(stream_fr_FR_locale(std::chrono::month_day{std::chrono::month{0}, 0d}) == - SV("0 is not a valid month/00 is not a valid day")); - assert(stream_fr_FR_locale(std::chrono::month_day{std::chrono::month{0}, 1d}) == - SV("0 is not a valid month/01")); + TEST_EQUAL(stream_fr_FR_locale(std::chrono::month_day{std::chrono::month{0}, 0d}), + SV("0 is not a valid month/00 is not a valid day")); + TEST_EQUAL(stream_fr_FR_locale(std::chrono::month_day{std::chrono::month{0}, 1d}), + SV("0 is not a valid month/01")); #if defined(__APPLE__) - assert(stream_fr_FR_locale(std::chrono::month_day{std::chrono::month{1}, 255d}) == - SV("jan/255 is not a valid day")); - assert(stream_fr_FR_locale(std::chrono::month_day{std::chrono::month{1}, 31d}) == SV("jan/31")); - assert(stream_fr_FR_locale(std::chrono::month_day{std::chrono::month{2}, 29d}) == SV("fév/29")); - assert(stream_fr_FR_locale(std::chrono::month_day{std::chrono::month{6}, 31d}) == SV("jui/31")); + TEST_EQUAL(stream_fr_FR_locale(std::chrono::month_day{std::chrono::month{1}, 255d}), + SV("jan/255 is not a valid day")); + TEST_EQUAL(stream_fr_FR_locale(std::chrono::month_day{std::chrono::month{1}, 31d}), SV("jan/31")); + TEST_EQUAL(stream_fr_FR_locale(std::chrono::month_day{std::chrono::month{2}, 29d}), SV("fév/29")); + TEST_EQUAL(stream_fr_FR_locale(std::chrono::month_day{std::chrono::month{6}, 31d}), SV("jui/31")); #else // defined(__APPLE__) - assert(stream_fr_FR_locale(std::chrono::month_day{std::chrono::month{1}, 255d}) == - SV("janv./255 is not a valid day")); - assert(stream_fr_FR_locale(std::chrono::month_day{std::chrono::month{1}, 31d}) == SV("janv./31")); - assert(stream_fr_FR_locale(std::chrono::month_day{std::chrono::month{2}, 29d}) == SV("févr./29")); - assert(stream_fr_FR_locale(std::chrono::month_day{std::chrono::month{6}, 31d}) == SV("juin/31")); + TEST_EQUAL(stream_fr_FR_locale(std::chrono::month_day{std::chrono::month{1}, 255d}), + SV("janv./255 is not a valid day")); + TEST_EQUAL(stream_fr_FR_locale(std::chrono::month_day{std::chrono::month{1}, 31d}), SV("janv./31")); + TEST_EQUAL(stream_fr_FR_locale(std::chrono::month_day{std::chrono::month{2}, 29d}), SV("févr./29")); + TEST_EQUAL(stream_fr_FR_locale(std::chrono::month_day{std::chrono::month{6}, 31d}), SV("juin/31")); #endif // defined(__APPLE__) - assert(stream_ja_JP_locale(std::chrono::month_day{std::chrono::month{0}, 0d}) == - SV("0 is not a valid month/00 is not a valid day")); - assert(stream_ja_JP_locale(std::chrono::month_day{std::chrono::month{0}, 1d}) == - SV("0 is not a valid month/01")); + TEST_EQUAL(stream_ja_JP_locale(std::chrono::month_day{std::chrono::month{0}, 0d}), + SV("0 is not a valid month/00 is not a valid day")); + TEST_EQUAL(stream_ja_JP_locale(std::chrono::month_day{std::chrono::month{0}, 1d}), + SV("0 is not a valid month/01")); #if defined(__APPLE__) - assert(stream_ja_JP_locale(std::chrono::month_day{std::chrono::month{1}, 255d}) == - SV(" 1/255 is not a valid day")); - assert(stream_ja_JP_locale(std::chrono::month_day{std::chrono::month{1}, 31d}) == SV(" 1/31")); - assert(stream_ja_JP_locale(std::chrono::month_day{std::chrono::month{2}, 29d}) == SV(" 2/29")); - assert(stream_ja_JP_locale(std::chrono::month_day{std::chrono::month{6}, 31d}) == SV(" 6/31")); -#elif defined(_AIX) || defined(_WIN32) // defined(__APPLE__) - assert(stream_ja_JP_locale(std::chrono::month_day{std::chrono::month{1}, 255d}) == - SV("1月/255 is not a valid day")); - assert(stream_ja_JP_locale(std::chrono::month_day{std::chrono::month{1}, 31d}) == SV("1月/31")); - assert(stream_ja_JP_locale(std::chrono::month_day{std::chrono::month{2}, 29d}) == SV("2月/29")); - assert(stream_ja_JP_locale(std::chrono::month_day{std::chrono::month{6}, 31d}) == SV("6月/31")); -#else // defined(__APPLE__) - assert(stream_ja_JP_locale(std::chrono::month_day{std::chrono::month{1}, 255d}) == - SV(" 1月/255 is not a valid day")); - assert(stream_ja_JP_locale(std::chrono::month_day{std::chrono::month{1}, 31d}) == SV(" 1月/31")); - assert(stream_ja_JP_locale(std::chrono::month_day{std::chrono::month{2}, 29d}) == SV(" 2月/29")); - assert(stream_ja_JP_locale(std::chrono::month_day{std::chrono::month{6}, 31d}) == SV(" 6月/31")); -#endif // defined(__APPLE__) + TEST_EQUAL(stream_ja_JP_locale(std::chrono::month_day{std::chrono::month{1}, 255d}), + SV(" 1/255 is not a valid day")); + TEST_EQUAL(stream_ja_JP_locale(std::chrono::month_day{std::chrono::month{1}, 31d}), SV(" 1/31")); + TEST_EQUAL(stream_ja_JP_locale(std::chrono::month_day{std::chrono::month{2}, 29d}), SV(" 2/29")); + TEST_EQUAL(stream_ja_JP_locale(std::chrono::month_day{std::chrono::month{6}, 31d}), SV(" 6/31")); +#elif defined(_WIN32) // defined(__APPLE__) + TEST_EQUAL(stream_ja_JP_locale(std::chrono::month_day{std::chrono::month{1}, 255d}), + SV("1/255 is not a valid day")); + TEST_EQUAL(stream_ja_JP_locale(std::chrono::month_day{std::chrono::month{1}, 31d}), SV("1/31")); + TEST_EQUAL(stream_ja_JP_locale(std::chrono::month_day{std::chrono::month{2}, 29d}), SV("2/29")); + TEST_EQUAL(stream_ja_JP_locale(std::chrono::month_day{std::chrono::month{6}, 31d}), SV("6/31")); +#elif defined(_AIX) // defined(__APPLE__) + TEST_EQUAL(stream_ja_JP_locale(std::chrono::month_day{std::chrono::month{1}, 255d}), + SV("1月/255 is not a valid day")); + TEST_EQUAL(stream_ja_JP_locale(std::chrono::month_day{std::chrono::month{1}, 31d}), SV("1月/31")); + TEST_EQUAL(stream_ja_JP_locale(std::chrono::month_day{std::chrono::month{2}, 29d}), SV("2月/29")); + TEST_EQUAL(stream_ja_JP_locale(std::chrono::month_day{std::chrono::month{6}, 31d}), SV("6月/31")); +#else // defined(__APPLE__) + TEST_EQUAL(stream_ja_JP_locale(std::chrono::month_day{std::chrono::month{1}, 255d}), + SV(" 1月/255 is not a valid day")); + TEST_EQUAL(stream_ja_JP_locale(std::chrono::month_day{std::chrono::month{1}, 31d}), SV(" 1月/31")); + TEST_EQUAL(stream_ja_JP_locale(std::chrono::month_day{std::chrono::month{2}, 29d}), SV(" 2月/29")); + TEST_EQUAL(stream_ja_JP_locale(std::chrono::month_day{std::chrono::month{6}, 31d}), SV(" 6月/31")); +#endif // defined(__APPLE__) } int main(int, char**) { diff --git a/libcxx/test/std/time/time.cal/time.cal.mdlast/ostream.pass.cpp b/libcxx/test/std/time/time.cal/time.cal.mdlast/ostream.pass.cpp --- a/libcxx/test/std/time/time.cal/time.cal.mdlast/ostream.pass.cpp +++ b/libcxx/test/std/time/time.cal/time.cal.mdlast/ostream.pass.cpp @@ -12,9 +12,6 @@ // UNSUPPORTED: no-localization // UNSUPPORTED: libcpp-has-no-incomplete-format -// TODO FMT Investigate Windows issues. -// UNSUPPORTED: msvc, target={{.+}}-windows-gnu - // TODO FMT It seems GCC uses too much memory in the CI and fails. // UNSUPPORTED: gcc-12 @@ -39,9 +36,16 @@ #include "make_string.h" #include "platform_support.h" // locale name macros #include "test_macros.h" +#include "assert_macros.h" +#include "concat_macros.h" #define SV(S) MAKE_STRING_VIEW(CharT, S) +#define TEST_EQUAL(OUT, EXPECTED) \ + TEST_REQUIRE(OUT == EXPECTED, \ + TEST_WRITE_CONCATENATED( \ + "\nExpression ", #OUT, "\nExpected output ", EXPECTED, "\nActual output ", OUT, '\n')); + template static std::basic_string stream_c_locale(std::chrono::month_day_last mdl) { std::basic_stringstream sstr; @@ -69,108 +73,120 @@ template static void test() { - assert(stream_c_locale(std::chrono::month_day_last{std::chrono::month{0}}) == - SV("0 is not a valid month/last")); - assert(stream_c_locale(std::chrono::month_day_last{std::chrono::month{1}}) == SV("Jan/last")); - assert(stream_c_locale(std::chrono::month_day_last{std::chrono::month{2}}) == SV("Feb/last")); - assert(stream_c_locale(std::chrono::month_day_last{std::chrono::month{3}}) == SV("Mar/last")); - assert(stream_c_locale(std::chrono::month_day_last{std::chrono::month{4}}) == SV("Apr/last")); - assert(stream_c_locale(std::chrono::month_day_last{std::chrono::month{5}}) == SV("May/last")); - assert(stream_c_locale(std::chrono::month_day_last{std::chrono::month{6}}) == SV("Jun/last")); - assert(stream_c_locale(std::chrono::month_day_last{std::chrono::month{7}}) == SV("Jul/last")); - assert(stream_c_locale(std::chrono::month_day_last{std::chrono::month{8}}) == SV("Aug/last")); - assert(stream_c_locale(std::chrono::month_day_last{std::chrono::month{9}}) == SV("Sep/last")); - assert(stream_c_locale(std::chrono::month_day_last{std::chrono::month{10}}) == SV("Oct/last")); - assert(stream_c_locale(std::chrono::month_day_last{std::chrono::month{11}}) == SV("Nov/last")); - assert(stream_c_locale(std::chrono::month_day_last{std::chrono::month{12}}) == SV("Dec/last")); - assert(stream_c_locale(std::chrono::month_day_last{std::chrono::month{13}}) == - SV("13 is not a valid month/last")); - assert(stream_c_locale(std::chrono::month_day_last{std::chrono::month{255}}) == - SV("255 is not a valid month/last")); - - assert(stream_fr_FR_locale(std::chrono::month_day_last{std::chrono::month{0}}) == - SV("0 is not a valid month/last")); + TEST_EQUAL(stream_c_locale(std::chrono::month_day_last{std::chrono::month{0}}), + SV("0 is not a valid month/last")); + TEST_EQUAL(stream_c_locale(std::chrono::month_day_last{std::chrono::month{1}}), SV("Jan/last")); + TEST_EQUAL(stream_c_locale(std::chrono::month_day_last{std::chrono::month{2}}), SV("Feb/last")); + TEST_EQUAL(stream_c_locale(std::chrono::month_day_last{std::chrono::month{3}}), SV("Mar/last")); + TEST_EQUAL(stream_c_locale(std::chrono::month_day_last{std::chrono::month{4}}), SV("Apr/last")); + TEST_EQUAL(stream_c_locale(std::chrono::month_day_last{std::chrono::month{5}}), SV("May/last")); + TEST_EQUAL(stream_c_locale(std::chrono::month_day_last{std::chrono::month{6}}), SV("Jun/last")); + TEST_EQUAL(stream_c_locale(std::chrono::month_day_last{std::chrono::month{7}}), SV("Jul/last")); + TEST_EQUAL(stream_c_locale(std::chrono::month_day_last{std::chrono::month{8}}), SV("Aug/last")); + TEST_EQUAL(stream_c_locale(std::chrono::month_day_last{std::chrono::month{9}}), SV("Sep/last")); + TEST_EQUAL(stream_c_locale(std::chrono::month_day_last{std::chrono::month{10}}), SV("Oct/last")); + TEST_EQUAL(stream_c_locale(std::chrono::month_day_last{std::chrono::month{11}}), SV("Nov/last")); + TEST_EQUAL(stream_c_locale(std::chrono::month_day_last{std::chrono::month{12}}), SV("Dec/last")); + TEST_EQUAL(stream_c_locale(std::chrono::month_day_last{std::chrono::month{13}}), + SV("13 is not a valid month/last")); + TEST_EQUAL(stream_c_locale(std::chrono::month_day_last{std::chrono::month{255}}), + SV("255 is not a valid month/last")); + + TEST_EQUAL(stream_fr_FR_locale(std::chrono::month_day_last{std::chrono::month{0}}), + SV("0 is not a valid month/last")); #if defined(__APPLE__) - assert(stream_fr_FR_locale(std::chrono::month_day_last{std::chrono::month{1}}) == SV("jan/last")); - assert(stream_fr_FR_locale(std::chrono::month_day_last{std::chrono::month{2}}) == SV("fév/last")); - assert(stream_fr_FR_locale(std::chrono::month_day_last{std::chrono::month{3}}) == SV("mar/last")); - assert(stream_fr_FR_locale(std::chrono::month_day_last{std::chrono::month{4}}) == SV("avr/last")); - assert(stream_fr_FR_locale(std::chrono::month_day_last{std::chrono::month{5}}) == SV("mai/last")); - assert(stream_fr_FR_locale(std::chrono::month_day_last{std::chrono::month{6}}) == SV("jui/last")); - assert(stream_fr_FR_locale(std::chrono::month_day_last{std::chrono::month{7}}) == SV("jul/last")); - assert(stream_fr_FR_locale(std::chrono::month_day_last{std::chrono::month{8}}) == SV("aoû/last")); - assert(stream_fr_FR_locale(std::chrono::month_day_last{std::chrono::month{9}}) == SV("sep/last")); - assert(stream_fr_FR_locale(std::chrono::month_day_last{std::chrono::month{10}}) == SV("oct/last")); - assert(stream_fr_FR_locale(std::chrono::month_day_last{std::chrono::month{11}}) == SV("nov/last")); - assert(stream_fr_FR_locale(std::chrono::month_day_last{std::chrono::month{12}}) == SV("déc/last")); + TEST_EQUAL(stream_fr_FR_locale(std::chrono::month_day_last{std::chrono::month{1}}), SV("jan/last")); + TEST_EQUAL(stream_fr_FR_locale(std::chrono::month_day_last{std::chrono::month{2}}), SV("fév/last")); + TEST_EQUAL(stream_fr_FR_locale(std::chrono::month_day_last{std::chrono::month{3}}), SV("mar/last")); + TEST_EQUAL(stream_fr_FR_locale(std::chrono::month_day_last{std::chrono::month{4}}), SV("avr/last")); + TEST_EQUAL(stream_fr_FR_locale(std::chrono::month_day_last{std::chrono::month{5}}), SV("mai/last")); + TEST_EQUAL(stream_fr_FR_locale(std::chrono::month_day_last{std::chrono::month{6}}), SV("jui/last")); + TEST_EQUAL(stream_fr_FR_locale(std::chrono::month_day_last{std::chrono::month{7}}), SV("jul/last")); + TEST_EQUAL(stream_fr_FR_locale(std::chrono::month_day_last{std::chrono::month{8}}), SV("aoû/last")); + TEST_EQUAL(stream_fr_FR_locale(std::chrono::month_day_last{std::chrono::month{9}}), SV("sep/last")); + TEST_EQUAL(stream_fr_FR_locale(std::chrono::month_day_last{std::chrono::month{10}}), SV("oct/last")); + TEST_EQUAL(stream_fr_FR_locale(std::chrono::month_day_last{std::chrono::month{11}}), SV("nov/last")); + TEST_EQUAL(stream_fr_FR_locale(std::chrono::month_day_last{std::chrono::month{12}}), SV("déc/last")); #else // defined(__APPLE__) - assert(stream_fr_FR_locale(std::chrono::month_day_last{std::chrono::month{1}}) == SV("janv./last")); - assert(stream_fr_FR_locale(std::chrono::month_day_last{std::chrono::month{2}}) == SV("févr./last")); - assert(stream_fr_FR_locale(std::chrono::month_day_last{std::chrono::month{3}}) == SV("mars/last")); + TEST_EQUAL(stream_fr_FR_locale(std::chrono::month_day_last{std::chrono::month{1}}), SV("janv./last")); + TEST_EQUAL(stream_fr_FR_locale(std::chrono::month_day_last{std::chrono::month{2}}), SV("févr./last")); + TEST_EQUAL(stream_fr_FR_locale(std::chrono::month_day_last{std::chrono::month{3}}), SV("mars/last")); # if defined(_WIN32) || defined(_AIX) - assert(stream_fr_FR_locale(std::chrono::month_day_last{std::chrono::month{4}}) == SV("avr./last")); + TEST_EQUAL(stream_fr_FR_locale(std::chrono::month_day_last{std::chrono::month{4}}), SV("avr./last")); # else - assert(stream_fr_FR_locale(std::chrono::month_day_last{std::chrono::month{4}}) == SV("avril/last")); + TEST_EQUAL(stream_fr_FR_locale(std::chrono::month_day_last{std::chrono::month{4}}), SV("avril/last")); # endif - assert(stream_fr_FR_locale(std::chrono::month_day_last{std::chrono::month{5}}) == SV("mai/last")); - assert(stream_fr_FR_locale(std::chrono::month_day_last{std::chrono::month{6}}) == SV("juin/last")); - assert(stream_fr_FR_locale(std::chrono::month_day_last{std::chrono::month{7}}) == SV("juil./last")); - assert(stream_fr_FR_locale(std::chrono::month_day_last{std::chrono::month{8}}) == SV("août/last")); - assert(stream_fr_FR_locale(std::chrono::month_day_last{std::chrono::month{9}}) == SV("sept./last")); - assert(stream_fr_FR_locale(std::chrono::month_day_last{std::chrono::month{10}}) == SV("oct./last")); - assert(stream_fr_FR_locale(std::chrono::month_day_last{std::chrono::month{11}}) == SV("nov./last")); - assert(stream_fr_FR_locale(std::chrono::month_day_last{std::chrono::month{12}}) == SV("déc./last")); + TEST_EQUAL(stream_fr_FR_locale(std::chrono::month_day_last{std::chrono::month{5}}), SV("mai/last")); + TEST_EQUAL(stream_fr_FR_locale(std::chrono::month_day_last{std::chrono::month{6}}), SV("juin/last")); + TEST_EQUAL(stream_fr_FR_locale(std::chrono::month_day_last{std::chrono::month{7}}), SV("juil./last")); + TEST_EQUAL(stream_fr_FR_locale(std::chrono::month_day_last{std::chrono::month{8}}), SV("août/last")); + TEST_EQUAL(stream_fr_FR_locale(std::chrono::month_day_last{std::chrono::month{9}}), SV("sept./last")); + TEST_EQUAL(stream_fr_FR_locale(std::chrono::month_day_last{std::chrono::month{10}}), SV("oct./last")); + TEST_EQUAL(stream_fr_FR_locale(std::chrono::month_day_last{std::chrono::month{11}}), SV("nov./last")); + TEST_EQUAL(stream_fr_FR_locale(std::chrono::month_day_last{std::chrono::month{12}}), SV("déc./last")); #endif // defined(__APPLE__) - assert(stream_fr_FR_locale(std::chrono::month_day_last{std::chrono::month{13}}) == - SV("13 is not a valid month/last")); - assert(stream_fr_FR_locale(std::chrono::month_day_last{std::chrono::month{255}}) == - SV("255 is not a valid month/last")); - - assert(stream_ja_JP_locale(std::chrono::month_day_last{std::chrono::month{0}}) == - SV("0 is not a valid month/last")); -#if defined(__APPLE__) - assert(stream_ja_JP_locale(std::chrono::month_day_last{std::chrono::month{1}}) == SV(" 1/last")); - assert(stream_ja_JP_locale(std::chrono::month_day_last{std::chrono::month{2}}) == SV(" 2/last")); - assert(stream_ja_JP_locale(std::chrono::month_day_last{std::chrono::month{3}}) == SV(" 3/last")); - assert(stream_ja_JP_locale(std::chrono::month_day_last{std::chrono::month{4}}) == SV(" 4/last")); - assert(stream_ja_JP_locale(std::chrono::month_day_last{std::chrono::month{5}}) == SV(" 5/last")); - assert(stream_ja_JP_locale(std::chrono::month_day_last{std::chrono::month{6}}) == SV(" 6/last")); - assert(stream_ja_JP_locale(std::chrono::month_day_last{std::chrono::month{7}}) == SV(" 7/last")); - assert(stream_ja_JP_locale(std::chrono::month_day_last{std::chrono::month{8}}) == SV(" 8/last")); - assert(stream_ja_JP_locale(std::chrono::month_day_last{std::chrono::month{9}}) == SV(" 9/last")); - assert(stream_ja_JP_locale(std::chrono::month_day_last{std::chrono::month{10}}) == SV("10/last")); - assert(stream_ja_JP_locale(std::chrono::month_day_last{std::chrono::month{11}}) == SV("11/last")); - assert(stream_ja_JP_locale(std::chrono::month_day_last{std::chrono::month{12}}) == SV("12/last")); -#else // defined(__APPLE__) -# if defined(_WIN32) || defined(_AIX) - assert(stream_ja_JP_locale(std::chrono::month_day_last{std::chrono::month{1}}) == SV("1月/last")); - assert(stream_ja_JP_locale(std::chrono::month_day_last{std::chrono::month{2}}) == SV("2月/last")); - assert(stream_ja_JP_locale(std::chrono::month_day_last{std::chrono::month{3}}) == SV("3月/last")); - assert(stream_ja_JP_locale(std::chrono::month_day_last{std::chrono::month{4}}) == SV("4月/last")); - assert(stream_ja_JP_locale(std::chrono::month_day_last{std::chrono::month{5}}) == SV("5月/last")); - assert(stream_ja_JP_locale(std::chrono::month_day_last{std::chrono::month{6}}) == SV("6月/last")); - assert(stream_ja_JP_locale(std::chrono::month_day_last{std::chrono::month{7}}) == SV("7月/last")); - assert(stream_ja_JP_locale(std::chrono::month_day_last{std::chrono::month{8}}) == SV("8月/last")); - assert(stream_ja_JP_locale(std::chrono::month_day_last{std::chrono::month{9}}) == SV("9月/last")); -# else // defined(_WIN32) || defined(_AIX) - assert(stream_ja_JP_locale(std::chrono::month_day_last{std::chrono::month{1}}) == SV(" 1月/last")); - assert(stream_ja_JP_locale(std::chrono::month_day_last{std::chrono::month{2}}) == SV(" 2月/last")); - assert(stream_ja_JP_locale(std::chrono::month_day_last{std::chrono::month{3}}) == SV(" 3月/last")); - assert(stream_ja_JP_locale(std::chrono::month_day_last{std::chrono::month{4}}) == SV(" 4月/last")); - assert(stream_ja_JP_locale(std::chrono::month_day_last{std::chrono::month{5}}) == SV(" 5月/last")); - assert(stream_ja_JP_locale(std::chrono::month_day_last{std::chrono::month{6}}) == SV(" 6月/last")); - assert(stream_ja_JP_locale(std::chrono::month_day_last{std::chrono::month{7}}) == SV(" 7月/last")); - assert(stream_ja_JP_locale(std::chrono::month_day_last{std::chrono::month{8}}) == SV(" 8月/last")); - assert(stream_ja_JP_locale(std::chrono::month_day_last{std::chrono::month{9}}) == SV(" 9月/last")); -# endif // defined(_WIN32) || defined(_AIX) - assert(stream_ja_JP_locale(std::chrono::month_day_last{std::chrono::month{10}}) == SV("10月/last")); - assert(stream_ja_JP_locale(std::chrono::month_day_last{std::chrono::month{11}}) == SV("11月/last")); - assert(stream_ja_JP_locale(std::chrono::month_day_last{std::chrono::month{12}}) == SV("12月/last")); -#endif // defined(__APPLE__) - assert(stream_ja_JP_locale(std::chrono::month_day_last{std::chrono::month{13}}) == - SV("13 is not a valid month/last")); - assert(stream_ja_JP_locale(std::chrono::month_day_last{std::chrono::month{255}}) == - SV("255 is not a valid month/last")); + TEST_EQUAL(stream_fr_FR_locale(std::chrono::month_day_last{std::chrono::month{13}}), + SV("13 is not a valid month/last")); + TEST_EQUAL(stream_fr_FR_locale(std::chrono::month_day_last{std::chrono::month{255}}), + SV("255 is not a valid month/last")); + + TEST_EQUAL(stream_ja_JP_locale(std::chrono::month_day_last{std::chrono::month{0}}), + SV("0 is not a valid month/last")); +#if defined(__APPLE__) || defined(_WIN32) +# if defined(__APPLE__) + TEST_EQUAL(stream_ja_JP_locale(std::chrono::month_day_last{std::chrono::month{1}}), SV(" 1/last")); + TEST_EQUAL(stream_ja_JP_locale(std::chrono::month_day_last{std::chrono::month{2}}), SV(" 2/last")); + TEST_EQUAL(stream_ja_JP_locale(std::chrono::month_day_last{std::chrono::month{3}}), SV(" 3/last")); + TEST_EQUAL(stream_ja_JP_locale(std::chrono::month_day_last{std::chrono::month{4}}), SV(" 4/last")); + TEST_EQUAL(stream_ja_JP_locale(std::chrono::month_day_last{std::chrono::month{5}}), SV(" 5/last")); + TEST_EQUAL(stream_ja_JP_locale(std::chrono::month_day_last{std::chrono::month{6}}), SV(" 6/last")); + TEST_EQUAL(stream_ja_JP_locale(std::chrono::month_day_last{std::chrono::month{7}}), SV(" 7/last")); + TEST_EQUAL(stream_ja_JP_locale(std::chrono::month_day_last{std::chrono::month{8}}), SV(" 8/last")); + TEST_EQUAL(stream_ja_JP_locale(std::chrono::month_day_last{std::chrono::month{9}}), SV(" 9/last")); +# else // defined(__APPLE__) + TEST_EQUAL(stream_ja_JP_locale(std::chrono::month_day_last{std::chrono::month{1}}), SV("1/last")); + TEST_EQUAL(stream_ja_JP_locale(std::chrono::month_day_last{std::chrono::month{2}}), SV("2/last")); + TEST_EQUAL(stream_ja_JP_locale(std::chrono::month_day_last{std::chrono::month{3}}), SV("3/last")); + TEST_EQUAL(stream_ja_JP_locale(std::chrono::month_day_last{std::chrono::month{4}}), SV("4/last")); + TEST_EQUAL(stream_ja_JP_locale(std::chrono::month_day_last{std::chrono::month{5}}), SV("5/last")); + TEST_EQUAL(stream_ja_JP_locale(std::chrono::month_day_last{std::chrono::month{6}}), SV("6/last")); + TEST_EQUAL(stream_ja_JP_locale(std::chrono::month_day_last{std::chrono::month{7}}), SV("7/last")); + TEST_EQUAL(stream_ja_JP_locale(std::chrono::month_day_last{std::chrono::month{8}}), SV("8/last")); + TEST_EQUAL(stream_ja_JP_locale(std::chrono::month_day_last{std::chrono::month{9}}), SV("9/last")); +# endif // defined(__APPLE__) + TEST_EQUAL(stream_ja_JP_locale(std::chrono::month_day_last{std::chrono::month{10}}), SV("10/last")); + TEST_EQUAL(stream_ja_JP_locale(std::chrono::month_day_last{std::chrono::month{11}}), SV("11/last")); + TEST_EQUAL(stream_ja_JP_locale(std::chrono::month_day_last{std::chrono::month{12}}), SV("12/last")); +#else // defined(__APPLE__) || defined(_WIN32) +# if defined(_AIX) + TEST_EQUAL(stream_ja_JP_locale(std::chrono::month_day_last{std::chrono::month{1}}), SV("1月/last")); + TEST_EQUAL(stream_ja_JP_locale(std::chrono::month_day_last{std::chrono::month{2}}), SV("2月/last")); + TEST_EQUAL(stream_ja_JP_locale(std::chrono::month_day_last{std::chrono::month{3}}), SV("3月/last")); + TEST_EQUAL(stream_ja_JP_locale(std::chrono::month_day_last{std::chrono::month{4}}), SV("4月/last")); + TEST_EQUAL(stream_ja_JP_locale(std::chrono::month_day_last{std::chrono::month{5}}), SV("5月/last")); + TEST_EQUAL(stream_ja_JP_locale(std::chrono::month_day_last{std::chrono::month{6}}), SV("6月/last")); + TEST_EQUAL(stream_ja_JP_locale(std::chrono::month_day_last{std::chrono::month{7}}), SV("7月/last")); + TEST_EQUAL(stream_ja_JP_locale(std::chrono::month_day_last{std::chrono::month{8}}), SV("8月/last")); + TEST_EQUAL(stream_ja_JP_locale(std::chrono::month_day_last{std::chrono::month{9}}), SV("9月/last")); +# else // defined(_AIX) + TEST_EQUAL(stream_ja_JP_locale(std::chrono::month_day_last{std::chrono::month{1}}), SV(" 1月/last")); + TEST_EQUAL(stream_ja_JP_locale(std::chrono::month_day_last{std::chrono::month{2}}), SV(" 2月/last")); + TEST_EQUAL(stream_ja_JP_locale(std::chrono::month_day_last{std::chrono::month{3}}), SV(" 3月/last")); + TEST_EQUAL(stream_ja_JP_locale(std::chrono::month_day_last{std::chrono::month{4}}), SV(" 4月/last")); + TEST_EQUAL(stream_ja_JP_locale(std::chrono::month_day_last{std::chrono::month{5}}), SV(" 5月/last")); + TEST_EQUAL(stream_ja_JP_locale(std::chrono::month_day_last{std::chrono::month{6}}), SV(" 6月/last")); + TEST_EQUAL(stream_ja_JP_locale(std::chrono::month_day_last{std::chrono::month{7}}), SV(" 7月/last")); + TEST_EQUAL(stream_ja_JP_locale(std::chrono::month_day_last{std::chrono::month{8}}), SV(" 8月/last")); + TEST_EQUAL(stream_ja_JP_locale(std::chrono::month_day_last{std::chrono::month{9}}), SV(" 9月/last")); +# endif // defined(_AIX) + TEST_EQUAL(stream_ja_JP_locale(std::chrono::month_day_last{std::chrono::month{10}}), SV("10月/last")); + TEST_EQUAL(stream_ja_JP_locale(std::chrono::month_day_last{std::chrono::month{11}}), SV("11月/last")); + TEST_EQUAL(stream_ja_JP_locale(std::chrono::month_day_last{std::chrono::month{12}}), SV("12月/last")); +#endif // defined(__APPLE__) || defined(_WIN32) + TEST_EQUAL(stream_ja_JP_locale(std::chrono::month_day_last{std::chrono::month{13}}), + SV("13 is not a valid month/last")); + TEST_EQUAL(stream_ja_JP_locale(std::chrono::month_day_last{std::chrono::month{255}}), + SV("255 is not a valid month/last")); } int main(int, char**) { diff --git a/libcxx/test/std/time/time.cal/time.cal.month/time.cal.month.nonmembers/ostream.pass.cpp b/libcxx/test/std/time/time.cal/time.cal.month/time.cal.month.nonmembers/ostream.pass.cpp --- a/libcxx/test/std/time/time.cal/time.cal.month/time.cal.month.nonmembers/ostream.pass.cpp +++ b/libcxx/test/std/time/time.cal/time.cal.month/time.cal.month.nonmembers/ostream.pass.cpp @@ -12,9 +12,6 @@ // UNSUPPORTED: no-localization // UNSUPPORTED: libcpp-has-no-incomplete-format -// TODO FMT Investigate Windows issues. -// UNSUPPORTED: msvc, target={{.+}}-windows-gnu - // TODO FMT Fix this test using GCC, it currently crashes. // UNSUPPORTED: gcc-12 @@ -39,9 +36,16 @@ #include "make_string.h" #include "platform_support.h" // locale name macros #include "test_macros.h" +#include "assert_macros.h" +#include "concat_macros.h" #define SV(S) MAKE_STRING_VIEW(CharT, S) +#define TEST_EQUAL(OUT, EXPECTED) \ + TEST_REQUIRE(OUT == EXPECTED, \ + TEST_WRITE_CONCATENATED( \ + "\nExpression ", #OUT, "\nExpected output ", EXPECTED, "\nActual output ", OUT, '\n')); + template static std::basic_string stream_c_locale(std::chrono::month month) { std::basic_stringstream sstr; @@ -69,99 +73,111 @@ template static void test() { - assert(stream_c_locale(std::chrono::month{0}) == SV("0 is not a valid month")); - assert(stream_c_locale(std::chrono::month{1}) == SV("Jan")); - assert(stream_c_locale(std::chrono::month{2}) == SV("Feb")); - assert(stream_c_locale(std::chrono::month{3}) == SV("Mar")); - assert(stream_c_locale(std::chrono::month{4}) == SV("Apr")); - assert(stream_c_locale(std::chrono::month{5}) == SV("May")); - assert(stream_c_locale(std::chrono::month{6}) == SV("Jun")); - assert(stream_c_locale(std::chrono::month{7}) == SV("Jul")); - assert(stream_c_locale(std::chrono::month{8}) == SV("Aug")); - assert(stream_c_locale(std::chrono::month{9}) == SV("Sep")); - assert(stream_c_locale(std::chrono::month{10}) == SV("Oct")); - assert(stream_c_locale(std::chrono::month{11}) == SV("Nov")); - assert(stream_c_locale(std::chrono::month{12}) == SV("Dec")); - assert(stream_c_locale(std::chrono::month{13}) == SV("13 is not a valid month")); - assert(stream_c_locale(std::chrono::month{255}) == SV("255 is not a valid month")); - - assert(stream_fr_FR_locale(std::chrono::month{0}) == SV("0 is not a valid month")); + TEST_EQUAL(stream_c_locale(std::chrono::month{0}), SV("0 is not a valid month")); + TEST_EQUAL(stream_c_locale(std::chrono::month{1}), SV("Jan")); + TEST_EQUAL(stream_c_locale(std::chrono::month{2}), SV("Feb")); + TEST_EQUAL(stream_c_locale(std::chrono::month{3}), SV("Mar")); + TEST_EQUAL(stream_c_locale(std::chrono::month{4}), SV("Apr")); + TEST_EQUAL(stream_c_locale(std::chrono::month{5}), SV("May")); + TEST_EQUAL(stream_c_locale(std::chrono::month{6}), SV("Jun")); + TEST_EQUAL(stream_c_locale(std::chrono::month{7}), SV("Jul")); + TEST_EQUAL(stream_c_locale(std::chrono::month{8}), SV("Aug")); + TEST_EQUAL(stream_c_locale(std::chrono::month{9}), SV("Sep")); + TEST_EQUAL(stream_c_locale(std::chrono::month{10}), SV("Oct")); + TEST_EQUAL(stream_c_locale(std::chrono::month{11}), SV("Nov")); + TEST_EQUAL(stream_c_locale(std::chrono::month{12}), SV("Dec")); + TEST_EQUAL(stream_c_locale(std::chrono::month{13}), SV("13 is not a valid month")); + TEST_EQUAL(stream_c_locale(std::chrono::month{255}), SV("255 is not a valid month")); + + TEST_EQUAL(stream_fr_FR_locale(std::chrono::month{0}), SV("0 is not a valid month")); #if defined(__APPLE__) - assert(stream_fr_FR_locale(std::chrono::month{1}) == SV("jan")); - assert(stream_fr_FR_locale(std::chrono::month{2}) == SV("fév")); - assert(stream_fr_FR_locale(std::chrono::month{3}) == SV("mar")); - assert(stream_fr_FR_locale(std::chrono::month{4}) == SV("avr")); - assert(stream_fr_FR_locale(std::chrono::month{5}) == SV("mai")); - assert(stream_fr_FR_locale(std::chrono::month{6}) == SV("jui")); - assert(stream_fr_FR_locale(std::chrono::month{7}) == SV("jul")); - assert(stream_fr_FR_locale(std::chrono::month{8}) == SV("aoû")); - assert(stream_fr_FR_locale(std::chrono::month{9}) == SV("sep")); - assert(stream_fr_FR_locale(std::chrono::month{10}) == SV("oct")); - assert(stream_fr_FR_locale(std::chrono::month{11}) == SV("nov")); - assert(stream_fr_FR_locale(std::chrono::month{12}) == SV("déc")); + TEST_EQUAL(stream_fr_FR_locale(std::chrono::month{1}), SV("jan")); + TEST_EQUAL(stream_fr_FR_locale(std::chrono::month{2}), SV("fév")); + TEST_EQUAL(stream_fr_FR_locale(std::chrono::month{3}), SV("mar")); + TEST_EQUAL(stream_fr_FR_locale(std::chrono::month{4}), SV("avr")); + TEST_EQUAL(stream_fr_FR_locale(std::chrono::month{5}), SV("mai")); + TEST_EQUAL(stream_fr_FR_locale(std::chrono::month{6}), SV("jui")); + TEST_EQUAL(stream_fr_FR_locale(std::chrono::month{7}), SV("jul")); + TEST_EQUAL(stream_fr_FR_locale(std::chrono::month{8}), SV("aoû")); + TEST_EQUAL(stream_fr_FR_locale(std::chrono::month{9}), SV("sep")); + TEST_EQUAL(stream_fr_FR_locale(std::chrono::month{10}), SV("oct")); + TEST_EQUAL(stream_fr_FR_locale(std::chrono::month{11}), SV("nov")); + TEST_EQUAL(stream_fr_FR_locale(std::chrono::month{12}), SV("déc")); #else // defined(__APPLE__) - assert(stream_fr_FR_locale(std::chrono::month{1}) == SV("janv.")); - assert(stream_fr_FR_locale(std::chrono::month{2}) == SV("févr.")); - assert(stream_fr_FR_locale(std::chrono::month{3}) == SV("mars")); + TEST_EQUAL(stream_fr_FR_locale(std::chrono::month{1}), SV("janv.")); + TEST_EQUAL(stream_fr_FR_locale(std::chrono::month{2}), SV("févr.")); + TEST_EQUAL(stream_fr_FR_locale(std::chrono::month{3}), SV("mars")); # if defined(_WIN32) || defined(_AIX) - assert(stream_fr_FR_locale(std::chrono::month{4}) == SV("avr.")); + TEST_EQUAL(stream_fr_FR_locale(std::chrono::month{4}), SV("avr.")); # else - assert(stream_fr_FR_locale(std::chrono::month{4}) == SV("avril")); + TEST_EQUAL(stream_fr_FR_locale(std::chrono::month{4}), SV("avril")); # endif - assert(stream_fr_FR_locale(std::chrono::month{5}) == SV("mai")); - assert(stream_fr_FR_locale(std::chrono::month{6}) == SV("juin")); - assert(stream_fr_FR_locale(std::chrono::month{7}) == SV("juil.")); - assert(stream_fr_FR_locale(std::chrono::month{8}) == SV("août")); - assert(stream_fr_FR_locale(std::chrono::month{9}) == SV("sept.")); - assert(stream_fr_FR_locale(std::chrono::month{10}) == SV("oct.")); - assert(stream_fr_FR_locale(std::chrono::month{11}) == SV("nov.")); - assert(stream_fr_FR_locale(std::chrono::month{12}) == SV("déc.")); + TEST_EQUAL(stream_fr_FR_locale(std::chrono::month{5}), SV("mai")); + TEST_EQUAL(stream_fr_FR_locale(std::chrono::month{6}), SV("juin")); + TEST_EQUAL(stream_fr_FR_locale(std::chrono::month{7}), SV("juil.")); + TEST_EQUAL(stream_fr_FR_locale(std::chrono::month{8}), SV("août")); + TEST_EQUAL(stream_fr_FR_locale(std::chrono::month{9}), SV("sept.")); + TEST_EQUAL(stream_fr_FR_locale(std::chrono::month{10}), SV("oct.")); + TEST_EQUAL(stream_fr_FR_locale(std::chrono::month{11}), SV("nov.")); + TEST_EQUAL(stream_fr_FR_locale(std::chrono::month{12}), SV("déc.")); #endif // defined(__APPLE__) - assert(stream_fr_FR_locale(std::chrono::month{13}) == SV("13 is not a valid month")); - assert(stream_fr_FR_locale(std::chrono::month{255}) == SV("255 is not a valid month")); - - assert(stream_ja_JP_locale(std::chrono::month{0}) == SV("0 is not a valid month")); -#if defined(__APPLE__) - assert(stream_ja_JP_locale(std::chrono::month{1}) == SV(" 1")); - assert(stream_ja_JP_locale(std::chrono::month{2}) == SV(" 2")); - assert(stream_ja_JP_locale(std::chrono::month{3}) == SV(" 3")); - assert(stream_ja_JP_locale(std::chrono::month{4}) == SV(" 4")); - assert(stream_ja_JP_locale(std::chrono::month{5}) == SV(" 5")); - assert(stream_ja_JP_locale(std::chrono::month{6}) == SV(" 6")); - assert(stream_ja_JP_locale(std::chrono::month{7}) == SV(" 7")); - assert(stream_ja_JP_locale(std::chrono::month{8}) == SV(" 8")); - assert(stream_ja_JP_locale(std::chrono::month{9}) == SV(" 9")); - assert(stream_ja_JP_locale(std::chrono::month{10}) == SV("10")); - assert(stream_ja_JP_locale(std::chrono::month{11}) == SV("11")); - assert(stream_ja_JP_locale(std::chrono::month{12}) == SV("12")); -#else // defined(__APPLE__) -# if defined(_WIN32) || defined(_AIX) - assert(stream_ja_JP_locale(std::chrono::month{1}) == SV("1月")); - assert(stream_ja_JP_locale(std::chrono::month{2}) == SV("2月")); - assert(stream_ja_JP_locale(std::chrono::month{3}) == SV("3月")); - assert(stream_ja_JP_locale(std::chrono::month{4}) == SV("4月")); - assert(stream_ja_JP_locale(std::chrono::month{5}) == SV("5月")); - assert(stream_ja_JP_locale(std::chrono::month{6}) == SV("6月")); - assert(stream_ja_JP_locale(std::chrono::month{7}) == SV("7月")); - assert(stream_ja_JP_locale(std::chrono::month{8}) == SV("8月")); - assert(stream_ja_JP_locale(std::chrono::month{9}) == SV("9月")); -# else // defined(_WIN32) || defined(_AIX) - assert(stream_ja_JP_locale(std::chrono::month{1}) == SV(" 1月")); - assert(stream_ja_JP_locale(std::chrono::month{2}) == SV(" 2月")); - assert(stream_ja_JP_locale(std::chrono::month{3}) == SV(" 3月")); - assert(stream_ja_JP_locale(std::chrono::month{4}) == SV(" 4月")); - assert(stream_ja_JP_locale(std::chrono::month{5}) == SV(" 5月")); - assert(stream_ja_JP_locale(std::chrono::month{6}) == SV(" 6月")); - assert(stream_ja_JP_locale(std::chrono::month{7}) == SV(" 7月")); - assert(stream_ja_JP_locale(std::chrono::month{8}) == SV(" 8月")); - assert(stream_ja_JP_locale(std::chrono::month{9}) == SV(" 9月")); -# endif // defined(_WIN32) || defined(_AIX) - assert(stream_ja_JP_locale(std::chrono::month{10}) == SV("10月")); - assert(stream_ja_JP_locale(std::chrono::month{11}) == SV("11月")); - assert(stream_ja_JP_locale(std::chrono::month{12}) == SV("12月")); -#endif // defined(__APPLE__) - assert(stream_ja_JP_locale(std::chrono::month{13}) == SV("13 is not a valid month")); - assert(stream_ja_JP_locale(std::chrono::month{255}) == SV("255 is not a valid month")); + TEST_EQUAL(stream_fr_FR_locale(std::chrono::month{13}), SV("13 is not a valid month")); + TEST_EQUAL(stream_fr_FR_locale(std::chrono::month{255}), SV("255 is not a valid month")); + + TEST_EQUAL(stream_ja_JP_locale(std::chrono::month{0}), SV("0 is not a valid month")); +#if defined(__APPLE__) || defined(_WIN32) +# if defined(__APPLE__) + TEST_EQUAL(stream_ja_JP_locale(std::chrono::month{1}), SV(" 1")); + TEST_EQUAL(stream_ja_JP_locale(std::chrono::month{2}), SV(" 2")); + TEST_EQUAL(stream_ja_JP_locale(std::chrono::month{3}), SV(" 3")); + TEST_EQUAL(stream_ja_JP_locale(std::chrono::month{4}), SV(" 4")); + TEST_EQUAL(stream_ja_JP_locale(std::chrono::month{5}), SV(" 5")); + TEST_EQUAL(stream_ja_JP_locale(std::chrono::month{6}), SV(" 6")); + TEST_EQUAL(stream_ja_JP_locale(std::chrono::month{7}), SV(" 7")); + TEST_EQUAL(stream_ja_JP_locale(std::chrono::month{8}), SV(" 8")); + TEST_EQUAL(stream_ja_JP_locale(std::chrono::month{9}), SV(" 9")); +# else // defined(__APPLE__) + TEST_EQUAL(stream_ja_JP_locale(std::chrono::month{1}), SV("1")); + TEST_EQUAL(stream_ja_JP_locale(std::chrono::month{2}), SV("2")); + TEST_EQUAL(stream_ja_JP_locale(std::chrono::month{3}), SV("3")); + TEST_EQUAL(stream_ja_JP_locale(std::chrono::month{4}), SV("4")); + TEST_EQUAL(stream_ja_JP_locale(std::chrono::month{5}), SV("5")); + TEST_EQUAL(stream_ja_JP_locale(std::chrono::month{6}), SV("6")); + TEST_EQUAL(stream_ja_JP_locale(std::chrono::month{7}), SV("7")); + TEST_EQUAL(stream_ja_JP_locale(std::chrono::month{8}), SV("8")); + TEST_EQUAL(stream_ja_JP_locale(std::chrono::month{9}), SV("9")); +# endif // defined(__APPLE__) + TEST_EQUAL(stream_ja_JP_locale(std::chrono::month{10}), SV("10")); + TEST_EQUAL(stream_ja_JP_locale(std::chrono::month{11}), SV("11")); + TEST_EQUAL(stream_ja_JP_locale(std::chrono::month{12}), SV("12")); +#else // defined(__APPLE__)|| defined(_WIN32) +# if defined(_AIX) + TEST_EQUAL(stream_ja_JP_locale(std::chrono::month{1}), SV("1月")); + TEST_EQUAL(stream_ja_JP_locale(std::chrono::month{2}), SV("2月")); + TEST_EQUAL(stream_ja_JP_locale(std::chrono::month{3}), SV("3月")); + TEST_EQUAL(stream_ja_JP_locale(std::chrono::month{4}), SV("4月")); + TEST_EQUAL(stream_ja_JP_locale(std::chrono::month{5}), SV("5月")); + TEST_EQUAL(stream_ja_JP_locale(std::chrono::month{6}), SV("6月")); + TEST_EQUAL(stream_ja_JP_locale(std::chrono::month{7}), SV("7月")); + TEST_EQUAL(stream_ja_JP_locale(std::chrono::month{8}), SV("8月")); + TEST_EQUAL(stream_ja_JP_locale(std::chrono::month{9}), SV("9月")); +# else // defined(_AIX) + TEST_EQUAL(stream_ja_JP_locale(std::chrono::month{1}), SV(" 1月")); + TEST_EQUAL(stream_ja_JP_locale(std::chrono::month{2}), SV(" 2月")); + TEST_EQUAL(stream_ja_JP_locale(std::chrono::month{3}), SV(" 3月")); + TEST_EQUAL(stream_ja_JP_locale(std::chrono::month{4}), SV(" 4月")); + TEST_EQUAL(stream_ja_JP_locale(std::chrono::month{5}), SV(" 5月")); + TEST_EQUAL(stream_ja_JP_locale(std::chrono::month{6}), SV(" 6月")); + TEST_EQUAL(stream_ja_JP_locale(std::chrono::month{7}), SV(" 7月")); + TEST_EQUAL(stream_ja_JP_locale(std::chrono::month{8}), SV(" 8月")); + TEST_EQUAL(stream_ja_JP_locale(std::chrono::month{9}), SV(" 9月")); +# endif // defined(_AIX) + TEST_EQUAL(stream_ja_JP_locale(std::chrono::month{10}), SV("10月")); + TEST_EQUAL(stream_ja_JP_locale(std::chrono::month{11}), SV("11月")); + TEST_EQUAL(stream_ja_JP_locale(std::chrono::month{12}), SV("12月")); +#endif // defined(__APPLE__)|| defined(_WIN32) + TEST_EQUAL(stream_ja_JP_locale(std::chrono::month{13}), SV("13 is not a valid month")); + TEST_EQUAL(stream_ja_JP_locale(std::chrono::month{255}), SV("255 is not a valid month")); } int main(int, char**) { diff --git a/libcxx/test/std/time/time.cal/time.cal.mwd/time.cal.mwd.nonmembers/ostream.pass.cpp b/libcxx/test/std/time/time.cal/time.cal.mwd/time.cal.mwd.nonmembers/ostream.pass.cpp --- a/libcxx/test/std/time/time.cal/time.cal.mwd/time.cal.mwd.nonmembers/ostream.pass.cpp +++ b/libcxx/test/std/time/time.cal/time.cal.mwd/time.cal.mwd.nonmembers/ostream.pass.cpp @@ -12,9 +12,6 @@ // UNSUPPORTED: no-localization // UNSUPPORTED: libcpp-has-no-incomplete-format -// TODO FMT Investigate Windows issues. -// UNSUPPORTED: msvc, target={{.+}}-windows-gnu - // TODO FMT It seems GCC uses too much memory in the CI and fails. // UNSUPPORTED: gcc-12 @@ -39,9 +36,16 @@ #include "make_string.h" #include "platform_support.h" // locale name macros #include "test_macros.h" +#include "assert_macros.h" +#include "concat_macros.h" #define SV(S) MAKE_STRING_VIEW(CharT, S) +#define TEST_EQUAL(OUT, EXPECTED) \ + TEST_REQUIRE(OUT == EXPECTED, \ + TEST_WRITE_CONCATENATED( \ + "\nExpression ", #OUT, "\nExpected output ", EXPECTED, "\nActual output ", OUT, '\n')); + template static std::basic_string stream_c_locale(std::chrono::month_weekday mwd) { std::basic_stringstream sstr; @@ -69,214 +73,296 @@ template static void test() { - assert(stream_c_locale(std::chrono::month_weekday{ - std::chrono::month{0}, std::chrono::weekday_indexed{std::chrono::weekday{0}, 1}}) == - SV("0 is not a valid month/Sun[1]")); - assert(stream_c_locale(std::chrono::month_weekday{ - std::chrono::month{1}, std::chrono::weekday_indexed{std::chrono::weekday{1}, 1}}) == SV("Jan/Mon[1]")); - assert(stream_c_locale(std::chrono::month_weekday{ - std::chrono::month{2}, std::chrono::weekday_indexed{std::chrono::weekday{2}, 2}}) == SV("Feb/Tue[2]")); - assert(stream_c_locale(std::chrono::month_weekday{ - std::chrono::month{3}, std::chrono::weekday_indexed{std::chrono::weekday{3}, 3}}) == SV("Mar/Wed[3]")); - assert(stream_c_locale(std::chrono::month_weekday{ - std::chrono::month{4}, std::chrono::weekday_indexed{std::chrono::weekday{4}, 4}}) == SV("Apr/Thu[4]")); - assert(stream_c_locale(std::chrono::month_weekday{ - std::chrono::month{5}, std::chrono::weekday_indexed{std::chrono::weekday{5}, 5}}) == SV("May/Fri[5]")); - assert(stream_c_locale(std::chrono::month_weekday{ - std::chrono::month{6}, std::chrono::weekday_indexed{std::chrono::weekday{6}, 6}}) == - SV("Jun/Sat[6 is not a valid index]")); - assert(stream_c_locale(std::chrono::month_weekday{ - std::chrono::month{7}, std::chrono::weekday_indexed{std::chrono::weekday{7}, 7}}) == - SV("Jul/Sun[7 is not a valid index]")); - assert(stream_c_locale(std::chrono::month_weekday{ - std::chrono::month{8}, std::chrono::weekday_indexed{std::chrono::weekday{8}, 0}}) == - SV("Aug/8 is not a valid weekday[0 is not a valid index]")); - assert(stream_c_locale(std::chrono::month_weekday{ - std::chrono::month{9}, std::chrono::weekday_indexed{std::chrono::weekday{0}, 1}}) == SV("Sep/Sun[1]")); - assert(stream_c_locale(std::chrono::month_weekday{ - std::chrono::month{10}, std::chrono::weekday_indexed{std::chrono::weekday{0}, 1}}) == SV("Oct/Sun[1]")); - assert(stream_c_locale(std::chrono::month_weekday{ - std::chrono::month{11}, std::chrono::weekday_indexed{std::chrono::weekday{0}, 1}}) == SV("Nov/Sun[1]")); - assert(stream_c_locale(std::chrono::month_weekday{ - std::chrono::month{12}, std::chrono::weekday_indexed{std::chrono::weekday{0}, 1}}) == SV("Dec/Sun[1]")); - assert(stream_c_locale(std::chrono::month_weekday{ - std::chrono::month{13}, std::chrono::weekday_indexed{std::chrono::weekday{0}, 1}}) == - SV("13 is not a valid month/Sun[1]")); - assert(stream_c_locale(std::chrono::month_weekday{ - std::chrono::month{255}, std::chrono::weekday_indexed{std::chrono::weekday{8}, 0}}) == - SV("255 is not a valid month/8 is not a valid weekday[0 is not a valid index]")); + TEST_EQUAL(stream_c_locale(std::chrono::month_weekday{ + std::chrono::month{0}, std::chrono::weekday_indexed{std::chrono::weekday{0}, 1}}), + SV("0 is not a valid month/Sun[1]")); + TEST_EQUAL(stream_c_locale(std::chrono::month_weekday{ + std::chrono::month{1}, std::chrono::weekday_indexed{std::chrono::weekday{1}, 1}}), + SV("Jan/Mon[1]")); + TEST_EQUAL(stream_c_locale(std::chrono::month_weekday{ + std::chrono::month{2}, std::chrono::weekday_indexed{std::chrono::weekday{2}, 2}}), + SV("Feb/Tue[2]")); + TEST_EQUAL(stream_c_locale(std::chrono::month_weekday{ + std::chrono::month{3}, std::chrono::weekday_indexed{std::chrono::weekday{3}, 3}}), + SV("Mar/Wed[3]")); + TEST_EQUAL(stream_c_locale(std::chrono::month_weekday{ + std::chrono::month{4}, std::chrono::weekday_indexed{std::chrono::weekday{4}, 4}}), + SV("Apr/Thu[4]")); + TEST_EQUAL(stream_c_locale(std::chrono::month_weekday{ + std::chrono::month{5}, std::chrono::weekday_indexed{std::chrono::weekday{5}, 5}}), + SV("May/Fri[5]")); + TEST_EQUAL(stream_c_locale(std::chrono::month_weekday{ + std::chrono::month{6}, std::chrono::weekday_indexed{std::chrono::weekday{6}, 6}}), + SV("Jun/Sat[6 is not a valid index]")); + TEST_EQUAL(stream_c_locale(std::chrono::month_weekday{ + std::chrono::month{7}, std::chrono::weekday_indexed{std::chrono::weekday{7}, 7}}), + SV("Jul/Sun[7 is not a valid index]")); + TEST_EQUAL(stream_c_locale(std::chrono::month_weekday{ + std::chrono::month{8}, std::chrono::weekday_indexed{std::chrono::weekday{8}, 0}}), + SV("Aug/8 is not a valid weekday[0 is not a valid index]")); + TEST_EQUAL(stream_c_locale(std::chrono::month_weekday{ + std::chrono::month{9}, std::chrono::weekday_indexed{std::chrono::weekday{0}, 1}}), + SV("Sep/Sun[1]")); + TEST_EQUAL(stream_c_locale(std::chrono::month_weekday{ + std::chrono::month{10}, std::chrono::weekday_indexed{std::chrono::weekday{0}, 1}}), + SV("Oct/Sun[1]")); + TEST_EQUAL(stream_c_locale(std::chrono::month_weekday{ + std::chrono::month{11}, std::chrono::weekday_indexed{std::chrono::weekday{0}, 1}}), + SV("Nov/Sun[1]")); + TEST_EQUAL(stream_c_locale(std::chrono::month_weekday{ + std::chrono::month{12}, std::chrono::weekday_indexed{std::chrono::weekday{0}, 1}}), + SV("Dec/Sun[1]")); + TEST_EQUAL(stream_c_locale(std::chrono::month_weekday{ + std::chrono::month{13}, std::chrono::weekday_indexed{std::chrono::weekday{0}, 1}}), + SV("13 is not a valid month/Sun[1]")); + TEST_EQUAL(stream_c_locale(std::chrono::month_weekday{ + std::chrono::month{255}, std::chrono::weekday_indexed{std::chrono::weekday{8}, 0}}), + SV("255 is not a valid month/8 is not a valid weekday[0 is not a valid index]")); #if defined(__APPLE__) - assert(stream_fr_FR_locale(std::chrono::month_weekday{ - std::chrono::month{0}, std::chrono::weekday_indexed{std::chrono::weekday{0}, 1}}) == - SV("0 is not a valid month/Dim[1]")); - assert(stream_fr_FR_locale(std::chrono::month_weekday{ - std::chrono::month{1}, std::chrono::weekday_indexed{std::chrono::weekday{1}, 1}}) == SV("jan/Lun[1]")); - assert(stream_fr_FR_locale(std::chrono::month_weekday{ - std::chrono::month{2}, std::chrono::weekday_indexed{std::chrono::weekday{2}, 2}}) == SV("fév/Mar[2]")); - assert(stream_fr_FR_locale(std::chrono::month_weekday{ - std::chrono::month{3}, std::chrono::weekday_indexed{std::chrono::weekday{3}, 3}}) == SV("mar/Mer[3]")); - assert(stream_fr_FR_locale(std::chrono::month_weekday{ - std::chrono::month{4}, std::chrono::weekday_indexed{std::chrono::weekday{4}, 4}}) == SV("avr/Jeu[4]")); - assert(stream_fr_FR_locale(std::chrono::month_weekday{ - std::chrono::month{5}, std::chrono::weekday_indexed{std::chrono::weekday{5}, 5}}) == SV("mai/Ven[5]")); - assert(stream_fr_FR_locale(std::chrono::month_weekday{ - std::chrono::month{6}, std::chrono::weekday_indexed{std::chrono::weekday{6}, 6}}) == - SV("jui/Sam[6 is not a valid index]")); - assert(stream_fr_FR_locale(std::chrono::month_weekday{ - std::chrono::month{7}, std::chrono::weekday_indexed{std::chrono::weekday{7}, 7}}) == - SV("jul/Dim[7 is not a valid index]")); - assert(stream_fr_FR_locale(std::chrono::month_weekday{ - std::chrono::month{8}, std::chrono::weekday_indexed{std::chrono::weekday{8}, 0}}) == - SV("aoû/8 is not a valid weekday[0 is not a valid index]")); - assert(stream_fr_FR_locale(std::chrono::month_weekday{ - std::chrono::month{9}, std::chrono::weekday_indexed{std::chrono::weekday{0}, 1}}) == SV("sep/Dim[1]")); - assert(stream_fr_FR_locale(std::chrono::month_weekday{ - std::chrono::month{10}, std::chrono::weekday_indexed{std::chrono::weekday{0}, 1}}) == SV("oct/Dim[1]")); - assert(stream_fr_FR_locale(std::chrono::month_weekday{ - std::chrono::month{11}, std::chrono::weekday_indexed{std::chrono::weekday{0}, 1}}) == SV("nov/Dim[1]")); - assert(stream_fr_FR_locale(std::chrono::month_weekday{ - std::chrono::month{12}, std::chrono::weekday_indexed{std::chrono::weekday{0}, 1}}) == SV("déc/Dim[1]")); - assert(stream_fr_FR_locale(std::chrono::month_weekday{ - std::chrono::month{13}, std::chrono::weekday_indexed{std::chrono::weekday{0}, 1}}) == - SV("13 is not a valid month/Dim[1]")); - assert(stream_fr_FR_locale(std::chrono::month_weekday{ - std::chrono::month{255}, std::chrono::weekday_indexed{std::chrono::weekday{8}, 0}}) == - SV("255 is not a valid month/8 is not a valid weekday[0 is not a valid index]")); + TEST_EQUAL(stream_fr_FR_locale(std::chrono::month_weekday{ + std::chrono::month{0}, std::chrono::weekday_indexed{std::chrono::weekday{0}, 1}}), + SV("0 is not a valid month/Dim[1]")); + TEST_EQUAL(stream_fr_FR_locale(std::chrono::month_weekday{ + std::chrono::month{1}, std::chrono::weekday_indexed{std::chrono::weekday{1}, 1}}), + SV("jan/Lun[1]")); + TEST_EQUAL(stream_fr_FR_locale(std::chrono::month_weekday{ + std::chrono::month{2}, std::chrono::weekday_indexed{std::chrono::weekday{2}, 2}}), + SV("fév/Mar[2]")); + TEST_EQUAL(stream_fr_FR_locale(std::chrono::month_weekday{ + std::chrono::month{3}, std::chrono::weekday_indexed{std::chrono::weekday{3}, 3}}), + SV("mar/Mer[3]")); + TEST_EQUAL(stream_fr_FR_locale(std::chrono::month_weekday{ + std::chrono::month{4}, std::chrono::weekday_indexed{std::chrono::weekday{4}, 4}}), + SV("avr/Jeu[4]")); + TEST_EQUAL(stream_fr_FR_locale(std::chrono::month_weekday{ + std::chrono::month{5}, std::chrono::weekday_indexed{std::chrono::weekday{5}, 5}}), + SV("mai/Ven[5]")); + TEST_EQUAL(stream_fr_FR_locale(std::chrono::month_weekday{ + std::chrono::month{6}, std::chrono::weekday_indexed{std::chrono::weekday{6}, 6}}), + SV("jui/Sam[6 is not a valid index]")); + TEST_EQUAL(stream_fr_FR_locale(std::chrono::month_weekday{ + std::chrono::month{7}, std::chrono::weekday_indexed{std::chrono::weekday{7}, 7}}), + SV("jul/Dim[7 is not a valid index]")); + TEST_EQUAL(stream_fr_FR_locale(std::chrono::month_weekday{ + std::chrono::month{8}, std::chrono::weekday_indexed{std::chrono::weekday{8}, 0}}), + SV("aoû/8 is not a valid weekday[0 is not a valid index]")); + TEST_EQUAL(stream_fr_FR_locale(std::chrono::month_weekday{ + std::chrono::month{9}, std::chrono::weekday_indexed{std::chrono::weekday{0}, 1}}), + SV("sep/Dim[1]")); + TEST_EQUAL(stream_fr_FR_locale(std::chrono::month_weekday{ + std::chrono::month{10}, std::chrono::weekday_indexed{std::chrono::weekday{0}, 1}}), + SV("oct/Dim[1]")); + TEST_EQUAL(stream_fr_FR_locale(std::chrono::month_weekday{ + std::chrono::month{11}, std::chrono::weekday_indexed{std::chrono::weekday{0}, 1}}), + SV("nov/Dim[1]")); + TEST_EQUAL(stream_fr_FR_locale(std::chrono::month_weekday{ + std::chrono::month{12}, std::chrono::weekday_indexed{std::chrono::weekday{0}, 1}}), + SV("déc/Dim[1]")); + TEST_EQUAL(stream_fr_FR_locale(std::chrono::month_weekday{ + std::chrono::month{13}, std::chrono::weekday_indexed{std::chrono::weekday{0}, 1}}), + SV("13 is not a valid month/Dim[1]")); + TEST_EQUAL(stream_fr_FR_locale(std::chrono::month_weekday{ + std::chrono::month{255}, std::chrono::weekday_indexed{std::chrono::weekday{8}, 0}}), + SV("255 is not a valid month/8 is not a valid weekday[0 is not a valid index]")); #else // defined(__APPLE__) - assert(stream_fr_FR_locale(std::chrono::month_weekday{ - std::chrono::month{0}, std::chrono::weekday_indexed{std::chrono::weekday{0}, 1}}) == - SV("0 is not a valid month/dim.[1]")); - assert(stream_fr_FR_locale(std::chrono::month_weekday{ - std::chrono::month{1}, std::chrono::weekday_indexed{std::chrono::weekday{1}, 1}}) == SV("janv./lun.[1]")); - assert(stream_fr_FR_locale(std::chrono::month_weekday{ - std::chrono::month{2}, std::chrono::weekday_indexed{std::chrono::weekday{2}, 2}}) == SV("févr./mar.[2]")); - assert(stream_fr_FR_locale(std::chrono::month_weekday{ - std::chrono::month{3}, std::chrono::weekday_indexed{std::chrono::weekday{3}, 3}}) == SV("mars/mer.[3]")); + TEST_EQUAL(stream_fr_FR_locale(std::chrono::month_weekday{ + std::chrono::month{0}, std::chrono::weekday_indexed{std::chrono::weekday{0}, 1}}), + SV("0 is not a valid month/dim.[1]")); + TEST_EQUAL(stream_fr_FR_locale(std::chrono::month_weekday{ + std::chrono::month{1}, std::chrono::weekday_indexed{std::chrono::weekday{1}, 1}}), + SV("janv./lun.[1]")); + TEST_EQUAL(stream_fr_FR_locale(std::chrono::month_weekday{ + std::chrono::month{2}, std::chrono::weekday_indexed{std::chrono::weekday{2}, 2}}), + SV("févr./mar.[2]")); + TEST_EQUAL(stream_fr_FR_locale(std::chrono::month_weekday{ + std::chrono::month{3}, std::chrono::weekday_indexed{std::chrono::weekday{3}, 3}}), + SV("mars/mer.[3]")); # if defined(_WIN32) || defined(_AIX) - assert(stream_fr_FR_locale(std::chrono::month_weekday{ - std::chrono::month{4}, std::chrono::weekday_indexed{std::chrono::weekday{4}, 4}}) == SV("avr./jeu.[4]")); + TEST_EQUAL(stream_fr_FR_locale(std::chrono::month_weekday{ + std::chrono::month{4}, std::chrono::weekday_indexed{std::chrono::weekday{4}, 4}}), + SV("avr./jeu.[4]")); # else - assert(stream_fr_FR_locale(std::chrono::month_weekday{ - std::chrono::month{4}, std::chrono::weekday_indexed{std::chrono::weekday{4}, 4}}) == SV("avril/jeu.[4]")); + TEST_EQUAL(stream_fr_FR_locale(std::chrono::month_weekday{ + std::chrono::month{4}, std::chrono::weekday_indexed{std::chrono::weekday{4}, 4}}), + SV("avril/jeu.[4]")); # endif - assert(stream_fr_FR_locale(std::chrono::month_weekday{ - std::chrono::month{5}, std::chrono::weekday_indexed{std::chrono::weekday{5}, 5}}) == SV("mai/ven.[5]")); - assert(stream_fr_FR_locale(std::chrono::month_weekday{ - std::chrono::month{6}, std::chrono::weekday_indexed{std::chrono::weekday{6}, 6}}) == - SV("juin/sam.[6 is not a valid index]")); - assert(stream_fr_FR_locale(std::chrono::month_weekday{ - std::chrono::month{7}, std::chrono::weekday_indexed{std::chrono::weekday{7}, 7}}) == - SV("juil./dim.[7 is not a valid index]")); - assert(stream_fr_FR_locale(std::chrono::month_weekday{ - std::chrono::month{8}, std::chrono::weekday_indexed{std::chrono::weekday{8}, 0}}) == - SV("août/8 is not a valid weekday[0 is not a valid index]")); - assert(stream_fr_FR_locale(std::chrono::month_weekday{ - std::chrono::month{9}, std::chrono::weekday_indexed{std::chrono::weekday{0}, 1}}) == SV("sept./dim.[1]")); - assert(stream_fr_FR_locale(std::chrono::month_weekday{ - std::chrono::month{10}, std::chrono::weekday_indexed{std::chrono::weekday{0}, 1}}) == SV("oct./dim.[1]")); - assert(stream_fr_FR_locale(std::chrono::month_weekday{ - std::chrono::month{11}, std::chrono::weekday_indexed{std::chrono::weekday{0}, 1}}) == SV("nov./dim.[1]")); - assert(stream_fr_FR_locale(std::chrono::month_weekday{ - std::chrono::month{12}, std::chrono::weekday_indexed{std::chrono::weekday{0}, 1}}) == SV("déc./dim.[1]")); - assert(stream_fr_FR_locale(std::chrono::month_weekday{ - std::chrono::month{13}, std::chrono::weekday_indexed{std::chrono::weekday{0}, 1}}) == - SV("13 is not a valid month/dim.[1]")); - assert(stream_fr_FR_locale(std::chrono::month_weekday{ - std::chrono::month{255}, std::chrono::weekday_indexed{std::chrono::weekday{8}, 0}}) == - SV("255 is not a valid month/8 is not a valid weekday[0 is not a valid index]")); + TEST_EQUAL(stream_fr_FR_locale(std::chrono::month_weekday{ + std::chrono::month{5}, std::chrono::weekday_indexed{std::chrono::weekday{5}, 5}}), + SV("mai/ven.[5]")); + TEST_EQUAL(stream_fr_FR_locale(std::chrono::month_weekday{ + std::chrono::month{6}, std::chrono::weekday_indexed{std::chrono::weekday{6}, 6}}), + SV("juin/sam.[6 is not a valid index]")); + TEST_EQUAL(stream_fr_FR_locale(std::chrono::month_weekday{ + std::chrono::month{7}, std::chrono::weekday_indexed{std::chrono::weekday{7}, 7}}), + SV("juil./dim.[7 is not a valid index]")); + TEST_EQUAL(stream_fr_FR_locale(std::chrono::month_weekday{ + std::chrono::month{8}, std::chrono::weekday_indexed{std::chrono::weekday{8}, 0}}), + SV("août/8 is not a valid weekday[0 is not a valid index]")); + TEST_EQUAL(stream_fr_FR_locale(std::chrono::month_weekday{ + std::chrono::month{9}, std::chrono::weekday_indexed{std::chrono::weekday{0}, 1}}), + SV("sept./dim.[1]")); + TEST_EQUAL(stream_fr_FR_locale(std::chrono::month_weekday{ + std::chrono::month{10}, std::chrono::weekday_indexed{std::chrono::weekday{0}, 1}}), + SV("oct./dim.[1]")); + TEST_EQUAL(stream_fr_FR_locale(std::chrono::month_weekday{ + std::chrono::month{11}, std::chrono::weekday_indexed{std::chrono::weekday{0}, 1}}), + SV("nov./dim.[1]")); + TEST_EQUAL(stream_fr_FR_locale(std::chrono::month_weekday{ + std::chrono::month{12}, std::chrono::weekday_indexed{std::chrono::weekday{0}, 1}}), + SV("déc./dim.[1]")); + TEST_EQUAL(stream_fr_FR_locale(std::chrono::month_weekday{ + std::chrono::month{13}, std::chrono::weekday_indexed{std::chrono::weekday{0}, 1}}), + SV("13 is not a valid month/dim.[1]")); + TEST_EQUAL(stream_fr_FR_locale(std::chrono::month_weekday{ + std::chrono::month{255}, std::chrono::weekday_indexed{std::chrono::weekday{8}, 0}}), + SV("255 is not a valid month/8 is not a valid weekday[0 is not a valid index]")); #endif // defined(__APPLE__) - assert(stream_ja_JP_locale(std::chrono::month_weekday{ - std::chrono::month{0}, std::chrono::weekday_indexed{std::chrono::weekday{0}, 1}}) == - SV("0 is not a valid month/日[1]")); -#if defined(__APPLE__) - assert(stream_ja_JP_locale(std::chrono::month_weekday{ - std::chrono::month{1}, std::chrono::weekday_indexed{std::chrono::weekday{1}, 1}}) == SV(" 1/月[1]")); - assert(stream_ja_JP_locale(std::chrono::month_weekday{ - std::chrono::month{2}, std::chrono::weekday_indexed{std::chrono::weekday{2}, 2}}) == SV(" 2/火[2]")); - assert(stream_ja_JP_locale(std::chrono::month_weekday{ - std::chrono::month{3}, std::chrono::weekday_indexed{std::chrono::weekday{3}, 3}}) == SV(" 3/水[3]")); - assert(stream_ja_JP_locale(std::chrono::month_weekday{ - std::chrono::month{4}, std::chrono::weekday_indexed{std::chrono::weekday{4}, 4}}) == SV(" 4/木[4]")); - assert(stream_ja_JP_locale(std::chrono::month_weekday{ - std::chrono::month{5}, std::chrono::weekday_indexed{std::chrono::weekday{5}, 5}}) == SV(" 5/金[5]")); - assert(stream_ja_JP_locale(std::chrono::month_weekday{ - std::chrono::month{6}, std::chrono::weekday_indexed{std::chrono::weekday{6}, 6}}) == - SV(" 6/土[6 is not a valid index]")); - assert(stream_ja_JP_locale(std::chrono::month_weekday{ - std::chrono::month{7}, std::chrono::weekday_indexed{std::chrono::weekday{7}, 7}}) == - SV(" 7/日[7 is not a valid index]")); - assert(stream_ja_JP_locale(std::chrono::month_weekday{ - std::chrono::month{8}, std::chrono::weekday_indexed{std::chrono::weekday{8}, 0}}) == - SV(" 8/8 is not a valid weekday[0 is not a valid index]")); - assert(stream_ja_JP_locale(std::chrono::month_weekday{ - std::chrono::month{9}, std::chrono::weekday_indexed{std::chrono::weekday{0}, 1}}) == SV(" 9/日[1]")); - assert(stream_ja_JP_locale(std::chrono::month_weekday{ - std::chrono::month{10}, std::chrono::weekday_indexed{std::chrono::weekday{0}, 1}}) == SV("10/日[1]")); - assert(stream_ja_JP_locale(std::chrono::month_weekday{ - std::chrono::month{11}, std::chrono::weekday_indexed{std::chrono::weekday{0}, 1}}) == SV("11/日[1]")); - assert(stream_ja_JP_locale(std::chrono::month_weekday{ - std::chrono::month{12}, std::chrono::weekday_indexed{std::chrono::weekday{0}, 1}}) == SV("12/日[1]")); -#else // defined(__APPLE__) -# if defined(_WIN32) || defined(_AIX) - assert(stream_ja_JP_locale(std::chrono::month_weekday{ - std::chrono::month{1}, std::chrono::weekday_indexed{std::chrono::weekday{1}, 1}}) == SV("1月/月[1]")); - assert(stream_ja_JP_locale(std::chrono::month_weekday{ - std::chrono::month{2}, std::chrono::weekday_indexed{std::chrono::weekday{2}, 2}}) == SV("2月/火[2]")); - assert(stream_ja_JP_locale(std::chrono::month_weekday{ - std::chrono::month{3}, std::chrono::weekday_indexed{std::chrono::weekday{3}, 3}}) == SV("3月/水[3]")); - assert(stream_ja_JP_locale(std::chrono::month_weekday{ - std::chrono::month{4}, std::chrono::weekday_indexed{std::chrono::weekday{4}, 4}}) == SV("4月/木[4]")); - assert(stream_ja_JP_locale(std::chrono::month_weekday{ - std::chrono::month{5}, std::chrono::weekday_indexed{std::chrono::weekday{5}, 5}}) == SV("5月/金[5]")); - assert(stream_ja_JP_locale(std::chrono::month_weekday{ - std::chrono::month{6}, std::chrono::weekday_indexed{std::chrono::weekday{6}, 6}}) == - SV("6月/土[6 is not a valid index]")); - assert(stream_ja_JP_locale(std::chrono::month_weekday{ - std::chrono::month{7}, std::chrono::weekday_indexed{std::chrono::weekday{7}, 7}}) == - SV("7月/日[7 is not a valid index]")); - assert(stream_ja_JP_locale(std::chrono::month_weekday{ - std::chrono::month{8}, std::chrono::weekday_indexed{std::chrono::weekday{8}, 0}}) == - SV("8月/8 is not a valid weekday[0 is not a valid index]")); - assert(stream_ja_JP_locale(std::chrono::month_weekday{ - std::chrono::month{9}, std::chrono::weekday_indexed{std::chrono::weekday{0}, 1}}) == SV("9月/日[1]")); -# else // defined(_WIN32) || defined(_AIX) - assert(stream_ja_JP_locale(std::chrono::month_weekday{ - std::chrono::month{1}, std::chrono::weekday_indexed{std::chrono::weekday{1}, 1}}) == SV(" 1月/月[1]")); - assert(stream_ja_JP_locale(std::chrono::month_weekday{ - std::chrono::month{2}, std::chrono::weekday_indexed{std::chrono::weekday{2}, 2}}) == SV(" 2月/火[2]")); - assert(stream_ja_JP_locale(std::chrono::month_weekday{ - std::chrono::month{3}, std::chrono::weekday_indexed{std::chrono::weekday{3}, 3}}) == SV(" 3月/水[3]")); - assert(stream_ja_JP_locale(std::chrono::month_weekday{ - std::chrono::month{4}, std::chrono::weekday_indexed{std::chrono::weekday{4}, 4}}) == SV(" 4月/木[4]")); - assert(stream_ja_JP_locale(std::chrono::month_weekday{ - std::chrono::month{5}, std::chrono::weekday_indexed{std::chrono::weekday{5}, 5}}) == SV(" 5月/金[5]")); - assert(stream_ja_JP_locale(std::chrono::month_weekday{ - std::chrono::month{6}, std::chrono::weekday_indexed{std::chrono::weekday{6}, 6}}) == - SV(" 6月/土[6 is not a valid index]")); - assert(stream_ja_JP_locale(std::chrono::month_weekday{ - std::chrono::month{7}, std::chrono::weekday_indexed{std::chrono::weekday{7}, 7}}) == - SV(" 7月/日[7 is not a valid index]")); - assert(stream_ja_JP_locale(std::chrono::month_weekday{ - std::chrono::month{8}, std::chrono::weekday_indexed{std::chrono::weekday{8}, 0}}) == - SV(" 8月/8 is not a valid weekday[0 is not a valid index]")); - assert(stream_ja_JP_locale(std::chrono::month_weekday{ - std::chrono::month{9}, std::chrono::weekday_indexed{std::chrono::weekday{0}, 1}}) == SV(" 9月/日[1]")); -# endif // defined(_WIN32) || defined(_AIX) - assert(stream_ja_JP_locale(std::chrono::month_weekday{ - std::chrono::month{10}, std::chrono::weekday_indexed{std::chrono::weekday{0}, 1}}) == SV("10月/日[1]")); - assert(stream_ja_JP_locale(std::chrono::month_weekday{ - std::chrono::month{11}, std::chrono::weekday_indexed{std::chrono::weekday{0}, 1}}) == SV("11月/日[1]")); - assert(stream_ja_JP_locale(std::chrono::month_weekday{ - std::chrono::month{12}, std::chrono::weekday_indexed{std::chrono::weekday{0}, 1}}) == SV("12月/日[1]")); -#endif // defined(__APPLE__) - assert(stream_ja_JP_locale(std::chrono::month_weekday{ - std::chrono::month{13}, std::chrono::weekday_indexed{std::chrono::weekday{0}, 1}}) == - SV("13 is not a valid month/日[1]")); - assert(stream_ja_JP_locale(std::chrono::month_weekday{ - std::chrono::month{255}, std::chrono::weekday_indexed{std::chrono::weekday{8}, 0}}) == - SV("255 is not a valid month/8 is not a valid weekday[0 is not a valid index]")); + TEST_EQUAL(stream_ja_JP_locale(std::chrono::month_weekday{ + std::chrono::month{0}, std::chrono::weekday_indexed{std::chrono::weekday{0}, 1}}), + SV("0 is not a valid month/日[1]")); +#if defined(__APPLE__) || defined(_WIN32) +# if defined(__APPLE__) + TEST_EQUAL(stream_ja_JP_locale(std::chrono::month_weekday{ + std::chrono::month{1}, std::chrono::weekday_indexed{std::chrono::weekday{1}, 1}}), + SV(" 1/月[1]")); + TEST_EQUAL(stream_ja_JP_locale(std::chrono::month_weekday{ + std::chrono::month{2}, std::chrono::weekday_indexed{std::chrono::weekday{2}, 2}}), + SV(" 2/火[2]")); + TEST_EQUAL(stream_ja_JP_locale(std::chrono::month_weekday{ + std::chrono::month{3}, std::chrono::weekday_indexed{std::chrono::weekday{3}, 3}}), + SV(" 3/水[3]")); + TEST_EQUAL(stream_ja_JP_locale(std::chrono::month_weekday{ + std::chrono::month{4}, std::chrono::weekday_indexed{std::chrono::weekday{4}, 4}}), + SV(" 4/木[4]")); + TEST_EQUAL(stream_ja_JP_locale(std::chrono::month_weekday{ + std::chrono::month{5}, std::chrono::weekday_indexed{std::chrono::weekday{5}, 5}}), + SV(" 5/金[5]")); + TEST_EQUAL(stream_ja_JP_locale(std::chrono::month_weekday{ + std::chrono::month{6}, std::chrono::weekday_indexed{std::chrono::weekday{6}, 6}}), + SV(" 6/土[6 is not a valid index]")); + TEST_EQUAL(stream_ja_JP_locale(std::chrono::month_weekday{ + std::chrono::month{7}, std::chrono::weekday_indexed{std::chrono::weekday{7}, 7}}), + SV(" 7/日[7 is not a valid index]")); + TEST_EQUAL(stream_ja_JP_locale(std::chrono::month_weekday{ + std::chrono::month{8}, std::chrono::weekday_indexed{std::chrono::weekday{8}, 0}}), + SV(" 8/8 is not a valid weekday[0 is not a valid index]")); + TEST_EQUAL(stream_ja_JP_locale(std::chrono::month_weekday{ + std::chrono::month{9}, std::chrono::weekday_indexed{std::chrono::weekday{0}, 1}}), + SV(" 9/日[1]")); +# else // defined(__APPLE__) + TEST_EQUAL(stream_ja_JP_locale(std::chrono::month_weekday{ + std::chrono::month{1}, std::chrono::weekday_indexed{std::chrono::weekday{1}, 1}}), + SV("1/月[1]")); + TEST_EQUAL(stream_ja_JP_locale(std::chrono::month_weekday{ + std::chrono::month{2}, std::chrono::weekday_indexed{std::chrono::weekday{2}, 2}}), + SV("2/火[2]")); + TEST_EQUAL(stream_ja_JP_locale(std::chrono::month_weekday{ + std::chrono::month{3}, std::chrono::weekday_indexed{std::chrono::weekday{3}, 3}}), + SV("3/水[3]")); + TEST_EQUAL(stream_ja_JP_locale(std::chrono::month_weekday{ + std::chrono::month{4}, std::chrono::weekday_indexed{std::chrono::weekday{4}, 4}}), + SV("4/木[4]")); + TEST_EQUAL(stream_ja_JP_locale(std::chrono::month_weekday{ + std::chrono::month{5}, std::chrono::weekday_indexed{std::chrono::weekday{5}, 5}}), + SV("5/金[5]")); + TEST_EQUAL(stream_ja_JP_locale(std::chrono::month_weekday{ + std::chrono::month{6}, std::chrono::weekday_indexed{std::chrono::weekday{6}, 6}}), + SV("6/土[6 is not a valid index]")); + TEST_EQUAL(stream_ja_JP_locale(std::chrono::month_weekday{ + std::chrono::month{7}, std::chrono::weekday_indexed{std::chrono::weekday{7}, 7}}), + SV("7/日[7 is not a valid index]")); + TEST_EQUAL(stream_ja_JP_locale(std::chrono::month_weekday{ + std::chrono::month{8}, std::chrono::weekday_indexed{std::chrono::weekday{8}, 0}}), + SV("8/8 is not a valid weekday[0 is not a valid index]")); + TEST_EQUAL(stream_ja_JP_locale(std::chrono::month_weekday{ + std::chrono::month{9}, std::chrono::weekday_indexed{std::chrono::weekday{0}, 1}}), + SV("9/日[1]")); +# endif // defined(__APPLE__) + TEST_EQUAL(stream_ja_JP_locale(std::chrono::month_weekday{ + std::chrono::month{10}, std::chrono::weekday_indexed{std::chrono::weekday{0}, 1}}), + SV("10/日[1]")); + TEST_EQUAL(stream_ja_JP_locale(std::chrono::month_weekday{ + std::chrono::month{11}, std::chrono::weekday_indexed{std::chrono::weekday{0}, 1}}), + SV("11/日[1]")); + TEST_EQUAL(stream_ja_JP_locale(std::chrono::month_weekday{ + std::chrono::month{12}, std::chrono::weekday_indexed{std::chrono::weekday{0}, 1}}), + SV("12/日[1]")); +#else // defined(__APPLE__) || defined(_WIN32) +# if defined(_AIX) + TEST_EQUAL(stream_ja_JP_locale(std::chrono::month_weekday{ + std::chrono::month{1}, std::chrono::weekday_indexed{std::chrono::weekday{1}, 1}}), + SV("1月/月[1]")); + TEST_EQUAL(stream_ja_JP_locale(std::chrono::month_weekday{ + std::chrono::month{2}, std::chrono::weekday_indexed{std::chrono::weekday{2}, 2}}), + SV("2月/火[2]")); + TEST_EQUAL(stream_ja_JP_locale(std::chrono::month_weekday{ + std::chrono::month{3}, std::chrono::weekday_indexed{std::chrono::weekday{3}, 3}}), + SV("3月/水[3]")); + TEST_EQUAL(stream_ja_JP_locale(std::chrono::month_weekday{ + std::chrono::month{4}, std::chrono::weekday_indexed{std::chrono::weekday{4}, 4}}), + SV("4月/木[4]")); + TEST_EQUAL(stream_ja_JP_locale(std::chrono::month_weekday{ + std::chrono::month{5}, std::chrono::weekday_indexed{std::chrono::weekday{5}, 5}}), + SV("5月/金[5]")); + TEST_EQUAL(stream_ja_JP_locale(std::chrono::month_weekday{ + std::chrono::month{6}, std::chrono::weekday_indexed{std::chrono::weekday{6}, 6}}), + SV("6月/土[6 is not a valid index]")); + TEST_EQUAL(stream_ja_JP_locale(std::chrono::month_weekday{ + std::chrono::month{7}, std::chrono::weekday_indexed{std::chrono::weekday{7}, 7}}), + SV("7月/日[7 is not a valid index]")); + TEST_EQUAL(stream_ja_JP_locale(std::chrono::month_weekday{ + std::chrono::month{8}, std::chrono::weekday_indexed{std::chrono::weekday{8}, 0}}), + SV("8月/8 is not a valid weekday[0 is not a valid index]")); + TEST_EQUAL(stream_ja_JP_locale(std::chrono::month_weekday{ + std::chrono::month{9}, std::chrono::weekday_indexed{std::chrono::weekday{0}, 1}}), + SV("9月/日[1]")); +# else // defined(_AIX) + TEST_EQUAL(stream_ja_JP_locale(std::chrono::month_weekday{ + std::chrono::month{1}, std::chrono::weekday_indexed{std::chrono::weekday{1}, 1}}), + SV(" 1月/月[1]")); + TEST_EQUAL(stream_ja_JP_locale(std::chrono::month_weekday{ + std::chrono::month{2}, std::chrono::weekday_indexed{std::chrono::weekday{2}, 2}}), + SV(" 2月/火[2]")); + TEST_EQUAL(stream_ja_JP_locale(std::chrono::month_weekday{ + std::chrono::month{3}, std::chrono::weekday_indexed{std::chrono::weekday{3}, 3}}), + SV(" 3月/水[3]")); + TEST_EQUAL(stream_ja_JP_locale(std::chrono::month_weekday{ + std::chrono::month{4}, std::chrono::weekday_indexed{std::chrono::weekday{4}, 4}}), + SV(" 4月/木[4]")); + TEST_EQUAL(stream_ja_JP_locale(std::chrono::month_weekday{ + std::chrono::month{5}, std::chrono::weekday_indexed{std::chrono::weekday{5}, 5}}), + SV(" 5月/金[5]")); + TEST_EQUAL(stream_ja_JP_locale(std::chrono::month_weekday{ + std::chrono::month{6}, std::chrono::weekday_indexed{std::chrono::weekday{6}, 6}}), + SV(" 6月/土[6 is not a valid index]")); + TEST_EQUAL(stream_ja_JP_locale(std::chrono::month_weekday{ + std::chrono::month{7}, std::chrono::weekday_indexed{std::chrono::weekday{7}, 7}}), + SV(" 7月/日[7 is not a valid index]")); + TEST_EQUAL(stream_ja_JP_locale(std::chrono::month_weekday{ + std::chrono::month{8}, std::chrono::weekday_indexed{std::chrono::weekday{8}, 0}}), + SV(" 8月/8 is not a valid weekday[0 is not a valid index]")); + TEST_EQUAL(stream_ja_JP_locale(std::chrono::month_weekday{ + std::chrono::month{9}, std::chrono::weekday_indexed{std::chrono::weekday{0}, 1}}), + SV(" 9月/日[1]")); +# endif // defined(_AIX) + TEST_EQUAL(stream_ja_JP_locale(std::chrono::month_weekday{ + std::chrono::month{10}, std::chrono::weekday_indexed{std::chrono::weekday{0}, 1}}), + SV("10月/日[1]")); + TEST_EQUAL(stream_ja_JP_locale(std::chrono::month_weekday{ + std::chrono::month{11}, std::chrono::weekday_indexed{std::chrono::weekday{0}, 1}}), + SV("11月/日[1]")); + TEST_EQUAL(stream_ja_JP_locale(std::chrono::month_weekday{ + std::chrono::month{12}, std::chrono::weekday_indexed{std::chrono::weekday{0}, 1}}), + SV("12月/日[1]")); +#endif // defined(__APPLE__) || defined(_WIN32) + TEST_EQUAL(stream_ja_JP_locale(std::chrono::month_weekday{ + std::chrono::month{13}, std::chrono::weekday_indexed{std::chrono::weekday{0}, 1}}), + SV("13 is not a valid month/日[1]")); + TEST_EQUAL(stream_ja_JP_locale(std::chrono::month_weekday{ + std::chrono::month{255}, std::chrono::weekday_indexed{std::chrono::weekday{8}, 0}}), + SV("255 is not a valid month/8 is not a valid weekday[0 is not a valid index]")); } int main(int, char**) { diff --git a/libcxx/test/std/time/time.cal/time.cal.mwdlast/time.cal.mwdlast.nonmembers/ostream.pass.cpp b/libcxx/test/std/time/time.cal/time.cal.mwdlast/time.cal.mwdlast.nonmembers/ostream.pass.cpp --- a/libcxx/test/std/time/time.cal/time.cal.mwdlast/time.cal.mwdlast.nonmembers/ostream.pass.cpp +++ b/libcxx/test/std/time/time.cal/time.cal.mwdlast/time.cal.mwdlast.nonmembers/ostream.pass.cpp @@ -12,9 +12,6 @@ // UNSUPPORTED: no-localization // UNSUPPORTED: libcpp-has-no-incomplete-format -// TODO FMT Investigate Windows issues. -// UNSUPPORTED: msvc, target={{.+}}-windows-gnu - // TODO FMT It seems GCC uses too much memory in the CI and fails. // UNSUPPORTED: gcc-12 @@ -39,9 +36,16 @@ #include "make_string.h" #include "platform_support.h" // locale name macros #include "test_macros.h" +#include "assert_macros.h" +#include "concat_macros.h" #define SV(S) MAKE_STRING_VIEW(CharT, S) +#define TEST_EQUAL(OUT, EXPECTED) \ + TEST_REQUIRE(OUT == EXPECTED, \ + TEST_WRITE_CONCATENATED( \ + "\nExpression ", #OUT, "\nExpected output ", EXPECTED, "\nActual output ", OUT, '\n')); + template static std::basic_string stream_c_locale(std::chrono::month_weekday_last mwdl) { std::basic_stringstream sstr; @@ -69,205 +73,299 @@ template static void test() { - assert(stream_c_locale(std::chrono::month_weekday_last{ - std::chrono::month{0}, std::chrono::weekday_last{std::chrono::weekday{0}}}) == - SV("0 is not a valid month/Sun[last]")); - assert(stream_c_locale(std::chrono::month_weekday_last{ - std::chrono::month{1}, std::chrono::weekday_last{std::chrono::weekday{0}}}) == SV("Jan/Sun[last]")); - assert(stream_c_locale(std::chrono::month_weekday_last{ - std::chrono::month{2}, std::chrono::weekday_last{std::chrono::weekday{1}}}) == SV("Feb/Mon[last]")); - assert(stream_c_locale(std::chrono::month_weekday_last{ - std::chrono::month{3}, std::chrono::weekday_last{std::chrono::weekday{2}}}) == SV("Mar/Tue[last]")); - assert(stream_c_locale(std::chrono::month_weekday_last{ - std::chrono::month{4}, std::chrono::weekday_last{std::chrono::weekday{3}}}) == SV("Apr/Wed[last]")); - assert(stream_c_locale(std::chrono::month_weekday_last{ - std::chrono::month{5}, std::chrono::weekday_last{std::chrono::weekday{4}}}) == SV("May/Thu[last]")); - assert(stream_c_locale(std::chrono::month_weekday_last{ - std::chrono::month{6}, std::chrono::weekday_last{std::chrono::weekday{5}}}) == SV("Jun/Fri[last]")); - assert(stream_c_locale(std::chrono::month_weekday_last{ - std::chrono::month{7}, std::chrono::weekday_last{std::chrono::weekday{6}}}) == SV("Jul/Sat[last]")); - assert(stream_c_locale(std::chrono::month_weekday_last{ - std::chrono::month{8}, std::chrono::weekday_last{std::chrono::weekday{7}}}) == SV("Aug/Sun[last]")); - assert(stream_c_locale(std::chrono::month_weekday_last{ - std::chrono::month{9}, std::chrono::weekday_last{std::chrono::weekday{8}}}) == - SV("Sep/8 is not a valid weekday[last]")); - assert(stream_c_locale(std::chrono::month_weekday_last{ - std::chrono::month{10}, std::chrono::weekday_last{std::chrono::weekday{0}}}) == SV("Oct/Sun[last]")); - assert(stream_c_locale(std::chrono::month_weekday_last{ - std::chrono::month{11}, std::chrono::weekday_last{std::chrono::weekday{0}}}) == SV("Nov/Sun[last]")); - assert(stream_c_locale(std::chrono::month_weekday_last{ - std::chrono::month{12}, std::chrono::weekday_last{std::chrono::weekday{0}}}) == SV("Dec/Sun[last]")); - assert(stream_c_locale(std::chrono::month_weekday_last{ - std::chrono::month{13}, std::chrono::weekday_last{std::chrono::weekday{0}}}) == - SV("13 is not a valid month/Sun[last]")); - assert(stream_c_locale(std::chrono::month_weekday_last{ - std::chrono::month{255}, std::chrono::weekday_last{std::chrono::weekday{8}}}) == - SV("255 is not a valid month/8 is not a valid weekday[last]")); + TEST_EQUAL(stream_c_locale(std::chrono::month_weekday_last{ + std::chrono::month{0}, std::chrono::weekday_last{std::chrono::weekday{0}}}), + SV("0 is not a valid month/Sun[last]")); + TEST_EQUAL(stream_c_locale(std::chrono::month_weekday_last{ + std::chrono::month{1}, std::chrono::weekday_last{std::chrono::weekday{0}}}), + SV("Jan/Sun[last]")); + TEST_EQUAL(stream_c_locale(std::chrono::month_weekday_last{ + std::chrono::month{2}, std::chrono::weekday_last{std::chrono::weekday{1}}}), + SV("Feb/Mon[last]")); + TEST_EQUAL(stream_c_locale(std::chrono::month_weekday_last{ + std::chrono::month{3}, std::chrono::weekday_last{std::chrono::weekday{2}}}), + SV("Mar/Tue[last]")); + TEST_EQUAL(stream_c_locale(std::chrono::month_weekday_last{ + std::chrono::month{4}, std::chrono::weekday_last{std::chrono::weekday{3}}}), + SV("Apr/Wed[last]")); + TEST_EQUAL(stream_c_locale(std::chrono::month_weekday_last{ + std::chrono::month{5}, std::chrono::weekday_last{std::chrono::weekday{4}}}), + SV("May/Thu[last]")); + TEST_EQUAL(stream_c_locale(std::chrono::month_weekday_last{ + std::chrono::month{6}, std::chrono::weekday_last{std::chrono::weekday{5}}}), + SV("Jun/Fri[last]")); + TEST_EQUAL(stream_c_locale(std::chrono::month_weekday_last{ + std::chrono::month{7}, std::chrono::weekday_last{std::chrono::weekday{6}}}), + SV("Jul/Sat[last]")); + TEST_EQUAL(stream_c_locale(std::chrono::month_weekday_last{ + std::chrono::month{8}, std::chrono::weekday_last{std::chrono::weekday{7}}}), + SV("Aug/Sun[last]")); + TEST_EQUAL(stream_c_locale(std::chrono::month_weekday_last{ + std::chrono::month{9}, std::chrono::weekday_last{std::chrono::weekday{8}}}), + SV("Sep/8 is not a valid weekday[last]")); + TEST_EQUAL(stream_c_locale(std::chrono::month_weekday_last{ + std::chrono::month{10}, std::chrono::weekday_last{std::chrono::weekday{0}}}), + SV("Oct/Sun[last]")); + TEST_EQUAL(stream_c_locale(std::chrono::month_weekday_last{ + std::chrono::month{11}, std::chrono::weekday_last{std::chrono::weekday{0}}}), + SV("Nov/Sun[last]")); + TEST_EQUAL(stream_c_locale(std::chrono::month_weekday_last{ + std::chrono::month{12}, std::chrono::weekday_last{std::chrono::weekday{0}}}), + SV("Dec/Sun[last]")); + TEST_EQUAL(stream_c_locale(std::chrono::month_weekday_last{ + std::chrono::month{13}, std::chrono::weekday_last{std::chrono::weekday{0}}}), + SV("13 is not a valid month/Sun[last]")); + TEST_EQUAL(stream_c_locale(std::chrono::month_weekday_last{ + std::chrono::month{255}, std::chrono::weekday_last{std::chrono::weekday{8}}}), + SV("255 is not a valid month/8 is not a valid weekday[last]")); #if defined(__APPLE__) - assert(stream_fr_FR_locale(std::chrono::month_weekday_last{ - std::chrono::month{0}, std::chrono::weekday_last{std::chrono::weekday{0}}}) == - SV("0 is not a valid month/Dim[last]")); - assert(stream_fr_FR_locale(std::chrono::month_weekday_last{ - std::chrono::month{1}, std::chrono::weekday_last{std::chrono::weekday{0}}}) == SV("jan/Dim[last]")); - assert(stream_fr_FR_locale(std::chrono::month_weekday_last{ - std::chrono::month{2}, std::chrono::weekday_last{std::chrono::weekday{1}}}) == SV("fév/Lun[last]")); - assert(stream_fr_FR_locale(std::chrono::month_weekday_last{ - std::chrono::month{3}, std::chrono::weekday_last{std::chrono::weekday{2}}}) == SV("mar/Mar[last]")); - assert(stream_fr_FR_locale(std::chrono::month_weekday_last{ - std::chrono::month{4}, std::chrono::weekday_last{std::chrono::weekday{3}}}) == SV("avr/Mer[last]")); - assert(stream_fr_FR_locale(std::chrono::month_weekday_last{ - std::chrono::month{5}, std::chrono::weekday_last{std::chrono::weekday{4}}}) == SV("mai/Jeu[last]")); - assert(stream_fr_FR_locale(std::chrono::month_weekday_last{ - std::chrono::month{6}, std::chrono::weekday_last{std::chrono::weekday{5}}}) == SV("jui/Ven[last]")); - assert(stream_fr_FR_locale(std::chrono::month_weekday_last{ - std::chrono::month{7}, std::chrono::weekday_last{std::chrono::weekday{6}}}) == SV("jul/Sam[last]")); - assert(stream_fr_FR_locale(std::chrono::month_weekday_last{ - std::chrono::month{8}, std::chrono::weekday_last{std::chrono::weekday{7}}}) == SV("aoû/Dim[last]")); - assert(stream_fr_FR_locale(std::chrono::month_weekday_last{ - std::chrono::month{9}, std::chrono::weekday_last{std::chrono::weekday{8}}}) == - SV("sep/8 is not a valid weekday[last]")); - assert(stream_fr_FR_locale(std::chrono::month_weekday_last{ - std::chrono::month{10}, std::chrono::weekday_last{std::chrono::weekday{0}}}) == SV("oct/Dim[last]")); - assert(stream_fr_FR_locale(std::chrono::month_weekday_last{ - std::chrono::month{11}, std::chrono::weekday_last{std::chrono::weekday{0}}}) == SV("nov/Dim[last]")); - assert(stream_fr_FR_locale(std::chrono::month_weekday_last{ - std::chrono::month{12}, std::chrono::weekday_last{std::chrono::weekday{0}}}) == SV("déc/Dim[last]")); - assert(stream_fr_FR_locale(std::chrono::month_weekday_last{ - std::chrono::month{13}, std::chrono::weekday_last{std::chrono::weekday{0}}}) == - SV("13 is not a valid month/Dim[last]")); -#else // defined(__APPLE__) - assert(stream_fr_FR_locale(std::chrono::month_weekday_last{ - std::chrono::month{0}, std::chrono::weekday_last{std::chrono::weekday{0}}}) == - SV("0 is not a valid month/dim.[last]")); - assert(stream_fr_FR_locale(std::chrono::month_weekday_last{ - std::chrono::month{1}, std::chrono::weekday_last{std::chrono::weekday{0}}}) == SV("janv./dim.[last]")); - assert(stream_fr_FR_locale(std::chrono::month_weekday_last{ - std::chrono::month{2}, std::chrono::weekday_last{std::chrono::weekday{1}}}) == SV("févr./lun.[last]")); - assert(stream_fr_FR_locale(std::chrono::month_weekday_last{ - std::chrono::month{3}, std::chrono::weekday_last{std::chrono::weekday{2}}}) == SV("mars/mar.[last]")); + TEST_EQUAL(stream_fr_FR_locale(std::chrono::month_weekday_last{ + std::chrono::month{0}, std::chrono::weekday_last{std::chrono::weekday{0}}}), + SV("0 is not a valid month/Dim[last]")); + TEST_EQUAL(stream_fr_FR_locale(std::chrono::month_weekday_last{ + std::chrono::month{1}, std::chrono::weekday_last{std::chrono::weekday{0}}}), + SV("jan/Dim[last]")); + TEST_EQUAL(stream_fr_FR_locale(std::chrono::month_weekday_last{ + std::chrono::month{2}, std::chrono::weekday_last{std::chrono::weekday{1}}}), + SV("fév/Lun[last]")); + TEST_EQUAL(stream_fr_FR_locale(std::chrono::month_weekday_last{ + std::chrono::month{3}, std::chrono::weekday_last{std::chrono::weekday{2}}}), + SV("mar/Mar[last]")); + TEST_EQUAL(stream_fr_FR_locale(std::chrono::month_weekday_last{ + std::chrono::month{4}, std::chrono::weekday_last{std::chrono::weekday{3}}}), + SV("avr/Mer[last]")); + TEST_EQUAL(stream_fr_FR_locale(std::chrono::month_weekday_last{ + std::chrono::month{5}, std::chrono::weekday_last{std::chrono::weekday{4}}}), + SV("mai/Jeu[last]")); + TEST_EQUAL(stream_fr_FR_locale(std::chrono::month_weekday_last{ + std::chrono::month{6}, std::chrono::weekday_last{std::chrono::weekday{5}}}), + SV("jui/Ven[last]")); + TEST_EQUAL(stream_fr_FR_locale(std::chrono::month_weekday_last{ + std::chrono::month{7}, std::chrono::weekday_last{std::chrono::weekday{6}}}), + SV("jul/Sam[last]")); + TEST_EQUAL(stream_fr_FR_locale(std::chrono::month_weekday_last{ + std::chrono::month{8}, std::chrono::weekday_last{std::chrono::weekday{7}}}), + SV("aoû/Dim[last]")); + TEST_EQUAL(stream_fr_FR_locale(std::chrono::month_weekday_last{ + std::chrono::month{9}, std::chrono::weekday_last{std::chrono::weekday{8}}}), + SV("sep/8 is not a valid weekday[last]")); + TEST_EQUAL(stream_fr_FR_locale(std::chrono::month_weekday_last{ + std::chrono::month{10}, std::chrono::weekday_last{std::chrono::weekday{0}}}), + SV("oct/Dim[last]")); + TEST_EQUAL(stream_fr_FR_locale(std::chrono::month_weekday_last{ + std::chrono::month{11}, std::chrono::weekday_last{std::chrono::weekday{0}}}), + SV("nov/Dim[last]")); + TEST_EQUAL(stream_fr_FR_locale(std::chrono::month_weekday_last{ + std::chrono::month{12}, std::chrono::weekday_last{std::chrono::weekday{0}}}), + SV("déc/Dim[last]")); + TEST_EQUAL(stream_fr_FR_locale(std::chrono::month_weekday_last{ + std::chrono::month{13}, std::chrono::weekday_last{std::chrono::weekday{0}}}), + SV("13 is not a valid month/Dim[last]")); +#else // defined(__APPLE__) + TEST_EQUAL(stream_fr_FR_locale(std::chrono::month_weekday_last{ + std::chrono::month{0}, std::chrono::weekday_last{std::chrono::weekday{0}}}), + SV("0 is not a valid month/dim.[last]")); + TEST_EQUAL(stream_fr_FR_locale(std::chrono::month_weekday_last{ + std::chrono::month{1}, std::chrono::weekday_last{std::chrono::weekday{0}}}), + SV("janv./dim.[last]")); + TEST_EQUAL(stream_fr_FR_locale(std::chrono::month_weekday_last{ + std::chrono::month{2}, std::chrono::weekday_last{std::chrono::weekday{1}}}), + SV("févr./lun.[last]")); + TEST_EQUAL(stream_fr_FR_locale(std::chrono::month_weekday_last{ + std::chrono::month{3}, std::chrono::weekday_last{std::chrono::weekday{2}}}), + SV("mars/mar.[last]")); # if defined(_WIN32) || defined(_AIX) - assert(stream_fr_FR_locale(std::chrono::month_weekday_last{ - std::chrono::month{4}, std::chrono::weekday_last{std::chrono::weekday{3}}}) == SV("avr./mer.[last]")); + TEST_EQUAL(stream_fr_FR_locale(std::chrono::month_weekday_last{ + std::chrono::month{4}, std::chrono::weekday_last{std::chrono::weekday{3}}}), + SV("avr./mer.[last]")); # else // defined(_WIN32) || defined(_AIX) - assert(stream_fr_FR_locale(std::chrono::month_weekday_last{ - std::chrono::month{4}, std::chrono::weekday_last{std::chrono::weekday{3}}}) == SV("avril/mer.[last]")); + TEST_EQUAL(stream_fr_FR_locale(std::chrono::month_weekday_last{ + std::chrono::month{4}, std::chrono::weekday_last{std::chrono::weekday{3}}}), + SV("avril/mer.[last]")); # endif // defined(_WIN32) || defined(_AIX) - assert(stream_fr_FR_locale(std::chrono::month_weekday_last{ - std::chrono::month{5}, std::chrono::weekday_last{std::chrono::weekday{4}}}) == SV("mai/jeu.[last]")); - assert(stream_fr_FR_locale(std::chrono::month_weekday_last{ - std::chrono::month{6}, std::chrono::weekday_last{std::chrono::weekday{5}}}) == SV("juin/ven.[last]")); - assert(stream_fr_FR_locale(std::chrono::month_weekday_last{ - std::chrono::month{7}, std::chrono::weekday_last{std::chrono::weekday{6}}}) == SV("juil./sam.[last]")); - assert(stream_fr_FR_locale(std::chrono::month_weekday_last{ - std::chrono::month{8}, std::chrono::weekday_last{std::chrono::weekday{7}}}) == SV("août/dim.[last]")); - assert(stream_fr_FR_locale(std::chrono::month_weekday_last{ - std::chrono::month{9}, std::chrono::weekday_last{std::chrono::weekday{8}}}) == - SV("sept./8 is not a valid weekday[last]")); - assert(stream_fr_FR_locale(std::chrono::month_weekday_last{ - std::chrono::month{10}, std::chrono::weekday_last{std::chrono::weekday{0}}}) == SV("oct./dim.[last]")); - assert(stream_fr_FR_locale(std::chrono::month_weekday_last{ - std::chrono::month{11}, std::chrono::weekday_last{std::chrono::weekday{0}}}) == SV("nov./dim.[last]")); - assert(stream_fr_FR_locale(std::chrono::month_weekday_last{ - std::chrono::month{12}, std::chrono::weekday_last{std::chrono::weekday{0}}}) == SV("déc./dim.[last]")); - assert(stream_fr_FR_locale(std::chrono::month_weekday_last{ - std::chrono::month{13}, std::chrono::weekday_last{std::chrono::weekday{0}}}) == - SV("13 is not a valid month/dim.[last]")); + TEST_EQUAL(stream_fr_FR_locale(std::chrono::month_weekday_last{ + std::chrono::month{5}, std::chrono::weekday_last{std::chrono::weekday{4}}}), + SV("mai/jeu.[last]")); + TEST_EQUAL(stream_fr_FR_locale(std::chrono::month_weekday_last{ + std::chrono::month{6}, std::chrono::weekday_last{std::chrono::weekday{5}}}), + SV("juin/ven.[last]")); + TEST_EQUAL(stream_fr_FR_locale(std::chrono::month_weekday_last{ + std::chrono::month{7}, std::chrono::weekday_last{std::chrono::weekday{6}}}), + SV("juil./sam.[last]")); + TEST_EQUAL(stream_fr_FR_locale(std::chrono::month_weekday_last{ + std::chrono::month{8}, std::chrono::weekday_last{std::chrono::weekday{7}}}), + SV("août/dim.[last]")); + TEST_EQUAL(stream_fr_FR_locale(std::chrono::month_weekday_last{ + std::chrono::month{9}, std::chrono::weekday_last{std::chrono::weekday{8}}}), + SV("sept./8 is not a valid weekday[last]")); + TEST_EQUAL(stream_fr_FR_locale(std::chrono::month_weekday_last{ + std::chrono::month{10}, std::chrono::weekday_last{std::chrono::weekday{0}}}), + SV("oct./dim.[last]")); + TEST_EQUAL(stream_fr_FR_locale(std::chrono::month_weekday_last{ + std::chrono::month{11}, std::chrono::weekday_last{std::chrono::weekday{0}}}), + SV("nov./dim.[last]")); + TEST_EQUAL(stream_fr_FR_locale(std::chrono::month_weekday_last{ + std::chrono::month{12}, std::chrono::weekday_last{std::chrono::weekday{0}}}), + SV("déc./dim.[last]")); + TEST_EQUAL(stream_fr_FR_locale(std::chrono::month_weekday_last{ + std::chrono::month{13}, std::chrono::weekday_last{std::chrono::weekday{0}}}), + SV("13 is not a valid month/dim.[last]")); #endif // defined(__APPLE__) - assert(stream_fr_FR_locale(std::chrono::month_weekday_last{ - std::chrono::month{255}, std::chrono::weekday_last{std::chrono::weekday{8}}}) == - SV("255 is not a valid month/8 is not a valid weekday[last]")); + TEST_EQUAL(stream_fr_FR_locale(std::chrono::month_weekday_last{ + std::chrono::month{255}, std::chrono::weekday_last{std::chrono::weekday{8}}}), + SV("255 is not a valid month/8 is not a valid weekday[last]")); -#if defined(__APPLE__) - assert(stream_ja_JP_locale(std::chrono::month_weekday_last{ - std::chrono::month{0}, std::chrono::weekday_last{std::chrono::weekday{0}}}) == - SV("0 is not a valid month/日[last]")); - assert(stream_ja_JP_locale(std::chrono::month_weekday_last{ - std::chrono::month{1}, std::chrono::weekday_last{std::chrono::weekday{0}}}) == SV(" 1/日[last]")); - assert(stream_ja_JP_locale(std::chrono::month_weekday_last{ - std::chrono::month{2}, std::chrono::weekday_last{std::chrono::weekday{1}}}) == SV(" 2/月[last]")); - assert(stream_ja_JP_locale(std::chrono::month_weekday_last{ - std::chrono::month{3}, std::chrono::weekday_last{std::chrono::weekday{2}}}) == SV(" 3/火[last]")); - assert(stream_ja_JP_locale(std::chrono::month_weekday_last{ - std::chrono::month{4}, std::chrono::weekday_last{std::chrono::weekday{3}}}) == SV(" 4/水[last]")); - assert(stream_ja_JP_locale(std::chrono::month_weekday_last{ - std::chrono::month{5}, std::chrono::weekday_last{std::chrono::weekday{4}}}) == SV(" 5/木[last]")); - assert(stream_ja_JP_locale(std::chrono::month_weekday_last{ - std::chrono::month{6}, std::chrono::weekday_last{std::chrono::weekday{5}}}) == SV(" 6/金[last]")); - assert(stream_ja_JP_locale(std::chrono::month_weekday_last{ - std::chrono::month{7}, std::chrono::weekday_last{std::chrono::weekday{6}}}) == SV(" 7/土[last]")); - assert(stream_ja_JP_locale(std::chrono::month_weekday_last{ - std::chrono::month{8}, std::chrono::weekday_last{std::chrono::weekday{7}}}) == SV(" 8/日[last]")); - assert(stream_ja_JP_locale(std::chrono::month_weekday_last{ - std::chrono::month{9}, std::chrono::weekday_last{std::chrono::weekday{8}}}) == - SV(" 9/8 is not a valid weekday[last]")); - assert(stream_ja_JP_locale(std::chrono::month_weekday_last{ - std::chrono::month{10}, std::chrono::weekday_last{std::chrono::weekday{0}}}) == SV("10/日[last]")); - assert(stream_ja_JP_locale(std::chrono::month_weekday_last{ - std::chrono::month{11}, std::chrono::weekday_last{std::chrono::weekday{0}}}) == SV("11/日[last]")); - assert(stream_ja_JP_locale(std::chrono::month_weekday_last{ - std::chrono::month{12}, std::chrono::weekday_last{std::chrono::weekday{0}}}) == SV("12/日[last]")); -#else // defined(__APPLE__) -# if defined(_WIN32) || defined(_AIX) - assert(stream_ja_JP_locale(std::chrono::month_weekday_last{ - std::chrono::month{0}, std::chrono::weekday_last{std::chrono::weekday{0}}}) == - SV("0 is not a valid month/日[last]")); - assert(stream_ja_JP_locale(std::chrono::month_weekday_last{ - std::chrono::month{1}, std::chrono::weekday_last{std::chrono::weekday{0}}}) == SV("1月/日[last]")); - assert(stream_ja_JP_locale(std::chrono::month_weekday_last{ - std::chrono::month{2}, std::chrono::weekday_last{std::chrono::weekday{1}}}) == SV("2月/月[last]")); - assert(stream_ja_JP_locale(std::chrono::month_weekday_last{ - std::chrono::month{3}, std::chrono::weekday_last{std::chrono::weekday{2}}}) == SV("3月/火[last]")); - assert(stream_ja_JP_locale(std::chrono::month_weekday_last{ - std::chrono::month{4}, std::chrono::weekday_last{std::chrono::weekday{3}}}) == SV("4月/水[last]")); - assert(stream_ja_JP_locale(std::chrono::month_weekday_last{ - std::chrono::month{5}, std::chrono::weekday_last{std::chrono::weekday{4}}}) == SV("5月/木[last]")); - assert(stream_ja_JP_locale(std::chrono::month_weekday_last{ - std::chrono::month{6}, std::chrono::weekday_last{std::chrono::weekday{5}}}) == SV("6月/金[last]")); - assert(stream_ja_JP_locale(std::chrono::month_weekday_last{ - std::chrono::month{7}, std::chrono::weekday_last{std::chrono::weekday{6}}}) == SV("7月/土[last]")); - assert(stream_ja_JP_locale(std::chrono::month_weekday_last{ - std::chrono::month{8}, std::chrono::weekday_last{std::chrono::weekday{7}}}) == SV("8月/日[last]")); - assert(stream_ja_JP_locale(std::chrono::month_weekday_last{ - std::chrono::month{9}, std::chrono::weekday_last{std::chrono::weekday{8}}}) == - SV("9月/8 is not a valid weekday[last]")); -# else // defined(_WIN32) || defined(_AIX) - assert(stream_ja_JP_locale(std::chrono::month_weekday_last{ - std::chrono::month{0}, std::chrono::weekday_last{std::chrono::weekday{0}}}) == - SV("0 is not a valid month/日[last]")); - assert(stream_ja_JP_locale(std::chrono::month_weekday_last{ - std::chrono::month{1}, std::chrono::weekday_last{std::chrono::weekday{0}}}) == SV(" 1月/日[last]")); - assert(stream_ja_JP_locale(std::chrono::month_weekday_last{ - std::chrono::month{2}, std::chrono::weekday_last{std::chrono::weekday{1}}}) == SV(" 2月/月[last]")); - assert(stream_ja_JP_locale(std::chrono::month_weekday_last{ - std::chrono::month{3}, std::chrono::weekday_last{std::chrono::weekday{2}}}) == SV(" 3月/火[last]")); - assert(stream_ja_JP_locale(std::chrono::month_weekday_last{ - std::chrono::month{4}, std::chrono::weekday_last{std::chrono::weekday{3}}}) == SV(" 4月/水[last]")); - assert(stream_ja_JP_locale(std::chrono::month_weekday_last{ - std::chrono::month{5}, std::chrono::weekday_last{std::chrono::weekday{4}}}) == SV(" 5月/木[last]")); - assert(stream_ja_JP_locale(std::chrono::month_weekday_last{ - std::chrono::month{6}, std::chrono::weekday_last{std::chrono::weekday{5}}}) == SV(" 6月/金[last]")); - assert(stream_ja_JP_locale(std::chrono::month_weekday_last{ - std::chrono::month{7}, std::chrono::weekday_last{std::chrono::weekday{6}}}) == SV(" 7月/土[last]")); - assert(stream_ja_JP_locale(std::chrono::month_weekday_last{ - std::chrono::month{8}, std::chrono::weekday_last{std::chrono::weekday{7}}}) == SV(" 8月/日[last]")); - assert(stream_ja_JP_locale(std::chrono::month_weekday_last{ - std::chrono::month{9}, std::chrono::weekday_last{std::chrono::weekday{8}}}) == - SV(" 9月/8 is not a valid weekday[last]")); -# endif // defined(_WIN32) || defined(_AIX) - assert(stream_ja_JP_locale(std::chrono::month_weekday_last{ - std::chrono::month{10}, std::chrono::weekday_last{std::chrono::weekday{0}}}) == SV("10月/日[last]")); - assert(stream_ja_JP_locale(std::chrono::month_weekday_last{ - std::chrono::month{11}, std::chrono::weekday_last{std::chrono::weekday{0}}}) == SV("11月/日[last]")); - assert(stream_ja_JP_locale(std::chrono::month_weekday_last{ - std::chrono::month{12}, std::chrono::weekday_last{std::chrono::weekday{0}}}) == SV("12月/日[last]")); -#endif // defined(__APPLE__) - assert(stream_ja_JP_locale(std::chrono::month_weekday_last{ - std::chrono::month{13}, std::chrono::weekday_last{std::chrono::weekday{0}}}) == - SV("13 is not a valid month/日[last]")); - assert(stream_ja_JP_locale(std::chrono::month_weekday_last{ - std::chrono::month{255}, std::chrono::weekday_last{std::chrono::weekday{8}}}) == - SV("255 is not a valid month/8 is not a valid weekday[last]")); +#if defined(__APPLE__) || defined(_WIN32) + TEST_EQUAL(stream_ja_JP_locale(std::chrono::month_weekday_last{ + std::chrono::month{0}, std::chrono::weekday_last{std::chrono::weekday{0}}}), + SV("0 is not a valid month/日[last]")); +# if defined(__APPLE__) + TEST_EQUAL(stream_ja_JP_locale(std::chrono::month_weekday_last{ + std::chrono::month{1}, std::chrono::weekday_last{std::chrono::weekday{0}}}), + SV(" 1/日[last]")); + TEST_EQUAL(stream_ja_JP_locale(std::chrono::month_weekday_last{ + std::chrono::month{2}, std::chrono::weekday_last{std::chrono::weekday{1}}}), + SV(" 2/月[last]")); + TEST_EQUAL(stream_ja_JP_locale(std::chrono::month_weekday_last{ + std::chrono::month{3}, std::chrono::weekday_last{std::chrono::weekday{2}}}), + SV(" 3/火[last]")); + TEST_EQUAL(stream_ja_JP_locale(std::chrono::month_weekday_last{ + std::chrono::month{4}, std::chrono::weekday_last{std::chrono::weekday{3}}}), + SV(" 4/水[last]")); + TEST_EQUAL(stream_ja_JP_locale(std::chrono::month_weekday_last{ + std::chrono::month{5}, std::chrono::weekday_last{std::chrono::weekday{4}}}), + SV(" 5/木[last]")); + TEST_EQUAL(stream_ja_JP_locale(std::chrono::month_weekday_last{ + std::chrono::month{6}, std::chrono::weekday_last{std::chrono::weekday{5}}}), + SV(" 6/金[last]")); + TEST_EQUAL(stream_ja_JP_locale(std::chrono::month_weekday_last{ + std::chrono::month{7}, std::chrono::weekday_last{std::chrono::weekday{6}}}), + SV(" 7/土[last]")); + TEST_EQUAL(stream_ja_JP_locale(std::chrono::month_weekday_last{ + std::chrono::month{8}, std::chrono::weekday_last{std::chrono::weekday{7}}}), + SV(" 8/日[last]")); + TEST_EQUAL(stream_ja_JP_locale(std::chrono::month_weekday_last{ + std::chrono::month{9}, std::chrono::weekday_last{std::chrono::weekday{8}}}), + SV(" 9/8 is not a valid weekday[last]")); +# else // defined(__APPLE__) + TEST_EQUAL(stream_ja_JP_locale(std::chrono::month_weekday_last{ + std::chrono::month{1}, std::chrono::weekday_last{std::chrono::weekday{0}}}), + SV("1/日[last]")); + TEST_EQUAL(stream_ja_JP_locale(std::chrono::month_weekday_last{ + std::chrono::month{2}, std::chrono::weekday_last{std::chrono::weekday{1}}}), + SV("2/月[last]")); + TEST_EQUAL(stream_ja_JP_locale(std::chrono::month_weekday_last{ + std::chrono::month{3}, std::chrono::weekday_last{std::chrono::weekday{2}}}), + SV("3/火[last]")); + TEST_EQUAL(stream_ja_JP_locale(std::chrono::month_weekday_last{ + std::chrono::month{4}, std::chrono::weekday_last{std::chrono::weekday{3}}}), + SV("4/水[last]")); + TEST_EQUAL(stream_ja_JP_locale(std::chrono::month_weekday_last{ + std::chrono::month{5}, std::chrono::weekday_last{std::chrono::weekday{4}}}), + SV("5/木[last]")); + TEST_EQUAL(stream_ja_JP_locale(std::chrono::month_weekday_last{ + std::chrono::month{6}, std::chrono::weekday_last{std::chrono::weekday{5}}}), + SV("6/金[last]")); + TEST_EQUAL(stream_ja_JP_locale(std::chrono::month_weekday_last{ + std::chrono::month{7}, std::chrono::weekday_last{std::chrono::weekday{6}}}), + SV("7/土[last]")); + TEST_EQUAL(stream_ja_JP_locale(std::chrono::month_weekday_last{ + std::chrono::month{8}, std::chrono::weekday_last{std::chrono::weekday{7}}}), + SV("8/日[last]")); + TEST_EQUAL(stream_ja_JP_locale(std::chrono::month_weekday_last{ + std::chrono::month{9}, std::chrono::weekday_last{std::chrono::weekday{8}}}), + SV("9/8 is not a valid weekday[last]")); +# endif // defined(__APPLE__) + TEST_EQUAL(stream_ja_JP_locale(std::chrono::month_weekday_last{ + std::chrono::month{10}, std::chrono::weekday_last{std::chrono::weekday{0}}}), + SV("10/日[last]")); + TEST_EQUAL(stream_ja_JP_locale(std::chrono::month_weekday_last{ + std::chrono::month{11}, std::chrono::weekday_last{std::chrono::weekday{0}}}), + SV("11/日[last]")); + TEST_EQUAL(stream_ja_JP_locale(std::chrono::month_weekday_last{ + std::chrono::month{12}, std::chrono::weekday_last{std::chrono::weekday{0}}}), + SV("12/日[last]")); +#else // defined(__APPLE__) || defined(_WIN32) +# if defined(_AIX) + TEST_EQUAL(stream_ja_JP_locale(std::chrono::month_weekday_last{ + std::chrono::month{0}, std::chrono::weekday_last{std::chrono::weekday{0}}}), + SV("0 is not a valid month/日[last]")); + TEST_EQUAL(stream_ja_JP_locale(std::chrono::month_weekday_last{ + std::chrono::month{1}, std::chrono::weekday_last{std::chrono::weekday{0}}}), + SV("1月/日[last]")); + TEST_EQUAL(stream_ja_JP_locale(std::chrono::month_weekday_last{ + std::chrono::month{2}, std::chrono::weekday_last{std::chrono::weekday{1}}}), + SV("2月/月[last]")); + TEST_EQUAL(stream_ja_JP_locale(std::chrono::month_weekday_last{ + std::chrono::month{3}, std::chrono::weekday_last{std::chrono::weekday{2}}}), + SV("3月/火[last]")); + TEST_EQUAL(stream_ja_JP_locale(std::chrono::month_weekday_last{ + std::chrono::month{4}, std::chrono::weekday_last{std::chrono::weekday{3}}}), + SV("4月/水[last]")); + TEST_EQUAL(stream_ja_JP_locale(std::chrono::month_weekday_last{ + std::chrono::month{5}, std::chrono::weekday_last{std::chrono::weekday{4}}}), + SV("5月/木[last]")); + TEST_EQUAL(stream_ja_JP_locale(std::chrono::month_weekday_last{ + std::chrono::month{6}, std::chrono::weekday_last{std::chrono::weekday{5}}}), + SV("6月/金[last]")); + TEST_EQUAL(stream_ja_JP_locale(std::chrono::month_weekday_last{ + std::chrono::month{7}, std::chrono::weekday_last{std::chrono::weekday{6}}}), + SV("7月/土[last]")); + TEST_EQUAL(stream_ja_JP_locale(std::chrono::month_weekday_last{ + std::chrono::month{8}, std::chrono::weekday_last{std::chrono::weekday{7}}}), + SV("8月/日[last]")); + TEST_EQUAL(stream_ja_JP_locale(std::chrono::month_weekday_last{ + std::chrono::month{9}, std::chrono::weekday_last{std::chrono::weekday{8}}}), + SV("9月/8 is not a valid weekday[last]")); +# else // defined(_AIX) + TEST_EQUAL(stream_ja_JP_locale(std::chrono::month_weekday_last{ + std::chrono::month{0}, std::chrono::weekday_last{std::chrono::weekday{0}}}), + SV("0 is not a valid month/日[last]")); + TEST_EQUAL(stream_ja_JP_locale(std::chrono::month_weekday_last{ + std::chrono::month{1}, std::chrono::weekday_last{std::chrono::weekday{0}}}), + SV(" 1月/日[last]")); + TEST_EQUAL(stream_ja_JP_locale(std::chrono::month_weekday_last{ + std::chrono::month{2}, std::chrono::weekday_last{std::chrono::weekday{1}}}), + SV(" 2月/月[last]")); + TEST_EQUAL(stream_ja_JP_locale(std::chrono::month_weekday_last{ + std::chrono::month{3}, std::chrono::weekday_last{std::chrono::weekday{2}}}), + SV(" 3月/火[last]")); + TEST_EQUAL(stream_ja_JP_locale(std::chrono::month_weekday_last{ + std::chrono::month{4}, std::chrono::weekday_last{std::chrono::weekday{3}}}), + SV(" 4月/水[last]")); + TEST_EQUAL(stream_ja_JP_locale(std::chrono::month_weekday_last{ + std::chrono::month{5}, std::chrono::weekday_last{std::chrono::weekday{4}}}), + SV(" 5月/木[last]")); + TEST_EQUAL(stream_ja_JP_locale(std::chrono::month_weekday_last{ + std::chrono::month{6}, std::chrono::weekday_last{std::chrono::weekday{5}}}), + SV(" 6月/金[last]")); + TEST_EQUAL(stream_ja_JP_locale(std::chrono::month_weekday_last{ + std::chrono::month{7}, std::chrono::weekday_last{std::chrono::weekday{6}}}), + SV(" 7月/土[last]")); + TEST_EQUAL(stream_ja_JP_locale(std::chrono::month_weekday_last{ + std::chrono::month{8}, std::chrono::weekday_last{std::chrono::weekday{7}}}), + SV(" 8月/日[last]")); + TEST_EQUAL(stream_ja_JP_locale(std::chrono::month_weekday_last{ + std::chrono::month{9}, std::chrono::weekday_last{std::chrono::weekday{8}}}), + SV(" 9月/8 is not a valid weekday[last]")); +# endif // defined(_AIX) + TEST_EQUAL(stream_ja_JP_locale(std::chrono::month_weekday_last{ + std::chrono::month{10}, std::chrono::weekday_last{std::chrono::weekday{0}}}), + SV("10月/日[last]")); + TEST_EQUAL(stream_ja_JP_locale(std::chrono::month_weekday_last{ + std::chrono::month{11}, std::chrono::weekday_last{std::chrono::weekday{0}}}), + SV("11月/日[last]")); + TEST_EQUAL(stream_ja_JP_locale(std::chrono::month_weekday_last{ + std::chrono::month{12}, std::chrono::weekday_last{std::chrono::weekday{0}}}), + SV("12月/日[last]")); +#endif // defined(__APPLE__) || defined(_WIN32) + TEST_EQUAL(stream_ja_JP_locale(std::chrono::month_weekday_last{ + std::chrono::month{13}, std::chrono::weekday_last{std::chrono::weekday{0}}}), + SV("13 is not a valid month/日[last]")); + TEST_EQUAL(stream_ja_JP_locale(std::chrono::month_weekday_last{ + std::chrono::month{255}, std::chrono::weekday_last{std::chrono::weekday{8}}}), + SV("255 is not a valid month/8 is not a valid weekday[last]")); } int main(int, char**) { diff --git a/libcxx/test/std/time/time.cal/time.cal.year/time.cal.year.nonmembers/ostream.pass.cpp b/libcxx/test/std/time/time.cal/time.cal.year/time.cal.year.nonmembers/ostream.pass.cpp --- a/libcxx/test/std/time/time.cal/time.cal.year/time.cal.year.nonmembers/ostream.pass.cpp +++ b/libcxx/test/std/time/time.cal/time.cal.year/time.cal.year.nonmembers/ostream.pass.cpp @@ -10,15 +10,15 @@ // UNSUPPORTED: no-localization // UNSUPPORTED: libcpp-has-no-incomplete-format -// TODO FMT Investigate Windows issues. -// UNSUPPORTED: msvc, target={{.+}}-windows-gnu - // TODO FMT Fix this test using GCC, it currently crashes. // UNSUPPORTED: gcc-12 // TODO FMT This test should not require std::to_chars(floating-point) // XFAIL: availability-fp_to_chars-missing +// TODO FMT Investigate Windows issues. +// XFAIL: msvc + // REQUIRES: locale.fr_FR.UTF-8 // REQUIRES: locale.ja_JP.UTF-8 @@ -36,9 +36,16 @@ #include "make_string.h" #include "platform_support.h" // locale name macros #include "test_macros.h" +#include "assert_macros.h" +#include "concat_macros.h" #define SV(S) MAKE_STRING_VIEW(CharT, S) +#define TEST_EQUAL(OUT, EXPECTED) \ + TEST_REQUIRE(OUT == EXPECTED, \ + TEST_WRITE_CONCATENATED( \ + "\nExpression ", #OUT, "\nExpected output ", EXPECTED, "\nActual output ", OUT, '\n')); + template static std::basic_string stream_c_locale(std::chrono::year year) { std::basic_stringstream sstr; @@ -66,23 +73,35 @@ template static void test() { - assert(stream_c_locale(std::chrono::year{-32'768}) == SV("-32768 is not a valid year")); - assert(stream_c_locale(std::chrono::year{-32'767}) == SV("-32767")); - assert(stream_c_locale(std::chrono::year{0}) == SV("0000")); - assert(stream_c_locale(std::chrono::year{1970}) == SV("1970")); - assert(stream_c_locale(std::chrono::year{32'767}) == SV("32767")); - - assert(stream_fr_FR_locale(std::chrono::year{-32'768}) == SV("-32768 is not a valid year")); - assert(stream_fr_FR_locale(std::chrono::year{-32'767}) == SV("-32767")); - assert(stream_fr_FR_locale(std::chrono::year{0}) == SV("0000")); - assert(stream_fr_FR_locale(std::chrono::year{1970}) == SV("1970")); - assert(stream_fr_FR_locale(std::chrono::year{32'767}) == SV("32767")); - - assert(stream_ja_JP_locale(std::chrono::year{-32'768}) == SV("-32768 is not a valid year")); - assert(stream_ja_JP_locale(std::chrono::year{-32'767}) == SV("-32767")); - assert(stream_ja_JP_locale(std::chrono::year{0}) == SV("0000")); - assert(stream_ja_JP_locale(std::chrono::year{1970}) == SV("1970")); - assert(stream_ja_JP_locale(std::chrono::year{32'767}) == SV("32767")); + TEST_EQUAL(stream_c_locale(std::chrono::year{-32'768}), SV("-32768 is not a valid year")); + TEST_EQUAL(stream_c_locale(std::chrono::year{-32'767}), SV("-32767")); + TEST_EQUAL(stream_c_locale(std::chrono::year{0}), SV("0000")); + TEST_EQUAL(stream_c_locale(std::chrono::year{1970}), SV("1970")); +#ifdef _WIN32 + TEST_EQUAL(stream_c_locale(std::chrono::year{32'767}), SV("")); +#else + TEST_EQUAL(stream_c_locale(std::chrono::year{32'767}), SV("32767")); +#endif + + TEST_EQUAL(stream_fr_FR_locale(std::chrono::year{-32'768}), SV("-32768 is not a valid year")); + TEST_EQUAL(stream_fr_FR_locale(std::chrono::year{-32'767}), SV("-32767")); + TEST_EQUAL(stream_fr_FR_locale(std::chrono::year{0}), SV("0000")); + TEST_EQUAL(stream_fr_FR_locale(std::chrono::year{1970}), SV("1970")); +#ifdef _WIN32 + TEST_EQUAL(stream_fr_FR_locale(std::chrono::year{32'767}), SV("")); +#else + TEST_EQUAL(stream_fr_FR_locale(std::chrono::year{32'767}), SV("32767")); +#endif + + TEST_EQUAL(stream_ja_JP_locale(std::chrono::year{-32'768}), SV("-32768 is not a valid year")); + TEST_EQUAL(stream_ja_JP_locale(std::chrono::year{-32'767}), SV("-32767")); + TEST_EQUAL(stream_ja_JP_locale(std::chrono::year{0}), SV("0000")); + TEST_EQUAL(stream_ja_JP_locale(std::chrono::year{1970}), SV("1970")); +#ifdef _WIN32 + TEST_EQUAL(stream_ja_JP_locale(std::chrono::year{32'767}), SV("")); +#else + TEST_EQUAL(stream_ja_JP_locale(std::chrono::year{32'767}), SV("32767")); +#endif } int main(int, char**) { diff --git a/libcxx/test/std/time/time.cal/time.cal.ym/time.cal.ym.nonmembers/ostream.pass.cpp b/libcxx/test/std/time/time.cal/time.cal.ym/time.cal.ym.nonmembers/ostream.pass.cpp --- a/libcxx/test/std/time/time.cal/time.cal.ym/time.cal.ym.nonmembers/ostream.pass.cpp +++ b/libcxx/test/std/time/time.cal/time.cal.ym/time.cal.ym.nonmembers/ostream.pass.cpp @@ -12,15 +12,15 @@ // UNSUPPORTED: no-localization // UNSUPPORTED: libcpp-has-no-incomplete-format -// TODO FMT Investigate Windows issues. -// UNSUPPORTED: msvc, target={{.+}}-windows-gnu - // TODO FMT It seems GCC uses too much memory in the CI and fails. // UNSUPPORTED: gcc-12 // TODO FMT This test should not require std::to_chars(floating-point) // XFAIL: availability-fp_to_chars-missing +// TODO FMT Investigate Windows issues. +// XFAIL: msvc + // REQUIRES: locale.fr_FR.UTF-8 // REQUIRES: locale.ja_JP.UTF-8 @@ -39,9 +39,16 @@ #include "make_string.h" #include "platform_support.h" // locale name macros #include "test_macros.h" +#include "assert_macros.h" +#include "concat_macros.h" #define SV(S) MAKE_STRING_VIEW(CharT, S) +#define TEST_EQUAL(OUT, EXPECTED) \ + TEST_REQUIRE(OUT == EXPECTED, \ + TEST_WRITE_CONCATENATED( \ + "\nExpression ", #OUT, "\nExpected output ", EXPECTED, "\nActual output ", OUT, '\n')); + template static std::basic_string stream_c_locale(std::chrono::year_month ym) { std::basic_stringstream sstr; @@ -69,178 +76,214 @@ template static void test() { - assert(stream_c_locale(std::chrono::year_month{std::chrono::year{-32'768}, std::chrono::month{0}}) == - SV("-32768 is not a valid year/0 is not a valid month")); - assert(stream_c_locale(std::chrono::year_month{std::chrono::year{-32'768}, std::chrono::month{1}}) == - SV("-32768 is not a valid year/Jan")); - assert(stream_c_locale(std::chrono::year_month{std::chrono::year{-32'767}, std::chrono::month{2}}) == - SV("-32767/Feb")); - assert(stream_c_locale(std::chrono::year_month{std::chrono::year{0}, std::chrono::month{3}}) == - SV("0000/Mar")); - assert(stream_c_locale(std::chrono::year_month{std::chrono::year{1970}, std::chrono::month{4}}) == - SV("1970/Apr")); - assert(stream_c_locale(std::chrono::year_month{std::chrono::year{32'767}, std::chrono::month{5}}) == - SV("32767/May")); - assert(stream_c_locale(std::chrono::year_month{std::chrono::year{0}, std::chrono::month{6}}) == - SV("0000/Jun")); - assert(stream_c_locale(std::chrono::year_month{std::chrono::year{0}, std::chrono::month{7}}) == - SV("0000/Jul")); - assert(stream_c_locale(std::chrono::year_month{std::chrono::year{0}, std::chrono::month{8}}) == - SV("0000/Aug")); - assert(stream_c_locale(std::chrono::year_month{std::chrono::year{0}, std::chrono::month{9}}) == - SV("0000/Sep")); - assert(stream_c_locale(std::chrono::year_month{std::chrono::year{0}, std::chrono::month{10}}) == - SV("0000/Oct")); - assert(stream_c_locale(std::chrono::year_month{std::chrono::year{0}, std::chrono::month{11}}) == - SV("0000/Nov")); - assert(stream_c_locale(std::chrono::year_month{std::chrono::year{0}, std::chrono::month{12}}) == - SV("0000/Dec")); - assert(stream_c_locale(std::chrono::year_month{std::chrono::year{0}, std::chrono::month{13}}) == - SV("0000/13 is not a valid month")); - assert(stream_c_locale(std::chrono::year_month{std::chrono::year{-32'768}, std::chrono::month{255}}) == - SV("-32768 is not a valid year/255 is not a valid month")); - - assert(stream_fr_FR_locale(std::chrono::year_month{std::chrono::year{-32'768}, std::chrono::month{0}}) == - SV("-32768 is not a valid year/0 is not a valid month")); -#if defined(__APPLE__) - assert(stream_fr_FR_locale(std::chrono::year_month{std::chrono::year{-32'768}, std::chrono::month{1}}) == - SV("-32768 is not a valid year/jan")); - assert(stream_fr_FR_locale(std::chrono::year_month{std::chrono::year{-32'767}, std::chrono::month{2}}) == - SV("-32767/fév")); - assert(stream_fr_FR_locale(std::chrono::year_month{std::chrono::year{0}, std::chrono::month{3}}) == - SV("0000/mar")); - assert(stream_fr_FR_locale(std::chrono::year_month{std::chrono::year{1970}, std::chrono::month{4}}) == - SV("1970/avr")); - assert(stream_fr_FR_locale(std::chrono::year_month{std::chrono::year{32'767}, std::chrono::month{5}}) == - SV("32767/mai")); - assert(stream_fr_FR_locale(std::chrono::year_month{std::chrono::year{0}, std::chrono::month{6}}) == - SV("0000/jui")); - assert(stream_fr_FR_locale(std::chrono::year_month{std::chrono::year{0}, std::chrono::month{7}}) == - SV("0000/jul")); - assert(stream_fr_FR_locale(std::chrono::year_month{std::chrono::year{0}, std::chrono::month{8}}) == - SV("0000/aoû")); - assert(stream_fr_FR_locale(std::chrono::year_month{std::chrono::year{0}, std::chrono::month{9}}) == - SV("0000/sep")); - assert(stream_fr_FR_locale(std::chrono::year_month{std::chrono::year{0}, std::chrono::month{10}}) == - SV("0000/oct")); - assert(stream_fr_FR_locale(std::chrono::year_month{std::chrono::year{0}, std::chrono::month{11}}) == - SV("0000/nov")); - assert(stream_fr_FR_locale(std::chrono::year_month{std::chrono::year{0}, std::chrono::month{12}}) == - SV("0000/déc")); -#else // defined(__APPLE__) - assert(stream_fr_FR_locale(std::chrono::year_month{std::chrono::year{-32'768}, std::chrono::month{1}}) == - SV("-32768 is not a valid year/janv.")); - assert(stream_fr_FR_locale(std::chrono::year_month{std::chrono::year{-32'767}, std::chrono::month{2}}) == - SV("-32767/févr.")); - assert(stream_fr_FR_locale(std::chrono::year_month{std::chrono::year{0}, std::chrono::month{3}}) == - SV("0000/mars")); -# if defined(_WIN32) || defined(_AIX) - assert(stream_fr_FR_locale(std::chrono::year_month{std::chrono::year{1970}, std::chrono::month{4}}) == - SV("1970/avr.")); -# else // defined(_WIN32) || defined(_AIX) - assert(stream_fr_FR_locale(std::chrono::year_month{std::chrono::year{1970}, std::chrono::month{4}}) == - SV("1970/avril")); -# endif // defined(_WIN32) || defined(_AIX) - assert(stream_fr_FR_locale(std::chrono::year_month{std::chrono::year{32'767}, std::chrono::month{5}}) == - SV("32767/mai")); - assert(stream_fr_FR_locale(std::chrono::year_month{std::chrono::year{0}, std::chrono::month{6}}) == - SV("0000/juin")); - assert(stream_fr_FR_locale(std::chrono::year_month{std::chrono::year{0}, std::chrono::month{7}}) == - SV("0000/juil.")); - assert(stream_fr_FR_locale(std::chrono::year_month{std::chrono::year{0}, std::chrono::month{8}}) == - SV("0000/août")); - assert(stream_fr_FR_locale(std::chrono::year_month{std::chrono::year{0}, std::chrono::month{9}}) == - SV("0000/sept.")); - assert(stream_fr_FR_locale(std::chrono::year_month{std::chrono::year{0}, std::chrono::month{10}}) == - SV("0000/oct.")); - assert(stream_fr_FR_locale(std::chrono::year_month{std::chrono::year{0}, std::chrono::month{11}}) == - SV("0000/nov.")); - assert(stream_fr_FR_locale(std::chrono::year_month{std::chrono::year{0}, std::chrono::month{12}}) == - SV("0000/déc.")); -#endif // defined(__APPLE__) - assert(stream_fr_FR_locale(std::chrono::year_month{std::chrono::year{0}, std::chrono::month{13}}) == - SV("0000/13 is not a valid month")); - assert(stream_fr_FR_locale(std::chrono::year_month{std::chrono::year{-32'768}, std::chrono::month{255}}) == - SV("-32768 is not a valid year/255 is not a valid month")); - - assert(stream_ja_JP_locale(std::chrono::year_month{std::chrono::year{-32'768}, std::chrono::month{0}}) == - SV("-32768 is not a valid year/0 is not a valid month")); + TEST_EQUAL(stream_c_locale(std::chrono::year_month{std::chrono::year{-32'768}, std::chrono::month{0}}), + SV("-32768 is not a valid year/0 is not a valid month")); + TEST_EQUAL(stream_c_locale(std::chrono::year_month{std::chrono::year{-32'768}, std::chrono::month{1}}), + SV("-32768 is not a valid year/Jan")); + TEST_EQUAL(stream_c_locale(std::chrono::year_month{std::chrono::year{-32'767}, std::chrono::month{2}}), + SV("-32767/Feb")); + TEST_EQUAL(stream_c_locale(std::chrono::year_month{std::chrono::year{0}, std::chrono::month{3}}), + SV("0000/Mar")); + TEST_EQUAL(stream_c_locale(std::chrono::year_month{std::chrono::year{1970}, std::chrono::month{4}}), + SV("1970/Apr")); +#ifdef _WIN32 + TEST_EQUAL(stream_c_locale(std::chrono::year_month{std::chrono::year{32'767}, std::chrono::month{5}}), + SV("/May")); +#else + TEST_EQUAL(stream_c_locale(std::chrono::year_month{std::chrono::year{32'767}, std::chrono::month{5}}), + SV("32767/May")); +#endif + TEST_EQUAL(stream_c_locale(std::chrono::year_month{std::chrono::year{0}, std::chrono::month{6}}), + SV("0000/Jun")); + TEST_EQUAL(stream_c_locale(std::chrono::year_month{std::chrono::year{0}, std::chrono::month{7}}), + SV("0000/Jul")); + TEST_EQUAL(stream_c_locale(std::chrono::year_month{std::chrono::year{0}, std::chrono::month{8}}), + SV("0000/Aug")); + TEST_EQUAL(stream_c_locale(std::chrono::year_month{std::chrono::year{0}, std::chrono::month{9}}), + SV("0000/Sep")); + TEST_EQUAL(stream_c_locale(std::chrono::year_month{std::chrono::year{0}, std::chrono::month{10}}), + SV("0000/Oct")); + TEST_EQUAL(stream_c_locale(std::chrono::year_month{std::chrono::year{0}, std::chrono::month{11}}), + SV("0000/Nov")); + TEST_EQUAL(stream_c_locale(std::chrono::year_month{std::chrono::year{0}, std::chrono::month{12}}), + SV("0000/Dec")); + TEST_EQUAL(stream_c_locale(std::chrono::year_month{std::chrono::year{0}, std::chrono::month{13}}), + SV("0000/13 is not a valid month")); + TEST_EQUAL(stream_c_locale(std::chrono::year_month{std::chrono::year{-32'768}, std::chrono::month{255}}), + SV("-32768 is not a valid year/255 is not a valid month")); + + TEST_EQUAL(stream_fr_FR_locale(std::chrono::year_month{std::chrono::year{-32'768}, std::chrono::month{0}}), + SV("-32768 is not a valid year/0 is not a valid month")); #if defined(__APPLE__) - assert(stream_ja_JP_locale(std::chrono::year_month{std::chrono::year{-32'768}, std::chrono::month{1}}) == - SV("-32768 is not a valid year/ 1")); - assert(stream_ja_JP_locale(std::chrono::year_month{std::chrono::year{-32'767}, std::chrono::month{2}}) == - SV("-32767/ 2")); - assert(stream_ja_JP_locale(std::chrono::year_month{std::chrono::year{0}, std::chrono::month{3}}) == - SV("0000/ 3")); - assert(stream_ja_JP_locale(std::chrono::year_month{std::chrono::year{1970}, std::chrono::month{4}}) == - SV("1970/ 4")); - assert(stream_ja_JP_locale(std::chrono::year_month{std::chrono::year{32'767}, std::chrono::month{5}}) == - SV("32767/ 5")); - assert(stream_ja_JP_locale(std::chrono::year_month{std::chrono::year{0}, std::chrono::month{6}}) == - SV("0000/ 6")); - assert(stream_ja_JP_locale(std::chrono::year_month{std::chrono::year{0}, std::chrono::month{7}}) == - SV("0000/ 7")); - assert(stream_ja_JP_locale(std::chrono::year_month{std::chrono::year{0}, std::chrono::month{8}}) == - SV("0000/ 8")); - assert(stream_ja_JP_locale(std::chrono::year_month{std::chrono::year{0}, std::chrono::month{9}}) == - SV("0000/ 9")); - assert(stream_ja_JP_locale(std::chrono::year_month{std::chrono::year{0}, std::chrono::month{10}}) == - SV("0000/10")); - assert(stream_ja_JP_locale(std::chrono::year_month{std::chrono::year{0}, std::chrono::month{11}}) == - SV("0000/11")); - assert(stream_ja_JP_locale(std::chrono::year_month{std::chrono::year{0}, std::chrono::month{12}}) == - SV("0000/12")); -#else // defined(__APPLE__) + TEST_EQUAL(stream_fr_FR_locale(std::chrono::year_month{std::chrono::year{-32'768}, std::chrono::month{1}}), + SV("-32768 is not a valid year/jan")); + TEST_EQUAL(stream_fr_FR_locale(std::chrono::year_month{std::chrono::year{-32'767}, std::chrono::month{2}}), + SV("-32767/fév")); + TEST_EQUAL(stream_fr_FR_locale(std::chrono::year_month{std::chrono::year{0}, std::chrono::month{3}}), + SV("0000/mar")); + TEST_EQUAL(stream_fr_FR_locale(std::chrono::year_month{std::chrono::year{1970}, std::chrono::month{4}}), + SV("1970/avr")); +# ifdef _WIN32 + TEST_EQUAL(stream_fr_FR_locale(std::chrono::year_month{std::chrono::year{32'767}, std::chrono::month{5}}), + SV("/mai")); +# else + TEST_EQUAL(stream_fr_FR_locale(std::chrono::year_month{std::chrono::year{32'767}, std::chrono::month{5}}), + SV("32767/mai")); +# endif + TEST_EQUAL(stream_fr_FR_locale(std::chrono::year_month{std::chrono::year{0}, std::chrono::month{6}}), + SV("0000/jui")); + TEST_EQUAL(stream_fr_FR_locale(std::chrono::year_month{std::chrono::year{0}, std::chrono::month{7}}), + SV("0000/jul")); + TEST_EQUAL(stream_fr_FR_locale(std::chrono::year_month{std::chrono::year{0}, std::chrono::month{8}}), + SV("0000/aoû")); + TEST_EQUAL(stream_fr_FR_locale(std::chrono::year_month{std::chrono::year{0}, std::chrono::month{9}}), + SV("0000/sep")); + TEST_EQUAL(stream_fr_FR_locale(std::chrono::year_month{std::chrono::year{0}, std::chrono::month{10}}), + SV("0000/oct")); + TEST_EQUAL(stream_fr_FR_locale(std::chrono::year_month{std::chrono::year{0}, std::chrono::month{11}}), + SV("0000/nov")); + TEST_EQUAL(stream_fr_FR_locale(std::chrono::year_month{std::chrono::year{0}, std::chrono::month{12}}), + SV("0000/déc")); +#else // defined(__APPLE__) + TEST_EQUAL(stream_fr_FR_locale(std::chrono::year_month{std::chrono::year{-32'768}, std::chrono::month{1}}), + SV("-32768 is not a valid year/janv.")); + TEST_EQUAL(stream_fr_FR_locale(std::chrono::year_month{std::chrono::year{-32'767}, std::chrono::month{2}}), + SV("-32767/févr.")); + TEST_EQUAL(stream_fr_FR_locale(std::chrono::year_month{std::chrono::year{0}, std::chrono::month{3}}), + SV("0000/mars")); # if defined(_WIN32) || defined(_AIX) - assert(stream_ja_JP_locale(std::chrono::year_month{std::chrono::year{-32'768}, std::chrono::month{1}}) == - SV("-32768 is not a valid year/1月")); - assert(stream_ja_JP_locale(std::chrono::year_month{std::chrono::year{-32'767}, std::chrono::month{2}}) == - SV("-32767/2月")); - assert(stream_ja_JP_locale(std::chrono::year_month{std::chrono::year{0}, std::chrono::month{3}}) == - SV("0000/3月")); - assert(stream_ja_JP_locale(std::chrono::year_month{std::chrono::year{1970}, std::chrono::month{4}}) == - SV("1970/4月")); - assert(stream_ja_JP_locale(std::chrono::year_month{std::chrono::year{32'767}, std::chrono::month{5}}) == - SV("32767/5月")); - assert(stream_ja_JP_locale(std::chrono::year_month{std::chrono::year{0}, std::chrono::month{6}}) == - SV("0000/6月")); - assert(stream_ja_JP_locale(std::chrono::year_month{std::chrono::year{0}, std::chrono::month{7}}) == - SV("0000/7月")); - assert(stream_ja_JP_locale(std::chrono::year_month{std::chrono::year{0}, std::chrono::month{8}}) == - SV("0000/8月")); - assert(stream_ja_JP_locale(std::chrono::year_month{std::chrono::year{0}, std::chrono::month{9}}) == - SV("0000/9月")); + TEST_EQUAL(stream_fr_FR_locale(std::chrono::year_month{std::chrono::year{1970}, std::chrono::month{4}}), + SV("1970/avr.")); # else // defined(_WIN32) || defined(_AIX) - assert(stream_ja_JP_locale(std::chrono::year_month{std::chrono::year{-32'768}, std::chrono::month{1}}) == - SV("-32768 is not a valid year/ 1月")); - assert(stream_ja_JP_locale(std::chrono::year_month{std::chrono::year{-32'767}, std::chrono::month{2}}) == - SV("-32767/ 2月")); - assert(stream_ja_JP_locale(std::chrono::year_month{std::chrono::year{0}, std::chrono::month{3}}) == - SV("0000/ 3月")); - assert(stream_ja_JP_locale(std::chrono::year_month{std::chrono::year{1970}, std::chrono::month{4}}) == - SV("1970/ 4月")); - assert(stream_ja_JP_locale(std::chrono::year_month{std::chrono::year{32'767}, std::chrono::month{5}}) == - SV("32767/ 5月")); - assert(stream_ja_JP_locale(std::chrono::year_month{std::chrono::year{0}, std::chrono::month{6}}) == - SV("0000/ 6月")); - assert(stream_ja_JP_locale(std::chrono::year_month{std::chrono::year{0}, std::chrono::month{7}}) == - SV("0000/ 7月")); - assert(stream_ja_JP_locale(std::chrono::year_month{std::chrono::year{0}, std::chrono::month{8}}) == - SV("0000/ 8月")); - assert(stream_ja_JP_locale(std::chrono::year_month{std::chrono::year{0}, std::chrono::month{9}}) == - SV("0000/ 9月")); + TEST_EQUAL(stream_fr_FR_locale(std::chrono::year_month{std::chrono::year{1970}, std::chrono::month{4}}), + SV("1970/avril")); # endif // defined(_WIN32) || defined(_AIX) - assert(stream_ja_JP_locale(std::chrono::year_month{std::chrono::year{0}, std::chrono::month{10}}) == - SV("0000/10月")); - assert(stream_ja_JP_locale(std::chrono::year_month{std::chrono::year{0}, std::chrono::month{11}}) == - SV("0000/11月")); - assert(stream_ja_JP_locale(std::chrono::year_month{std::chrono::year{0}, std::chrono::month{12}}) == - SV("0000/12月")); -#endif // defined(__APPLE__) - assert(stream_ja_JP_locale(std::chrono::year_month{std::chrono::year{0}, std::chrono::month{13}}) == - SV("0000/13 is not a valid month")); - assert(stream_ja_JP_locale(std::chrono::year_month{std::chrono::year{-32'768}, std::chrono::month{255}}) == - SV("-32768 is not a valid year/255 is not a valid month")); +# ifdef _WIN32 + TEST_EQUAL(stream_fr_FR_locale(std::chrono::year_month{std::chrono::year{32'767}, std::chrono::month{5}}), + SV("/mai")); +# else + TEST_EQUAL(stream_fr_FR_locale(std::chrono::year_month{std::chrono::year{32'767}, std::chrono::month{5}}), + SV("32767/mai")); +# endif + TEST_EQUAL(stream_fr_FR_locale(std::chrono::year_month{std::chrono::year{0}, std::chrono::month{6}}), + SV("0000/juin")); + TEST_EQUAL(stream_fr_FR_locale(std::chrono::year_month{std::chrono::year{0}, std::chrono::month{7}}), + SV("0000/juil.")); + TEST_EQUAL(stream_fr_FR_locale(std::chrono::year_month{std::chrono::year{0}, std::chrono::month{8}}), + SV("0000/août")); + TEST_EQUAL(stream_fr_FR_locale(std::chrono::year_month{std::chrono::year{0}, std::chrono::month{9}}), + SV("0000/sept.")); + TEST_EQUAL(stream_fr_FR_locale(std::chrono::year_month{std::chrono::year{0}, std::chrono::month{10}}), + SV("0000/oct.")); + TEST_EQUAL(stream_fr_FR_locale(std::chrono::year_month{std::chrono::year{0}, std::chrono::month{11}}), + SV("0000/nov.")); + TEST_EQUAL(stream_fr_FR_locale(std::chrono::year_month{std::chrono::year{0}, std::chrono::month{12}}), + SV("0000/déc.")); +#endif // defined(__APPLE__) + TEST_EQUAL(stream_fr_FR_locale(std::chrono::year_month{std::chrono::year{0}, std::chrono::month{13}}), + SV("0000/13 is not a valid month")); + TEST_EQUAL(stream_fr_FR_locale(std::chrono::year_month{std::chrono::year{-32'768}, std::chrono::month{255}}), + SV("-32768 is not a valid year/255 is not a valid month")); + + TEST_EQUAL(stream_ja_JP_locale(std::chrono::year_month{std::chrono::year{-32'768}, std::chrono::month{0}}), + SV("-32768 is not a valid year/0 is not a valid month")); +#if defined(__APPLE__) || defined(_WIN32) +# if defined(__APPLE__) + TEST_EQUAL(stream_ja_JP_locale(std::chrono::year_month{std::chrono::year{-32'768}, std::chrono::month{1}}), + SV("-32768 is not a valid year/ 1")); + TEST_EQUAL(stream_ja_JP_locale(std::chrono::year_month{std::chrono::year{-32'767}, std::chrono::month{2}}), + SV("-32767/ 2")); + TEST_EQUAL(stream_ja_JP_locale(std::chrono::year_month{std::chrono::year{0}, std::chrono::month{3}}), + SV("0000/ 3")); + TEST_EQUAL(stream_ja_JP_locale(std::chrono::year_month{std::chrono::year{1970}, std::chrono::month{4}}), + SV("1970/ 4")); + TEST_EQUAL(stream_ja_JP_locale(std::chrono::year_month{std::chrono::year{32'767}, std::chrono::month{5}}), + SV("32767/ 5")); + TEST_EQUAL(stream_ja_JP_locale(std::chrono::year_month{std::chrono::year{0}, std::chrono::month{6}}), + SV("0000/ 6")); + TEST_EQUAL(stream_ja_JP_locale(std::chrono::year_month{std::chrono::year{0}, std::chrono::month{7}}), + SV("0000/ 7")); + TEST_EQUAL(stream_ja_JP_locale(std::chrono::year_month{std::chrono::year{0}, std::chrono::month{8}}), + SV("0000/ 8")); + TEST_EQUAL(stream_ja_JP_locale(std::chrono::year_month{std::chrono::year{0}, std::chrono::month{9}}), + SV("0000/ 9")); +# else // defined(__APPLE__) + TEST_EQUAL(stream_ja_JP_locale(std::chrono::year_month{std::chrono::year{-32'768}, std::chrono::month{1}}), + SV("-32768 is not a valid year/1")); + TEST_EQUAL(stream_ja_JP_locale(std::chrono::year_month{std::chrono::year{-32'767}, std::chrono::month{2}}), + SV("-32767/2")); + TEST_EQUAL(stream_ja_JP_locale(std::chrono::year_month{std::chrono::year{0}, std::chrono::month{3}}), + SV("0000/3")); + TEST_EQUAL(stream_ja_JP_locale(std::chrono::year_month{std::chrono::year{1970}, std::chrono::month{4}}), + SV("1970/4")); + TEST_EQUAL(stream_ja_JP_locale(std::chrono::year_month{std::chrono::year{32'767}, std::chrono::month{5}}), + SV("/5")); + TEST_EQUAL(stream_ja_JP_locale(std::chrono::year_month{std::chrono::year{0}, std::chrono::month{6}}), + SV("0000/6")); + TEST_EQUAL(stream_ja_JP_locale(std::chrono::year_month{std::chrono::year{0}, std::chrono::month{7}}), + SV("0000/7")); + TEST_EQUAL(stream_ja_JP_locale(std::chrono::year_month{std::chrono::year{0}, std::chrono::month{8}}), + SV("0000/8")); + TEST_EQUAL(stream_ja_JP_locale(std::chrono::year_month{std::chrono::year{0}, std::chrono::month{9}}), + SV("0000/9")); +# endif // defined(__APPLE__) + TEST_EQUAL(stream_ja_JP_locale(std::chrono::year_month{std::chrono::year{0}, std::chrono::month{10}}), + SV("0000/10")); + TEST_EQUAL(stream_ja_JP_locale(std::chrono::year_month{std::chrono::year{0}, std::chrono::month{11}}), + SV("0000/11")); + TEST_EQUAL(stream_ja_JP_locale(std::chrono::year_month{std::chrono::year{0}, std::chrono::month{12}}), + SV("0000/12")); +#else // defined(__APPLE__) || defined(_WIN32) +# if defined(_AIX) + TEST_EQUAL(stream_ja_JP_locale(std::chrono::year_month{std::chrono::year{-32'768}, std::chrono::month{1}}), + SV("-32768 is not a valid year/1月")); + TEST_EQUAL(stream_ja_JP_locale(std::chrono::year_month{std::chrono::year{-32'767}, std::chrono::month{2}}), + SV("-32767/2月")); + TEST_EQUAL(stream_ja_JP_locale(std::chrono::year_month{std::chrono::year{0}, std::chrono::month{3}}), + SV("0000/3月")); + TEST_EQUAL(stream_ja_JP_locale(std::chrono::year_month{std::chrono::year{1970}, std::chrono::month{4}}), + SV("1970/4月")); + TEST_EQUAL(stream_ja_JP_locale(std::chrono::year_month{std::chrono::year{32'767}, std::chrono::month{5}}), + SV("32767/5月")); + TEST_EQUAL(stream_ja_JP_locale(std::chrono::year_month{std::chrono::year{0}, std::chrono::month{6}}), + SV("0000/6月")); + TEST_EQUAL(stream_ja_JP_locale(std::chrono::year_month{std::chrono::year{0}, std::chrono::month{7}}), + SV("0000/7月")); + TEST_EQUAL(stream_ja_JP_locale(std::chrono::year_month{std::chrono::year{0}, std::chrono::month{8}}), + SV("0000/8月")); + TEST_EQUAL(stream_ja_JP_locale(std::chrono::year_month{std::chrono::year{0}, std::chrono::month{9}}), + SV("0000/9月")); +# else // defined(_AIX) + TEST_EQUAL(stream_ja_JP_locale(std::chrono::year_month{std::chrono::year{-32'768}, std::chrono::month{1}}), + SV("-32768 is not a valid year/ 1月")); + TEST_EQUAL(stream_ja_JP_locale(std::chrono::year_month{std::chrono::year{-32'767}, std::chrono::month{2}}), + SV("-32767/ 2月")); + TEST_EQUAL(stream_ja_JP_locale(std::chrono::year_month{std::chrono::year{0}, std::chrono::month{3}}), + SV("0000/ 3月")); + TEST_EQUAL(stream_ja_JP_locale(std::chrono::year_month{std::chrono::year{1970}, std::chrono::month{4}}), + SV("1970/ 4月")); + TEST_EQUAL(stream_ja_JP_locale(std::chrono::year_month{std::chrono::year{32'767}, std::chrono::month{5}}), + SV("32767/ 5月")); + TEST_EQUAL(stream_ja_JP_locale(std::chrono::year_month{std::chrono::year{0}, std::chrono::month{6}}), + SV("0000/ 6月")); + TEST_EQUAL(stream_ja_JP_locale(std::chrono::year_month{std::chrono::year{0}, std::chrono::month{7}}), + SV("0000/ 7月")); + TEST_EQUAL(stream_ja_JP_locale(std::chrono::year_month{std::chrono::year{0}, std::chrono::month{8}}), + SV("0000/ 8月")); + TEST_EQUAL(stream_ja_JP_locale(std::chrono::year_month{std::chrono::year{0}, std::chrono::month{9}}), + SV("0000/ 9月")); +# endif // defined(_AIX) + TEST_EQUAL(stream_ja_JP_locale(std::chrono::year_month{std::chrono::year{0}, std::chrono::month{10}}), + SV("0000/10月")); + TEST_EQUAL(stream_ja_JP_locale(std::chrono::year_month{std::chrono::year{0}, std::chrono::month{11}}), + SV("0000/11月")); + TEST_EQUAL(stream_ja_JP_locale(std::chrono::year_month{std::chrono::year{0}, std::chrono::month{12}}), + SV("0000/12月")); +#endif // defined(__APPLE__) || defined(_WIN32) + TEST_EQUAL(stream_ja_JP_locale(std::chrono::year_month{std::chrono::year{0}, std::chrono::month{13}}), + SV("0000/13 is not a valid month")); + TEST_EQUAL(stream_ja_JP_locale(std::chrono::year_month{std::chrono::year{-32'768}, std::chrono::month{255}}), + SV("-32768 is not a valid year/255 is not a valid month")); } int main(int, char**) { diff --git a/libcxx/test/std/time/time.cal/time.cal.ymd/time.cal.ymd.nonmembers/ostream.pass.cpp b/libcxx/test/std/time/time.cal/time.cal.ymd/time.cal.ymd.nonmembers/ostream.pass.cpp --- a/libcxx/test/std/time/time.cal/time.cal.ymd/time.cal.ymd.nonmembers/ostream.pass.cpp +++ b/libcxx/test/std/time/time.cal/time.cal.ymd/time.cal.ymd.nonmembers/ostream.pass.cpp @@ -10,15 +10,15 @@ // UNSUPPORTED: no-localization // UNSUPPORTED: libcpp-has-no-incomplete-format -// TODO FMT Investigate Windows issues. -// UNSUPPORTED: msvc, target={{.+}}-windows-gnu - // TODO FMT It seems GCC uses too much memory in the CI and fails. // UNSUPPORTED: gcc-12 // TODO FMT This test should not require std::to_chars(floating-point) // XFAIL: availability-fp_to_chars-missing +// TODO FMT Investigate Windows issues. +// XFAIL: msvc + // REQUIRES: locale.fr_FR.UTF-8 // REQUIRES: locale.ja_JP.UTF-8 @@ -37,9 +37,16 @@ #include "make_string.h" #include "platform_support.h" // locale name macros #include "test_macros.h" +#include "assert_macros.h" +#include "concat_macros.h" #define SV(S) MAKE_STRING_VIEW(CharT, S) +#define TEST_EQUAL(OUT, EXPECTED) \ + TEST_REQUIRE(OUT == EXPECTED, \ + TEST_WRITE_CONCATENATED( \ + "\nExpression ", #OUT, "\nExpected output ", EXPECTED, "\nActual output ", OUT, '\n')); + template static std::basic_string stream_c_locale(std::chrono::year_month_day ymd) { std::basic_stringstream sstr; @@ -67,78 +74,102 @@ template static void test() { - assert(stream_c_locale( - std::chrono::year_month_day{std::chrono::year{-32'768}, std::chrono::month{1}, std::chrono::day{1}}) == - SV("-32768-01-01 is not a valid date")); - assert(stream_c_locale( - std::chrono::year_month_day{std::chrono::year{-32'767}, std::chrono::month{0}, std::chrono::day{1}}) == - SV("-32767-00-01 is not a valid date")); - assert(stream_c_locale( - std::chrono::year_month_day{std::chrono::year{-32'767}, std::chrono::month{1}, std::chrono::day{0}}) == - SV("-32767-01-00 is not a valid date")); - assert(stream_c_locale(std::chrono::year_month_day{ - std::chrono::year{1970}, std::chrono::month{1}, std::chrono::day{1}}) == SV("1970-01-01")); - assert(stream_c_locale( - std::chrono::year_month_day{std::chrono::year{1999}, std::chrono::month{2}, std::chrono::day{29}}) == - SV("1999-02-29 is not a valid date")); - assert(stream_c_locale(std::chrono::year_month_day{ - std::chrono::year{2000}, std::chrono::month{2}, std::chrono::day{29}}) == SV("2000-02-29")); + TEST_EQUAL(stream_c_locale( + std::chrono::year_month_day{std::chrono::year{-32'768}, std::chrono::month{1}, std::chrono::day{1}}), + SV("-32768-01-01 is not a valid date")); + TEST_EQUAL(stream_c_locale( + std::chrono::year_month_day{std::chrono::year{-32'767}, std::chrono::month{0}, std::chrono::day{1}}), + SV("-32767-00-01 is not a valid date")); + TEST_EQUAL(stream_c_locale( + std::chrono::year_month_day{std::chrono::year{-32'767}, std::chrono::month{1}, std::chrono::day{0}}), + SV("-32767-01-00 is not a valid date")); + TEST_EQUAL(stream_c_locale( + std::chrono::year_month_day{std::chrono::year{1970}, std::chrono::month{1}, std::chrono::day{1}}), + SV("1970-01-01")); + TEST_EQUAL(stream_c_locale( + std::chrono::year_month_day{std::chrono::year{1999}, std::chrono::month{2}, std::chrono::day{29}}), + SV("1999-02-29 is not a valid date")); + TEST_EQUAL(stream_c_locale( + std::chrono::year_month_day{std::chrono::year{2000}, std::chrono::month{2}, std::chrono::day{29}}), + SV("2000-02-29")); #if defined(_AIX) - assert(stream_c_locale(std::chrono::year_month_day{ - std::chrono::year{32'767}, std::chrono::month{12}, std::chrono::day{31}}) == SV("+32767-12-31")); -#else // defined(_AIX) - assert(stream_c_locale(std::chrono::year_month_day{ - std::chrono::year{32'767}, std::chrono::month{12}, std::chrono::day{31}}) == SV("32767-12-31")); -#endif // defined(_AIX) - - assert(stream_fr_FR_locale( - std::chrono::year_month_day{std::chrono::year{-32'768}, std::chrono::month{1}, std::chrono::day{1}}) == - SV("-32768-01-01 is not a valid date")); - assert(stream_fr_FR_locale( - std::chrono::year_month_day{std::chrono::year{-32'767}, std::chrono::month{0}, std::chrono::day{1}}) == - SV("-32767-00-01 is not a valid date")); - assert(stream_fr_FR_locale( - std::chrono::year_month_day{std::chrono::year{-32'767}, std::chrono::month{1}, std::chrono::day{0}}) == - SV("-32767-01-00 is not a valid date")); - assert(stream_fr_FR_locale(std::chrono::year_month_day{ - std::chrono::year{1970}, std::chrono::month{1}, std::chrono::day{1}}) == SV("1970-01-01")); - assert(stream_fr_FR_locale( - std::chrono::year_month_day{std::chrono::year{1999}, std::chrono::month{2}, std::chrono::day{29}}) == - SV("1999-02-29 is not a valid date")); - assert(stream_fr_FR_locale(std::chrono::year_month_day{ - std::chrono::year{2000}, std::chrono::month{2}, std::chrono::day{29}}) == SV("2000-02-29")); + TEST_EQUAL(stream_c_locale( + std::chrono::year_month_day{std::chrono::year{32'767}, std::chrono::month{12}, std::chrono::day{31}}), + SV("+32767-12-31")); +#elif defined(_WIN32) // defined(_AIX) + TEST_EQUAL(stream_c_locale( + std::chrono::year_month_day{std::chrono::year{32'767}, std::chrono::month{12}, std::chrono::day{31}}), + SV("")); +#else // defined(_AIX) + TEST_EQUAL(stream_c_locale( + std::chrono::year_month_day{std::chrono::year{32'767}, std::chrono::month{12}, std::chrono::day{31}}), + SV("32767-12-31")); +#endif // defined(_AIX) + + TEST_EQUAL(stream_fr_FR_locale( + std::chrono::year_month_day{std::chrono::year{-32'768}, std::chrono::month{1}, std::chrono::day{1}}), + SV("-32768-01-01 is not a valid date")); + TEST_EQUAL(stream_fr_FR_locale( + std::chrono::year_month_day{std::chrono::year{-32'767}, std::chrono::month{0}, std::chrono::day{1}}), + SV("-32767-00-01 is not a valid date")); + TEST_EQUAL(stream_fr_FR_locale( + std::chrono::year_month_day{std::chrono::year{-32'767}, std::chrono::month{1}, std::chrono::day{0}}), + SV("-32767-01-00 is not a valid date")); + TEST_EQUAL(stream_fr_FR_locale( + std::chrono::year_month_day{std::chrono::year{1970}, std::chrono::month{1}, std::chrono::day{1}}), + SV("1970-01-01")); + TEST_EQUAL(stream_fr_FR_locale( + std::chrono::year_month_day{std::chrono::year{1999}, std::chrono::month{2}, std::chrono::day{29}}), + SV("1999-02-29 is not a valid date")); + TEST_EQUAL(stream_fr_FR_locale( + std::chrono::year_month_day{std::chrono::year{2000}, std::chrono::month{2}, std::chrono::day{29}}), + SV("2000-02-29")); #if defined(_AIX) - assert(stream_fr_FR_locale(std::chrono::year_month_day{ - std::chrono::year{32'767}, std::chrono::month{12}, std::chrono::day{31}}) == SV("+32767-12-31")); -#else // defined(_AIX) - assert(stream_fr_FR_locale(std::chrono::year_month_day{ - std::chrono::year{32'767}, std::chrono::month{12}, std::chrono::day{31}}) == SV("32767-12-31")); -#endif // defined(_AIX) - - assert(stream_ja_JP_locale( - std::chrono::year_month_day{std::chrono::year{-32'768}, std::chrono::month{1}, std::chrono::day{1}}) == - SV("-32768-01-01 is not a valid date")); - assert(stream_ja_JP_locale( - std::chrono::year_month_day{std::chrono::year{-32'767}, std::chrono::month{0}, std::chrono::day{1}}) == - SV("-32767-00-01 is not a valid date")); - assert(stream_ja_JP_locale( - std::chrono::year_month_day{std::chrono::year{-32'767}, std::chrono::month{1}, std::chrono::day{0}}) == - SV("-32767-01-00 is not a valid date")); - assert(stream_ja_JP_locale(std::chrono::year_month_day{ - std::chrono::year{1970}, std::chrono::month{1}, std::chrono::day{1}}) == SV("1970-01-01")); - assert(stream_ja_JP_locale( - std::chrono::year_month_day{std::chrono::year{1999}, std::chrono::month{2}, std::chrono::day{29}}) == - SV("1999-02-29 is not a valid date")); - assert(stream_ja_JP_locale(std::chrono::year_month_day{ - std::chrono::year{2000}, std::chrono::month{2}, std::chrono::day{29}}) == SV("2000-02-29")); + TEST_EQUAL(stream_fr_FR_locale( + std::chrono::year_month_day{std::chrono::year{32'767}, std::chrono::month{12}, std::chrono::day{31}}), + SV("+32767-12-31")); +#elif defined(_WIN32) // defined(_AIX) + TEST_EQUAL(stream_fr_FR_locale( + std::chrono::year_month_day{std::chrono::year{32'767}, std::chrono::month{12}, std::chrono::day{31}}), + SV("")); +#else // defined(_AIX) + TEST_EQUAL(stream_fr_FR_locale( + std::chrono::year_month_day{std::chrono::year{32'767}, std::chrono::month{12}, std::chrono::day{31}}), + SV("32767-12-31")); +#endif // defined(_AIX) + + TEST_EQUAL(stream_ja_JP_locale( + std::chrono::year_month_day{std::chrono::year{-32'768}, std::chrono::month{1}, std::chrono::day{1}}), + SV("-32768-01-01 is not a valid date")); + TEST_EQUAL(stream_ja_JP_locale( + std::chrono::year_month_day{std::chrono::year{-32'767}, std::chrono::month{0}, std::chrono::day{1}}), + SV("-32767-00-01 is not a valid date")); + TEST_EQUAL(stream_ja_JP_locale( + std::chrono::year_month_day{std::chrono::year{-32'767}, std::chrono::month{1}, std::chrono::day{0}}), + SV("-32767-01-00 is not a valid date")); + TEST_EQUAL(stream_ja_JP_locale( + std::chrono::year_month_day{std::chrono::year{1970}, std::chrono::month{1}, std::chrono::day{1}}), + SV("1970-01-01")); + TEST_EQUAL(stream_ja_JP_locale( + std::chrono::year_month_day{std::chrono::year{1999}, std::chrono::month{2}, std::chrono::day{29}}), + SV("1999-02-29 is not a valid date")); + TEST_EQUAL(stream_ja_JP_locale( + std::chrono::year_month_day{std::chrono::year{2000}, std::chrono::month{2}, std::chrono::day{29}}), + SV("2000-02-29")); #if defined(_AIX) - assert(stream_ja_JP_locale(std::chrono::year_month_day{ - std::chrono::year{32'767}, std::chrono::month{12}, std::chrono::day{31}}) == SV("+32767-12-31")); -#else // defined(_AIX) - assert(stream_ja_JP_locale(std::chrono::year_month_day{ - std::chrono::year{32'767}, std::chrono::month{12}, std::chrono::day{31}}) == SV("32767-12-31")); -#endif // defined(_AIX) + TEST_EQUAL(stream_ja_JP_locale( + std::chrono::year_month_day{std::chrono::year{32'767}, std::chrono::month{12}, std::chrono::day{31}}), + SV("+32767-12-31")); +#elif defined(_WIN32) // defined(_AIX) + TEST_EQUAL(stream_ja_JP_locale( + std::chrono::year_month_day{std::chrono::year{32'767}, std::chrono::month{12}, std::chrono::day{31}}), + SV("")); +#else // defined(_AIX) + TEST_EQUAL(stream_ja_JP_locale( + std::chrono::year_month_day{std::chrono::year{32'767}, std::chrono::month{12}, std::chrono::day{31}}), + SV("32767-12-31")); +#endif // defined(_AIX) } int main(int, char**) { diff --git a/libcxx/test/std/time/time.cal/time.cal.ymdlast/time.cal.ymdlast.nonmembers/ostream.pass.cpp b/libcxx/test/std/time/time.cal/time.cal.ymdlast/time.cal.ymdlast.nonmembers/ostream.pass.cpp --- a/libcxx/test/std/time/time.cal/time.cal.ymdlast/time.cal.ymdlast.nonmembers/ostream.pass.cpp +++ b/libcxx/test/std/time/time.cal/time.cal.ymdlast/time.cal.ymdlast.nonmembers/ostream.pass.cpp @@ -12,15 +12,15 @@ // UNSUPPORTED: no-localization // UNSUPPORTED: libcpp-has-no-incomplete-format -// TODO FMT Investigate Windows issues. -// UNSUPPORTED: msvc, target={{.+}}-windows-gnu - // TODO FMT It seems GCC uses too much memory in the CI and fails. // UNSUPPORTED: gcc-12 // TODO FMT This test should not require std::to_chars(floating-point) // XFAIL: availability-fp_to_chars-missing +// TODO FMT Investigate Windows issues. +// XFAIL: msvc + // REQUIRES: locale.fr_FR.UTF-8 // REQUIRES: locale.ja_JP.UTF-8 @@ -39,9 +39,16 @@ #include "make_string.h" #include "platform_support.h" // locale name macros #include "test_macros.h" +#include "assert_macros.h" +#include "concat_macros.h" #define SV(S) MAKE_STRING_VIEW(CharT, S) +#define TEST_EQUAL(OUT, EXPECTED) \ + TEST_REQUIRE(OUT == EXPECTED, \ + TEST_WRITE_CONCATENATED( \ + "\nExpression ", #OUT, "\nExpected output ", EXPECTED, "\nActual output ", OUT, '\n')); + template static std::basic_string stream_c_locale(std::chrono::year_month_day_last ymdl) { std::basic_stringstream sstr; @@ -69,195 +76,299 @@ template static void test() { - assert(stream_c_locale(std::chrono::year_month_day_last{ - std::chrono::year{0}, std::chrono::month_day_last{std::chrono::month{0}}}) == - SV("0000/0 is not a valid month/last")); - assert(stream_c_locale(std::chrono::year_month_day_last{ - std::chrono::year{-32'768}, std::chrono::month_day_last{std::chrono::month{1}}}) == - SV("-32768 is not a valid year/Jan/last")); - assert(stream_c_locale(std::chrono::year_month_day_last{ - std::chrono::year{-32'767}, std::chrono::month_day_last{std::chrono::month{2}}}) == SV("-32767/Feb/last")); - assert(stream_c_locale(std::chrono::year_month_day_last{ - std::chrono::year{0}, std::chrono::month_day_last{std::chrono::month{3}}}) == SV("0000/Mar/last")); - assert(stream_c_locale(std::chrono::year_month_day_last{ - std::chrono::year{1970}, std::chrono::month_day_last{std::chrono::month{4}}}) == SV("1970/Apr/last")); - assert(stream_c_locale(std::chrono::year_month_day_last{ - std::chrono::year{32'767}, std::chrono::month_day_last{std::chrono::month{5}}}) == SV("32767/May/last")); - assert(stream_c_locale(std::chrono::year_month_day_last{ - std::chrono::year{0}, std::chrono::month_day_last{std::chrono::month{6}}}) == SV("0000/Jun/last")); - assert(stream_c_locale(std::chrono::year_month_day_last{ - std::chrono::year{0}, std::chrono::month_day_last{std::chrono::month{7}}}) == SV("0000/Jul/last")); - assert(stream_c_locale(std::chrono::year_month_day_last{ - std::chrono::year{0}, std::chrono::month_day_last{std::chrono::month{8}}}) == SV("0000/Aug/last")); - assert(stream_c_locale(std::chrono::year_month_day_last{ - std::chrono::year{0}, std::chrono::month_day_last{std::chrono::month{9}}}) == SV("0000/Sep/last")); - assert(stream_c_locale(std::chrono::year_month_day_last{ - std::chrono::year{0}, std::chrono::month_day_last{std::chrono::month{10}}}) == SV("0000/Oct/last")); - assert(stream_c_locale(std::chrono::year_month_day_last{ - std::chrono::year{0}, std::chrono::month_day_last{std::chrono::month{11}}}) == SV("0000/Nov/last")); - assert(stream_c_locale(std::chrono::year_month_day_last{ - std::chrono::year{0}, std::chrono::month_day_last{std::chrono::month{12}}}) == SV("0000/Dec/last")); - assert(stream_c_locale(std::chrono::year_month_day_last{ - std::chrono::year{0}, std::chrono::month_day_last{std::chrono::month{13}}}) == - SV("0000/13 is not a valid month/last")); - assert(stream_c_locale(std::chrono::year_month_day_last{ - std::chrono::year{-32'768}, std::chrono::month_day_last{std::chrono::month{255}}}) == - SV("-32768 is not a valid year/255 is not a valid month/last")); + TEST_EQUAL(stream_c_locale(std::chrono::year_month_day_last{ + std::chrono::year{0}, std::chrono::month_day_last{std::chrono::month{0}}}), + SV("0000/0 is not a valid month/last")); + TEST_EQUAL(stream_c_locale(std::chrono::year_month_day_last{ + std::chrono::year{-32'768}, std::chrono::month_day_last{std::chrono::month{1}}}), + SV("-32768 is not a valid year/Jan/last")); + TEST_EQUAL(stream_c_locale(std::chrono::year_month_day_last{ + std::chrono::year{-32'767}, std::chrono::month_day_last{std::chrono::month{2}}}), + SV("-32767/Feb/last")); + TEST_EQUAL(stream_c_locale(std::chrono::year_month_day_last{ + std::chrono::year{0}, std::chrono::month_day_last{std::chrono::month{3}}}), + SV("0000/Mar/last")); + TEST_EQUAL(stream_c_locale(std::chrono::year_month_day_last{ + std::chrono::year{1970}, std::chrono::month_day_last{std::chrono::month{4}}}), + SV("1970/Apr/last")); +#ifdef _WIN32 + TEST_EQUAL(stream_c_locale(std::chrono::year_month_day_last{ + std::chrono::year{32'767}, std::chrono::month_day_last{std::chrono::month{5}}}), + SV("/May/last")); +#else + TEST_EQUAL(stream_c_locale(std::chrono::year_month_day_last{ + std::chrono::year{32'767}, std::chrono::month_day_last{std::chrono::month{5}}}), + SV("32767/May/last")); +#endif + TEST_EQUAL(stream_c_locale(std::chrono::year_month_day_last{ + std::chrono::year{0}, std::chrono::month_day_last{std::chrono::month{6}}}), + SV("0000/Jun/last")); + TEST_EQUAL(stream_c_locale(std::chrono::year_month_day_last{ + std::chrono::year{0}, std::chrono::month_day_last{std::chrono::month{7}}}), + SV("0000/Jul/last")); + TEST_EQUAL(stream_c_locale(std::chrono::year_month_day_last{ + std::chrono::year{0}, std::chrono::month_day_last{std::chrono::month{8}}}), + SV("0000/Aug/last")); + TEST_EQUAL(stream_c_locale(std::chrono::year_month_day_last{ + std::chrono::year{0}, std::chrono::month_day_last{std::chrono::month{9}}}), + SV("0000/Sep/last")); + TEST_EQUAL(stream_c_locale(std::chrono::year_month_day_last{ + std::chrono::year{0}, std::chrono::month_day_last{std::chrono::month{10}}}), + SV("0000/Oct/last")); + TEST_EQUAL(stream_c_locale(std::chrono::year_month_day_last{ + std::chrono::year{0}, std::chrono::month_day_last{std::chrono::month{11}}}), + SV("0000/Nov/last")); + TEST_EQUAL(stream_c_locale(std::chrono::year_month_day_last{ + std::chrono::year{0}, std::chrono::month_day_last{std::chrono::month{12}}}), + SV("0000/Dec/last")); + TEST_EQUAL(stream_c_locale(std::chrono::year_month_day_last{ + std::chrono::year{0}, std::chrono::month_day_last{std::chrono::month{13}}}), + SV("0000/13 is not a valid month/last")); + TEST_EQUAL(stream_c_locale(std::chrono::year_month_day_last{ + std::chrono::year{-32'768}, std::chrono::month_day_last{std::chrono::month{255}}}), + SV("-32768 is not a valid year/255 is not a valid month/last")); - assert(stream_fr_FR_locale(std::chrono::year_month_day_last{ - std::chrono::year{0}, std::chrono::month_day_last{std::chrono::month{0}}}) == - SV("0000/0 is not a valid month/last")); + TEST_EQUAL(stream_fr_FR_locale(std::chrono::year_month_day_last{ + std::chrono::year{0}, std::chrono::month_day_last{std::chrono::month{0}}}), + SV("0000/0 is not a valid month/last")); #if defined(__APPLE__) - assert(stream_fr_FR_locale(std::chrono::year_month_day_last{ - std::chrono::year{-32'768}, std::chrono::month_day_last{std::chrono::month{1}}}) == - SV("-32768 is not a valid year/jan/last")); - assert(stream_fr_FR_locale(std::chrono::year_month_day_last{ - std::chrono::year{-32'767}, std::chrono::month_day_last{std::chrono::month{2}}}) == SV("-32767/fév/last")); - assert(stream_fr_FR_locale(std::chrono::year_month_day_last{ - std::chrono::year{0}, std::chrono::month_day_last{std::chrono::month{3}}}) == SV("0000/mar/last")); - assert(stream_fr_FR_locale(std::chrono::year_month_day_last{ - std::chrono::year{1970}, std::chrono::month_day_last{std::chrono::month{4}}}) == SV("1970/avr/last")); - assert(stream_fr_FR_locale(std::chrono::year_month_day_last{ - std::chrono::year{32'767}, std::chrono::month_day_last{std::chrono::month{5}}}) == SV("32767/mai/last")); - assert(stream_fr_FR_locale(std::chrono::year_month_day_last{ - std::chrono::year{0}, std::chrono::month_day_last{std::chrono::month{6}}}) == SV("0000/jui/last")); - assert(stream_fr_FR_locale(std::chrono::year_month_day_last{ - std::chrono::year{0}, std::chrono::month_day_last{std::chrono::month{7}}}) == SV("0000/jul/last")); - assert(stream_fr_FR_locale(std::chrono::year_month_day_last{ - std::chrono::year{0}, std::chrono::month_day_last{std::chrono::month{8}}}) == SV("0000/aoû/last")); - assert(stream_fr_FR_locale(std::chrono::year_month_day_last{ - std::chrono::year{0}, std::chrono::month_day_last{std::chrono::month{9}}}) == SV("0000/sep/last")); - assert(stream_fr_FR_locale(std::chrono::year_month_day_last{ - std::chrono::year{0}, std::chrono::month_day_last{std::chrono::month{10}}}) == SV("0000/oct/last")); - assert(stream_fr_FR_locale(std::chrono::year_month_day_last{ - std::chrono::year{0}, std::chrono::month_day_last{std::chrono::month{11}}}) == SV("0000/nov/last")); - assert(stream_fr_FR_locale(std::chrono::year_month_day_last{ - std::chrono::year{0}, std::chrono::month_day_last{std::chrono::month{12}}}) == SV("0000/déc/last")); -#else // defined(__APPLE__) - assert(stream_fr_FR_locale(std::chrono::year_month_day_last{ - std::chrono::year{-32'768}, std::chrono::month_day_last{std::chrono::month{1}}}) == - SV("-32768 is not a valid year/janv./last")); - assert( - stream_fr_FR_locale(std::chrono::year_month_day_last{ - std::chrono::year{-32'767}, std::chrono::month_day_last{std::chrono::month{2}}}) == SV("-32767/févr./last")); - assert(stream_fr_FR_locale(std::chrono::year_month_day_last{ - std::chrono::year{0}, std::chrono::month_day_last{std::chrono::month{3}}}) == SV("0000/mars/last")); + TEST_EQUAL(stream_fr_FR_locale(std::chrono::year_month_day_last{ + std::chrono::year{-32'768}, std::chrono::month_day_last{std::chrono::month{1}}}), + SV("-32768 is not a valid year/jan/last")); + TEST_EQUAL(stream_fr_FR_locale(std::chrono::year_month_day_last{ + std::chrono::year{-32'767}, std::chrono::month_day_last{std::chrono::month{2}}}), + SV("-32767/fév/last")); + TEST_EQUAL(stream_fr_FR_locale(std::chrono::year_month_day_last{ + std::chrono::year{0}, std::chrono::month_day_last{std::chrono::month{3}}}), + SV("0000/mar/last")); + TEST_EQUAL(stream_fr_FR_locale(std::chrono::year_month_day_last{ + std::chrono::year{1970}, std::chrono::month_day_last{std::chrono::month{4}}}), + SV("1970/avr/last")); + TEST_EQUAL(stream_fr_FR_locale(std::chrono::year_month_day_last{ + std::chrono::year{32'767}, std::chrono::month_day_last{std::chrono::month{5}}}), + SV("32767/mai/last")); + TEST_EQUAL(stream_fr_FR_locale(std::chrono::year_month_day_last{ + std::chrono::year{0}, std::chrono::month_day_last{std::chrono::month{6}}}), + SV("0000/jui/last")); + TEST_EQUAL(stream_fr_FR_locale(std::chrono::year_month_day_last{ + std::chrono::year{0}, std::chrono::month_day_last{std::chrono::month{7}}}), + SV("0000/jul/last")); + TEST_EQUAL(stream_fr_FR_locale(std::chrono::year_month_day_last{ + std::chrono::year{0}, std::chrono::month_day_last{std::chrono::month{8}}}), + SV("0000/aoû/last")); + TEST_EQUAL(stream_fr_FR_locale(std::chrono::year_month_day_last{ + std::chrono::year{0}, std::chrono::month_day_last{std::chrono::month{9}}}), + SV("0000/sep/last")); + TEST_EQUAL(stream_fr_FR_locale(std::chrono::year_month_day_last{ + std::chrono::year{0}, std::chrono::month_day_last{std::chrono::month{10}}}), + SV("0000/oct/last")); + TEST_EQUAL(stream_fr_FR_locale(std::chrono::year_month_day_last{ + std::chrono::year{0}, std::chrono::month_day_last{std::chrono::month{11}}}), + SV("0000/nov/last")); + TEST_EQUAL(stream_fr_FR_locale(std::chrono::year_month_day_last{ + std::chrono::year{0}, std::chrono::month_day_last{std::chrono::month{12}}}), + SV("0000/déc/last")); +#else // defined(__APPLE__) + TEST_EQUAL(stream_fr_FR_locale(std::chrono::year_month_day_last{ + std::chrono::year{-32'768}, std::chrono::month_day_last{std::chrono::month{1}}}), + SV("-32768 is not a valid year/janv./last")); + TEST_EQUAL(stream_fr_FR_locale(std::chrono::year_month_day_last{ + std::chrono::year{-32'767}, std::chrono::month_day_last{std::chrono::month{2}}}), + SV("-32767/févr./last")); + TEST_EQUAL(stream_fr_FR_locale(std::chrono::year_month_day_last{ + std::chrono::year{0}, std::chrono::month_day_last{std::chrono::month{3}}}), + SV("0000/mars/last")); # if defined(_WIN32) || defined(_AIX) - assert(stream_fr_FR_locale(std::chrono::year_month_day_last{ - std::chrono::year{1970}, std::chrono::month_day_last{std::chrono::month{4}}}) == SV("1970/avr./last")); + TEST_EQUAL(stream_fr_FR_locale(std::chrono::year_month_day_last{ + std::chrono::year{1970}, std::chrono::month_day_last{std::chrono::month{4}}}), + SV("1970/avr./last")); # else // defined(_WIN32) || defined(_AIX) - assert(stream_fr_FR_locale(std::chrono::year_month_day_last{ - std::chrono::year{1970}, std::chrono::month_day_last{std::chrono::month{4}}}) == SV("1970/avril/last")); + TEST_EQUAL(stream_fr_FR_locale(std::chrono::year_month_day_last{ + std::chrono::year{1970}, std::chrono::month_day_last{std::chrono::month{4}}}), + SV("1970/avril/last")); # endif // defined(_WIN32) || defined(_AIX) - assert(stream_fr_FR_locale(std::chrono::year_month_day_last{ - std::chrono::year{32'767}, std::chrono::month_day_last{std::chrono::month{5}}}) == SV("32767/mai/last")); - assert(stream_fr_FR_locale(std::chrono::year_month_day_last{ - std::chrono::year{0}, std::chrono::month_day_last{std::chrono::month{6}}}) == SV("0000/juin/last")); - assert(stream_fr_FR_locale(std::chrono::year_month_day_last{ - std::chrono::year{0}, std::chrono::month_day_last{std::chrono::month{7}}}) == SV("0000/juil./last")); - assert(stream_fr_FR_locale(std::chrono::year_month_day_last{ - std::chrono::year{0}, std::chrono::month_day_last{std::chrono::month{8}}}) == SV("0000/août/last")); - assert(stream_fr_FR_locale(std::chrono::year_month_day_last{ - std::chrono::year{0}, std::chrono::month_day_last{std::chrono::month{9}}}) == SV("0000/sept./last")); - assert(stream_fr_FR_locale(std::chrono::year_month_day_last{ - std::chrono::year{0}, std::chrono::month_day_last{std::chrono::month{10}}}) == SV("0000/oct./last")); - assert(stream_fr_FR_locale(std::chrono::year_month_day_last{ - std::chrono::year{0}, std::chrono::month_day_last{std::chrono::month{11}}}) == SV("0000/nov./last")); - assert(stream_fr_FR_locale(std::chrono::year_month_day_last{ - std::chrono::year{0}, std::chrono::month_day_last{std::chrono::month{12}}}) == SV("0000/déc./last")); -#endif // defined(__APPLE__) - assert(stream_fr_FR_locale(std::chrono::year_month_day_last{ - std::chrono::year{0}, std::chrono::month_day_last{std::chrono::month{13}}}) == - SV("0000/13 is not a valid month/last")); - assert(stream_fr_FR_locale(std::chrono::year_month_day_last{ - std::chrono::year{-32'768}, std::chrono::month_day_last{std::chrono::month{255}}}) == - SV("-32768 is not a valid year/255 is not a valid month/last")); +# ifdef _WIN32 + TEST_EQUAL(stream_fr_FR_locale(std::chrono::year_month_day_last{ + std::chrono::year{32'767}, std::chrono::month_day_last{std::chrono::month{5}}}), + SV("/mai/last")); +# else + TEST_EQUAL(stream_fr_FR_locale(std::chrono::year_month_day_last{ + std::chrono::year{32'767}, std::chrono::month_day_last{std::chrono::month{5}}}), + SV("32767/mai/last")); +# endif + TEST_EQUAL(stream_fr_FR_locale(std::chrono::year_month_day_last{ + std::chrono::year{0}, std::chrono::month_day_last{std::chrono::month{6}}}), + SV("0000/juin/last")); + TEST_EQUAL(stream_fr_FR_locale(std::chrono::year_month_day_last{ + std::chrono::year{0}, std::chrono::month_day_last{std::chrono::month{7}}}), + SV("0000/juil./last")); + TEST_EQUAL(stream_fr_FR_locale(std::chrono::year_month_day_last{ + std::chrono::year{0}, std::chrono::month_day_last{std::chrono::month{8}}}), + SV("0000/août/last")); + TEST_EQUAL(stream_fr_FR_locale(std::chrono::year_month_day_last{ + std::chrono::year{0}, std::chrono::month_day_last{std::chrono::month{9}}}), + SV("0000/sept./last")); + TEST_EQUAL(stream_fr_FR_locale(std::chrono::year_month_day_last{ + std::chrono::year{0}, std::chrono::month_day_last{std::chrono::month{10}}}), + SV("0000/oct./last")); + TEST_EQUAL(stream_fr_FR_locale(std::chrono::year_month_day_last{ + std::chrono::year{0}, std::chrono::month_day_last{std::chrono::month{11}}}), + SV("0000/nov./last")); + TEST_EQUAL(stream_fr_FR_locale(std::chrono::year_month_day_last{ + std::chrono::year{0}, std::chrono::month_day_last{std::chrono::month{12}}}), + SV("0000/déc./last")); +#endif // defined(__APPLE__) + TEST_EQUAL(stream_fr_FR_locale(std::chrono::year_month_day_last{ + std::chrono::year{0}, std::chrono::month_day_last{std::chrono::month{13}}}), + SV("0000/13 is not a valid month/last")); + TEST_EQUAL(stream_fr_FR_locale(std::chrono::year_month_day_last{ + std::chrono::year{-32'768}, std::chrono::month_day_last{std::chrono::month{255}}}), + SV("-32768 is not a valid year/255 is not a valid month/last")); - assert(stream_ja_JP_locale(std::chrono::year_month_day_last{ - std::chrono::year{0}, std::chrono::month_day_last{std::chrono::month{0}}}) == - SV("0000/0 is not a valid month/last")); -#if defined(__APPLE__) - assert(stream_ja_JP_locale(std::chrono::year_month_day_last{ - std::chrono::year{-32'768}, std::chrono::month_day_last{std::chrono::month{1}}}) == - SV("-32768 is not a valid year/ 1/last")); - assert(stream_ja_JP_locale(std::chrono::year_month_day_last{ - std::chrono::year{-32'767}, std::chrono::month_day_last{std::chrono::month{2}}}) == SV("-32767/ 2/last")); - assert(stream_ja_JP_locale(std::chrono::year_month_day_last{ - std::chrono::year{0}, std::chrono::month_day_last{std::chrono::month{3}}}) == SV("0000/ 3/last")); - assert(stream_ja_JP_locale(std::chrono::year_month_day_last{ - std::chrono::year{1970}, std::chrono::month_day_last{std::chrono::month{4}}}) == SV("1970/ 4/last")); - assert(stream_ja_JP_locale(std::chrono::year_month_day_last{ - std::chrono::year{32'767}, std::chrono::month_day_last{std::chrono::month{5}}}) == SV("32767/ 5/last")); - assert(stream_ja_JP_locale(std::chrono::year_month_day_last{ - std::chrono::year{0}, std::chrono::month_day_last{std::chrono::month{6}}}) == SV("0000/ 6/last")); - assert(stream_ja_JP_locale(std::chrono::year_month_day_last{ - std::chrono::year{0}, std::chrono::month_day_last{std::chrono::month{7}}}) == SV("0000/ 7/last")); - assert(stream_ja_JP_locale(std::chrono::year_month_day_last{ - std::chrono::year{0}, std::chrono::month_day_last{std::chrono::month{8}}}) == SV("0000/ 8/last")); - assert(stream_ja_JP_locale(std::chrono::year_month_day_last{ - std::chrono::year{0}, std::chrono::month_day_last{std::chrono::month{9}}}) == SV("0000/ 9/last")); - assert(stream_ja_JP_locale(std::chrono::year_month_day_last{ - std::chrono::year{0}, std::chrono::month_day_last{std::chrono::month{10}}}) == SV("0000/10/last")); - assert(stream_ja_JP_locale(std::chrono::year_month_day_last{ - std::chrono::year{0}, std::chrono::month_day_last{std::chrono::month{11}}}) == SV("0000/11/last")); - assert(stream_ja_JP_locale(std::chrono::year_month_day_last{ - std::chrono::year{0}, std::chrono::month_day_last{std::chrono::month{12}}}) == SV("0000/12/last")); -#else // defined(__APPLE__) -# if defined(_WIN32) || defined(_AIX) - assert(stream_ja_JP_locale(std::chrono::year_month_day_last{ - std::chrono::year{-32'768}, std::chrono::month_day_last{std::chrono::month{1}}}) == - SV("-32768 is not a valid year/1月/last")); - assert(stream_ja_JP_locale(std::chrono::year_month_day_last{ - std::chrono::year{-32'767}, std::chrono::month_day_last{std::chrono::month{2}}}) == SV("-32767/2月/last")); - assert(stream_ja_JP_locale(std::chrono::year_month_day_last{ - std::chrono::year{0}, std::chrono::month_day_last{std::chrono::month{3}}}) == SV("0000/3月/last")); - assert(stream_ja_JP_locale(std::chrono::year_month_day_last{ - std::chrono::year{1970}, std::chrono::month_day_last{std::chrono::month{4}}}) == SV("1970/4月/last")); - assert(stream_ja_JP_locale(std::chrono::year_month_day_last{ - std::chrono::year{32'767}, std::chrono::month_day_last{std::chrono::month{5}}}) == SV("32767/5月/last")); - assert(stream_ja_JP_locale(std::chrono::year_month_day_last{ - std::chrono::year{0}, std::chrono::month_day_last{std::chrono::month{6}}}) == SV("0000/6月/last")); - assert(stream_ja_JP_locale(std::chrono::year_month_day_last{ - std::chrono::year{0}, std::chrono::month_day_last{std::chrono::month{7}}}) == SV("0000/7月/last")); - assert(stream_ja_JP_locale(std::chrono::year_month_day_last{ - std::chrono::year{0}, std::chrono::month_day_last{std::chrono::month{8}}}) == SV("0000/8月/last")); - assert(stream_ja_JP_locale(std::chrono::year_month_day_last{ - std::chrono::year{0}, std::chrono::month_day_last{std::chrono::month{9}}}) == SV("0000/9月/last")); -# else // defined(_WIN32) || defined(_AIX) - assert(stream_ja_JP_locale(std::chrono::year_month_day_last{ - std::chrono::year{-32'768}, std::chrono::month_day_last{std::chrono::month{1}}}) == - SV("-32768 is not a valid year/ 1月/last")); - assert( - stream_ja_JP_locale(std::chrono::year_month_day_last{ - std::chrono::year{-32'767}, std::chrono::month_day_last{std::chrono::month{2}}}) == SV("-32767/ 2月/last")); - assert(stream_ja_JP_locale(std::chrono::year_month_day_last{ - std::chrono::year{0}, std::chrono::month_day_last{std::chrono::month{3}}}) == SV("0000/ 3月/last")); - assert(stream_ja_JP_locale(std::chrono::year_month_day_last{ - std::chrono::year{1970}, std::chrono::month_day_last{std::chrono::month{4}}}) == SV("1970/ 4月/last")); - assert(stream_ja_JP_locale(std::chrono::year_month_day_last{ - std::chrono::year{32'767}, std::chrono::month_day_last{std::chrono::month{5}}}) == SV("32767/ 5月/last")); - assert(stream_ja_JP_locale(std::chrono::year_month_day_last{ - std::chrono::year{0}, std::chrono::month_day_last{std::chrono::month{6}}}) == SV("0000/ 6月/last")); - assert(stream_ja_JP_locale(std::chrono::year_month_day_last{ - std::chrono::year{0}, std::chrono::month_day_last{std::chrono::month{7}}}) == SV("0000/ 7月/last")); - assert(stream_ja_JP_locale(std::chrono::year_month_day_last{ - std::chrono::year{0}, std::chrono::month_day_last{std::chrono::month{8}}}) == SV("0000/ 8月/last")); - assert(stream_ja_JP_locale(std::chrono::year_month_day_last{ - std::chrono::year{0}, std::chrono::month_day_last{std::chrono::month{9}}}) == SV("0000/ 9月/last")); -# endif // defined(_WIN32) || defined(_AIX) - assert(stream_ja_JP_locale(std::chrono::year_month_day_last{ - std::chrono::year{0}, std::chrono::month_day_last{std::chrono::month{10}}}) == SV("0000/10月/last")); - assert(stream_ja_JP_locale(std::chrono::year_month_day_last{ - std::chrono::year{0}, std::chrono::month_day_last{std::chrono::month{11}}}) == SV("0000/11月/last")); - assert(stream_ja_JP_locale(std::chrono::year_month_day_last{ - std::chrono::year{0}, std::chrono::month_day_last{std::chrono::month{12}}}) == SV("0000/12月/last")); -#endif // defined(__APPLE__) - assert(stream_ja_JP_locale(std::chrono::year_month_day_last{ - std::chrono::year{0}, std::chrono::month_day_last{std::chrono::month{13}}}) == - SV("0000/13 is not a valid month/last")); - assert(stream_ja_JP_locale(std::chrono::year_month_day_last{ - std::chrono::year{-32'768}, std::chrono::month_day_last{std::chrono::month{255}}}) == - SV("-32768 is not a valid year/255 is not a valid month/last")); + TEST_EQUAL(stream_ja_JP_locale(std::chrono::year_month_day_last{ + std::chrono::year{0}, std::chrono::month_day_last{std::chrono::month{0}}}), + SV("0000/0 is not a valid month/last")); +#if defined(__APPLE__) || defined(_WIN32) +# if defined(__APPLE__) + TEST_EQUAL(stream_ja_JP_locale(std::chrono::year_month_day_last{ + std::chrono::year{-32'768}, std::chrono::month_day_last{std::chrono::month{1}}}), + SV("-32768 is not a valid year/ 1/last")); + TEST_EQUAL(stream_ja_JP_locale(std::chrono::year_month_day_last{ + std::chrono::year{-32'767}, std::chrono::month_day_last{std::chrono::month{2}}}), + SV("-32767/ 2/last")); + TEST_EQUAL(stream_ja_JP_locale(std::chrono::year_month_day_last{ + std::chrono::year{0}, std::chrono::month_day_last{std::chrono::month{3}}}), + SV("0000/ 3/last")); + TEST_EQUAL(stream_ja_JP_locale(std::chrono::year_month_day_last{ + std::chrono::year{1970}, std::chrono::month_day_last{std::chrono::month{4}}}), + SV("1970/ 4/last")); + TEST_EQUAL(stream_ja_JP_locale(std::chrono::year_month_day_last{ + std::chrono::year{32'767}, std::chrono::month_day_last{std::chrono::month{5}}}), + SV("32767/ 5/last")); + TEST_EQUAL(stream_ja_JP_locale(std::chrono::year_month_day_last{ + std::chrono::year{0}, std::chrono::month_day_last{std::chrono::month{6}}}), + SV("0000/ 6/last")); + TEST_EQUAL(stream_ja_JP_locale(std::chrono::year_month_day_last{ + std::chrono::year{0}, std::chrono::month_day_last{std::chrono::month{7}}}), + SV("0000/ 7/last")); + TEST_EQUAL(stream_ja_JP_locale(std::chrono::year_month_day_last{ + std::chrono::year{0}, std::chrono::month_day_last{std::chrono::month{8}}}), + SV("0000/ 8/last")); + TEST_EQUAL(stream_ja_JP_locale(std::chrono::year_month_day_last{ + std::chrono::year{0}, std::chrono::month_day_last{std::chrono::month{9}}}), + SV("0000/ 9/last")); +# else // defined(__APPLE__) + TEST_EQUAL(stream_ja_JP_locale(std::chrono::year_month_day_last{ + std::chrono::year{-32'768}, std::chrono::month_day_last{std::chrono::month{1}}}), + SV("-32768 is not a valid year/1/last")); + TEST_EQUAL(stream_ja_JP_locale(std::chrono::year_month_day_last{ + std::chrono::year{-32'767}, std::chrono::month_day_last{std::chrono::month{2}}}), + SV("-32767/2/last")); + TEST_EQUAL(stream_ja_JP_locale(std::chrono::year_month_day_last{ + std::chrono::year{0}, std::chrono::month_day_last{std::chrono::month{3}}}), + SV("0000/3/last")); + TEST_EQUAL(stream_ja_JP_locale(std::chrono::year_month_day_last{ + std::chrono::year{1970}, std::chrono::month_day_last{std::chrono::month{4}}}), + SV("1970/4/last")); + TEST_EQUAL(stream_ja_JP_locale(std::chrono::year_month_day_last{ + std::chrono::year{32'767}, std::chrono::month_day_last{std::chrono::month{5}}}), + SV("/5/last")); + TEST_EQUAL(stream_ja_JP_locale(std::chrono::year_month_day_last{ + std::chrono::year{0}, std::chrono::month_day_last{std::chrono::month{6}}}), + SV("0000/6/last")); + TEST_EQUAL(stream_ja_JP_locale(std::chrono::year_month_day_last{ + std::chrono::year{0}, std::chrono::month_day_last{std::chrono::month{7}}}), + SV("0000/7/last")); + TEST_EQUAL(stream_ja_JP_locale(std::chrono::year_month_day_last{ + std::chrono::year{0}, std::chrono::month_day_last{std::chrono::month{8}}}), + SV("0000/8/last")); + TEST_EQUAL(stream_ja_JP_locale(std::chrono::year_month_day_last{ + std::chrono::year{0}, std::chrono::month_day_last{std::chrono::month{9}}}), + SV("0000/9/last")); +# endif // defined(__APPLE__) + TEST_EQUAL(stream_ja_JP_locale(std::chrono::year_month_day_last{ + std::chrono::year{0}, std::chrono::month_day_last{std::chrono::month{10}}}), + SV("0000/10/last")); + TEST_EQUAL(stream_ja_JP_locale(std::chrono::year_month_day_last{ + std::chrono::year{0}, std::chrono::month_day_last{std::chrono::month{11}}}), + SV("0000/11/last")); + TEST_EQUAL(stream_ja_JP_locale(std::chrono::year_month_day_last{ + std::chrono::year{0}, std::chrono::month_day_last{std::chrono::month{12}}}), + SV("0000/12/last")); +#else // defined(__APPLE__) || defined(_WIN32) +# if defined(_AIX) + TEST_EQUAL(stream_ja_JP_locale(std::chrono::year_month_day_last{ + std::chrono::year{-32'768}, std::chrono::month_day_last{std::chrono::month{1}}}), + SV("-32768 is not a valid year/1月/last")); + TEST_EQUAL(stream_ja_JP_locale(std::chrono::year_month_day_last{ + std::chrono::year{-32'767}, std::chrono::month_day_last{std::chrono::month{2}}}), + SV("-32767/2月/last")); + TEST_EQUAL(stream_ja_JP_locale(std::chrono::year_month_day_last{ + std::chrono::year{0}, std::chrono::month_day_last{std::chrono::month{3}}}), + SV("0000/3月/last")); + TEST_EQUAL(stream_ja_JP_locale(std::chrono::year_month_day_last{ + std::chrono::year{1970}, std::chrono::month_day_last{std::chrono::month{4}}}), + SV("1970/4月/last")); + TEST_EQUAL(stream_ja_JP_locale(std::chrono::year_month_day_last{ + std::chrono::year{32'767}, std::chrono::month_day_last{std::chrono::month{5}}}), + SV("32767/5月/last")); + TEST_EQUAL(stream_ja_JP_locale(std::chrono::year_month_day_last{ + std::chrono::year{0}, std::chrono::month_day_last{std::chrono::month{6}}}), + SV("0000/6月/last")); + TEST_EQUAL(stream_ja_JP_locale(std::chrono::year_month_day_last{ + std::chrono::year{0}, std::chrono::month_day_last{std::chrono::month{7}}}), + SV("0000/7月/last")); + TEST_EQUAL(stream_ja_JP_locale(std::chrono::year_month_day_last{ + std::chrono::year{0}, std::chrono::month_day_last{std::chrono::month{8}}}), + SV("0000/8月/last")); + TEST_EQUAL(stream_ja_JP_locale(std::chrono::year_month_day_last{ + std::chrono::year{0}, std::chrono::month_day_last{std::chrono::month{9}}}), + SV("0000/9月/last")); +# else // defined(_AIX) + TEST_EQUAL(stream_ja_JP_locale(std::chrono::year_month_day_last{ + std::chrono::year{-32'768}, std::chrono::month_day_last{std::chrono::month{1}}}), + SV("-32768 is not a valid year/ 1月/last")); + TEST_EQUAL(stream_ja_JP_locale(std::chrono::year_month_day_last{ + std::chrono::year{-32'767}, std::chrono::month_day_last{std::chrono::month{2}}}), + SV("-32767/ 2月/last")); + TEST_EQUAL(stream_ja_JP_locale(std::chrono::year_month_day_last{ + std::chrono::year{0}, std::chrono::month_day_last{std::chrono::month{3}}}), + SV("0000/ 3月/last")); + TEST_EQUAL(stream_ja_JP_locale(std::chrono::year_month_day_last{ + std::chrono::year{1970}, std::chrono::month_day_last{std::chrono::month{4}}}), + SV("1970/ 4月/last")); + TEST_EQUAL(stream_ja_JP_locale(std::chrono::year_month_day_last{ + std::chrono::year{32'767}, std::chrono::month_day_last{std::chrono::month{5}}}), + SV("32767/ 5月/last")); + TEST_EQUAL(stream_ja_JP_locale(std::chrono::year_month_day_last{ + std::chrono::year{0}, std::chrono::month_day_last{std::chrono::month{6}}}), + SV("0000/ 6月/last")); + TEST_EQUAL(stream_ja_JP_locale(std::chrono::year_month_day_last{ + std::chrono::year{0}, std::chrono::month_day_last{std::chrono::month{7}}}), + SV("0000/ 7月/last")); + TEST_EQUAL(stream_ja_JP_locale(std::chrono::year_month_day_last{ + std::chrono::year{0}, std::chrono::month_day_last{std::chrono::month{8}}}), + SV("0000/ 8月/last")); + TEST_EQUAL(stream_ja_JP_locale(std::chrono::year_month_day_last{ + std::chrono::year{0}, std::chrono::month_day_last{std::chrono::month{9}}}), + SV("0000/ 9月/last")); +# endif // defined(_AIX) + TEST_EQUAL(stream_ja_JP_locale(std::chrono::year_month_day_last{ + std::chrono::year{0}, std::chrono::month_day_last{std::chrono::month{10}}}), + SV("0000/10月/last")); + TEST_EQUAL(stream_ja_JP_locale(std::chrono::year_month_day_last{ + std::chrono::year{0}, std::chrono::month_day_last{std::chrono::month{11}}}), + SV("0000/11月/last")); + TEST_EQUAL(stream_ja_JP_locale(std::chrono::year_month_day_last{ + std::chrono::year{0}, std::chrono::month_day_last{std::chrono::month{12}}}), + SV("0000/12月/last")); +#endif // defined(__APPLE__) || defined(_WIN32) + TEST_EQUAL(stream_ja_JP_locale(std::chrono::year_month_day_last{ + std::chrono::year{0}, std::chrono::month_day_last{std::chrono::month{13}}}), + SV("0000/13 is not a valid month/last")); + TEST_EQUAL(stream_ja_JP_locale(std::chrono::year_month_day_last{ + std::chrono::year{-32'768}, std::chrono::month_day_last{std::chrono::month{255}}}), + SV("-32768 is not a valid year/255 is not a valid month/last")); } int main(int, char**) { diff --git a/libcxx/test/std/time/time.cal/time.cal.ymwd/time.cal.ymwd.nonmembers/ostream.pass.cpp b/libcxx/test/std/time/time.cal/time.cal.ymwd/time.cal.ymwd.nonmembers/ostream.pass.cpp --- a/libcxx/test/std/time/time.cal/time.cal.ymwd/time.cal.ymwd.nonmembers/ostream.pass.cpp +++ b/libcxx/test/std/time/time.cal/time.cal.ymwd/time.cal.ymwd.nonmembers/ostream.pass.cpp @@ -10,9 +10,6 @@ // UNSUPPORTED: no-localization // UNSUPPORTED: libcpp-has-no-incomplete-format -// TODO FMT Investigate Windows issues. -// UNSUPPORTED: msvc, target={{.+}}-windows-gnu - // TODO FMT It seems GCC uses too much memory in the CI and fails. // UNSUPPORTED: gcc-12 @@ -37,9 +34,16 @@ #include "make_string.h" #include "platform_support.h" // locale name macros #include "test_macros.h" +#include "assert_macros.h" +#include "concat_macros.h" #define SV(S) MAKE_STRING_VIEW(CharT, S) +#define TEST_EQUAL(OUT, EXPECTED) \ + TEST_REQUIRE(OUT == EXPECTED, \ + TEST_WRITE_CONCATENATED( \ + "\nExpression ", #OUT, "\nExpected output ", EXPECTED, "\nActual output ", OUT, '\n')); + template static std::basic_string stream_c_locale(std::chrono::year_month_weekday ymwd) { std::basic_stringstream sstr; @@ -67,180 +71,191 @@ template static void test() { - assert(stream_c_locale(std::chrono::year_month_weekday{ - std::chrono::year{-32'768}, - std::chrono::month{1}, - std::chrono::weekday_indexed{std::chrono::weekday(0), 1}}) == SV("-32768 is not a valid year/Jan/Sun[1]")); - assert(stream_c_locale(std::chrono::year_month_weekday{ - std::chrono::year{-32'767}, - std::chrono::month{0}, - std::chrono::weekday_indexed{std::chrono::weekday(0), 1}}) == SV("-32767/0 is not a valid month/Sun[1]")); - assert( + TEST_EQUAL( + stream_c_locale(std::chrono::year_month_weekday{ + std::chrono::year{-32'768}, std::chrono::month{1}, std::chrono::weekday_indexed{std::chrono::weekday(0), 1}}), + SV("-32768 is not a valid year/Jan/Sun[1]")); + TEST_EQUAL( stream_c_locale(std::chrono::year_month_weekday{ - std::chrono::year{-32'767}, - std::chrono::month{1}, - std::chrono::weekday_indexed{std::chrono::weekday(8), 1}}) == SV("-32767/Jan/8 is not a valid weekday[1]")); - assert(stream_c_locale(std::chrono::year_month_weekday{ - std::chrono::year{-32'767}, - std::chrono::month{1}, - std::chrono::weekday_indexed{std::chrono::weekday(0), 0}}) == - SV("-32767/Jan/Sun[0 is not a valid index]")); // note 0 is a valid index here... - assert(stream_c_locale(std::chrono::year_month_weekday{ - std::chrono::year{-32'767}, - std::chrono::month{1}, - std::chrono::weekday_indexed{std::chrono::weekday(0), 1}}) == SV("-32767/Jan/Sun[1]")); - - assert( + std::chrono::year{-32'767}, std::chrono::month{0}, std::chrono::weekday_indexed{std::chrono::weekday(0), 1}}), + SV("-32767/0 is not a valid month/Sun[1]")); + TEST_EQUAL( stream_c_locale(std::chrono::year_month_weekday{ - std::chrono::year{1970}, std::chrono::month{1}, std::chrono::weekday_indexed{std::chrono::weekday(0), 1}}) == + std::chrono::year{-32'767}, std::chrono::month{1}, std::chrono::weekday_indexed{std::chrono::weekday(8), 1}}), + SV("-32767/Jan/8 is not a valid weekday[1]")); + TEST_EQUAL( + stream_c_locale(std::chrono::year_month_weekday{ + std::chrono::year{-32'767}, std::chrono::month{1}, std::chrono::weekday_indexed{std::chrono::weekday(0), 0}}), + SV("-32767/Jan/Sun[0 is not a valid index]")); // note 0 is a valid index here... + TEST_EQUAL( + stream_c_locale(std::chrono::year_month_weekday{ + std::chrono::year{-32'767}, std::chrono::month{1}, std::chrono::weekday_indexed{std::chrono::weekday(0), 1}}), + SV("-32767/Jan/Sun[1]")); + + TEST_EQUAL( + stream_c_locale(std::chrono::year_month_weekday{ + std::chrono::year{1970}, std::chrono::month{1}, std::chrono::weekday_indexed{std::chrono::weekday(0), 1}}), SV("1970/Jan/Sun[1]")); #if defined(__APPLE__) - assert(stream_fr_FR_locale(std::chrono::year_month_weekday{ - std::chrono::year{-32'768}, - std::chrono::month{1}, - std::chrono::weekday_indexed{std::chrono::weekday(0), 1}}) == SV("-32768 is not a valid year/jan/Dim[1]")); - assert(stream_fr_FR_locale(std::chrono::year_month_weekday{ - std::chrono::year{-32'767}, - std::chrono::month{0}, - std::chrono::weekday_indexed{std::chrono::weekday(0), 1}}) == SV("-32767/0 is not a valid month/Dim[1]")); - assert( + TEST_EQUAL( + stream_fr_FR_locale(std::chrono::year_month_weekday{ + std::chrono::year{-32'768}, std::chrono::month{1}, std::chrono::weekday_indexed{std::chrono::weekday(0), 1}}), + SV("-32768 is not a valid year/jan/Dim[1]")); + TEST_EQUAL( + stream_fr_FR_locale(std::chrono::year_month_weekday{ + std::chrono::year{-32'767}, std::chrono::month{0}, std::chrono::weekday_indexed{std::chrono::weekday(0), 1}}), + SV("-32767/0 is not a valid month/Dim[1]")); + TEST_EQUAL( + stream_fr_FR_locale(std::chrono::year_month_weekday{ + std::chrono::year{-32'767}, std::chrono::month{1}, std::chrono::weekday_indexed{std::chrono::weekday(8), 1}}), + SV("-32767/jan/8 is not a valid weekday[1]")); + TEST_EQUAL( + stream_fr_FR_locale(std::chrono::year_month_weekday{ + std::chrono::year{-32'767}, std::chrono::month{1}, std::chrono::weekday_indexed{std::chrono::weekday(0), 0}}), + SV("-32767/jan/Dim[0 is not a valid index]")); // note 0 is a valid index here... + TEST_EQUAL( stream_fr_FR_locale(std::chrono::year_month_weekday{ - std::chrono::year{-32'767}, - std::chrono::month{1}, - std::chrono::weekday_indexed{std::chrono::weekday(8), 1}}) == SV("-32767/jan/8 is not a valid weekday[1]")); - assert(stream_fr_FR_locale(std::chrono::year_month_weekday{ - std::chrono::year{-32'767}, - std::chrono::month{1}, - std::chrono::weekday_indexed{std::chrono::weekday(0), 0}}) == - SV("-32767/jan/Dim[0 is not a valid index]")); // note 0 is a valid index here... - assert(stream_fr_FR_locale(std::chrono::year_month_weekday{ - std::chrono::year{-32'767}, - std::chrono::month{1}, - std::chrono::weekday_indexed{std::chrono::weekday(0), 1}}) == SV("-32767/jan/Dim[1]")); - - assert( + std::chrono::year{-32'767}, std::chrono::month{1}, std::chrono::weekday_indexed{std::chrono::weekday(0), 1}}), + SV("-32767/jan/Dim[1]")); + + TEST_EQUAL( stream_fr_FR_locale(std::chrono::year_month_weekday{ - std::chrono::year{1970}, std::chrono::month{1}, std::chrono::weekday_indexed{std::chrono::weekday(0), 1}}) == + std::chrono::year{1970}, std::chrono::month{1}, std::chrono::weekday_indexed{std::chrono::weekday(0), 1}}), SV("1970/jan/Dim[1]")); #else // defined(__APPLE__) - assert( + TEST_EQUAL( + stream_fr_FR_locale(std::chrono::year_month_weekday{ + std::chrono::year{-32'768}, std::chrono::month{1}, std::chrono::weekday_indexed{std::chrono::weekday(0), 1}}), + SV("-32768 is not a valid year/janv./dim.[1]")); + TEST_EQUAL( + stream_fr_FR_locale(std::chrono::year_month_weekday{ + std::chrono::year{-32'767}, std::chrono::month{0}, std::chrono::weekday_indexed{std::chrono::weekday(0), 1}}), + SV("-32767/0 is not a valid month/dim.[1]")); + TEST_EQUAL( stream_fr_FR_locale(std::chrono::year_month_weekday{ - std::chrono::year{-32'768}, - std::chrono::month{1}, - std::chrono::weekday_indexed{std::chrono::weekday(0), 1}}) == SV("-32768 is not a valid year/janv./dim.[1]")); - assert(stream_fr_FR_locale(std::chrono::year_month_weekday{ - std::chrono::year{-32'767}, - std::chrono::month{0}, - std::chrono::weekday_indexed{std::chrono::weekday(0), 1}}) == SV("-32767/0 is not a valid month/dim.[1]")); - assert( + std::chrono::year{-32'767}, std::chrono::month{1}, std::chrono::weekday_indexed{std::chrono::weekday(8), 1}}), + SV("-32767/janv./8 is not a valid weekday[1]")); + TEST_EQUAL( stream_fr_FR_locale(std::chrono::year_month_weekday{ - std::chrono::year{-32'767}, - std::chrono::month{1}, - std::chrono::weekday_indexed{std::chrono::weekday(8), 1}}) == SV("-32767/janv./8 is not a valid weekday[1]")); - assert(stream_fr_FR_locale(std::chrono::year_month_weekday{ - std::chrono::year{-32'767}, - std::chrono::month{1}, - std::chrono::weekday_indexed{std::chrono::weekday(0), 0}}) == - SV("-32767/janv./dim.[0 is not a valid index]")); // note 0 is a valid index here... - assert(stream_fr_FR_locale(std::chrono::year_month_weekday{ - std::chrono::year{-32'767}, - std::chrono::month{1}, - std::chrono::weekday_indexed{std::chrono::weekday(0), 1}}) == SV("-32767/janv./dim.[1]")); - - assert( + std::chrono::year{-32'767}, std::chrono::month{1}, std::chrono::weekday_indexed{std::chrono::weekday(0), 0}}), + SV("-32767/janv./dim.[0 is not a valid index]")); // note 0 is a valid index here... + TEST_EQUAL( stream_fr_FR_locale(std::chrono::year_month_weekday{ - std::chrono::year{1970}, std::chrono::month{1}, std::chrono::weekday_indexed{std::chrono::weekday(0), 1}}) == + std::chrono::year{-32'767}, std::chrono::month{1}, std::chrono::weekday_indexed{std::chrono::weekday(0), 1}}), + SV("-32767/janv./dim.[1]")); + + TEST_EQUAL( + stream_fr_FR_locale(std::chrono::year_month_weekday{ + std::chrono::year{1970}, std::chrono::month{1}, std::chrono::weekday_indexed{std::chrono::weekday(0), 1}}), SV("1970/janv./dim.[1]")); #endif // defined(__APPLE__) #if defined(__APPLE__) - assert(stream_ja_JP_locale(std::chrono::year_month_weekday{ - std::chrono::year{-32'768}, - std::chrono::month{1}, - std::chrono::weekday_indexed{std::chrono::weekday(0), 1}}) == SV("-32768 is not a valid year/ 1/日[1]")); - assert(stream_ja_JP_locale(std::chrono::year_month_weekday{ - std::chrono::year{-32'767}, - std::chrono::month{0}, - std::chrono::weekday_indexed{std::chrono::weekday(0), 1}}) == SV("-32767/0 is not a valid month/日[1]")); - assert(stream_ja_JP_locale(std::chrono::year_month_weekday{ - std::chrono::year{-32'767}, - std::chrono::month{1}, - std::chrono::weekday_indexed{std::chrono::weekday(8), 1}}) == SV("-32767/ 1/8 is not a valid weekday[1]")); - assert(stream_ja_JP_locale(std::chrono::year_month_weekday{ - std::chrono::year{-32'767}, - std::chrono::month{1}, - std::chrono::weekday_indexed{std::chrono::weekday(0), 0}}) == - SV("-32767/ 1/日[0 is not a valid index]")); // note 0 is a valid index here... - assert(stream_ja_JP_locale(std::chrono::year_month_weekday{ - std::chrono::year{-32'767}, - std::chrono::month{1}, - std::chrono::weekday_indexed{std::chrono::weekday(0), 1}}) == SV("-32767/ 1/日[1]")); - - assert( - stream_ja_JP_locale(std::chrono::year_month_weekday{ - std::chrono::year{1970}, std::chrono::month{1}, std::chrono::weekday_indexed{std::chrono::weekday(0), 1}}) == + TEST_EQUAL( + stream_ja_JP_locale(std::chrono::year_month_weekday{ + std::chrono::year{-32'768}, std::chrono::month{1}, std::chrono::weekday_indexed{std::chrono::weekday(0), 1}}), + SV("-32768 is not a valid year/ 1/日[1]")); + TEST_EQUAL( + stream_ja_JP_locale(std::chrono::year_month_weekday{ + std::chrono::year{-32'767}, std::chrono::month{0}, std::chrono::weekday_indexed{std::chrono::weekday(0), 1}}), + SV("-32767/0 is not a valid month/日[1]")); + TEST_EQUAL( + stream_ja_JP_locale(std::chrono::year_month_weekday{ + std::chrono::year{-32'767}, std::chrono::month{1}, std::chrono::weekday_indexed{std::chrono::weekday(8), 1}}), + SV("-32767/ 1/8 is not a valid weekday[1]")); + TEST_EQUAL( + stream_ja_JP_locale(std::chrono::year_month_weekday{ + std::chrono::year{-32'767}, std::chrono::month{1}, std::chrono::weekday_indexed{std::chrono::weekday(0), 0}}), + SV("-32767/ 1/日[0 is not a valid index]")); // note 0 is a valid index here... + TEST_EQUAL( + stream_ja_JP_locale(std::chrono::year_month_weekday{ + std::chrono::year{-32'767}, std::chrono::month{1}, std::chrono::weekday_indexed{std::chrono::weekday(0), 1}}), + SV("-32767/ 1/日[1]")); + TEST_EQUAL( + stream_ja_JP_locale(std::chrono::year_month_weekday{ + std::chrono::year{1970}, std::chrono::month{1}, std::chrono::weekday_indexed{std::chrono::weekday(0), 1}}), SV("1970/ 1/日[1]")); -#else // defined(__APPLE__) -# if defined(_WIN32) || defined(_AIX) - assert(stream_ja_JP_locale(std::chrono::year_month_weekday{ - std::chrono::year{-32'768}, - std::chrono::month{1}, - std::chrono::weekday_indexed{std::chrono::weekday(0), 1}}) == SV("-32768 is not a valid year/1月/日[1]")); - assert(stream_ja_JP_locale(std::chrono::year_month_weekday{ - std::chrono::year{-32'767}, - std::chrono::month{0}, - std::chrono::weekday_indexed{std::chrono::weekday(0), 1}}) == SV("-32767/0 is not a valid month/日[1]")); - assert( - stream_ja_JP_locale(std::chrono::year_month_weekday{ - std::chrono::year{-32'767}, - std::chrono::month{1}, - std::chrono::weekday_indexed{std::chrono::weekday(8), 1}}) == SV("-32767/1月/8 is not a valid weekday[1]")); - - assert(stream_ja_JP_locale(std::chrono::year_month_weekday{ - std::chrono::year{-32'767}, - std::chrono::month{1}, - std::chrono::weekday_indexed{std::chrono::weekday(0), 0}}) == - SV("-32767/1月/日[0 is not a valid index]")); // note 0 is a valid index here... - assert(stream_ja_JP_locale(std::chrono::year_month_weekday{ - std::chrono::year{-32'767}, - std::chrono::month{1}, - std::chrono::weekday_indexed{std::chrono::weekday(0), 1}}) == SV("-32767/1月/日[1]")); - - assert( - stream_ja_JP_locale(std::chrono::year_month_weekday{ - std::chrono::year{1970}, std::chrono::month{1}, std::chrono::weekday_indexed{std::chrono::weekday(0), 1}}) == +#elif defined(_WIN32) // defined(__APPLE__) + TEST_EQUAL( + stream_ja_JP_locale(std::chrono::year_month_weekday{ + std::chrono::year{-32'768}, std::chrono::month{1}, std::chrono::weekday_indexed{std::chrono::weekday(0), 1}}), + SV("-32768 is not a valid year/1/日[1]")); + TEST_EQUAL( + stream_ja_JP_locale(std::chrono::year_month_weekday{ + std::chrono::year{-32'767}, std::chrono::month{0}, std::chrono::weekday_indexed{std::chrono::weekday(0), 1}}), + SV("-32767/0 is not a valid month/日[1]")); + TEST_EQUAL( + stream_ja_JP_locale(std::chrono::year_month_weekday{ + std::chrono::year{-32'767}, std::chrono::month{1}, std::chrono::weekday_indexed{std::chrono::weekday(8), 1}}), + SV("-32767/1/8 is not a valid weekday[1]")); + TEST_EQUAL( + stream_ja_JP_locale(std::chrono::year_month_weekday{ + std::chrono::year{-32'767}, std::chrono::month{1}, std::chrono::weekday_indexed{std::chrono::weekday(0), 0}}), + SV("-32767/1/日[0 is not a valid index]")); // note 0 is a valid index here... + TEST_EQUAL( + stream_ja_JP_locale(std::chrono::year_month_weekday{ + std::chrono::year{-32'767}, std::chrono::month{1}, std::chrono::weekday_indexed{std::chrono::weekday(0), 1}}), + SV("-32767/1/日[1]")); + + TEST_EQUAL( + stream_ja_JP_locale(std::chrono::year_month_weekday{ + std::chrono::year{1970}, std::chrono::month{1}, std::chrono::weekday_indexed{std::chrono::weekday(0), 1}}), + SV("1970/1/日[1]")); +#elif defined(_AIX) // defined(__APPLE__) + TEST_EQUAL( + stream_ja_JP_locale(std::chrono::year_month_weekday{ + std::chrono::year{-32'768}, std::chrono::month{1}, std::chrono::weekday_indexed{std::chrono::weekday(0), 1}}), + SV("-32768 is not a valid year/1月/日[1]")); + TEST_EQUAL( + stream_ja_JP_locale(std::chrono::year_month_weekday{ + std::chrono::year{-32'767}, std::chrono::month{0}, std::chrono::weekday_indexed{std::chrono::weekday(0), 1}}), + SV("-32767/0 is not a valid month/日[1]")); + TEST_EQUAL( + stream_ja_JP_locale(std::chrono::year_month_weekday{ + std::chrono::year{-32'767}, std::chrono::month{1}, std::chrono::weekday_indexed{std::chrono::weekday(8), 1}}), + SV("-32767/1月/8 is not a valid weekday[1]")); + + TEST_EQUAL( + stream_ja_JP_locale(std::chrono::year_month_weekday{ + std::chrono::year{-32'767}, std::chrono::month{1}, std::chrono::weekday_indexed{std::chrono::weekday(0), 0}}), + SV("-32767/1月/日[0 is not a valid index]")); // note 0 is a valid index here... + TEST_EQUAL( + stream_ja_JP_locale(std::chrono::year_month_weekday{ + std::chrono::year{-32'767}, std::chrono::month{1}, std::chrono::weekday_indexed{std::chrono::weekday(0), 1}}), + SV("-32767/1月/日[1]")); + + TEST_EQUAL( + stream_ja_JP_locale(std::chrono::year_month_weekday{ + std::chrono::year{1970}, std::chrono::month{1}, std::chrono::weekday_indexed{std::chrono::weekday(0), 1}}), SV("1970/1月/日[1]")); -# else // defined(_WIN32) || defined(_AIX) - assert(stream_ja_JP_locale(std::chrono::year_month_weekday{ - std::chrono::year{-32'768}, - std::chrono::month{1}, - std::chrono::weekday_indexed{std::chrono::weekday(0), 1}}) == SV("-32768 is not a valid year/ 1月/日[1]")); - assert(stream_ja_JP_locale(std::chrono::year_month_weekday{ - std::chrono::year{-32'767}, - std::chrono::month{0}, - std::chrono::weekday_indexed{std::chrono::weekday(0), 1}}) == SV("-32767/0 is not a valid month/日[1]")); - assert( - stream_ja_JP_locale(std::chrono::year_month_weekday{ - std::chrono::year{-32'767}, - std::chrono::month{1}, - std::chrono::weekday_indexed{std::chrono::weekday(8), 1}}) == SV("-32767/ 1月/8 is not a valid weekday[1]")); - assert(stream_ja_JP_locale(std::chrono::year_month_weekday{ - std::chrono::year{-32'767}, - std::chrono::month{1}, - std::chrono::weekday_indexed{std::chrono::weekday(0), 0}}) == - SV("-32767/ 1月/日[0 is not a valid index]")); // note 0 is a valid index here... - assert(stream_ja_JP_locale(std::chrono::year_month_weekday{ - std::chrono::year{-32'767}, - std::chrono::month{1}, - std::chrono::weekday_indexed{std::chrono::weekday(0), 1}}) == SV("-32767/ 1月/日[1]")); - - assert( - stream_ja_JP_locale(std::chrono::year_month_weekday{ - std::chrono::year{1970}, std::chrono::month{1}, std::chrono::weekday_indexed{std::chrono::weekday(0), 1}}) == +#else // defined(__APPLE__) + TEST_EQUAL( + stream_ja_JP_locale(std::chrono::year_month_weekday{ + std::chrono::year{-32'768}, std::chrono::month{1}, std::chrono::weekday_indexed{std::chrono::weekday(0), 1}}), + SV("-32768 is not a valid year/ 1月/日[1]")); + TEST_EQUAL( + stream_ja_JP_locale(std::chrono::year_month_weekday{ + std::chrono::year{-32'767}, std::chrono::month{0}, std::chrono::weekday_indexed{std::chrono::weekday(0), 1}}), + SV("-32767/0 is not a valid month/日[1]")); + TEST_EQUAL( + stream_ja_JP_locale(std::chrono::year_month_weekday{ + std::chrono::year{-32'767}, std::chrono::month{1}, std::chrono::weekday_indexed{std::chrono::weekday(8), 1}}), + SV("-32767/ 1月/8 is not a valid weekday[1]")); + TEST_EQUAL( + stream_ja_JP_locale(std::chrono::year_month_weekday{ + std::chrono::year{-32'767}, std::chrono::month{1}, std::chrono::weekday_indexed{std::chrono::weekday(0), 0}}), + SV("-32767/ 1月/日[0 is not a valid index]")); // note 0 is a valid index here... + TEST_EQUAL( + stream_ja_JP_locale(std::chrono::year_month_weekday{ + std::chrono::year{-32'767}, std::chrono::month{1}, std::chrono::weekday_indexed{std::chrono::weekday(0), 1}}), + SV("-32767/ 1月/日[1]")); + + TEST_EQUAL( + stream_ja_JP_locale(std::chrono::year_month_weekday{ + std::chrono::year{1970}, std::chrono::month{1}, std::chrono::weekday_indexed{std::chrono::weekday(0), 1}}), SV("1970/ 1月/日[1]")); -# endif // defined(_WIN32) || defined(_AIX) -#endif // defined(__APPLE__) +#endif // defined(__APPLE__) } int main(int, char**) { diff --git a/libcxx/test/std/time/time.cal/time.cal.ymwdlast/time.cal.ymwdlast.nonmembers/ostream.pass.cpp b/libcxx/test/std/time/time.cal/time.cal.ymwdlast/time.cal.ymwdlast.nonmembers/ostream.pass.cpp --- a/libcxx/test/std/time/time.cal/time.cal.ymwdlast/time.cal.ymwdlast.nonmembers/ostream.pass.cpp +++ b/libcxx/test/std/time/time.cal/time.cal.ymwdlast/time.cal.ymwdlast.nonmembers/ostream.pass.cpp @@ -10,9 +10,6 @@ // UNSUPPORTED: no-localization // UNSUPPORTED: libcpp-has-no-incomplete-format -// TODO FMT Investigate Windows issues. -// UNSUPPORTED: msvc, target={{.+}}-windows-gnu - // TODO FMT It seems GCC uses too much memory in the CI and fails. // UNSUPPORTED: gcc-12 @@ -37,9 +34,16 @@ #include "make_string.h" #include "platform_support.h" // locale name macros #include "test_macros.h" +#include "assert_macros.h" +#include "concat_macros.h" #define SV(S) MAKE_STRING_VIEW(CharT, S) +#define TEST_EQUAL(OUT, EXPECTED) \ + TEST_REQUIRE(OUT == EXPECTED, \ + TEST_WRITE_CONCATENATED( \ + "\nExpression ", #OUT, "\nExpected output ", EXPECTED, "\nActual output ", OUT, '\n')); + template static std::basic_string stream_c_locale(std::chrono::year_month_weekday_last ymwdl) { std::basic_stringstream sstr; @@ -67,114 +71,157 @@ template static void test() { - assert(stream_c_locale(std::chrono::year_month_weekday_last{ - std::chrono::year{-32'768}, std::chrono::month{1}, std::chrono::weekday_last{std::chrono::weekday{0}}}) == - SV("-32768 is not a valid year/Jan/Sun[last]")); - assert(stream_c_locale(std::chrono::year_month_weekday_last{ - std::chrono::year{-32'767}, std::chrono::month{0}, std::chrono::weekday_last{std::chrono::weekday{0}}}) == - SV("-32767/0 is not a valid month/Sun[last]")); - assert(stream_c_locale(std::chrono::year_month_weekday_last{ - std::chrono::year{-32'767}, std::chrono::month{1}, std::chrono::weekday_last{std::chrono::weekday{8}}}) == - SV("-32767/Jan/8 is not a valid weekday[last]")); - assert(stream_c_locale(std::chrono::year_month_weekday_last{ - std::chrono::year{-32'767}, std::chrono::month{1}, std::chrono::weekday_last{std::chrono::weekday{0}}}) == - SV("-32767/Jan/Sun[last]")); - - assert(stream_c_locale(std::chrono::year_month_weekday_last{ - std::chrono::year{1970}, std::chrono::month{1}, std::chrono::weekday_last{std::chrono::weekday{0}}}) == - SV("1970/Jan/Sun[last]")); + TEST_EQUAL( + stream_c_locale(std::chrono::year_month_weekday_last{ + std::chrono::year{-32'768}, std::chrono::month{1}, std::chrono::weekday_last{std::chrono::weekday{0}}}), + SV("-32768 is not a valid year/Jan/Sun[last]")); + TEST_EQUAL( + stream_c_locale(std::chrono::year_month_weekday_last{ + std::chrono::year{-32'767}, std::chrono::month{0}, std::chrono::weekday_last{std::chrono::weekday{0}}}), + SV("-32767/0 is not a valid month/Sun[last]")); + TEST_EQUAL( + stream_c_locale(std::chrono::year_month_weekday_last{ + std::chrono::year{-32'767}, std::chrono::month{1}, std::chrono::weekday_last{std::chrono::weekday{8}}}), + SV("-32767/Jan/8 is not a valid weekday[last]")); + TEST_EQUAL( + stream_c_locale(std::chrono::year_month_weekday_last{ + std::chrono::year{-32'767}, std::chrono::month{1}, std::chrono::weekday_last{std::chrono::weekday{0}}}), + SV("-32767/Jan/Sun[last]")); + + TEST_EQUAL(stream_c_locale(std::chrono::year_month_weekday_last{ + std::chrono::year{1970}, std::chrono::month{1}, std::chrono::weekday_last{std::chrono::weekday{0}}}), + SV("1970/Jan/Sun[last]")); #if defined(__APPLE__) - assert(stream_fr_FR_locale(std::chrono::year_month_weekday_last{ - std::chrono::year{-32'768}, std::chrono::month{1}, std::chrono::weekday_last{std::chrono::weekday{0}}}) == - SV("-32768 is not a valid year/jan/Dim[last]")); - assert(stream_fr_FR_locale(std::chrono::year_month_weekday_last{ - std::chrono::year{-32'767}, std::chrono::month{0}, std::chrono::weekday_last{std::chrono::weekday{0}}}) == - SV("-32767/0 is not a valid month/Dim[last]")); - assert(stream_fr_FR_locale(std::chrono::year_month_weekday_last{ - std::chrono::year{-32'767}, std::chrono::month{1}, std::chrono::weekday_last{std::chrono::weekday{8}}}) == - SV("-32767/jan/8 is not a valid weekday[last]")); - assert(stream_fr_FR_locale(std::chrono::year_month_weekday_last{ - std::chrono::year{-32'767}, std::chrono::month{1}, std::chrono::weekday_last{std::chrono::weekday{0}}}) == - SV("-32767/jan/Dim[last]")); - - assert(stream_fr_FR_locale(std::chrono::year_month_weekday_last{ - std::chrono::year{1970}, std::chrono::month{1}, std::chrono::weekday_last{std::chrono::weekday{0}}}) == - SV("1970/jan/Dim[last]")); + TEST_EQUAL( + stream_fr_FR_locale(std::chrono::year_month_weekday_last{ + std::chrono::year{-32'768}, std::chrono::month{1}, std::chrono::weekday_last{std::chrono::weekday{0}}}), + SV("-32768 is not a valid year/jan/Dim[last]")); + TEST_EQUAL( + stream_fr_FR_locale(std::chrono::year_month_weekday_last{ + std::chrono::year{-32'767}, std::chrono::month{0}, std::chrono::weekday_last{std::chrono::weekday{0}}}), + SV("-32767/0 is not a valid month/Dim[last]")); + TEST_EQUAL( + stream_fr_FR_locale(std::chrono::year_month_weekday_last{ + std::chrono::year{-32'767}, std::chrono::month{1}, std::chrono::weekday_last{std::chrono::weekday{8}}}), + SV("-32767/jan/8 is not a valid weekday[last]")); + TEST_EQUAL( + stream_fr_FR_locale(std::chrono::year_month_weekday_last{ + std::chrono::year{-32'767}, std::chrono::month{1}, std::chrono::weekday_last{std::chrono::weekday{0}}}), + SV("-32767/jan/Dim[last]")); + + TEST_EQUAL(stream_fr_FR_locale(std::chrono::year_month_weekday_last{ + std::chrono::year{1970}, std::chrono::month{1}, std::chrono::weekday_last{std::chrono::weekday{0}}}), + SV("1970/jan/Dim[last]")); #else // defined(__APPLE__) - assert(stream_fr_FR_locale(std::chrono::year_month_weekday_last{ - std::chrono::year{-32'768}, std::chrono::month{1}, std::chrono::weekday_last{std::chrono::weekday{0}}}) == - SV("-32768 is not a valid year/janv./dim.[last]")); - assert(stream_fr_FR_locale(std::chrono::year_month_weekday_last{ - std::chrono::year{-32'767}, std::chrono::month{0}, std::chrono::weekday_last{std::chrono::weekday{0}}}) == - SV("-32767/0 is not a valid month/dim.[last]")); - assert(stream_fr_FR_locale(std::chrono::year_month_weekday_last{ - std::chrono::year{-32'767}, std::chrono::month{1}, std::chrono::weekday_last{std::chrono::weekday{8}}}) == - SV("-32767/janv./8 is not a valid weekday[last]")); - assert(stream_fr_FR_locale(std::chrono::year_month_weekday_last{ - std::chrono::year{-32'767}, std::chrono::month{1}, std::chrono::weekday_last{std::chrono::weekday{0}}}) == - SV("-32767/janv./dim.[last]")); - - assert(stream_fr_FR_locale(std::chrono::year_month_weekday_last{ - std::chrono::year{1970}, std::chrono::month{1}, std::chrono::weekday_last{std::chrono::weekday{0}}}) == - SV("1970/janv./dim.[last]")); + TEST_EQUAL( + stream_fr_FR_locale(std::chrono::year_month_weekday_last{ + std::chrono::year{-32'768}, std::chrono::month{1}, std::chrono::weekday_last{std::chrono::weekday{0}}}), + SV("-32768 is not a valid year/janv./dim.[last]")); + TEST_EQUAL( + stream_fr_FR_locale(std::chrono::year_month_weekday_last{ + std::chrono::year{-32'767}, std::chrono::month{0}, std::chrono::weekday_last{std::chrono::weekday{0}}}), + SV("-32767/0 is not a valid month/dim.[last]")); + TEST_EQUAL( + stream_fr_FR_locale(std::chrono::year_month_weekday_last{ + std::chrono::year{-32'767}, std::chrono::month{1}, std::chrono::weekday_last{std::chrono::weekday{8}}}), + SV("-32767/janv./8 is not a valid weekday[last]")); + TEST_EQUAL( + stream_fr_FR_locale(std::chrono::year_month_weekday_last{ + std::chrono::year{-32'767}, std::chrono::month{1}, std::chrono::weekday_last{std::chrono::weekday{0}}}), + SV("-32767/janv./dim.[last]")); + + TEST_EQUAL(stream_fr_FR_locale(std::chrono::year_month_weekday_last{ + std::chrono::year{1970}, std::chrono::month{1}, std::chrono::weekday_last{std::chrono::weekday{0}}}), + SV("1970/janv./dim.[last]")); #endif // defined(__APPLE__) #if defined(__APPLE__) - assert(stream_ja_JP_locale(std::chrono::year_month_weekday_last{ - std::chrono::year{-32'768}, std::chrono::month{1}, std::chrono::weekday_last{std::chrono::weekday{0}}}) == - SV("-32768 is not a valid year/ 1/日[last]")); - assert(stream_ja_JP_locale(std::chrono::year_month_weekday_last{ - std::chrono::year{-32'767}, std::chrono::month{0}, std::chrono::weekday_last{std::chrono::weekday{0}}}) == - SV("-32767/0 is not a valid month/日[last]")); - assert(stream_ja_JP_locale(std::chrono::year_month_weekday_last{ - std::chrono::year{-32'767}, std::chrono::month{1}, std::chrono::weekday_last{std::chrono::weekday{8}}}) == - SV("-32767/ 1/8 is not a valid weekday[last]")); - assert(stream_ja_JP_locale(std::chrono::year_month_weekday_last{ - std::chrono::year{-32'767}, std::chrono::month{1}, std::chrono::weekday_last{std::chrono::weekday{0}}}) == - SV("-32767/ 1/日[last]")); - - assert(stream_ja_JP_locale(std::chrono::year_month_weekday_last{ - std::chrono::year{1970}, std::chrono::month{1}, std::chrono::weekday_last{std::chrono::weekday{0}}}) == - SV("1970/ 1/日[last]")); -#else // defined(__APPLE__) -# if defined(_WIN32) || defined(_AIX) - assert(stream_ja_JP_locale(std::chrono::year_month_weekday_last{ - std::chrono::year{-32'768}, std::chrono::month{1}, std::chrono::weekday_last{std::chrono::weekday{0}}}) == - SV("-32768 is not a valid year/1月/日[last]")); - assert(stream_ja_JP_locale(std::chrono::year_month_weekday_last{ - std::chrono::year{-32'767}, std::chrono::month{0}, std::chrono::weekday_last{std::chrono::weekday{0}}}) == - SV("-32767/0 is not a valid month/日[last]")); - assert(stream_ja_JP_locale(std::chrono::year_month_weekday_last{ - std::chrono::year{-32'767}, std::chrono::month{1}, std::chrono::weekday_last{std::chrono::weekday{8}}}) == - SV("-32767/1月/8 is not a valid weekday[last]")); - - assert(stream_ja_JP_locale(std::chrono::year_month_weekday_last{ - std::chrono::year{-32'767}, std::chrono::month{1}, std::chrono::weekday_last{std::chrono::weekday{0}}}) == - SV("-32767/1月/日[last]")); - - assert(stream_ja_JP_locale(std::chrono::year_month_weekday_last{ - std::chrono::year{1970}, std::chrono::month{1}, std::chrono::weekday_last{std::chrono::weekday{0}}}) == - SV("1970/1月/日[last]")); -# else // defined(_WIN32) || defined(_AIX) - assert(stream_ja_JP_locale(std::chrono::year_month_weekday_last{ - std::chrono::year{-32'768}, std::chrono::month{1}, std::chrono::weekday_last{std::chrono::weekday{0}}}) == - SV("-32768 is not a valid year/ 1月/日[last]")); - assert(stream_ja_JP_locale(std::chrono::year_month_weekday_last{ - std::chrono::year{-32'767}, std::chrono::month{0}, std::chrono::weekday_last{std::chrono::weekday{0}}}) == - SV("-32767/0 is not a valid month/日[last]")); - assert(stream_ja_JP_locale(std::chrono::year_month_weekday_last{ - std::chrono::year{-32'767}, std::chrono::month{1}, std::chrono::weekday_last{std::chrono::weekday{8}}}) == - SV("-32767/ 1月/8 is not a valid weekday[last]")); - assert(stream_ja_JP_locale(std::chrono::year_month_weekday_last{ - std::chrono::year{-32'767}, std::chrono::month{1}, std::chrono::weekday_last{std::chrono::weekday{0}}}) == - SV("-32767/ 1月/日[last]")); - - assert(stream_ja_JP_locale(std::chrono::year_month_weekday_last{ - std::chrono::year{1970}, std::chrono::month{1}, std::chrono::weekday_last{std::chrono::weekday{0}}}) == - SV("1970/ 1月/日[last]")); -# endif // defined(_WIN32) || defined(_AIX) -#endif // defined(__APPLE__) + TEST_EQUAL( + stream_ja_JP_locale(std::chrono::year_month_weekday_last{ + std::chrono::year{-32'768}, std::chrono::month{1}, std::chrono::weekday_last{std::chrono::weekday{0}}}), + SV("-32768 is not a valid year/ 1/日[last]")); + TEST_EQUAL( + stream_ja_JP_locale(std::chrono::year_month_weekday_last{ + std::chrono::year{-32'767}, std::chrono::month{0}, std::chrono::weekday_last{std::chrono::weekday{0}}}), + SV("-32767/0 is not a valid month/日[last]")); + TEST_EQUAL( + stream_ja_JP_locale(std::chrono::year_month_weekday_last{ + std::chrono::year{-32'767}, std::chrono::month{1}, std::chrono::weekday_last{std::chrono::weekday{8}}}), + SV("-32767/ 1/8 is not a valid weekday[last]")); + TEST_EQUAL( + stream_ja_JP_locale(std::chrono::year_month_weekday_last{ + std::chrono::year{-32'767}, std::chrono::month{1}, std::chrono::weekday_last{std::chrono::weekday{0}}}), + SV("-32767/ 1/日[last]")); + + TEST_EQUAL(stream_ja_JP_locale(std::chrono::year_month_weekday_last{ + std::chrono::year{1970}, std::chrono::month{1}, std::chrono::weekday_last{std::chrono::weekday{0}}}), + SV("1970/ 1/日[last]")); +#elif defined(_WIN32) // defined(__APPLE__) + TEST_EQUAL( + stream_ja_JP_locale(std::chrono::year_month_weekday_last{ + std::chrono::year{-32'768}, std::chrono::month{1}, std::chrono::weekday_last{std::chrono::weekday{0}}}), + SV("-32768 is not a valid year/1/日[last]")); + TEST_EQUAL( + stream_ja_JP_locale(std::chrono::year_month_weekday_last{ + std::chrono::year{-32'767}, std::chrono::month{0}, std::chrono::weekday_last{std::chrono::weekday{0}}}), + SV("-32767/0 is not a valid month/日[last]")); + TEST_EQUAL( + stream_ja_JP_locale(std::chrono::year_month_weekday_last{ + std::chrono::year{-32'767}, std::chrono::month{1}, std::chrono::weekday_last{std::chrono::weekday{8}}}), + SV("-32767/1/8 is not a valid weekday[last]")); + TEST_EQUAL( + stream_ja_JP_locale(std::chrono::year_month_weekday_last{ + std::chrono::year{-32'767}, std::chrono::month{1}, std::chrono::weekday_last{std::chrono::weekday{0}}}), + SV("-32767/1/日[last]")); + + TEST_EQUAL(stream_ja_JP_locale(std::chrono::year_month_weekday_last{ + std::chrono::year{1970}, std::chrono::month{1}, std::chrono::weekday_last{std::chrono::weekday{0}}}), + SV("1970/1/日[last]")); +#elif defined(_AIX) // defined(__APPLE__) + TEST_EQUAL( + stream_ja_JP_locale(std::chrono::year_month_weekday_last{ + std::chrono::year{-32'768}, std::chrono::month{1}, std::chrono::weekday_last{std::chrono::weekday{0}}}), + SV("-32768 is not a valid year/1月/日[last]")); + TEST_EQUAL( + stream_ja_JP_locale(std::chrono::year_month_weekday_last{ + std::chrono::year{-32'767}, std::chrono::month{0}, std::chrono::weekday_last{std::chrono::weekday{0}}}), + SV("-32767/0 is not a valid month/日[last]")); + TEST_EQUAL( + stream_ja_JP_locale(std::chrono::year_month_weekday_last{ + std::chrono::year{-32'767}, std::chrono::month{1}, std::chrono::weekday_last{std::chrono::weekday{8}}}), + SV("-32767/1月/8 is not a valid weekday[last]")); + + TEST_EQUAL( + stream_ja_JP_locale(std::chrono::year_month_weekday_last{ + std::chrono::year{-32'767}, std::chrono::month{1}, std::chrono::weekday_last{std::chrono::weekday{0}}}), + SV("-32767/1月/日[last]")); + + TEST_EQUAL(stream_ja_JP_locale(std::chrono::year_month_weekday_last{ + std::chrono::year{1970}, std::chrono::month{1}, std::chrono::weekday_last{std::chrono::weekday{0}}}), + SV("1970/1月/日[last]")); +#else // defined(__APPLE__) + TEST_EQUAL( + stream_ja_JP_locale(std::chrono::year_month_weekday_last{ + std::chrono::year{-32'768}, std::chrono::month{1}, std::chrono::weekday_last{std::chrono::weekday{0}}}), + SV("-32768 is not a valid year/ 1月/日[last]")); + TEST_EQUAL( + stream_ja_JP_locale(std::chrono::year_month_weekday_last{ + std::chrono::year{-32'767}, std::chrono::month{0}, std::chrono::weekday_last{std::chrono::weekday{0}}}), + SV("-32767/0 is not a valid month/日[last]")); + TEST_EQUAL( + stream_ja_JP_locale(std::chrono::year_month_weekday_last{ + std::chrono::year{-32'767}, std::chrono::month{1}, std::chrono::weekday_last{std::chrono::weekday{8}}}), + SV("-32767/ 1月/8 is not a valid weekday[last]")); + TEST_EQUAL( + stream_ja_JP_locale(std::chrono::year_month_weekday_last{ + std::chrono::year{-32'767}, std::chrono::month{1}, std::chrono::weekday_last{std::chrono::weekday{0}}}), + SV("-32767/ 1月/日[last]")); + + TEST_EQUAL(stream_ja_JP_locale(std::chrono::year_month_weekday_last{ + std::chrono::year{1970}, std::chrono::month{1}, std::chrono::weekday_last{std::chrono::weekday{0}}}), + SV("1970/ 1月/日[last]")); +#endif // defined(__APPLE__) } int main(int, char**) { diff --git a/libcxx/test/std/time/time.clock/time.clock.file/ostream.pass.cpp b/libcxx/test/std/time/time.clock/time.clock.file/ostream.pass.cpp --- a/libcxx/test/std/time/time.clock/time.clock.file/ostream.pass.cpp +++ b/libcxx/test/std/time/time.clock/time.clock.file/ostream.pass.cpp @@ -10,8 +10,6 @@ // UNSUPPORTED: no-localization // UNSUPPORTED: libcpp-has-no-incomplete-format -// TODO FMT Investigate Windows issues. -// UNSUPPORTED msvc, target={{.+}}-windows-gnu // TODO FMT It seems GCC uses too much memory in the CI and fails. // UNSUPPORTED: gcc-12 diff --git a/libcxx/test/std/time/time.clock/time.clock.local/ostream.pass.cpp b/libcxx/test/std/time/time.clock/time.clock.local/ostream.pass.cpp --- a/libcxx/test/std/time/time.clock/time.clock.local/ostream.pass.cpp +++ b/libcxx/test/std/time/time.clock/time.clock.local/ostream.pass.cpp @@ -10,8 +10,6 @@ // UNSUPPORTED: no-localization // UNSUPPORTED: libcpp-has-no-incomplete-format -// TODO FMT Investigate Windows issues. -// UNSUPPORTED msvc, target={{.+}}-windows-gnu // TODO FMT It seems GCC uses too much memory in the CI and fails. // UNSUPPORTED: gcc-12 diff --git a/libcxx/test/std/time/time.clock/time.clock.system/ostream.pass.cpp b/libcxx/test/std/time/time.clock/time.clock.system/ostream.pass.cpp --- a/libcxx/test/std/time/time.clock/time.clock.system/ostream.pass.cpp +++ b/libcxx/test/std/time/time.clock/time.clock.system/ostream.pass.cpp @@ -10,8 +10,6 @@ // UNSUPPORTED: no-localization // UNSUPPORTED: libcpp-has-no-incomplete-format -// TODO FMT Investigate Windows issues. -// UNSUPPORTED msvc, target={{.+}}-windows-gnu // TODO FMT It seems GCC uses too much memory in the CI and fails. // UNSUPPORTED: gcc-12 diff --git a/libcxx/test/std/time/time.duration/time.duration.nonmember/ostream.pass.cpp b/libcxx/test/std/time/time.duration/time.duration.nonmember/ostream.pass.cpp --- a/libcxx/test/std/time/time.duration/time.duration.nonmember/ostream.pass.cpp +++ b/libcxx/test/std/time/time.duration/time.duration.nonmember/ostream.pass.cpp @@ -10,8 +10,6 @@ // UNSUPPORTED: no-localization // UNSUPPORTED: libcpp-has-no-incomplete-format -// TODO FMT Investigate Windows issues. -// UNSUPPORTED: msvc, target={{.+}}-windows-gnu // TODO FMT Evaluate gcc-12 status // UNSUPPORTED: gcc-12 diff --git a/libcxx/test/std/time/time.syn/formatter.hh_mm_ss.pass.cpp b/libcxx/test/std/time/time.syn/formatter.hh_mm_ss.pass.cpp --- a/libcxx/test/std/time/time.syn/formatter.hh_mm_ss.pass.cpp +++ b/libcxx/test/std/time/time.syn/formatter.hh_mm_ss.pass.cpp @@ -12,9 +12,6 @@ // TODO FMT Evaluate gcc-12 status // UNSUPPORTED: gcc-12 -// TODO FMT Investigate Windows issues. -// UNSUPPORTED: msvc, target={{.+}}-windows-gnu - // XFAIL: LIBCXX-FREEBSD-FIXME // XFAIL: availability-fp_to_chars-missing @@ -296,7 +293,7 @@ std::chrono::hh_mm_ss(std::chrono::duration(3661.123456))); // Use supplied locale (ja_JP). This locale has a different alternate. -#if defined(__APPLE__) || defined(_AIX) +#if defined(__APPLE__) || defined(_AIX) || defined(_WIN32) check(loc, SV("%H='00'\t" "%OH='00'\t" @@ -317,6 +314,10 @@ "%r='12:00:00 AM'\t" "%X='00時00分00秒'\t" "%EX='00時00分00秒'\t" +# elif defined(_WIN32) + "%r='0:00:00'\t" + "%X='0:00:00'\t" + "%EX='0:00:00'\t" # else "%r='午前12:00:00'\t" "%X='00:00:00'\t" @@ -346,6 +347,10 @@ "%r='11:31:30 PM'\t" "%X='23時31分30秒'\t" "%EX='23時31分30秒'\t" +# elif defined(_WIN32) + "%r='23:31:30'\t" + "%X='23:31:30'\t" + "%EX='23:31:30'\t" # else "%r='午後11:31:30'\t" "%X='23:31:30'\t" @@ -375,6 +380,10 @@ "%r='03:02:01 AM'\t" "%X='03時02分01秒'\t" "%EX='03時02分01秒'\t" +# elif defined(_WIN32) + "%r='3:02:01'\t" + "%X='3:02:01'\t" + "%EX='3:02:01'\t" # else "%r='午前03:02:01'\t" "%X='03:02:01'\t" @@ -404,6 +413,10 @@ "%r='01:01:01 AM'\t" "%X='01時01分01秒'\t" "%EX='01時01分01秒'\t" +# elif defined(_WIN32) + "%r='1:01:01'\t" + "%X='1:01:01'\t" + "%EX='1:01:01'\t" # else "%r='午前01:01:01'\t" "%X='01:01:01'\t" @@ -412,7 +425,7 @@ "\n"), lfmt, std::chrono::hh_mm_ss(std::chrono::duration(3661.123456))); -#else // defined(__APPLE__) || defined(_AIX) +#else // defined(__APPLE__) || defined(_AIX) || defined(_WIN32) check(loc, SV("%H='00'\t" "%OH='〇'\t" @@ -489,7 +502,7 @@ "\n"), lfmt, std::chrono::hh_mm_ss(std::chrono::duration(3661.123456))); -#endif // defined(__APPLE__) || defined(_AIX) +#endif // defined(__APPLE__) || defined(_AIX) || defined(_WIN32) std::locale::global(std::locale::classic()); } diff --git a/libcxx/test/std/time/time.syn/formatter.day.pass.cpp b/libcxx/test/std/time/time.syn/formatter.day.pass.cpp --- a/libcxx/test/std/time/time.syn/formatter.day.pass.cpp +++ b/libcxx/test/std/time/time.syn/formatter.day.pass.cpp @@ -11,15 +11,15 @@ // UNSUPPORTED: no-localization // UNSUPPORTED: libcpp-has-no-incomplete-format -// TODO FMT Investigate Windows issues. -// UNSUPPORTED: msvc, target={{.+}}-windows-gnu - // TODO FMT Fix this test using GCC, it currently crashes. // UNSUPPORTED: gcc-12 // TODO FMT This test should not require std::to_chars(floating-point) // XFAIL: availability-fp_to_chars-missing +// TODO FMT Investigate Windows issues. +// XFAIL: msvc + // REQUIRES: locale.fr_FR.UTF-8 // REQUIRES: locale.ja_JP.UTF-8 @@ -67,41 +67,59 @@ std::locale::global(std::locale(LOCALE_fr_FR_UTF_8)); // Non localized output using C-locale +#if defined(_WIN32) + check(SV("%d=''\t%Od=''\t%e=''\t%Oe=''\n"), fmt, 0d); +#else check(SV("%d='00'\t%Od='00'\t%e=' 0'\t%Oe=' 0'\n"), fmt, 0d); +#endif check(SV("%d='01'\t%Od='01'\t%e=' 1'\t%Oe=' 1'\n"), fmt, 1d); check(SV("%d='31'\t%Od='31'\t%e='31'\t%Oe='31'\n"), fmt, 31d); -#if defined(_AIX) +#if defined(_WIN32) + check(SV("%d=''\t%Od=''\t%e=''\t%Oe=''\n"), fmt, 0d); +#elif defined(_AIX) check(SV("%d='55'\t%Od='55'\t%e='55'\t%Oe='55'\n"), fmt, 255d); #else check(SV("%d='255'\t%Od='255'\t%e='255'\t%Oe='255'\n"), fmt, 255d); #endif // Use the global locale (fr_FR) +#if defined(_WIN32) + check(SV("%d=''\t%Od=''\t%e=''\t%Oe=''\n"), lfmt, 0d); +#else check(SV("%d='00'\t%Od='00'\t%e=' 0'\t%Oe=' 0'\n"), lfmt, 0d); +#endif check(SV("%d='01'\t%Od='01'\t%e=' 1'\t%Oe=' 1'\n"), lfmt, 1d); check(SV("%d='31'\t%Od='31'\t%e='31'\t%Oe='31'\n"), lfmt, 31d); -#if defined(_AIX) +#if defined(_WIN32) + check(SV("%d=''\t%Od=''\t%e=''\t%Oe=''\n"), lfmt, 255d); +#elif defined(_AIX) check(SV("%d='55'\t%Od='55'\t%e='55'\t%Oe='55'\n"), lfmt, 255d); #else check(SV("%d='255'\t%Od='255'\t%e='255'\t%Oe='255'\n"), lfmt, 255d); #endif // Use supplied locale (ja_JP). This locale has a different alternate on some platforms. -#if defined(__APPLE__) || defined(_AIX) +#if defined(__APPLE__) || defined(_AIX) || defined(_WIN32) +# if defined(_WIN32) + check(loc, SV("%d=''\t%Od=''\t%e=''\t%Oe=''\n"), lfmt, 0d); +# else check(loc, SV("%d='00'\t%Od='00'\t%e=' 0'\t%Oe=' 0'\n"), lfmt, 0d); +# endif check(loc, SV("%d='01'\t%Od='01'\t%e=' 1'\t%Oe=' 1'\n"), lfmt, 1d); check(loc, SV("%d='31'\t%Od='31'\t%e='31'\t%Oe='31'\n"), lfmt, 31d); -# if defined(_AIX) +# if defined(_WIN32) + check(SV("%d=''\t%Od=''\t%e=''\t%Oe=''\n"), fmt, 255d); +# elif defined(_AIX) check(SV("%d='55'\t%Od='55'\t%e='55'\t%Oe='55'\n"), fmt, 255d); # else check(SV("%d='255'\t%Od='255'\t%e='255'\t%Oe='255'\n"), fmt, 255d); # endif -#else // defined(__APPLE__) || defined(_AIX) +#else // defined(__APPLE__) || defined(_AIX) || defined(_WIN32) check(loc, SV("%d='00'\t%Od='〇'\t%e=' 0'\t%Oe='〇'\n"), lfmt, 0d); check(loc, SV("%d='01'\t%Od='一'\t%e=' 1'\t%Oe='一'\n"), lfmt, 1d); check(loc, SV("%d='31'\t%Od='三十一'\t%e='31'\t%Oe='三十一'\n"), lfmt, 31d); check(loc, SV("%d='255'\t%Od='255'\t%e='255'\t%Oe='255'\n"), lfmt, 255d); -#endif // defined(__APPLE__) || defined(_AIX) +#endif // defined(__APPLE__) || defined(_AIX) || defined(_WIN32) std::locale::global(std::locale::classic()); } diff --git a/libcxx/test/std/time/time.syn/formatter.duration.pass.cpp b/libcxx/test/std/time/time.syn/formatter.duration.pass.cpp --- a/libcxx/test/std/time/time.syn/formatter.duration.pass.cpp +++ b/libcxx/test/std/time/time.syn/formatter.duration.pass.cpp @@ -11,8 +11,6 @@ // UNSUPPORTED: no-localization // UNSUPPORTED: libcpp-has-no-incomplete-format -// TODO FMT Investigate Windows issues. -// UNSUPPORTED: msvc, target={{.+}}-windows-gnu // TODO FMT Evaluate gcc-12 status // UNSUPPORTED: gcc-12 @@ -249,7 +247,7 @@ "%R='00:00'\t" "%T='00:00:00'\t" #ifdef _WIN32 - "%r='12:00:00'\t" + "%r='00:00:00'\t" #elif defined(_AIX) "%r='12:00:00 AM'\t" #elif defined(__APPLE__) @@ -315,7 +313,7 @@ "%R='12:00'\t" "%T='12:00:00'\t" #ifdef _WIN32 - "%r='00:00:00'\t" + "%r='12:00:00'\t" #elif defined(_AIX) "%r='12:00:00 PM'\t" #elif defined(__APPLE__) @@ -351,6 +349,8 @@ "%r='11:59:59 PM'\t" #elif defined(__APPLE__) "%r=''\t" +#elif defined(_WIN32) + "%r='23:59:59'\t" #else "%r='11:59:59 '\t" #endif @@ -379,11 +379,13 @@ "%R='00:00'\t" "%T='00:00:00'\t" #ifdef _WIN32 - "%r='12:00:00'\t" + "%r='00:00:00'\t" #elif defined(_AIX) "%r='12:00:00 AM'\t" #elif defined(__APPLE__) "%r=''\t" +#elif defined(_WIN32) + "%r='12:00:00'\t" #else "%r='12:00:00 '\t" #endif @@ -397,7 +399,7 @@ std::chrono::duration>(7)); // Use supplied locale (ja_JP). This locale has a different alternate. -#if defined(__APPLE__) || defined(_AIX) +#if defined(__APPLE__) || defined(_AIX) || defined(_WIN32) check(loc, SV("%H='00'\t" "%OH='00'\t" @@ -418,6 +420,10 @@ "%r='12:00:00 AM'\t" "%X='00時00分00秒'\t" "%EX='00時00分00秒'\t" +# elif defined(_WIN32) + "%r='0:00:00'\t" + "%X='0:00:00'\t" + "%EX='0:00:00'\t" # else "%r='午前12:00:00'\t" "%X='00:00:00'\t" @@ -450,6 +456,10 @@ "%r='11:59:59 AM'\t" "%X='11時59分59秒'\t" "%EX='11時59分59秒'\t" +# elif defined(_WIN32) + "%r='11:59:59'\t" + "%X='11:59:59'\t" + "%EX='11:59:59'\t" # else "%r='午前11:59:59'\t" "%X='11:59:59'\t" @@ -483,7 +493,11 @@ "%X='12時00分00秒'\t" "%EX='12時00分00秒'\t" # else +# ifdef _WIN32 + "%r='12:00:00'\t" +# else "%r='午後12:00:00'\t" +# endif "%X='12:00:00'\t" "%EX='12:00:00'\t" # endif @@ -515,7 +529,11 @@ "%X='23時59分59秒'\t" "%EX='23時59分59秒'\t" # else +# ifdef _WIN32 + "%r='23:59:59'\t" +# else "%r='午後11:59:59'\t" +# endif "%X='23:59:59'\t" "%EX='23:59:59'\t" # endif @@ -546,6 +564,10 @@ "%r='12:00:00 AM'\t" "%X='00時00分00秒'\t" "%EX='00時00分00秒'\t" +# elif defined(_WIN32) + "%r='0:00:00'\t" + "%X='0:00:00'\t" + "%EX='0:00:00'\t" # else "%r='午前12:00:00'\t" "%X='00:00:00'\t" @@ -557,7 +579,7 @@ "\n"), lfmt, std::chrono::duration>(7)); -#else // defined(__APPLE__) || defined(_AIX) +#else // defined(__APPLE__) || defined(_AIX) || defined(_WIN32) check(loc, SV("%H='00'\t" "%OH='〇'\t" @@ -667,8 +689,8 @@ "\n"), lfmt, std::chrono::duration>(7)); +#endif // defined(__APPLE__) || defined(_AIX) || defined(_WIN32) -#endif // defined(__APPLE__) || defined(_AIX) std::locale::global(std::locale::classic()); } @@ -769,6 +791,8 @@ "%r='11:59:59 PM'\t" #elif defined(__APPLE__) "%r=''\t" +#elif defined(_WIN32) + "%r='23:59:59'\t" #else "%r='11:59:59 '\t" #endif @@ -782,7 +806,7 @@ -(23h + 59min + 59s)); // Use supplied locale (ja_JP). This locale has a different alternate. -#if defined(__APPLE__) || defined(_AIX) +#if defined(__APPLE__) || defined(_AIX) || defined(_WIN32) check(loc, SV("-%H='23'\t" "%OH='23'\t" @@ -803,6 +827,10 @@ "%r='11:59:59 PM'\t" "%X='23時59分59秒'\t" "%EX='23時59分59秒'\t" +# elif defined(_WIN32) + "%r='23:59:59'\t" + "%X='23:59:59'\t" + "%EX='23:59:59'\t" # else "%r='午後11:59:59'\t" "%X='23:59:59'\t" @@ -814,7 +842,7 @@ "\n"), lfmt, -(23h + 59min + 59s)); -#else // defined(__APPLE__) || defined(_AIX) +#else // defined(__APPLE__) || defined(_AIX) || defined(_WIN32) check(loc, SV("-%H='23'\t" "%OH='二十三'\t" @@ -836,7 +864,7 @@ "\n"), lfmt, -(23h + 59min + 59s)); -#endif // defined(__APPLE__) || defined(_AIX) +#endif // defined(__APPLE__) || defined(_AIX) || defined(_WIN32) std::locale::global(std::locale::classic()); } @@ -989,7 +1017,7 @@ check(loc, SV("00.011"), SV("{:L%S}"), std::chrono::duration(11.123456789)); check(loc, SV("01"), SV("{:L%S}"), std::chrono::duration(61.123456789)); -#if defined(__APPLE__) || defined(_AIX) +#if defined(__APPLE__) || defined(_AIX) || defined(_WIN32) check(SV("00.000000001"), SV("{:%OS}"), 1ns); check(SV("00.000000501"), SV("{:%OS}"), 501ns); check(SV("00.000001000"), SV("{:%OS}"), 1000ns); @@ -1005,7 +1033,7 @@ check(SV("00.001"), SV("{:%OS}"), std::chrono::duration(1.123456789)); check(SV("00.011"), SV("{:%OS}"), std::chrono::duration(11.123456789)); check(SV("01"), SV("{:%OS}"), std::chrono::duration(61.123456789)); -#else // defined(__APPLE__) || defined(_AIX) +#else // defined(__APPLE__) || defined(_AIX) || defined(_WIN32) check(loc, SV("〇.000000001"), SV("{:L%OS}"), 1ns); check(loc, SV("〇.000000501"), SV("{:L%OS}"), 501ns); check(loc, SV("〇.000001000"), SV("{:L%OS}"), 1000ns); @@ -1021,7 +1049,7 @@ check(loc, SV("〇.001"), SV("{:L%OS}"), std::chrono::duration(1.123456789)); check(loc, SV("〇.011"), SV("{:L%OS}"), std::chrono::duration(11.123456789)); check(loc, SV("一"), SV("{:L%OS}"), std::chrono::duration(61.123456789)); -#endif // defined(__APPLE__) || defined(_AIX) +#endif // defined(__APPLE__) || defined(_AIX) || defined(_WIN32) check(loc, SV("01:05:06.000000001"), SV("{:L%T}"), 1h + 5min + 6s + 1ns); check(loc, SV("01:05:06.000000501"), SV("{:L%T}"), 1h + 5min + 6s + 501ns); diff --git a/libcxx/test/std/time/time.syn/formatter.file_time.pass.cpp b/libcxx/test/std/time/time.syn/formatter.file_time.pass.cpp --- a/libcxx/test/std/time/time.syn/formatter.file_time.pass.cpp +++ b/libcxx/test/std/time/time.syn/formatter.file_time.pass.cpp @@ -14,8 +14,6 @@ // TODO FMT This test should not require std::to_chars(floating-point) // XFAIL: availability-fp_to_chars-missing -// TODO FMT Investigate Windows issues. -// UNSUPPORTED: msvc, target={{.+}}-windows-gnu // TODO FMT It seems GCC uses too much memory in the CI and fails. // UNSUPPORTED: gcc-12 @@ -247,7 +245,7 @@ lfmt, file_seconds(1'234'567'890s)); // 23:31:30 UTC on Friday, 13 February 2009 -#endif // _WIN32 +#endif // _WIN32 std::locale::global(std::locale::classic()); } @@ -338,7 +336,7 @@ check(SV("%j='138'\n"), lfmt, file_seconds(2'000'000'000s)); // 03:33:20 UTC on Wednesday, 18 May 2033 // Use supplied locale (ja_JP). This locale has a different alternate. - check(loc, SV("%j='001'\n"), lfmt, file_seconds(0s)); // 00:00:00 UTC Thursday, 1 January 1970 + check(loc, SV("%j='001'\n"), lfmt, file_seconds(0s)); // 00:00:00 UTC Thursday, 1 January 1970 check(loc, SV("%j='138'\n"), lfmt, file_seconds(2'000'000'000s)); // 03:33:20 UTC on Wednesday, 18 May 2033 @@ -643,6 +641,8 @@ "%r='11:31:30 PM'\t" #elif defined(__APPLE__) "%r=''\t" +#elif defined(_WIN32) + "%r='23:31:30 '\t" #else "%r='11:31:30 '\t" #endif @@ -654,7 +654,7 @@ 1'234'567'890'123ms)); // 23:31:30 UTC on Friday, 13 February 2009 // Use supplied locale (ja_JP). This locale has a different alternate.a -#if defined(__APPLE__) || defined(_AIX) +#if defined(__APPLE__) || defined(_AIX) || defined(_WIN32) check(loc, SV("%H='00'\t" "%OH='00'\t" @@ -675,6 +675,10 @@ "%r='12:00:00 AM'\t" "%X='00時00分00秒'\t" "%EX='00時00分00秒'\t" +# elif defined(_WIN32) + "%r='0:00:00'\t" + "%X='0:00:00'\t" + "%EX='0:00:00'\t" # else "%r='午前12:00:00'\t" "%X='00:00:00'\t" @@ -704,6 +708,10 @@ "%r='11:31:30 PM'\t" "%X='23時31分30秒'\t" "%EX='23時31分30秒'\t" +# elif defined(_WIN32) + "%r='23:31:30'\t" + "%X='23:31:30'\t" + "%EX='23:31:30'\t" # else "%r='午後11:31:30'\t" "%X='23:31:30'\t" @@ -712,7 +720,7 @@ "\n"), lfmt, std::chrono::hh_mm_ss(23h + 31min + 30s + 123ms)); -#else // defined(__APPLE__) || defined(_AIX) +#else // defined(__APPLE__) || defined(_AIX) || defined(_WIN32) check(loc, SV("%H='00'\t" "%OH='〇'\t" @@ -751,7 +759,7 @@ lfmt, std::chrono::sys_time( 1'234'567'890'123ms)); // 23:31:30 UTC on Friday, 13 February 2009 -#endif // defined(__APPLE__) || defined(_AIX) +#endif // defined(__APPLE__) || defined(_AIX) || defined(_WIN32) std::locale::global(std::locale::classic()); } @@ -784,6 +792,8 @@ SV("%c=' 1 janvier 1970 à 00:00:00 UTC'\t%Ec=' 1 janvier 1970 à 00:00:00 UTC'\n"), #elif defined(__APPLE__) SV("%c='Jeu 1 jan 00:00:00 1970'\t%Ec='Jeu 1 jan 00:00:00 1970'\n"), +#elif defined(_WIN32) + SV("%c='01/01/1970 00:00:00'\t%Ec='01/01/1970 00:00:00'\n"), #else SV("%c='jeu. 01 janv. 1970 00:00:00'\t%Ec='jeu. 01 janv. 1970 00:00:00'\n"), #endif @@ -798,6 +808,8 @@ SV("%c='13 février 2009 à 23:31:30 UTC'\t%Ec='13 février 2009 à 23:31:30 UTC'\n"), #elif defined(__APPLE__) SV("%c='Ven 13 fév 23:31:30 2009'\t%Ec='Ven 13 fév 23:31:30 2009'\n"), +#elif defined(_WIN32) + SV("%c='13/02/2009 23:31:30'\t%Ec='13/02/2009 23:31:30'\n"), #else SV("%c='ven. 13 févr. 2009 23:31:30'\t%Ec='ven. 13 févr. 2009 23:31:30'\n"), #endif @@ -823,6 +835,15 @@ SV("%c='2009年02月13日 23:31:30 UTC'\t%Ec='2009年02月13日 23:31:30 UTC'\n"), lfmt, file_seconds(1'234'567'890s)); // 23:31:30 UTC on Friday, 13 February 2009 +#elif defined(_WIN32) // __APPLE__ + check(loc, + SV("%c='1970/01/01 0:00:00'\t%Ec='1970/01/01 0:00:00'\n"), + lfmt, + std::chrono::sys_seconds(0s)); // 00:00:00 UTC Thursday, 1 January 1970 + check(loc, + SV("%c='2009/02/13 23:31:30'\t%Ec='2009/02/13 23:31:30'\n"), + lfmt, + std::chrono::sys_seconds(1'234'567'890s)); // 23:31:30 UTC on Friday, 13 February 2009 #else // __APPLE__ check(loc, SV("%c='1970年01月01日 00時00分00秒'\t%Ec='昭和45年01月01日 00時00分00秒'\n"), @@ -868,6 +889,22 @@ SV("%z='UTC'\t%Ez='UTC'\t%Oz='UTC'\t%Z='UTC'\n"), lfmt, file_seconds(0s)); // 00:00:00 UTC Thursday, 1 January 1970 +# elif defined(_WIN32) // defined(_AIX) + // Non localized output using C-locale + check(SV("%z='-0000'\t%Ez='-0000'\t%Oz='-0000'\t%Z='UTC'\n"), + fmt, + file_seconds(0s)); // 00:00:00 UTC Thursday, 1 January 1970 + + // Use the global locale (fr_FR) + check(SV("%z='-0000'\t%Ez='-0000'\t%Oz='-0000'\t%Z='UTC'\n"), + lfmt, + file_seconds(0s)); // 00:00:00 UTC Thursday, 1 January 1970 + + // Use supplied locale (ja_JP). This locale has a different alternate.a + check(loc, + SV("%z='-0000'\t%Ez='-0000'\t%Oz='-0000'\t%Z='UTC'\n"), + lfmt, + file_seconds(0s)); // 00:00:00 UTC Thursday, 1 January 1970 # else // defined(_AIX) // Non localized output using C-locale check(SV("%z='+0000'\t%Ez='+0000'\t%Oz='+0000'\t%Z='UTC'\n"), @@ -886,7 +923,7 @@ file_seconds(0s)); // 00:00:00 UTC Thursday, 1 January 1970 # endif // defined(_AIX) std::locale::global(std::locale::classic()); -#endif // !defined(__APPLE__) +#endif // !defined(__APPLE__) } template diff --git a/libcxx/test/std/time/time.syn/formatter.local_time.pass.cpp b/libcxx/test/std/time/time.syn/formatter.local_time.pass.cpp --- a/libcxx/test/std/time/time.syn/formatter.local_time.pass.cpp +++ b/libcxx/test/std/time/time.syn/formatter.local_time.pass.cpp @@ -14,8 +14,6 @@ // TODO FMT This test should not require std::to_chars(floating-point) // XFAIL: availability-fp_to_chars-missing -// TODO FMT Investigate Windows issues. -// UNSUPPORTED: msvc, target={{.+}}-windows-gnu // TODO FMT It seems GCC uses too much memory in the CI and fails. // UNSUPPORTED: gcc-12 @@ -242,7 +240,7 @@ lfmt, std::chrono::local_seconds(1'234'567'890s)); // 23:31:30 UTC on Friday, 13 February 2009 -#endif // _WIN32 +#endif // _WIN32 std::locale::global(std::locale::classic()); } @@ -656,7 +654,7 @@ 1'234'567'890'123ms)); // 23:31:30 UTC on Friday, 13 February 2009 // Use supplied locale (ja_JP). This locale has a different alternate.a -#if defined(__APPLE__) || defined(_AIX) +#if defined(__APPLE__) || defined(_AIX) || defined(_WIN32) check(loc, SV("%H='00'\t" "%OH='00'\t" @@ -677,6 +675,10 @@ "%r='12:00:00 AM'\t" "%X='00時00分00秒'\t" "%EX='00時00分00秒'\t" +# elif defined(_WIN32) + "%r='0:00:00'\t" + "%X='0:00:00'\t" + "%EX='0:00:00'\t" # else "%r='午前12:00:00'\t" "%X='00:00:00'\t" @@ -706,6 +708,10 @@ "%r='11:31:30 PM'\t" "%X='23時31分30秒'\t" "%EX='23時31分30秒'\t" +# elif defined(_WIN32) + "%r='23:31:30'\t" + "%X='23:31:30'\t" + "%EX='23:31:30'\t" # else "%r='午後11:31:30'\t" "%X='23:31:30'\t" @@ -714,7 +720,7 @@ "\n"), lfmt, std::chrono::hh_mm_ss(23h + 31min + 30s + 123ms)); -#else // defined(__APPLE__) || defined(_AIX) +#else // defined(__APPLE__) || defined(_AIX) || defined(_WIN32) check(loc, SV("%H='00'\t" "%OH='〇'\t" @@ -753,7 +759,7 @@ lfmt, std::chrono::local_time( 1'234'567'890'123ms)); // 23:31:30 UTC on Friday, 13 February 2009 -#endif // defined(__APPLE__) || defined(_AIX) +#endif // defined(__APPLE__) || defined(_AIX) || defined(_WIN32) std::locale::global(std::locale::classic()); } @@ -786,6 +792,8 @@ SV("%c=' 1 janvier 1970 à 00:00:00 UTC'\t%Ec=' 1 janvier 1970 à 00:00:00 UTC'\n"), #elif defined(__APPLE__) SV("%c='Jeu 1 jan 00:00:00 1970'\t%Ec='Jeu 1 jan 00:00:00 1970'\n"), +#elif defined(_WIN32) + SV("%c='01/01/1970 00:00:00'\t%Ec='01/01/1970 00:00:00'\n"), #else SV("%c='jeu. 01 janv. 1970 00:00:00'\t%Ec='jeu. 01 janv. 1970 00:00:00'\n"), #endif @@ -800,6 +808,8 @@ SV("%c='13 février 2009 à 23:31:30 UTC'\t%Ec='13 février 2009 à 23:31:30 UTC'\n"), #elif defined(__APPLE__) SV("%c='Ven 13 fév 23:31:30 2009'\t%Ec='Ven 13 fév 23:31:30 2009'\n"), +#elif defined(_WIN32) + SV("%c='13/02/2009 23:31:30'\t%Ec='13/02/2009 23:31:30'\n"), #else SV("%c='ven. 13 févr. 2009 23:31:30'\t%Ec='ven. 13 févr. 2009 23:31:30'\n"), #endif @@ -825,6 +835,15 @@ SV("%c='2009年02月13日 23:31:30 UTC'\t%Ec='2009年02月13日 23:31:30 UTC'\n"), lfmt, std::chrono::local_seconds(1'234'567'890s)); // 23:31:30 UTC on Friday, 13 February 2009 +#elif defined(_WIN32) // __APPLE__ + check(loc, + SV("%c='1970/01/01 0:00:00'\t%Ec='1970/01/01 0:00:00'\n"), + lfmt, + std::chrono::sys_seconds(0s)); // 00:00:00 UTC Thursday, 1 January 1970 + check(loc, + SV("%c='2009/02/13 23:31:30'\t%Ec='2009/02/13 23:31:30'\n"), + lfmt, + std::chrono::sys_seconds(1'234'567'890s)); // 23:31:30 UTC on Friday, 13 February 2009 #else // __APPLE__ check(loc, SV("%c='1970年01月01日 00時00分00秒'\t%Ec='昭和45年01月01日 00時00分00秒'\n"), diff --git a/libcxx/test/std/time/time.syn/formatter.month_day.pass.cpp b/libcxx/test/std/time/time.syn/formatter.month_day.pass.cpp --- a/libcxx/test/std/time/time.syn/formatter.month_day.pass.cpp +++ b/libcxx/test/std/time/time.syn/formatter.month_day.pass.cpp @@ -11,15 +11,15 @@ // UNSUPPORTED: no-localization // UNSUPPORTED: libcpp-has-no-incomplete-format -// TODO FMT Investigate Windows issues. -// UNSUPPORTED: msvc, target={{.+}}-windows-gnu - // TODO FMT It seems GCC uses too much memory in the CI and fails. // UNSUPPORTED: gcc-12 // TODO FMT This test should not require std::to_chars(floating-point) // XFAIL: availability-fp_to_chars-missing +// TODO FMT Investigate Windows issues. +// XFAIL: msvc + // REQUIRES: locale.fr_FR.UTF-8 // REQUIRES: locale.ja_JP.UTF-8 @@ -115,9 +115,15 @@ std::locale::global(std::locale(LOCALE_fr_FR_UTF_8)); // Non localized output using C-locale +#ifdef _WIN32 + check(SV("%b='Jan'\t%B='January'\t%h='Jan'\t%m='01'\t%Om='01'\t%d=''\t%e=''\t%Od=''\t%Oe=''\n"), + fmt, + std::chrono::month_day{std::chrono::January, std::chrono::day{0}}); +#else check(SV("%b='Jan'\t%B='January'\t%h='Jan'\t%m='01'\t%Om='01'\t%d='00'\t%e=' 0'\t%Od='00'\t%Oe=' 0'\n"), fmt, std::chrono::month_day{std::chrono::January, std::chrono::day{0}}); +#endif check(SV("%b='Feb'\t%B='February'\t%h='Feb'\t%m='02'\t%Om='02'\t%d='01'\t%e=' 1'\t%Od='01'\t%Oe=' 1'\n"), fmt, std::chrono::month_day{std::chrono::February, std::chrono::day{1}}); @@ -139,27 +145,42 @@ check(SV("%b='Aug'\t%B='August'\t%h='Aug'\t%m='08'\t%Om='08'\t%d='31'\t%e='31'\t%Od='31'\t%Oe='31'\n"), fmt, std::chrono::month_day{std::chrono::August, std::chrono::day{31}}); +#ifdef _WIN32 + check(SV("%b='Sep'\t%B='September'\t%h='Sep'\t%m='09'\t%Om='09'\t%d=''\t%e=''\t%Od=''\t%Oe=''\n"), + fmt, + std::chrono::month_day{std::chrono::September, std::chrono::day{32}}); + check(SV("%b='Oct'\t%B='October'\t%h='Oct'\t%m='10'\t%Om='10'\t%d=''\t%e=''\t%Od=''\t%Oe=''\n"), + fmt, + std::chrono::month_day{std::chrono::October, std::chrono::day{99}}); + check(SV("%b='Nov'\t%B='November'\t%h='Nov'\t%m='11'\t%Om='11'\t%d=''\t%e=''\t%Od=''\t%Oe=''\n"), + fmt, + std::chrono::month_day{std::chrono::November, std::chrono::day{100}}); + check(SV("%b='Dec'\t%B='December'\t%h='Dec'\t%m='12'\t%Om='12'\t%d=''\t%e=''\t%Od=''\t%Oe=''\n"), + fmt, + std::chrono::month_day{std::chrono::December, std::chrono::day{255}}); +#else // _WIN32 check(SV("%b='Sep'\t%B='September'\t%h='Sep'\t%m='09'\t%Om='09'\t%d='32'\t%e='32'\t%Od='32'\t%Oe='32'\n"), fmt, std::chrono::month_day{std::chrono::September, std::chrono::day{32}}); check(SV("%b='Oct'\t%B='October'\t%h='Oct'\t%m='10'\t%Om='10'\t%d='99'\t%e='99'\t%Od='99'\t%Oe='99'\n"), fmt, std::chrono::month_day{std::chrono::October, std::chrono::day{99}}); -#if defined(_AIX) +# if defined(_AIX) check(SV("%b='Nov'\t%B='November'\t%h='Nov'\t%m='11'\t%Om='11'\t%d='00'\t%e=' 0'\t%Od='00'\t%Oe=' 0'\n"), fmt, std::chrono::month_day{std::chrono::November, std::chrono::day{100}}); check(SV("%b='Dec'\t%B='December'\t%h='Dec'\t%m='12'\t%Om='12'\t%d='55'\t%e='55'\t%Od='55'\t%Oe='55'\n"), fmt, std::chrono::month_day{std::chrono::December, std::chrono::day{255}}); -#else // defined(_AIX) +# else // defined(_AIX) check(SV("%b='Nov'\t%B='November'\t%h='Nov'\t%m='11'\t%Om='11'\t%d='100'\t%e='100'\t%Od='100'\t%Oe='100'\n"), fmt, std::chrono::month_day{std::chrono::November, std::chrono::day{100}}); check(SV("%b='Dec'\t%B='December'\t%h='Dec'\t%m='12'\t%Om='12'\t%d='255'\t%e='255'\t%Od='255'\t%Oe='255'\n"), fmt, std::chrono::month_day{std::chrono::December, std::chrono::day{255}}); -#endif // defined(_AIX) +# endif // defined(_AIX) +#endif // _WIN32 // Use the global locale (fr_FR) #if defined(__APPLE__) @@ -199,10 +220,16 @@ check(SV("%b='déc'\t%B='décembre'\t%h='déc'\t%m='12'\t%Om='12'\t%d='255'\t%e='255'\t%Od='255'\t%Oe='255'\n"), lfmt, std::chrono::month_day{std::chrono::December, std::chrono::day{255}}); -#else // defined(__APPLE__) +#else // defined(__APPLE__) +# if defined(_WIN32) + check(SV("%b='janv.'\t%B='janvier'\t%h='janv.'\t%m='01'\t%Om='01'\t%d=''\t%e=''\t%Od=''\t%Oe=''\n"), + lfmt, + std::chrono::month_day{std::chrono::January, std::chrono::day{0}}); +# else check(SV("%b='janv.'\t%B='janvier'\t%h='janv.'\t%m='01'\t%Om='01'\t%d='00'\t%e=' 0'\t%Od='00'\t%Oe=' 0'\n"), lfmt, std::chrono::month_day{std::chrono::January, std::chrono::day{0}}); +# endif check(SV("%b='févr.'\t%B='février'\t%h='févr.'\t%m='02'\t%Om='02'\t%d='01'\t%e=' 1'\t%Od='01'\t%Oe=' 1'\n"), lfmt, std::chrono::month_day{std::chrono::February, std::chrono::day{1}}); @@ -229,77 +256,92 @@ check(SV("%b='août'\t%B='août'\t%h='août'\t%m='08'\t%Om='08'\t%d='31'\t%e='31'\t%Od='31'\t%Oe='31'\n"), lfmt, std::chrono::month_day{std::chrono::August, std::chrono::day{31}}); +# if defined(_WIN32) + check(SV("%b='sept.'\t%B='septembre'\t%h='sept.'\t%m='09'\t%Om='09'\t%d=''\t%e=''\t%Od=''\t%Oe=''\n"), + lfmt, + std::chrono::month_day{std::chrono::September, std::chrono::day{32}}); + check(SV("%b='oct.'\t%B='octobre'\t%h='oct.'\t%m='10'\t%Om='10'\t%d=''\t%e=''\t%Od=''\t%Oe=''\n"), + lfmt, + std::chrono::month_day{std::chrono::October, std::chrono::day{99}}); + check(SV("%b='nov.'\t%B='novembre'\t%h='nov.'\t%m='11'\t%Om='11'\t%d=''\t%e=''\t%Od=''\t%Oe=''\n"), + lfmt, + std::chrono::month_day{std::chrono::November, std::chrono::day{100}}); + check(SV("%b='déc.'\t%B='décembre'\t%h='déc.'\t%m='12'\t%Om='12'\t%d=''\t%e=''\t%Od=''\t%Oe=''\n"), + lfmt, + std::chrono::month_day{std::chrono::December, std::chrono::day{255}}); +# else // defined(_WIN32) check(SV("%b='sept.'\t%B='septembre'\t%h='sept.'\t%m='09'\t%Om='09'\t%d='32'\t%e='32'\t%Od='32'\t%Oe='32'\n"), lfmt, std::chrono::month_day{std::chrono::September, std::chrono::day{32}}); check(SV("%b='oct.'\t%B='octobre'\t%h='oct.'\t%m='10'\t%Om='10'\t%d='99'\t%e='99'\t%Od='99'\t%Oe='99'\n"), lfmt, std::chrono::month_day{std::chrono::October, std::chrono::day{99}}); -# if defined(_AIX) +# if defined(_AIX) check(SV("%b='nov.'\t%B='novembre'\t%h='nov.'\t%m='11'\t%Om='11'\t%d='00'\t%e=' 0'\t%Od='00'\t%Oe=' 0'\n"), lfmt, std::chrono::month_day{std::chrono::November, std::chrono::day{100}}); check(SV("%b='déc.'\t%B='décembre'\t%h='déc.'\t%m='12'\t%Om='12'\t%d='55'\t%e='55'\t%Od='55'\t%Oe='55'\n"), lfmt, std::chrono::month_day{std::chrono::December, std::chrono::day{255}}); -# else // defined(_AIX) +# else // defined(_AIX) check(SV("%b='nov.'\t%B='novembre'\t%h='nov.'\t%m='11'\t%Om='11'\t%d='100'\t%e='100'\t%Od='100'\t%Oe='100'\n"), lfmt, std::chrono::month_day{std::chrono::November, std::chrono::day{100}}); check(SV("%b='déc.'\t%B='décembre'\t%h='déc.'\t%m='12'\t%Om='12'\t%d='255'\t%e='255'\t%Od='255'\t%Oe='255'\n"), lfmt, std::chrono::month_day{std::chrono::December, std::chrono::day{255}}); -# endif // defined(_AIX) -#endif // defined(__APPLE__) +# endif // defined(_AIX) +# endif // defined(_WIN32) +#endif // defined(__APPLE__) // Use supplied locale (ja_JP) #if defined(_WIN32) check(loc, - SV("%b='1'\t%B='1月'\t%h='1'\t%m='01'\t%Om='01'\t%d='00'\t%e=' 0'\t%Od='〇'\t%Oe='〇'\n"), + SV("%b='1'\t%B='1月'\t%h='1'\t%m='01'\t%Om='01'\t%d=''\t%e=''\t%Od=''\t%Oe=''\n"), lfmt, std::chrono::month_day{std::chrono::January, std::chrono::day{0}}); check(loc, - SV("%b='2'\t%B='2月'\t%h='2'\t%m='02'\t%Om='02'\t%d='01'\t%e=' 1'\t%Od='一'\t%Oe='一'\n"), + SV("%b='2'\t%B='2月'\t%h='2'\t%m='02'\t%Om='02'\t%d='01'\t%e=' 1'\t%Od='01'\t%Oe=' 1'\n"), lfmt, std::chrono::month_day{std::chrono::February, std::chrono::day{1}}); check(loc, - SV("%b='3'\t%B='3月'\t%h='3'\t%m='03'\t%Om='03'\t%d='09'\t%e=' 9'\t%Od='九'\t%Oe='九'\n"), + SV("%b='3'\t%B='3月'\t%h='3'\t%m='03'\t%Om='03'\t%d='09'\t%e=' 9'\t%Od='09'\t%Oe=' 9'\n"), lfmt, std::chrono::month_day{std::chrono::March, std::chrono::day{9}}); check(loc, - SV("%b='4'\t%B='4月'\t%h='4'\t%m='04'\t%Om='04'\t%d='10'\t%e='10'\t%Od='十'\t%Oe='十'\n"), + SV("%b='4'\t%B='4月'\t%h='4'\t%m='04'\t%Om='04'\t%d='10'\t%e='10'\t%Od='10'\t%Oe='10'\n"), lfmt, std::chrono::month_day{std::chrono::April, std::chrono::day{10}}); check(loc, - SV("%b='5'\t%B='5月'\t%h='5'\t%m='05'\t%Om='05'\t%d='28'\t%e='28'\t%Od='二十八'\t%Oe='二十八'\n"), + SV("%b='5'\t%B='5月'\t%h='5'\t%m='05'\t%Om='05'\t%d='28'\t%e='28'\t%Od='28'\t%Oe='28'\n"), lfmt, std::chrono::month_day{std::chrono::May, std::chrono::day{28}}); check(loc, - SV("%b='6'\t%B='6月'\t%h='6'\t%m='06'\t%Om='06'\t%d='29'\t%e='29'\t%Od='二十九'\t%Oe='二十九'\n"), + SV("%b='6'\t%B='6月'\t%h='6'\t%m='06'\t%Om='06'\t%d='29'\t%e='29'\t%Od='29'\t%Oe='29'\n"), lfmt, std::chrono::month_day{std::chrono::June, std::chrono::day{29}}); check(loc, - SV("%b='7'\t%B='7月'\t%h='7'\t%m='07'\t%Om='07'\t%d='30'\t%e='30'\t%Od='三十'\t%Oe='三十'\n"), + SV("%b='7'\t%B='7月'\t%h='7'\t%m='07'\t%Om='07'\t%d='30'\t%e='30'\t%Od='30'\t%Oe='30'\n"), lfmt, std::chrono::month_day{std::chrono::July, std::chrono::day{30}}); check(loc, - SV("%b='8'\t%B='8月'\t%h='8'\t%m='08'\t%Om='08'\t%d='31'\t%e='31'\t%Od='三十一'\t%Oe='三十一'\n"), + SV("%b='8'\t%B='8月'\t%h='8'\t%m='08'\t%Om='08'\t%d='31'\t%e='31'\t%Od='31'\t%Oe='31'\n"), lfmt, std::chrono::month_day{std::chrono::August, std::chrono::day{31}}); check(loc, - SV("%b='9'\t%B='9月'\t%h='9'\t%m='09'\t%Om='09'\t%d='32'\t%e='32'\t%Od='三十二'\t%Oe='三十二'\n"), + SV("%b='9'\t%B='9月'\t%h='9'\t%m='09'\t%Om='09'\t%d=''\t%e=''\t%Od=''\t%Oe=''\n"), lfmt, std::chrono::month_day{std::chrono::September, std::chrono::day{32}}); check(loc, - SV("%b='10'\t%B='10月'\t%h='10'\t%m='10'\t%Om='10'\t%d='99'\t%e='99'\t%Od='九十九'\t%Oe='九十九'\n"), + SV("%b='10'\t%B='10月'\t%h='10'\t%m='10'\t%Om='10'\t%d=''\t%e=''\t%Od=''\t%Oe=''\n"), lfmt, std::chrono::month_day{std::chrono::October, std::chrono::day{99}}); check(loc, - SV("%b='11'\t%B='11月'\t%h='11'\t%m='11'\t%Om='11'\t%d='100'\t%e='100'\t%Od='100'\t%Oe='100'\n"), + SV("%b='11'\t%B='11月'\t%h='11'\t%m='11'\t%Om='11'\t%d=''\t%e=''\t%Od=''\t%Oe=''\n"), lfmt, std::chrono::month_day{std::chrono::November, std::chrono::day{100}}); check(loc, - SV("%b='12'\t%B='12月'\t%h='12'\t%m='12'\t%Om='12'\t%d='255'\t%e='255'\t%Od='255'\t%Oe='255'\n"), + SV("%b='12'\t%B='12月'\t%h='12'\t%m='12'\t%Om='12'\t%d=''\t%e=''\t%Od=''\t%Oe=''\n"), lfmt, std::chrono::month_day{std::chrono::December, std::chrono::day{255}}); #elif defined(_AIX) // defined(_WIN32) diff --git a/libcxx/test/std/time/time.syn/formatter.sys_time.pass.cpp b/libcxx/test/std/time/time.syn/formatter.sys_time.pass.cpp --- a/libcxx/test/std/time/time.syn/formatter.sys_time.pass.cpp +++ b/libcxx/test/std/time/time.syn/formatter.sys_time.pass.cpp @@ -14,8 +14,6 @@ // TODO FMT This test should not require std::to_chars(floating-point) // XFAIL: availability-fp_to_chars-missing -// TODO FMT Investigate Windows issues. -// UNSUPPORTED: msvc, target={{.+}}-windows-gnu // TODO FMT It seems GCC uses too much memory in the CI and fails. // UNSUPPORTED: gcc-12 @@ -242,7 +240,7 @@ lfmt, std::chrono::sys_seconds(1'234'567'890s)); // 23:31:30 UTC on Friday, 13 February 2009 -#endif // _WIN32 +#endif // _WIN32 std::locale::global(std::locale::classic()); } @@ -653,8 +651,8 @@ std::chrono::sys_time( 1'234'567'890'123ms)); // 23:31:30 UTC on Friday, 13 February 2009 - // Use supplied locale (ja_JP). This locale has a different alternate.a -#if defined(__APPLE__) || defined(_AIX) + // Use supplied locale (ja_JP). This locale has a different alternate. +#if defined(__APPLE__) || defined(_AIX) || defined(_WIN32) check(loc, SV("%H='00'\t" "%OH='00'\t" @@ -675,6 +673,10 @@ "%r='12:00:00 AM'\t" "%X='00時00分00秒'\t" "%EX='00時00分00秒'\t" +# elif defined(_WIN32) + "%r='0:00:00'\t" + "%X='0:00:00'\t" + "%EX='0:00:00'\t" # else "%r='午前12:00:00'\t" "%X='00:00:00'\t" @@ -704,6 +706,10 @@ "%r='11:31:30 PM'\t" "%X='23時31分30秒'\t" "%EX='23時31分30秒'\t" +# elif defined(_WIN32) + "%r='23:31:30'\t" + "%X='23:31:30'\t" + "%EX='23:31:30'\t" # else "%r='午後11:31:30'\t" "%X='23:31:30'\t" @@ -712,7 +718,7 @@ "\n"), lfmt, std::chrono::hh_mm_ss(23h + 31min + 30s + 123ms)); -#else // defined(__APPLE__) || defined(_AIX) +#else // defined(__APPLE__) || defined(_AIX) || defined(_WIN32) check(loc, SV("%H='00'\t" "%OH='〇'\t" @@ -751,7 +757,7 @@ lfmt, std::chrono::sys_time( 1'234'567'890'123ms)); // 23:31:30 UTC on Friday, 13 February 2009 -#endif // defined(__APPLE__) || defined(_AIX) +#endif // defined(__APPLE__) || defined(_AIX) || defined(_WIN32) std::locale::global(std::locale::classic()); } @@ -784,6 +790,8 @@ SV("%c=' 1 janvier 1970 à 00:00:00 UTC'\t%Ec=' 1 janvier 1970 à 00:00:00 UTC'\n"), #elif defined(__APPLE__) SV("%c='Jeu 1 jan 00:00:00 1970'\t%Ec='Jeu 1 jan 00:00:00 1970'\n"), +#elif defined(_WIN32) + SV("%c='01/01/1970 00:00:00'\t%Ec='01/01/1970 00:00:00'\n"), #else SV("%c='jeu. 01 janv. 1970 00:00:00'\t%Ec='jeu. 01 janv. 1970 00:00:00'\n"), #endif @@ -798,6 +806,8 @@ SV("%c='13 février 2009 à 23:31:30 UTC'\t%Ec='13 février 2009 à 23:31:30 UTC'\n"), #elif defined(__APPLE__) SV("%c='Ven 13 fév 23:31:30 2009'\t%Ec='Ven 13 fév 23:31:30 2009'\n"), +#elif defined(_WIN32) + SV("%c='13/02/2009 23:31:30'\t%Ec='13/02/2009 23:31:30'\n"), #else SV("%c='ven. 13 févr. 2009 23:31:30'\t%Ec='ven. 13 févr. 2009 23:31:30'\n"), #endif @@ -823,6 +833,15 @@ SV("%c='2009年02月13日 23:31:30 UTC'\t%Ec='2009年02月13日 23:31:30 UTC'\n"), lfmt, std::chrono::sys_seconds(1'234'567'890s)); // 23:31:30 UTC on Friday, 13 February 2009 +#elif defined(_WIN32) // __APPLE__ + check(loc, + SV("%c='1970/01/01 0:00:00'\t%Ec='1970/01/01 0:00:00'\n"), + lfmt, + std::chrono::sys_seconds(0s)); // 00:00:00 UTC Thursday, 1 January 1970 + check(loc, + SV("%c='2009/02/13 23:31:30'\t%Ec='2009/02/13 23:31:30'\n"), + lfmt, + std::chrono::sys_seconds(1'234'567'890s)); // 23:31:30 UTC on Friday, 13 February 2009 #else // __APPLE__ check(loc, SV("%c='1970年01月01日 00時00分00秒'\t%Ec='昭和45年01月01日 00時00分00秒'\n"), @@ -868,6 +887,22 @@ SV("%z='UTC'\t%Ez='UTC'\t%Oz='UTC'\t%Z='UTC'\n"), lfmt, std::chrono::sys_seconds(0s)); // 00:00:00 UTC Thursday, 1 January 1970 +# elif defined(_WIN32) // defined(_AIX) + // Non localized output using C-locale + check(SV("%z='-0000'\t%Ez='-0000'\t%Oz='-0000'\t%Z='UTC'\n"), + fmt, + std::chrono::sys_seconds(0s)); // 00:00:00 UTC Thursday, 1 January 1970 + + // Use the global locale (fr_FR) + check(SV("%z='-0000'\t%Ez='-0000'\t%Oz='-0000'\t%Z='UTC'\n"), + lfmt, + std::chrono::sys_seconds(0s)); // 00:00:00 UTC Thursday, 1 January 1970 + + // Use supplied locale (ja_JP). This locale has a different alternate.a + check(loc, + SV("%z='-0000'\t%Ez='-0000'\t%Oz='-0000'\t%Z='UTC'\n"), + lfmt, + std::chrono::sys_seconds(0s)); // 00:00:00 UTC Thursday, 1 January 1970 # else // defined(_AIX) // Non localized output using C-locale check(SV("%z='+0000'\t%Ez='+0000'\t%Oz='+0000'\t%Z='UTC'\n"), @@ -886,7 +921,7 @@ std::chrono::sys_seconds(0s)); // 00:00:00 UTC Thursday, 1 January 1970 # endif // defined(_AIX) std::locale::global(std::locale::classic()); -#endif // !defined(__APPLE__) +#endif // !defined(__APPLE__) } template diff --git a/libcxx/test/std/time/time.syn/formatter.weekday.pass.cpp b/libcxx/test/std/time/time.syn/formatter.weekday.pass.cpp --- a/libcxx/test/std/time/time.syn/formatter.weekday.pass.cpp +++ b/libcxx/test/std/time/time.syn/formatter.weekday.pass.cpp @@ -11,15 +11,15 @@ // UNSUPPORTED: no-localization // UNSUPPORTED: libcpp-has-no-incomplete-format -// TODO FMT Investigate Windows issues. -// UNSUPPORTED: msvc, target={{.+}}-windows-gnu - // TODO FMT Fix this test using GCC, it currently crashes. // UNSUPPORTED: gcc-12 // TODO FMT This test should not require std::to_chars(floating-point) // XFAIL: availability-fp_to_chars-missing +// TODO FMT Investigate Windows issues. +// XFAIL: msvc + // REQUIRES: locale.fr_FR.UTF-8 // REQUIRES: locale.ja_JP.UTF-8 @@ -145,7 +145,7 @@ // Use supplied locale (ja_JP). This locale has a different alternate. check(loc, SV("%u='8'\t%Ou='8'\t%w='8'\t%Ow='8'\n"), lfmt, std::chrono::weekday(8)); check(loc, SV("%u='255'\t%Ou='255'\t%w='255'\t%Ow='255'\n"), lfmt, std::chrono::weekday(255)); -#elif defined(_AIX) +#elif defined(_AIX) // defined(__APPLE__) // Non localized output using C-locale check(SV("%u='8'\t%Ou='8'\t%w='8'\t%Ow='8'\n"), fmt, std::chrono::weekday(8)); check(SV("%u='5'\t%Ou='5'\t%w='5'\t%Ow='5'\n"), fmt, std::chrono::weekday(255)); @@ -157,7 +157,19 @@ // Use supplied locale (ja_JP). This locale has a different alternate. check(loc, SV("%u='8'\t%Ou='8'\t%w='8'\t%Ow='8'\n"), lfmt, std::chrono::weekday(8)); check(loc, SV("%u='5'\t%Ou='5'\t%w='5'\t%Ow='5'\n"), lfmt, std::chrono::weekday(255)); -#else +#elif defined(_WIN32) // defined(__APPLE__) + // Non localized output using C-locale + check(SV("%u=''\t%Ou=''\t%w=''\t%Ow=''\n"), fmt, std::chrono::weekday(8)); + check(SV("%u=''\t%Ou=''\t%w=''\t%Ow=''\n"), fmt, std::chrono::weekday(255)); + + // Use the global locale (fr_FR) + check(SV("%u=''\t%Ou=''\t%w=''\t%Ow=''\n"), lfmt, std::chrono::weekday(8)); + check(SV("%u=''\t%Ou=''\t%w=''\t%Ow=''\n"), lfmt, std::chrono::weekday(255)); + + // Use supplied locale (ja_JP). This locale has a different alternate. + check(loc, SV("%u=''\t%Ou=''\t%w=''\t%Ow=''\n"), lfmt, std::chrono::weekday(8)); + check(loc, SV("%u=''\t%Ou=''\t%w=''\t%Ow=''\n"), lfmt, std::chrono::weekday(255)); +#else // defined(__APPLE__) // Non localized output using C-locale check(SV("%u='1'\t%Ou='1'\t%w='8'\t%Ow='8'\n"), fmt, std::chrono::weekday(8)); check(SV("%u='3'\t%Ou='3'\t%w='255'\t%Ow='255'\n"), fmt, std::chrono::weekday(255)); @@ -169,8 +181,7 @@ // Use supplied locale (ja_JP). This locale has a different alternate. check(loc, SV("%u='1'\t%Ou='一'\t%w='8'\t%Ow='八'\n"), lfmt, std::chrono::weekday(8)); check(loc, SV("%u='3'\t%Ou='三'\t%w='255'\t%Ow='255'\n"), lfmt, std::chrono::weekday(255)); - -#endif +#endif // defined(__APPLE__) std::locale::global(std::locale::classic()); } diff --git a/libcxx/test/std/time/time.syn/formatter.weekday_index.pass.cpp b/libcxx/test/std/time/time.syn/formatter.weekday_index.pass.cpp --- a/libcxx/test/std/time/time.syn/formatter.weekday_index.pass.cpp +++ b/libcxx/test/std/time/time.syn/formatter.weekday_index.pass.cpp @@ -11,15 +11,15 @@ // UNSUPPORTED: no-localization // UNSUPPORTED: libcpp-has-no-incomplete-format -// TODO FMT Investigate Windows issues. -// UNSUPPORTED: msvc, target={{.+}}-windows-gnu - // TODO FMT It seems GCC uses too much memory in the CI and fails. // UNSUPPORTED: gcc-12 // TODO FMT This test should not require std::to_chars(floating-point) // XFAIL: availability-fp_to_chars-missing +// TODO FMT Investigate Windows issues. +// XFAIL: msvc + // REQUIRES: locale.fr_FR.UTF-8 // REQUIRES: locale.ja_JP.UTF-8 @@ -287,6 +287,24 @@ SV("%u='255'\t%Ou='255'\t%w='255'\t%Ow='255'\n"), lfmt, std::chrono::weekday_indexed{std::chrono::weekday(255), 1}); +#elif defined(_WIN32) // defined(__APPLE__) + // Non localized output using C-locale + check(SV("%u=''\t%Ou=''\t%w=''\t%Ow=''\n"), fmt, std::chrono::weekday_indexed{std::chrono::weekday(8), 0}); + check(SV("%u=''\t%Ou=''\t%w=''\t%Ow=''\n"), fmt, std::chrono::weekday_indexed{std::chrono::weekday(8), 1}); + check(SV("%u=''\t%Ou=''\t%w=''\t%Ow=''\n"), fmt, std::chrono::weekday_indexed{std::chrono::weekday(255), 0}); + check(SV("%u=''\t%Ou=''\t%w=''\t%Ow=''\n"), fmt, std::chrono::weekday_indexed{std::chrono::weekday(255), 1}); + + // Use the global locale (fr_FR) + check(SV("%u=''\t%Ou=''\t%w=''\t%Ow=''\n"), lfmt, std::chrono::weekday_indexed{std::chrono::weekday(8), 0}); + check(SV("%u=''\t%Ou=''\t%w=''\t%Ow=''\n"), lfmt, std::chrono::weekday_indexed{std::chrono::weekday(8), 1}); + check(SV("%u=''\t%Ou=''\t%w=''\t%Ow=''\n"), lfmt, std::chrono::weekday_indexed{std::chrono::weekday(255), 0}); + check(SV("%u=''\t%Ou=''\t%w=''\t%Ow=''\n"), lfmt, std::chrono::weekday_indexed{std::chrono::weekday(255), 1}); + + // Use supplied locale (ja_JP). This locale has a different alternate. + check(loc, SV("%u=''\t%Ou=''\t%w=''\t%Ow=''\n"), lfmt, std::chrono::weekday_indexed{std::chrono::weekday(8), 0}); + check(loc, SV("%u=''\t%Ou=''\t%w=''\t%Ow=''\n"), lfmt, std::chrono::weekday_indexed{std::chrono::weekday(8), 1}); + check(loc, SV("%u=''\t%Ou=''\t%w=''\t%Ow=''\n"), lfmt, std::chrono::weekday_indexed{std::chrono::weekday(255), 0}); + check(loc, SV("%u=''\t%Ou=''\t%w=''\t%Ow=''\n"), lfmt, std::chrono::weekday_indexed{std::chrono::weekday(255), 1}); #elif defined(_AIX) // defined(__APPLE__) // Non localized output using C-locale check(SV("%u='8'\t%Ou='8'\t%w='8'\t%Ow='8'\n"), fmt, std::chrono::weekday_indexed{std::chrono::weekday(8), 0}); diff --git a/libcxx/test/std/time/time.syn/formatter.weekday_last.pass.cpp b/libcxx/test/std/time/time.syn/formatter.weekday_last.pass.cpp --- a/libcxx/test/std/time/time.syn/formatter.weekday_last.pass.cpp +++ b/libcxx/test/std/time/time.syn/formatter.weekday_last.pass.cpp @@ -11,15 +11,15 @@ // UNSUPPORTED: no-localization // UNSUPPORTED: libcpp-has-no-incomplete-format -// TODO FMT Investigate Windows issues. -// UNSUPPORTED: msvc, target={{.+}}-windows-gnu - // TODO FMT It seems GCC uses too much memory in the CI and fails. // UNSUPPORTED: gcc-12 // TODO FMT This test should not require std::to_chars(floating-point) // XFAIL: availability-fp_to_chars-missing +// TODO FMT Investigate Windows issues. +// XFAIL: msvc + // REQUIRES: locale.fr_FR.UTF-8 // REQUIRES: locale.ja_JP.UTF-8 @@ -251,6 +251,18 @@ SV("%u='255'\t%Ou='255'\t%w='255'\t%Ow='255'\n"), lfmt, std::chrono::weekday_last{std::chrono::weekday(255)}); +#elif defined(_WIN32) // defined(__APPLE__) + // Non localized output using C-locale + check(SV("%u=''\t%Ou=''\t%w=''\t%Ow=''\n"), fmt, std::chrono::weekday_last{std::chrono::weekday(8)}); + check(SV("%u=''\t%Ou=''\t%w=''\t%Ow=''\n"), fmt, std::chrono::weekday_last{std::chrono::weekday(255)}); + + // Use the global locale (fr_FR) + check(SV("%u=''\t%Ou=''\t%w=''\t%Ow=''\n"), lfmt, std::chrono::weekday_last{std::chrono::weekday(8)}); + check(SV("%u=''\t%Ou=''\t%w=''\t%Ow=''\n"), lfmt, std::chrono::weekday_last{std::chrono::weekday(255)}); + + // Use supplied locale (ja_JP). This locale has a different alternate. + check(loc, SV("%u=''\t%Ou=''\t%w=''\t%Ow=''\n"), lfmt, std::chrono::weekday_last{std::chrono::weekday(8)}); + check(loc, SV("%u=''\t%Ou=''\t%w=''\t%Ow=''\n"), lfmt, std::chrono::weekday_last{std::chrono::weekday(255)}); #elif defined(_AIX) // defined(__APPLE__) // Non localized output using C-locale check(SV("%u='8'\t%Ou='8'\t%w='8'\t%Ow='8'\n"), fmt, std::chrono::weekday_last{std::chrono::weekday(8)}); diff --git a/libcxx/test/std/time/time.syn/formatter.year.pass.cpp b/libcxx/test/std/time/time.syn/formatter.year.pass.cpp --- a/libcxx/test/std/time/time.syn/formatter.year.pass.cpp +++ b/libcxx/test/std/time/time.syn/formatter.year.pass.cpp @@ -11,15 +11,15 @@ // UNSUPPORTED: no-localization // UNSUPPORTED: libcpp-has-no-incomplete-format -// TODO FMT Investigate Windows issues. -// UNSUPPORTED: msvc, target={{.+}}-windows-gnu - // TODO FMT Fix this test using GCC, it currently crashes. // UNSUPPORTED: gcc-12 // TODO FMT This test should not require std::to_chars(floating-point) // XFAIL: availability-fp_to_chars-missing +// TODO FMT Investigate Windows issues. +// XFAIL: msvc + // REQUIRES: locale.fr_FR.UTF-8 // REQUIRES: locale.ja_JP.UTF-8 @@ -54,7 +54,11 @@ check(SV("0010"), SV("{}"), std::chrono::year{10}); check(SV("0100"), SV("{}"), std::chrono::year{100}); check(SV("1000"), SV("{}"), std::chrono::year{1000}); +#ifdef _WIN32 + check(SV(""), SV("{}"), std::chrono::year{32'727}); +#else check(SV("32727"), SV("{}"), std::chrono::year{32'727}); +#endif // Invalid year check(SV("-32768 is not a valid year"), SV("{}"), std::chrono::year{-32'768}); @@ -89,7 +93,7 @@ // Non localized output using C-locale check(SV("%C='00'\t" -#if defined(__APPLE__) +#if defined(__APPLE__) || defined(_WIN32) "%EC='00'\t" #else "%EC='0'\t" @@ -98,7 +102,7 @@ "%Ey='00'\t" "%Oy='00'\t" "%Y='0000'\t" -#if defined(__APPLE__) +#if defined(__APPLE__) || defined(_WIN32) "%EY='0000'\t" #elif defined(_AIX) "%EY=''\t" @@ -133,7 +137,7 @@ // Use the global locale (fr_FR) check(SV("%C='00'\t" -#if defined(__APPLE__) +#if defined(__APPLE__) || defined(_WIN32) "%EC='00'\t" #else "%EC='0'\t" @@ -142,7 +146,7 @@ "%Ey='00'\t" "%Oy='00'\t" "%Y='0000'\t" -#if defined(__APPLE__) +#if defined(__APPLE__) || defined(_WIN32) "%EY='0000'\t" #elif defined(_AIX) "%EY=''\t" @@ -176,10 +180,10 @@ std::chrono::year{2038}); // Use supplied locale (ja_JP). This locale has a different alternate. -#if defined(__APPLE__) || defined(_AIX) +#if defined(__APPLE__) || defined(_AIX) || defined(_WIN32) check(SV("%C='00'\t" -# if defined(__APPLE__) +# if defined(__APPLE__) || defined(_WIN32) "%EC='00'\t" # else "%EC='0'\t" @@ -219,12 +223,12 @@ lfmt, std::chrono::year{2038}); -#else // defined(__APPLE__) || defined(_AIX) +#else // defined(__APPLE__) || defined(_AIX) || defined(_WIN32) check(loc, SV("%C='00'\t" "%EC='紀元前'\t" "%y='00'\t" -// https://sourceware.org/bugzilla/show_bug.cgi?id=23758 + // https://sourceware.org/bugzilla/show_bug.cgi?id=23758 # if defined(__GLIBC__) && __GLIBC__ <= 2 && __GLIBC_MINOR__ < 29 "%Ey='1'\t" # else @@ -232,7 +236,7 @@ # endif "%Oy='〇'\t" "%Y='0000'\t" -// https://sourceware.org/bugzilla/show_bug.cgi?id=23758 + // https://sourceware.org/bugzilla/show_bug.cgi?id=23758 # if defined(__GLIBC__) && __GLIBC__ <= 2 && __GLIBC_MINOR__ < 29 "%EY='紀元前1年'\t" # else @@ -266,7 +270,7 @@ "\n"), lfmt, std::chrono::year{2038}); -#endif // defined(__APPLE__) || defined(_AIX) +#endif // defined(__APPLE__) || defined(_AIX) || defined(_WIN32) std::locale::global(std::locale::classic()); } @@ -274,17 +278,27 @@ template static void test_padding() { constexpr std::basic_string_view fmt = SV("{:%%C='%C'%t%%y='%y'%t%%Y='%Y'%t%n}"); - +#ifdef _WIN32 + check(SV("%C='-100'\t%y=''\t%Y='-9999'\t\n"), fmt, std::chrono::year{-9'999}); + check(SV("%C='-10'\t%y=''\t%Y='-0999'\t\n"), fmt, std::chrono::year{-999}); + check(SV("%C='-1'\t%y=''\t%Y='-0099'\t\n"), fmt, std::chrono::year{-99}); + check(SV("%C='-1'\t%y=''\t%Y='-0009'\t\n"), fmt, std::chrono::year{-9}); +#else check(SV("%C='-100'\t%y='99'\t%Y='-9999'\t\n"), fmt, std::chrono::year{-9'999}); check(SV("%C='-10'\t%y='99'\t%Y='-0999'\t\n"), fmt, std::chrono::year{-999}); check(SV("%C='-1'\t%y='99'\t%Y='-0099'\t\n"), fmt, std::chrono::year{-99}); check(SV("%C='-1'\t%y='09'\t%Y='-0009'\t\n"), fmt, std::chrono::year{-9}); +#endif check(SV("%C='00'\t%y='00'\t%Y='0000'\t\n"), fmt, std::chrono::year{0}); check(SV("%C='00'\t%y='09'\t%Y='0009'\t\n"), fmt, std::chrono::year{9}); check(SV("%C='00'\t%y='99'\t%Y='0099'\t\n"), fmt, std::chrono::year{99}); check(SV("%C='09'\t%y='99'\t%Y='0999'\t\n"), fmt, std::chrono::year{999}); check(SV("%C='99'\t%y='99'\t%Y='9999'\t\n"), fmt, std::chrono::year{9'999}); +#ifdef _WIN32 + check(SV("%C='100'\t%y=''\t%Y=''\t\n"), fmt, std::chrono::year{10'000}); +#else check(SV("%C='100'\t%y='00'\t%Y='10000'\t\n"), fmt, std::chrono::year{10'000}); +#endif } template diff --git a/libcxx/test/std/time/time.syn/formatter.year_month_day.pass.cpp b/libcxx/test/std/time/time.syn/formatter.year_month_day.pass.cpp --- a/libcxx/test/std/time/time.syn/formatter.year_month_day.pass.cpp +++ b/libcxx/test/std/time/time.syn/formatter.year_month_day.pass.cpp @@ -11,15 +11,15 @@ // UNSUPPORTED: no-localization // UNSUPPORTED: libcpp-has-no-incomplete-format -// TODO FMT Investigate Windows issues. -// UNSUPPORTED: msvc, target={{.+}}-windows-gnu - // TODO FMT It seems GCC uses too much memory in the CI and fails. // UNSUPPORTED: gcc-12 // TODO FMT This test should not require std::to_chars(floating-point) // XFAIL: availability-fp_to_chars-missing +// TODO FMT Investigate Windows issues. +// XFAIL: msvc + // REQUIRES: locale.fr_FR.UTF-8 // REQUIRES: locale.ja_JP.UTF-8 @@ -67,6 +67,17 @@ std::chrono::year_month_day{std::chrono::year{1970}, std::chrono::month{2}, std::chrono::day{31}}); // Valid year, invalid month, valid day +#ifdef _WIN32 + check(SV(" is not a valid date"), + SV("{}"), + std::chrono::year_month_day{std::chrono::year{1970}, std::chrono::month{0}, std::chrono::day{31}}); + check(SV("****** is not a valid date******"), + SV("{:*^32}"), + std::chrono::year_month_day{std::chrono::year{1970}, std::chrono::month{0}, std::chrono::day{31}}); + check(SV("*********** is not a valid date"), + SV("{:*>31}"), + std::chrono::year_month_day{std::chrono::year{1970}, std::chrono::month{0}, std::chrono::day{31}}); +#else // _WIN32 check(SV("1970-00-31 is not a valid date"), SV("{}"), std::chrono::year_month_day{std::chrono::year{1970}, std::chrono::month{0}, std::chrono::day{31}}); @@ -76,8 +87,20 @@ check(SV("*1970-00-31 is not a valid date"), SV("{:*>31}"), std::chrono::year_month_day{std::chrono::year{1970}, std::chrono::month{0}, std::chrono::day{31}}); +#endif // _WIN32 // Valid year, invalid month, invalid day +#ifdef _WIN32 + check(SV(" is not a valid date"), + SV("{}"), + std::chrono::year_month_day{std::chrono::year{1970}, std::chrono::month{0}, std::chrono::day{32}}); + check(SV("****** is not a valid date******"), + SV("{:*^32}"), + std::chrono::year_month_day{std::chrono::year{1970}, std::chrono::month{0}, std::chrono::day{32}}); + check(SV("*********** is not a valid date"), + SV("{:*>31}"), + std::chrono::year_month_day{std::chrono::year{1970}, std::chrono::month{0}, std::chrono::day{32}}); +#else // _WIN32 check(SV("1970-00-32 is not a valid date"), SV("{}"), std::chrono::year_month_day{std::chrono::year{1970}, std::chrono::month{0}, std::chrono::day{32}}); @@ -87,6 +110,7 @@ check(SV("*1970-00-32 is not a valid date"), SV("{:*>31}"), std::chrono::year_month_day{std::chrono::year{1970}, std::chrono::month{0}, std::chrono::day{32}}); +#endif // _WIN32 // Invalid year, valid month, valid day check(SV("-32768-01-31 is not a valid date"), @@ -400,9 +424,15 @@ std::locale::global(std::locale(LOCALE_fr_FR_UTF_8)); // Non localized output using C-locale +#ifdef _WIN32 + check(SV("%b='Jan'\t%B='January'\t%h='Jan'\t%m='01'\t%Om='01'\t%d=''\t%e=''\t%Od=''\t%Oe=''\n"), + fmt, + std::chrono::year_month_day{std::chrono::year{1970}, std::chrono::January, std::chrono::day{0}}); +#else check(SV("%b='Jan'\t%B='January'\t%h='Jan'\t%m='01'\t%Om='01'\t%d='00'\t%e=' 0'\t%Od='00'\t%Oe=' 0'\n"), fmt, std::chrono::year_month_day{std::chrono::year{1970}, std::chrono::January, std::chrono::day{0}}); +#endif check(SV("%b='Feb'\t%B='February'\t%h='Feb'\t%m='02'\t%Om='02'\t%d='01'\t%e=' 1'\t%Od='01'\t%Oe=' 1'\n"), fmt, std::chrono::year_month_day{std::chrono::year{1970}, std::chrono::February, std::chrono::day{1}}); @@ -424,27 +454,42 @@ check(SV("%b='Aug'\t%B='August'\t%h='Aug'\t%m='08'\t%Om='08'\t%d='31'\t%e='31'\t%Od='31'\t%Oe='31'\n"), fmt, std::chrono::year_month_day{std::chrono::year{1970}, std::chrono::August, std::chrono::day{31}}); +#ifdef _WIN32 + check(SV("%b='Sep'\t%B='September'\t%h='Sep'\t%m='09'\t%Om='09'\t%d=''\t%e=''\t%Od=''\t%Oe=''\n"), + fmt, + std::chrono::year_month_day{std::chrono::year{1970}, std::chrono::September, std::chrono::day{32}}); + check(SV("%b='Oct'\t%B='October'\t%h='Oct'\t%m='10'\t%Om='10'\t%d=''\t%e=''\t%Od=''\t%Oe=''\n"), + fmt, + std::chrono::year_month_day{std::chrono::year{1970}, std::chrono::October, std::chrono::day{99}}); + check(SV("%b='Nov'\t%B='November'\t%h='Nov'\t%m='11'\t%Om='11'\t%d=''\t%e=''\t%Od=''\t%Oe=''\n"), + fmt, + std::chrono::year_month_day{std::chrono::year{1970}, std::chrono::November, std::chrono::day{100}}); + check(SV("%b='Dec'\t%B='December'\t%h='Dec'\t%m='12'\t%Om='12'\t%d=''\t%e=''\t%Od=''\t%Oe=''\n"), + fmt, + std::chrono::year_month_day{std::chrono::year{1970}, std::chrono::December, std::chrono::day{255}}); +#else // _WIN32 check(SV("%b='Sep'\t%B='September'\t%h='Sep'\t%m='09'\t%Om='09'\t%d='32'\t%e='32'\t%Od='32'\t%Oe='32'\n"), fmt, std::chrono::year_month_day{std::chrono::year{1970}, std::chrono::September, std::chrono::day{32}}); check(SV("%b='Oct'\t%B='October'\t%h='Oct'\t%m='10'\t%Om='10'\t%d='99'\t%e='99'\t%Od='99'\t%Oe='99'\n"), fmt, std::chrono::year_month_day{std::chrono::year{1970}, std::chrono::October, std::chrono::day{99}}); -#if defined(_AIX) +# if defined(_AIX) check(SV("%b='Nov'\t%B='November'\t%h='Nov'\t%m='11'\t%Om='11'\t%d='00'\t%e=' 0'\t%Od='00'\t%Oe=' 0'\n"), fmt, std::chrono::year_month_day{std::chrono::year{1970}, std::chrono::November, std::chrono::day{100}}); check(SV("%b='Dec'\t%B='December'\t%h='Dec'\t%m='12'\t%Om='12'\t%d='55'\t%e='55'\t%Od='55'\t%Oe='55'\n"), fmt, std::chrono::year_month_day{std::chrono::year{1970}, std::chrono::December, std::chrono::day{255}}); -#else // defined(_AIX) +# else // defined(_AIX) check(SV("%b='Nov'\t%B='November'\t%h='Nov'\t%m='11'\t%Om='11'\t%d='100'\t%e='100'\t%Od='100'\t%Oe='100'\n"), fmt, std::chrono::year_month_day{std::chrono::year{1970}, std::chrono::November, std::chrono::day{100}}); check(SV("%b='Dec'\t%B='December'\t%h='Dec'\t%m='12'\t%Om='12'\t%d='255'\t%e='255'\t%Od='255'\t%Oe='255'\n"), fmt, std::chrono::year_month_day{std::chrono::year{1970}, std::chrono::December, std::chrono::day{255}}); -#endif // defined(_AIX) +# endif // defined(_AIX) +#endif // _WIN32 // Use the global locale (fr_FR) #if defined(__APPLE__) @@ -484,10 +529,16 @@ check(SV("%b='déc'\t%B='décembre'\t%h='déc'\t%m='12'\t%Om='12'\t%d='255'\t%e='255'\t%Od='255'\t%Oe='255'\n"), lfmt, std::chrono::year_month_day{std::chrono::year{1970}, std::chrono::December, std::chrono::day{255}}); -#else // defined(__APPLE__) +#else // defined(__APPLE__) +# ifdef _WIN32 + check(SV("%b='janv.'\t%B='janvier'\t%h='janv.'\t%m='01'\t%Om='01'\t%d=''\t%e=''\t%Od=''\t%Oe=''\n"), + lfmt, + std::chrono::year_month_day{std::chrono::year{1970}, std::chrono::January, std::chrono::day{0}}); +# else check(SV("%b='janv.'\t%B='janvier'\t%h='janv.'\t%m='01'\t%Om='01'\t%d='00'\t%e=' 0'\t%Od='00'\t%Oe=' 0'\n"), lfmt, std::chrono::year_month_day{std::chrono::year{1970}, std::chrono::January, std::chrono::day{0}}); +# endif check(SV("%b='févr.'\t%B='février'\t%h='févr.'\t%m='02'\t%Om='02'\t%d='01'\t%e=' 1'\t%Od='01'\t%Oe=' 1'\n"), lfmt, std::chrono::year_month_day{std::chrono::year{1970}, std::chrono::February, std::chrono::day{1}}); @@ -514,77 +565,92 @@ check(SV("%b='août'\t%B='août'\t%h='août'\t%m='08'\t%Om='08'\t%d='31'\t%e='31'\t%Od='31'\t%Oe='31'\n"), lfmt, std::chrono::year_month_day{std::chrono::year{1970}, std::chrono::August, std::chrono::day{31}}); +# ifdef _WIN32 + check(SV("%b='sept.'\t%B='septembre'\t%h='sept.'\t%m='09'\t%Om='09'\t%d=''\t%e=''\t%Od=''\t%Oe=''\n"), + lfmt, + std::chrono::year_month_day{std::chrono::year{1970}, std::chrono::September, std::chrono::day{32}}); + check(SV("%b='oct.'\t%B='octobre'\t%h='oct.'\t%m='10'\t%Om='10'\t%d=''\t%e=''\t%Od=''\t%Oe=''\n"), + lfmt, + std::chrono::year_month_day{std::chrono::year{1970}, std::chrono::October, std::chrono::day{99}}); + check(SV("%b='nov.'\t%B='novembre'\t%h='nov.'\t%m='11'\t%Om='11'\t%d=''\t%e=''\t%Od=''\t%Oe=''\n"), + lfmt, + std::chrono::year_month_day{std::chrono::year{1970}, std::chrono::November, std::chrono::day{100}}); + check(SV("%b='déc.'\t%B='décembre'\t%h='déc.'\t%m='12'\t%Om='12'\t%d=''\t%e=''\t%Od=''\t%Oe=''\n"), + lfmt, + std::chrono::year_month_day{std::chrono::year{1970}, std::chrono::December, std::chrono::day{255}}); +# else // _WIN32 check(SV("%b='sept.'\t%B='septembre'\t%h='sept.'\t%m='09'\t%Om='09'\t%d='32'\t%e='32'\t%Od='32'\t%Oe='32'\n"), lfmt, std::chrono::year_month_day{std::chrono::year{1970}, std::chrono::September, std::chrono::day{32}}); check(SV("%b='oct.'\t%B='octobre'\t%h='oct.'\t%m='10'\t%Om='10'\t%d='99'\t%e='99'\t%Od='99'\t%Oe='99'\n"), lfmt, std::chrono::year_month_day{std::chrono::year{1970}, std::chrono::October, std::chrono::day{99}}); -# if defined(_AIX) +# if defined(_AIX) check(SV("%b='nov.'\t%B='novembre'\t%h='nov.'\t%m='11'\t%Om='11'\t%d='00'\t%e=' 0'\t%Od='00'\t%Oe=' 0'\n"), lfmt, std::chrono::year_month_day{std::chrono::year{1970}, std::chrono::November, std::chrono::day{100}}); check(SV("%b='déc.'\t%B='décembre'\t%h='déc.'\t%m='12'\t%Om='12'\t%d='55'\t%e='55'\t%Od='55'\t%Oe='55'\n"), lfmt, std::chrono::year_month_day{std::chrono::year{1970}, std::chrono::December, std::chrono::day{255}}); -# else // defined(_AIX) +# else // defined(_AIX) check(SV("%b='nov.'\t%B='novembre'\t%h='nov.'\t%m='11'\t%Om='11'\t%d='100'\t%e='100'\t%Od='100'\t%Oe='100'\n"), lfmt, std::chrono::year_month_day{std::chrono::year{1970}, std::chrono::November, std::chrono::day{100}}); check(SV("%b='déc.'\t%B='décembre'\t%h='déc.'\t%m='12'\t%Om='12'\t%d='255'\t%e='255'\t%Od='255'\t%Oe='255'\n"), lfmt, std::chrono::year_month_day{std::chrono::year{1970}, std::chrono::December, std::chrono::day{255}}); -# endif // defined(_AIX) -#endif // defined(__APPLE__) +# endif // defined(_AIX) +# endif // _WIN32 +#endif // defined(__APPLE__) // Use supplied locale (ja_JP) #if defined(_WIN32) check(loc, - SV("%b='1'\t%B='1月'\t%h='1'\t%m='01'\t%Om='01'\t%d='00'\t%e=' 0'\t%Od='〇'\t%Oe='〇'\n"), + SV("%b='1'\t%B='1月'\t%h='1'\t%m='01'\t%Om='01'\t%d=''\t%e=''\t%Od=''\t%Oe=''\n"), lfmt, std::chrono::year_month_day{std::chrono::year{1970}, std::chrono::January, std::chrono::day{0}}); check(loc, - SV("%b='2'\t%B='2月'\t%h='2'\t%m='02'\t%Om='02'\t%d='01'\t%e=' 1'\t%Od='一'\t%Oe='一'\n"), + SV("%b='2'\t%B='2月'\t%h='2'\t%m='02'\t%Om='02'\t%d='01'\t%e=' 1'\t%Od='01'\t%Oe=' 1'\n"), lfmt, std::chrono::year_month_day{std::chrono::year{1970}, std::chrono::February, std::chrono::day{1}}); check(loc, - SV("%b='3'\t%B='3月'\t%h='3'\t%m='03'\t%Om='03'\t%d='09'\t%e=' 9'\t%Od='九'\t%Oe='九'\n"), + SV("%b='3'\t%B='3月'\t%h='3'\t%m='03'\t%Om='03'\t%d='09'\t%e=' 9'\t%Od='09'\t%Oe=' 9'\n"), lfmt, std::chrono::year_month_day{std::chrono::year{1970}, std::chrono::March, std::chrono::day{9}}); check(loc, - SV("%b='4'\t%B='4月'\t%h='4'\t%m='04'\t%Om='04'\t%d='10'\t%e='10'\t%Od='十'\t%Oe='十'\n"), + SV("%b='4'\t%B='4月'\t%h='4'\t%m='04'\t%Om='04'\t%d='10'\t%e='10'\t%Od='10'\t%Oe='10'\n"), lfmt, std::chrono::year_month_day{std::chrono::year{1970}, std::chrono::April, std::chrono::day{10}}); check(loc, - SV("%b='5'\t%B='5月'\t%h='5'\t%m='05'\t%Om='05'\t%d='28'\t%e='28'\t%Od='二十八'\t%Oe='二十八'\n"), + SV("%b='5'\t%B='5月'\t%h='5'\t%m='05'\t%Om='05'\t%d='28'\t%e='28'\t%Od='28'\t%Oe='28'\n"), lfmt, std::chrono::year_month_day{std::chrono::year{1970}, std::chrono::May, std::chrono::day{28}}); check(loc, - SV("%b='6'\t%B='6月'\t%h='6'\t%m='06'\t%Om='06'\t%d='29'\t%e='29'\t%Od='二十九'\t%Oe='二十九'\n"), + SV("%b='6'\t%B='6月'\t%h='6'\t%m='06'\t%Om='06'\t%d='29'\t%e='29'\t%Od='29'\t%Oe='29'\n"), lfmt, std::chrono::year_month_day{std::chrono::year{1970}, std::chrono::June, std::chrono::day{29}}); check(loc, - SV("%b='7'\t%B='7月'\t%h='7'\t%m='07'\t%Om='07'\t%d='30'\t%e='30'\t%Od='三十'\t%Oe='三十'\n"), + SV("%b='7'\t%B='7月'\t%h='7'\t%m='07'\t%Om='07'\t%d='30'\t%e='30'\t%Od='30'\t%Oe='30'\n"), lfmt, std::chrono::year_month_day{std::chrono::year{1970}, std::chrono::July, std::chrono::day{30}}); check(loc, - SV("%b='8'\t%B='8月'\t%h='8'\t%m='08'\t%Om='08'\t%d='31'\t%e='31'\t%Od='三十一'\t%Oe='三十一'\n"), + SV("%b='8'\t%B='8月'\t%h='8'\t%m='08'\t%Om='08'\t%d='31'\t%e='31'\t%Od='31'\t%Oe='31'\n"), lfmt, std::chrono::year_month_day{std::chrono::year{1970}, std::chrono::August, std::chrono::day{31}}); check(loc, - SV("%b='9'\t%B='9月'\t%h='9'\t%m='09'\t%Om='09'\t%d='32'\t%e='32'\t%Od='三十二'\t%Oe='三十二'\n"), + SV("%b='9'\t%B='9月'\t%h='9'\t%m='09'\t%Om='09'\t%d=''\t%e=''\t%Od=''\t%Oe=''\n"), lfmt, std::chrono::year_month_day{std::chrono::year{1970}, std::chrono::September, std::chrono::day{32}}); check(loc, - SV("%b='10'\t%B='10月'\t%h='10'\t%m='10'\t%Om='10'\t%d='99'\t%e='99'\t%Od='九十九'\t%Oe='九十九'\n"), + SV("%b='10'\t%B='10月'\t%h='10'\t%m='10'\t%Om='10'\t%d=''\t%e=''\t%Od=''\t%Oe=''\n"), lfmt, std::chrono::year_month_day{std::chrono::year{1970}, std::chrono::October, std::chrono::day{99}}); check(loc, - SV("%b='11'\t%B='11月'\t%h='11'\t%m='11'\t%Om='11'\t%d='100'\t%e='100'\t%Od='100'\t%Oe='100'\n"), + SV("%b='11'\t%B='11月'\t%h='11'\t%m='11'\t%Om='11'\t%d=''\t%e=''\t%Od=''\t%Oe=''\n"), lfmt, std::chrono::year_month_day{std::chrono::year{1970}, std::chrono::November, std::chrono::day{100}}); check(loc, - SV("%b='12'\t%B='12月'\t%h='12'\t%m='12'\t%Om='12'\t%d='255'\t%e='255'\t%Od='255'\t%Oe='255'\n"), + SV("%b='12'\t%B='12月'\t%h='12'\t%m='12'\t%Om='12'\t%d=''\t%e=''\t%Od=''\t%Oe=''\n"), lfmt, std::chrono::year_month_day{std::chrono::year{1970}, std::chrono::December, std::chrono::day{255}}); #elif defined(_AIX) // defined(_WIN32) @@ -948,14 +1014,14 @@ "%V='01'\t" "%w='4'\t" "%W='00'\t" -#if defined(__APPLE__) || defined(_AIX) +#if defined(__APPLE__) || defined(_AIX) || defined(_WIN32) "%x='1970/01/01'\t" -#else // defined(__APPLE__) || defined(_AIX) +#else // defined(__APPLE__) || defined(_AIX) || defined(_WIN32) "%x='1970年01月01日'\t" -#endif // defined(__APPLE__) || defined(_AIX) +#endif // defined(__APPLE__) || defined(_AIX) || defined(_WIN32) "%y='70'\t" "%Y='1970'\t" -#if defined(__APPLE__) || defined(_AIX) +#if defined(__APPLE__) || defined(_AIX) || defined(_WIN32) "%Ex='1970/01/01'\t" "%EC='19'\t" "%Ey='70'\t" @@ -966,7 +1032,7 @@ "%Ow='4'\t" "%OW='00'\t" "%Oy='70'\t" -#else // defined(__APPLE__) || defined(_AIX) +#else // defined(__APPLE__) || defined(_AIX) || defined(_WIN32) "%Ex='昭和45年01月01日'\t" "%EC='昭和'\t" "%Ey='45'\t" @@ -977,7 +1043,7 @@ "%Ow='四'\t" "%OW='〇'\t" "%Oy='七十'\t" -#endif // defined(__APPLE__) || defined(_AIX) +#endif // defined(__APPLE__) || defined(_AIX) || defined(_WIN32) "\n"), lfmt, std::chrono::year_month_day{std::chrono::year{1970}, std::chrono::January, std::chrono::day{1}}); @@ -995,14 +1061,14 @@ "%V='22'\t" "%w='6'\t" "%W='21'\t" -#if defined(__APPLE__) || defined(_AIX) +#if defined(__APPLE__) || defined(_AIX) || defined(_WIN32) "%x='2004/05/29'\t" -#else // defined(__APPLE__) || defined(_AIX) +#else // defined(__APPLE__) || defined(_AIX) || defined(_WIN32) "%x='2004年05月29日'\t" -#endif // defined(__APPLE__) || defined(_AIX) +#endif // defined(__APPLE__) || defined(_AIX) || defined(_WIN32) "%y='04'\t" "%Y='2004'\t" -#if defined(__APPLE__) || defined(_AIX) +#if defined(__APPLE__) || defined(_AIX) || defined(_WIN32) "%Ex='2004/05/29'\t" "%EC='20'\t" "%Ey='04'\t" @@ -1013,7 +1079,7 @@ "%Ow='6'\t" "%OW='21'\t" "%Oy='04'\t" -#else // defined(__APPLE__) || defined(_AIX) +#else // defined(__APPLE__) || defined(_AIX) || defined(_WIN32) "%Ex='平成16年05月29日'\t" "%EC='平成'\t" "%Ey='16'\t" @@ -1024,7 +1090,7 @@ "%Ow='六'\t" "%OW='二十一'\t" "%Oy='四'\t" -#endif // defined(__APPLE__) || defined(_AIX) +#endif // defined(__APPLE__) || defined(_AIX) || defined(_WIN32) "\n"), lfmt, std::chrono::year_month_day{std::chrono::year{2004}, std::chrono::May, std::chrono::day{29}}); diff --git a/libcxx/test/std/time/time.syn/formatter_tests.h b/libcxx/test/std/time/time.syn/formatter_tests.h --- a/libcxx/test/std/time/time.syn/formatter_tests.h +++ b/libcxx/test/std/time/time.syn/formatter_tests.h @@ -8,6 +8,8 @@ #ifndef TEST_STD_TIME_TIME_SYN_FORMATTER_TESTS_H #define TEST_STD_TIME_TIME_SYN_FORMATTER_TESTS_H +#include "assert_macros.h" +#include "concat_macros.h" #include "make_string.h" #include "string_literal.h" #include "test_format_string.h" @@ -34,11 +36,9 @@ template void check(std::basic_string_view expected, test_format_string fmt, Args&&... args) { std::basic_string out = std::format(fmt, std::forward(args)...); - if constexpr (std::same_as) - if (out != expected) - std::cerr << "\nFormat string " << fmt.get() << "\nExpected output " << expected << "\nActual output " << out - << '\n'; - assert(out == expected); + TEST_REQUIRE(out == expected, + TEST_WRITE_CONCATENATED( + "\nFormat string ", fmt.get(), "\nExpected output ", expected, "\nActual output ", out, '\n')); } template @@ -47,38 +47,24 @@ test_format_string fmt, Args&&... args) { std::basic_string out = std::format(loc, fmt, std::forward(args)...); - if constexpr (std::same_as) - if (out != expected) - std::cerr << "\nFormat string " << fmt.get() << "\nExpected output " << expected << "\nActual output " << out - << '\n'; - assert(out == expected); + TEST_REQUIRE(out == expected, + TEST_WRITE_CONCATENATED( + "\nFormat string ", fmt.get(), "\nExpected output ", expected, "\nActual output ", out, '\n')); } template void check_exception([[maybe_unused]] std::string_view what, [[maybe_unused]] std::basic_string_view fmt, [[maybe_unused]] const Args&... args) { -#ifndef TEST_HAS_NO_EXCEPTIONS - try { - TEST_IGNORE_NODISCARD std::vformat(fmt, std::make_format_args>(args...)); - if constexpr (std::same_as) - std::cerr << "\nFormat string " << fmt << "\nDidn't throw an exception.\n"; - assert(false); - } catch (const std::format_error& e) { -# if defined(_LIBCPP_VERSION) - if constexpr (std::same_as) - if (e.what() != what) - std::cerr << "\nFormat string " << fmt << "\nExpected exception " << what << "\nActual exception " - << e.what() << '\n'; - assert(e.what() == what); -# else - (void)what; - (void)e; -# endif - return; - } - assert(false); -#endif + TEST_VALIDATE_EXCEPTION( + std::format_error, + [&]([[maybe_unused]] const std::format_error& e) { + TEST_LIBCPP_REQUIRE( + e.what() == what, + TEST_WRITE_CONCATENATED( + "\nFormat string ", fmt, "\nExpected exception ", what, "\nActual exception ", e.what(), '\n')); + }, + TEST_IGNORE_NODISCARD std::vformat(fmt, std::make_format_args>(args...))); } template diff --git a/libcxx/test/std/utilities/format/format.functions/unicode.pass.cpp b/libcxx/test/std/utilities/format/format.functions/unicode.pass.cpp --- a/libcxx/test/std/utilities/format/format.functions/unicode.pass.cpp +++ b/libcxx/test/std/utilities/format/format.functions/unicode.pass.cpp @@ -11,9 +11,6 @@ // This version runs the test when the platform has Unicode support. // UNSUPPORTED: libcpp-has-no-unicode -// TODO FMT Investigate Windows issues. -// UNSUPPORTED msvc, target={{.+}}-windows-gnu - // TODO FMT This test should not require std::to_chars(floating-point) // XFAIL: availability-fp_to_chars-missing diff --git a/libcxx/test/support/concat_macros.h b/libcxx/test/support/concat_macros.h --- a/libcxx/test/support/concat_macros.h +++ b/libcxx/test/support/concat_macros.h @@ -16,15 +16,153 @@ #include "test_macros.h" #ifndef TEST_HAS_NO_LOCALIZATION +# include +# include # include #endif #if TEST_STD_VER > 17 # ifndef TEST_HAS_NO_LOCALIZATION + +[[nodiscard]] constexpr bool test_is_high_surrogate(char32_t value) { return value >= 0xd800 && value <= 0xdbff; } + +[[nodiscard]] constexpr bool test_is_low_surrogate(char32_t value) { return value >= 0xdc00 && value <= 0xdfff; } + +[[nodiscard]] constexpr bool test_is_surrogate(char32_t value) { return value >= 0xd800 && value <= 0xdfff; } + +[[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr bool test_is_code_point(char32_t value) { return value <= 0x10ffff; } + +[[nodiscard]] constexpr bool test_is_scalar_value(char32_t value) { + return test_is_code_point(value) && !test_is_surrogate(value); +} + +inline constexpr char32_t test_replacement_character = U'\ufffd'; + +template +OutIt test_transcode() = delete; + +template + requires(std::output_iterator && std::same_as, char8_t>) +OutIt test_transcode(InIt first, InIt last, OutIt out_it) { + return std::copy(first, last, out_it); +} + +template + requires std::output_iterator +void test_encode(OutIt& out_it, char16_t value) { + if (value < 0x80) + *out_it++ = value; + else if (value < 0x800) { + *out_it++ = 0b1100'0000 | (value >> 6); + *out_it++ = 0b1000'0000 | (value & 0b0011'1111); + } else { + *out_it++ = 0b1110'0000 | (value >> 12); + *out_it++ = 0b1000'0000 | ((value) >> 6 & 0b0011'1111); + *out_it++ = 0b1000'0000 | (value & 0b0011'1111); + } +} + +template + requires std::output_iterator +void test_encode(OutIt& out_it, char32_t value) { + if ((value & 0xffff0000) == 0) + test_encode(out_it, static_cast(value)); + else { + *out_it++ = 0b1110'0000 | (value >> 18); + *out_it++ = 0b1000'0000 | ((value) >> 12 & 0b0011'1111); + *out_it++ = 0b1000'0000 | ((value) >> 6 & 0b0011'1111); + *out_it++ = 0b1000'0000 | (value & 0b0011'1111); + } +} + +template + requires(std::output_iterator && + (std::same_as, char16_t> +# ifndef TEST_HAS_NO_WIDE_CHARACTERS + || (std::same_as, wchar_t> && sizeof(wchar_t) == 2)) +# endif + ) +OutIt test_transcode(InIt first, InIt last, OutIt out_it) { + while (first != last) { + char32_t value = *first++; + + if (test_is_low_surrogate(value)) [[unlikely]] { + test_encode(out_it, static_cast(test_replacement_character)); + continue; + } + + if (!test_is_high_surrogate(value)) { + test_encode(out_it, static_cast(value)); + continue; + } + + if (first == last || !test_is_low_surrogate(static_cast(*first))) [[unlikely]] { + test_encode(out_it, static_cast(test_replacement_character)); + continue; + } + + value -= 0xd800; + value <<= 10; + value += static_cast(*first++) - 0xdc00; + value += 0x10000; + + if (test_is_code_point(value)) [[likely]] + test_encode(out_it, value); + else + test_encode(out_it, static_cast(test_replacement_character)); + } + + return out_it; +} + +template + requires(std::output_iterator && + (std::same_as, char32_t> || +# ifndef TEST_HAS_NO_WIDE_CHARACTERS + (std::same_as, wchar_t> && sizeof(wchar_t) == 4)) +# endif + ) +OutIt test_transcode(InIt first, InIt last, OutIt out_it) { + while (first != last) { + char32_t value = *first++; + if (test_is_code_point(value)) [[likely]] + test_encode(out_it, value); + else + test_encode(out_it, static_cast(test_replacement_character)); + } + return out_it; +} + template -concept test_char_streamable = requires(T&& value) { std::stringstream{} << std::forward(value); }; -# endif +concept test_streamable = requires(std::stringstream& stream, T&& value) { stream << value; }; + +template +concept test_convertable = (!test_streamable && requires(T&& value) { + std::basic_string_view{std::begin(value), std::end(value)}; +}); + +template +concept test_can_concat = test_streamable || test_convertable; + +template +std::ostream& test_concat(std::ostream& stream, T&& value) { + return stream << value; +} + +template +std::ostream& test_concat(std::ostream& stream, T&& value) { + auto b = std::begin(value); + auto e = std::end(value); + if (b != e) { + // When T is an array it's string-literal, remove the NUL terminator. + if constexpr (std::is_array_v>) + --e; + test_transcode(b, e, std::ostream_iterator{stream}); + } + return stream; +} +# endif // TEST_HAS_NO_LOCALIZATION // If possible concatenates message for the assertion function, else returns a // default message. Not being able to stream is not considered and error. For @@ -37,12 +175,12 @@ template std::string test_concat_message([[maybe_unused]] Args&&... args) { # ifndef TEST_HAS_NO_LOCALIZATION - if constexpr ((test_char_streamable && ...)) { + if constexpr ((test_can_concat && ...)) { std::stringstream sstr; - ((sstr << std::forward(args)), ...); + ((test_concat(sstr, std::forward(args))), ...); return sstr.str(); } else -# endif +# endif // TEST_HAS_NO_LOCALIZATION return "Message discarded since it can't be streamed to std::cerr.\n"; } @@ -50,5 +188,4 @@ # define TEST_WRITE_CONCATENATED(...) [&] { ::test_eprintf("%s", ::test_concat_message(__VA_ARGS__).c_str()); } #endif // TEST_STD_VER > 17 - #endif // TEST_SUPPORT_CONCAT_MACROS_H diff --git a/libcxx/utils/ci/buildkite-pipeline.yml b/libcxx/utils/ci/buildkite-pipeline.yml --- a/libcxx/utils/ci/buildkite-pipeline.yml +++ b/libcxx/utils/ci/buildkite-pipeline.yml @@ -27,695 +27,9 @@ LLVM_HEAD_VERSION: "17" GCC_STABLE_VERSION: "12" steps: - # - # Light pre-commit tests for things like formatting or when people forget - # to update generated files. - # - - label: "Format" - command: "libcxx/utils/ci/run-buildbot check-format" - artifact_paths: - - "**/clang-format.patch" - env: - GIT_CLANG_FORMAT: "/usr/bin/git-clang-format-${LLVM_STABLE_VERSION} --binary clang-format-${LLVM_STABLE_VERSION}" - CC: "clang-${LLVM_HEAD_VERSION}" - CXX: "clang++-${LLVM_HEAD_VERSION}" - agents: - queue: "libcxx-builders" - os: "linux" - retry: - automatic: - - exit_status: -1 # Agent was lost - limit: 2 - timeout_in_minutes: 120 - - - label: "Generated output" - command: "libcxx/utils/ci/run-buildbot check-generated-output" - artifact_paths: - - "**/generated_output.patch" - - "**/generated_output.status" - env: - CC: "clang-${LLVM_HEAD_VERSION}" - CXX: "clang++-${LLVM_HEAD_VERSION}" - CLANG_FORMAT: "/usr/bin/clang-format-${LLVM_STABLE_VERSION}" - agents: - queue: "libcxx-builders" - os: "linux" - retry: - automatic: - - exit_status: -1 # Agent was lost - limit: 2 - timeout_in_minutes: 120 - - - label: "Documentation" - command: "libcxx/utils/ci/run-buildbot documentation" - artifact_paths: - - "**/test-results.xml" - env: - CC: "clang-${LLVM_HEAD_VERSION}" - CXX: "clang++-${LLVM_HEAD_VERSION}" - agents: - queue: "libcxx-builders" - os: "linux" - retry: - automatic: - - exit_status: -1 # Agent was lost - limit: 2 - timeout_in_minutes: 120 - - # - # General testing with the default configuration, under all the supported - # Standard modes, with Clang and GCC. This catches most issues upfront. - # The goal of this step is to catch most issues while being very fast. - # - - wait - - - label: "GCC ${GCC_STABLE_VERSION} / C++latest" - command: "libcxx/utils/ci/run-buildbot generic-gcc" - artifact_paths: - - "**/test-results.xml" - - "**/*.abilist" - env: - CC: "gcc-${GCC_STABLE_VERSION}" - CXX: "g++-${GCC_STABLE_VERSION}" - ENABLE_CLANG_TIDY: "On" - agents: - queue: "libcxx-builders" - os: "linux" - retry: - automatic: - - exit_status: -1 # Agent was lost - limit: 2 - timeout_in_minutes: 120 - - - label: "C++2b" - command: "libcxx/utils/ci/run-buildbot generic-cxx2b" - artifact_paths: - - "**/test-results.xml" - - "**/*.abilist" - env: - CC: "clang-${LLVM_HEAD_VERSION}" - CXX: "clang++-${LLVM_HEAD_VERSION}" - ENABLE_CLANG_TIDY: "On" - agents: - queue: "libcxx-builders" - os: "linux" - retry: - automatic: - - exit_status: -1 # Agent was lost - limit: 2 - timeout_in_minutes: 120 - - - label: "Modular build" - command: "libcxx/utils/ci/run-buildbot generic-modules" - artifact_paths: - - "**/test-results.xml" - - "**/*.abilist" - env: - CC: "clang-${LLVM_HEAD_VERSION}" - CXX: "clang++-${LLVM_HEAD_VERSION}" - ENABLE_CLANG_TIDY: "On" - agents: - queue: "libcxx-builders" - os: "linux" - retry: - automatic: - - exit_status: -1 # Agent was lost - limit: 2 - timeout_in_minutes: 120 - - - label: "C++11" - command: "libcxx/utils/ci/run-buildbot generic-cxx11" - artifact_paths: - - "**/test-results.xml" - - "**/*.abilist" - env: - CC: "clang-${LLVM_HEAD_VERSION}" - CXX: "clang++-${LLVM_HEAD_VERSION}" - ENABLE_CLANG_TIDY: "On" - agents: - queue: "libcxx-builders" - os: "linux" - retry: - automatic: - - exit_status: -1 # Agent was lost - limit: 2 - timeout_in_minutes: 120 - - - label: "C++03" - command: "libcxx/utils/ci/run-buildbot generic-cxx03" - artifact_paths: - - "**/test-results.xml" - - "**/*.abilist" - env: - CC: "clang-${LLVM_HEAD_VERSION}" - CXX: "clang++-${LLVM_HEAD_VERSION}" - ENABLE_CLANG_TIDY: "On" - agents: - queue: "libcxx-builders" - os: "linux" - retry: - automatic: - - exit_status: -1 # Agent was lost - limit: 2 - timeout_in_minutes: 120 - - # - # All other supported configurations of libc++. - # - - wait - - - label: "C++20" - command: "libcxx/utils/ci/run-buildbot generic-cxx20" - artifact_paths: - - "**/test-results.xml" - - "**/*.abilist" - env: - CC: "clang-${LLVM_HEAD_VERSION}" - CXX: "clang++-${LLVM_HEAD_VERSION}" - ENABLE_CLANG_TIDY: "On" - agents: - queue: "libcxx-builders" - os: "linux" - retry: - automatic: - - exit_status: -1 # Agent was lost - limit: 2 - timeout_in_minutes: 120 - - - label: "C++17" - command: "libcxx/utils/ci/run-buildbot generic-cxx17" - artifact_paths: - - "**/test-results.xml" - - "**/*.abilist" - env: - CC: "clang-${LLVM_HEAD_VERSION}" - CXX: "clang++-${LLVM_HEAD_VERSION}" - ENABLE_CLANG_TIDY: "On" - agents: - queue: "libcxx-builders" - os: "linux" - retry: - automatic: - - exit_status: -1 # Agent was lost - limit: 2 - timeout_in_minutes: 120 - - - label: "C++14" - command: "libcxx/utils/ci/run-buildbot generic-cxx14" - artifact_paths: - - "**/test-results.xml" - - "**/*.abilist" - env: - CC: "clang-${LLVM_HEAD_VERSION}" - CXX: "clang++-${LLVM_HEAD_VERSION}" - ENABLE_CLANG_TIDY: "On" - agents: - queue: "libcxx-builders" - os: "linux" - retry: - automatic: - - exit_status: -1 # Agent was lost - limit: 2 - timeout_in_minutes: 120 - - # Tests with the supported compilers. - - label: "GCC ${GCC_STABLE_VERSION} / C++11" - command: "libcxx/utils/ci/run-buildbot generic-gcc-cxx11" - artifact_paths: - - "**/test-results.xml" - - "**/*.abilist" - env: - CC: "gcc-${GCC_STABLE_VERSION}" - CXX: "g++-${GCC_STABLE_VERSION}" - ENABLE_CLANG_TIDY: "On" - agents: - queue: "libcxx-builders" - os: "linux" - retry: - automatic: - - exit_status: -1 # Agent was lost - limit: 2 - timeout_in_minutes: 120 - - - label: "Clang 15" - command: "libcxx/utils/ci/run-buildbot generic-cxx2b" - artifact_paths: - - "**/test-results.xml" - - "**/*.abilist" - env: - CC: "clang-15" - CXX: "clang++-15" - # TODO LLVM18: Enable clang-tidy - # ENABLE_CLANG_TIDY: "On" - agents: - queue: "libcxx-builders" - os: "linux" - retry: - automatic: - - exit_status: -1 # Agent was lost - limit: 2 - timeout_in_minutes: 120 - - - label: "Clang 16" - command: "libcxx/utils/ci/run-buildbot generic-cxx2b" - artifact_paths: - - "**/test-results.xml" - - "**/*.abilist" - env: - CC: "clang-16" - CXX: "clang++-16" - ENABLE_CLANG_TIDY: "On" - agents: - queue: "libcxx-builders" - os: "linux" - retry: - automatic: - - exit_status: -1 # Agent was lost - limit: 2 - timeout_in_minutes: 120 - - # Tests with the sanitizers. - - group: "Sanitizers" - steps: - - label: "ASAN" - command: "libcxx/utils/ci/run-buildbot generic-asan" - artifact_paths: - - "**/test-results.xml" - - "**/*.abilist" - env: - CC: "clang-${LLVM_HEAD_VERSION}" - CXX: "clang++-${LLVM_HEAD_VERSION}" - ENABLE_CLANG_TIDY: "On" - agents: - queue: "libcxx-builders" - os: "linux" - retry: - automatic: - - exit_status: -1 # Agent was lost - limit: 2 - timeout_in_minutes: 120 - - - label: "TSAN" - command: "libcxx/utils/ci/run-buildbot generic-tsan" - artifact_paths: - - "**/test-results.xml" - - "**/*.abilist" - env: - CC: "clang-${LLVM_HEAD_VERSION}" - CXX: "clang++-${LLVM_HEAD_VERSION}" - ENABLE_CLANG_TIDY: "On" - agents: - queue: "libcxx-builders" - os: "linux" - retry: - automatic: - - exit_status: -1 # Agent was lost - limit: 2 - timeout_in_minutes: 120 - - - label: "UBSAN" - command: "libcxx/utils/ci/run-buildbot generic-ubsan" - artifact_paths: - - "**/test-results.xml" - - "**/*.abilist" - env: - CC: "clang-${LLVM_HEAD_VERSION}" - CXX: "clang++-${LLVM_HEAD_VERSION}" - ENABLE_CLANG_TIDY: "On" - agents: - queue: "libcxx-builders" - os: "linux" - retry: - automatic: - - exit_status: -1 # Agent was lost - limit: 2 - timeout_in_minutes: 120 - - - label: "MSAN" - command: "libcxx/utils/ci/run-buildbot generic-msan" - artifact_paths: - - "**/test-results.xml" - - "**/*.abilist" - env: - CC: "clang-${LLVM_HEAD_VERSION}" - CXX: "clang++-${LLVM_HEAD_VERSION}" - ENABLE_CLANG_TIDY: "On" - agents: - queue: "libcxx-builders" - os: "linux" - retry: - automatic: - - exit_status: -1 # Agent was lost - limit: 2 - timeout_in_minutes: 120 - - # Tests with the various supported ways to build libc++. - - label: "Bootstrapping build" - command: "libcxx/utils/ci/run-buildbot bootstrapping-build" - artifact_paths: - - "**/test-results.xml" - - "**/*.abilist" - - "**/crash_diagnostics/*" - env: - CC: "clang-${LLVM_HEAD_VERSION}" - CXX: "clang++-${LLVM_HEAD_VERSION}" - LLVM_SYMBOLIZER_PATH: "/usr/bin/llvm-symbolizer-${LLVM_HEAD_VERSION}" - CLANG_CRASH_DIAGNOSTICS_DIR: "crash_diagnostics" - agents: - queue: "libcxx-builders" - os: "linux" - retry: - automatic: - - exit_status: -1 # Agent was lost - limit: 2 - timeout_in_minutes: 120 - - # Tests with various build configurations. - - label: "Static libraries" - command: "libcxx/utils/ci/run-buildbot generic-static" - artifact_paths: - - "**/test-results.xml" - - "**/*.abilist" - env: - CC: "clang-${LLVM_HEAD_VERSION}" - CXX: "clang++-${LLVM_HEAD_VERSION}" - ENABLE_CLANG_TIDY: "On" - agents: - queue: "libcxx-builders" - os: "linux" - retry: - automatic: - - exit_status: -1 # Agent was lost - limit: 2 - timeout_in_minutes: 120 - - - label: "Shared library with merged ABI and unwinder libraries" - command: "libcxx/utils/ci/run-buildbot generic-merged" - artifact_paths: - - "**/test-results.xml" - - "**/*.abilist" - env: - CC: "clang-${LLVM_HEAD_VERSION}" - CXX: "clang++-${LLVM_HEAD_VERSION}" - ENABLE_CLANG_TIDY: "On" - agents: - queue: "libcxx-builders" - os: "linux" - retry: - automatic: - - exit_status: -1 # Agent was lost - limit: 2 - timeout_in_minutes: 120 - - - label: "Assertions enabled" - command: "libcxx/utils/ci/run-buildbot generic-assertions" - artifact_paths: - - "**/test-results.xml" - - "**/*.abilist" - env: - CC: "clang-${LLVM_HEAD_VERSION}" - CXX: "clang++-${LLVM_HEAD_VERSION}" - ENABLE_CLANG_TIDY: "On" - agents: - queue: "libcxx-builders" - os: "linux" - retry: - automatic: - - exit_status: -1 # Agent was lost - limit: 2 - timeout_in_minutes: 120 - - - label: "Debug mode" - command: "libcxx/utils/ci/run-buildbot generic-debug-mode" - artifact_paths: - - "**/test-results.xml" - - "**/*.abilist" - env: - CC: "clang-${LLVM_HEAD_VERSION}" - CXX: "clang++-${LLVM_HEAD_VERSION}" - ENABLE_CLANG_TIDY: "On" - agents: - queue: "libcxx-builders" - os: "linux" - retry: - automatic: - - exit_status: -1 # Agent was lost - limit: 2 - timeout_in_minutes: 120 - - - label: "With LLVM's libunwind" - command: "libcxx/utils/ci/run-buildbot generic-with_llvm_unwinder" - artifact_paths: - - "**/test-results.xml" - - "**/*.abilist" - env: - CC: "clang-${LLVM_HEAD_VERSION}" - CXX: "clang++-${LLVM_HEAD_VERSION}" - ENABLE_CLANG_TIDY: "On" - agents: - queue: "libcxx-builders" - os: "linux" - retry: - automatic: - - exit_status: -1 # Agent was lost - limit: 2 - timeout_in_minutes: 120 - - - label: "Modular build with Local Submodule Visibility" - command: "libcxx/utils/ci/run-buildbot generic-modules-lsv" - artifact_paths: - - "**/test-results.xml" - - "**/*.abilist" - env: - CC: "clang-${LLVM_HEAD_VERSION}" - CXX: "clang++-${LLVM_HEAD_VERSION}" - ENABLE_CLANG_TIDY: "On" - agents: - queue: "libcxx-builders" - os: "linux" - retry: - automatic: - - exit_status: -1 # Agent was lost - limit: 2 - timeout_in_minutes: 120 - - - group: "Parts disabled" - steps: - - label: "No threads" - command: "libcxx/utils/ci/run-buildbot generic-no-threads" - artifact_paths: - - "**/test-results.xml" - - "**/*.abilist" - env: - CC: "clang-${LLVM_HEAD_VERSION}" - CXX: "clang++-${LLVM_HEAD_VERSION}" - ENABLE_CLANG_TIDY: "On" - agents: - queue: "libcxx-builders" - os: "linux" - retry: - automatic: - - exit_status: -1 # Agent was lost - limit: 2 - timeout_in_minutes: 120 - - - label: "No filesystem" - command: "libcxx/utils/ci/run-buildbot generic-no-filesystem" - artifact_paths: - - "**/test-results.xml" - - "**/*.abilist" - env: - CC: "clang-${LLVM_HEAD_VERSION}" - CXX: "clang++-${LLVM_HEAD_VERSION}" - ENABLE_CLANG_TIDY: "On" - agents: - queue: "libcxx-builders" - os: "linux" - retry: - automatic: - - exit_status: -1 # Agent was lost - limit: 2 - timeout_in_minutes: 120 - - - label: "No random device" - command: "libcxx/utils/ci/run-buildbot generic-no-random_device" - artifact_paths: - - "**/test-results.xml" - - "**/*.abilist" - env: - CC: "clang-${LLVM_HEAD_VERSION}" - CXX: "clang++-${LLVM_HEAD_VERSION}" - ENABLE_CLANG_TIDY: "On" - agents: - queue: "libcxx-builders" - os: "linux" - retry: - automatic: - - exit_status: -1 # Agent was lost - limit: 2 - timeout_in_minutes: 120 - - - label: "No fstream" - command: "libcxx/utils/ci/run-buildbot generic-no-fstream" - artifact_paths: - - "**/test-results.xml" - - "**/*.abilist" - env: - CC: "clang-${LLVM_HEAD_VERSION}" - CXX: "clang++-${LLVM_HEAD_VERSION}" - ENABLE_CLANG_TIDY: "On" - agents: - queue: "libcxx-builders" - os: "linux" - retry: - automatic: - - exit_status: -1 # Agent was lost - limit: 2 - timeout_in_minutes: 120 - - - label: "No locale" - command: "libcxx/utils/ci/run-buildbot generic-no-localization" - artifact_paths: - - "**/test-results.xml" - - "**/*.abilist" - env: - CC: "clang-${LLVM_HEAD_VERSION}" - CXX: "clang++-${LLVM_HEAD_VERSION}" - ENABLE_CLANG_TIDY: "On" - agents: - queue: "libcxx-builders" - os: "linux" - retry: - automatic: - - exit_status: -1 # Agent was lost - limit: 2 - timeout_in_minutes: 120 - - - label: "No Unicode" - command: "libcxx/utils/ci/run-buildbot generic-no-unicode" - artifact_paths: - - "**/test-results.xml" - - "**/*.abilist" - env: - CC: "clang-${LLVM_HEAD_VERSION}" - CXX: "clang++-${LLVM_HEAD_VERSION}" - ENABLE_CLANG_TIDY: "On" - agents: - queue: "libcxx-builders" - os: "linux" - retry: - automatic: - - exit_status: -1 # Agent was lost - limit: 2 - timeout_in_minutes: 120 - - - label: "No wide characters" - command: "libcxx/utils/ci/run-buildbot generic-no-wide-characters" - artifact_paths: - - "**/test-results.xml" - - "**/*.abilist" - env: - CC: "clang-${LLVM_HEAD_VERSION}" - CXX: "clang++-${LLVM_HEAD_VERSION}" - ENABLE_CLANG_TIDY: "On" - agents: - queue: "libcxx-builders" - os: "linux" - retry: - automatic: - - exit_status: -1 # Agent was lost - limit: 2 - timeout_in_minutes: 120 - - - label: "No experimental features" - command: "libcxx/utils/ci/run-buildbot generic-no-experimental" - artifact_paths: - - "**/test-results.xml" - - "**/*.abilist" - env: - CC: "clang-${LLVM_HEAD_VERSION}" - CXX: "clang++-${LLVM_HEAD_VERSION}" - ENABLE_CLANG_TIDY: "On" - agents: - queue: "libcxx-builders" - os: "linux" - retry: - automatic: - - exit_status: -1 # Agent was lost - limit: 2 - timeout_in_minutes: 120 - - - label: "No exceptions" - command: "libcxx/utils/ci/run-buildbot generic-noexceptions" - artifact_paths: - - "**/test-results.xml" - - "**/*.abilist" - env: - CC: "clang-${LLVM_HEAD_VERSION}" - CXX: "clang++-${LLVM_HEAD_VERSION}" - ENABLE_CLANG_TIDY: "On" - agents: - queue: "libcxx-builders" - os: "linux" - retry: - automatic: - - exit_status: -1 # Agent was lost - limit: 2 - timeout_in_minutes: 120 - - - label: "Unstable ABI" - command: "libcxx/utils/ci/run-buildbot generic-abi-unstable" - artifact_paths: - - "**/test-results.xml" - - "**/*.abilist" - env: - CC: "clang-${LLVM_HEAD_VERSION}" - CXX: "clang++-${LLVM_HEAD_VERSION}" - ENABLE_CLANG_TIDY: "On" - agents: - queue: "libcxx-builders" - os: "linux" - retry: - automatic: - - exit_status: -1 # Agent was lost - limit: 2 - timeout_in_minutes: 120 - - # Other non-testing CI jobs - - label: "Benchmarks" - command: "libcxx/utils/ci/run-buildbot benchmarks" - artifact_paths: - - "**/test-results.xml" - - "**/*.abilist" - env: - CC: "clang-${LLVM_HEAD_VERSION}" - CXX: "clang++-${LLVM_HEAD_VERSION}" - ENABLE_CLANG_TIDY: "On" - agents: - queue: "libcxx-builders" - os: "linux" - retry: - automatic: - - exit_status: -1 # Agent was lost - limit: 2 - timeout_in_minutes: 120 - # Tests on non-Unix platforms - group: ":windows: Windows" steps: - - label: "Clang-cl (DLL)" - command: "bash libcxx/utils/ci/run-buildbot clang-cl-dll" - artifact_paths: - - "**/test-results.xml" - - "**/*.abilist" - agents: - queue: "windows" - retry: - automatic: - - exit_status: -1 # Agent was lost - limit: 2 - timeout_in_minutes: 120 - - label: "Clang-cl (Static)" command: "bash libcxx/utils/ci/run-buildbot clang-cl-static" artifact_paths: @@ -729,18 +43,6 @@ limit: 2 timeout_in_minutes: 120 - - label: "Clang-cl (no vcruntime exceptions)" - command: "bash libcxx/utils/ci/run-buildbot clang-cl-no-vcruntime" - artifact_paths: - - "**/test-results.xml" - - "**/*.abilist" - agents: - queue: "windows" - retry: - automatic: - - exit_status: -1 # Agent was lost - limit: 2 - - label: "MinGW (DLL, x86_64)" command: "bash libcxx/utils/ci/run-buildbot mingw-dll" artifact_paths: @@ -754,293 +56,3 @@ limit: 2 timeout_in_minutes: 120 - - label: "MinGW (Static, x86_64)" - command: "bash libcxx/utils/ci/run-buildbot mingw-static" - artifact_paths: - - "**/test-results.xml" - - "**/*.abilist" - agents: - queue: "windows" - retry: - automatic: - - exit_status: -1 # Agent was lost - limit: 2 - timeout_in_minutes: 120 - - - label: "MinGW (DLL, i686)" - command: "bash libcxx/utils/ci/run-buildbot mingw-dll-i686" - artifact_paths: - - "**/test-results.xml" - - "**/*.abilist" - agents: - queue: "windows" - retry: - automatic: - - exit_status: -1 # Agent was lost - limit: 2 - timeout_in_minutes: 120 - - - group: ":apple: Apple" - steps: - - label: "MacOS x86_64" - command: "libcxx/utils/ci/run-buildbot generic-cxx20" - artifact_paths: - - "**/test-results.xml" - - "**/*.abilist" - agents: - queue: "libcxx-builders" - os: "macos" - arch: "x86_64" - retry: - automatic: - - exit_status: -1 # Agent was lost - limit: 2 - timeout_in_minutes: 120 - - - label: "MacOS arm64" - command: "libcxx/utils/ci/run-buildbot generic-cxx20" - artifact_paths: - - "**/test-results.xml" - - "**/*.abilist" - agents: - queue: "libcxx-builders" - os: "macos" - arch: "arm64" - retry: - automatic: - - exit_status: -1 # Agent was lost - limit: 2 - timeout_in_minutes: 120 - - - label: "MacOS with Modules" - command: "libcxx/utils/ci/run-buildbot generic-modules" - artifact_paths: - - "**/test-results.xml" - - "**/*.abilist" - agents: - queue: "libcxx-builders" - os: "macos" - retry: - automatic: - - exit_status: -1 # Agent was lost - limit: 2 - timeout_in_minutes: 120 - - # Build with the configuration we use to generate libc++.dylib on Apple platforms - - label: "Apple system" - command: "libcxx/utils/ci/run-buildbot apple-system" - artifact_paths: - - "**/test-results.xml" - - "**/*.abilist" - agents: - queue: "libcxx-builders" - os: "macos" - arch: "arm64" # This can technically run on any architecture, but we have more resources on arm64 so we pin this job to arm64 - retry: - automatic: - - exit_status: -1 # Agent was lost - limit: 2 - timeout_in_minutes: 120 - - # Test back-deployment to older Apple platforms - - label: "Apple back-deployment macosx10.9" - command: "libcxx/utils/ci/run-buildbot apple-system-backdeployment-10.9" - artifact_paths: - - "**/test-results.xml" - - "**/*.abilist" - agents: - queue: "libcxx-builders" - os: "macos" - arch: "x86_64" # We need to use x86_64 for back-deployment CI on this target since macOS didn't support arm64 back then. - retry: - automatic: - - exit_status: -1 # Agent was lost - limit: 2 - timeout_in_minutes: 120 - - - label: "Apple back-deployment macosx10.15" - command: "libcxx/utils/ci/run-buildbot apple-system-backdeployment-10.15" - artifact_paths: - - "**/test-results.xml" - - "**/*.abilist" - agents: - queue: "libcxx-builders" - os: "macos" - arch: "x86_64" # We need to use x86_64 for back-deployment CI on this target since macOS didn't support arm64 back then. - retry: - automatic: - - exit_status: -1 # Agent was lost - limit: 2 - timeout_in_minutes: 120 - - - label: "Apple back-deployment macosx11.0 arm64" - command: "libcxx/utils/ci/run-buildbot apple-system-backdeployment-11.0" - artifact_paths: - - "**/test-results.xml" - - "**/*.abilist" - agents: - queue: "libcxx-builders" - os: "macos" - arch: "arm64" - retry: - automatic: - - exit_status: -1 # Agent was lost - limit: 2 - timeout_in_minutes: 120 - - - label: "Apple back-deployment with assertions enabled" - command: "libcxx/utils/ci/run-buildbot apple-system-backdeployment-assertions-11.0" - artifact_paths: - - "**/test-results.xml" - - "**/*.abilist" - agents: - queue: "libcxx-builders" - os: "macos" - retry: - automatic: - - exit_status: -1 # Agent was lost - limit: 2 - timeout_in_minutes: 120 - - - group: "ARM" - steps: - - label: "AArch64" - command: "libcxx/utils/ci/run-buildbot aarch64" - artifact_paths: - - "**/test-results.xml" - - "**/*.abilist" - agents: - queue: "libcxx-builders-linaro-arm" - arch: "aarch64" - retry: - automatic: - - exit_status: -1 # Agent was lost - limit: 2 - timeout_in_minutes: 120 - - - label: "AArch64 -fno-exceptions" - command: "libcxx/utils/ci/run-buildbot aarch64-noexceptions" - artifact_paths: - - "**/test-results.xml" - - "**/*.abilist" - agents: - queue: "libcxx-builders-linaro-arm" - arch: "aarch64" - retry: - automatic: - - exit_status: -1 # Agent was lost - limit: 2 - timeout_in_minutes: 120 - - - label: "Armv8" - command: "libcxx/utils/ci/run-buildbot armv8" - artifact_paths: - - "**/test-results.xml" - - "**/*.abilist" - agents: - queue: "libcxx-builders-linaro-arm" - arch: "armv8l" - retry: - automatic: - - exit_status: -1 # Agent was lost - limit: 2 - timeout_in_minutes: 120 - - - label: "Armv8 -fno-exceptions" - command: "libcxx/utils/ci/run-buildbot armv8-noexceptions" - artifact_paths: - - "**/test-results.xml" - - "**/*.abilist" - agents: - queue: "libcxx-builders-linaro-arm" - arch: "armv8l" - retry: - automatic: - - exit_status: -1 # Agent was lost - limit: 2 - timeout_in_minutes: 120 - - - label: "Armv7" - command: "libcxx/utils/ci/run-buildbot armv7" - artifact_paths: - - "**/test-results.xml" - - "**/*.abilist" - agents: - queue: "libcxx-builders-linaro-arm" - arch: "armv8l" # Compiling for v7, running on v8 hardware - retry: - automatic: - - exit_status: -1 # Agent was lost - limit: 2 - timeout_in_minutes: 120 - - - label: "Armv7 -fno-exceptions" - command: "libcxx/utils/ci/run-buildbot armv7-noexceptions" - artifact_paths: - - "**/test-results.xml" - - "**/*.abilist" - agents: - queue: "libcxx-builders-linaro-arm" - arch: "armv8l" # Compiling for v7, running on v8 hardware - retry: - automatic: - - exit_status: -1 # Agent was lost - limit: 2 - timeout_in_minutes: 120 - - - group: "AIX" - steps: - - label: "AIX (32-bit)" - command: "libcxx/utils/ci/run-buildbot aix" - artifact_paths: - - "**/test-results.xml" - - "**/*.abilist" - env: - CC: "clang" - CXX: "clang++" - OBJECT_MODE: "32" - agents: - queue: libcxx-builders - os: aix - retry: - automatic: - - exit_status: -1 # Agent was lost - limit: 2 - timeout_in_minutes: 120 - - - label: "AIX (64-bit)" - command: "libcxx/utils/ci/run-buildbot aix" - artifact_paths: - - "**/test-results.xml" - - "**/*.abilist" - env: - CC: "clang" - CXX: "clang++" - OBJECT_MODE: "64" - agents: - queue: libcxx-builders - os: aix - retry: - automatic: - - exit_status: -1 # Agent was lost - limit: 2 - timeout_in_minutes: 120 - - - group: "FreeBSD" - steps: - - label: "FreeBSD 13 amd64" - command: "libcxx/utils/ci/run-buildbot generic-cxx2b" - artifact_paths: - - "**/test-results.xml" - - "**/*.abilist" - env: - CC: "clang15" - CXX: "clang++15" - agents: - queue: "libcxx-builders" - os: "freebsd" - retry: - automatic: - - exit_status: -1 # Agent was lost - limit: 2 - timeout_in_minutes: 120