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,62 +72,63 @@ 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")); + 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(_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")); + 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__) - 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")); + 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__) } 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 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,99 @@ 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")); + 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")); - assert(stream_ja_JP_locale(std::chrono::month{0}) == SV("0 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__) - 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")); + 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")); + 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__) # 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月")); + 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(_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月")); + 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(_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月")); + 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__) - 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_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,266 @@ 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]")); + 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__) - 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__) + 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]")); + 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__) # 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]")); + 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(_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]")); + 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(_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]")); + 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__) - 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{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,269 @@ 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__) + 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]")); + 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__) # 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]")); + 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(_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]")); + 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(_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]")); + 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__) - 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]")); + 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,9 +10,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 @@ -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::year year) { std::basic_stringstream sstr; @@ -66,23 +70,23 @@ 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")); + TEST_EQUAL(stream_c_locale(std::chrono::year{32'767}), SV("32767")); + + 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")); + TEST_EQUAL(stream_fr_FR_locale(std::chrono::year{32'767}), SV("32767")); + + 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")); + TEST_EQUAL(stream_ja_JP_locale(std::chrono::year{32'767}), SV("32767")); } 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,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::year_month ym) { std::basic_stringstream sstr; @@ -69,178 +73,178 @@ 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")); + 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")); + TEST_EQUAL(stream_c_locale(std::chrono::year_month{std::chrono::year{32'767}, std::chrono::month{5}}), + SV("32767/May")); + 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_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")); + 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")); + TEST_EQUAL(stream_fr_FR_locale(std::chrono::year_month{std::chrono::year{32'767}, std::chrono::month{5}}), + SV("32767/mai")); + 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_fr_FR_locale(std::chrono::year_month{std::chrono::year{1970}, std::chrono::month{4}}) == - SV("1970/avr.")); + 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_fr_FR_locale(std::chrono::year_month{std::chrono::year{1970}, std::chrono::month{4}}) == - SV("1970/avril")); + 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_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.")); + TEST_EQUAL(stream_fr_FR_locale(std::chrono::year_month{std::chrono::year{32'767}, std::chrono::month{5}}), + SV("32767/mai")); + 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__) - 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")); + 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")); - 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_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__) - 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_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")); + 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__) # 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_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(_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_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(_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月")); + 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__) - 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")); + 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,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_day ymd) { std::basic_stringstream sstr; @@ -67,77 +71,89 @@ 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")); + 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")); #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")); + 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) - 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_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")); + 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")); #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")); + 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) - 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_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")); + 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")); #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")); + 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) } 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,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::year_month_day_last ymdl) { std::basic_stringstream sstr; @@ -69,195 +73,257 @@ 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")); + 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")); + 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")); + 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/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__) - 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")); + 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")); + 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__) - 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__) + 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")); + 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__) # 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")); + 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(_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")); + 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(_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")); + 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__) - 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{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,177 +71,165 @@ 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{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{-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(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{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{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/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(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), 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{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/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}}), 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'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{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/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(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{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), 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{-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__) +#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}}) == + 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}}) == + 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__) 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,112 +71,136 @@ 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__) + 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__) # 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]")); + 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(_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]")); + 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(_WIN32) || defined(_AIX) #endif // defined(__APPLE__) } 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" @@ -412,7 +409,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 +486,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,9 +11,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 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__) @@ -379,7 +377,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__) @@ -397,7 +395,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" @@ -557,7 +555,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 +665,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()); } 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 @@ -654,7 +652,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" @@ -712,7 +710,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 +749,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()); } 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 @@ -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" @@ -714,7 +712,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 +751,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()); } 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,9 +11,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.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 @@ -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" @@ -712,7 +710,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 +749,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()); } 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,9 +11,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 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,9 +11,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.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,9 +11,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.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,9 +11,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 @@ -176,7 +173,7 @@ 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__) @@ -219,7 +216,7 @@ 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" @@ -266,7 +263,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()); } 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,9 +11,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 @@ -1002,7 +999,7 @@ #endif // defined(__APPLE__) || defined(_AIX) "%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 +1010,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 +1021,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 @@ -9,6 +9,7 @@ #ifndef TEST_SUPPORT_CONCAT_MACROS_H #define TEST_SUPPORT_CONCAT_MACROS_H +#include #include #include @@ -19,12 +20,120 @@ # include #endif +#ifdef TEST_HAS_NO_WIDE_CHARACTERS +# include +#endif #if TEST_STD_VER > 17 # ifndef TEST_HAS_NO_LOCALIZATION + +template +concept test_streamable = requires(std::basic_stringstream& stream, T value) { stream << value; }; + +template +concept test_char_streamable = test_streamable; + +# ifndef TEST_HAS_NO_WIDE_CHARACTERS + template -concept test_char_streamable = requires(T&& value) { std::stringstream{} << std::forward(value); }; -# endif +concept test_wide_char_streamable = test_streamable; + +[[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 +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, wchar_t> && + sizeof(wchar_t) == 2) +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, wchar_t> && + sizeof(wchar_t) == 4) +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; +} +# endif // TEST_HAS_NO_WIDE_CHARACTERS +# 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 @@ -42,7 +151,18 @@ ((sstr << std::forward(args)), ...); return sstr.str(); } else -# endif +# ifndef TEST_HAS_NO_WIDE_CHARACTERS + if constexpr ((test_wide_char_streamable && ...)) { + std::wstringstream wsstr; + ((wsstr << std::forward(args)), ...); + std::wstring wstr = wsstr.str(); // TODO FMT Use view + + std::string str; + test_transcode(wstr.begin(), wstr.end(), std::back_inserter(str)); + return str; + } else +# endif // TEST_HAS_NO_WIDE_CHARACTERS +# endif // TEST_HAS_NO_LOCALIZATION return "Message discarded since it can't be streamed to std::cerr.\n"; } @@ -50,5 +170,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