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 @@ -9,9 +9,6 @@ // UNSUPPORTED: c++03, c++11, c++14, c++17 // UNSUPPORTED: no-localization -// 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 @@ -35,9 +32,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; @@ -67,63 +71,70 @@ static void test() { using namespace std::literals::chrono_literals; - assert(stream_c_locale(std::chrono::month_day{std::chrono::month{0}, 0d}) == - SV("0 is not a valid month/00 is not a valid day")); - assert(stream_c_locale(std::chrono::month_day{std::chrono::month{0}, 1d}) == SV("0 is not a valid month/01")); - assert(stream_c_locale(std::chrono::month_day{std::chrono::month{1}, 255d}) == - SV("Jan/255 is not a valid day")); - assert(stream_c_locale(std::chrono::month_day{std::chrono::month{1}, 31d}) == SV("Jan/31")); + TEST_EQUAL(stream_c_locale(std::chrono::month_day{std::chrono::month{0}, 0d}), + SV("0 is not a valid month/00 is not a valid day")); + TEST_EQUAL(stream_c_locale(std::chrono::month_day{std::chrono::month{0}, 1d}), + SV("0 is not a valid month/01")); + TEST_EQUAL(stream_c_locale(std::chrono::month_day{std::chrono::month{1}, 255d}), + SV("Jan/255 is not a valid day")); + TEST_EQUAL(stream_c_locale(std::chrono::month_day{std::chrono::month{1}, 31d}), SV("Jan/31")); // February is considered valid with 29 days; it lacks the year information // to do a proper validation. - assert(stream_c_locale(std::chrono::month_day{std::chrono::month{2}, 29d}) == SV("Feb/29")); + TEST_EQUAL(stream_c_locale(std::chrono::month_day{std::chrono::month{2}, 29d}), SV("Feb/29")); // The month_day stream operator has no validation, this means never validate // dates don't get // Jun/31 is not a valid month day // which is inconsistent with other stream operators. // TODO FMT file an issue about this. - assert(stream_c_locale(std::chrono::month_day{std::chrono::month{6}, 31d}) == SV("Jun/31")); + TEST_EQUAL(stream_c_locale(std::chrono::month_day{std::chrono::month{6}, 31d}), SV("Jun/31")); - assert(stream_fr_FR_locale(std::chrono::month_day{std::chrono::month{0}, 0d}) == - SV("0 is not a valid month/00 is not a valid day")); - assert(stream_fr_FR_locale(std::chrono::month_day{std::chrono::month{0}, 1d}) == - SV("0 is not a valid month/01")); + TEST_EQUAL(stream_fr_FR_locale(std::chrono::month_day{std::chrono::month{0}, 0d}), + SV("0 is not a valid month/00 is not a valid day")); + TEST_EQUAL(stream_fr_FR_locale(std::chrono::month_day{std::chrono::month{0}, 1d}), + SV("0 is not a valid month/01")); #if defined(__APPLE__) - assert(stream_fr_FR_locale(std::chrono::month_day{std::chrono::month{1}, 255d}) == - SV("jan/255 is not a valid day")); - assert(stream_fr_FR_locale(std::chrono::month_day{std::chrono::month{1}, 31d}) == SV("jan/31")); - assert(stream_fr_FR_locale(std::chrono::month_day{std::chrono::month{2}, 29d}) == SV("fév/29")); - assert(stream_fr_FR_locale(std::chrono::month_day{std::chrono::month{6}, 31d}) == SV("jui/31")); + TEST_EQUAL(stream_fr_FR_locale(std::chrono::month_day{std::chrono::month{1}, 255d}), + SV("jan/255 is not a valid day")); + TEST_EQUAL(stream_fr_FR_locale(std::chrono::month_day{std::chrono::month{1}, 31d}), SV("jan/31")); + TEST_EQUAL(stream_fr_FR_locale(std::chrono::month_day{std::chrono::month{2}, 29d}), SV("fév/29")); + TEST_EQUAL(stream_fr_FR_locale(std::chrono::month_day{std::chrono::month{6}, 31d}), SV("jui/31")); #else // defined(__APPLE__) - assert(stream_fr_FR_locale(std::chrono::month_day{std::chrono::month{1}, 255d}) == - SV("janv./255 is not a valid day")); - assert(stream_fr_FR_locale(std::chrono::month_day{std::chrono::month{1}, 31d}) == SV("janv./31")); - assert(stream_fr_FR_locale(std::chrono::month_day{std::chrono::month{2}, 29d}) == SV("févr./29")); - assert(stream_fr_FR_locale(std::chrono::month_day{std::chrono::month{6}, 31d}) == SV("juin/31")); + TEST_EQUAL(stream_fr_FR_locale(std::chrono::month_day{std::chrono::month{1}, 255d}), + SV("janv./255 is not a valid day")); + TEST_EQUAL(stream_fr_FR_locale(std::chrono::month_day{std::chrono::month{1}, 31d}), SV("janv./31")); + TEST_EQUAL(stream_fr_FR_locale(std::chrono::month_day{std::chrono::month{2}, 29d}), SV("févr./29")); + TEST_EQUAL(stream_fr_FR_locale(std::chrono::month_day{std::chrono::month{6}, 31d}), SV("juin/31")); #endif // defined(__APPLE__) - assert(stream_ja_JP_locale(std::chrono::month_day{std::chrono::month{0}, 0d}) == - SV("0 is not a valid month/00 is not a valid day")); - assert(stream_ja_JP_locale(std::chrono::month_day{std::chrono::month{0}, 1d}) == - SV("0 is not a valid month/01")); + TEST_EQUAL(stream_ja_JP_locale(std::chrono::month_day{std::chrono::month{0}, 0d}), + SV("0 is not a valid month/00 is not a valid day")); + TEST_EQUAL(stream_ja_JP_locale(std::chrono::month_day{std::chrono::month{0}, 1d}), + SV("0 is not a valid month/01")); #if defined(__APPLE__) - assert(stream_ja_JP_locale(std::chrono::month_day{std::chrono::month{1}, 255d}) == - SV(" 1/255 is not a valid day")); - assert(stream_ja_JP_locale(std::chrono::month_day{std::chrono::month{1}, 31d}) == SV(" 1/31")); - assert(stream_ja_JP_locale(std::chrono::month_day{std::chrono::month{2}, 29d}) == SV(" 2/29")); - assert(stream_ja_JP_locale(std::chrono::month_day{std::chrono::month{6}, 31d}) == SV(" 6/31")); -#elif defined(_AIX) || defined(_WIN32) // defined(__APPLE__) - assert(stream_ja_JP_locale(std::chrono::month_day{std::chrono::month{1}, 255d}) == - SV("1月/255 is not a valid day")); - assert(stream_ja_JP_locale(std::chrono::month_day{std::chrono::month{1}, 31d}) == SV("1月/31")); - assert(stream_ja_JP_locale(std::chrono::month_day{std::chrono::month{2}, 29d}) == SV("2月/29")); - assert(stream_ja_JP_locale(std::chrono::month_day{std::chrono::month{6}, 31d}) == SV("6月/31")); -#else // defined(__APPLE__) - assert(stream_ja_JP_locale(std::chrono::month_day{std::chrono::month{1}, 255d}) == - SV(" 1月/255 is not a valid day")); - assert(stream_ja_JP_locale(std::chrono::month_day{std::chrono::month{1}, 31d}) == SV(" 1月/31")); - assert(stream_ja_JP_locale(std::chrono::month_day{std::chrono::month{2}, 29d}) == SV(" 2月/29")); - assert(stream_ja_JP_locale(std::chrono::month_day{std::chrono::month{6}, 31d}) == SV(" 6月/31")); -#endif // defined(__APPLE__) + TEST_EQUAL(stream_ja_JP_locale(std::chrono::month_day{std::chrono::month{1}, 255d}), + SV(" 1/255 is not a valid day")); + TEST_EQUAL(stream_ja_JP_locale(std::chrono::month_day{std::chrono::month{1}, 31d}), SV(" 1/31")); + TEST_EQUAL(stream_ja_JP_locale(std::chrono::month_day{std::chrono::month{2}, 29d}), SV(" 2/29")); + TEST_EQUAL(stream_ja_JP_locale(std::chrono::month_day{std::chrono::month{6}, 31d}), SV(" 6/31")); +#elif defined(_WIN32) // defined(__APPLE__) + TEST_EQUAL(stream_ja_JP_locale(std::chrono::month_day{std::chrono::month{1}, 255d}), + SV("1/255 is not a valid day")); + TEST_EQUAL(stream_ja_JP_locale(std::chrono::month_day{std::chrono::month{1}, 31d}), SV("1/31")); + TEST_EQUAL(stream_ja_JP_locale(std::chrono::month_day{std::chrono::month{2}, 29d}), SV("2/29")); + TEST_EQUAL(stream_ja_JP_locale(std::chrono::month_day{std::chrono::month{6}, 31d}), SV("6/31")); +#elif defined(_AIX) // defined(__APPLE__) + TEST_EQUAL(stream_ja_JP_locale(std::chrono::month_day{std::chrono::month{1}, 255d}), + SV("1月/255 is not a valid day")); + TEST_EQUAL(stream_ja_JP_locale(std::chrono::month_day{std::chrono::month{1}, 31d}), SV("1月/31")); + TEST_EQUAL(stream_ja_JP_locale(std::chrono::month_day{std::chrono::month{2}, 29d}), SV("2月/29")); + TEST_EQUAL(stream_ja_JP_locale(std::chrono::month_day{std::chrono::month{6}, 31d}), SV("6月/31")); +#else // defined(__APPLE__) + TEST_EQUAL(stream_ja_JP_locale(std::chrono::month_day{std::chrono::month{1}, 255d}), + SV(" 1月/255 is not a valid day")); + TEST_EQUAL(stream_ja_JP_locale(std::chrono::month_day{std::chrono::month{1}, 31d}), SV(" 1月/31")); + TEST_EQUAL(stream_ja_JP_locale(std::chrono::month_day{std::chrono::month{2}, 29d}), SV(" 2月/29")); + TEST_EQUAL(stream_ja_JP_locale(std::chrono::month_day{std::chrono::month{6}, 31d}), SV(" 6月/31")); +#endif // defined(__APPLE__) } int main(int, char**) { diff --git a/libcxx/test/std/time/time.cal/time.cal.mdlast/ostream.pass.cpp b/libcxx/test/std/time/time.cal/time.cal.mdlast/ostream.pass.cpp --- a/libcxx/test/std/time/time.cal/time.cal.mdlast/ostream.pass.cpp +++ b/libcxx/test/std/time/time.cal/time.cal.mdlast/ostream.pass.cpp @@ -11,9 +11,6 @@ // UNSUPPORTED: c++03, c++11, c++14, c++17 // UNSUPPORTED: no-localization -// 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 @@ -38,9 +35,16 @@ #include "make_string.h" #include "platform_support.h" // locale name macros #include "test_macros.h" +#include "assert_macros.h" +#include "concat_macros.h" #define SV(S) MAKE_STRING_VIEW(CharT, S) +#define TEST_EQUAL(OUT, EXPECTED) \ + TEST_REQUIRE(OUT == EXPECTED, \ + TEST_WRITE_CONCATENATED( \ + "\nExpression ", #OUT, "\nExpected output ", EXPECTED, "\nActual output ", OUT, '\n')); + template static std::basic_string stream_c_locale(std::chrono::month_day_last mdl) { std::basic_stringstream sstr; @@ -68,108 +72,120 @@ template static void test() { - assert(stream_c_locale(std::chrono::month_day_last{std::chrono::month{0}}) == - SV("0 is not a valid month/last")); - assert(stream_c_locale(std::chrono::month_day_last{std::chrono::month{1}}) == SV("Jan/last")); - assert(stream_c_locale(std::chrono::month_day_last{std::chrono::month{2}}) == SV("Feb/last")); - assert(stream_c_locale(std::chrono::month_day_last{std::chrono::month{3}}) == SV("Mar/last")); - assert(stream_c_locale(std::chrono::month_day_last{std::chrono::month{4}}) == SV("Apr/last")); - assert(stream_c_locale(std::chrono::month_day_last{std::chrono::month{5}}) == SV("May/last")); - assert(stream_c_locale(std::chrono::month_day_last{std::chrono::month{6}}) == SV("Jun/last")); - assert(stream_c_locale(std::chrono::month_day_last{std::chrono::month{7}}) == SV("Jul/last")); - assert(stream_c_locale(std::chrono::month_day_last{std::chrono::month{8}}) == SV("Aug/last")); - assert(stream_c_locale(std::chrono::month_day_last{std::chrono::month{9}}) == SV("Sep/last")); - assert(stream_c_locale(std::chrono::month_day_last{std::chrono::month{10}}) == SV("Oct/last")); - assert(stream_c_locale(std::chrono::month_day_last{std::chrono::month{11}}) == SV("Nov/last")); - assert(stream_c_locale(std::chrono::month_day_last{std::chrono::month{12}}) == SV("Dec/last")); - assert(stream_c_locale(std::chrono::month_day_last{std::chrono::month{13}}) == - SV("13 is not a valid month/last")); - assert(stream_c_locale(std::chrono::month_day_last{std::chrono::month{255}}) == - SV("255 is not a valid month/last")); - - assert(stream_fr_FR_locale(std::chrono::month_day_last{std::chrono::month{0}}) == - SV("0 is not a valid month/last")); + TEST_EQUAL(stream_c_locale(std::chrono::month_day_last{std::chrono::month{0}}), + SV("0 is not a valid month/last")); + TEST_EQUAL(stream_c_locale(std::chrono::month_day_last{std::chrono::month{1}}), SV("Jan/last")); + TEST_EQUAL(stream_c_locale(std::chrono::month_day_last{std::chrono::month{2}}), SV("Feb/last")); + TEST_EQUAL(stream_c_locale(std::chrono::month_day_last{std::chrono::month{3}}), SV("Mar/last")); + TEST_EQUAL(stream_c_locale(std::chrono::month_day_last{std::chrono::month{4}}), SV("Apr/last")); + TEST_EQUAL(stream_c_locale(std::chrono::month_day_last{std::chrono::month{5}}), SV("May/last")); + TEST_EQUAL(stream_c_locale(std::chrono::month_day_last{std::chrono::month{6}}), SV("Jun/last")); + TEST_EQUAL(stream_c_locale(std::chrono::month_day_last{std::chrono::month{7}}), SV("Jul/last")); + TEST_EQUAL(stream_c_locale(std::chrono::month_day_last{std::chrono::month{8}}), SV("Aug/last")); + TEST_EQUAL(stream_c_locale(std::chrono::month_day_last{std::chrono::month{9}}), SV("Sep/last")); + TEST_EQUAL(stream_c_locale(std::chrono::month_day_last{std::chrono::month{10}}), SV("Oct/last")); + TEST_EQUAL(stream_c_locale(std::chrono::month_day_last{std::chrono::month{11}}), SV("Nov/last")); + TEST_EQUAL(stream_c_locale(std::chrono::month_day_last{std::chrono::month{12}}), SV("Dec/last")); + TEST_EQUAL(stream_c_locale(std::chrono::month_day_last{std::chrono::month{13}}), + SV("13 is not a valid month/last")); + TEST_EQUAL(stream_c_locale(std::chrono::month_day_last{std::chrono::month{255}}), + SV("255 is not a valid month/last")); + + TEST_EQUAL(stream_fr_FR_locale(std::chrono::month_day_last{std::chrono::month{0}}), + SV("0 is not a valid month/last")); #if defined(__APPLE__) - assert(stream_fr_FR_locale(std::chrono::month_day_last{std::chrono::month{1}}) == SV("jan/last")); - assert(stream_fr_FR_locale(std::chrono::month_day_last{std::chrono::month{2}}) == SV("fév/last")); - assert(stream_fr_FR_locale(std::chrono::month_day_last{std::chrono::month{3}}) == SV("mar/last")); - assert(stream_fr_FR_locale(std::chrono::month_day_last{std::chrono::month{4}}) == SV("avr/last")); - assert(stream_fr_FR_locale(std::chrono::month_day_last{std::chrono::month{5}}) == SV("mai/last")); - assert(stream_fr_FR_locale(std::chrono::month_day_last{std::chrono::month{6}}) == SV("jui/last")); - assert(stream_fr_FR_locale(std::chrono::month_day_last{std::chrono::month{7}}) == SV("jul/last")); - assert(stream_fr_FR_locale(std::chrono::month_day_last{std::chrono::month{8}}) == SV("aoû/last")); - assert(stream_fr_FR_locale(std::chrono::month_day_last{std::chrono::month{9}}) == SV("sep/last")); - assert(stream_fr_FR_locale(std::chrono::month_day_last{std::chrono::month{10}}) == SV("oct/last")); - assert(stream_fr_FR_locale(std::chrono::month_day_last{std::chrono::month{11}}) == SV("nov/last")); - assert(stream_fr_FR_locale(std::chrono::month_day_last{std::chrono::month{12}}) == SV("déc/last")); + TEST_EQUAL(stream_fr_FR_locale(std::chrono::month_day_last{std::chrono::month{1}}), SV("jan/last")); + TEST_EQUAL(stream_fr_FR_locale(std::chrono::month_day_last{std::chrono::month{2}}), SV("fév/last")); + TEST_EQUAL(stream_fr_FR_locale(std::chrono::month_day_last{std::chrono::month{3}}), SV("mar/last")); + TEST_EQUAL(stream_fr_FR_locale(std::chrono::month_day_last{std::chrono::month{4}}), SV("avr/last")); + TEST_EQUAL(stream_fr_FR_locale(std::chrono::month_day_last{std::chrono::month{5}}), SV("mai/last")); + TEST_EQUAL(stream_fr_FR_locale(std::chrono::month_day_last{std::chrono::month{6}}), SV("jui/last")); + TEST_EQUAL(stream_fr_FR_locale(std::chrono::month_day_last{std::chrono::month{7}}), SV("jul/last")); + TEST_EQUAL(stream_fr_FR_locale(std::chrono::month_day_last{std::chrono::month{8}}), SV("aoû/last")); + TEST_EQUAL(stream_fr_FR_locale(std::chrono::month_day_last{std::chrono::month{9}}), SV("sep/last")); + TEST_EQUAL(stream_fr_FR_locale(std::chrono::month_day_last{std::chrono::month{10}}), SV("oct/last")); + TEST_EQUAL(stream_fr_FR_locale(std::chrono::month_day_last{std::chrono::month{11}}), SV("nov/last")); + TEST_EQUAL(stream_fr_FR_locale(std::chrono::month_day_last{std::chrono::month{12}}), SV("déc/last")); #else // defined(__APPLE__) - assert(stream_fr_FR_locale(std::chrono::month_day_last{std::chrono::month{1}}) == SV("janv./last")); - assert(stream_fr_FR_locale(std::chrono::month_day_last{std::chrono::month{2}}) == SV("févr./last")); - assert(stream_fr_FR_locale(std::chrono::month_day_last{std::chrono::month{3}}) == SV("mars/last")); + TEST_EQUAL(stream_fr_FR_locale(std::chrono::month_day_last{std::chrono::month{1}}), SV("janv./last")); + TEST_EQUAL(stream_fr_FR_locale(std::chrono::month_day_last{std::chrono::month{2}}), SV("févr./last")); + TEST_EQUAL(stream_fr_FR_locale(std::chrono::month_day_last{std::chrono::month{3}}), SV("mars/last")); # if defined(_WIN32) || defined(_AIX) - assert(stream_fr_FR_locale(std::chrono::month_day_last{std::chrono::month{4}}) == SV("avr./last")); + TEST_EQUAL(stream_fr_FR_locale(std::chrono::month_day_last{std::chrono::month{4}}), SV("avr./last")); # else - assert(stream_fr_FR_locale(std::chrono::month_day_last{std::chrono::month{4}}) == SV("avril/last")); + TEST_EQUAL(stream_fr_FR_locale(std::chrono::month_day_last{std::chrono::month{4}}), SV("avril/last")); # endif - assert(stream_fr_FR_locale(std::chrono::month_day_last{std::chrono::month{5}}) == SV("mai/last")); - assert(stream_fr_FR_locale(std::chrono::month_day_last{std::chrono::month{6}}) == SV("juin/last")); - assert(stream_fr_FR_locale(std::chrono::month_day_last{std::chrono::month{7}}) == SV("juil./last")); - assert(stream_fr_FR_locale(std::chrono::month_day_last{std::chrono::month{8}}) == SV("août/last")); - assert(stream_fr_FR_locale(std::chrono::month_day_last{std::chrono::month{9}}) == SV("sept./last")); - assert(stream_fr_FR_locale(std::chrono::month_day_last{std::chrono::month{10}}) == SV("oct./last")); - assert(stream_fr_FR_locale(std::chrono::month_day_last{std::chrono::month{11}}) == SV("nov./last")); - assert(stream_fr_FR_locale(std::chrono::month_day_last{std::chrono::month{12}}) == SV("déc./last")); + TEST_EQUAL(stream_fr_FR_locale(std::chrono::month_day_last{std::chrono::month{5}}), SV("mai/last")); + TEST_EQUAL(stream_fr_FR_locale(std::chrono::month_day_last{std::chrono::month{6}}), SV("juin/last")); + TEST_EQUAL(stream_fr_FR_locale(std::chrono::month_day_last{std::chrono::month{7}}), SV("juil./last")); + TEST_EQUAL(stream_fr_FR_locale(std::chrono::month_day_last{std::chrono::month{8}}), SV("août/last")); + TEST_EQUAL(stream_fr_FR_locale(std::chrono::month_day_last{std::chrono::month{9}}), SV("sept./last")); + TEST_EQUAL(stream_fr_FR_locale(std::chrono::month_day_last{std::chrono::month{10}}), SV("oct./last")); + TEST_EQUAL(stream_fr_FR_locale(std::chrono::month_day_last{std::chrono::month{11}}), SV("nov./last")); + TEST_EQUAL(stream_fr_FR_locale(std::chrono::month_day_last{std::chrono::month{12}}), SV("déc./last")); #endif // defined(__APPLE__) - assert(stream_fr_FR_locale(std::chrono::month_day_last{std::chrono::month{13}}) == - SV("13 is not a valid month/last")); - assert(stream_fr_FR_locale(std::chrono::month_day_last{std::chrono::month{255}}) == - SV("255 is not a valid month/last")); - - assert(stream_ja_JP_locale(std::chrono::month_day_last{std::chrono::month{0}}) == - SV("0 is not a valid month/last")); -#if defined(__APPLE__) - assert(stream_ja_JP_locale(std::chrono::month_day_last{std::chrono::month{1}}) == SV(" 1/last")); - assert(stream_ja_JP_locale(std::chrono::month_day_last{std::chrono::month{2}}) == SV(" 2/last")); - assert(stream_ja_JP_locale(std::chrono::month_day_last{std::chrono::month{3}}) == SV(" 3/last")); - assert(stream_ja_JP_locale(std::chrono::month_day_last{std::chrono::month{4}}) == SV(" 4/last")); - assert(stream_ja_JP_locale(std::chrono::month_day_last{std::chrono::month{5}}) == SV(" 5/last")); - assert(stream_ja_JP_locale(std::chrono::month_day_last{std::chrono::month{6}}) == SV(" 6/last")); - assert(stream_ja_JP_locale(std::chrono::month_day_last{std::chrono::month{7}}) == SV(" 7/last")); - assert(stream_ja_JP_locale(std::chrono::month_day_last{std::chrono::month{8}}) == SV(" 8/last")); - assert(stream_ja_JP_locale(std::chrono::month_day_last{std::chrono::month{9}}) == SV(" 9/last")); - assert(stream_ja_JP_locale(std::chrono::month_day_last{std::chrono::month{10}}) == SV("10/last")); - assert(stream_ja_JP_locale(std::chrono::month_day_last{std::chrono::month{11}}) == SV("11/last")); - assert(stream_ja_JP_locale(std::chrono::month_day_last{std::chrono::month{12}}) == SV("12/last")); -#else // defined(__APPLE__) -# if defined(_WIN32) || defined(_AIX) - assert(stream_ja_JP_locale(std::chrono::month_day_last{std::chrono::month{1}}) == SV("1月/last")); - assert(stream_ja_JP_locale(std::chrono::month_day_last{std::chrono::month{2}}) == SV("2月/last")); - assert(stream_ja_JP_locale(std::chrono::month_day_last{std::chrono::month{3}}) == SV("3月/last")); - assert(stream_ja_JP_locale(std::chrono::month_day_last{std::chrono::month{4}}) == SV("4月/last")); - assert(stream_ja_JP_locale(std::chrono::month_day_last{std::chrono::month{5}}) == SV("5月/last")); - assert(stream_ja_JP_locale(std::chrono::month_day_last{std::chrono::month{6}}) == SV("6月/last")); - assert(stream_ja_JP_locale(std::chrono::month_day_last{std::chrono::month{7}}) == SV("7月/last")); - assert(stream_ja_JP_locale(std::chrono::month_day_last{std::chrono::month{8}}) == SV("8月/last")); - assert(stream_ja_JP_locale(std::chrono::month_day_last{std::chrono::month{9}}) == SV("9月/last")); -# else // defined(_WIN32) || defined(_AIX) - assert(stream_ja_JP_locale(std::chrono::month_day_last{std::chrono::month{1}}) == SV(" 1月/last")); - assert(stream_ja_JP_locale(std::chrono::month_day_last{std::chrono::month{2}}) == SV(" 2月/last")); - assert(stream_ja_JP_locale(std::chrono::month_day_last{std::chrono::month{3}}) == SV(" 3月/last")); - assert(stream_ja_JP_locale(std::chrono::month_day_last{std::chrono::month{4}}) == SV(" 4月/last")); - assert(stream_ja_JP_locale(std::chrono::month_day_last{std::chrono::month{5}}) == SV(" 5月/last")); - assert(stream_ja_JP_locale(std::chrono::month_day_last{std::chrono::month{6}}) == SV(" 6月/last")); - assert(stream_ja_JP_locale(std::chrono::month_day_last{std::chrono::month{7}}) == SV(" 7月/last")); - assert(stream_ja_JP_locale(std::chrono::month_day_last{std::chrono::month{8}}) == SV(" 8月/last")); - assert(stream_ja_JP_locale(std::chrono::month_day_last{std::chrono::month{9}}) == SV(" 9月/last")); -# endif // defined(_WIN32) || defined(_AIX) - assert(stream_ja_JP_locale(std::chrono::month_day_last{std::chrono::month{10}}) == SV("10月/last")); - assert(stream_ja_JP_locale(std::chrono::month_day_last{std::chrono::month{11}}) == SV("11月/last")); - assert(stream_ja_JP_locale(std::chrono::month_day_last{std::chrono::month{12}}) == SV("12月/last")); -#endif // defined(__APPLE__) - assert(stream_ja_JP_locale(std::chrono::month_day_last{std::chrono::month{13}}) == - SV("13 is not a valid month/last")); - assert(stream_ja_JP_locale(std::chrono::month_day_last{std::chrono::month{255}}) == - SV("255 is not a valid month/last")); + TEST_EQUAL(stream_fr_FR_locale(std::chrono::month_day_last{std::chrono::month{13}}), + SV("13 is not a valid month/last")); + TEST_EQUAL(stream_fr_FR_locale(std::chrono::month_day_last{std::chrono::month{255}}), + SV("255 is not a valid month/last")); + + TEST_EQUAL(stream_ja_JP_locale(std::chrono::month_day_last{std::chrono::month{0}}), + SV("0 is not a valid month/last")); +#if defined(__APPLE__) || defined(_WIN32) +# if defined(__APPLE__) + TEST_EQUAL(stream_ja_JP_locale(std::chrono::month_day_last{std::chrono::month{1}}), SV(" 1/last")); + TEST_EQUAL(stream_ja_JP_locale(std::chrono::month_day_last{std::chrono::month{2}}), SV(" 2/last")); + TEST_EQUAL(stream_ja_JP_locale(std::chrono::month_day_last{std::chrono::month{3}}), SV(" 3/last")); + TEST_EQUAL(stream_ja_JP_locale(std::chrono::month_day_last{std::chrono::month{4}}), SV(" 4/last")); + TEST_EQUAL(stream_ja_JP_locale(std::chrono::month_day_last{std::chrono::month{5}}), SV(" 5/last")); + TEST_EQUAL(stream_ja_JP_locale(std::chrono::month_day_last{std::chrono::month{6}}), SV(" 6/last")); + TEST_EQUAL(stream_ja_JP_locale(std::chrono::month_day_last{std::chrono::month{7}}), SV(" 7/last")); + TEST_EQUAL(stream_ja_JP_locale(std::chrono::month_day_last{std::chrono::month{8}}), SV(" 8/last")); + TEST_EQUAL(stream_ja_JP_locale(std::chrono::month_day_last{std::chrono::month{9}}), SV(" 9/last")); +# else // defined(__APPLE__) + TEST_EQUAL(stream_ja_JP_locale(std::chrono::month_day_last{std::chrono::month{1}}), SV("1/last")); + TEST_EQUAL(stream_ja_JP_locale(std::chrono::month_day_last{std::chrono::month{2}}), SV("2/last")); + TEST_EQUAL(stream_ja_JP_locale(std::chrono::month_day_last{std::chrono::month{3}}), SV("3/last")); + TEST_EQUAL(stream_ja_JP_locale(std::chrono::month_day_last{std::chrono::month{4}}), SV("4/last")); + TEST_EQUAL(stream_ja_JP_locale(std::chrono::month_day_last{std::chrono::month{5}}), SV("5/last")); + TEST_EQUAL(stream_ja_JP_locale(std::chrono::month_day_last{std::chrono::month{6}}), SV("6/last")); + TEST_EQUAL(stream_ja_JP_locale(std::chrono::month_day_last{std::chrono::month{7}}), SV("7/last")); + TEST_EQUAL(stream_ja_JP_locale(std::chrono::month_day_last{std::chrono::month{8}}), SV("8/last")); + TEST_EQUAL(stream_ja_JP_locale(std::chrono::month_day_last{std::chrono::month{9}}), SV("9/last")); +# endif // defined(__APPLE__) + TEST_EQUAL(stream_ja_JP_locale(std::chrono::month_day_last{std::chrono::month{10}}), SV("10/last")); + TEST_EQUAL(stream_ja_JP_locale(std::chrono::month_day_last{std::chrono::month{11}}), SV("11/last")); + TEST_EQUAL(stream_ja_JP_locale(std::chrono::month_day_last{std::chrono::month{12}}), SV("12/last")); +#else // defined(__APPLE__) || defined(_WIN32) +# if defined(_AIX) + TEST_EQUAL(stream_ja_JP_locale(std::chrono::month_day_last{std::chrono::month{1}}), SV("1月/last")); + TEST_EQUAL(stream_ja_JP_locale(std::chrono::month_day_last{std::chrono::month{2}}), SV("2月/last")); + TEST_EQUAL(stream_ja_JP_locale(std::chrono::month_day_last{std::chrono::month{3}}), SV("3月/last")); + TEST_EQUAL(stream_ja_JP_locale(std::chrono::month_day_last{std::chrono::month{4}}), SV("4月/last")); + TEST_EQUAL(stream_ja_JP_locale(std::chrono::month_day_last{std::chrono::month{5}}), SV("5月/last")); + TEST_EQUAL(stream_ja_JP_locale(std::chrono::month_day_last{std::chrono::month{6}}), SV("6月/last")); + TEST_EQUAL(stream_ja_JP_locale(std::chrono::month_day_last{std::chrono::month{7}}), SV("7月/last")); + TEST_EQUAL(stream_ja_JP_locale(std::chrono::month_day_last{std::chrono::month{8}}), SV("8月/last")); + TEST_EQUAL(stream_ja_JP_locale(std::chrono::month_day_last{std::chrono::month{9}}), SV("9月/last")); +# else // defined(_AIX) + TEST_EQUAL(stream_ja_JP_locale(std::chrono::month_day_last{std::chrono::month{1}}), SV(" 1月/last")); + TEST_EQUAL(stream_ja_JP_locale(std::chrono::month_day_last{std::chrono::month{2}}), SV(" 2月/last")); + TEST_EQUAL(stream_ja_JP_locale(std::chrono::month_day_last{std::chrono::month{3}}), SV(" 3月/last")); + TEST_EQUAL(stream_ja_JP_locale(std::chrono::month_day_last{std::chrono::month{4}}), SV(" 4月/last")); + TEST_EQUAL(stream_ja_JP_locale(std::chrono::month_day_last{std::chrono::month{5}}), SV(" 5月/last")); + TEST_EQUAL(stream_ja_JP_locale(std::chrono::month_day_last{std::chrono::month{6}}), SV(" 6月/last")); + TEST_EQUAL(stream_ja_JP_locale(std::chrono::month_day_last{std::chrono::month{7}}), SV(" 7月/last")); + TEST_EQUAL(stream_ja_JP_locale(std::chrono::month_day_last{std::chrono::month{8}}), SV(" 8月/last")); + TEST_EQUAL(stream_ja_JP_locale(std::chrono::month_day_last{std::chrono::month{9}}), SV(" 9月/last")); +# endif // defined(_AIX) + TEST_EQUAL(stream_ja_JP_locale(std::chrono::month_day_last{std::chrono::month{10}}), SV("10月/last")); + TEST_EQUAL(stream_ja_JP_locale(std::chrono::month_day_last{std::chrono::month{11}}), SV("11月/last")); + TEST_EQUAL(stream_ja_JP_locale(std::chrono::month_day_last{std::chrono::month{12}}), SV("12月/last")); +#endif // defined(__APPLE__) || defined(_WIN32) + TEST_EQUAL(stream_ja_JP_locale(std::chrono::month_day_last{std::chrono::month{13}}), + SV("13 is not a valid month/last")); + TEST_EQUAL(stream_ja_JP_locale(std::chrono::month_day_last{std::chrono::month{255}}), + SV("255 is not a valid month/last")); } int main(int, char**) { diff --git a/libcxx/test/std/time/time.cal/time.cal.month/time.cal.month.nonmembers/ostream.pass.cpp b/libcxx/test/std/time/time.cal/time.cal.month/time.cal.month.nonmembers/ostream.pass.cpp --- a/libcxx/test/std/time/time.cal/time.cal.month/time.cal.month.nonmembers/ostream.pass.cpp +++ b/libcxx/test/std/time/time.cal/time.cal.month/time.cal.month.nonmembers/ostream.pass.cpp @@ -11,9 +11,6 @@ // UNSUPPORTED: c++03, c++11, c++14, c++17 // UNSUPPORTED: no-localization -// TODO FMT Investigate Windows issues. -// UNSUPPORTED: msvc, target={{.+}}-windows-gnu - // TODO FMT Fix this test using GCC, it currently crashes. // UNSUPPORTED: gcc-12 @@ -38,9 +35,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; @@ -68,99 +72,111 @@ template static void test() { - assert(stream_c_locale(std::chrono::month{0}) == SV("0 is not a valid month")); - assert(stream_c_locale(std::chrono::month{1}) == SV("Jan")); - assert(stream_c_locale(std::chrono::month{2}) == SV("Feb")); - assert(stream_c_locale(std::chrono::month{3}) == SV("Mar")); - assert(stream_c_locale(std::chrono::month{4}) == SV("Apr")); - assert(stream_c_locale(std::chrono::month{5}) == SV("May")); - assert(stream_c_locale(std::chrono::month{6}) == SV("Jun")); - assert(stream_c_locale(std::chrono::month{7}) == SV("Jul")); - assert(stream_c_locale(std::chrono::month{8}) == SV("Aug")); - assert(stream_c_locale(std::chrono::month{9}) == SV("Sep")); - assert(stream_c_locale(std::chrono::month{10}) == SV("Oct")); - assert(stream_c_locale(std::chrono::month{11}) == SV("Nov")); - assert(stream_c_locale(std::chrono::month{12}) == SV("Dec")); - assert(stream_c_locale(std::chrono::month{13}) == SV("13 is not a valid month")); - assert(stream_c_locale(std::chrono::month{255}) == SV("255 is not a valid month")); - - assert(stream_fr_FR_locale(std::chrono::month{0}) == SV("0 is not a valid month")); + TEST_EQUAL(stream_c_locale(std::chrono::month{0}), SV("0 is not a valid month")); + TEST_EQUAL(stream_c_locale(std::chrono::month{1}), SV("Jan")); + TEST_EQUAL(stream_c_locale(std::chrono::month{2}), SV("Feb")); + TEST_EQUAL(stream_c_locale(std::chrono::month{3}), SV("Mar")); + TEST_EQUAL(stream_c_locale(std::chrono::month{4}), SV("Apr")); + TEST_EQUAL(stream_c_locale(std::chrono::month{5}), SV("May")); + TEST_EQUAL(stream_c_locale(std::chrono::month{6}), SV("Jun")); + TEST_EQUAL(stream_c_locale(std::chrono::month{7}), SV("Jul")); + TEST_EQUAL(stream_c_locale(std::chrono::month{8}), SV("Aug")); + TEST_EQUAL(stream_c_locale(std::chrono::month{9}), SV("Sep")); + TEST_EQUAL(stream_c_locale(std::chrono::month{10}), SV("Oct")); + TEST_EQUAL(stream_c_locale(std::chrono::month{11}), SV("Nov")); + TEST_EQUAL(stream_c_locale(std::chrono::month{12}), SV("Dec")); + TEST_EQUAL(stream_c_locale(std::chrono::month{13}), SV("13 is not a valid month")); + TEST_EQUAL(stream_c_locale(std::chrono::month{255}), SV("255 is not a valid month")); + + TEST_EQUAL(stream_fr_FR_locale(std::chrono::month{0}), SV("0 is not a valid month")); #if defined(__APPLE__) - assert(stream_fr_FR_locale(std::chrono::month{1}) == SV("jan")); - assert(stream_fr_FR_locale(std::chrono::month{2}) == SV("fév")); - assert(stream_fr_FR_locale(std::chrono::month{3}) == SV("mar")); - assert(stream_fr_FR_locale(std::chrono::month{4}) == SV("avr")); - assert(stream_fr_FR_locale(std::chrono::month{5}) == SV("mai")); - assert(stream_fr_FR_locale(std::chrono::month{6}) == SV("jui")); - assert(stream_fr_FR_locale(std::chrono::month{7}) == SV("jul")); - assert(stream_fr_FR_locale(std::chrono::month{8}) == SV("aoû")); - assert(stream_fr_FR_locale(std::chrono::month{9}) == SV("sep")); - assert(stream_fr_FR_locale(std::chrono::month{10}) == SV("oct")); - assert(stream_fr_FR_locale(std::chrono::month{11}) == SV("nov")); - assert(stream_fr_FR_locale(std::chrono::month{12}) == SV("déc")); + TEST_EQUAL(stream_fr_FR_locale(std::chrono::month{1}), SV("jan")); + TEST_EQUAL(stream_fr_FR_locale(std::chrono::month{2}), SV("fév")); + TEST_EQUAL(stream_fr_FR_locale(std::chrono::month{3}), SV("mar")); + TEST_EQUAL(stream_fr_FR_locale(std::chrono::month{4}), SV("avr")); + TEST_EQUAL(stream_fr_FR_locale(std::chrono::month{5}), SV("mai")); + TEST_EQUAL(stream_fr_FR_locale(std::chrono::month{6}), SV("jui")); + TEST_EQUAL(stream_fr_FR_locale(std::chrono::month{7}), SV("jul")); + TEST_EQUAL(stream_fr_FR_locale(std::chrono::month{8}), SV("aoû")); + TEST_EQUAL(stream_fr_FR_locale(std::chrono::month{9}), SV("sep")); + TEST_EQUAL(stream_fr_FR_locale(std::chrono::month{10}), SV("oct")); + TEST_EQUAL(stream_fr_FR_locale(std::chrono::month{11}), SV("nov")); + TEST_EQUAL(stream_fr_FR_locale(std::chrono::month{12}), SV("déc")); #else // defined(__APPLE__) - assert(stream_fr_FR_locale(std::chrono::month{1}) == SV("janv.")); - assert(stream_fr_FR_locale(std::chrono::month{2}) == SV("févr.")); - assert(stream_fr_FR_locale(std::chrono::month{3}) == SV("mars")); + TEST_EQUAL(stream_fr_FR_locale(std::chrono::month{1}), SV("janv.")); + TEST_EQUAL(stream_fr_FR_locale(std::chrono::month{2}), SV("févr.")); + TEST_EQUAL(stream_fr_FR_locale(std::chrono::month{3}), SV("mars")); # if defined(_WIN32) || defined(_AIX) - assert(stream_fr_FR_locale(std::chrono::month{4}) == SV("avr.")); + TEST_EQUAL(stream_fr_FR_locale(std::chrono::month{4}), SV("avr.")); # else - assert(stream_fr_FR_locale(std::chrono::month{4}) == SV("avril")); + TEST_EQUAL(stream_fr_FR_locale(std::chrono::month{4}), SV("avril")); # endif - assert(stream_fr_FR_locale(std::chrono::month{5}) == SV("mai")); - assert(stream_fr_FR_locale(std::chrono::month{6}) == SV("juin")); - assert(stream_fr_FR_locale(std::chrono::month{7}) == SV("juil.")); - assert(stream_fr_FR_locale(std::chrono::month{8}) == SV("août")); - assert(stream_fr_FR_locale(std::chrono::month{9}) == SV("sept.")); - assert(stream_fr_FR_locale(std::chrono::month{10}) == SV("oct.")); - assert(stream_fr_FR_locale(std::chrono::month{11}) == SV("nov.")); - assert(stream_fr_FR_locale(std::chrono::month{12}) == SV("déc.")); + TEST_EQUAL(stream_fr_FR_locale(std::chrono::month{5}), SV("mai")); + TEST_EQUAL(stream_fr_FR_locale(std::chrono::month{6}), SV("juin")); + TEST_EQUAL(stream_fr_FR_locale(std::chrono::month{7}), SV("juil.")); + TEST_EQUAL(stream_fr_FR_locale(std::chrono::month{8}), SV("août")); + TEST_EQUAL(stream_fr_FR_locale(std::chrono::month{9}), SV("sept.")); + TEST_EQUAL(stream_fr_FR_locale(std::chrono::month{10}), SV("oct.")); + TEST_EQUAL(stream_fr_FR_locale(std::chrono::month{11}), SV("nov.")); + TEST_EQUAL(stream_fr_FR_locale(std::chrono::month{12}), SV("déc.")); #endif // defined(__APPLE__) - assert(stream_fr_FR_locale(std::chrono::month{13}) == SV("13 is not a valid month")); - assert(stream_fr_FR_locale(std::chrono::month{255}) == SV("255 is not a valid month")); - - assert(stream_ja_JP_locale(std::chrono::month{0}) == SV("0 is not a valid month")); -#if defined(__APPLE__) - assert(stream_ja_JP_locale(std::chrono::month{1}) == SV(" 1")); - assert(stream_ja_JP_locale(std::chrono::month{2}) == SV(" 2")); - assert(stream_ja_JP_locale(std::chrono::month{3}) == SV(" 3")); - assert(stream_ja_JP_locale(std::chrono::month{4}) == SV(" 4")); - assert(stream_ja_JP_locale(std::chrono::month{5}) == SV(" 5")); - assert(stream_ja_JP_locale(std::chrono::month{6}) == SV(" 6")); - assert(stream_ja_JP_locale(std::chrono::month{7}) == SV(" 7")); - assert(stream_ja_JP_locale(std::chrono::month{8}) == SV(" 8")); - assert(stream_ja_JP_locale(std::chrono::month{9}) == SV(" 9")); - assert(stream_ja_JP_locale(std::chrono::month{10}) == SV("10")); - assert(stream_ja_JP_locale(std::chrono::month{11}) == SV("11")); - assert(stream_ja_JP_locale(std::chrono::month{12}) == SV("12")); -#else // defined(__APPLE__) -# if defined(_WIN32) || defined(_AIX) - assert(stream_ja_JP_locale(std::chrono::month{1}) == SV("1月")); - assert(stream_ja_JP_locale(std::chrono::month{2}) == SV("2月")); - assert(stream_ja_JP_locale(std::chrono::month{3}) == SV("3月")); - assert(stream_ja_JP_locale(std::chrono::month{4}) == SV("4月")); - assert(stream_ja_JP_locale(std::chrono::month{5}) == SV("5月")); - assert(stream_ja_JP_locale(std::chrono::month{6}) == SV("6月")); - assert(stream_ja_JP_locale(std::chrono::month{7}) == SV("7月")); - assert(stream_ja_JP_locale(std::chrono::month{8}) == SV("8月")); - assert(stream_ja_JP_locale(std::chrono::month{9}) == SV("9月")); -# else // defined(_WIN32) || defined(_AIX) - assert(stream_ja_JP_locale(std::chrono::month{1}) == SV(" 1月")); - assert(stream_ja_JP_locale(std::chrono::month{2}) == SV(" 2月")); - assert(stream_ja_JP_locale(std::chrono::month{3}) == SV(" 3月")); - assert(stream_ja_JP_locale(std::chrono::month{4}) == SV(" 4月")); - assert(stream_ja_JP_locale(std::chrono::month{5}) == SV(" 5月")); - assert(stream_ja_JP_locale(std::chrono::month{6}) == SV(" 6月")); - assert(stream_ja_JP_locale(std::chrono::month{7}) == SV(" 7月")); - assert(stream_ja_JP_locale(std::chrono::month{8}) == SV(" 8月")); - assert(stream_ja_JP_locale(std::chrono::month{9}) == SV(" 9月")); -# endif // defined(_WIN32) || defined(_AIX) - assert(stream_ja_JP_locale(std::chrono::month{10}) == SV("10月")); - assert(stream_ja_JP_locale(std::chrono::month{11}) == SV("11月")); - assert(stream_ja_JP_locale(std::chrono::month{12}) == SV("12月")); -#endif // defined(__APPLE__) - assert(stream_ja_JP_locale(std::chrono::month{13}) == SV("13 is not a valid month")); - assert(stream_ja_JP_locale(std::chrono::month{255}) == SV("255 is not a valid month")); + TEST_EQUAL(stream_fr_FR_locale(std::chrono::month{13}), SV("13 is not a valid month")); + TEST_EQUAL(stream_fr_FR_locale(std::chrono::month{255}), SV("255 is not a valid month")); + + TEST_EQUAL(stream_ja_JP_locale(std::chrono::month{0}), SV("0 is not a valid month")); +#if defined(__APPLE__) || defined(_WIN32) +# if defined(__APPLE__) + TEST_EQUAL(stream_ja_JP_locale(std::chrono::month{1}), SV(" 1")); + TEST_EQUAL(stream_ja_JP_locale(std::chrono::month{2}), SV(" 2")); + TEST_EQUAL(stream_ja_JP_locale(std::chrono::month{3}), SV(" 3")); + TEST_EQUAL(stream_ja_JP_locale(std::chrono::month{4}), SV(" 4")); + TEST_EQUAL(stream_ja_JP_locale(std::chrono::month{5}), SV(" 5")); + TEST_EQUAL(stream_ja_JP_locale(std::chrono::month{6}), SV(" 6")); + TEST_EQUAL(stream_ja_JP_locale(std::chrono::month{7}), SV(" 7")); + TEST_EQUAL(stream_ja_JP_locale(std::chrono::month{8}), SV(" 8")); + TEST_EQUAL(stream_ja_JP_locale(std::chrono::month{9}), SV(" 9")); +# else // defined(__APPLE__) + TEST_EQUAL(stream_ja_JP_locale(std::chrono::month{1}), SV("1")); + TEST_EQUAL(stream_ja_JP_locale(std::chrono::month{2}), SV("2")); + TEST_EQUAL(stream_ja_JP_locale(std::chrono::month{3}), SV("3")); + TEST_EQUAL(stream_ja_JP_locale(std::chrono::month{4}), SV("4")); + TEST_EQUAL(stream_ja_JP_locale(std::chrono::month{5}), SV("5")); + TEST_EQUAL(stream_ja_JP_locale(std::chrono::month{6}), SV("6")); + TEST_EQUAL(stream_ja_JP_locale(std::chrono::month{7}), SV("7")); + TEST_EQUAL(stream_ja_JP_locale(std::chrono::month{8}), SV("8")); + TEST_EQUAL(stream_ja_JP_locale(std::chrono::month{9}), SV("9")); +# endif // defined(__APPLE__) + TEST_EQUAL(stream_ja_JP_locale(std::chrono::month{10}), SV("10")); + TEST_EQUAL(stream_ja_JP_locale(std::chrono::month{11}), SV("11")); + TEST_EQUAL(stream_ja_JP_locale(std::chrono::month{12}), SV("12")); +#else // defined(__APPLE__)|| defined(_WIN32) +# if defined(_AIX) + TEST_EQUAL(stream_ja_JP_locale(std::chrono::month{1}), SV("1月")); + TEST_EQUAL(stream_ja_JP_locale(std::chrono::month{2}), SV("2月")); + TEST_EQUAL(stream_ja_JP_locale(std::chrono::month{3}), SV("3月")); + TEST_EQUAL(stream_ja_JP_locale(std::chrono::month{4}), SV("4月")); + TEST_EQUAL(stream_ja_JP_locale(std::chrono::month{5}), SV("5月")); + TEST_EQUAL(stream_ja_JP_locale(std::chrono::month{6}), SV("6月")); + TEST_EQUAL(stream_ja_JP_locale(std::chrono::month{7}), SV("7月")); + TEST_EQUAL(stream_ja_JP_locale(std::chrono::month{8}), SV("8月")); + TEST_EQUAL(stream_ja_JP_locale(std::chrono::month{9}), SV("9月")); +# else // defined(_AIX) + TEST_EQUAL(stream_ja_JP_locale(std::chrono::month{1}), SV(" 1月")); + TEST_EQUAL(stream_ja_JP_locale(std::chrono::month{2}), SV(" 2月")); + TEST_EQUAL(stream_ja_JP_locale(std::chrono::month{3}), SV(" 3月")); + TEST_EQUAL(stream_ja_JP_locale(std::chrono::month{4}), SV(" 4月")); + TEST_EQUAL(stream_ja_JP_locale(std::chrono::month{5}), SV(" 5月")); + TEST_EQUAL(stream_ja_JP_locale(std::chrono::month{6}), SV(" 6月")); + TEST_EQUAL(stream_ja_JP_locale(std::chrono::month{7}), SV(" 7月")); + TEST_EQUAL(stream_ja_JP_locale(std::chrono::month{8}), SV(" 8月")); + TEST_EQUAL(stream_ja_JP_locale(std::chrono::month{9}), SV(" 9月")); +# endif // defined(_AIX) + TEST_EQUAL(stream_ja_JP_locale(std::chrono::month{10}), SV("10月")); + TEST_EQUAL(stream_ja_JP_locale(std::chrono::month{11}), SV("11月")); + TEST_EQUAL(stream_ja_JP_locale(std::chrono::month{12}), SV("12月")); +#endif // defined(__APPLE__)|| defined(_WIN32) + TEST_EQUAL(stream_ja_JP_locale(std::chrono::month{13}), SV("13 is not a valid month")); + TEST_EQUAL(stream_ja_JP_locale(std::chrono::month{255}), SV("255 is not a valid month")); } int main(int, char**) { diff --git a/libcxx/test/std/time/time.cal/time.cal.mwd/time.cal.mwd.nonmembers/ostream.pass.cpp b/libcxx/test/std/time/time.cal/time.cal.mwd/time.cal.mwd.nonmembers/ostream.pass.cpp --- a/libcxx/test/std/time/time.cal/time.cal.mwd/time.cal.mwd.nonmembers/ostream.pass.cpp +++ b/libcxx/test/std/time/time.cal/time.cal.mwd/time.cal.mwd.nonmembers/ostream.pass.cpp @@ -11,9 +11,6 @@ // UNSUPPORTED: c++03, c++11, c++14, c++17 // UNSUPPORTED: no-localization -// 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 @@ -38,9 +35,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; @@ -68,214 +72,296 @@ template static void test() { - assert(stream_c_locale(std::chrono::month_weekday{ - std::chrono::month{0}, std::chrono::weekday_indexed{std::chrono::weekday{0}, 1}}) == - SV("0 is not a valid month/Sun[1]")); - assert(stream_c_locale(std::chrono::month_weekday{ - std::chrono::month{1}, std::chrono::weekday_indexed{std::chrono::weekday{1}, 1}}) == SV("Jan/Mon[1]")); - assert(stream_c_locale(std::chrono::month_weekday{ - std::chrono::month{2}, std::chrono::weekday_indexed{std::chrono::weekday{2}, 2}}) == SV("Feb/Tue[2]")); - assert(stream_c_locale(std::chrono::month_weekday{ - std::chrono::month{3}, std::chrono::weekday_indexed{std::chrono::weekday{3}, 3}}) == SV("Mar/Wed[3]")); - assert(stream_c_locale(std::chrono::month_weekday{ - std::chrono::month{4}, std::chrono::weekday_indexed{std::chrono::weekday{4}, 4}}) == SV("Apr/Thu[4]")); - assert(stream_c_locale(std::chrono::month_weekday{ - std::chrono::month{5}, std::chrono::weekday_indexed{std::chrono::weekday{5}, 5}}) == SV("May/Fri[5]")); - assert(stream_c_locale(std::chrono::month_weekday{ - std::chrono::month{6}, std::chrono::weekday_indexed{std::chrono::weekday{6}, 6}}) == - SV("Jun/Sat[6 is not a valid index]")); - assert(stream_c_locale(std::chrono::month_weekday{ - std::chrono::month{7}, std::chrono::weekday_indexed{std::chrono::weekday{7}, 7}}) == - SV("Jul/Sun[7 is not a valid index]")); - assert(stream_c_locale(std::chrono::month_weekday{ - std::chrono::month{8}, std::chrono::weekday_indexed{std::chrono::weekday{8}, 0}}) == - SV("Aug/8 is not a valid weekday[0 is not a valid index]")); - assert(stream_c_locale(std::chrono::month_weekday{ - std::chrono::month{9}, std::chrono::weekday_indexed{std::chrono::weekday{0}, 1}}) == SV("Sep/Sun[1]")); - assert(stream_c_locale(std::chrono::month_weekday{ - std::chrono::month{10}, std::chrono::weekday_indexed{std::chrono::weekday{0}, 1}}) == SV("Oct/Sun[1]")); - assert(stream_c_locale(std::chrono::month_weekday{ - std::chrono::month{11}, std::chrono::weekday_indexed{std::chrono::weekday{0}, 1}}) == SV("Nov/Sun[1]")); - assert(stream_c_locale(std::chrono::month_weekday{ - std::chrono::month{12}, std::chrono::weekday_indexed{std::chrono::weekday{0}, 1}}) == SV("Dec/Sun[1]")); - assert(stream_c_locale(std::chrono::month_weekday{ - std::chrono::month{13}, std::chrono::weekday_indexed{std::chrono::weekday{0}, 1}}) == - SV("13 is not a valid month/Sun[1]")); - assert(stream_c_locale(std::chrono::month_weekday{ - std::chrono::month{255}, std::chrono::weekday_indexed{std::chrono::weekday{8}, 0}}) == - SV("255 is not a valid month/8 is not a valid weekday[0 is not a valid index]")); + TEST_EQUAL(stream_c_locale(std::chrono::month_weekday{ + std::chrono::month{0}, std::chrono::weekday_indexed{std::chrono::weekday{0}, 1}}), + SV("0 is not a valid month/Sun[1]")); + TEST_EQUAL(stream_c_locale(std::chrono::month_weekday{ + std::chrono::month{1}, std::chrono::weekday_indexed{std::chrono::weekday{1}, 1}}), + SV("Jan/Mon[1]")); + TEST_EQUAL(stream_c_locale(std::chrono::month_weekday{ + std::chrono::month{2}, std::chrono::weekday_indexed{std::chrono::weekday{2}, 2}}), + SV("Feb/Tue[2]")); + TEST_EQUAL(stream_c_locale(std::chrono::month_weekday{ + std::chrono::month{3}, std::chrono::weekday_indexed{std::chrono::weekday{3}, 3}}), + SV("Mar/Wed[3]")); + TEST_EQUAL(stream_c_locale(std::chrono::month_weekday{ + std::chrono::month{4}, std::chrono::weekday_indexed{std::chrono::weekday{4}, 4}}), + SV("Apr/Thu[4]")); + TEST_EQUAL(stream_c_locale(std::chrono::month_weekday{ + std::chrono::month{5}, std::chrono::weekday_indexed{std::chrono::weekday{5}, 5}}), + SV("May/Fri[5]")); + TEST_EQUAL(stream_c_locale(std::chrono::month_weekday{ + std::chrono::month{6}, std::chrono::weekday_indexed{std::chrono::weekday{6}, 6}}), + SV("Jun/Sat[6 is not a valid index]")); + TEST_EQUAL(stream_c_locale(std::chrono::month_weekday{ + std::chrono::month{7}, std::chrono::weekday_indexed{std::chrono::weekday{7}, 7}}), + SV("Jul/Sun[7 is not a valid index]")); + TEST_EQUAL(stream_c_locale(std::chrono::month_weekday{ + std::chrono::month{8}, std::chrono::weekday_indexed{std::chrono::weekday{8}, 0}}), + SV("Aug/8 is not a valid weekday[0 is not a valid index]")); + TEST_EQUAL(stream_c_locale(std::chrono::month_weekday{ + std::chrono::month{9}, std::chrono::weekday_indexed{std::chrono::weekday{0}, 1}}), + SV("Sep/Sun[1]")); + TEST_EQUAL(stream_c_locale(std::chrono::month_weekday{ + std::chrono::month{10}, std::chrono::weekday_indexed{std::chrono::weekday{0}, 1}}), + SV("Oct/Sun[1]")); + TEST_EQUAL(stream_c_locale(std::chrono::month_weekday{ + std::chrono::month{11}, std::chrono::weekday_indexed{std::chrono::weekday{0}, 1}}), + SV("Nov/Sun[1]")); + TEST_EQUAL(stream_c_locale(std::chrono::month_weekday{ + std::chrono::month{12}, std::chrono::weekday_indexed{std::chrono::weekday{0}, 1}}), + SV("Dec/Sun[1]")); + TEST_EQUAL(stream_c_locale(std::chrono::month_weekday{ + std::chrono::month{13}, std::chrono::weekday_indexed{std::chrono::weekday{0}, 1}}), + SV("13 is not a valid month/Sun[1]")); + TEST_EQUAL(stream_c_locale(std::chrono::month_weekday{ + std::chrono::month{255}, std::chrono::weekday_indexed{std::chrono::weekday{8}, 0}}), + SV("255 is not a valid month/8 is not a valid weekday[0 is not a valid index]")); #if defined(__APPLE__) - assert(stream_fr_FR_locale(std::chrono::month_weekday{ - std::chrono::month{0}, std::chrono::weekday_indexed{std::chrono::weekday{0}, 1}}) == - SV("0 is not a valid month/Dim[1]")); - assert(stream_fr_FR_locale(std::chrono::month_weekday{ - std::chrono::month{1}, std::chrono::weekday_indexed{std::chrono::weekday{1}, 1}}) == SV("jan/Lun[1]")); - assert(stream_fr_FR_locale(std::chrono::month_weekday{ - std::chrono::month{2}, std::chrono::weekday_indexed{std::chrono::weekday{2}, 2}}) == SV("fév/Mar[2]")); - assert(stream_fr_FR_locale(std::chrono::month_weekday{ - std::chrono::month{3}, std::chrono::weekday_indexed{std::chrono::weekday{3}, 3}}) == SV("mar/Mer[3]")); - assert(stream_fr_FR_locale(std::chrono::month_weekday{ - std::chrono::month{4}, std::chrono::weekday_indexed{std::chrono::weekday{4}, 4}}) == SV("avr/Jeu[4]")); - assert(stream_fr_FR_locale(std::chrono::month_weekday{ - std::chrono::month{5}, std::chrono::weekday_indexed{std::chrono::weekday{5}, 5}}) == SV("mai/Ven[5]")); - assert(stream_fr_FR_locale(std::chrono::month_weekday{ - std::chrono::month{6}, std::chrono::weekday_indexed{std::chrono::weekday{6}, 6}}) == - SV("jui/Sam[6 is not a valid index]")); - assert(stream_fr_FR_locale(std::chrono::month_weekday{ - std::chrono::month{7}, std::chrono::weekday_indexed{std::chrono::weekday{7}, 7}}) == - SV("jul/Dim[7 is not a valid index]")); - assert(stream_fr_FR_locale(std::chrono::month_weekday{ - std::chrono::month{8}, std::chrono::weekday_indexed{std::chrono::weekday{8}, 0}}) == - SV("aoû/8 is not a valid weekday[0 is not a valid index]")); - assert(stream_fr_FR_locale(std::chrono::month_weekday{ - std::chrono::month{9}, std::chrono::weekday_indexed{std::chrono::weekday{0}, 1}}) == SV("sep/Dim[1]")); - assert(stream_fr_FR_locale(std::chrono::month_weekday{ - std::chrono::month{10}, std::chrono::weekday_indexed{std::chrono::weekday{0}, 1}}) == SV("oct/Dim[1]")); - assert(stream_fr_FR_locale(std::chrono::month_weekday{ - std::chrono::month{11}, std::chrono::weekday_indexed{std::chrono::weekday{0}, 1}}) == SV("nov/Dim[1]")); - assert(stream_fr_FR_locale(std::chrono::month_weekday{ - std::chrono::month{12}, std::chrono::weekday_indexed{std::chrono::weekday{0}, 1}}) == SV("déc/Dim[1]")); - assert(stream_fr_FR_locale(std::chrono::month_weekday{ - std::chrono::month{13}, std::chrono::weekday_indexed{std::chrono::weekday{0}, 1}}) == - SV("13 is not a valid month/Dim[1]")); - assert(stream_fr_FR_locale(std::chrono::month_weekday{ - std::chrono::month{255}, std::chrono::weekday_indexed{std::chrono::weekday{8}, 0}}) == - SV("255 is not a valid month/8 is not a valid weekday[0 is not a valid index]")); + TEST_EQUAL(stream_fr_FR_locale(std::chrono::month_weekday{ + std::chrono::month{0}, std::chrono::weekday_indexed{std::chrono::weekday{0}, 1}}), + SV("0 is not a valid month/Dim[1]")); + TEST_EQUAL(stream_fr_FR_locale(std::chrono::month_weekday{ + std::chrono::month{1}, std::chrono::weekday_indexed{std::chrono::weekday{1}, 1}}), + SV("jan/Lun[1]")); + TEST_EQUAL(stream_fr_FR_locale(std::chrono::month_weekday{ + std::chrono::month{2}, std::chrono::weekday_indexed{std::chrono::weekday{2}, 2}}), + SV("fév/Mar[2]")); + TEST_EQUAL(stream_fr_FR_locale(std::chrono::month_weekday{ + std::chrono::month{3}, std::chrono::weekday_indexed{std::chrono::weekday{3}, 3}}), + SV("mar/Mer[3]")); + TEST_EQUAL(stream_fr_FR_locale(std::chrono::month_weekday{ + std::chrono::month{4}, std::chrono::weekday_indexed{std::chrono::weekday{4}, 4}}), + SV("avr/Jeu[4]")); + TEST_EQUAL(stream_fr_FR_locale(std::chrono::month_weekday{ + std::chrono::month{5}, std::chrono::weekday_indexed{std::chrono::weekday{5}, 5}}), + SV("mai/Ven[5]")); + TEST_EQUAL(stream_fr_FR_locale(std::chrono::month_weekday{ + std::chrono::month{6}, std::chrono::weekday_indexed{std::chrono::weekday{6}, 6}}), + SV("jui/Sam[6 is not a valid index]")); + TEST_EQUAL(stream_fr_FR_locale(std::chrono::month_weekday{ + std::chrono::month{7}, std::chrono::weekday_indexed{std::chrono::weekday{7}, 7}}), + SV("jul/Dim[7 is not a valid index]")); + TEST_EQUAL(stream_fr_FR_locale(std::chrono::month_weekday{ + std::chrono::month{8}, std::chrono::weekday_indexed{std::chrono::weekday{8}, 0}}), + SV("aoû/8 is not a valid weekday[0 is not a valid index]")); + TEST_EQUAL(stream_fr_FR_locale(std::chrono::month_weekday{ + std::chrono::month{9}, std::chrono::weekday_indexed{std::chrono::weekday{0}, 1}}), + SV("sep/Dim[1]")); + TEST_EQUAL(stream_fr_FR_locale(std::chrono::month_weekday{ + std::chrono::month{10}, std::chrono::weekday_indexed{std::chrono::weekday{0}, 1}}), + SV("oct/Dim[1]")); + TEST_EQUAL(stream_fr_FR_locale(std::chrono::month_weekday{ + std::chrono::month{11}, std::chrono::weekday_indexed{std::chrono::weekday{0}, 1}}), + SV("nov/Dim[1]")); + TEST_EQUAL(stream_fr_FR_locale(std::chrono::month_weekday{ + std::chrono::month{12}, std::chrono::weekday_indexed{std::chrono::weekday{0}, 1}}), + SV("déc/Dim[1]")); + TEST_EQUAL(stream_fr_FR_locale(std::chrono::month_weekday{ + std::chrono::month{13}, std::chrono::weekday_indexed{std::chrono::weekday{0}, 1}}), + SV("13 is not a valid month/Dim[1]")); + TEST_EQUAL(stream_fr_FR_locale(std::chrono::month_weekday{ + std::chrono::month{255}, std::chrono::weekday_indexed{std::chrono::weekday{8}, 0}}), + SV("255 is not a valid month/8 is not a valid weekday[0 is not a valid index]")); #else // defined(__APPLE__) - assert(stream_fr_FR_locale(std::chrono::month_weekday{ - std::chrono::month{0}, std::chrono::weekday_indexed{std::chrono::weekday{0}, 1}}) == - SV("0 is not a valid month/dim.[1]")); - assert(stream_fr_FR_locale(std::chrono::month_weekday{ - std::chrono::month{1}, std::chrono::weekday_indexed{std::chrono::weekday{1}, 1}}) == SV("janv./lun.[1]")); - assert(stream_fr_FR_locale(std::chrono::month_weekday{ - std::chrono::month{2}, std::chrono::weekday_indexed{std::chrono::weekday{2}, 2}}) == SV("févr./mar.[2]")); - assert(stream_fr_FR_locale(std::chrono::month_weekday{ - std::chrono::month{3}, std::chrono::weekday_indexed{std::chrono::weekday{3}, 3}}) == SV("mars/mer.[3]")); + TEST_EQUAL(stream_fr_FR_locale(std::chrono::month_weekday{ + std::chrono::month{0}, std::chrono::weekday_indexed{std::chrono::weekday{0}, 1}}), + SV("0 is not a valid month/dim.[1]")); + TEST_EQUAL(stream_fr_FR_locale(std::chrono::month_weekday{ + std::chrono::month{1}, std::chrono::weekday_indexed{std::chrono::weekday{1}, 1}}), + SV("janv./lun.[1]")); + TEST_EQUAL(stream_fr_FR_locale(std::chrono::month_weekday{ + std::chrono::month{2}, std::chrono::weekday_indexed{std::chrono::weekday{2}, 2}}), + SV("févr./mar.[2]")); + TEST_EQUAL(stream_fr_FR_locale(std::chrono::month_weekday{ + std::chrono::month{3}, std::chrono::weekday_indexed{std::chrono::weekday{3}, 3}}), + SV("mars/mer.[3]")); # if defined(_WIN32) || defined(_AIX) - assert(stream_fr_FR_locale(std::chrono::month_weekday{ - std::chrono::month{4}, std::chrono::weekday_indexed{std::chrono::weekday{4}, 4}}) == SV("avr./jeu.[4]")); + TEST_EQUAL(stream_fr_FR_locale(std::chrono::month_weekday{ + std::chrono::month{4}, std::chrono::weekday_indexed{std::chrono::weekday{4}, 4}}), + SV("avr./jeu.[4]")); # else - assert(stream_fr_FR_locale(std::chrono::month_weekday{ - std::chrono::month{4}, std::chrono::weekday_indexed{std::chrono::weekday{4}, 4}}) == SV("avril/jeu.[4]")); + TEST_EQUAL(stream_fr_FR_locale(std::chrono::month_weekday{ + std::chrono::month{4}, std::chrono::weekday_indexed{std::chrono::weekday{4}, 4}}), + SV("avril/jeu.[4]")); # endif - assert(stream_fr_FR_locale(std::chrono::month_weekday{ - std::chrono::month{5}, std::chrono::weekday_indexed{std::chrono::weekday{5}, 5}}) == SV("mai/ven.[5]")); - assert(stream_fr_FR_locale(std::chrono::month_weekday{ - std::chrono::month{6}, std::chrono::weekday_indexed{std::chrono::weekday{6}, 6}}) == - SV("juin/sam.[6 is not a valid index]")); - assert(stream_fr_FR_locale(std::chrono::month_weekday{ - std::chrono::month{7}, std::chrono::weekday_indexed{std::chrono::weekday{7}, 7}}) == - SV("juil./dim.[7 is not a valid index]")); - assert(stream_fr_FR_locale(std::chrono::month_weekday{ - std::chrono::month{8}, std::chrono::weekday_indexed{std::chrono::weekday{8}, 0}}) == - SV("août/8 is not a valid weekday[0 is not a valid index]")); - assert(stream_fr_FR_locale(std::chrono::month_weekday{ - std::chrono::month{9}, std::chrono::weekday_indexed{std::chrono::weekday{0}, 1}}) == SV("sept./dim.[1]")); - assert(stream_fr_FR_locale(std::chrono::month_weekday{ - std::chrono::month{10}, std::chrono::weekday_indexed{std::chrono::weekday{0}, 1}}) == SV("oct./dim.[1]")); - assert(stream_fr_FR_locale(std::chrono::month_weekday{ - std::chrono::month{11}, std::chrono::weekday_indexed{std::chrono::weekday{0}, 1}}) == SV("nov./dim.[1]")); - assert(stream_fr_FR_locale(std::chrono::month_weekday{ - std::chrono::month{12}, std::chrono::weekday_indexed{std::chrono::weekday{0}, 1}}) == SV("déc./dim.[1]")); - assert(stream_fr_FR_locale(std::chrono::month_weekday{ - std::chrono::month{13}, std::chrono::weekday_indexed{std::chrono::weekday{0}, 1}}) == - SV("13 is not a valid month/dim.[1]")); - assert(stream_fr_FR_locale(std::chrono::month_weekday{ - std::chrono::month{255}, std::chrono::weekday_indexed{std::chrono::weekday{8}, 0}}) == - SV("255 is not a valid month/8 is not a valid weekday[0 is not a valid index]")); + TEST_EQUAL(stream_fr_FR_locale(std::chrono::month_weekday{ + std::chrono::month{5}, std::chrono::weekday_indexed{std::chrono::weekday{5}, 5}}), + SV("mai/ven.[5]")); + TEST_EQUAL(stream_fr_FR_locale(std::chrono::month_weekday{ + std::chrono::month{6}, std::chrono::weekday_indexed{std::chrono::weekday{6}, 6}}), + SV("juin/sam.[6 is not a valid index]")); + TEST_EQUAL(stream_fr_FR_locale(std::chrono::month_weekday{ + std::chrono::month{7}, std::chrono::weekday_indexed{std::chrono::weekday{7}, 7}}), + SV("juil./dim.[7 is not a valid index]")); + TEST_EQUAL(stream_fr_FR_locale(std::chrono::month_weekday{ + std::chrono::month{8}, std::chrono::weekday_indexed{std::chrono::weekday{8}, 0}}), + SV("août/8 is not a valid weekday[0 is not a valid index]")); + TEST_EQUAL(stream_fr_FR_locale(std::chrono::month_weekday{ + std::chrono::month{9}, std::chrono::weekday_indexed{std::chrono::weekday{0}, 1}}), + SV("sept./dim.[1]")); + TEST_EQUAL(stream_fr_FR_locale(std::chrono::month_weekday{ + std::chrono::month{10}, std::chrono::weekday_indexed{std::chrono::weekday{0}, 1}}), + SV("oct./dim.[1]")); + TEST_EQUAL(stream_fr_FR_locale(std::chrono::month_weekday{ + std::chrono::month{11}, std::chrono::weekday_indexed{std::chrono::weekday{0}, 1}}), + SV("nov./dim.[1]")); + TEST_EQUAL(stream_fr_FR_locale(std::chrono::month_weekday{ + std::chrono::month{12}, std::chrono::weekday_indexed{std::chrono::weekday{0}, 1}}), + SV("déc./dim.[1]")); + TEST_EQUAL(stream_fr_FR_locale(std::chrono::month_weekday{ + std::chrono::month{13}, std::chrono::weekday_indexed{std::chrono::weekday{0}, 1}}), + SV("13 is not a valid month/dim.[1]")); + TEST_EQUAL(stream_fr_FR_locale(std::chrono::month_weekday{ + std::chrono::month{255}, std::chrono::weekday_indexed{std::chrono::weekday{8}, 0}}), + SV("255 is not a valid month/8 is not a valid weekday[0 is not a valid index]")); #endif // defined(__APPLE__) - assert(stream_ja_JP_locale(std::chrono::month_weekday{ - std::chrono::month{0}, std::chrono::weekday_indexed{std::chrono::weekday{0}, 1}}) == - SV("0 is not a valid month/日[1]")); -#if defined(__APPLE__) - assert(stream_ja_JP_locale(std::chrono::month_weekday{ - std::chrono::month{1}, std::chrono::weekday_indexed{std::chrono::weekday{1}, 1}}) == SV(" 1/月[1]")); - assert(stream_ja_JP_locale(std::chrono::month_weekday{ - std::chrono::month{2}, std::chrono::weekday_indexed{std::chrono::weekday{2}, 2}}) == SV(" 2/火[2]")); - assert(stream_ja_JP_locale(std::chrono::month_weekday{ - std::chrono::month{3}, std::chrono::weekday_indexed{std::chrono::weekday{3}, 3}}) == SV(" 3/水[3]")); - assert(stream_ja_JP_locale(std::chrono::month_weekday{ - std::chrono::month{4}, std::chrono::weekday_indexed{std::chrono::weekday{4}, 4}}) == SV(" 4/木[4]")); - assert(stream_ja_JP_locale(std::chrono::month_weekday{ - std::chrono::month{5}, std::chrono::weekday_indexed{std::chrono::weekday{5}, 5}}) == SV(" 5/金[5]")); - assert(stream_ja_JP_locale(std::chrono::month_weekday{ - std::chrono::month{6}, std::chrono::weekday_indexed{std::chrono::weekday{6}, 6}}) == - SV(" 6/土[6 is not a valid index]")); - assert(stream_ja_JP_locale(std::chrono::month_weekday{ - std::chrono::month{7}, std::chrono::weekday_indexed{std::chrono::weekday{7}, 7}}) == - SV(" 7/日[7 is not a valid index]")); - assert(stream_ja_JP_locale(std::chrono::month_weekday{ - std::chrono::month{8}, std::chrono::weekday_indexed{std::chrono::weekday{8}, 0}}) == - SV(" 8/8 is not a valid weekday[0 is not a valid index]")); - assert(stream_ja_JP_locale(std::chrono::month_weekday{ - std::chrono::month{9}, std::chrono::weekday_indexed{std::chrono::weekday{0}, 1}}) == SV(" 9/日[1]")); - assert(stream_ja_JP_locale(std::chrono::month_weekday{ - std::chrono::month{10}, std::chrono::weekday_indexed{std::chrono::weekday{0}, 1}}) == SV("10/日[1]")); - assert(stream_ja_JP_locale(std::chrono::month_weekday{ - std::chrono::month{11}, std::chrono::weekday_indexed{std::chrono::weekday{0}, 1}}) == SV("11/日[1]")); - assert(stream_ja_JP_locale(std::chrono::month_weekday{ - std::chrono::month{12}, std::chrono::weekday_indexed{std::chrono::weekday{0}, 1}}) == SV("12/日[1]")); -#else // defined(__APPLE__) -# if defined(_WIN32) || defined(_AIX) - assert(stream_ja_JP_locale(std::chrono::month_weekday{ - std::chrono::month{1}, std::chrono::weekday_indexed{std::chrono::weekday{1}, 1}}) == SV("1月/月[1]")); - assert(stream_ja_JP_locale(std::chrono::month_weekday{ - std::chrono::month{2}, std::chrono::weekday_indexed{std::chrono::weekday{2}, 2}}) == SV("2月/火[2]")); - assert(stream_ja_JP_locale(std::chrono::month_weekday{ - std::chrono::month{3}, std::chrono::weekday_indexed{std::chrono::weekday{3}, 3}}) == SV("3月/水[3]")); - assert(stream_ja_JP_locale(std::chrono::month_weekday{ - std::chrono::month{4}, std::chrono::weekday_indexed{std::chrono::weekday{4}, 4}}) == SV("4月/木[4]")); - assert(stream_ja_JP_locale(std::chrono::month_weekday{ - std::chrono::month{5}, std::chrono::weekday_indexed{std::chrono::weekday{5}, 5}}) == SV("5月/金[5]")); - assert(stream_ja_JP_locale(std::chrono::month_weekday{ - std::chrono::month{6}, std::chrono::weekday_indexed{std::chrono::weekday{6}, 6}}) == - SV("6月/土[6 is not a valid index]")); - assert(stream_ja_JP_locale(std::chrono::month_weekday{ - std::chrono::month{7}, std::chrono::weekday_indexed{std::chrono::weekday{7}, 7}}) == - SV("7月/日[7 is not a valid index]")); - assert(stream_ja_JP_locale(std::chrono::month_weekday{ - std::chrono::month{8}, std::chrono::weekday_indexed{std::chrono::weekday{8}, 0}}) == - SV("8月/8 is not a valid weekday[0 is not a valid index]")); - assert(stream_ja_JP_locale(std::chrono::month_weekday{ - std::chrono::month{9}, std::chrono::weekday_indexed{std::chrono::weekday{0}, 1}}) == SV("9月/日[1]")); -# else // defined(_WIN32) || defined(_AIX) - assert(stream_ja_JP_locale(std::chrono::month_weekday{ - std::chrono::month{1}, std::chrono::weekday_indexed{std::chrono::weekday{1}, 1}}) == SV(" 1月/月[1]")); - assert(stream_ja_JP_locale(std::chrono::month_weekday{ - std::chrono::month{2}, std::chrono::weekday_indexed{std::chrono::weekday{2}, 2}}) == SV(" 2月/火[2]")); - assert(stream_ja_JP_locale(std::chrono::month_weekday{ - std::chrono::month{3}, std::chrono::weekday_indexed{std::chrono::weekday{3}, 3}}) == SV(" 3月/水[3]")); - assert(stream_ja_JP_locale(std::chrono::month_weekday{ - std::chrono::month{4}, std::chrono::weekday_indexed{std::chrono::weekday{4}, 4}}) == SV(" 4月/木[4]")); - assert(stream_ja_JP_locale(std::chrono::month_weekday{ - std::chrono::month{5}, std::chrono::weekday_indexed{std::chrono::weekday{5}, 5}}) == SV(" 5月/金[5]")); - assert(stream_ja_JP_locale(std::chrono::month_weekday{ - std::chrono::month{6}, std::chrono::weekday_indexed{std::chrono::weekday{6}, 6}}) == - SV(" 6月/土[6 is not a valid index]")); - assert(stream_ja_JP_locale(std::chrono::month_weekday{ - std::chrono::month{7}, std::chrono::weekday_indexed{std::chrono::weekday{7}, 7}}) == - SV(" 7月/日[7 is not a valid index]")); - assert(stream_ja_JP_locale(std::chrono::month_weekday{ - std::chrono::month{8}, std::chrono::weekday_indexed{std::chrono::weekday{8}, 0}}) == - SV(" 8月/8 is not a valid weekday[0 is not a valid index]")); - assert(stream_ja_JP_locale(std::chrono::month_weekday{ - std::chrono::month{9}, std::chrono::weekday_indexed{std::chrono::weekday{0}, 1}}) == SV(" 9月/日[1]")); -# endif // defined(_WIN32) || defined(_AIX) - assert(stream_ja_JP_locale(std::chrono::month_weekday{ - std::chrono::month{10}, std::chrono::weekday_indexed{std::chrono::weekday{0}, 1}}) == SV("10月/日[1]")); - assert(stream_ja_JP_locale(std::chrono::month_weekday{ - std::chrono::month{11}, std::chrono::weekday_indexed{std::chrono::weekday{0}, 1}}) == SV("11月/日[1]")); - assert(stream_ja_JP_locale(std::chrono::month_weekday{ - std::chrono::month{12}, std::chrono::weekday_indexed{std::chrono::weekday{0}, 1}}) == SV("12月/日[1]")); -#endif // defined(__APPLE__) - assert(stream_ja_JP_locale(std::chrono::month_weekday{ - std::chrono::month{13}, std::chrono::weekday_indexed{std::chrono::weekday{0}, 1}}) == - SV("13 is not a valid month/日[1]")); - assert(stream_ja_JP_locale(std::chrono::month_weekday{ - std::chrono::month{255}, std::chrono::weekday_indexed{std::chrono::weekday{8}, 0}}) == - SV("255 is not a valid month/8 is not a valid weekday[0 is not a valid index]")); + TEST_EQUAL(stream_ja_JP_locale(std::chrono::month_weekday{ + std::chrono::month{0}, std::chrono::weekday_indexed{std::chrono::weekday{0}, 1}}), + SV("0 is not a valid month/日[1]")); +#if defined(__APPLE__) || defined(_WIN32) +# if defined(__APPLE__) + TEST_EQUAL(stream_ja_JP_locale(std::chrono::month_weekday{ + std::chrono::month{1}, std::chrono::weekday_indexed{std::chrono::weekday{1}, 1}}), + SV(" 1/月[1]")); + TEST_EQUAL(stream_ja_JP_locale(std::chrono::month_weekday{ + std::chrono::month{2}, std::chrono::weekday_indexed{std::chrono::weekday{2}, 2}}), + SV(" 2/火[2]")); + TEST_EQUAL(stream_ja_JP_locale(std::chrono::month_weekday{ + std::chrono::month{3}, std::chrono::weekday_indexed{std::chrono::weekday{3}, 3}}), + SV(" 3/水[3]")); + TEST_EQUAL(stream_ja_JP_locale(std::chrono::month_weekday{ + std::chrono::month{4}, std::chrono::weekday_indexed{std::chrono::weekday{4}, 4}}), + SV(" 4/木[4]")); + TEST_EQUAL(stream_ja_JP_locale(std::chrono::month_weekday{ + std::chrono::month{5}, std::chrono::weekday_indexed{std::chrono::weekday{5}, 5}}), + SV(" 5/金[5]")); + TEST_EQUAL(stream_ja_JP_locale(std::chrono::month_weekday{ + std::chrono::month{6}, std::chrono::weekday_indexed{std::chrono::weekday{6}, 6}}), + SV(" 6/土[6 is not a valid index]")); + TEST_EQUAL(stream_ja_JP_locale(std::chrono::month_weekday{ + std::chrono::month{7}, std::chrono::weekday_indexed{std::chrono::weekday{7}, 7}}), + SV(" 7/日[7 is not a valid index]")); + TEST_EQUAL(stream_ja_JP_locale(std::chrono::month_weekday{ + std::chrono::month{8}, std::chrono::weekday_indexed{std::chrono::weekday{8}, 0}}), + SV(" 8/8 is not a valid weekday[0 is not a valid index]")); + TEST_EQUAL(stream_ja_JP_locale(std::chrono::month_weekday{ + std::chrono::month{9}, std::chrono::weekday_indexed{std::chrono::weekday{0}, 1}}), + SV(" 9/日[1]")); +# else // defined(__APPLE__) + TEST_EQUAL(stream_ja_JP_locale(std::chrono::month_weekday{ + std::chrono::month{1}, std::chrono::weekday_indexed{std::chrono::weekday{1}, 1}}), + SV("1/月[1]")); + TEST_EQUAL(stream_ja_JP_locale(std::chrono::month_weekday{ + std::chrono::month{2}, std::chrono::weekday_indexed{std::chrono::weekday{2}, 2}}), + SV("2/火[2]")); + TEST_EQUAL(stream_ja_JP_locale(std::chrono::month_weekday{ + std::chrono::month{3}, std::chrono::weekday_indexed{std::chrono::weekday{3}, 3}}), + SV("3/水[3]")); + TEST_EQUAL(stream_ja_JP_locale(std::chrono::month_weekday{ + std::chrono::month{4}, std::chrono::weekday_indexed{std::chrono::weekday{4}, 4}}), + SV("4/木[4]")); + TEST_EQUAL(stream_ja_JP_locale(std::chrono::month_weekday{ + std::chrono::month{5}, std::chrono::weekday_indexed{std::chrono::weekday{5}, 5}}), + SV("5/金[5]")); + TEST_EQUAL(stream_ja_JP_locale(std::chrono::month_weekday{ + std::chrono::month{6}, std::chrono::weekday_indexed{std::chrono::weekday{6}, 6}}), + SV("6/土[6 is not a valid index]")); + TEST_EQUAL(stream_ja_JP_locale(std::chrono::month_weekday{ + std::chrono::month{7}, std::chrono::weekday_indexed{std::chrono::weekday{7}, 7}}), + SV("7/日[7 is not a valid index]")); + TEST_EQUAL(stream_ja_JP_locale(std::chrono::month_weekday{ + std::chrono::month{8}, std::chrono::weekday_indexed{std::chrono::weekday{8}, 0}}), + SV("8/8 is not a valid weekday[0 is not a valid index]")); + TEST_EQUAL(stream_ja_JP_locale(std::chrono::month_weekday{ + std::chrono::month{9}, std::chrono::weekday_indexed{std::chrono::weekday{0}, 1}}), + SV("9/日[1]")); +# endif // defined(__APPLE__) + TEST_EQUAL(stream_ja_JP_locale(std::chrono::month_weekday{ + std::chrono::month{10}, std::chrono::weekday_indexed{std::chrono::weekday{0}, 1}}), + SV("10/日[1]")); + TEST_EQUAL(stream_ja_JP_locale(std::chrono::month_weekday{ + std::chrono::month{11}, std::chrono::weekday_indexed{std::chrono::weekday{0}, 1}}), + SV("11/日[1]")); + TEST_EQUAL(stream_ja_JP_locale(std::chrono::month_weekday{ + std::chrono::month{12}, std::chrono::weekday_indexed{std::chrono::weekday{0}, 1}}), + SV("12/日[1]")); +#else // defined(__APPLE__) || defined(_WIN32) +# if defined(_AIX) + TEST_EQUAL(stream_ja_JP_locale(std::chrono::month_weekday{ + std::chrono::month{1}, std::chrono::weekday_indexed{std::chrono::weekday{1}, 1}}), + SV("1月/月[1]")); + TEST_EQUAL(stream_ja_JP_locale(std::chrono::month_weekday{ + std::chrono::month{2}, std::chrono::weekday_indexed{std::chrono::weekday{2}, 2}}), + SV("2月/火[2]")); + TEST_EQUAL(stream_ja_JP_locale(std::chrono::month_weekday{ + std::chrono::month{3}, std::chrono::weekday_indexed{std::chrono::weekday{3}, 3}}), + SV("3月/水[3]")); + TEST_EQUAL(stream_ja_JP_locale(std::chrono::month_weekday{ + std::chrono::month{4}, std::chrono::weekday_indexed{std::chrono::weekday{4}, 4}}), + SV("4月/木[4]")); + TEST_EQUAL(stream_ja_JP_locale(std::chrono::month_weekday{ + std::chrono::month{5}, std::chrono::weekday_indexed{std::chrono::weekday{5}, 5}}), + SV("5月/金[5]")); + TEST_EQUAL(stream_ja_JP_locale(std::chrono::month_weekday{ + std::chrono::month{6}, std::chrono::weekday_indexed{std::chrono::weekday{6}, 6}}), + SV("6月/土[6 is not a valid index]")); + TEST_EQUAL(stream_ja_JP_locale(std::chrono::month_weekday{ + std::chrono::month{7}, std::chrono::weekday_indexed{std::chrono::weekday{7}, 7}}), + SV("7月/日[7 is not a valid index]")); + TEST_EQUAL(stream_ja_JP_locale(std::chrono::month_weekday{ + std::chrono::month{8}, std::chrono::weekday_indexed{std::chrono::weekday{8}, 0}}), + SV("8月/8 is not a valid weekday[0 is not a valid index]")); + TEST_EQUAL(stream_ja_JP_locale(std::chrono::month_weekday{ + std::chrono::month{9}, std::chrono::weekday_indexed{std::chrono::weekday{0}, 1}}), + SV("9月/日[1]")); +# else // defined(_AIX) + TEST_EQUAL(stream_ja_JP_locale(std::chrono::month_weekday{ + std::chrono::month{1}, std::chrono::weekday_indexed{std::chrono::weekday{1}, 1}}), + SV(" 1月/月[1]")); + TEST_EQUAL(stream_ja_JP_locale(std::chrono::month_weekday{ + std::chrono::month{2}, std::chrono::weekday_indexed{std::chrono::weekday{2}, 2}}), + SV(" 2月/火[2]")); + TEST_EQUAL(stream_ja_JP_locale(std::chrono::month_weekday{ + std::chrono::month{3}, std::chrono::weekday_indexed{std::chrono::weekday{3}, 3}}), + SV(" 3月/水[3]")); + TEST_EQUAL(stream_ja_JP_locale(std::chrono::month_weekday{ + std::chrono::month{4}, std::chrono::weekday_indexed{std::chrono::weekday{4}, 4}}), + SV(" 4月/木[4]")); + TEST_EQUAL(stream_ja_JP_locale(std::chrono::month_weekday{ + std::chrono::month{5}, std::chrono::weekday_indexed{std::chrono::weekday{5}, 5}}), + SV(" 5月/金[5]")); + TEST_EQUAL(stream_ja_JP_locale(std::chrono::month_weekday{ + std::chrono::month{6}, std::chrono::weekday_indexed{std::chrono::weekday{6}, 6}}), + SV(" 6月/土[6 is not a valid index]")); + TEST_EQUAL(stream_ja_JP_locale(std::chrono::month_weekday{ + std::chrono::month{7}, std::chrono::weekday_indexed{std::chrono::weekday{7}, 7}}), + SV(" 7月/日[7 is not a valid index]")); + TEST_EQUAL(stream_ja_JP_locale(std::chrono::month_weekday{ + std::chrono::month{8}, std::chrono::weekday_indexed{std::chrono::weekday{8}, 0}}), + SV(" 8月/8 is not a valid weekday[0 is not a valid index]")); + TEST_EQUAL(stream_ja_JP_locale(std::chrono::month_weekday{ + std::chrono::month{9}, std::chrono::weekday_indexed{std::chrono::weekday{0}, 1}}), + SV(" 9月/日[1]")); +# endif // defined(_AIX) + TEST_EQUAL(stream_ja_JP_locale(std::chrono::month_weekday{ + std::chrono::month{10}, std::chrono::weekday_indexed{std::chrono::weekday{0}, 1}}), + SV("10月/日[1]")); + TEST_EQUAL(stream_ja_JP_locale(std::chrono::month_weekday{ + std::chrono::month{11}, std::chrono::weekday_indexed{std::chrono::weekday{0}, 1}}), + SV("11月/日[1]")); + TEST_EQUAL(stream_ja_JP_locale(std::chrono::month_weekday{ + std::chrono::month{12}, std::chrono::weekday_indexed{std::chrono::weekday{0}, 1}}), + SV("12月/日[1]")); +#endif // defined(__APPLE__) || defined(_WIN32) + TEST_EQUAL(stream_ja_JP_locale(std::chrono::month_weekday{ + std::chrono::month{13}, std::chrono::weekday_indexed{std::chrono::weekday{0}, 1}}), + SV("13 is not a valid month/日[1]")); + TEST_EQUAL(stream_ja_JP_locale(std::chrono::month_weekday{ + std::chrono::month{255}, std::chrono::weekday_indexed{std::chrono::weekday{8}, 0}}), + SV("255 is not a valid month/8 is not a valid weekday[0 is not a valid index]")); } int main(int, char**) { diff --git a/libcxx/test/std/time/time.cal/time.cal.mwdlast/time.cal.mwdlast.nonmembers/ostream.pass.cpp b/libcxx/test/std/time/time.cal/time.cal.mwdlast/time.cal.mwdlast.nonmembers/ostream.pass.cpp --- a/libcxx/test/std/time/time.cal/time.cal.mwdlast/time.cal.mwdlast.nonmembers/ostream.pass.cpp +++ b/libcxx/test/std/time/time.cal/time.cal.mwdlast/time.cal.mwdlast.nonmembers/ostream.pass.cpp @@ -11,9 +11,6 @@ // UNSUPPORTED: c++03, c++11, c++14, c++17 // UNSUPPORTED: no-localization -// 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 @@ -38,9 +35,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; @@ -68,205 +72,299 @@ template static void test() { - assert(stream_c_locale(std::chrono::month_weekday_last{ - std::chrono::month{0}, std::chrono::weekday_last{std::chrono::weekday{0}}}) == - SV("0 is not a valid month/Sun[last]")); - assert(stream_c_locale(std::chrono::month_weekday_last{ - std::chrono::month{1}, std::chrono::weekday_last{std::chrono::weekday{0}}}) == SV("Jan/Sun[last]")); - assert(stream_c_locale(std::chrono::month_weekday_last{ - std::chrono::month{2}, std::chrono::weekday_last{std::chrono::weekday{1}}}) == SV("Feb/Mon[last]")); - assert(stream_c_locale(std::chrono::month_weekday_last{ - std::chrono::month{3}, std::chrono::weekday_last{std::chrono::weekday{2}}}) == SV("Mar/Tue[last]")); - assert(stream_c_locale(std::chrono::month_weekday_last{ - std::chrono::month{4}, std::chrono::weekday_last{std::chrono::weekday{3}}}) == SV("Apr/Wed[last]")); - assert(stream_c_locale(std::chrono::month_weekday_last{ - std::chrono::month{5}, std::chrono::weekday_last{std::chrono::weekday{4}}}) == SV("May/Thu[last]")); - assert(stream_c_locale(std::chrono::month_weekday_last{ - std::chrono::month{6}, std::chrono::weekday_last{std::chrono::weekday{5}}}) == SV("Jun/Fri[last]")); - assert(stream_c_locale(std::chrono::month_weekday_last{ - std::chrono::month{7}, std::chrono::weekday_last{std::chrono::weekday{6}}}) == SV("Jul/Sat[last]")); - assert(stream_c_locale(std::chrono::month_weekday_last{ - std::chrono::month{8}, std::chrono::weekday_last{std::chrono::weekday{7}}}) == SV("Aug/Sun[last]")); - assert(stream_c_locale(std::chrono::month_weekday_last{ - std::chrono::month{9}, std::chrono::weekday_last{std::chrono::weekday{8}}}) == - SV("Sep/8 is not a valid weekday[last]")); - assert(stream_c_locale(std::chrono::month_weekday_last{ - std::chrono::month{10}, std::chrono::weekday_last{std::chrono::weekday{0}}}) == SV("Oct/Sun[last]")); - assert(stream_c_locale(std::chrono::month_weekday_last{ - std::chrono::month{11}, std::chrono::weekday_last{std::chrono::weekday{0}}}) == SV("Nov/Sun[last]")); - assert(stream_c_locale(std::chrono::month_weekday_last{ - std::chrono::month{12}, std::chrono::weekday_last{std::chrono::weekday{0}}}) == SV("Dec/Sun[last]")); - assert(stream_c_locale(std::chrono::month_weekday_last{ - std::chrono::month{13}, std::chrono::weekday_last{std::chrono::weekday{0}}}) == - SV("13 is not a valid month/Sun[last]")); - assert(stream_c_locale(std::chrono::month_weekday_last{ - std::chrono::month{255}, std::chrono::weekday_last{std::chrono::weekday{8}}}) == - SV("255 is not a valid month/8 is not a valid weekday[last]")); + TEST_EQUAL(stream_c_locale(std::chrono::month_weekday_last{ + std::chrono::month{0}, std::chrono::weekday_last{std::chrono::weekday{0}}}), + SV("0 is not a valid month/Sun[last]")); + TEST_EQUAL(stream_c_locale(std::chrono::month_weekday_last{ + std::chrono::month{1}, std::chrono::weekday_last{std::chrono::weekday{0}}}), + SV("Jan/Sun[last]")); + TEST_EQUAL(stream_c_locale(std::chrono::month_weekday_last{ + std::chrono::month{2}, std::chrono::weekday_last{std::chrono::weekday{1}}}), + SV("Feb/Mon[last]")); + TEST_EQUAL(stream_c_locale(std::chrono::month_weekday_last{ + std::chrono::month{3}, std::chrono::weekday_last{std::chrono::weekday{2}}}), + SV("Mar/Tue[last]")); + TEST_EQUAL(stream_c_locale(std::chrono::month_weekday_last{ + std::chrono::month{4}, std::chrono::weekday_last{std::chrono::weekday{3}}}), + SV("Apr/Wed[last]")); + TEST_EQUAL(stream_c_locale(std::chrono::month_weekday_last{ + std::chrono::month{5}, std::chrono::weekday_last{std::chrono::weekday{4}}}), + SV("May/Thu[last]")); + TEST_EQUAL(stream_c_locale(std::chrono::month_weekday_last{ + std::chrono::month{6}, std::chrono::weekday_last{std::chrono::weekday{5}}}), + SV("Jun/Fri[last]")); + TEST_EQUAL(stream_c_locale(std::chrono::month_weekday_last{ + std::chrono::month{7}, std::chrono::weekday_last{std::chrono::weekday{6}}}), + SV("Jul/Sat[last]")); + TEST_EQUAL(stream_c_locale(std::chrono::month_weekday_last{ + std::chrono::month{8}, std::chrono::weekday_last{std::chrono::weekday{7}}}), + SV("Aug/Sun[last]")); + TEST_EQUAL(stream_c_locale(std::chrono::month_weekday_last{ + std::chrono::month{9}, std::chrono::weekday_last{std::chrono::weekday{8}}}), + SV("Sep/8 is not a valid weekday[last]")); + TEST_EQUAL(stream_c_locale(std::chrono::month_weekday_last{ + std::chrono::month{10}, std::chrono::weekday_last{std::chrono::weekday{0}}}), + SV("Oct/Sun[last]")); + TEST_EQUAL(stream_c_locale(std::chrono::month_weekday_last{ + std::chrono::month{11}, std::chrono::weekday_last{std::chrono::weekday{0}}}), + SV("Nov/Sun[last]")); + TEST_EQUAL(stream_c_locale(std::chrono::month_weekday_last{ + std::chrono::month{12}, std::chrono::weekday_last{std::chrono::weekday{0}}}), + SV("Dec/Sun[last]")); + TEST_EQUAL(stream_c_locale(std::chrono::month_weekday_last{ + std::chrono::month{13}, std::chrono::weekday_last{std::chrono::weekday{0}}}), + SV("13 is not a valid month/Sun[last]")); + TEST_EQUAL(stream_c_locale(std::chrono::month_weekday_last{ + std::chrono::month{255}, std::chrono::weekday_last{std::chrono::weekday{8}}}), + SV("255 is not a valid month/8 is not a valid weekday[last]")); #if defined(__APPLE__) - assert(stream_fr_FR_locale(std::chrono::month_weekday_last{ - std::chrono::month{0}, std::chrono::weekday_last{std::chrono::weekday{0}}}) == - SV("0 is not a valid month/Dim[last]")); - assert(stream_fr_FR_locale(std::chrono::month_weekday_last{ - std::chrono::month{1}, std::chrono::weekday_last{std::chrono::weekday{0}}}) == SV("jan/Dim[last]")); - assert(stream_fr_FR_locale(std::chrono::month_weekday_last{ - std::chrono::month{2}, std::chrono::weekday_last{std::chrono::weekday{1}}}) == SV("fév/Lun[last]")); - assert(stream_fr_FR_locale(std::chrono::month_weekday_last{ - std::chrono::month{3}, std::chrono::weekday_last{std::chrono::weekday{2}}}) == SV("mar/Mar[last]")); - assert(stream_fr_FR_locale(std::chrono::month_weekday_last{ - std::chrono::month{4}, std::chrono::weekday_last{std::chrono::weekday{3}}}) == SV("avr/Mer[last]")); - assert(stream_fr_FR_locale(std::chrono::month_weekday_last{ - std::chrono::month{5}, std::chrono::weekday_last{std::chrono::weekday{4}}}) == SV("mai/Jeu[last]")); - assert(stream_fr_FR_locale(std::chrono::month_weekday_last{ - std::chrono::month{6}, std::chrono::weekday_last{std::chrono::weekday{5}}}) == SV("jui/Ven[last]")); - assert(stream_fr_FR_locale(std::chrono::month_weekday_last{ - std::chrono::month{7}, std::chrono::weekday_last{std::chrono::weekday{6}}}) == SV("jul/Sam[last]")); - assert(stream_fr_FR_locale(std::chrono::month_weekday_last{ - std::chrono::month{8}, std::chrono::weekday_last{std::chrono::weekday{7}}}) == SV("aoû/Dim[last]")); - assert(stream_fr_FR_locale(std::chrono::month_weekday_last{ - std::chrono::month{9}, std::chrono::weekday_last{std::chrono::weekday{8}}}) == - SV("sep/8 is not a valid weekday[last]")); - assert(stream_fr_FR_locale(std::chrono::month_weekday_last{ - std::chrono::month{10}, std::chrono::weekday_last{std::chrono::weekday{0}}}) == SV("oct/Dim[last]")); - assert(stream_fr_FR_locale(std::chrono::month_weekday_last{ - std::chrono::month{11}, std::chrono::weekday_last{std::chrono::weekday{0}}}) == SV("nov/Dim[last]")); - assert(stream_fr_FR_locale(std::chrono::month_weekday_last{ - std::chrono::month{12}, std::chrono::weekday_last{std::chrono::weekday{0}}}) == SV("déc/Dim[last]")); - assert(stream_fr_FR_locale(std::chrono::month_weekday_last{ - std::chrono::month{13}, std::chrono::weekday_last{std::chrono::weekday{0}}}) == - SV("13 is not a valid month/Dim[last]")); -#else // defined(__APPLE__) - assert(stream_fr_FR_locale(std::chrono::month_weekday_last{ - std::chrono::month{0}, std::chrono::weekday_last{std::chrono::weekday{0}}}) == - SV("0 is not a valid month/dim.[last]")); - assert(stream_fr_FR_locale(std::chrono::month_weekday_last{ - std::chrono::month{1}, std::chrono::weekday_last{std::chrono::weekday{0}}}) == SV("janv./dim.[last]")); - assert(stream_fr_FR_locale(std::chrono::month_weekday_last{ - std::chrono::month{2}, std::chrono::weekday_last{std::chrono::weekday{1}}}) == SV("févr./lun.[last]")); - assert(stream_fr_FR_locale(std::chrono::month_weekday_last{ - std::chrono::month{3}, std::chrono::weekday_last{std::chrono::weekday{2}}}) == SV("mars/mar.[last]")); + TEST_EQUAL(stream_fr_FR_locale(std::chrono::month_weekday_last{ + std::chrono::month{0}, std::chrono::weekday_last{std::chrono::weekday{0}}}), + SV("0 is not a valid month/Dim[last]")); + TEST_EQUAL(stream_fr_FR_locale(std::chrono::month_weekday_last{ + std::chrono::month{1}, std::chrono::weekday_last{std::chrono::weekday{0}}}), + SV("jan/Dim[last]")); + TEST_EQUAL(stream_fr_FR_locale(std::chrono::month_weekday_last{ + std::chrono::month{2}, std::chrono::weekday_last{std::chrono::weekday{1}}}), + SV("fév/Lun[last]")); + TEST_EQUAL(stream_fr_FR_locale(std::chrono::month_weekday_last{ + std::chrono::month{3}, std::chrono::weekday_last{std::chrono::weekday{2}}}), + SV("mar/Mar[last]")); + TEST_EQUAL(stream_fr_FR_locale(std::chrono::month_weekday_last{ + std::chrono::month{4}, std::chrono::weekday_last{std::chrono::weekday{3}}}), + SV("avr/Mer[last]")); + TEST_EQUAL(stream_fr_FR_locale(std::chrono::month_weekday_last{ + std::chrono::month{5}, std::chrono::weekday_last{std::chrono::weekday{4}}}), + SV("mai/Jeu[last]")); + TEST_EQUAL(stream_fr_FR_locale(std::chrono::month_weekday_last{ + std::chrono::month{6}, std::chrono::weekday_last{std::chrono::weekday{5}}}), + SV("jui/Ven[last]")); + TEST_EQUAL(stream_fr_FR_locale(std::chrono::month_weekday_last{ + std::chrono::month{7}, std::chrono::weekday_last{std::chrono::weekday{6}}}), + SV("jul/Sam[last]")); + TEST_EQUAL(stream_fr_FR_locale(std::chrono::month_weekday_last{ + std::chrono::month{8}, std::chrono::weekday_last{std::chrono::weekday{7}}}), + SV("aoû/Dim[last]")); + TEST_EQUAL(stream_fr_FR_locale(std::chrono::month_weekday_last{ + std::chrono::month{9}, std::chrono::weekday_last{std::chrono::weekday{8}}}), + SV("sep/8 is not a valid weekday[last]")); + TEST_EQUAL(stream_fr_FR_locale(std::chrono::month_weekday_last{ + std::chrono::month{10}, std::chrono::weekday_last{std::chrono::weekday{0}}}), + SV("oct/Dim[last]")); + TEST_EQUAL(stream_fr_FR_locale(std::chrono::month_weekday_last{ + std::chrono::month{11}, std::chrono::weekday_last{std::chrono::weekday{0}}}), + SV("nov/Dim[last]")); + TEST_EQUAL(stream_fr_FR_locale(std::chrono::month_weekday_last{ + std::chrono::month{12}, std::chrono::weekday_last{std::chrono::weekday{0}}}), + SV("déc/Dim[last]")); + TEST_EQUAL(stream_fr_FR_locale(std::chrono::month_weekday_last{ + std::chrono::month{13}, std::chrono::weekday_last{std::chrono::weekday{0}}}), + SV("13 is not a valid month/Dim[last]")); +#else // defined(__APPLE__) + TEST_EQUAL(stream_fr_FR_locale(std::chrono::month_weekday_last{ + std::chrono::month{0}, std::chrono::weekday_last{std::chrono::weekday{0}}}), + SV("0 is not a valid month/dim.[last]")); + TEST_EQUAL(stream_fr_FR_locale(std::chrono::month_weekday_last{ + std::chrono::month{1}, std::chrono::weekday_last{std::chrono::weekday{0}}}), + SV("janv./dim.[last]")); + TEST_EQUAL(stream_fr_FR_locale(std::chrono::month_weekday_last{ + std::chrono::month{2}, std::chrono::weekday_last{std::chrono::weekday{1}}}), + SV("févr./lun.[last]")); + TEST_EQUAL(stream_fr_FR_locale(std::chrono::month_weekday_last{ + std::chrono::month{3}, std::chrono::weekday_last{std::chrono::weekday{2}}}), + SV("mars/mar.[last]")); # if defined(_WIN32) || defined(_AIX) - assert(stream_fr_FR_locale(std::chrono::month_weekday_last{ - std::chrono::month{4}, std::chrono::weekday_last{std::chrono::weekday{3}}}) == SV("avr./mer.[last]")); + TEST_EQUAL(stream_fr_FR_locale(std::chrono::month_weekday_last{ + std::chrono::month{4}, std::chrono::weekday_last{std::chrono::weekday{3}}}), + SV("avr./mer.[last]")); # else // defined(_WIN32) || defined(_AIX) - assert(stream_fr_FR_locale(std::chrono::month_weekday_last{ - std::chrono::month{4}, std::chrono::weekday_last{std::chrono::weekday{3}}}) == SV("avril/mer.[last]")); + TEST_EQUAL(stream_fr_FR_locale(std::chrono::month_weekday_last{ + std::chrono::month{4}, std::chrono::weekday_last{std::chrono::weekday{3}}}), + SV("avril/mer.[last]")); # endif // defined(_WIN32) || defined(_AIX) - assert(stream_fr_FR_locale(std::chrono::month_weekday_last{ - std::chrono::month{5}, std::chrono::weekday_last{std::chrono::weekday{4}}}) == SV("mai/jeu.[last]")); - assert(stream_fr_FR_locale(std::chrono::month_weekday_last{ - std::chrono::month{6}, std::chrono::weekday_last{std::chrono::weekday{5}}}) == SV("juin/ven.[last]")); - assert(stream_fr_FR_locale(std::chrono::month_weekday_last{ - std::chrono::month{7}, std::chrono::weekday_last{std::chrono::weekday{6}}}) == SV("juil./sam.[last]")); - assert(stream_fr_FR_locale(std::chrono::month_weekday_last{ - std::chrono::month{8}, std::chrono::weekday_last{std::chrono::weekday{7}}}) == SV("août/dim.[last]")); - assert(stream_fr_FR_locale(std::chrono::month_weekday_last{ - std::chrono::month{9}, std::chrono::weekday_last{std::chrono::weekday{8}}}) == - SV("sept./8 is not a valid weekday[last]")); - assert(stream_fr_FR_locale(std::chrono::month_weekday_last{ - std::chrono::month{10}, std::chrono::weekday_last{std::chrono::weekday{0}}}) == SV("oct./dim.[last]")); - assert(stream_fr_FR_locale(std::chrono::month_weekday_last{ - std::chrono::month{11}, std::chrono::weekday_last{std::chrono::weekday{0}}}) == SV("nov./dim.[last]")); - assert(stream_fr_FR_locale(std::chrono::month_weekday_last{ - std::chrono::month{12}, std::chrono::weekday_last{std::chrono::weekday{0}}}) == SV("déc./dim.[last]")); - assert(stream_fr_FR_locale(std::chrono::month_weekday_last{ - std::chrono::month{13}, std::chrono::weekday_last{std::chrono::weekday{0}}}) == - SV("13 is not a valid month/dim.[last]")); + TEST_EQUAL(stream_fr_FR_locale(std::chrono::month_weekday_last{ + std::chrono::month{5}, std::chrono::weekday_last{std::chrono::weekday{4}}}), + SV("mai/jeu.[last]")); + TEST_EQUAL(stream_fr_FR_locale(std::chrono::month_weekday_last{ + std::chrono::month{6}, std::chrono::weekday_last{std::chrono::weekday{5}}}), + SV("juin/ven.[last]")); + TEST_EQUAL(stream_fr_FR_locale(std::chrono::month_weekday_last{ + std::chrono::month{7}, std::chrono::weekday_last{std::chrono::weekday{6}}}), + SV("juil./sam.[last]")); + TEST_EQUAL(stream_fr_FR_locale(std::chrono::month_weekday_last{ + std::chrono::month{8}, std::chrono::weekday_last{std::chrono::weekday{7}}}), + SV("août/dim.[last]")); + TEST_EQUAL(stream_fr_FR_locale(std::chrono::month_weekday_last{ + std::chrono::month{9}, std::chrono::weekday_last{std::chrono::weekday{8}}}), + SV("sept./8 is not a valid weekday[last]")); + TEST_EQUAL(stream_fr_FR_locale(std::chrono::month_weekday_last{ + std::chrono::month{10}, std::chrono::weekday_last{std::chrono::weekday{0}}}), + SV("oct./dim.[last]")); + TEST_EQUAL(stream_fr_FR_locale(std::chrono::month_weekday_last{ + std::chrono::month{11}, std::chrono::weekday_last{std::chrono::weekday{0}}}), + SV("nov./dim.[last]")); + TEST_EQUAL(stream_fr_FR_locale(std::chrono::month_weekday_last{ + std::chrono::month{12}, std::chrono::weekday_last{std::chrono::weekday{0}}}), + SV("déc./dim.[last]")); + TEST_EQUAL(stream_fr_FR_locale(std::chrono::month_weekday_last{ + std::chrono::month{13}, std::chrono::weekday_last{std::chrono::weekday{0}}}), + SV("13 is not a valid month/dim.[last]")); #endif // defined(__APPLE__) - assert(stream_fr_FR_locale(std::chrono::month_weekday_last{ - std::chrono::month{255}, std::chrono::weekday_last{std::chrono::weekday{8}}}) == - SV("255 is not a valid month/8 is not a valid weekday[last]")); + TEST_EQUAL(stream_fr_FR_locale(std::chrono::month_weekday_last{ + std::chrono::month{255}, std::chrono::weekday_last{std::chrono::weekday{8}}}), + SV("255 is not a valid month/8 is not a valid weekday[last]")); -#if defined(__APPLE__) - assert(stream_ja_JP_locale(std::chrono::month_weekday_last{ - std::chrono::month{0}, std::chrono::weekday_last{std::chrono::weekday{0}}}) == - SV("0 is not a valid month/日[last]")); - assert(stream_ja_JP_locale(std::chrono::month_weekday_last{ - std::chrono::month{1}, std::chrono::weekday_last{std::chrono::weekday{0}}}) == SV(" 1/日[last]")); - assert(stream_ja_JP_locale(std::chrono::month_weekday_last{ - std::chrono::month{2}, std::chrono::weekday_last{std::chrono::weekday{1}}}) == SV(" 2/月[last]")); - assert(stream_ja_JP_locale(std::chrono::month_weekday_last{ - std::chrono::month{3}, std::chrono::weekday_last{std::chrono::weekday{2}}}) == SV(" 3/火[last]")); - assert(stream_ja_JP_locale(std::chrono::month_weekday_last{ - std::chrono::month{4}, std::chrono::weekday_last{std::chrono::weekday{3}}}) == SV(" 4/水[last]")); - assert(stream_ja_JP_locale(std::chrono::month_weekday_last{ - std::chrono::month{5}, std::chrono::weekday_last{std::chrono::weekday{4}}}) == SV(" 5/木[last]")); - assert(stream_ja_JP_locale(std::chrono::month_weekday_last{ - std::chrono::month{6}, std::chrono::weekday_last{std::chrono::weekday{5}}}) == SV(" 6/金[last]")); - assert(stream_ja_JP_locale(std::chrono::month_weekday_last{ - std::chrono::month{7}, std::chrono::weekday_last{std::chrono::weekday{6}}}) == SV(" 7/土[last]")); - assert(stream_ja_JP_locale(std::chrono::month_weekday_last{ - std::chrono::month{8}, std::chrono::weekday_last{std::chrono::weekday{7}}}) == SV(" 8/日[last]")); - assert(stream_ja_JP_locale(std::chrono::month_weekday_last{ - std::chrono::month{9}, std::chrono::weekday_last{std::chrono::weekday{8}}}) == - SV(" 9/8 is not a valid weekday[last]")); - assert(stream_ja_JP_locale(std::chrono::month_weekday_last{ - std::chrono::month{10}, std::chrono::weekday_last{std::chrono::weekday{0}}}) == SV("10/日[last]")); - assert(stream_ja_JP_locale(std::chrono::month_weekday_last{ - std::chrono::month{11}, std::chrono::weekday_last{std::chrono::weekday{0}}}) == SV("11/日[last]")); - assert(stream_ja_JP_locale(std::chrono::month_weekday_last{ - std::chrono::month{12}, std::chrono::weekday_last{std::chrono::weekday{0}}}) == SV("12/日[last]")); -#else // defined(__APPLE__) -# if defined(_WIN32) || defined(_AIX) - assert(stream_ja_JP_locale(std::chrono::month_weekday_last{ - std::chrono::month{0}, std::chrono::weekday_last{std::chrono::weekday{0}}}) == - SV("0 is not a valid month/日[last]")); - assert(stream_ja_JP_locale(std::chrono::month_weekday_last{ - std::chrono::month{1}, std::chrono::weekday_last{std::chrono::weekday{0}}}) == SV("1月/日[last]")); - assert(stream_ja_JP_locale(std::chrono::month_weekday_last{ - std::chrono::month{2}, std::chrono::weekday_last{std::chrono::weekday{1}}}) == SV("2月/月[last]")); - assert(stream_ja_JP_locale(std::chrono::month_weekday_last{ - std::chrono::month{3}, std::chrono::weekday_last{std::chrono::weekday{2}}}) == SV("3月/火[last]")); - assert(stream_ja_JP_locale(std::chrono::month_weekday_last{ - std::chrono::month{4}, std::chrono::weekday_last{std::chrono::weekday{3}}}) == SV("4月/水[last]")); - assert(stream_ja_JP_locale(std::chrono::month_weekday_last{ - std::chrono::month{5}, std::chrono::weekday_last{std::chrono::weekday{4}}}) == SV("5月/木[last]")); - assert(stream_ja_JP_locale(std::chrono::month_weekday_last{ - std::chrono::month{6}, std::chrono::weekday_last{std::chrono::weekday{5}}}) == SV("6月/金[last]")); - assert(stream_ja_JP_locale(std::chrono::month_weekday_last{ - std::chrono::month{7}, std::chrono::weekday_last{std::chrono::weekday{6}}}) == SV("7月/土[last]")); - assert(stream_ja_JP_locale(std::chrono::month_weekday_last{ - std::chrono::month{8}, std::chrono::weekday_last{std::chrono::weekday{7}}}) == SV("8月/日[last]")); - assert(stream_ja_JP_locale(std::chrono::month_weekday_last{ - std::chrono::month{9}, std::chrono::weekday_last{std::chrono::weekday{8}}}) == - SV("9月/8 is not a valid weekday[last]")); -# else // defined(_WIN32) || defined(_AIX) - assert(stream_ja_JP_locale(std::chrono::month_weekday_last{ - std::chrono::month{0}, std::chrono::weekday_last{std::chrono::weekday{0}}}) == - SV("0 is not a valid month/日[last]")); - assert(stream_ja_JP_locale(std::chrono::month_weekday_last{ - std::chrono::month{1}, std::chrono::weekday_last{std::chrono::weekday{0}}}) == SV(" 1月/日[last]")); - assert(stream_ja_JP_locale(std::chrono::month_weekday_last{ - std::chrono::month{2}, std::chrono::weekday_last{std::chrono::weekday{1}}}) == SV(" 2月/月[last]")); - assert(stream_ja_JP_locale(std::chrono::month_weekday_last{ - std::chrono::month{3}, std::chrono::weekday_last{std::chrono::weekday{2}}}) == SV(" 3月/火[last]")); - assert(stream_ja_JP_locale(std::chrono::month_weekday_last{ - std::chrono::month{4}, std::chrono::weekday_last{std::chrono::weekday{3}}}) == SV(" 4月/水[last]")); - assert(stream_ja_JP_locale(std::chrono::month_weekday_last{ - std::chrono::month{5}, std::chrono::weekday_last{std::chrono::weekday{4}}}) == SV(" 5月/木[last]")); - assert(stream_ja_JP_locale(std::chrono::month_weekday_last{ - std::chrono::month{6}, std::chrono::weekday_last{std::chrono::weekday{5}}}) == SV(" 6月/金[last]")); - assert(stream_ja_JP_locale(std::chrono::month_weekday_last{ - std::chrono::month{7}, std::chrono::weekday_last{std::chrono::weekday{6}}}) == SV(" 7月/土[last]")); - assert(stream_ja_JP_locale(std::chrono::month_weekday_last{ - std::chrono::month{8}, std::chrono::weekday_last{std::chrono::weekday{7}}}) == SV(" 8月/日[last]")); - assert(stream_ja_JP_locale(std::chrono::month_weekday_last{ - std::chrono::month{9}, std::chrono::weekday_last{std::chrono::weekday{8}}}) == - SV(" 9月/8 is not a valid weekday[last]")); -# endif // defined(_WIN32) || defined(_AIX) - assert(stream_ja_JP_locale(std::chrono::month_weekday_last{ - std::chrono::month{10}, std::chrono::weekday_last{std::chrono::weekday{0}}}) == SV("10月/日[last]")); - assert(stream_ja_JP_locale(std::chrono::month_weekday_last{ - std::chrono::month{11}, std::chrono::weekday_last{std::chrono::weekday{0}}}) == SV("11月/日[last]")); - assert(stream_ja_JP_locale(std::chrono::month_weekday_last{ - std::chrono::month{12}, std::chrono::weekday_last{std::chrono::weekday{0}}}) == SV("12月/日[last]")); -#endif // defined(__APPLE__) - assert(stream_ja_JP_locale(std::chrono::month_weekday_last{ - std::chrono::month{13}, std::chrono::weekday_last{std::chrono::weekday{0}}}) == - SV("13 is not a valid month/日[last]")); - assert(stream_ja_JP_locale(std::chrono::month_weekday_last{ - std::chrono::month{255}, std::chrono::weekday_last{std::chrono::weekday{8}}}) == - SV("255 is not a valid month/8 is not a valid weekday[last]")); +#if defined(__APPLE__) || defined(_WIN32) + TEST_EQUAL(stream_ja_JP_locale(std::chrono::month_weekday_last{ + std::chrono::month{0}, std::chrono::weekday_last{std::chrono::weekday{0}}}), + SV("0 is not a valid month/日[last]")); +# if defined(__APPLE__) + TEST_EQUAL(stream_ja_JP_locale(std::chrono::month_weekday_last{ + std::chrono::month{1}, std::chrono::weekday_last{std::chrono::weekday{0}}}), + SV(" 1/日[last]")); + TEST_EQUAL(stream_ja_JP_locale(std::chrono::month_weekday_last{ + std::chrono::month{2}, std::chrono::weekday_last{std::chrono::weekday{1}}}), + SV(" 2/月[last]")); + TEST_EQUAL(stream_ja_JP_locale(std::chrono::month_weekday_last{ + std::chrono::month{3}, std::chrono::weekday_last{std::chrono::weekday{2}}}), + SV(" 3/火[last]")); + TEST_EQUAL(stream_ja_JP_locale(std::chrono::month_weekday_last{ + std::chrono::month{4}, std::chrono::weekday_last{std::chrono::weekday{3}}}), + SV(" 4/水[last]")); + TEST_EQUAL(stream_ja_JP_locale(std::chrono::month_weekday_last{ + std::chrono::month{5}, std::chrono::weekday_last{std::chrono::weekday{4}}}), + SV(" 5/木[last]")); + TEST_EQUAL(stream_ja_JP_locale(std::chrono::month_weekday_last{ + std::chrono::month{6}, std::chrono::weekday_last{std::chrono::weekday{5}}}), + SV(" 6/金[last]")); + TEST_EQUAL(stream_ja_JP_locale(std::chrono::month_weekday_last{ + std::chrono::month{7}, std::chrono::weekday_last{std::chrono::weekday{6}}}), + SV(" 7/土[last]")); + TEST_EQUAL(stream_ja_JP_locale(std::chrono::month_weekday_last{ + std::chrono::month{8}, std::chrono::weekday_last{std::chrono::weekday{7}}}), + SV(" 8/日[last]")); + TEST_EQUAL(stream_ja_JP_locale(std::chrono::month_weekday_last{ + std::chrono::month{9}, std::chrono::weekday_last{std::chrono::weekday{8}}}), + SV(" 9/8 is not a valid weekday[last]")); +# else // defined(__APPLE__) + TEST_EQUAL(stream_ja_JP_locale(std::chrono::month_weekday_last{ + std::chrono::month{1}, std::chrono::weekday_last{std::chrono::weekday{0}}}), + SV("1/日[last]")); + TEST_EQUAL(stream_ja_JP_locale(std::chrono::month_weekday_last{ + std::chrono::month{2}, std::chrono::weekday_last{std::chrono::weekday{1}}}), + SV("2/月[last]")); + TEST_EQUAL(stream_ja_JP_locale(std::chrono::month_weekday_last{ + std::chrono::month{3}, std::chrono::weekday_last{std::chrono::weekday{2}}}), + SV("3/火[last]")); + TEST_EQUAL(stream_ja_JP_locale(std::chrono::month_weekday_last{ + std::chrono::month{4}, std::chrono::weekday_last{std::chrono::weekday{3}}}), + SV("4/水[last]")); + TEST_EQUAL(stream_ja_JP_locale(std::chrono::month_weekday_last{ + std::chrono::month{5}, std::chrono::weekday_last{std::chrono::weekday{4}}}), + SV("5/木[last]")); + TEST_EQUAL(stream_ja_JP_locale(std::chrono::month_weekday_last{ + std::chrono::month{6}, std::chrono::weekday_last{std::chrono::weekday{5}}}), + SV("6/金[last]")); + TEST_EQUAL(stream_ja_JP_locale(std::chrono::month_weekday_last{ + std::chrono::month{7}, std::chrono::weekday_last{std::chrono::weekday{6}}}), + SV("7/土[last]")); + TEST_EQUAL(stream_ja_JP_locale(std::chrono::month_weekday_last{ + std::chrono::month{8}, std::chrono::weekday_last{std::chrono::weekday{7}}}), + SV("8/日[last]")); + TEST_EQUAL(stream_ja_JP_locale(std::chrono::month_weekday_last{ + std::chrono::month{9}, std::chrono::weekday_last{std::chrono::weekday{8}}}), + SV("9/8 is not a valid weekday[last]")); +# endif // defined(__APPLE__) + TEST_EQUAL(stream_ja_JP_locale(std::chrono::month_weekday_last{ + std::chrono::month{10}, std::chrono::weekday_last{std::chrono::weekday{0}}}), + SV("10/日[last]")); + TEST_EQUAL(stream_ja_JP_locale(std::chrono::month_weekday_last{ + std::chrono::month{11}, std::chrono::weekday_last{std::chrono::weekday{0}}}), + SV("11/日[last]")); + TEST_EQUAL(stream_ja_JP_locale(std::chrono::month_weekday_last{ + std::chrono::month{12}, std::chrono::weekday_last{std::chrono::weekday{0}}}), + SV("12/日[last]")); +#else // defined(__APPLE__) || defined(_WIN32) +# if defined(_AIX) + TEST_EQUAL(stream_ja_JP_locale(std::chrono::month_weekday_last{ + std::chrono::month{0}, std::chrono::weekday_last{std::chrono::weekday{0}}}), + SV("0 is not a valid month/日[last]")); + TEST_EQUAL(stream_ja_JP_locale(std::chrono::month_weekday_last{ + std::chrono::month{1}, std::chrono::weekday_last{std::chrono::weekday{0}}}), + SV("1月/日[last]")); + TEST_EQUAL(stream_ja_JP_locale(std::chrono::month_weekday_last{ + std::chrono::month{2}, std::chrono::weekday_last{std::chrono::weekday{1}}}), + SV("2月/月[last]")); + TEST_EQUAL(stream_ja_JP_locale(std::chrono::month_weekday_last{ + std::chrono::month{3}, std::chrono::weekday_last{std::chrono::weekday{2}}}), + SV("3月/火[last]")); + TEST_EQUAL(stream_ja_JP_locale(std::chrono::month_weekday_last{ + std::chrono::month{4}, std::chrono::weekday_last{std::chrono::weekday{3}}}), + SV("4月/水[last]")); + TEST_EQUAL(stream_ja_JP_locale(std::chrono::month_weekday_last{ + std::chrono::month{5}, std::chrono::weekday_last{std::chrono::weekday{4}}}), + SV("5月/木[last]")); + TEST_EQUAL(stream_ja_JP_locale(std::chrono::month_weekday_last{ + std::chrono::month{6}, std::chrono::weekday_last{std::chrono::weekday{5}}}), + SV("6月/金[last]")); + TEST_EQUAL(stream_ja_JP_locale(std::chrono::month_weekday_last{ + std::chrono::month{7}, std::chrono::weekday_last{std::chrono::weekday{6}}}), + SV("7月/土[last]")); + TEST_EQUAL(stream_ja_JP_locale(std::chrono::month_weekday_last{ + std::chrono::month{8}, std::chrono::weekday_last{std::chrono::weekday{7}}}), + SV("8月/日[last]")); + TEST_EQUAL(stream_ja_JP_locale(std::chrono::month_weekday_last{ + std::chrono::month{9}, std::chrono::weekday_last{std::chrono::weekday{8}}}), + SV("9月/8 is not a valid weekday[last]")); +# else // defined(_AIX) + TEST_EQUAL(stream_ja_JP_locale(std::chrono::month_weekday_last{ + std::chrono::month{0}, std::chrono::weekday_last{std::chrono::weekday{0}}}), + SV("0 is not a valid month/日[last]")); + TEST_EQUAL(stream_ja_JP_locale(std::chrono::month_weekday_last{ + std::chrono::month{1}, std::chrono::weekday_last{std::chrono::weekday{0}}}), + SV(" 1月/日[last]")); + TEST_EQUAL(stream_ja_JP_locale(std::chrono::month_weekday_last{ + std::chrono::month{2}, std::chrono::weekday_last{std::chrono::weekday{1}}}), + SV(" 2月/月[last]")); + TEST_EQUAL(stream_ja_JP_locale(std::chrono::month_weekday_last{ + std::chrono::month{3}, std::chrono::weekday_last{std::chrono::weekday{2}}}), + SV(" 3月/火[last]")); + TEST_EQUAL(stream_ja_JP_locale(std::chrono::month_weekday_last{ + std::chrono::month{4}, std::chrono::weekday_last{std::chrono::weekday{3}}}), + SV(" 4月/水[last]")); + TEST_EQUAL(stream_ja_JP_locale(std::chrono::month_weekday_last{ + std::chrono::month{5}, std::chrono::weekday_last{std::chrono::weekday{4}}}), + SV(" 5月/木[last]")); + TEST_EQUAL(stream_ja_JP_locale(std::chrono::month_weekday_last{ + std::chrono::month{6}, std::chrono::weekday_last{std::chrono::weekday{5}}}), + SV(" 6月/金[last]")); + TEST_EQUAL(stream_ja_JP_locale(std::chrono::month_weekday_last{ + std::chrono::month{7}, std::chrono::weekday_last{std::chrono::weekday{6}}}), + SV(" 7月/土[last]")); + TEST_EQUAL(stream_ja_JP_locale(std::chrono::month_weekday_last{ + std::chrono::month{8}, std::chrono::weekday_last{std::chrono::weekday{7}}}), + SV(" 8月/日[last]")); + TEST_EQUAL(stream_ja_JP_locale(std::chrono::month_weekday_last{ + std::chrono::month{9}, std::chrono::weekday_last{std::chrono::weekday{8}}}), + SV(" 9月/8 is not a valid weekday[last]")); +# endif // defined(_AIX) + TEST_EQUAL(stream_ja_JP_locale(std::chrono::month_weekday_last{ + std::chrono::month{10}, std::chrono::weekday_last{std::chrono::weekday{0}}}), + SV("10月/日[last]")); + TEST_EQUAL(stream_ja_JP_locale(std::chrono::month_weekday_last{ + std::chrono::month{11}, std::chrono::weekday_last{std::chrono::weekday{0}}}), + SV("11月/日[last]")); + TEST_EQUAL(stream_ja_JP_locale(std::chrono::month_weekday_last{ + std::chrono::month{12}, std::chrono::weekday_last{std::chrono::weekday{0}}}), + SV("12月/日[last]")); +#endif // defined(__APPLE__) || defined(_WIN32) + TEST_EQUAL(stream_ja_JP_locale(std::chrono::month_weekday_last{ + std::chrono::month{13}, std::chrono::weekday_last{std::chrono::weekday{0}}}), + SV("13 is not a valid month/日[last]")); + TEST_EQUAL(stream_ja_JP_locale(std::chrono::month_weekday_last{ + std::chrono::month{255}, std::chrono::weekday_last{std::chrono::weekday{8}}}), + SV("255 is not a valid month/8 is not a valid weekday[last]")); } int main(int, char**) { diff --git a/libcxx/test/std/time/time.cal/time.cal.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 @@ -11,9 +11,6 @@ // UNSUPPORTED: c++03, c++11, c++14, c++17 // UNSUPPORTED: no-localization -// 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 @@ -38,9 +35,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; @@ -68,178 +72,199 @@ template static void test() { - assert(stream_c_locale(std::chrono::year_month{std::chrono::year{-32'768}, std::chrono::month{0}}) == - SV("-32768 is not a valid year/0 is not a valid month")); - assert(stream_c_locale(std::chrono::year_month{std::chrono::year{-32'768}, std::chrono::month{1}}) == - SV("-32768 is not a valid year/Jan")); - assert(stream_c_locale(std::chrono::year_month{std::chrono::year{-32'767}, std::chrono::month{2}}) == - SV("-32767/Feb")); - assert(stream_c_locale(std::chrono::year_month{std::chrono::year{0}, std::chrono::month{3}}) == - SV("0000/Mar")); - assert(stream_c_locale(std::chrono::year_month{std::chrono::year{1970}, std::chrono::month{4}}) == - SV("1970/Apr")); - assert(stream_c_locale(std::chrono::year_month{std::chrono::year{32'767}, std::chrono::month{5}}) == - SV("32767/May")); - assert(stream_c_locale(std::chrono::year_month{std::chrono::year{0}, std::chrono::month{6}}) == - SV("0000/Jun")); - assert(stream_c_locale(std::chrono::year_month{std::chrono::year{0}, std::chrono::month{7}}) == - SV("0000/Jul")); - assert(stream_c_locale(std::chrono::year_month{std::chrono::year{0}, std::chrono::month{8}}) == - SV("0000/Aug")); - assert(stream_c_locale(std::chrono::year_month{std::chrono::year{0}, std::chrono::month{9}}) == - SV("0000/Sep")); - assert(stream_c_locale(std::chrono::year_month{std::chrono::year{0}, std::chrono::month{10}}) == - SV("0000/Oct")); - assert(stream_c_locale(std::chrono::year_month{std::chrono::year{0}, std::chrono::month{11}}) == - SV("0000/Nov")); - assert(stream_c_locale(std::chrono::year_month{std::chrono::year{0}, std::chrono::month{12}}) == - SV("0000/Dec")); - assert(stream_c_locale(std::chrono::year_month{std::chrono::year{0}, std::chrono::month{13}}) == - SV("0000/13 is not a valid month")); - assert(stream_c_locale(std::chrono::year_month{std::chrono::year{-32'768}, std::chrono::month{255}}) == - SV("-32768 is not a valid year/255 is not a valid month")); - - assert(stream_fr_FR_locale(std::chrono::year_month{std::chrono::year{-32'768}, std::chrono::month{0}}) == - SV("-32768 is not a valid year/0 is not a valid month")); -#if defined(__APPLE__) - assert(stream_fr_FR_locale(std::chrono::year_month{std::chrono::year{-32'768}, std::chrono::month{1}}) == - SV("-32768 is not a valid year/jan")); - assert(stream_fr_FR_locale(std::chrono::year_month{std::chrono::year{-32'767}, std::chrono::month{2}}) == - SV("-32767/fév")); - assert(stream_fr_FR_locale(std::chrono::year_month{std::chrono::year{0}, std::chrono::month{3}}) == - SV("0000/mar")); - assert(stream_fr_FR_locale(std::chrono::year_month{std::chrono::year{1970}, std::chrono::month{4}}) == - SV("1970/avr")); - assert(stream_fr_FR_locale(std::chrono::year_month{std::chrono::year{32'767}, std::chrono::month{5}}) == - SV("32767/mai")); - assert(stream_fr_FR_locale(std::chrono::year_month{std::chrono::year{0}, std::chrono::month{6}}) == - SV("0000/jui")); - assert(stream_fr_FR_locale(std::chrono::year_month{std::chrono::year{0}, std::chrono::month{7}}) == - SV("0000/jul")); - assert(stream_fr_FR_locale(std::chrono::year_month{std::chrono::year{0}, std::chrono::month{8}}) == - SV("0000/aoû")); - assert(stream_fr_FR_locale(std::chrono::year_month{std::chrono::year{0}, std::chrono::month{9}}) == - SV("0000/sep")); - assert(stream_fr_FR_locale(std::chrono::year_month{std::chrono::year{0}, std::chrono::month{10}}) == - SV("0000/oct")); - assert(stream_fr_FR_locale(std::chrono::year_month{std::chrono::year{0}, std::chrono::month{11}}) == - SV("0000/nov")); - assert(stream_fr_FR_locale(std::chrono::year_month{std::chrono::year{0}, std::chrono::month{12}}) == - SV("0000/déc")); -#else // defined(__APPLE__) - assert(stream_fr_FR_locale(std::chrono::year_month{std::chrono::year{-32'768}, std::chrono::month{1}}) == - SV("-32768 is not a valid year/janv.")); - assert(stream_fr_FR_locale(std::chrono::year_month{std::chrono::year{-32'767}, std::chrono::month{2}}) == - SV("-32767/févr.")); - assert(stream_fr_FR_locale(std::chrono::year_month{std::chrono::year{0}, std::chrono::month{3}}) == - SV("0000/mars")); -# if defined(_WIN32) || defined(_AIX) - assert(stream_fr_FR_locale(std::chrono::year_month{std::chrono::year{1970}, std::chrono::month{4}}) == - SV("1970/avr.")); -# else // defined(_WIN32) || defined(_AIX) - assert(stream_fr_FR_locale(std::chrono::year_month{std::chrono::year{1970}, std::chrono::month{4}}) == - SV("1970/avril")); -# endif // defined(_WIN32) || defined(_AIX) - assert(stream_fr_FR_locale(std::chrono::year_month{std::chrono::year{32'767}, std::chrono::month{5}}) == - SV("32767/mai")); - assert(stream_fr_FR_locale(std::chrono::year_month{std::chrono::year{0}, std::chrono::month{6}}) == - SV("0000/juin")); - assert(stream_fr_FR_locale(std::chrono::year_month{std::chrono::year{0}, std::chrono::month{7}}) == - SV("0000/juil.")); - assert(stream_fr_FR_locale(std::chrono::year_month{std::chrono::year{0}, std::chrono::month{8}}) == - SV("0000/août")); - assert(stream_fr_FR_locale(std::chrono::year_month{std::chrono::year{0}, std::chrono::month{9}}) == - SV("0000/sept.")); - assert(stream_fr_FR_locale(std::chrono::year_month{std::chrono::year{0}, std::chrono::month{10}}) == - SV("0000/oct.")); - assert(stream_fr_FR_locale(std::chrono::year_month{std::chrono::year{0}, std::chrono::month{11}}) == - SV("0000/nov.")); - assert(stream_fr_FR_locale(std::chrono::year_month{std::chrono::year{0}, std::chrono::month{12}}) == - SV("0000/déc.")); -#endif // defined(__APPLE__) - assert(stream_fr_FR_locale(std::chrono::year_month{std::chrono::year{0}, std::chrono::month{13}}) == - SV("0000/13 is not a valid month")); - assert(stream_fr_FR_locale(std::chrono::year_month{std::chrono::year{-32'768}, std::chrono::month{255}}) == - SV("-32768 is not a valid year/255 is not a valid month")); - - assert(stream_ja_JP_locale(std::chrono::year_month{std::chrono::year{-32'768}, std::chrono::month{0}}) == - SV("-32768 is not a valid year/0 is not a valid month")); + TEST_EQUAL(stream_c_locale(std::chrono::year_month{std::chrono::year{-32'768}, std::chrono::month{0}}), + SV("-32768 is not a valid year/0 is not a valid month")); + TEST_EQUAL(stream_c_locale(std::chrono::year_month{std::chrono::year{-32'768}, std::chrono::month{1}}), + SV("-32768 is not a valid year/Jan")); + TEST_EQUAL(stream_c_locale(std::chrono::year_month{std::chrono::year{-32'767}, std::chrono::month{2}}), + SV("-32767/Feb")); + TEST_EQUAL(stream_c_locale(std::chrono::year_month{std::chrono::year{0}, std::chrono::month{3}}), + SV("0000/Mar")); + TEST_EQUAL(stream_c_locale(std::chrono::year_month{std::chrono::year{1970}, std::chrono::month{4}}), + SV("1970/Apr")); + 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_ja_JP_locale(std::chrono::year_month{std::chrono::year{-32'768}, std::chrono::month{1}}) == - SV("-32768 is not a valid year/ 1")); - assert(stream_ja_JP_locale(std::chrono::year_month{std::chrono::year{-32'767}, std::chrono::month{2}}) == - SV("-32767/ 2")); - assert(stream_ja_JP_locale(std::chrono::year_month{std::chrono::year{0}, std::chrono::month{3}}) == - SV("0000/ 3")); - assert(stream_ja_JP_locale(std::chrono::year_month{std::chrono::year{1970}, std::chrono::month{4}}) == - SV("1970/ 4")); - assert(stream_ja_JP_locale(std::chrono::year_month{std::chrono::year{32'767}, std::chrono::month{5}}) == - SV("32767/ 5")); - assert(stream_ja_JP_locale(std::chrono::year_month{std::chrono::year{0}, std::chrono::month{6}}) == - SV("0000/ 6")); - assert(stream_ja_JP_locale(std::chrono::year_month{std::chrono::year{0}, std::chrono::month{7}}) == - SV("0000/ 7")); - assert(stream_ja_JP_locale(std::chrono::year_month{std::chrono::year{0}, std::chrono::month{8}}) == - SV("0000/ 8")); - assert(stream_ja_JP_locale(std::chrono::year_month{std::chrono::year{0}, std::chrono::month{9}}) == - SV("0000/ 9")); - assert(stream_ja_JP_locale(std::chrono::year_month{std::chrono::year{0}, std::chrono::month{10}}) == - SV("0000/10")); - assert(stream_ja_JP_locale(std::chrono::year_month{std::chrono::year{0}, std::chrono::month{11}}) == - SV("0000/11")); - assert(stream_ja_JP_locale(std::chrono::year_month{std::chrono::year{0}, std::chrono::month{12}}) == - SV("0000/12")); -#else // defined(__APPLE__) + TEST_EQUAL(stream_fr_FR_locale(std::chrono::year_month{std::chrono::year{-32'768}, std::chrono::month{1}}), + SV("-32768 is not a valid year/jan")); + TEST_EQUAL(stream_fr_FR_locale(std::chrono::year_month{std::chrono::year{-32'767}, std::chrono::month{2}}), + SV("-32767/fév")); + TEST_EQUAL(stream_fr_FR_locale(std::chrono::year_month{std::chrono::year{0}, std::chrono::month{3}}), + SV("0000/mar")); + TEST_EQUAL(stream_fr_FR_locale(std::chrono::year_month{std::chrono::year{1970}, std::chrono::month{4}}), + SV("1970/avr")); + 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_ja_JP_locale(std::chrono::year_month{std::chrono::year{-32'768}, std::chrono::month{1}}) == - SV("-32768 is not a valid year/1月")); - assert(stream_ja_JP_locale(std::chrono::year_month{std::chrono::year{-32'767}, std::chrono::month{2}}) == - SV("-32767/2月")); - assert(stream_ja_JP_locale(std::chrono::year_month{std::chrono::year{0}, std::chrono::month{3}}) == - SV("0000/3月")); - assert(stream_ja_JP_locale(std::chrono::year_month{std::chrono::year{1970}, std::chrono::month{4}}) == - SV("1970/4月")); - assert(stream_ja_JP_locale(std::chrono::year_month{std::chrono::year{32'767}, std::chrono::month{5}}) == - SV("32767/5月")); - assert(stream_ja_JP_locale(std::chrono::year_month{std::chrono::year{0}, std::chrono::month{6}}) == - SV("0000/6月")); - assert(stream_ja_JP_locale(std::chrono::year_month{std::chrono::year{0}, std::chrono::month{7}}) == - SV("0000/7月")); - assert(stream_ja_JP_locale(std::chrono::year_month{std::chrono::year{0}, std::chrono::month{8}}) == - SV("0000/8月")); - assert(stream_ja_JP_locale(std::chrono::year_month{std::chrono::year{0}, std::chrono::month{9}}) == - SV("0000/9月")); + TEST_EQUAL(stream_fr_FR_locale(std::chrono::year_month{std::chrono::year{1970}, std::chrono::month{4}}), + SV("1970/avr.")); # else // defined(_WIN32) || defined(_AIX) - assert(stream_ja_JP_locale(std::chrono::year_month{std::chrono::year{-32'768}, std::chrono::month{1}}) == - SV("-32768 is not a valid year/ 1月")); - assert(stream_ja_JP_locale(std::chrono::year_month{std::chrono::year{-32'767}, std::chrono::month{2}}) == - SV("-32767/ 2月")); - assert(stream_ja_JP_locale(std::chrono::year_month{std::chrono::year{0}, std::chrono::month{3}}) == - SV("0000/ 3月")); - assert(stream_ja_JP_locale(std::chrono::year_month{std::chrono::year{1970}, std::chrono::month{4}}) == - SV("1970/ 4月")); - assert(stream_ja_JP_locale(std::chrono::year_month{std::chrono::year{32'767}, std::chrono::month{5}}) == - SV("32767/ 5月")); - assert(stream_ja_JP_locale(std::chrono::year_month{std::chrono::year{0}, std::chrono::month{6}}) == - SV("0000/ 6月")); - assert(stream_ja_JP_locale(std::chrono::year_month{std::chrono::year{0}, std::chrono::month{7}}) == - SV("0000/ 7月")); - assert(stream_ja_JP_locale(std::chrono::year_month{std::chrono::year{0}, std::chrono::month{8}}) == - SV("0000/ 8月")); - assert(stream_ja_JP_locale(std::chrono::year_month{std::chrono::year{0}, std::chrono::month{9}}) == - SV("0000/ 9月")); + TEST_EQUAL(stream_fr_FR_locale(std::chrono::year_month{std::chrono::year{1970}, std::chrono::month{4}}), + SV("1970/avril")); # endif // defined(_WIN32) || defined(_AIX) - assert(stream_ja_JP_locale(std::chrono::year_month{std::chrono::year{0}, std::chrono::month{10}}) == - SV("0000/10月")); - assert(stream_ja_JP_locale(std::chrono::year_month{std::chrono::year{0}, std::chrono::month{11}}) == - SV("0000/11月")); - assert(stream_ja_JP_locale(std::chrono::year_month{std::chrono::year{0}, std::chrono::month{12}}) == - SV("0000/12月")); + 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_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_fr_FR_locale(std::chrono::year_month{std::chrono::year{0}, std::chrono::month{13}}), + SV("0000/13 is not a valid month")); + TEST_EQUAL(stream_fr_FR_locale(std::chrono::year_month{std::chrono::year{-32'768}, std::chrono::month{255}}), + SV("-32768 is not a valid year/255 is not a valid month")); + + TEST_EQUAL(stream_ja_JP_locale(std::chrono::year_month{std::chrono::year{-32'768}, std::chrono::month{0}}), + SV("-32768 is not a valid year/0 is not a valid month")); +#if defined(__APPLE__) || defined(_WIN32) +# if defined(__APPLE__) + TEST_EQUAL(stream_ja_JP_locale(std::chrono::year_month{std::chrono::year{-32'768}, std::chrono::month{1}}), + SV("-32768 is not a valid year/ 1")); + TEST_EQUAL(stream_ja_JP_locale(std::chrono::year_month{std::chrono::year{-32'767}, std::chrono::month{2}}), + SV("-32767/ 2")); + TEST_EQUAL(stream_ja_JP_locale(std::chrono::year_month{std::chrono::year{0}, std::chrono::month{3}}), + SV("0000/ 3")); + TEST_EQUAL(stream_ja_JP_locale(std::chrono::year_month{std::chrono::year{1970}, std::chrono::month{4}}), + SV("1970/ 4")); + TEST_EQUAL(stream_ja_JP_locale(std::chrono::year_month{std::chrono::year{32'767}, std::chrono::month{5}}), + SV("32767/ 5")); + TEST_EQUAL(stream_ja_JP_locale(std::chrono::year_month{std::chrono::year{0}, std::chrono::month{6}}), + SV("0000/ 6")); + TEST_EQUAL(stream_ja_JP_locale(std::chrono::year_month{std::chrono::year{0}, std::chrono::month{7}}), + SV("0000/ 7")); + TEST_EQUAL(stream_ja_JP_locale(std::chrono::year_month{std::chrono::year{0}, std::chrono::month{8}}), + SV("0000/ 8")); + TEST_EQUAL(stream_ja_JP_locale(std::chrono::year_month{std::chrono::year{0}, std::chrono::month{9}}), + SV("0000/ 9")); +# else // defined(__APPLE__) + TEST_EQUAL(stream_ja_JP_locale(std::chrono::year_month{std::chrono::year{-32'768}, std::chrono::month{1}}), + SV("-32768 is not a valid year/1")); + TEST_EQUAL(stream_ja_JP_locale(std::chrono::year_month{std::chrono::year{-32'767}, std::chrono::month{2}}), + SV("-32767/2")); + TEST_EQUAL(stream_ja_JP_locale(std::chrono::year_month{std::chrono::year{0}, std::chrono::month{3}}), + SV("0000/3")); + TEST_EQUAL(stream_ja_JP_locale(std::chrono::year_month{std::chrono::year{1970}, std::chrono::month{4}}), + SV("1970/4")); + TEST_EQUAL(stream_ja_JP_locale(std::chrono::year_month{std::chrono::year{32'767}, std::chrono::month{5}}), + SV("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(__APPLE__) + TEST_EQUAL(stream_ja_JP_locale(std::chrono::year_month{std::chrono::year{0}, std::chrono::month{10}}), + SV("0000/10")); + TEST_EQUAL(stream_ja_JP_locale(std::chrono::year_month{std::chrono::year{0}, std::chrono::month{11}}), + SV("0000/11")); + TEST_EQUAL(stream_ja_JP_locale(std::chrono::year_month{std::chrono::year{0}, std::chrono::month{12}}), + SV("0000/12")); +#else // defined(__APPLE__) || defined(_WIN32) +# if defined(_AIX) + TEST_EQUAL(stream_ja_JP_locale(std::chrono::year_month{std::chrono::year{-32'768}, std::chrono::month{1}}), + SV("-32768 is not a valid year/1月")); + TEST_EQUAL(stream_ja_JP_locale(std::chrono::year_month{std::chrono::year{-32'767}, std::chrono::month{2}}), + SV("-32767/2月")); + TEST_EQUAL(stream_ja_JP_locale(std::chrono::year_month{std::chrono::year{0}, std::chrono::month{3}}), + SV("0000/3月")); + TEST_EQUAL(stream_ja_JP_locale(std::chrono::year_month{std::chrono::year{1970}, std::chrono::month{4}}), + SV("1970/4月")); + TEST_EQUAL(stream_ja_JP_locale(std::chrono::year_month{std::chrono::year{32'767}, std::chrono::month{5}}), + SV("32767/5月")); + TEST_EQUAL(stream_ja_JP_locale(std::chrono::year_month{std::chrono::year{0}, std::chrono::month{6}}), + SV("0000/6月")); + TEST_EQUAL(stream_ja_JP_locale(std::chrono::year_month{std::chrono::year{0}, std::chrono::month{7}}), + SV("0000/7月")); + TEST_EQUAL(stream_ja_JP_locale(std::chrono::year_month{std::chrono::year{0}, std::chrono::month{8}}), + SV("0000/8月")); + TEST_EQUAL(stream_ja_JP_locale(std::chrono::year_month{std::chrono::year{0}, std::chrono::month{9}}), + SV("0000/9月")); +# else // defined(_AIX) + TEST_EQUAL(stream_ja_JP_locale(std::chrono::year_month{std::chrono::year{-32'768}, std::chrono::month{1}}), + SV("-32768 is not a valid year/ 1月")); + TEST_EQUAL(stream_ja_JP_locale(std::chrono::year_month{std::chrono::year{-32'767}, std::chrono::month{2}}), + SV("-32767/ 2月")); + TEST_EQUAL(stream_ja_JP_locale(std::chrono::year_month{std::chrono::year{0}, std::chrono::month{3}}), + SV("0000/ 3月")); + TEST_EQUAL(stream_ja_JP_locale(std::chrono::year_month{std::chrono::year{1970}, std::chrono::month{4}}), + SV("1970/ 4月")); + TEST_EQUAL(stream_ja_JP_locale(std::chrono::year_month{std::chrono::year{32'767}, std::chrono::month{5}}), + SV("32767/ 5月")); + TEST_EQUAL(stream_ja_JP_locale(std::chrono::year_month{std::chrono::year{0}, std::chrono::month{6}}), + SV("0000/ 6月")); + TEST_EQUAL(stream_ja_JP_locale(std::chrono::year_month{std::chrono::year{0}, std::chrono::month{7}}), + SV("0000/ 7月")); + TEST_EQUAL(stream_ja_JP_locale(std::chrono::year_month{std::chrono::year{0}, std::chrono::month{8}}), + SV("0000/ 8月")); + TEST_EQUAL(stream_ja_JP_locale(std::chrono::year_month{std::chrono::year{0}, std::chrono::month{9}}), + SV("0000/ 9月")); +# endif // defined(_AIX) + TEST_EQUAL(stream_ja_JP_locale(std::chrono::year_month{std::chrono::year{0}, std::chrono::month{10}}), + SV("0000/10月")); + TEST_EQUAL(stream_ja_JP_locale(std::chrono::year_month{std::chrono::year{0}, std::chrono::month{11}}), + SV("0000/11月")); + TEST_EQUAL(stream_ja_JP_locale(std::chrono::year_month{std::chrono::year{0}, std::chrono::month{12}}), + SV("0000/12月")); +#endif // defined(__APPLE__) || defined(_WIN32) + TEST_EQUAL(stream_ja_JP_locale(std::chrono::year_month{std::chrono::year{0}, std::chrono::month{13}}), + SV("0000/13 is not a valid month")); + TEST_EQUAL(stream_ja_JP_locale(std::chrono::year_month{std::chrono::year{-32'768}, std::chrono::month{255}}), + SV("-32768 is not a valid year/255 is not a valid month")); } int main(int, char**) { diff --git a/libcxx/test/std/time/time.cal/time.cal.ymd/time.cal.ymd.nonmembers/ostream.pass.cpp b/libcxx/test/std/time/time.cal/time.cal.ymd/time.cal.ymd.nonmembers/ostream.pass.cpp --- a/libcxx/test/std/time/time.cal/time.cal.ymd/time.cal.ymd.nonmembers/ostream.pass.cpp +++ b/libcxx/test/std/time/time.cal/time.cal.ymd/time.cal.ymd.nonmembers/ostream.pass.cpp @@ -9,15 +9,15 @@ // UNSUPPORTED: c++03, c++11, c++14, c++17 // UNSUPPORTED: no-localization -// TODO FMT Investigate Windows issues. -// UNSUPPORTED: msvc, target={{.+}}-windows-gnu - // TODO FMT It seems GCC uses too much memory in the CI and fails. // UNSUPPORTED: gcc-12 // TODO FMT This test should not require std::to_chars(floating-point) // XFAIL: availability-fp_to_chars-missing +// TODO FMT Investigate Windows issues. +// XFAIL: msvc + // REQUIRES: locale.fr_FR.UTF-8 // REQUIRES: locale.ja_JP.UTF-8 @@ -36,9 +36,16 @@ #include "make_string.h" #include "platform_support.h" // locale name macros #include "test_macros.h" +#include "assert_macros.h" +#include "concat_macros.h" #define SV(S) MAKE_STRING_VIEW(CharT, S) +#define TEST_EQUAL(OUT, EXPECTED) \ + TEST_REQUIRE(OUT == EXPECTED, \ + TEST_WRITE_CONCATENATED( \ + "\nExpression ", #OUT, "\nExpected output ", EXPECTED, "\nActual output ", OUT, '\n')); + template static std::basic_string stream_c_locale(std::chrono::year_month_day ymd) { std::basic_stringstream sstr; @@ -66,78 +73,102 @@ template static void test() { - assert(stream_c_locale( - std::chrono::year_month_day{std::chrono::year{-32'768}, std::chrono::month{1}, std::chrono::day{1}}) == - SV("-32768-01-01 is not a valid date")); - assert(stream_c_locale( - std::chrono::year_month_day{std::chrono::year{-32'767}, std::chrono::month{0}, std::chrono::day{1}}) == - SV("-32767-00-01 is not a valid date")); - assert(stream_c_locale( - std::chrono::year_month_day{std::chrono::year{-32'767}, std::chrono::month{1}, std::chrono::day{0}}) == - SV("-32767-01-00 is not a valid date")); - assert(stream_c_locale(std::chrono::year_month_day{ - std::chrono::year{1970}, std::chrono::month{1}, std::chrono::day{1}}) == SV("1970-01-01")); - assert(stream_c_locale( - std::chrono::year_month_day{std::chrono::year{1999}, std::chrono::month{2}, std::chrono::day{29}}) == - SV("1999-02-29 is not a valid date")); - assert(stream_c_locale(std::chrono::year_month_day{ - std::chrono::year{2000}, std::chrono::month{2}, std::chrono::day{29}}) == SV("2000-02-29")); + TEST_EQUAL(stream_c_locale( + std::chrono::year_month_day{std::chrono::year{-32'768}, std::chrono::month{1}, std::chrono::day{1}}), + SV("-32768-01-01 is not a valid date")); + TEST_EQUAL(stream_c_locale( + std::chrono::year_month_day{std::chrono::year{-32'767}, std::chrono::month{0}, std::chrono::day{1}}), + SV("-32767-00-01 is not a valid date")); + TEST_EQUAL(stream_c_locale( + std::chrono::year_month_day{std::chrono::year{-32'767}, std::chrono::month{1}, std::chrono::day{0}}), + SV("-32767-01-00 is not a valid date")); + TEST_EQUAL(stream_c_locale( + std::chrono::year_month_day{std::chrono::year{1970}, std::chrono::month{1}, std::chrono::day{1}}), + SV("1970-01-01")); + TEST_EQUAL(stream_c_locale( + std::chrono::year_month_day{std::chrono::year{1999}, std::chrono::month{2}, std::chrono::day{29}}), + SV("1999-02-29 is not a valid date")); + TEST_EQUAL(stream_c_locale( + std::chrono::year_month_day{std::chrono::year{2000}, std::chrono::month{2}, std::chrono::day{29}}), + SV("2000-02-29")); #if defined(_AIX) - assert(stream_c_locale(std::chrono::year_month_day{ - std::chrono::year{32'767}, std::chrono::month{12}, std::chrono::day{31}}) == SV("+32767-12-31")); -#else // defined(_AIX) - assert(stream_c_locale(std::chrono::year_month_day{ - std::chrono::year{32'767}, std::chrono::month{12}, std::chrono::day{31}}) == SV("32767-12-31")); -#endif // defined(_AIX) - - assert(stream_fr_FR_locale( - std::chrono::year_month_day{std::chrono::year{-32'768}, std::chrono::month{1}, std::chrono::day{1}}) == - SV("-32768-01-01 is not a valid date")); - assert(stream_fr_FR_locale( - std::chrono::year_month_day{std::chrono::year{-32'767}, std::chrono::month{0}, std::chrono::day{1}}) == - SV("-32767-00-01 is not a valid date")); - assert(stream_fr_FR_locale( - std::chrono::year_month_day{std::chrono::year{-32'767}, std::chrono::month{1}, std::chrono::day{0}}) == - SV("-32767-01-00 is not a valid date")); - assert(stream_fr_FR_locale(std::chrono::year_month_day{ - std::chrono::year{1970}, std::chrono::month{1}, std::chrono::day{1}}) == SV("1970-01-01")); - assert(stream_fr_FR_locale( - std::chrono::year_month_day{std::chrono::year{1999}, std::chrono::month{2}, std::chrono::day{29}}) == - SV("1999-02-29 is not a valid date")); - assert(stream_fr_FR_locale(std::chrono::year_month_day{ - std::chrono::year{2000}, std::chrono::month{2}, std::chrono::day{29}}) == SV("2000-02-29")); + TEST_EQUAL(stream_c_locale( + std::chrono::year_month_day{std::chrono::year{32'767}, std::chrono::month{12}, std::chrono::day{31}}), + SV("+32767-12-31")); +#elif defined(_WIN32) // defined(_AIX) + TEST_EQUAL(stream_c_locale( + std::chrono::year_month_day{std::chrono::year{32'767}, std::chrono::month{12}, std::chrono::day{31}}), + SV("")); +#else // defined(_AIX) + TEST_EQUAL(stream_c_locale( + std::chrono::year_month_day{std::chrono::year{32'767}, std::chrono::month{12}, std::chrono::day{31}}), + SV("32767-12-31")); +#endif // defined(_AIX) + + TEST_EQUAL(stream_fr_FR_locale( + std::chrono::year_month_day{std::chrono::year{-32'768}, std::chrono::month{1}, std::chrono::day{1}}), + SV("-32768-01-01 is not a valid date")); + TEST_EQUAL(stream_fr_FR_locale( + std::chrono::year_month_day{std::chrono::year{-32'767}, std::chrono::month{0}, std::chrono::day{1}}), + SV("-32767-00-01 is not a valid date")); + TEST_EQUAL(stream_fr_FR_locale( + std::chrono::year_month_day{std::chrono::year{-32'767}, std::chrono::month{1}, std::chrono::day{0}}), + SV("-32767-01-00 is not a valid date")); + TEST_EQUAL(stream_fr_FR_locale( + std::chrono::year_month_day{std::chrono::year{1970}, std::chrono::month{1}, std::chrono::day{1}}), + SV("1970-01-01")); + TEST_EQUAL(stream_fr_FR_locale( + std::chrono::year_month_day{std::chrono::year{1999}, std::chrono::month{2}, std::chrono::day{29}}), + SV("1999-02-29 is not a valid date")); + TEST_EQUAL(stream_fr_FR_locale( + std::chrono::year_month_day{std::chrono::year{2000}, std::chrono::month{2}, std::chrono::day{29}}), + SV("2000-02-29")); #if defined(_AIX) - assert(stream_fr_FR_locale(std::chrono::year_month_day{ - std::chrono::year{32'767}, std::chrono::month{12}, std::chrono::day{31}}) == SV("+32767-12-31")); -#else // defined(_AIX) - assert(stream_fr_FR_locale(std::chrono::year_month_day{ - std::chrono::year{32'767}, std::chrono::month{12}, std::chrono::day{31}}) == SV("32767-12-31")); -#endif // defined(_AIX) - - assert(stream_ja_JP_locale( - std::chrono::year_month_day{std::chrono::year{-32'768}, std::chrono::month{1}, std::chrono::day{1}}) == - SV("-32768-01-01 is not a valid date")); - assert(stream_ja_JP_locale( - std::chrono::year_month_day{std::chrono::year{-32'767}, std::chrono::month{0}, std::chrono::day{1}}) == - SV("-32767-00-01 is not a valid date")); - assert(stream_ja_JP_locale( - std::chrono::year_month_day{std::chrono::year{-32'767}, std::chrono::month{1}, std::chrono::day{0}}) == - SV("-32767-01-00 is not a valid date")); - assert(stream_ja_JP_locale(std::chrono::year_month_day{ - std::chrono::year{1970}, std::chrono::month{1}, std::chrono::day{1}}) == SV("1970-01-01")); - assert(stream_ja_JP_locale( - std::chrono::year_month_day{std::chrono::year{1999}, std::chrono::month{2}, std::chrono::day{29}}) == - SV("1999-02-29 is not a valid date")); - assert(stream_ja_JP_locale(std::chrono::year_month_day{ - std::chrono::year{2000}, std::chrono::month{2}, std::chrono::day{29}}) == SV("2000-02-29")); + TEST_EQUAL(stream_fr_FR_locale( + std::chrono::year_month_day{std::chrono::year{32'767}, std::chrono::month{12}, std::chrono::day{31}}), + SV("+32767-12-31")); +#elif defined(_WIN32) // defined(_AIX) + TEST_EQUAL(stream_fr_FR_locale( + std::chrono::year_month_day{std::chrono::year{32'767}, std::chrono::month{12}, std::chrono::day{31}}), + SV("")); +#else // defined(_AIX) + TEST_EQUAL(stream_fr_FR_locale( + std::chrono::year_month_day{std::chrono::year{32'767}, std::chrono::month{12}, std::chrono::day{31}}), + SV("32767-12-31")); +#endif // defined(_AIX) + + TEST_EQUAL(stream_ja_JP_locale( + std::chrono::year_month_day{std::chrono::year{-32'768}, std::chrono::month{1}, std::chrono::day{1}}), + SV("-32768-01-01 is not a valid date")); + TEST_EQUAL(stream_ja_JP_locale( + std::chrono::year_month_day{std::chrono::year{-32'767}, std::chrono::month{0}, std::chrono::day{1}}), + SV("-32767-00-01 is not a valid date")); + TEST_EQUAL(stream_ja_JP_locale( + std::chrono::year_month_day{std::chrono::year{-32'767}, std::chrono::month{1}, std::chrono::day{0}}), + SV("-32767-01-00 is not a valid date")); + TEST_EQUAL(stream_ja_JP_locale( + std::chrono::year_month_day{std::chrono::year{1970}, std::chrono::month{1}, std::chrono::day{1}}), + SV("1970-01-01")); + TEST_EQUAL(stream_ja_JP_locale( + std::chrono::year_month_day{std::chrono::year{1999}, std::chrono::month{2}, std::chrono::day{29}}), + SV("1999-02-29 is not a valid date")); + TEST_EQUAL(stream_ja_JP_locale( + std::chrono::year_month_day{std::chrono::year{2000}, std::chrono::month{2}, std::chrono::day{29}}), + SV("2000-02-29")); #if defined(_AIX) - assert(stream_ja_JP_locale(std::chrono::year_month_day{ - std::chrono::year{32'767}, std::chrono::month{12}, std::chrono::day{31}}) == SV("+32767-12-31")); -#else // defined(_AIX) - assert(stream_ja_JP_locale(std::chrono::year_month_day{ - std::chrono::year{32'767}, std::chrono::month{12}, std::chrono::day{31}}) == SV("32767-12-31")); -#endif // defined(_AIX) + TEST_EQUAL(stream_ja_JP_locale( + std::chrono::year_month_day{std::chrono::year{32'767}, std::chrono::month{12}, std::chrono::day{31}}), + SV("+32767-12-31")); +#elif defined(_WIN32) // defined(_AIX) + TEST_EQUAL(stream_ja_JP_locale( + std::chrono::year_month_day{std::chrono::year{32'767}, std::chrono::month{12}, std::chrono::day{31}}), + SV("")); +#else // defined(_AIX) + TEST_EQUAL(stream_ja_JP_locale( + std::chrono::year_month_day{std::chrono::year{32'767}, std::chrono::month{12}, std::chrono::day{31}}), + SV("32767-12-31")); +#endif // defined(_AIX) } int main(int, char**) { diff --git a/libcxx/test/std/time/time.cal/time.cal.ymdlast/time.cal.ymdlast.nonmembers/ostream.pass.cpp b/libcxx/test/std/time/time.cal/time.cal.ymdlast/time.cal.ymdlast.nonmembers/ostream.pass.cpp --- a/libcxx/test/std/time/time.cal/time.cal.ymdlast/time.cal.ymdlast.nonmembers/ostream.pass.cpp +++ b/libcxx/test/std/time/time.cal/time.cal.ymdlast/time.cal.ymdlast.nonmembers/ostream.pass.cpp @@ -11,9 +11,6 @@ // UNSUPPORTED: c++03, c++11, c++14, c++17 // UNSUPPORTED: no-localization -// 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 @@ -38,9 +35,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; @@ -68,195 +72,287 @@ 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")); -#if defined(__APPLE__) - assert(stream_ja_JP_locale(std::chrono::year_month_day_last{ - std::chrono::year{-32'768}, std::chrono::month_day_last{std::chrono::month{1}}}) == - SV("-32768 is not a valid year/ 1/last")); - assert(stream_ja_JP_locale(std::chrono::year_month_day_last{ - std::chrono::year{-32'767}, std::chrono::month_day_last{std::chrono::month{2}}}) == SV("-32767/ 2/last")); - assert(stream_ja_JP_locale(std::chrono::year_month_day_last{ - std::chrono::year{0}, std::chrono::month_day_last{std::chrono::month{3}}}) == SV("0000/ 3/last")); - assert(stream_ja_JP_locale(std::chrono::year_month_day_last{ - std::chrono::year{1970}, std::chrono::month_day_last{std::chrono::month{4}}}) == SV("1970/ 4/last")); - assert(stream_ja_JP_locale(std::chrono::year_month_day_last{ - std::chrono::year{32'767}, std::chrono::month_day_last{std::chrono::month{5}}}) == SV("32767/ 5/last")); - assert(stream_ja_JP_locale(std::chrono::year_month_day_last{ - std::chrono::year{0}, std::chrono::month_day_last{std::chrono::month{6}}}) == SV("0000/ 6/last")); - assert(stream_ja_JP_locale(std::chrono::year_month_day_last{ - std::chrono::year{0}, std::chrono::month_day_last{std::chrono::month{7}}}) == SV("0000/ 7/last")); - assert(stream_ja_JP_locale(std::chrono::year_month_day_last{ - std::chrono::year{0}, std::chrono::month_day_last{std::chrono::month{8}}}) == SV("0000/ 8/last")); - assert(stream_ja_JP_locale(std::chrono::year_month_day_last{ - std::chrono::year{0}, std::chrono::month_day_last{std::chrono::month{9}}}) == SV("0000/ 9/last")); - assert(stream_ja_JP_locale(std::chrono::year_month_day_last{ - std::chrono::year{0}, std::chrono::month_day_last{std::chrono::month{10}}}) == SV("0000/10/last")); - assert(stream_ja_JP_locale(std::chrono::year_month_day_last{ - std::chrono::year{0}, std::chrono::month_day_last{std::chrono::month{11}}}) == SV("0000/11/last")); - assert(stream_ja_JP_locale(std::chrono::year_month_day_last{ - std::chrono::year{0}, std::chrono::month_day_last{std::chrono::month{12}}}) == SV("0000/12/last")); -#else // defined(__APPLE__) -# if defined(_WIN32) || defined(_AIX) - assert(stream_ja_JP_locale(std::chrono::year_month_day_last{ - std::chrono::year{-32'768}, std::chrono::month_day_last{std::chrono::month{1}}}) == - SV("-32768 is not a valid year/1月/last")); - assert(stream_ja_JP_locale(std::chrono::year_month_day_last{ - std::chrono::year{-32'767}, std::chrono::month_day_last{std::chrono::month{2}}}) == SV("-32767/2月/last")); - assert(stream_ja_JP_locale(std::chrono::year_month_day_last{ - std::chrono::year{0}, std::chrono::month_day_last{std::chrono::month{3}}}) == SV("0000/3月/last")); - assert(stream_ja_JP_locale(std::chrono::year_month_day_last{ - std::chrono::year{1970}, std::chrono::month_day_last{std::chrono::month{4}}}) == SV("1970/4月/last")); - assert(stream_ja_JP_locale(std::chrono::year_month_day_last{ - std::chrono::year{32'767}, std::chrono::month_day_last{std::chrono::month{5}}}) == SV("32767/5月/last")); - assert(stream_ja_JP_locale(std::chrono::year_month_day_last{ - std::chrono::year{0}, std::chrono::month_day_last{std::chrono::month{6}}}) == SV("0000/6月/last")); - assert(stream_ja_JP_locale(std::chrono::year_month_day_last{ - std::chrono::year{0}, std::chrono::month_day_last{std::chrono::month{7}}}) == SV("0000/7月/last")); - assert(stream_ja_JP_locale(std::chrono::year_month_day_last{ - std::chrono::year{0}, std::chrono::month_day_last{std::chrono::month{8}}}) == SV("0000/8月/last")); - assert(stream_ja_JP_locale(std::chrono::year_month_day_last{ - std::chrono::year{0}, std::chrono::month_day_last{std::chrono::month{9}}}) == SV("0000/9月/last")); -# else // defined(_WIN32) || defined(_AIX) - assert(stream_ja_JP_locale(std::chrono::year_month_day_last{ - std::chrono::year{-32'768}, std::chrono::month_day_last{std::chrono::month{1}}}) == - SV("-32768 is not a valid year/ 1月/last")); - assert( - stream_ja_JP_locale(std::chrono::year_month_day_last{ - std::chrono::year{-32'767}, std::chrono::month_day_last{std::chrono::month{2}}}) == SV("-32767/ 2月/last")); - assert(stream_ja_JP_locale(std::chrono::year_month_day_last{ - std::chrono::year{0}, std::chrono::month_day_last{std::chrono::month{3}}}) == SV("0000/ 3月/last")); - assert(stream_ja_JP_locale(std::chrono::year_month_day_last{ - std::chrono::year{1970}, std::chrono::month_day_last{std::chrono::month{4}}}) == SV("1970/ 4月/last")); - assert(stream_ja_JP_locale(std::chrono::year_month_day_last{ - std::chrono::year{32'767}, std::chrono::month_day_last{std::chrono::month{5}}}) == SV("32767/ 5月/last")); - assert(stream_ja_JP_locale(std::chrono::year_month_day_last{ - std::chrono::year{0}, std::chrono::month_day_last{std::chrono::month{6}}}) == SV("0000/ 6月/last")); - assert(stream_ja_JP_locale(std::chrono::year_month_day_last{ - std::chrono::year{0}, std::chrono::month_day_last{std::chrono::month{7}}}) == SV("0000/ 7月/last")); - assert(stream_ja_JP_locale(std::chrono::year_month_day_last{ - std::chrono::year{0}, std::chrono::month_day_last{std::chrono::month{8}}}) == SV("0000/ 8月/last")); - assert(stream_ja_JP_locale(std::chrono::year_month_day_last{ - std::chrono::year{0}, std::chrono::month_day_last{std::chrono::month{9}}}) == SV("0000/ 9月/last")); -# endif // defined(_WIN32) || defined(_AIX) - assert(stream_ja_JP_locale(std::chrono::year_month_day_last{ - std::chrono::year{0}, std::chrono::month_day_last{std::chrono::month{10}}}) == SV("0000/10月/last")); - assert(stream_ja_JP_locale(std::chrono::year_month_day_last{ - std::chrono::year{0}, std::chrono::month_day_last{std::chrono::month{11}}}) == SV("0000/11月/last")); - assert(stream_ja_JP_locale(std::chrono::year_month_day_last{ - std::chrono::year{0}, std::chrono::month_day_last{std::chrono::month{12}}}) == SV("0000/12月/last")); -#endif // defined(__APPLE__) - assert(stream_ja_JP_locale(std::chrono::year_month_day_last{ - std::chrono::year{0}, std::chrono::month_day_last{std::chrono::month{13}}}) == - SV("0000/13 is not a valid month/last")); - assert(stream_ja_JP_locale(std::chrono::year_month_day_last{ - std::chrono::year{-32'768}, std::chrono::month_day_last{std::chrono::month{255}}}) == - SV("-32768 is not a valid year/255 is not a valid month/last")); + TEST_EQUAL(stream_ja_JP_locale(std::chrono::year_month_day_last{ + std::chrono::year{0}, std::chrono::month_day_last{std::chrono::month{0}}}), + SV("0000/0 is not a valid month/last")); +#if defined(__APPLE__) || defined(_WIN32) +# if defined(__APPLE__) + TEST_EQUAL(stream_ja_JP_locale(std::chrono::year_month_day_last{ + std::chrono::year{-32'768}, std::chrono::month_day_last{std::chrono::month{1}}}), + SV("-32768 is not a valid year/ 1/last")); + TEST_EQUAL(stream_ja_JP_locale(std::chrono::year_month_day_last{ + std::chrono::year{-32'767}, std::chrono::month_day_last{std::chrono::month{2}}}), + SV("-32767/ 2/last")); + TEST_EQUAL(stream_ja_JP_locale(std::chrono::year_month_day_last{ + std::chrono::year{0}, std::chrono::month_day_last{std::chrono::month{3}}}), + SV("0000/ 3/last")); + TEST_EQUAL(stream_ja_JP_locale(std::chrono::year_month_day_last{ + std::chrono::year{1970}, std::chrono::month_day_last{std::chrono::month{4}}}), + SV("1970/ 4/last")); + TEST_EQUAL(stream_ja_JP_locale(std::chrono::year_month_day_last{ + std::chrono::year{32'767}, std::chrono::month_day_last{std::chrono::month{5}}}), + SV("32767/ 5/last")); + TEST_EQUAL(stream_ja_JP_locale(std::chrono::year_month_day_last{ + std::chrono::year{0}, std::chrono::month_day_last{std::chrono::month{6}}}), + SV("0000/ 6/last")); + TEST_EQUAL(stream_ja_JP_locale(std::chrono::year_month_day_last{ + std::chrono::year{0}, std::chrono::month_day_last{std::chrono::month{7}}}), + SV("0000/ 7/last")); + TEST_EQUAL(stream_ja_JP_locale(std::chrono::year_month_day_last{ + std::chrono::year{0}, std::chrono::month_day_last{std::chrono::month{8}}}), + SV("0000/ 8/last")); + TEST_EQUAL(stream_ja_JP_locale(std::chrono::year_month_day_last{ + std::chrono::year{0}, std::chrono::month_day_last{std::chrono::month{9}}}), + SV("0000/ 9/last")); +# else // defined(__APPLE__) + TEST_EQUAL(stream_ja_JP_locale(std::chrono::year_month_day_last{ + std::chrono::year{-32'768}, std::chrono::month_day_last{std::chrono::month{1}}}), + SV("-32768 is not a valid year/1/last")); + TEST_EQUAL(stream_ja_JP_locale(std::chrono::year_month_day_last{ + std::chrono::year{-32'767}, std::chrono::month_day_last{std::chrono::month{2}}}), + SV("-32767/2/last")); + TEST_EQUAL(stream_ja_JP_locale(std::chrono::year_month_day_last{ + std::chrono::year{0}, std::chrono::month_day_last{std::chrono::month{3}}}), + SV("0000/3/last")); + TEST_EQUAL(stream_ja_JP_locale(std::chrono::year_month_day_last{ + std::chrono::year{1970}, std::chrono::month_day_last{std::chrono::month{4}}}), + SV("1970/4/last")); + TEST_EQUAL(stream_ja_JP_locale(std::chrono::year_month_day_last{ + std::chrono::year{32'767}, std::chrono::month_day_last{std::chrono::month{5}}}), + SV("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(__APPLE__) + TEST_EQUAL(stream_ja_JP_locale(std::chrono::year_month_day_last{ + std::chrono::year{0}, std::chrono::month_day_last{std::chrono::month{10}}}), + SV("0000/10/last")); + TEST_EQUAL(stream_ja_JP_locale(std::chrono::year_month_day_last{ + std::chrono::year{0}, std::chrono::month_day_last{std::chrono::month{11}}}), + SV("0000/11/last")); + TEST_EQUAL(stream_ja_JP_locale(std::chrono::year_month_day_last{ + std::chrono::year{0}, std::chrono::month_day_last{std::chrono::month{12}}}), + SV("0000/12/last")); +#else // defined(__APPLE__) || defined(_WIN32) +# if defined(_AIX) + TEST_EQUAL(stream_ja_JP_locale(std::chrono::year_month_day_last{ + std::chrono::year{-32'768}, std::chrono::month_day_last{std::chrono::month{1}}}), + SV("-32768 is not a valid year/1月/last")); + TEST_EQUAL(stream_ja_JP_locale(std::chrono::year_month_day_last{ + std::chrono::year{-32'767}, std::chrono::month_day_last{std::chrono::month{2}}}), + SV("-32767/2月/last")); + TEST_EQUAL(stream_ja_JP_locale(std::chrono::year_month_day_last{ + std::chrono::year{0}, std::chrono::month_day_last{std::chrono::month{3}}}), + SV("0000/3月/last")); + TEST_EQUAL(stream_ja_JP_locale(std::chrono::year_month_day_last{ + std::chrono::year{1970}, std::chrono::month_day_last{std::chrono::month{4}}}), + SV("1970/4月/last")); + TEST_EQUAL(stream_ja_JP_locale(std::chrono::year_month_day_last{ + std::chrono::year{32'767}, std::chrono::month_day_last{std::chrono::month{5}}}), + SV("32767/5月/last")); + TEST_EQUAL(stream_ja_JP_locale(std::chrono::year_month_day_last{ + std::chrono::year{0}, std::chrono::month_day_last{std::chrono::month{6}}}), + SV("0000/6月/last")); + TEST_EQUAL(stream_ja_JP_locale(std::chrono::year_month_day_last{ + std::chrono::year{0}, std::chrono::month_day_last{std::chrono::month{7}}}), + SV("0000/7月/last")); + TEST_EQUAL(stream_ja_JP_locale(std::chrono::year_month_day_last{ + std::chrono::year{0}, std::chrono::month_day_last{std::chrono::month{8}}}), + SV("0000/8月/last")); + TEST_EQUAL(stream_ja_JP_locale(std::chrono::year_month_day_last{ + std::chrono::year{0}, std::chrono::month_day_last{std::chrono::month{9}}}), + SV("0000/9月/last")); +# else // defined(_AIX) + TEST_EQUAL(stream_ja_JP_locale(std::chrono::year_month_day_last{ + std::chrono::year{-32'768}, std::chrono::month_day_last{std::chrono::month{1}}}), + SV("-32768 is not a valid year/ 1月/last")); + TEST_EQUAL(stream_ja_JP_locale(std::chrono::year_month_day_last{ + std::chrono::year{-32'767}, std::chrono::month_day_last{std::chrono::month{2}}}), + SV("-32767/ 2月/last")); + TEST_EQUAL(stream_ja_JP_locale(std::chrono::year_month_day_last{ + std::chrono::year{0}, std::chrono::month_day_last{std::chrono::month{3}}}), + SV("0000/ 3月/last")); + TEST_EQUAL(stream_ja_JP_locale(std::chrono::year_month_day_last{ + std::chrono::year{1970}, std::chrono::month_day_last{std::chrono::month{4}}}), + SV("1970/ 4月/last")); + TEST_EQUAL(stream_ja_JP_locale(std::chrono::year_month_day_last{ + std::chrono::year{32'767}, std::chrono::month_day_last{std::chrono::month{5}}}), + SV("32767/ 5月/last")); + TEST_EQUAL(stream_ja_JP_locale(std::chrono::year_month_day_last{ + std::chrono::year{0}, std::chrono::month_day_last{std::chrono::month{6}}}), + SV("0000/ 6月/last")); + TEST_EQUAL(stream_ja_JP_locale(std::chrono::year_month_day_last{ + std::chrono::year{0}, std::chrono::month_day_last{std::chrono::month{7}}}), + SV("0000/ 7月/last")); + TEST_EQUAL(stream_ja_JP_locale(std::chrono::year_month_day_last{ + std::chrono::year{0}, std::chrono::month_day_last{std::chrono::month{8}}}), + SV("0000/ 8月/last")); + TEST_EQUAL(stream_ja_JP_locale(std::chrono::year_month_day_last{ + std::chrono::year{0}, std::chrono::month_day_last{std::chrono::month{9}}}), + SV("0000/ 9月/last")); +# endif // defined(_AIX) + TEST_EQUAL(stream_ja_JP_locale(std::chrono::year_month_day_last{ + std::chrono::year{0}, std::chrono::month_day_last{std::chrono::month{10}}}), + SV("0000/10月/last")); + TEST_EQUAL(stream_ja_JP_locale(std::chrono::year_month_day_last{ + std::chrono::year{0}, std::chrono::month_day_last{std::chrono::month{11}}}), + SV("0000/11月/last")); + TEST_EQUAL(stream_ja_JP_locale(std::chrono::year_month_day_last{ + std::chrono::year{0}, std::chrono::month_day_last{std::chrono::month{12}}}), + SV("0000/12月/last")); +#endif // defined(__APPLE__) || defined(_WIN32) + TEST_EQUAL(stream_ja_JP_locale(std::chrono::year_month_day_last{ + std::chrono::year{0}, std::chrono::month_day_last{std::chrono::month{13}}}), + SV("0000/13 is not a valid month/last")); + TEST_EQUAL(stream_ja_JP_locale(std::chrono::year_month_day_last{ + std::chrono::year{-32'768}, std::chrono::month_day_last{std::chrono::month{255}}}), + SV("-32768 is not a valid year/255 is not a valid month/last")); } int main(int, char**) { diff --git a/libcxx/test/std/time/time.cal/time.cal.ymwd/time.cal.ymwd.nonmembers/ostream.pass.cpp b/libcxx/test/std/time/time.cal/time.cal.ymwd/time.cal.ymwd.nonmembers/ostream.pass.cpp --- a/libcxx/test/std/time/time.cal/time.cal.ymwd/time.cal.ymwd.nonmembers/ostream.pass.cpp +++ b/libcxx/test/std/time/time.cal/time.cal.ymwd/time.cal.ymwd.nonmembers/ostream.pass.cpp @@ -9,9 +9,6 @@ // UNSUPPORTED: c++03, c++11, c++14, c++17 // UNSUPPORTED: no-localization -// 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::year_month_weekday ymwd) { std::basic_stringstream sstr; @@ -66,180 +70,191 @@ template static void test() { - assert(stream_c_locale(std::chrono::year_month_weekday{ - std::chrono::year{-32'768}, - std::chrono::month{1}, - std::chrono::weekday_indexed{std::chrono::weekday(0), 1}}) == SV("-32768 is not a valid year/Jan/Sun[1]")); - assert(stream_c_locale(std::chrono::year_month_weekday{ - std::chrono::year{-32'767}, - std::chrono::month{0}, - std::chrono::weekday_indexed{std::chrono::weekday(0), 1}}) == SV("-32767/0 is not a valid month/Sun[1]")); - assert( + TEST_EQUAL( + stream_c_locale(std::chrono::year_month_weekday{ + std::chrono::year{-32'768}, std::chrono::month{1}, std::chrono::weekday_indexed{std::chrono::weekday(0), 1}}), + SV("-32768 is not a valid year/Jan/Sun[1]")); + TEST_EQUAL( stream_c_locale(std::chrono::year_month_weekday{ - std::chrono::year{-32'767}, - std::chrono::month{1}, - std::chrono::weekday_indexed{std::chrono::weekday(8), 1}}) == SV("-32767/Jan/8 is not a valid weekday[1]")); - assert(stream_c_locale(std::chrono::year_month_weekday{ - std::chrono::year{-32'767}, - std::chrono::month{1}, - std::chrono::weekday_indexed{std::chrono::weekday(0), 0}}) == - SV("-32767/Jan/Sun[0 is not a valid index]")); // note 0 is a valid index here... - assert(stream_c_locale(std::chrono::year_month_weekday{ - std::chrono::year{-32'767}, - std::chrono::month{1}, - std::chrono::weekday_indexed{std::chrono::weekday(0), 1}}) == SV("-32767/Jan/Sun[1]")); - - assert( + std::chrono::year{-32'767}, std::chrono::month{0}, std::chrono::weekday_indexed{std::chrono::weekday(0), 1}}), + SV("-32767/0 is not a valid month/Sun[1]")); + TEST_EQUAL( stream_c_locale(std::chrono::year_month_weekday{ - std::chrono::year{1970}, std::chrono::month{1}, std::chrono::weekday_indexed{std::chrono::weekday(0), 1}}) == + std::chrono::year{-32'767}, std::chrono::month{1}, std::chrono::weekday_indexed{std::chrono::weekday(8), 1}}), + SV("-32767/Jan/8 is not a valid weekday[1]")); + TEST_EQUAL( + stream_c_locale(std::chrono::year_month_weekday{ + std::chrono::year{-32'767}, std::chrono::month{1}, std::chrono::weekday_indexed{std::chrono::weekday(0), 0}}), + SV("-32767/Jan/Sun[0 is not a valid index]")); // note 0 is a valid index here... + TEST_EQUAL( + stream_c_locale(std::chrono::year_month_weekday{ + std::chrono::year{-32'767}, std::chrono::month{1}, std::chrono::weekday_indexed{std::chrono::weekday(0), 1}}), + SV("-32767/Jan/Sun[1]")); + + TEST_EQUAL( + stream_c_locale(std::chrono::year_month_weekday{ + std::chrono::year{1970}, std::chrono::month{1}, std::chrono::weekday_indexed{std::chrono::weekday(0), 1}}), SV("1970/Jan/Sun[1]")); #if defined(__APPLE__) - assert(stream_fr_FR_locale(std::chrono::year_month_weekday{ - std::chrono::year{-32'768}, - std::chrono::month{1}, - std::chrono::weekday_indexed{std::chrono::weekday(0), 1}}) == SV("-32768 is not a valid year/jan/Dim[1]")); - assert(stream_fr_FR_locale(std::chrono::year_month_weekday{ - std::chrono::year{-32'767}, - std::chrono::month{0}, - std::chrono::weekday_indexed{std::chrono::weekday(0), 1}}) == SV("-32767/0 is not a valid month/Dim[1]")); - assert( + TEST_EQUAL( + stream_fr_FR_locale(std::chrono::year_month_weekday{ + std::chrono::year{-32'768}, std::chrono::month{1}, std::chrono::weekday_indexed{std::chrono::weekday(0), 1}}), + SV("-32768 is not a valid year/jan/Dim[1]")); + TEST_EQUAL( + stream_fr_FR_locale(std::chrono::year_month_weekday{ + std::chrono::year{-32'767}, std::chrono::month{0}, std::chrono::weekday_indexed{std::chrono::weekday(0), 1}}), + SV("-32767/0 is not a valid month/Dim[1]")); + TEST_EQUAL( + stream_fr_FR_locale(std::chrono::year_month_weekday{ + std::chrono::year{-32'767}, std::chrono::month{1}, std::chrono::weekday_indexed{std::chrono::weekday(8), 1}}), + SV("-32767/jan/8 is not a valid weekday[1]")); + TEST_EQUAL( + stream_fr_FR_locale(std::chrono::year_month_weekday{ + std::chrono::year{-32'767}, std::chrono::month{1}, std::chrono::weekday_indexed{std::chrono::weekday(0), 0}}), + SV("-32767/jan/Dim[0 is not a valid index]")); // note 0 is a valid index here... + TEST_EQUAL( stream_fr_FR_locale(std::chrono::year_month_weekday{ - std::chrono::year{-32'767}, - std::chrono::month{1}, - std::chrono::weekday_indexed{std::chrono::weekday(8), 1}}) == SV("-32767/jan/8 is not a valid weekday[1]")); - assert(stream_fr_FR_locale(std::chrono::year_month_weekday{ - std::chrono::year{-32'767}, - std::chrono::month{1}, - std::chrono::weekday_indexed{std::chrono::weekday(0), 0}}) == - SV("-32767/jan/Dim[0 is not a valid index]")); // note 0 is a valid index here... - assert(stream_fr_FR_locale(std::chrono::year_month_weekday{ - std::chrono::year{-32'767}, - std::chrono::month{1}, - std::chrono::weekday_indexed{std::chrono::weekday(0), 1}}) == SV("-32767/jan/Dim[1]")); - - assert( + std::chrono::year{-32'767}, std::chrono::month{1}, std::chrono::weekday_indexed{std::chrono::weekday(0), 1}}), + SV("-32767/jan/Dim[1]")); + + TEST_EQUAL( stream_fr_FR_locale(std::chrono::year_month_weekday{ - std::chrono::year{1970}, std::chrono::month{1}, std::chrono::weekday_indexed{std::chrono::weekday(0), 1}}) == + std::chrono::year{1970}, std::chrono::month{1}, std::chrono::weekday_indexed{std::chrono::weekday(0), 1}}), SV("1970/jan/Dim[1]")); #else // defined(__APPLE__) - assert( + TEST_EQUAL( + stream_fr_FR_locale(std::chrono::year_month_weekday{ + std::chrono::year{-32'768}, std::chrono::month{1}, std::chrono::weekday_indexed{std::chrono::weekday(0), 1}}), + SV("-32768 is not a valid year/janv./dim.[1]")); + TEST_EQUAL( + stream_fr_FR_locale(std::chrono::year_month_weekday{ + std::chrono::year{-32'767}, std::chrono::month{0}, std::chrono::weekday_indexed{std::chrono::weekday(0), 1}}), + SV("-32767/0 is not a valid month/dim.[1]")); + TEST_EQUAL( stream_fr_FR_locale(std::chrono::year_month_weekday{ - std::chrono::year{-32'768}, - std::chrono::month{1}, - std::chrono::weekday_indexed{std::chrono::weekday(0), 1}}) == SV("-32768 is not a valid year/janv./dim.[1]")); - assert(stream_fr_FR_locale(std::chrono::year_month_weekday{ - std::chrono::year{-32'767}, - std::chrono::month{0}, - std::chrono::weekday_indexed{std::chrono::weekday(0), 1}}) == SV("-32767/0 is not a valid month/dim.[1]")); - assert( + std::chrono::year{-32'767}, std::chrono::month{1}, std::chrono::weekday_indexed{std::chrono::weekday(8), 1}}), + SV("-32767/janv./8 is not a valid weekday[1]")); + TEST_EQUAL( stream_fr_FR_locale(std::chrono::year_month_weekday{ - std::chrono::year{-32'767}, - std::chrono::month{1}, - std::chrono::weekday_indexed{std::chrono::weekday(8), 1}}) == SV("-32767/janv./8 is not a valid weekday[1]")); - assert(stream_fr_FR_locale(std::chrono::year_month_weekday{ - std::chrono::year{-32'767}, - std::chrono::month{1}, - std::chrono::weekday_indexed{std::chrono::weekday(0), 0}}) == - SV("-32767/janv./dim.[0 is not a valid index]")); // note 0 is a valid index here... - assert(stream_fr_FR_locale(std::chrono::year_month_weekday{ - std::chrono::year{-32'767}, - std::chrono::month{1}, - std::chrono::weekday_indexed{std::chrono::weekday(0), 1}}) == SV("-32767/janv./dim.[1]")); - - assert( + std::chrono::year{-32'767}, std::chrono::month{1}, std::chrono::weekday_indexed{std::chrono::weekday(0), 0}}), + SV("-32767/janv./dim.[0 is not a valid index]")); // note 0 is a valid index here... + TEST_EQUAL( stream_fr_FR_locale(std::chrono::year_month_weekday{ - std::chrono::year{1970}, std::chrono::month{1}, std::chrono::weekday_indexed{std::chrono::weekday(0), 1}}) == + std::chrono::year{-32'767}, std::chrono::month{1}, std::chrono::weekday_indexed{std::chrono::weekday(0), 1}}), + SV("-32767/janv./dim.[1]")); + + TEST_EQUAL( + stream_fr_FR_locale(std::chrono::year_month_weekday{ + std::chrono::year{1970}, std::chrono::month{1}, std::chrono::weekday_indexed{std::chrono::weekday(0), 1}}), SV("1970/janv./dim.[1]")); #endif // defined(__APPLE__) #if defined(__APPLE__) - assert(stream_ja_JP_locale(std::chrono::year_month_weekday{ - std::chrono::year{-32'768}, - std::chrono::month{1}, - std::chrono::weekday_indexed{std::chrono::weekday(0), 1}}) == SV("-32768 is not a valid year/ 1/日[1]")); - assert(stream_ja_JP_locale(std::chrono::year_month_weekday{ - std::chrono::year{-32'767}, - std::chrono::month{0}, - std::chrono::weekday_indexed{std::chrono::weekday(0), 1}}) == SV("-32767/0 is not a valid month/日[1]")); - assert(stream_ja_JP_locale(std::chrono::year_month_weekday{ - std::chrono::year{-32'767}, - std::chrono::month{1}, - std::chrono::weekday_indexed{std::chrono::weekday(8), 1}}) == SV("-32767/ 1/8 is not a valid weekday[1]")); - assert(stream_ja_JP_locale(std::chrono::year_month_weekday{ - std::chrono::year{-32'767}, - std::chrono::month{1}, - std::chrono::weekday_indexed{std::chrono::weekday(0), 0}}) == - SV("-32767/ 1/日[0 is not a valid index]")); // note 0 is a valid index here... - assert(stream_ja_JP_locale(std::chrono::year_month_weekday{ - std::chrono::year{-32'767}, - std::chrono::month{1}, - std::chrono::weekday_indexed{std::chrono::weekday(0), 1}}) == SV("-32767/ 1/日[1]")); - - assert( - stream_ja_JP_locale(std::chrono::year_month_weekday{ - std::chrono::year{1970}, std::chrono::month{1}, std::chrono::weekday_indexed{std::chrono::weekday(0), 1}}) == + TEST_EQUAL( + stream_ja_JP_locale(std::chrono::year_month_weekday{ + std::chrono::year{-32'768}, std::chrono::month{1}, std::chrono::weekday_indexed{std::chrono::weekday(0), 1}}), + SV("-32768 is not a valid year/ 1/日[1]")); + TEST_EQUAL( + stream_ja_JP_locale(std::chrono::year_month_weekday{ + std::chrono::year{-32'767}, std::chrono::month{0}, std::chrono::weekday_indexed{std::chrono::weekday(0), 1}}), + SV("-32767/0 is not a valid month/日[1]")); + TEST_EQUAL( + stream_ja_JP_locale(std::chrono::year_month_weekday{ + std::chrono::year{-32'767}, std::chrono::month{1}, std::chrono::weekday_indexed{std::chrono::weekday(8), 1}}), + SV("-32767/ 1/8 is not a valid weekday[1]")); + TEST_EQUAL( + stream_ja_JP_locale(std::chrono::year_month_weekday{ + std::chrono::year{-32'767}, std::chrono::month{1}, std::chrono::weekday_indexed{std::chrono::weekday(0), 0}}), + SV("-32767/ 1/日[0 is not a valid index]")); // note 0 is a valid index here... + TEST_EQUAL( + stream_ja_JP_locale(std::chrono::year_month_weekday{ + std::chrono::year{-32'767}, std::chrono::month{1}, std::chrono::weekday_indexed{std::chrono::weekday(0), 1}}), + SV("-32767/ 1/日[1]")); + TEST_EQUAL( + stream_ja_JP_locale(std::chrono::year_month_weekday{ + std::chrono::year{1970}, std::chrono::month{1}, std::chrono::weekday_indexed{std::chrono::weekday(0), 1}}), SV("1970/ 1/日[1]")); -#else // defined(__APPLE__) -# if defined(_WIN32) || defined(_AIX) - assert(stream_ja_JP_locale(std::chrono::year_month_weekday{ - std::chrono::year{-32'768}, - std::chrono::month{1}, - std::chrono::weekday_indexed{std::chrono::weekday(0), 1}}) == SV("-32768 is not a valid year/1月/日[1]")); - assert(stream_ja_JP_locale(std::chrono::year_month_weekday{ - std::chrono::year{-32'767}, - std::chrono::month{0}, - std::chrono::weekday_indexed{std::chrono::weekday(0), 1}}) == SV("-32767/0 is not a valid month/日[1]")); - assert( - stream_ja_JP_locale(std::chrono::year_month_weekday{ - std::chrono::year{-32'767}, - std::chrono::month{1}, - std::chrono::weekday_indexed{std::chrono::weekday(8), 1}}) == SV("-32767/1月/8 is not a valid weekday[1]")); - - assert(stream_ja_JP_locale(std::chrono::year_month_weekday{ - std::chrono::year{-32'767}, - std::chrono::month{1}, - std::chrono::weekday_indexed{std::chrono::weekday(0), 0}}) == - SV("-32767/1月/日[0 is not a valid index]")); // note 0 is a valid index here... - assert(stream_ja_JP_locale(std::chrono::year_month_weekday{ - std::chrono::year{-32'767}, - std::chrono::month{1}, - std::chrono::weekday_indexed{std::chrono::weekday(0), 1}}) == SV("-32767/1月/日[1]")); - - assert( - stream_ja_JP_locale(std::chrono::year_month_weekday{ - std::chrono::year{1970}, std::chrono::month{1}, std::chrono::weekday_indexed{std::chrono::weekday(0), 1}}) == +#elif defined(_WIN32) // defined(__APPLE__) + TEST_EQUAL( + stream_ja_JP_locale(std::chrono::year_month_weekday{ + std::chrono::year{-32'768}, std::chrono::month{1}, std::chrono::weekday_indexed{std::chrono::weekday(0), 1}}), + SV("-32768 is not a valid year/1/日[1]")); + TEST_EQUAL( + stream_ja_JP_locale(std::chrono::year_month_weekday{ + std::chrono::year{-32'767}, std::chrono::month{0}, std::chrono::weekday_indexed{std::chrono::weekday(0), 1}}), + SV("-32767/0 is not a valid month/日[1]")); + TEST_EQUAL( + stream_ja_JP_locale(std::chrono::year_month_weekday{ + std::chrono::year{-32'767}, std::chrono::month{1}, std::chrono::weekday_indexed{std::chrono::weekday(8), 1}}), + SV("-32767/1/8 is not a valid weekday[1]")); + TEST_EQUAL( + stream_ja_JP_locale(std::chrono::year_month_weekday{ + std::chrono::year{-32'767}, std::chrono::month{1}, std::chrono::weekday_indexed{std::chrono::weekday(0), 0}}), + SV("-32767/1/日[0 is not a valid index]")); // note 0 is a valid index here... + TEST_EQUAL( + stream_ja_JP_locale(std::chrono::year_month_weekday{ + std::chrono::year{-32'767}, std::chrono::month{1}, std::chrono::weekday_indexed{std::chrono::weekday(0), 1}}), + SV("-32767/1/日[1]")); + + TEST_EQUAL( + stream_ja_JP_locale(std::chrono::year_month_weekday{ + std::chrono::year{1970}, std::chrono::month{1}, std::chrono::weekday_indexed{std::chrono::weekday(0), 1}}), + SV("1970/1/日[1]")); +#elif defined(_AIX) // defined(__APPLE__) + TEST_EQUAL( + stream_ja_JP_locale(std::chrono::year_month_weekday{ + std::chrono::year{-32'768}, std::chrono::month{1}, std::chrono::weekday_indexed{std::chrono::weekday(0), 1}}), + SV("-32768 is not a valid year/1月/日[1]")); + TEST_EQUAL( + stream_ja_JP_locale(std::chrono::year_month_weekday{ + std::chrono::year{-32'767}, std::chrono::month{0}, std::chrono::weekday_indexed{std::chrono::weekday(0), 1}}), + SV("-32767/0 is not a valid month/日[1]")); + TEST_EQUAL( + stream_ja_JP_locale(std::chrono::year_month_weekday{ + std::chrono::year{-32'767}, std::chrono::month{1}, std::chrono::weekday_indexed{std::chrono::weekday(8), 1}}), + SV("-32767/1月/8 is not a valid weekday[1]")); + + TEST_EQUAL( + stream_ja_JP_locale(std::chrono::year_month_weekday{ + std::chrono::year{-32'767}, std::chrono::month{1}, std::chrono::weekday_indexed{std::chrono::weekday(0), 0}}), + SV("-32767/1月/日[0 is not a valid index]")); // note 0 is a valid index here... + TEST_EQUAL( + stream_ja_JP_locale(std::chrono::year_month_weekday{ + std::chrono::year{-32'767}, std::chrono::month{1}, std::chrono::weekday_indexed{std::chrono::weekday(0), 1}}), + SV("-32767/1月/日[1]")); + + TEST_EQUAL( + stream_ja_JP_locale(std::chrono::year_month_weekday{ + std::chrono::year{1970}, std::chrono::month{1}, std::chrono::weekday_indexed{std::chrono::weekday(0), 1}}), SV("1970/1月/日[1]")); -# else // defined(_WIN32) || defined(_AIX) - assert(stream_ja_JP_locale(std::chrono::year_month_weekday{ - std::chrono::year{-32'768}, - std::chrono::month{1}, - std::chrono::weekday_indexed{std::chrono::weekday(0), 1}}) == SV("-32768 is not a valid year/ 1月/日[1]")); - assert(stream_ja_JP_locale(std::chrono::year_month_weekday{ - std::chrono::year{-32'767}, - std::chrono::month{0}, - std::chrono::weekday_indexed{std::chrono::weekday(0), 1}}) == SV("-32767/0 is not a valid month/日[1]")); - assert( - stream_ja_JP_locale(std::chrono::year_month_weekday{ - std::chrono::year{-32'767}, - std::chrono::month{1}, - std::chrono::weekday_indexed{std::chrono::weekday(8), 1}}) == SV("-32767/ 1月/8 is not a valid weekday[1]")); - assert(stream_ja_JP_locale(std::chrono::year_month_weekday{ - std::chrono::year{-32'767}, - std::chrono::month{1}, - std::chrono::weekday_indexed{std::chrono::weekday(0), 0}}) == - SV("-32767/ 1月/日[0 is not a valid index]")); // note 0 is a valid index here... - assert(stream_ja_JP_locale(std::chrono::year_month_weekday{ - std::chrono::year{-32'767}, - std::chrono::month{1}, - std::chrono::weekday_indexed{std::chrono::weekday(0), 1}}) == SV("-32767/ 1月/日[1]")); - - assert( - stream_ja_JP_locale(std::chrono::year_month_weekday{ - std::chrono::year{1970}, std::chrono::month{1}, std::chrono::weekday_indexed{std::chrono::weekday(0), 1}}) == +#else // defined(__APPLE__) + TEST_EQUAL( + stream_ja_JP_locale(std::chrono::year_month_weekday{ + std::chrono::year{-32'768}, std::chrono::month{1}, std::chrono::weekday_indexed{std::chrono::weekday(0), 1}}), + SV("-32768 is not a valid year/ 1月/日[1]")); + TEST_EQUAL( + stream_ja_JP_locale(std::chrono::year_month_weekday{ + std::chrono::year{-32'767}, std::chrono::month{0}, std::chrono::weekday_indexed{std::chrono::weekday(0), 1}}), + SV("-32767/0 is not a valid month/日[1]")); + TEST_EQUAL( + stream_ja_JP_locale(std::chrono::year_month_weekday{ + std::chrono::year{-32'767}, std::chrono::month{1}, std::chrono::weekday_indexed{std::chrono::weekday(8), 1}}), + SV("-32767/ 1月/8 is not a valid weekday[1]")); + TEST_EQUAL( + stream_ja_JP_locale(std::chrono::year_month_weekday{ + std::chrono::year{-32'767}, std::chrono::month{1}, std::chrono::weekday_indexed{std::chrono::weekday(0), 0}}), + SV("-32767/ 1月/日[0 is not a valid index]")); // note 0 is a valid index here... + TEST_EQUAL( + stream_ja_JP_locale(std::chrono::year_month_weekday{ + std::chrono::year{-32'767}, std::chrono::month{1}, std::chrono::weekday_indexed{std::chrono::weekday(0), 1}}), + SV("-32767/ 1月/日[1]")); + + TEST_EQUAL( + stream_ja_JP_locale(std::chrono::year_month_weekday{ + std::chrono::year{1970}, std::chrono::month{1}, std::chrono::weekday_indexed{std::chrono::weekday(0), 1}}), SV("1970/ 1月/日[1]")); -# endif // defined(_WIN32) || defined(_AIX) -#endif // defined(__APPLE__) +#endif // defined(__APPLE__) } int main(int, char**) { diff --git a/libcxx/test/std/time/time.cal/time.cal.ymwdlast/time.cal.ymwdlast.nonmembers/ostream.pass.cpp b/libcxx/test/std/time/time.cal/time.cal.ymwdlast/time.cal.ymwdlast.nonmembers/ostream.pass.cpp --- a/libcxx/test/std/time/time.cal/time.cal.ymwdlast/time.cal.ymwdlast.nonmembers/ostream.pass.cpp +++ b/libcxx/test/std/time/time.cal/time.cal.ymwdlast/time.cal.ymwdlast.nonmembers/ostream.pass.cpp @@ -9,9 +9,6 @@ // UNSUPPORTED: c++03, c++11, c++14, c++17 // UNSUPPORTED: no-localization -// 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::year_month_weekday_last ymwdl) { std::basic_stringstream sstr; @@ -66,114 +70,157 @@ template static void test() { - assert(stream_c_locale(std::chrono::year_month_weekday_last{ - std::chrono::year{-32'768}, std::chrono::month{1}, std::chrono::weekday_last{std::chrono::weekday{0}}}) == - SV("-32768 is not a valid year/Jan/Sun[last]")); - assert(stream_c_locale(std::chrono::year_month_weekday_last{ - std::chrono::year{-32'767}, std::chrono::month{0}, std::chrono::weekday_last{std::chrono::weekday{0}}}) == - SV("-32767/0 is not a valid month/Sun[last]")); - assert(stream_c_locale(std::chrono::year_month_weekday_last{ - std::chrono::year{-32'767}, std::chrono::month{1}, std::chrono::weekday_last{std::chrono::weekday{8}}}) == - SV("-32767/Jan/8 is not a valid weekday[last]")); - assert(stream_c_locale(std::chrono::year_month_weekday_last{ - std::chrono::year{-32'767}, std::chrono::month{1}, std::chrono::weekday_last{std::chrono::weekday{0}}}) == - SV("-32767/Jan/Sun[last]")); - - assert(stream_c_locale(std::chrono::year_month_weekday_last{ - std::chrono::year{1970}, std::chrono::month{1}, std::chrono::weekday_last{std::chrono::weekday{0}}}) == - SV("1970/Jan/Sun[last]")); + TEST_EQUAL( + stream_c_locale(std::chrono::year_month_weekday_last{ + std::chrono::year{-32'768}, std::chrono::month{1}, std::chrono::weekday_last{std::chrono::weekday{0}}}), + SV("-32768 is not a valid year/Jan/Sun[last]")); + TEST_EQUAL( + stream_c_locale(std::chrono::year_month_weekday_last{ + std::chrono::year{-32'767}, std::chrono::month{0}, std::chrono::weekday_last{std::chrono::weekday{0}}}), + SV("-32767/0 is not a valid month/Sun[last]")); + TEST_EQUAL( + stream_c_locale(std::chrono::year_month_weekday_last{ + std::chrono::year{-32'767}, std::chrono::month{1}, std::chrono::weekday_last{std::chrono::weekday{8}}}), + SV("-32767/Jan/8 is not a valid weekday[last]")); + TEST_EQUAL( + stream_c_locale(std::chrono::year_month_weekday_last{ + std::chrono::year{-32'767}, std::chrono::month{1}, std::chrono::weekday_last{std::chrono::weekday{0}}}), + SV("-32767/Jan/Sun[last]")); + + TEST_EQUAL(stream_c_locale(std::chrono::year_month_weekday_last{ + std::chrono::year{1970}, std::chrono::month{1}, std::chrono::weekday_last{std::chrono::weekday{0}}}), + SV("1970/Jan/Sun[last]")); #if defined(__APPLE__) - assert(stream_fr_FR_locale(std::chrono::year_month_weekday_last{ - std::chrono::year{-32'768}, std::chrono::month{1}, std::chrono::weekday_last{std::chrono::weekday{0}}}) == - SV("-32768 is not a valid year/jan/Dim[last]")); - assert(stream_fr_FR_locale(std::chrono::year_month_weekday_last{ - std::chrono::year{-32'767}, std::chrono::month{0}, std::chrono::weekday_last{std::chrono::weekday{0}}}) == - SV("-32767/0 is not a valid month/Dim[last]")); - assert(stream_fr_FR_locale(std::chrono::year_month_weekday_last{ - std::chrono::year{-32'767}, std::chrono::month{1}, std::chrono::weekday_last{std::chrono::weekday{8}}}) == - SV("-32767/jan/8 is not a valid weekday[last]")); - assert(stream_fr_FR_locale(std::chrono::year_month_weekday_last{ - std::chrono::year{-32'767}, std::chrono::month{1}, std::chrono::weekday_last{std::chrono::weekday{0}}}) == - SV("-32767/jan/Dim[last]")); - - assert(stream_fr_FR_locale(std::chrono::year_month_weekday_last{ - std::chrono::year{1970}, std::chrono::month{1}, std::chrono::weekday_last{std::chrono::weekday{0}}}) == - SV("1970/jan/Dim[last]")); + TEST_EQUAL( + stream_fr_FR_locale(std::chrono::year_month_weekday_last{ + std::chrono::year{-32'768}, std::chrono::month{1}, std::chrono::weekday_last{std::chrono::weekday{0}}}), + SV("-32768 is not a valid year/jan/Dim[last]")); + TEST_EQUAL( + stream_fr_FR_locale(std::chrono::year_month_weekday_last{ + std::chrono::year{-32'767}, std::chrono::month{0}, std::chrono::weekday_last{std::chrono::weekday{0}}}), + SV("-32767/0 is not a valid month/Dim[last]")); + TEST_EQUAL( + stream_fr_FR_locale(std::chrono::year_month_weekday_last{ + std::chrono::year{-32'767}, std::chrono::month{1}, std::chrono::weekday_last{std::chrono::weekday{8}}}), + SV("-32767/jan/8 is not a valid weekday[last]")); + TEST_EQUAL( + stream_fr_FR_locale(std::chrono::year_month_weekday_last{ + std::chrono::year{-32'767}, std::chrono::month{1}, std::chrono::weekday_last{std::chrono::weekday{0}}}), + SV("-32767/jan/Dim[last]")); + + TEST_EQUAL(stream_fr_FR_locale(std::chrono::year_month_weekday_last{ + std::chrono::year{1970}, std::chrono::month{1}, std::chrono::weekday_last{std::chrono::weekday{0}}}), + SV("1970/jan/Dim[last]")); #else // defined(__APPLE__) - assert(stream_fr_FR_locale(std::chrono::year_month_weekday_last{ - std::chrono::year{-32'768}, std::chrono::month{1}, std::chrono::weekday_last{std::chrono::weekday{0}}}) == - SV("-32768 is not a valid year/janv./dim.[last]")); - assert(stream_fr_FR_locale(std::chrono::year_month_weekday_last{ - std::chrono::year{-32'767}, std::chrono::month{0}, std::chrono::weekday_last{std::chrono::weekday{0}}}) == - SV("-32767/0 is not a valid month/dim.[last]")); - assert(stream_fr_FR_locale(std::chrono::year_month_weekday_last{ - std::chrono::year{-32'767}, std::chrono::month{1}, std::chrono::weekday_last{std::chrono::weekday{8}}}) == - SV("-32767/janv./8 is not a valid weekday[last]")); - assert(stream_fr_FR_locale(std::chrono::year_month_weekday_last{ - std::chrono::year{-32'767}, std::chrono::month{1}, std::chrono::weekday_last{std::chrono::weekday{0}}}) == - SV("-32767/janv./dim.[last]")); - - assert(stream_fr_FR_locale(std::chrono::year_month_weekday_last{ - std::chrono::year{1970}, std::chrono::month{1}, std::chrono::weekday_last{std::chrono::weekday{0}}}) == - SV("1970/janv./dim.[last]")); + TEST_EQUAL( + stream_fr_FR_locale(std::chrono::year_month_weekday_last{ + std::chrono::year{-32'768}, std::chrono::month{1}, std::chrono::weekday_last{std::chrono::weekday{0}}}), + SV("-32768 is not a valid year/janv./dim.[last]")); + TEST_EQUAL( + stream_fr_FR_locale(std::chrono::year_month_weekday_last{ + std::chrono::year{-32'767}, std::chrono::month{0}, std::chrono::weekday_last{std::chrono::weekday{0}}}), + SV("-32767/0 is not a valid month/dim.[last]")); + TEST_EQUAL( + stream_fr_FR_locale(std::chrono::year_month_weekday_last{ + std::chrono::year{-32'767}, std::chrono::month{1}, std::chrono::weekday_last{std::chrono::weekday{8}}}), + SV("-32767/janv./8 is not a valid weekday[last]")); + TEST_EQUAL( + stream_fr_FR_locale(std::chrono::year_month_weekday_last{ + std::chrono::year{-32'767}, std::chrono::month{1}, std::chrono::weekday_last{std::chrono::weekday{0}}}), + SV("-32767/janv./dim.[last]")); + + TEST_EQUAL(stream_fr_FR_locale(std::chrono::year_month_weekday_last{ + std::chrono::year{1970}, std::chrono::month{1}, std::chrono::weekday_last{std::chrono::weekday{0}}}), + SV("1970/janv./dim.[last]")); #endif // defined(__APPLE__) #if defined(__APPLE__) - assert(stream_ja_JP_locale(std::chrono::year_month_weekday_last{ - std::chrono::year{-32'768}, std::chrono::month{1}, std::chrono::weekday_last{std::chrono::weekday{0}}}) == - SV("-32768 is not a valid year/ 1/日[last]")); - assert(stream_ja_JP_locale(std::chrono::year_month_weekday_last{ - std::chrono::year{-32'767}, std::chrono::month{0}, std::chrono::weekday_last{std::chrono::weekday{0}}}) == - SV("-32767/0 is not a valid month/日[last]")); - assert(stream_ja_JP_locale(std::chrono::year_month_weekday_last{ - std::chrono::year{-32'767}, std::chrono::month{1}, std::chrono::weekday_last{std::chrono::weekday{8}}}) == - SV("-32767/ 1/8 is not a valid weekday[last]")); - assert(stream_ja_JP_locale(std::chrono::year_month_weekday_last{ - std::chrono::year{-32'767}, std::chrono::month{1}, std::chrono::weekday_last{std::chrono::weekday{0}}}) == - SV("-32767/ 1/日[last]")); - - assert(stream_ja_JP_locale(std::chrono::year_month_weekday_last{ - std::chrono::year{1970}, std::chrono::month{1}, std::chrono::weekday_last{std::chrono::weekday{0}}}) == - SV("1970/ 1/日[last]")); -#else // defined(__APPLE__) -# if defined(_WIN32) || defined(_AIX) - assert(stream_ja_JP_locale(std::chrono::year_month_weekday_last{ - std::chrono::year{-32'768}, std::chrono::month{1}, std::chrono::weekday_last{std::chrono::weekday{0}}}) == - SV("-32768 is not a valid year/1月/日[last]")); - assert(stream_ja_JP_locale(std::chrono::year_month_weekday_last{ - std::chrono::year{-32'767}, std::chrono::month{0}, std::chrono::weekday_last{std::chrono::weekday{0}}}) == - SV("-32767/0 is not a valid month/日[last]")); - assert(stream_ja_JP_locale(std::chrono::year_month_weekday_last{ - std::chrono::year{-32'767}, std::chrono::month{1}, std::chrono::weekday_last{std::chrono::weekday{8}}}) == - SV("-32767/1月/8 is not a valid weekday[last]")); - - assert(stream_ja_JP_locale(std::chrono::year_month_weekday_last{ - std::chrono::year{-32'767}, std::chrono::month{1}, std::chrono::weekday_last{std::chrono::weekday{0}}}) == - SV("-32767/1月/日[last]")); - - assert(stream_ja_JP_locale(std::chrono::year_month_weekday_last{ - std::chrono::year{1970}, std::chrono::month{1}, std::chrono::weekday_last{std::chrono::weekday{0}}}) == - SV("1970/1月/日[last]")); -# else // defined(_WIN32) || defined(_AIX) - assert(stream_ja_JP_locale(std::chrono::year_month_weekday_last{ - std::chrono::year{-32'768}, std::chrono::month{1}, std::chrono::weekday_last{std::chrono::weekday{0}}}) == - SV("-32768 is not a valid year/ 1月/日[last]")); - assert(stream_ja_JP_locale(std::chrono::year_month_weekday_last{ - std::chrono::year{-32'767}, std::chrono::month{0}, std::chrono::weekday_last{std::chrono::weekday{0}}}) == - SV("-32767/0 is not a valid month/日[last]")); - assert(stream_ja_JP_locale(std::chrono::year_month_weekday_last{ - std::chrono::year{-32'767}, std::chrono::month{1}, std::chrono::weekday_last{std::chrono::weekday{8}}}) == - SV("-32767/ 1月/8 is not a valid weekday[last]")); - assert(stream_ja_JP_locale(std::chrono::year_month_weekday_last{ - std::chrono::year{-32'767}, std::chrono::month{1}, std::chrono::weekday_last{std::chrono::weekday{0}}}) == - SV("-32767/ 1月/日[last]")); - - assert(stream_ja_JP_locale(std::chrono::year_month_weekday_last{ - std::chrono::year{1970}, std::chrono::month{1}, std::chrono::weekday_last{std::chrono::weekday{0}}}) == - SV("1970/ 1月/日[last]")); -# endif // defined(_WIN32) || defined(_AIX) -#endif // defined(__APPLE__) + TEST_EQUAL( + stream_ja_JP_locale(std::chrono::year_month_weekday_last{ + std::chrono::year{-32'768}, std::chrono::month{1}, std::chrono::weekday_last{std::chrono::weekday{0}}}), + SV("-32768 is not a valid year/ 1/日[last]")); + TEST_EQUAL( + stream_ja_JP_locale(std::chrono::year_month_weekday_last{ + std::chrono::year{-32'767}, std::chrono::month{0}, std::chrono::weekday_last{std::chrono::weekday{0}}}), + SV("-32767/0 is not a valid month/日[last]")); + TEST_EQUAL( + stream_ja_JP_locale(std::chrono::year_month_weekday_last{ + std::chrono::year{-32'767}, std::chrono::month{1}, std::chrono::weekday_last{std::chrono::weekday{8}}}), + SV("-32767/ 1/8 is not a valid weekday[last]")); + TEST_EQUAL( + stream_ja_JP_locale(std::chrono::year_month_weekday_last{ + std::chrono::year{-32'767}, std::chrono::month{1}, std::chrono::weekday_last{std::chrono::weekday{0}}}), + SV("-32767/ 1/日[last]")); + + TEST_EQUAL(stream_ja_JP_locale(std::chrono::year_month_weekday_last{ + std::chrono::year{1970}, std::chrono::month{1}, std::chrono::weekday_last{std::chrono::weekday{0}}}), + SV("1970/ 1/日[last]")); +#elif defined(_WIN32) // defined(__APPLE__) + TEST_EQUAL( + stream_ja_JP_locale(std::chrono::year_month_weekday_last{ + std::chrono::year{-32'768}, std::chrono::month{1}, std::chrono::weekday_last{std::chrono::weekday{0}}}), + SV("-32768 is not a valid year/1/日[last]")); + TEST_EQUAL( + stream_ja_JP_locale(std::chrono::year_month_weekday_last{ + std::chrono::year{-32'767}, std::chrono::month{0}, std::chrono::weekday_last{std::chrono::weekday{0}}}), + SV("-32767/0 is not a valid month/日[last]")); + TEST_EQUAL( + stream_ja_JP_locale(std::chrono::year_month_weekday_last{ + std::chrono::year{-32'767}, std::chrono::month{1}, std::chrono::weekday_last{std::chrono::weekday{8}}}), + SV("-32767/1/8 is not a valid weekday[last]")); + TEST_EQUAL( + stream_ja_JP_locale(std::chrono::year_month_weekday_last{ + std::chrono::year{-32'767}, std::chrono::month{1}, std::chrono::weekday_last{std::chrono::weekday{0}}}), + SV("-32767/1/日[last]")); + + TEST_EQUAL(stream_ja_JP_locale(std::chrono::year_month_weekday_last{ + std::chrono::year{1970}, std::chrono::month{1}, std::chrono::weekday_last{std::chrono::weekday{0}}}), + SV("1970/1/日[last]")); +#elif defined(_AIX) // defined(__APPLE__) + TEST_EQUAL( + stream_ja_JP_locale(std::chrono::year_month_weekday_last{ + std::chrono::year{-32'768}, std::chrono::month{1}, std::chrono::weekday_last{std::chrono::weekday{0}}}), + SV("-32768 is not a valid year/1月/日[last]")); + TEST_EQUAL( + stream_ja_JP_locale(std::chrono::year_month_weekday_last{ + std::chrono::year{-32'767}, std::chrono::month{0}, std::chrono::weekday_last{std::chrono::weekday{0}}}), + SV("-32767/0 is not a valid month/日[last]")); + TEST_EQUAL( + stream_ja_JP_locale(std::chrono::year_month_weekday_last{ + std::chrono::year{-32'767}, std::chrono::month{1}, std::chrono::weekday_last{std::chrono::weekday{8}}}), + SV("-32767/1月/8 is not a valid weekday[last]")); + + TEST_EQUAL( + stream_ja_JP_locale(std::chrono::year_month_weekday_last{ + std::chrono::year{-32'767}, std::chrono::month{1}, std::chrono::weekday_last{std::chrono::weekday{0}}}), + SV("-32767/1月/日[last]")); + + TEST_EQUAL(stream_ja_JP_locale(std::chrono::year_month_weekday_last{ + std::chrono::year{1970}, std::chrono::month{1}, std::chrono::weekday_last{std::chrono::weekday{0}}}), + SV("1970/1月/日[last]")); +#else // defined(__APPLE__) + TEST_EQUAL( + stream_ja_JP_locale(std::chrono::year_month_weekday_last{ + std::chrono::year{-32'768}, std::chrono::month{1}, std::chrono::weekday_last{std::chrono::weekday{0}}}), + SV("-32768 is not a valid year/ 1月/日[last]")); + TEST_EQUAL( + stream_ja_JP_locale(std::chrono::year_month_weekday_last{ + std::chrono::year{-32'767}, std::chrono::month{0}, std::chrono::weekday_last{std::chrono::weekday{0}}}), + SV("-32767/0 is not a valid month/日[last]")); + TEST_EQUAL( + stream_ja_JP_locale(std::chrono::year_month_weekday_last{ + std::chrono::year{-32'767}, std::chrono::month{1}, std::chrono::weekday_last{std::chrono::weekday{8}}}), + SV("-32767/ 1月/8 is not a valid weekday[last]")); + TEST_EQUAL( + stream_ja_JP_locale(std::chrono::year_month_weekday_last{ + std::chrono::year{-32'767}, std::chrono::month{1}, std::chrono::weekday_last{std::chrono::weekday{0}}}), + SV("-32767/ 1月/日[last]")); + + TEST_EQUAL(stream_ja_JP_locale(std::chrono::year_month_weekday_last{ + std::chrono::year{1970}, std::chrono::month{1}, std::chrono::weekday_last{std::chrono::weekday{0}}}), + SV("1970/ 1月/日[last]")); +#endif // defined(__APPLE__) } int main(int, char**) {