From a9bc0face598fa65b5c20844ec37e551725802d1 Mon Sep 17 00:00:00 2001 From: Artem Dergachev Date: Tue, 16 Oct 2018 02:40:42 +0000 Subject: [PATCH] Revert r344529 "Implement the first part of the calendar support for C++20" Revert r344535 "Wrap up the new chrono literals in an #ifdef..." Revert r344546 "Mark a couple of test cases as 'C++17-only'..." Some of the buildbot failures were masked by another error, and this one was probably missed. llvm-svn: 344580 --- libcxx/include/__config | 5 - libcxx/include/chrono | 1033 +---------------- libcxx/test/std/utilities/time/days.pass.cpp | 28 - .../test/std/utilities/time/months.pass.cpp | 29 - .../std/utilities/time/time.cal/euclidian.h | 40 - .../time/time.cal/nothing_to_do.pass.cpp | 12 - .../time.cal.day.members/ctor.pass.cpp | 46 - .../time.cal.day.members/decrement.pass.cpp | 52 - .../time.cal.day.members/increment.pass.cpp | 52 - .../time.cal.day.members/ok.pass.cpp | 37 - .../plus_minus_equal.pass.cpp | 57 - .../comparisons.pass.cpp | 44 - .../time.cal.day.nonmembers/literals.fail.cpp | 26 - .../time.cal.day.nonmembers/literals.pass.cpp | 47 - .../time.cal.day.nonmembers/minus.pass.cpp | 58 - .../time.cal.day.nonmembers/plus.pass.cpp | 59 - .../streaming.pass.cpp | 56 - .../time/time.cal/time.cal.day/types.pass.cpp | 26 - .../time.cal/time.cal.last/types.pass.cpp | 33 - .../time.cal.md.members/ctor.pass.cpp | 47 - .../time.cal.md.members/day.pass.cpp | 39 - .../time.cal.md.members/month.pass.cpp | 39 - .../time.cal.md.members/ok.pass.cpp | 55 - .../comparisons.pass.cpp | 70 -- .../time.cal.md.nonmembers/streaming.pass.cpp | 41 - .../time/time.cal/time.cal.md/types.pass.cpp | 26 - .../time.cal.mdlast/comparisons.pass.cpp | 43 - .../time.cal/time.cal.mdlast/ctor.pass.cpp | 41 - .../time.cal/time.cal.mdlast/month.pass.cpp | 38 - .../time/time.cal/time.cal.mdlast/ok.pass.cpp | 46 - .../time.cal.mdlast/streaming.pass.cpp | 34 - .../time.cal/time.cal.mdlast/types.pass.cpp | 27 - .../time.cal.month.members/ctor.pass.cpp | 46 - .../time.cal.month.members/decrement.pass.cpp | 53 - .../time.cal.month.members/increment.pass.cpp | 52 - .../time.cal.month.members/ok.pass.cpp | 38 - .../plus_minus_equal.pass.cpp | 67 -- .../comparisons.pass.cpp | 47 - .../literals.pass.cpp | 87 -- .../time.cal.month.nonmembers/minus.pass.cpp | 72 -- .../time.cal.month.nonmembers/plus.pass.cpp | 72 -- .../streaming.pass.cpp | 53 - .../time.cal/time.cal.month/types.pass.cpp | 26 - .../time.cal.mwd.members/ctor.pass.cpp | 46 - .../time.cal.mwd.members/month.pass.cpp | 42 - .../time.cal.mwd.members/ok.pass.cpp | 51 - .../weekday_indexed.pass.cpp | 43 - .../comparisons.pass.cpp | 86 -- .../streaming.pass.cpp | 36 - .../time/time.cal/time.cal.mwd/types.pass.cpp | 26 - .../time.cal.mwdlast.members/ctor.pass.cpp | 60 - .../time.cal.mwdlast.members/month.pass.cpp | 42 - .../time.cal.mwdlast.members/ok.pass.cpp | 52 - .../weekday_last.pass.cpp | 44 - .../comparisons.pass.cpp | 73 -- .../streaming.pass.cpp | 37 - .../time.cal/time.cal.mwdlast/types.pass.cpp | 27 - .../time.cal.operators/month_day.pass.cpp | 108 -- .../month_day_last.pass.cpp | 107 -- .../time.cal.operators/month_weekday.pass.cpp | 115 -- .../month_weekday_last.pass.cpp | 107 -- .../time.cal.operators/year_month.pass.cpp | 68 -- .../year_month_day.pass.cpp | 192 --- .../year_month_day_last.pass.cpp | 129 -- .../year_month_weekday.pass.cpp | 145 --- .../year_month_weekday_last.pass.cpp | 154 --- .../time.cal.wdidx.members/ctor.pass.cpp | 61 - .../time.cal.wdidx.members/index.pass.cpp | 38 - .../time.cal.wdidx.members/ok.pass.cpp | 49 - .../time.cal.wdidx.members/weekday.pass.cpp | 39 - .../comparisons.pass.cpp | 48 - .../streaming.pass.cpp | 36 - .../time.cal/time.cal.wdidx/types.pass.cpp | 26 - .../time.cal.wdlast.members/ctor.pass.cpp | 47 - .../time.cal.wdlast.members/ok.pass.cpp | 37 - .../time.cal.wdlast.members/weekday.pass.cpp | 33 - .../comparisons.pass.cpp | 43 - .../streaming.pass.cpp | 34 - .../time.cal/time.cal.wdlast/types.pass.cpp | 26 - .../time.cal.weekday.members/ctor.pass.cpp | 51 - .../decrement.pass.cpp | 53 - .../increment.pass.cpp | 53 - .../time.cal.weekday.members/ok.pass.cpp | 38 - .../operator[].pass.cpp | 59 - .../plus_minus_equal.pass.cpp | 63 - .../comparisons.pass.cpp | 42 - .../literals.pass.cpp | 62 - .../minus.pass.cpp | 76 -- .../time.cal.weekday.nonmembers/plus.pass.cpp | 70 -- .../streaming.pass.cpp | 56 - .../time.cal/time.cal.weekday/types.pass.cpp | 26 - .../time.cal.year.members/ctor.pass.cpp | 46 - .../time.cal.year.members/decrement.pass.cpp | 52 - .../time.cal.year.members/increment.pass.cpp | 52 - .../time.cal.year.members/is_leap.pass.cpp | 53 - .../time.cal.year.members/ok.pass.cpp | 53 - .../time.cal.year.members/plus_minus.pass.cpp | 51 - .../plus_minus_equal.pass.cpp | 57 - .../comparisons.pass.cpp | 47 - .../literals.fail.cpp | 26 - .../literals.pass.cpp | 44 - .../time.cal.year.nonmembers/minus.pass.cpp | 62 - .../time.cal.year.nonmembers/plus.pass.cpp | 59 - .../streaming.pass.cpp | 55 - .../time.cal/time.cal.year/types.pass.cpp | 26 - .../time.cal.ym.members/ctor.pass.cpp | 52 - .../time.cal.ym.members/month.pass.cpp | 39 - .../time.cal.ym.members/ok.pass.cpp | 50 - .../plus_minus_equal_month.pass.cpp | 64 - .../plus_minus_equal_year.pass.cpp | 65 -- .../time.cal.ym.members/year.pass.cpp | 39 - .../comparisons.pass.cpp | 69 -- .../time.cal.ym.nonmembers/minus.pass.cpp | 90 -- .../time.cal.ym.nonmembers/plus.pass.cpp | 106 -- .../time.cal.ym.nonmembers/streaming.pass.cpp | 57 - .../time/time.cal/time.cal.ym/types.pass.cpp | 26 - .../ctor.local_days.pass.cpp | 44 - .../time.cal.ymd.members/ctor.pass.cpp | 56 - .../ctor.sys_days.pass.cpp | 44 - .../ctor.year_month_day_last.pass.cpp | 42 - .../time.cal.ymd.members/day.pass.cpp | 40 - .../time.cal.ymd.members/month.pass.cpp | 40 - .../time.cal.ymd.members/ok.pass.cpp | 65 -- .../plus_minus_equal_month.pass.cpp | 70 -- .../plus_minus_equal_year.pass.cpp | 70 -- .../time.cal.ymd.members/year.pass.cpp | 40 - .../comparisons.pass.cpp | 118 -- .../time.cal.ymd.nonmembers/minus.pass.cpp | 60 - .../time.cal.ymd.nonmembers/plus.pass.cpp | 112 -- .../streaming.pass.cpp | 58 - .../time/time.cal/time.cal.ymd/types.pass.cpp | 26 - .../time.cal.ymdlast.members/ctor.pass.cpp | 54 - .../time.cal.ymdlast.members/day.pass.cpp | 43 - .../time.cal.ymdlast.members/month.pass.cpp | 39 - .../month_day_last.pass.cpp | 39 - .../time.cal.ymdlast.members/ok.pass.cpp | 53 - .../op_local_days.pass.cpp | 36 - .../op_sys_days.pass.cpp | 36 - .../plus_minus_equal_month.pass.cpp | 67 -- .../plus_minus_equal_year.pass.cpp | 66 -- .../time.cal.ymdlast.members/year.pass.cpp | 39 - .../comparisons.pass.cpp | 88 -- .../minus.pass.cpp | 92 -- .../time.cal.ymdlast.nonmembers/plus.pass.cpp | 123 -- .../streaming.pass.cpp | 37 - .../ctor.local_days.pass.cpp | 44 - .../time.cal.ymwd.members/ctor.pass.cpp | 65 -- .../ctor.sys_days.pass.cpp | 43 - .../ctor.year_month_day_last.pass.cpp | 41 - .../time.cal.ymwd.members/index.pass.cpp | 42 - .../time.cal.ymwd.members/month.pass.cpp | 42 - .../time.cal.ymwd.members/ok.pass.cpp | 76 -- .../plus_minus_equal_month.pass.cpp | 82 -- .../plus_minus_equal_year.pass.cpp | 82 -- .../time.cal.ymwd.members/weekday.pass.cpp | 42 - .../weekday_indexed.pass.cpp | 46 - .../time.cal.ymwd.members/year.pass.cpp | 42 - .../comparisons.pass.cpp | 114 -- .../time.cal.ymwd.nonmembers/minus.pass.cpp | 101 -- .../time.cal.ymwd.nonmembers/plus.pass.cpp | 121 -- .../streaming.pass.cpp | 57 - .../time.cal/time.cal.ymwd/types.pass.cpp | 26 - .../time.cal.ymwdlast.members/ctor.pass.cpp | 52 - .../time.cal.ymwdlast.members/month.pass.cpp | 41 - .../time.cal.ymwdlast.members/ok.pass.cpp | 73 -- .../op_local_days.pass.cpp | 35 - .../op_sys_days.pass.cpp | 36 - .../plus_minus_equal_month.pass.cpp | 75 -- .../plus_minus_equal_year.pass.cpp | 76 -- .../weekday.pass.cpp | 41 - .../time.cal.ymwdlast.members/year.pass.cpp | 41 - .../comparisons.pass.cpp | 114 -- .../minus.pass.cpp | 93 -- .../plus.pass.cpp | 116 -- .../streaming.pass.cpp | 38 - .../time.cal/time.cal.ymwdlast/types.pass.cpp | 26 - .../time.duration.literals/literals.pass.cpp | 55 - .../time.duration.literals/literals1.pass.cpp | 27 - .../time.duration.literals/literals2.pass.cpp | 6 - libcxx/test/std/utilities/time/weeks.pass.cpp | 28 - libcxx/test/std/utilities/time/years.pass.cpp | 28 - .../variant.status/index.pass.cpp | 4 +- .../valueless_by_exception.pass.cpp | 4 +- 183 files changed, 3 insertions(+), 10964 deletions(-) delete mode 100644 libcxx/test/std/utilities/time/days.pass.cpp delete mode 100644 libcxx/test/std/utilities/time/months.pass.cpp delete mode 100644 libcxx/test/std/utilities/time/time.cal/euclidian.h delete mode 100644 libcxx/test/std/utilities/time/time.cal/nothing_to_do.pass.cpp delete mode 100644 libcxx/test/std/utilities/time/time.cal/time.cal.day/time.cal.day.members/ctor.pass.cpp delete mode 100644 libcxx/test/std/utilities/time/time.cal/time.cal.day/time.cal.day.members/decrement.pass.cpp delete mode 100644 libcxx/test/std/utilities/time/time.cal/time.cal.day/time.cal.day.members/increment.pass.cpp delete mode 100644 libcxx/test/std/utilities/time/time.cal/time.cal.day/time.cal.day.members/ok.pass.cpp delete mode 100644 libcxx/test/std/utilities/time/time.cal/time.cal.day/time.cal.day.members/plus_minus_equal.pass.cpp delete mode 100644 libcxx/test/std/utilities/time/time.cal/time.cal.day/time.cal.day.nonmembers/comparisons.pass.cpp delete mode 100644 libcxx/test/std/utilities/time/time.cal/time.cal.day/time.cal.day.nonmembers/literals.fail.cpp delete mode 100644 libcxx/test/std/utilities/time/time.cal/time.cal.day/time.cal.day.nonmembers/literals.pass.cpp delete mode 100644 libcxx/test/std/utilities/time/time.cal/time.cal.day/time.cal.day.nonmembers/minus.pass.cpp delete mode 100644 libcxx/test/std/utilities/time/time.cal/time.cal.day/time.cal.day.nonmembers/plus.pass.cpp delete mode 100644 libcxx/test/std/utilities/time/time.cal/time.cal.day/time.cal.day.nonmembers/streaming.pass.cpp delete mode 100644 libcxx/test/std/utilities/time/time.cal/time.cal.day/types.pass.cpp delete mode 100644 libcxx/test/std/utilities/time/time.cal/time.cal.last/types.pass.cpp delete mode 100644 libcxx/test/std/utilities/time/time.cal/time.cal.md/time.cal.md.members/ctor.pass.cpp delete mode 100644 libcxx/test/std/utilities/time/time.cal/time.cal.md/time.cal.md.members/day.pass.cpp delete mode 100644 libcxx/test/std/utilities/time/time.cal/time.cal.md/time.cal.md.members/month.pass.cpp delete mode 100644 libcxx/test/std/utilities/time/time.cal/time.cal.md/time.cal.md.members/ok.pass.cpp delete mode 100644 libcxx/test/std/utilities/time/time.cal/time.cal.md/time.cal.md.nonmembers/comparisons.pass.cpp delete mode 100644 libcxx/test/std/utilities/time/time.cal/time.cal.md/time.cal.md.nonmembers/streaming.pass.cpp delete mode 100644 libcxx/test/std/utilities/time/time.cal/time.cal.md/types.pass.cpp delete mode 100644 libcxx/test/std/utilities/time/time.cal/time.cal.mdlast/comparisons.pass.cpp delete mode 100644 libcxx/test/std/utilities/time/time.cal/time.cal.mdlast/ctor.pass.cpp delete mode 100644 libcxx/test/std/utilities/time/time.cal/time.cal.mdlast/month.pass.cpp delete mode 100644 libcxx/test/std/utilities/time/time.cal/time.cal.mdlast/ok.pass.cpp delete mode 100644 libcxx/test/std/utilities/time/time.cal/time.cal.mdlast/streaming.pass.cpp delete mode 100644 libcxx/test/std/utilities/time/time.cal/time.cal.mdlast/types.pass.cpp delete mode 100644 libcxx/test/std/utilities/time/time.cal/time.cal.month/time.cal.month.members/ctor.pass.cpp delete mode 100644 libcxx/test/std/utilities/time/time.cal/time.cal.month/time.cal.month.members/decrement.pass.cpp delete mode 100644 libcxx/test/std/utilities/time/time.cal/time.cal.month/time.cal.month.members/increment.pass.cpp delete mode 100644 libcxx/test/std/utilities/time/time.cal/time.cal.month/time.cal.month.members/ok.pass.cpp delete mode 100644 libcxx/test/std/utilities/time/time.cal/time.cal.month/time.cal.month.members/plus_minus_equal.pass.cpp delete mode 100644 libcxx/test/std/utilities/time/time.cal/time.cal.month/time.cal.month.nonmembers/comparisons.pass.cpp delete mode 100644 libcxx/test/std/utilities/time/time.cal/time.cal.month/time.cal.month.nonmembers/literals.pass.cpp delete mode 100644 libcxx/test/std/utilities/time/time.cal/time.cal.month/time.cal.month.nonmembers/minus.pass.cpp delete mode 100644 libcxx/test/std/utilities/time/time.cal/time.cal.month/time.cal.month.nonmembers/plus.pass.cpp delete mode 100644 libcxx/test/std/utilities/time/time.cal/time.cal.month/time.cal.month.nonmembers/streaming.pass.cpp delete mode 100644 libcxx/test/std/utilities/time/time.cal/time.cal.month/types.pass.cpp delete mode 100644 libcxx/test/std/utilities/time/time.cal/time.cal.mwd/time.cal.mwd.members/ctor.pass.cpp delete mode 100644 libcxx/test/std/utilities/time/time.cal/time.cal.mwd/time.cal.mwd.members/month.pass.cpp delete mode 100644 libcxx/test/std/utilities/time/time.cal/time.cal.mwd/time.cal.mwd.members/ok.pass.cpp delete mode 100644 libcxx/test/std/utilities/time/time.cal/time.cal.mwd/time.cal.mwd.members/weekday_indexed.pass.cpp delete mode 100644 libcxx/test/std/utilities/time/time.cal/time.cal.mwd/time.cal.mwd.nonmembers/comparisons.pass.cpp delete mode 100644 libcxx/test/std/utilities/time/time.cal/time.cal.mwd/time.cal.mwd.nonmembers/streaming.pass.cpp delete mode 100644 libcxx/test/std/utilities/time/time.cal/time.cal.mwd/types.pass.cpp delete mode 100644 libcxx/test/std/utilities/time/time.cal/time.cal.mwdlast/time.cal.mwdlast.members/ctor.pass.cpp delete mode 100644 libcxx/test/std/utilities/time/time.cal/time.cal.mwdlast/time.cal.mwdlast.members/month.pass.cpp delete mode 100644 libcxx/test/std/utilities/time/time.cal/time.cal.mwdlast/time.cal.mwdlast.members/ok.pass.cpp delete mode 100644 libcxx/test/std/utilities/time/time.cal/time.cal.mwdlast/time.cal.mwdlast.members/weekday_last.pass.cpp delete mode 100644 libcxx/test/std/utilities/time/time.cal/time.cal.mwdlast/time.cal.mwdlast.nonmembers/comparisons.pass.cpp delete mode 100644 libcxx/test/std/utilities/time/time.cal/time.cal.mwdlast/time.cal.mwdlast.nonmembers/streaming.pass.cpp delete mode 100644 libcxx/test/std/utilities/time/time.cal/time.cal.mwdlast/types.pass.cpp delete mode 100644 libcxx/test/std/utilities/time/time.cal/time.cal.operators/month_day.pass.cpp delete mode 100644 libcxx/test/std/utilities/time/time.cal/time.cal.operators/month_day_last.pass.cpp delete mode 100644 libcxx/test/std/utilities/time/time.cal/time.cal.operators/month_weekday.pass.cpp delete mode 100644 libcxx/test/std/utilities/time/time.cal/time.cal.operators/month_weekday_last.pass.cpp delete mode 100644 libcxx/test/std/utilities/time/time.cal/time.cal.operators/year_month.pass.cpp delete mode 100644 libcxx/test/std/utilities/time/time.cal/time.cal.operators/year_month_day.pass.cpp delete mode 100644 libcxx/test/std/utilities/time/time.cal/time.cal.operators/year_month_day_last.pass.cpp delete mode 100644 libcxx/test/std/utilities/time/time.cal/time.cal.operators/year_month_weekday.pass.cpp delete mode 100644 libcxx/test/std/utilities/time/time.cal/time.cal.operators/year_month_weekday_last.pass.cpp delete mode 100644 libcxx/test/std/utilities/time/time.cal/time.cal.wdidx/time.cal.wdidx.members/ctor.pass.cpp delete mode 100644 libcxx/test/std/utilities/time/time.cal/time.cal.wdidx/time.cal.wdidx.members/index.pass.cpp delete mode 100644 libcxx/test/std/utilities/time/time.cal/time.cal.wdidx/time.cal.wdidx.members/ok.pass.cpp delete mode 100644 libcxx/test/std/utilities/time/time.cal/time.cal.wdidx/time.cal.wdidx.members/weekday.pass.cpp delete mode 100644 libcxx/test/std/utilities/time/time.cal/time.cal.wdidx/time.cal.wdidx.nonmembers/comparisons.pass.cpp delete mode 100644 libcxx/test/std/utilities/time/time.cal/time.cal.wdidx/time.cal.wdidx.nonmembers/streaming.pass.cpp delete mode 100644 libcxx/test/std/utilities/time/time.cal/time.cal.wdidx/types.pass.cpp delete mode 100644 libcxx/test/std/utilities/time/time.cal/time.cal.wdlast/time.cal.wdlast.members/ctor.pass.cpp delete mode 100644 libcxx/test/std/utilities/time/time.cal/time.cal.wdlast/time.cal.wdlast.members/ok.pass.cpp delete mode 100644 libcxx/test/std/utilities/time/time.cal/time.cal.wdlast/time.cal.wdlast.members/weekday.pass.cpp delete mode 100644 libcxx/test/std/utilities/time/time.cal/time.cal.wdlast/time.cal.wdlast.nonmembers/comparisons.pass.cpp delete mode 100644 libcxx/test/std/utilities/time/time.cal/time.cal.wdlast/time.cal.wdlast.nonmembers/streaming.pass.cpp delete mode 100644 libcxx/test/std/utilities/time/time.cal/time.cal.wdlast/types.pass.cpp delete mode 100644 libcxx/test/std/utilities/time/time.cal/time.cal.weekday/time.cal.weekday.members/ctor.pass.cpp delete mode 100644 libcxx/test/std/utilities/time/time.cal/time.cal.weekday/time.cal.weekday.members/decrement.pass.cpp delete mode 100644 libcxx/test/std/utilities/time/time.cal/time.cal.weekday/time.cal.weekday.members/increment.pass.cpp delete mode 100644 libcxx/test/std/utilities/time/time.cal/time.cal.weekday/time.cal.weekday.members/ok.pass.cpp delete mode 100644 libcxx/test/std/utilities/time/time.cal/time.cal.weekday/time.cal.weekday.members/operator[].pass.cpp delete mode 100644 libcxx/test/std/utilities/time/time.cal/time.cal.weekday/time.cal.weekday.members/plus_minus_equal.pass.cpp delete mode 100644 libcxx/test/std/utilities/time/time.cal/time.cal.weekday/time.cal.weekday.nonmembers/comparisons.pass.cpp delete mode 100644 libcxx/test/std/utilities/time/time.cal/time.cal.weekday/time.cal.weekday.nonmembers/literals.pass.cpp delete mode 100644 libcxx/test/std/utilities/time/time.cal/time.cal.weekday/time.cal.weekday.nonmembers/minus.pass.cpp delete mode 100644 libcxx/test/std/utilities/time/time.cal/time.cal.weekday/time.cal.weekday.nonmembers/plus.pass.cpp delete mode 100644 libcxx/test/std/utilities/time/time.cal/time.cal.weekday/time.cal.weekday.nonmembers/streaming.pass.cpp delete mode 100644 libcxx/test/std/utilities/time/time.cal/time.cal.weekday/types.pass.cpp delete mode 100644 libcxx/test/std/utilities/time/time.cal/time.cal.year/time.cal.year.members/ctor.pass.cpp delete mode 100644 libcxx/test/std/utilities/time/time.cal/time.cal.year/time.cal.year.members/decrement.pass.cpp delete mode 100644 libcxx/test/std/utilities/time/time.cal/time.cal.year/time.cal.year.members/increment.pass.cpp delete mode 100644 libcxx/test/std/utilities/time/time.cal/time.cal.year/time.cal.year.members/is_leap.pass.cpp delete mode 100644 libcxx/test/std/utilities/time/time.cal/time.cal.year/time.cal.year.members/ok.pass.cpp delete mode 100644 libcxx/test/std/utilities/time/time.cal/time.cal.year/time.cal.year.members/plus_minus.pass.cpp delete mode 100644 libcxx/test/std/utilities/time/time.cal/time.cal.year/time.cal.year.members/plus_minus_equal.pass.cpp delete mode 100644 libcxx/test/std/utilities/time/time.cal/time.cal.year/time.cal.year.nonmembers/comparisons.pass.cpp delete mode 100644 libcxx/test/std/utilities/time/time.cal/time.cal.year/time.cal.year.nonmembers/literals.fail.cpp delete mode 100644 libcxx/test/std/utilities/time/time.cal/time.cal.year/time.cal.year.nonmembers/literals.pass.cpp delete mode 100644 libcxx/test/std/utilities/time/time.cal/time.cal.year/time.cal.year.nonmembers/minus.pass.cpp delete mode 100644 libcxx/test/std/utilities/time/time.cal/time.cal.year/time.cal.year.nonmembers/plus.pass.cpp delete mode 100644 libcxx/test/std/utilities/time/time.cal/time.cal.year/time.cal.year.nonmembers/streaming.pass.cpp delete mode 100644 libcxx/test/std/utilities/time/time.cal/time.cal.year/types.pass.cpp delete mode 100644 libcxx/test/std/utilities/time/time.cal/time.cal.ym/time.cal.ym.members/ctor.pass.cpp delete mode 100644 libcxx/test/std/utilities/time/time.cal/time.cal.ym/time.cal.ym.members/month.pass.cpp delete mode 100644 libcxx/test/std/utilities/time/time.cal/time.cal.ym/time.cal.ym.members/ok.pass.cpp delete mode 100644 libcxx/test/std/utilities/time/time.cal/time.cal.ym/time.cal.ym.members/plus_minus_equal_month.pass.cpp delete mode 100644 libcxx/test/std/utilities/time/time.cal/time.cal.ym/time.cal.ym.members/plus_minus_equal_year.pass.cpp delete mode 100644 libcxx/test/std/utilities/time/time.cal/time.cal.ym/time.cal.ym.members/year.pass.cpp delete mode 100644 libcxx/test/std/utilities/time/time.cal/time.cal.ym/time.cal.ym.nonmembers/comparisons.pass.cpp delete mode 100644 libcxx/test/std/utilities/time/time.cal/time.cal.ym/time.cal.ym.nonmembers/minus.pass.cpp delete mode 100644 libcxx/test/std/utilities/time/time.cal/time.cal.ym/time.cal.ym.nonmembers/plus.pass.cpp delete mode 100644 libcxx/test/std/utilities/time/time.cal/time.cal.ym/time.cal.ym.nonmembers/streaming.pass.cpp delete mode 100644 libcxx/test/std/utilities/time/time.cal/time.cal.ym/types.pass.cpp delete mode 100644 libcxx/test/std/utilities/time/time.cal/time.cal.ymd/time.cal.ymd.members/ctor.local_days.pass.cpp delete mode 100644 libcxx/test/std/utilities/time/time.cal/time.cal.ymd/time.cal.ymd.members/ctor.pass.cpp delete mode 100644 libcxx/test/std/utilities/time/time.cal/time.cal.ymd/time.cal.ymd.members/ctor.sys_days.pass.cpp delete mode 100644 libcxx/test/std/utilities/time/time.cal/time.cal.ymd/time.cal.ymd.members/ctor.year_month_day_last.pass.cpp delete mode 100644 libcxx/test/std/utilities/time/time.cal/time.cal.ymd/time.cal.ymd.members/day.pass.cpp delete mode 100644 libcxx/test/std/utilities/time/time.cal/time.cal.ymd/time.cal.ymd.members/month.pass.cpp delete mode 100644 libcxx/test/std/utilities/time/time.cal/time.cal.ymd/time.cal.ymd.members/ok.pass.cpp delete mode 100644 libcxx/test/std/utilities/time/time.cal/time.cal.ymd/time.cal.ymd.members/plus_minus_equal_month.pass.cpp delete mode 100644 libcxx/test/std/utilities/time/time.cal/time.cal.ymd/time.cal.ymd.members/plus_minus_equal_year.pass.cpp delete mode 100644 libcxx/test/std/utilities/time/time.cal/time.cal.ymd/time.cal.ymd.members/year.pass.cpp delete mode 100644 libcxx/test/std/utilities/time/time.cal/time.cal.ymd/time.cal.ymd.nonmembers/comparisons.pass.cpp delete mode 100644 libcxx/test/std/utilities/time/time.cal/time.cal.ymd/time.cal.ymd.nonmembers/minus.pass.cpp delete mode 100644 libcxx/test/std/utilities/time/time.cal/time.cal.ymd/time.cal.ymd.nonmembers/plus.pass.cpp delete mode 100644 libcxx/test/std/utilities/time/time.cal/time.cal.ymd/time.cal.ymd.nonmembers/streaming.pass.cpp delete mode 100644 libcxx/test/std/utilities/time/time.cal/time.cal.ymd/types.pass.cpp delete mode 100644 libcxx/test/std/utilities/time/time.cal/time.cal.ymdlast/time.cal.ymdlast.members/ctor.pass.cpp delete mode 100644 libcxx/test/std/utilities/time/time.cal/time.cal.ymdlast/time.cal.ymdlast.members/day.pass.cpp delete mode 100644 libcxx/test/std/utilities/time/time.cal/time.cal.ymdlast/time.cal.ymdlast.members/month.pass.cpp delete mode 100644 libcxx/test/std/utilities/time/time.cal/time.cal.ymdlast/time.cal.ymdlast.members/month_day_last.pass.cpp delete mode 100644 libcxx/test/std/utilities/time/time.cal/time.cal.ymdlast/time.cal.ymdlast.members/ok.pass.cpp delete mode 100644 libcxx/test/std/utilities/time/time.cal/time.cal.ymdlast/time.cal.ymdlast.members/op_local_days.pass.cpp delete mode 100644 libcxx/test/std/utilities/time/time.cal/time.cal.ymdlast/time.cal.ymdlast.members/op_sys_days.pass.cpp delete mode 100644 libcxx/test/std/utilities/time/time.cal/time.cal.ymdlast/time.cal.ymdlast.members/plus_minus_equal_month.pass.cpp delete mode 100644 libcxx/test/std/utilities/time/time.cal/time.cal.ymdlast/time.cal.ymdlast.members/plus_minus_equal_year.pass.cpp delete mode 100644 libcxx/test/std/utilities/time/time.cal/time.cal.ymdlast/time.cal.ymdlast.members/year.pass.cpp delete mode 100644 libcxx/test/std/utilities/time/time.cal/time.cal.ymdlast/time.cal.ymdlast.nonmembers/comparisons.pass.cpp delete mode 100644 libcxx/test/std/utilities/time/time.cal/time.cal.ymdlast/time.cal.ymdlast.nonmembers/minus.pass.cpp delete mode 100644 libcxx/test/std/utilities/time/time.cal/time.cal.ymdlast/time.cal.ymdlast.nonmembers/plus.pass.cpp delete mode 100644 libcxx/test/std/utilities/time/time.cal/time.cal.ymdlast/time.cal.ymdlast.nonmembers/streaming.pass.cpp delete mode 100644 libcxx/test/std/utilities/time/time.cal/time.cal.ymwd/time.cal.ymwd.members/ctor.local_days.pass.cpp delete mode 100644 libcxx/test/std/utilities/time/time.cal/time.cal.ymwd/time.cal.ymwd.members/ctor.pass.cpp delete mode 100644 libcxx/test/std/utilities/time/time.cal/time.cal.ymwd/time.cal.ymwd.members/ctor.sys_days.pass.cpp delete mode 100644 libcxx/test/std/utilities/time/time.cal/time.cal.ymwd/time.cal.ymwd.members/ctor.year_month_day_last.pass.cpp delete mode 100644 libcxx/test/std/utilities/time/time.cal/time.cal.ymwd/time.cal.ymwd.members/index.pass.cpp delete mode 100644 libcxx/test/std/utilities/time/time.cal/time.cal.ymwd/time.cal.ymwd.members/month.pass.cpp delete mode 100644 libcxx/test/std/utilities/time/time.cal/time.cal.ymwd/time.cal.ymwd.members/ok.pass.cpp delete mode 100644 libcxx/test/std/utilities/time/time.cal/time.cal.ymwd/time.cal.ymwd.members/plus_minus_equal_month.pass.cpp delete mode 100644 libcxx/test/std/utilities/time/time.cal/time.cal.ymwd/time.cal.ymwd.members/plus_minus_equal_year.pass.cpp delete mode 100644 libcxx/test/std/utilities/time/time.cal/time.cal.ymwd/time.cal.ymwd.members/weekday.pass.cpp delete mode 100644 libcxx/test/std/utilities/time/time.cal/time.cal.ymwd/time.cal.ymwd.members/weekday_indexed.pass.cpp delete mode 100644 libcxx/test/std/utilities/time/time.cal/time.cal.ymwd/time.cal.ymwd.members/year.pass.cpp delete mode 100644 libcxx/test/std/utilities/time/time.cal/time.cal.ymwd/time.cal.ymwd.nonmembers/comparisons.pass.cpp delete mode 100644 libcxx/test/std/utilities/time/time.cal/time.cal.ymwd/time.cal.ymwd.nonmembers/minus.pass.cpp delete mode 100644 libcxx/test/std/utilities/time/time.cal/time.cal.ymwd/time.cal.ymwd.nonmembers/plus.pass.cpp delete mode 100644 libcxx/test/std/utilities/time/time.cal/time.cal.ymwd/time.cal.ymwd.nonmembers/streaming.pass.cpp delete mode 100644 libcxx/test/std/utilities/time/time.cal/time.cal.ymwd/types.pass.cpp delete mode 100644 libcxx/test/std/utilities/time/time.cal/time.cal.ymwdlast/time.cal.ymwdlast.members/ctor.pass.cpp delete mode 100644 libcxx/test/std/utilities/time/time.cal/time.cal.ymwdlast/time.cal.ymwdlast.members/month.pass.cpp delete mode 100644 libcxx/test/std/utilities/time/time.cal/time.cal.ymwdlast/time.cal.ymwdlast.members/ok.pass.cpp delete mode 100644 libcxx/test/std/utilities/time/time.cal/time.cal.ymwdlast/time.cal.ymwdlast.members/op_local_days.pass.cpp delete mode 100644 libcxx/test/std/utilities/time/time.cal/time.cal.ymwdlast/time.cal.ymwdlast.members/op_sys_days.pass.cpp delete mode 100644 libcxx/test/std/utilities/time/time.cal/time.cal.ymwdlast/time.cal.ymwdlast.members/plus_minus_equal_month.pass.cpp delete mode 100644 libcxx/test/std/utilities/time/time.cal/time.cal.ymwdlast/time.cal.ymwdlast.members/plus_minus_equal_year.pass.cpp delete mode 100644 libcxx/test/std/utilities/time/time.cal/time.cal.ymwdlast/time.cal.ymwdlast.members/weekday.pass.cpp delete mode 100644 libcxx/test/std/utilities/time/time.cal/time.cal.ymwdlast/time.cal.ymwdlast.members/year.pass.cpp delete mode 100644 libcxx/test/std/utilities/time/time.cal/time.cal.ymwdlast/time.cal.ymwdlast.nonmembers/comparisons.pass.cpp delete mode 100644 libcxx/test/std/utilities/time/time.cal/time.cal.ymwdlast/time.cal.ymwdlast.nonmembers/minus.pass.cpp delete mode 100644 libcxx/test/std/utilities/time/time.cal/time.cal.ymwdlast/time.cal.ymwdlast.nonmembers/plus.pass.cpp delete mode 100644 libcxx/test/std/utilities/time/time.cal/time.cal.ymwdlast/time.cal.ymwdlast.nonmembers/streaming.pass.cpp delete mode 100644 libcxx/test/std/utilities/time/time.cal/time.cal.ymwdlast/types.pass.cpp delete mode 100644 libcxx/test/std/utilities/time/weeks.pass.cpp delete mode 100644 libcxx/test/std/utilities/time/years.pass.cpp diff --git a/libcxx/include/__config b/libcxx/include/__config index 7e47f44790c7..14ecb8fb426b 100644 --- a/libcxx/include/__config +++ b/libcxx/include/__config @@ -492,11 +492,6 @@ namespace std { #define _LIBCPP_ALWAYS_INLINE __attribute__ ((__always_inline__)) -// No apple compilers support ""d and ""y at this time. -#if _LIBCPP_CLANG_VER < 800 || defined(__apple_build_version__) -#define _LIBCPP_HAS_NO_CXX20_CHRONO_LITERALS -#endif - #elif defined(_LIBCPP_COMPILER_GCC) #define _ALIGNAS(x) __attribute__((__aligned__(x))) diff --git a/libcxx/include/chrono b/libcxx/include/chrono index 75258abd26b9..0691101010fb 100644 --- a/libcxx/include/chrono +++ b/libcxx/include/chrono @@ -748,7 +748,6 @@ unspecified parse(const basic_string& format, Parsable& tp, basic_string& abbrev, minutes& offset); -// calendrical constants inline constexpr last_spec last{}; // C++20 inline constexpr chrono::weekday Sunday{0}; // C++20 inline constexpr chrono::weekday Monday{1}; // C++20 @@ -1092,12 +1091,7 @@ typedef duration milliseconds; typedef duration seconds; typedef duration< long, ratio< 60> > minutes; typedef duration< long, ratio<3600> > hours; -#if _LIBCPP_STD_VER > 17 -typedef duration< int, ratio_multiply, hours::period>> days; -typedef duration< int, ratio_multiply, days::period>> weeks; -typedef duration< int, ratio_multiply, days::period>> years; -typedef duration< int, ratio_divide>> months; -#endif + // Duration == template @@ -1580,1020 +1574,6 @@ typedef steady_clock high_resolution_clock; typedef system_clock high_resolution_clock; #endif -#if _LIBCPP_STD_VER > 17 - -struct _LIBCPP_TYPE_VIS last_spec { explicit last_spec() = default; }; - - -class _LIBCPP_TYPE_VIS day { -private: - unsigned char __d; -public: - day() = default; - explicit inline constexpr day(unsigned __val) noexcept : __d(static_cast(__val)) {} - inline constexpr day& operator++() noexcept { ++__d; return *this; } - inline constexpr day operator++(int) noexcept { day __tmp = *this; ++(*this); return __tmp; } - inline constexpr day& operator--() noexcept { --__d; return *this; } - inline constexpr day operator--(int) noexcept { day __tmp = *this; --(*this); return __tmp; } - constexpr day& operator+=(const days& __dd) noexcept; - constexpr day& operator-=(const days& __dd) noexcept; - explicit inline constexpr operator unsigned() const noexcept { return __d; } - inline constexpr bool ok() const noexcept { return __d >= 1 && __d <= 31; } - }; - - -inline constexpr -bool operator==(const day& __lhs, const day& __rhs) noexcept -{ return static_cast(__lhs) == static_cast(__rhs); } - -inline constexpr -bool operator!=(const day& __lhs, const day& __rhs) noexcept -{ return !(__lhs == __rhs); } - -inline constexpr -bool operator< (const day& __lhs, const day& __rhs) noexcept -{ return static_cast(__lhs) < static_cast(__rhs); } - -inline constexpr -bool operator> (const day& __lhs, const day& __rhs) noexcept -{ return __rhs < __lhs; } - -inline constexpr -bool operator<=(const day& __lhs, const day& __rhs) noexcept -{ return !(__rhs < __lhs);} - -inline constexpr -bool operator>=(const day& __lhs, const day& __rhs) noexcept -{ return !(__lhs < __rhs); } - -inline constexpr -day operator+ (const day& __lhs, const days& __rhs) noexcept -{ return day(static_cast(__lhs) + __rhs.count()); } - -inline constexpr -day operator+ (const days& __lhs, const day& __rhs) noexcept -{ return __rhs + __lhs; } - -inline constexpr -day operator- (const day& __lhs, const days& __rhs) noexcept -{ return __lhs + -__rhs; } - -inline constexpr -days operator-(const day& __lhs, const day& __rhs) noexcept -{ return days(static_cast(static_cast(__lhs)) - - static_cast(static_cast(__rhs))); } - -inline constexpr day& day::operator+=(const days& __dd) noexcept -{ *this = *this + __dd; return *this; } - -inline constexpr day& day::operator-=(const days& __dd) noexcept -{ *this = *this - __dd; return *this; } - - -class _LIBCPP_TYPE_VIS month { -private: - unsigned char __m; -public: - month() = default; - explicit inline constexpr month(unsigned __val) noexcept : __m(static_cast(__val)) {} - inline constexpr month& operator++() noexcept { ++__m; return *this; } - inline constexpr month operator++(int) noexcept { month __tmp = *this; ++(*this); return __tmp; } - inline constexpr month& operator--() noexcept { --__m; return *this; } - inline constexpr month operator--(int) noexcept { month __tmp = *this; --(*this); return __tmp; } - constexpr month& operator+=(const months& __m1) noexcept; - constexpr month& operator-=(const months& __m1) noexcept; - explicit inline constexpr operator unsigned() const noexcept { return __m; } - inline constexpr bool ok() const noexcept { return __m >= 1 && __m <= 12; } -}; - - -inline constexpr -bool operator==(const month& __lhs, const month& __rhs) noexcept -{ return static_cast(__lhs) == static_cast(__rhs); } - -inline constexpr -bool operator!=(const month& __lhs, const month& __rhs) noexcept -{ return !(__lhs == __rhs); } - -inline constexpr -bool operator< (const month& __lhs, const month& __rhs) noexcept -{ return static_cast(__lhs) < static_cast(__rhs); } - -inline constexpr -bool operator> (const month& __lhs, const month& __rhs) noexcept -{ return __rhs < __lhs; } - -inline constexpr -bool operator<=(const month& __lhs, const month& __rhs) noexcept -{ return !(__rhs < __lhs); } - -inline constexpr -bool operator>=(const month& __lhs, const month& __rhs) noexcept -{ return !(__lhs < __rhs); } - -inline constexpr -month operator+ (const month& __lhs, const months& __rhs) noexcept -{ - auto const __mu = static_cast(static_cast(__lhs)) + (__rhs.count() - 1); - auto const __yr = (__mu >= 0 ? __mu : __mu - 11) / 12; - return month{static_cast(__mu - __yr * 12 + 1)}; -} - -inline constexpr -month operator+ (const months& __lhs, const month& __rhs) noexcept -{ return __rhs + __lhs; } - -inline constexpr -month operator- (const month& __lhs, const months& __rhs) noexcept -{ return __lhs + -__rhs; } - -inline constexpr -months operator-(const month& __lhs, const month& __rhs) noexcept -{ - auto const __dm = static_cast(__lhs) - static_cast(__rhs); - return months(__dm <= 11 ? __dm : __dm + 12); -} - -inline constexpr month& month::operator+=(const months& __dm) noexcept -{ *this = *this + __dm; return *this; } - -inline constexpr month& month::operator-=(const months& __dm) noexcept -{ *this = *this - __dm; return *this; } - - -class _LIBCPP_TYPE_VIS year { -private: - short __y; -public: - year() = default; - explicit inline constexpr year(int __val) noexcept : __y(static_cast(__val)) {} - - inline constexpr year& operator++() noexcept { ++__y; return *this; }; - inline constexpr year operator++(int) noexcept { year __tmp = *this; ++(*this); return __tmp; }; - inline constexpr year& operator--() noexcept { --__y; return *this; }; - inline constexpr year operator--(int) noexcept { year __tmp = *this; --(*this); return __tmp; }; - constexpr year& operator+=(const years& __dy) noexcept; - constexpr year& operator-=(const years& __dy) noexcept; - inline constexpr year operator+() const noexcept { return *this; } - inline constexpr year operator-() const noexcept { return year{-__y}; }; - - inline constexpr bool is_leap() const noexcept { return __y % 4 == 0 && (__y % 100 != 0 || __y % 400 == 0); } - explicit inline constexpr operator int() const noexcept { return __y; } - constexpr bool ok() const noexcept; - static inline constexpr year min() noexcept { return year{-32767}; } - static inline constexpr year max() noexcept { return year{ 32767}; } -}; - - -inline constexpr -bool operator==(const year& __lhs, const year& __rhs) noexcept -{ return static_cast(__lhs) == static_cast(__rhs); } - -inline constexpr -bool operator!=(const year& __lhs, const year& __rhs) noexcept -{ return !(__lhs == __rhs); } - -inline constexpr -bool operator< (const year& __lhs, const year& __rhs) noexcept -{ return static_cast(__lhs) < static_cast(__rhs); } - -inline constexpr -bool operator> (const year& __lhs, const year& __rhs) noexcept -{ return __rhs < __lhs; } - -inline constexpr -bool operator<=(const year& __lhs, const year& __rhs) noexcept -{ return !(__rhs < __lhs); } - -inline constexpr -bool operator>=(const year& __lhs, const year& __rhs) noexcept -{ return !(__lhs < __rhs); } - -inline constexpr -year operator+ (const year& __lhs, const years& __rhs) noexcept -{ return year(static_cast(__lhs) + __rhs.count()); } - -inline constexpr -year operator+ (const years& __lhs, const year& __rhs) noexcept -{ return __rhs + __lhs; } - -inline constexpr -year operator- (const year& __lhs, const years& __rhs) noexcept -{ return __lhs + -__rhs; } - -inline constexpr -years operator-(const year& __lhs, const year& __rhs) noexcept -{ return years{static_cast(__lhs) - static_cast(__rhs)}; } - - -inline constexpr year& year::operator+=(const years& __dy) noexcept -{ *this = *this + __dy; return *this; } - -inline constexpr year& year::operator-=(const years& __dy) noexcept -{ *this = *this - __dy; return *this; } - -inline constexpr bool year::ok() const noexcept -{ return static_cast(min()) <= __y && __y <= static_cast(max()); } - -class _LIBCPP_TYPE_VIS weekday_indexed; -class _LIBCPP_TYPE_VIS weekday_last; - -class _LIBCPP_TYPE_VIS weekday { -private: - unsigned char __wd; -public: - weekday() = default; - explicit inline constexpr weekday(unsigned __val) noexcept: __wd(static_cast(__val)) {} -// inline constexpr weekday(const sys_days& dp) noexcept; -// explicit constexpr weekday(const local_days& dp) noexcept; - inline constexpr weekday& operator++() noexcept { __wd = (__wd == 6 ? 0 : __wd + 1); return *this; } - inline constexpr weekday operator++(int) noexcept { weekday __tmp = *this; ++(*this); return __tmp; } - inline constexpr weekday& operator--() noexcept { __wd = (__wd == 0 ? 6 : __wd - 1); return *this; } - inline constexpr weekday operator--(int) noexcept { weekday __tmp = *this; --(*this); return __tmp; } - constexpr weekday& operator+=(const days& __dd) noexcept; - constexpr weekday& operator-=(const days& __dd) noexcept; - explicit inline constexpr operator unsigned() const noexcept { return __wd; } - inline constexpr bool ok() const noexcept { return __wd <= 6; } - constexpr weekday_indexed operator[](unsigned __index) const noexcept; - constexpr weekday_last operator[](last_spec) const noexcept; -}; - -inline constexpr -bool operator==(const weekday& __lhs, const weekday& __rhs) noexcept -{ return static_cast(__lhs) == static_cast(__rhs); } - -inline constexpr -bool operator!=(const weekday& __lhs, const weekday& __rhs) noexcept -{ return !(__lhs == __rhs); } - -inline constexpr -bool operator< (const weekday& __lhs, const weekday& __rhs) noexcept -{ return static_cast(__lhs) < static_cast(__rhs); } - -inline constexpr -bool operator> (const weekday& __lhs, const weekday& __rhs) noexcept -{ return __rhs < __lhs; } - -inline constexpr -bool operator<=(const weekday& __lhs, const weekday& __rhs) noexcept -{ return !(__rhs < __lhs);} - -inline constexpr -bool operator>=(const weekday& __lhs, const weekday& __rhs) noexcept -{ return !(__lhs < __rhs); } - -constexpr weekday operator+(const weekday& __lhs, const days& __rhs) noexcept -{ - auto const __mu = static_cast(static_cast(__lhs)) + __rhs.count(); - auto const __yr = (__mu >= 0 ? __mu : __mu - 6) / 7; - return weekday{static_cast(__mu - __yr * 7)}; -} - -constexpr weekday operator+(const days& __lhs, const weekday& __rhs) noexcept -{ return __rhs + __lhs; } - -constexpr weekday operator-(const weekday& __lhs, const days& __rhs) noexcept -{ return __lhs + -__rhs; } - -constexpr days operator-(const weekday& __lhs, const weekday& __rhs) noexcept -{ - const int __wdu = static_cast(__lhs) - static_cast(__rhs); - const int __wk = (__wdu >= 0 ? __wdu : __wdu-6) / 7; - return days{__wdu - __wk * 7}; -} - -inline constexpr weekday& weekday::operator+=(const days& __dd) noexcept -{ *this = *this + __dd; return *this; } - -inline constexpr weekday& weekday::operator-=(const days& __dd) noexcept -{ *this = *this - __dd; return *this; } - - -class _LIBCPP_TYPE_VIS weekday_indexed { -private: - _VSTD::chrono::weekday __wd; - unsigned char __idx; -public: - weekday_indexed() = default; - inline constexpr weekday_indexed(const _VSTD::chrono::weekday& __wdval, unsigned __idxval) noexcept - : __wd{__wdval}, __idx(__idxval) {} - inline constexpr _VSTD::chrono::weekday weekday() const noexcept { return __wd; } - inline constexpr unsigned index() const noexcept { return __idx; } - inline constexpr bool ok() const noexcept { return __wd.ok() && __idx >= 1 && __idx <= 5; } -}; - -inline constexpr -bool operator==(const weekday_indexed& __lhs, const weekday_indexed& __rhs) noexcept -{ return __lhs.weekday() == __rhs.weekday() && __lhs.index() == __rhs.index(); } - -inline constexpr -bool operator!=(const weekday_indexed& __lhs, const weekday_indexed& __rhs) noexcept -{ return !(__lhs == __rhs); } - - -class _LIBCPP_TYPE_VIS weekday_last { -private: - _VSTD::chrono::weekday __wd; -public: - explicit constexpr weekday_last(const _VSTD::chrono::weekday& __val) noexcept - : __wd{__val} {} - constexpr _VSTD::chrono::weekday weekday() const noexcept { return __wd; } - constexpr bool ok() const noexcept { return __wd.ok(); } -}; - -inline constexpr -bool operator==(const weekday_last& __lhs, const weekday_last& __rhs) noexcept -{ return __lhs.weekday() == __rhs.weekday(); } - -inline constexpr -bool operator!=(const weekday_last& __lhs, const weekday_last& __rhs) noexcept -{ return !(__lhs == __rhs); } - -inline constexpr -weekday_indexed weekday::operator[](unsigned __index) const noexcept { return weekday_indexed{*this, __index}; } - -inline constexpr -weekday_last weekday::operator[](last_spec) const noexcept { return weekday_last{*this}; } - - -inline constexpr last_spec last{}; -inline constexpr weekday Sunday{0}; -inline constexpr weekday Monday{1}; -inline constexpr weekday Tuesday{2}; -inline constexpr weekday Wednesday{3}; -inline constexpr weekday Thursday{4}; -inline constexpr weekday Friday{5}; -inline constexpr weekday Saturday{6}; - -inline constexpr month January{1}; -inline constexpr month February{2}; -inline constexpr month March{3}; -inline constexpr month April{4}; -inline constexpr month May{5}; -inline constexpr month June{6}; -inline constexpr month July{7}; -inline constexpr month August{8}; -inline constexpr month September{9}; -inline constexpr month October{10}; -inline constexpr month November{11}; -inline constexpr month December{12}; - - -class _LIBCPP_TYPE_VIS month_day { -private: - chrono::month __m; - chrono::day __d; -public: - month_day() = default; - constexpr month_day(const chrono::month& __mval, const chrono::day& __dval) noexcept - : __m{__mval}, __d{__dval} {} - inline constexpr chrono::month month() const noexcept { return __m; } - inline constexpr chrono::day day() const noexcept { return __d; } - constexpr bool ok() const noexcept; -}; - -inline constexpr -bool month_day::ok() const noexcept -{ - if (!__m.ok()) return false; - const unsigned __dval = static_cast(__d); - if (__dval < 1 || __dval > 31) return false; - if (__dval <= 29) return true; -// Now we've got either 30 or 31 - const unsigned __mval = static_cast(__m); - if (__mval == 2) return false; - if (__mval == 4 || __mval == 6 || __mval == 9 || __mval == 11) - return __dval == 30; - return true; -} - -inline constexpr -bool operator==(const month_day& __lhs, const month_day& __rhs) noexcept -{ return __lhs.month() == __rhs.month() && __lhs.day() == __rhs.day(); } - -inline constexpr -bool operator!=(const month_day& __lhs, const month_day& __rhs) noexcept -{ return !(__lhs == __rhs); } - -inline constexpr -month_day operator/(const month& __lhs, const day& __rhs) noexcept -{ return month_day{__lhs, __rhs}; } - -constexpr -month_day operator/(const day& __lhs, const month& __rhs) noexcept -{ return __rhs / __lhs; } - -inline constexpr -month_day operator/(const month& __lhs, int __rhs) noexcept -{ return __lhs / day(__rhs); } - -constexpr -month_day operator/(int __lhs, const day& __rhs) noexcept -{ return month(__lhs) / __rhs; } - -constexpr -month_day operator/(const day& __lhs, int __rhs) noexcept -{ return month(__rhs) / __lhs; } - - -inline constexpr -bool operator< (const month_day& __lhs, const month_day& __rhs) noexcept -{ return __lhs.month() != __rhs.month() ? __lhs.month() < __rhs.month() : __lhs.day() < __rhs.day(); } - -inline constexpr -bool operator> (const month_day& __lhs, const month_day& __rhs) noexcept -{ return __rhs < __lhs; } - -inline constexpr -bool operator<=(const month_day& __lhs, const month_day& __rhs) noexcept -{ return !(__rhs < __lhs);} - -inline constexpr -bool operator>=(const month_day& __lhs, const month_day& __rhs) noexcept -{ return !(__lhs < __rhs); } - - - -class _LIBCPP_TYPE_VIS month_day_last { -private: - chrono::month __m; -public: - explicit constexpr month_day_last(const chrono::month& __val) noexcept - : __m{__val} {} - inline constexpr chrono::month month() const noexcept { return __m; } - inline constexpr bool ok() const noexcept { return __m.ok(); } -}; - -inline constexpr -bool operator==(const month_day_last& __lhs, const month_day_last& __rhs) noexcept -{ return __lhs.month() == __rhs.month(); } - -inline constexpr -bool operator!=(const month_day_last& __lhs, const month_day_last& __rhs) noexcept -{ return !(__lhs == __rhs); } - -inline constexpr -bool operator< (const month_day_last& __lhs, const month_day_last& __rhs) noexcept -{ return __lhs.month() < __rhs.month(); } - -inline constexpr -bool operator> (const month_day_last& __lhs, const month_day_last& __rhs) noexcept -{ return __rhs < __lhs; } - -inline constexpr -bool operator<=(const month_day_last& __lhs, const month_day_last& __rhs) noexcept -{ return !(__rhs < __lhs);} - -inline constexpr -bool operator>=(const month_day_last& __lhs, const month_day_last& __rhs) noexcept -{ return !(__lhs < __rhs); } - -inline constexpr -month_day_last operator/(const month& __lhs, last_spec) noexcept -{ return month_day_last{__lhs}; } - -inline constexpr -month_day_last operator/(last_spec, const month& __rhs) noexcept -{ return month_day_last{__rhs}; } - -inline constexpr -month_day_last operator/(int __lhs, last_spec) noexcept -{ return month_day_last{month(__lhs)}; } - -inline constexpr -month_day_last operator/(last_spec, int __rhs) noexcept -{ return month_day_last{month(__rhs)}; } - - -class _LIBCPP_TYPE_VIS month_weekday { -private: - chrono::month __m; - chrono::weekday_indexed __wdi; -public: - month_weekday() = default; - constexpr month_weekday(const chrono::month& __mval, const chrono::weekday_indexed& __wdival) noexcept - : __m{__mval}, __wdi{__wdival} {} - inline constexpr chrono::month month() const noexcept { return __m; } - inline constexpr chrono::weekday_indexed weekday_indexed() const noexcept { return __wdi; } - inline constexpr bool ok() const noexcept { return __m.ok() && __wdi.ok(); } -}; - -inline constexpr -bool operator==(const month_weekday& __lhs, const month_weekday& __rhs) noexcept -{ return __lhs.month() == __rhs.month() && __lhs.weekday_indexed() == __rhs.weekday_indexed(); } - -inline constexpr -bool operator!=(const month_weekday& __lhs, const month_weekday& __rhs) noexcept -{ return !(__lhs == __rhs); } - -inline constexpr -month_weekday operator/(const month& __lhs, const weekday_indexed& __rhs) noexcept -{ return month_weekday{__lhs, __rhs}; } - -inline constexpr -month_weekday operator/(int __lhs, const weekday_indexed& __rhs) noexcept -{ return month_weekday{month(__lhs), __rhs}; } - -inline constexpr -month_weekday operator/(const weekday_indexed& __lhs, const month& __rhs) noexcept -{ return month_weekday{__rhs, __lhs}; } - -inline constexpr -month_weekday operator/(const weekday_indexed& __lhs, int __rhs) noexcept -{ return month_weekday{month(__rhs), __lhs}; } - - -class _LIBCPP_TYPE_VIS month_weekday_last { - chrono::month __m; - chrono::weekday_last __wdl; - public: - constexpr month_weekday_last(const chrono::month& __mval, const chrono::weekday_last& __wdlval) noexcept - : __m{__mval}, __wdl{__wdlval} {} - inline constexpr chrono::month month() const noexcept { return __m; } - inline constexpr chrono::weekday_last weekday_last() const noexcept { return __wdl; } - inline constexpr bool ok() const noexcept { return __m.ok() && __wdl.ok(); } -}; - -inline constexpr -bool operator==(const month_weekday_last& __lhs, const month_weekday_last& __rhs) noexcept -{ return __lhs.month() == __rhs.month() && __lhs.weekday_last() == __rhs.weekday_last(); } - -inline constexpr -bool operator!=(const month_weekday_last& __lhs, const month_weekday_last& __rhs) noexcept -{ return !(__lhs == __rhs); } - - -inline constexpr -month_weekday_last operator/(const month& __lhs, const weekday_last& __rhs) noexcept -{ return month_weekday_last{__lhs, __rhs}; } - -inline constexpr -month_weekday_last operator/(int __lhs, const weekday_last& __rhs) noexcept -{ return month_weekday_last{month(__lhs), __rhs}; } - -inline constexpr -month_weekday_last operator/(const weekday_last& __lhs, const month& __rhs) noexcept -{ return month_weekday_last{__rhs, __lhs}; } - -inline constexpr -month_weekday_last operator/(const weekday_last& __lhs, int __rhs) noexcept -{ return month_weekday_last{month(__rhs), __lhs}; } - - -class _LIBCPP_TYPE_VIS year_month { - chrono::year __y; - chrono::month __m; -public: - year_month() = default; - constexpr year_month(const chrono::year& __yval, const chrono::month& __mval) noexcept - : __y{__yval}, __m{__mval} {} - inline constexpr chrono::year year() const noexcept { return __y; } - inline constexpr chrono::month month() const noexcept { return __m; } - inline constexpr year_month& operator+=(const months& __dm) noexcept { this->__m += __dm; return *this; } - inline constexpr year_month& operator-=(const months& __dm) noexcept { this->__m -= __dm; return *this; } - inline constexpr year_month& operator+=(const years& __dy) noexcept { this->__y += __dy; return *this; } - inline constexpr year_month& operator-=(const years& __dy) noexcept { this->__y -= __dy; return *this; } - inline constexpr bool ok() const noexcept { return __y.ok() && __m.ok(); } -}; - -inline constexpr -year_month operator/(const year& __y, const month& __m) noexcept { return year_month{__y, __m}; } - -inline constexpr -year_month operator/(const year& __y, int __m) noexcept { return year_month{__y, month(__m)}; } - -inline constexpr -bool operator==(const year_month& __lhs, const year_month& __rhs) noexcept -{ return __lhs.year() == __rhs.year() && __lhs.month() == __rhs.month(); } - -inline constexpr -bool operator!=(const year_month& __lhs, const year_month& __rhs) noexcept -{ return !(__lhs == __rhs); } - -inline constexpr -bool operator< (const year_month& __lhs, const year_month& __rhs) noexcept -{ return __lhs.year() != __rhs.year() ? __lhs.year() < __rhs.year() : __lhs.month() < __rhs.month(); } - -inline constexpr -bool operator> (const year_month& __lhs, const year_month& __rhs) noexcept -{ return __rhs < __lhs; } - -inline constexpr -bool operator<=(const year_month& __lhs, const year_month& __rhs) noexcept -{ return !(__rhs < __lhs);} - -inline constexpr -bool operator>=(const year_month& __lhs, const year_month& __rhs) noexcept -{ return !(__lhs < __rhs); } - -constexpr year_month operator+(const year_month& __lhs, const months& __rhs) noexcept -{ - int __dmi = static_cast(static_cast(__lhs.month())) - 1 + __rhs.count(); - const int __dy = (__dmi >= 0 ? __dmi : __dmi-11) / 12; - __dmi = __dmi - __dy * 12 + 1; - return (__lhs.year() + years(__dy)) / month(static_cast(__dmi)); -} - -constexpr year_month operator+(const months& __lhs, const year_month& __rhs) noexcept -{ return __rhs + __lhs; } - -constexpr year_month operator+(const year_month& __lhs, const years& __rhs) noexcept -{ return (__lhs.year() + __rhs) / __lhs.month(); } - -constexpr year_month operator+(const years& __lhs, const year_month& __rhs) noexcept -{ return __rhs + __lhs; } - -constexpr months operator-(const year_month& __lhs, const year_month& __rhs) noexcept -{ return (__lhs.year() - __rhs.year()) + months(static_cast(__lhs.month()) - static_cast(__rhs.month())); } - -constexpr year_month operator-(const year_month& __lhs, const months& __rhs) noexcept -{ return __lhs + -__rhs; } - -constexpr year_month operator-(const year_month& __lhs, const years& __rhs) noexcept -{ return __lhs + -__rhs; } - - -class _LIBCPP_TYPE_VIS year_month_day { -private: - chrono::year __y; - chrono::month __m; - chrono::day __d; -public: - year_month_day() = default; - inline constexpr year_month_day( - const chrono::year& __yval, const chrono::month& __mval, const chrono::day& __dval) noexcept - : __y{__yval}, __m{__mval}, __d{__dval} {} -// inline constexpr year_month_day(const year_month_day_last& __ymdl) noexcept; -// inline constexpr year_month_day(const sys_days& dp) noexcept; -// inline explicit constexpr year_month_day(const local_days& dp) noexcept; - constexpr year_month_day& operator+=(const months& __dm) noexcept; - constexpr year_month_day& operator-=(const months& __dm) noexcept; - constexpr year_month_day& operator+=(const years& __dy) noexcept; - constexpr year_month_day& operator-=(const years& __dy) noexcept; - inline constexpr chrono::year year() const noexcept { return __y; } - inline constexpr chrono::month month() const noexcept { return __m; } - inline constexpr chrono::day day() const noexcept { return __d; } -// inline constexpr operator sys_days() const noexcept; -// inline explicit constexpr operator local_days() const noexcept; - -// TODO: This is not quite correct; requires the calendar bits to do right -// d_ is in the range [1d, (y_/m_/last).day()], - inline constexpr bool ok() const noexcept { return __y.ok() && __m.ok() && __d.ok(); } -}; - -inline constexpr -bool operator==(const year_month_day& __lhs, const year_month_day& __rhs) noexcept -{ return __lhs.year() == __rhs.year() && __lhs.month() == __rhs.month() && __lhs.day() == __rhs.day(); } - -inline constexpr -bool operator!=(const year_month_day& __lhs, const year_month_day& __rhs) noexcept -{ return !(__lhs == __rhs); } - -inline constexpr -bool operator< (const year_month_day& __lhs, const year_month_day& __rhs) noexcept -{ - if (__lhs.year() < __rhs.year()) return true; - if (__lhs.year() > __rhs.year()) return false; - if (__lhs.month() < __rhs.month()) return true; - if (__lhs.month() > __rhs.month()) return false; - return __lhs.day() < __rhs.day(); -} - -inline constexpr -bool operator> (const year_month_day& __lhs, const year_month_day& __rhs) noexcept -{ return __rhs < __lhs; } - -inline constexpr -bool operator<=(const year_month_day& __lhs, const year_month_day& __rhs) noexcept -{ return !(__rhs < __lhs);} - -inline constexpr -bool operator>=(const year_month_day& __lhs, const year_month_day& __rhs) noexcept -{ return !(__lhs < __rhs); } - -inline constexpr -year_month_day operator/(const year_month& __lhs, const day& __rhs) noexcept -{ return year_month_day{__lhs.year(), __lhs.month(), __rhs}; } - -inline constexpr -year_month_day operator/(const year_month& __lhs, int __rhs) noexcept -{ return __lhs / day(__rhs); } - -inline constexpr -year_month_day operator/(const year& __lhs, const month_day& __rhs) noexcept -{ return __lhs / __rhs.month() / __rhs.day(); } - -inline constexpr -year_month_day operator/(int __lhs, const month_day& __rhs) noexcept -{ return year(__lhs) / __rhs; } - -inline constexpr -year_month_day operator/(const month_day& __lhs, const year& __rhs) noexcept -{ return __rhs / __lhs; } - -inline constexpr -year_month_day operator/(const month_day& __lhs, int __rhs) noexcept -{ return year(__rhs) / __lhs; } - - -inline constexpr -year_month_day operator+(const year_month_day& __lhs, const months& __rhs) noexcept -{ return (__lhs.year()/__lhs.month() + __rhs)/__lhs.day(); } - -inline constexpr -year_month_day operator+(const months& __lhs, const year_month_day& __rhs) noexcept -{ return __rhs + __lhs; } - -inline constexpr -year_month_day operator-(const year_month_day& __lhs, const months& __rhs) noexcept -{ return __lhs + -__rhs; } - -inline constexpr -year_month_day operator+(const year_month_day& __lhs, const years& __rhs) noexcept -{ return (__lhs.year() + __rhs) / __lhs.month() / __lhs.day(); } - -inline constexpr -year_month_day operator+(const years& __lhs, const year_month_day& __rhs) noexcept -{ return __rhs + __lhs; } - -inline constexpr -year_month_day operator-(const year_month_day& __lhs, const years& __rhs) noexcept -{ return __lhs + -__rhs; } - -inline constexpr year_month_day& year_month_day::operator+=(const months& __dm) noexcept { *this = *this + __dm; return *this; } -inline constexpr year_month_day& year_month_day::operator-=(const months& __dm) noexcept { *this = *this - __dm; return *this; } -inline constexpr year_month_day& year_month_day::operator+=(const years& __dy) noexcept { *this = *this + __dy; return *this; } -inline constexpr year_month_day& year_month_day::operator-=(const years& __dy) noexcept { *this = *this - __dy; return *this; } - -class _LIBCPP_TYPE_VIS year_month_day_last { -private: - chrono::year __y; - chrono::month_day_last __mdl; -public: - constexpr year_month_day_last(const year& __yval, const month_day_last& __mdlval) noexcept - : __y{__yval}, __mdl{__mdlval} {} - - constexpr year_month_day_last& operator+=(const months& __m) noexcept; - constexpr year_month_day_last& operator-=(const months& __m) noexcept; - constexpr year_month_day_last& operator+=(const years& __y) noexcept; - constexpr year_month_day_last& operator-=(const years& __y) noexcept; - - constexpr chrono::year year() const noexcept { return __y; } - constexpr chrono::month month() const noexcept { return __mdl.month(); } - constexpr chrono::month_day_last month_day_last() const noexcept { return __mdl; } -// constexpr chrono::day day() const noexcept; -// constexpr operator sys_days() const noexcept; -// explicit constexpr operator local_days() const noexcept; - constexpr bool ok() const noexcept { return __y.ok() && __mdl.ok(); } -}; - -inline constexpr -bool operator==(const year_month_day_last& __lhs, const year_month_day_last& __rhs) noexcept -{ return __lhs.year() == __rhs.year() && __lhs.month_day_last() == __rhs.month_day_last(); } - -inline constexpr -bool operator!=(const year_month_day_last& __lhs, const year_month_day_last& __rhs) noexcept -{ return !(__lhs == __rhs); } - -inline constexpr -bool operator< (const year_month_day_last& __lhs, const year_month_day_last& __rhs) noexcept -{ - if (__lhs.year() < __rhs.year()) return true; - if (__lhs.year() > __rhs.year()) return false; - return __lhs.month_day_last() < __rhs.month_day_last(); -} - -inline constexpr -bool operator> (const year_month_day_last& __lhs, const year_month_day_last& __rhs) noexcept -{ return __rhs < __lhs; } - -inline constexpr -bool operator<=(const year_month_day_last& __lhs, const year_month_day_last& __rhs) noexcept -{ return !(__rhs < __lhs);} - -inline constexpr -bool operator>=(const year_month_day_last& __lhs, const year_month_day_last& __rhs) noexcept -{ return !(__lhs < __rhs); } - -inline constexpr year_month_day_last operator/(const year_month& __lhs, last_spec) noexcept -{ return year_month_day_last{__lhs.year(), month_day_last{__lhs.month()}}; } - -inline constexpr year_month_day_last operator/(const year& __lhs, const month_day_last& __rhs) noexcept -{ return year_month_day_last{__lhs, __rhs}; } - -inline constexpr year_month_day_last operator/(int __lhs, const month_day_last& __rhs) noexcept -{ return year_month_day_last{year{__lhs}, __rhs}; } - -inline constexpr year_month_day_last operator/(const month_day_last& __lhs, const year& __rhs) noexcept -{ return __rhs / __lhs; } - -inline constexpr year_month_day_last operator/(const month_day_last& __lhs, int __rhs) noexcept -{ return year{__rhs} / __lhs; } - - -inline constexpr -year_month_day_last operator+(const year_month_day_last& __lhs, const months& __rhs) noexcept -{ return (__lhs.year() / __lhs.month() + __rhs) / last; } - -inline constexpr -year_month_day_last operator+(const months& __lhs, const year_month_day_last& __rhs) noexcept -{ return __rhs + __lhs; } - -inline constexpr -year_month_day_last operator-(const year_month_day_last& __lhs, const months& __rhs) noexcept -{ return __lhs + (-__rhs); } - -inline constexpr -year_month_day_last operator+(const year_month_day_last& __lhs, const years& __rhs) noexcept -{ return year_month_day_last{__lhs.year() + __rhs, __lhs.month_day_last()}; } - -inline constexpr -year_month_day_last operator+(const years& __lhs, const year_month_day_last& __rhs) noexcept -{ return __rhs + __lhs; } - -inline constexpr -year_month_day_last operator-(const year_month_day_last& __lhs, const years& __rhs) noexcept -{ return __lhs + (-__rhs); } - -inline constexpr year_month_day_last& year_month_day_last::operator+=(const months& __dm) noexcept { *this = *this + __dm; return *this; } -inline constexpr year_month_day_last& year_month_day_last::operator-=(const months& __dm) noexcept { *this = *this - __dm; return *this; } -inline constexpr year_month_day_last& year_month_day_last::operator+=(const years& __dy) noexcept { *this = *this + __dy; return *this; } -inline constexpr year_month_day_last& year_month_day_last::operator-=(const years& __dy) noexcept { *this = *this - __dy; return *this; } - -class _LIBCPP_TYPE_VIS year_month_weekday { - chrono::year __y; - chrono::month __m; - chrono::weekday_indexed __wdi; -public: - year_month_weekday() = default; - constexpr year_month_weekday(const chrono::year& __yval, const chrono::month& __mval, - const chrono::weekday_indexed& __wdival) noexcept - : __y{__yval}, __m{__mval}, __wdi{__wdival} {} -// constexpr year_month_weekday(const sys_days& dp) noexcept; -// explicit constexpr year_month_weekday(const local_days& dp) noexcept; - constexpr year_month_weekday& operator+=(const months& m) noexcept; - constexpr year_month_weekday& operator-=(const months& m) noexcept; - constexpr year_month_weekday& operator+=(const years& y) noexcept; - constexpr year_month_weekday& operator-=(const years& y) noexcept; - - inline constexpr chrono::year year() const noexcept { return __y; } - inline constexpr chrono::month month() const noexcept { return __m; } - inline constexpr chrono::weekday weekday() const noexcept { return __wdi.weekday(); } - inline constexpr unsigned index() const noexcept { return __wdi.index(); } - inline constexpr chrono::weekday_indexed weekday_indexed() const noexcept { return __wdi; } - -// constexpr operator sys_days() const noexcept; -// explicit constexpr operator local_days() const noexcept; - inline constexpr bool ok() const noexcept - { - if (!__y.ok() || !__m.ok() || !__wdi.ok()) return false; - // TODO: make sure it's a valid date - return true; - } -}; - -inline constexpr -bool operator==(const year_month_weekday& __lhs, const year_month_weekday& __rhs) noexcept -{ return __lhs.year() == __rhs.year() && __lhs.month() == __rhs.month() && __lhs.weekday_indexed() == __rhs.weekday_indexed(); } - -inline constexpr -bool operator!=(const year_month_weekday& __lhs, const year_month_weekday& __rhs) noexcept -{ return !(__lhs == __rhs); } - -inline constexpr -year_month_weekday operator/(const year_month& __lhs, const weekday_indexed& __rhs) noexcept -{ return year_month_weekday{__lhs.year(), __lhs.month(), __rhs}; } - -inline constexpr -year_month_weekday operator/(const year& __lhs, const month_weekday& __rhs) noexcept -{ return year_month_weekday{__lhs, __rhs.month(), __rhs.weekday_indexed()}; } - -inline constexpr -year_month_weekday operator/(int __lhs, const month_weekday& __rhs) noexcept -{ return year(__lhs) / __rhs; } - -inline constexpr -year_month_weekday operator/(const month_weekday& __lhs, const year& __rhs) noexcept -{ return __rhs / __lhs; } - -inline constexpr -year_month_weekday operator/(const month_weekday& __lhs, int __rhs) noexcept -{ return year(__rhs) / __lhs; } - - -inline constexpr -year_month_weekday operator+(const year_month_weekday& __lhs, const months& __rhs) noexcept -{ return (__lhs.year() / __lhs.month() + __rhs) / __lhs.weekday_indexed(); } - -inline constexpr -year_month_weekday operator+(const months& __lhs, const year_month_weekday& __rhs) noexcept -{ return __rhs + __lhs; } - -inline constexpr -year_month_weekday operator-(const year_month_weekday& __lhs, const months& __rhs) noexcept -{ return __lhs + (-__rhs); } - -inline constexpr -year_month_weekday operator+(const year_month_weekday& __lhs, const years& __rhs) noexcept -{ return year_month_weekday{__lhs.year() + __rhs, __lhs.month(), __lhs.weekday_indexed()}; } - -inline constexpr -year_month_weekday operator+(const years& __lhs, const year_month_weekday& __rhs) noexcept -{ return __rhs + __lhs; } - -inline constexpr -year_month_weekday operator-(const year_month_weekday& __lhs, const years& __rhs) noexcept -{ return __lhs + (-__rhs); } - - -inline constexpr year_month_weekday& year_month_weekday::operator+=(const months& __dm) noexcept { *this = *this + __dm; return *this; } -inline constexpr year_month_weekday& year_month_weekday::operator-=(const months& __dm) noexcept { *this = *this - __dm; return *this; } -inline constexpr year_month_weekday& year_month_weekday::operator+=(const years& __dy) noexcept { *this = *this + __dy; return *this; } -inline constexpr year_month_weekday& year_month_weekday::operator-=(const years& __dy) noexcept { *this = *this - __dy; return *this; } - -class _LIBCPP_TYPE_VIS year_month_weekday_last { -private: - chrono::year __y; - chrono::month __m; - chrono::weekday_last __wdl; -public: - constexpr year_month_weekday_last(const chrono::year& __yval, const chrono::month& __mval, - const chrono::weekday_last& __wdlval) noexcept - : __y{__yval}, __m{__mval}, __wdl{__wdlval} {} - constexpr year_month_weekday_last& operator+=(const months& __dm) noexcept; - constexpr year_month_weekday_last& operator-=(const months& __dm) noexcept; - constexpr year_month_weekday_last& operator+=(const years& __dy) noexcept; - constexpr year_month_weekday_last& operator-=(const years& __dy) noexcept; - - inline constexpr chrono::year year() const noexcept { return __y; } - inline constexpr chrono::month month() const noexcept { return __m; } - inline constexpr chrono::weekday weekday() const noexcept { return __wdl.weekday(); } - inline constexpr chrono::weekday_last weekday_last() const noexcept { return __wdl; } -// constexpr operator sys_days() const noexcept; -// explicit constexpr operator local_days() const noexcept; - inline constexpr bool ok() const noexcept { return __y.ok() && __m.ok() && __wdl.ok(); } -}; - -inline constexpr -bool operator==(const year_month_weekday_last& __lhs, const year_month_weekday_last& __rhs) noexcept -{ return __lhs.year() == __rhs.year() && __lhs.month() == __rhs.month() && __lhs.weekday_last() == __rhs.weekday_last(); } - -inline constexpr -bool operator!=(const year_month_weekday_last& __lhs, const year_month_weekday_last& __rhs) noexcept -{ return !(__lhs == __rhs); } - - -inline constexpr -year_month_weekday_last operator/(const year_month& __lhs, const weekday_last& __rhs) noexcept -{ return year_month_weekday_last{__lhs.year(), __lhs.month(), __rhs}; } - -inline constexpr -year_month_weekday_last operator/(const year& __lhs, const month_weekday_last& __rhs) noexcept -{ return year_month_weekday_last{__lhs, __rhs.month(), __rhs.weekday_last()}; } - -inline constexpr -year_month_weekday_last operator/(int __lhs, const month_weekday_last& __rhs) noexcept -{ return year(__lhs) / __rhs; } - -inline constexpr -year_month_weekday_last operator/(const month_weekday_last& __lhs, const year& __rhs) noexcept -{ return __rhs / __lhs; } - -inline constexpr -year_month_weekday_last operator/(const month_weekday_last& __lhs, int __rhs) noexcept -{ return year(__rhs) / __lhs; } - - -inline constexpr -year_month_weekday_last operator+(const year_month_weekday_last& __lhs, const months& __rhs) noexcept -{ return (__lhs.year() / __lhs.month() + __rhs) / __lhs.weekday_last(); } - -inline constexpr -year_month_weekday_last operator+(const months& __lhs, const year_month_weekday_last& __rhs) noexcept -{ return __rhs + __lhs; } - -inline constexpr -year_month_weekday_last operator-(const year_month_weekday_last& __lhs, const months& __rhs) noexcept -{ return __lhs + (-__rhs); } - -inline constexpr -year_month_weekday_last operator+(const year_month_weekday_last& __lhs, const years& __rhs) noexcept -{ return year_month_weekday_last{__lhs.year() + __rhs, __lhs.month(), __lhs.weekday_last()}; } - -inline constexpr -year_month_weekday_last operator+(const years& __lhs, const year_month_weekday_last& __rhs) noexcept -{ return __rhs + __lhs; } - -inline constexpr -year_month_weekday_last operator-(const year_month_weekday_last& __lhs, const years& __rhs) noexcept -{ return __lhs + (-__rhs); } - -inline constexpr year_month_weekday_last& year_month_weekday_last::operator+=(const months& __dm) noexcept { *this = *this + __dm; return *this; } -inline constexpr year_month_weekday_last& year_month_weekday_last::operator-=(const months& __dm) noexcept { *this = *this - __dm; return *this; } -inline constexpr year_month_weekday_last& year_month_weekday_last::operator+=(const years& __dy) noexcept { *this = *this + __dy; return *this; } -inline constexpr year_month_weekday_last& year_month_weekday_last::operator-=(const years& __dy) noexcept { *this = *this - __dy; return *this; } - -#endif // _LIBCPP_STD_VER > 17 } // chrono #if _LIBCPP_STD_VER > 11 @@ -2668,17 +1648,6 @@ inline namespace literals return chrono::duration (__ns); } -#if _LIBCPP_STD_VER > 17 && !defined(_LIBCPP_HAS_NO_CXX20_CHRONO_LITERALS) - constexpr chrono::day operator ""d(unsigned long long __d) noexcept - { - return chrono::day(static_cast(__d)); - } - - constexpr chrono::year operator ""y(unsigned long long __y) noexcept - { - return chrono::year(static_cast(__y)); - } -#endif }} namespace chrono { // hoist the literals into namespace std::chrono diff --git a/libcxx/test/std/utilities/time/days.pass.cpp b/libcxx/test/std/utilities/time/days.pass.cpp deleted file mode 100644 index 3954e986acdd..000000000000 --- a/libcxx/test/std/utilities/time/days.pass.cpp +++ /dev/null @@ -1,28 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// -// UNSUPPORTED: c++03, c++11, c++14, c++17 - -// - -// using days = duration, hours::period>>; - -#include -#include -#include - -int main() -{ - typedef std::chrono::days D; - typedef D::rep Rep; - typedef D::period Period; - static_assert(std::is_signed::value, ""); - static_assert(std::is_integral::value, ""); - static_assert(std::numeric_limits::digits >= 25, ""); - static_assert(std::is_same_v, std::chrono::hours::period>>, ""); -} diff --git a/libcxx/test/std/utilities/time/months.pass.cpp b/libcxx/test/std/utilities/time/months.pass.cpp deleted file mode 100644 index 9a48b0a19d7e..000000000000 --- a/libcxx/test/std/utilities/time/months.pass.cpp +++ /dev/null @@ -1,29 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// -// UNSUPPORTED: c++03, c++11, c++14, c++17 - -// - -// using months = duration>>; - - -#include -#include -#include - -int main() -{ - typedef std::chrono::months D; - typedef D::rep Rep; - typedef D::period Period; - static_assert(std::is_signed::value, ""); - static_assert(std::is_integral::value, ""); - static_assert(std::numeric_limits::digits >= 20, ""); - static_assert(std::is_same_v>>, ""); -} diff --git a/libcxx/test/std/utilities/time/time.cal/euclidian.h b/libcxx/test/std/utilities/time/time.cal/euclidian.h deleted file mode 100644 index f2dc28b36cd1..000000000000 --- a/libcxx/test/std/utilities/time/time.cal/euclidian.h +++ /dev/null @@ -1,40 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - - -// Assumption: minValue < maxValue -// Assumption: minValue <= rhs <= maxValue -// Assumption: minValue <= lhs <= maxValue -// Assumption: minValue >= 0 -template -T euclidian_addition(T rhs, T lhs) -{ - const T modulus = maxValue - minValue + 1; - T ret = rhs + lhs; - if (ret > maxValue) - ret -= modulus; - return ret; -} - -// Assumption: minValue < maxValue -// Assumption: minValue <= rhs <= maxValue -// Assumption: minValue <= lhs <= maxValue -// Assumption: minValue >= 0 -template -T euclidian_subtraction(T lhs, T rhs) -{ - const T modulus = maxValue - minValue + 1; - T ret = lhs - rhs; - if (ret < minValue) - ret += modulus; - if (ret > maxValue) // this can happen if T is unsigned - ret += modulus; - return ret; -} - diff --git a/libcxx/test/std/utilities/time/time.cal/nothing_to_do.pass.cpp b/libcxx/test/std/utilities/time/time.cal/nothing_to_do.pass.cpp deleted file mode 100644 index b58f5c55b643..000000000000 --- a/libcxx/test/std/utilities/time/time.cal/nothing_to_do.pass.cpp +++ /dev/null @@ -1,12 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -int main() -{ -} diff --git a/libcxx/test/std/utilities/time/time.cal/time.cal.day/time.cal.day.members/ctor.pass.cpp b/libcxx/test/std/utilities/time/time.cal/time.cal.day/time.cal.day.members/ctor.pass.cpp deleted file mode 100644 index c2c2eba87d7d..000000000000 --- a/libcxx/test/std/utilities/time/time.cal/time.cal.day/time.cal.day.members/ctor.pass.cpp +++ /dev/null @@ -1,46 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// -// UNSUPPORTED: c++03, c++11, c++14, c++17 - -// -// class day; - -// day() = default; -// explicit constexpr day(unsigned d) noexcept; -// explicit constexpr operator unsigned() const noexcept; - -// Effects: Constructs an object of type day by initializing d_ with d. -// The value held is unspecified if d is not in the range [0, 255]. - -#include -#include -#include - -#include "test_macros.h" - -int main() -{ - using day = std::chrono::day; - - ASSERT_NOEXCEPT(day{}); - ASSERT_NOEXCEPT(day(0U)); - ASSERT_NOEXCEPT(static_cast(day(0U))); - - constexpr day d0{}; - static_assert(static_cast(d0) == 0, ""); - - constexpr day d1{1}; - static_assert(static_cast(d1) == 1, ""); - - for (unsigned i = 0; i <= 255; ++i) - { - day day(i); - assert(static_cast(day) == i); - } -} diff --git a/libcxx/test/std/utilities/time/time.cal/time.cal.day/time.cal.day.members/decrement.pass.cpp b/libcxx/test/std/utilities/time/time.cal/time.cal.day/time.cal.day.members/decrement.pass.cpp deleted file mode 100644 index 819709a891fb..000000000000 --- a/libcxx/test/std/utilities/time/time.cal/time.cal.day/time.cal.day.members/decrement.pass.cpp +++ /dev/null @@ -1,52 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// -// UNSUPPORTED: c++03, c++11, c++14, c++17 - -// -// class day; - -// constexpr day& operator--() noexcept; -// constexpr day operator--(int) noexcept; - - -#include -#include -#include - -#include "test_macros.h" - -template -constexpr bool testConstexpr() -{ - D d1{10}; - if (static_cast(--d1) != 9) return false; - if (static_cast(d1--) != 9) return false; - if (static_cast(d1) != 8) return false; - return true; -} - -int main() -{ - using day = std::chrono::day; - ASSERT_NOEXCEPT(--(std::declval()) ); - ASSERT_NOEXCEPT( (std::declval())--); - - ASSERT_SAME_TYPE(day , decltype( std::declval()--)); - ASSERT_SAME_TYPE(day&, decltype(--std::declval() )); - - static_assert(testConstexpr(), ""); - - for (unsigned i = 10; i <= 20; ++i) - { - day day(i); - assert(static_cast(--day) == i - 1); - assert(static_cast(day--) == i - 1); - assert(static_cast(day) == i - 2); - } -} diff --git a/libcxx/test/std/utilities/time/time.cal/time.cal.day/time.cal.day.members/increment.pass.cpp b/libcxx/test/std/utilities/time/time.cal/time.cal.day/time.cal.day.members/increment.pass.cpp deleted file mode 100644 index 323bf8bfe45e..000000000000 --- a/libcxx/test/std/utilities/time/time.cal/time.cal.day/time.cal.day.members/increment.pass.cpp +++ /dev/null @@ -1,52 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// -// UNSUPPORTED: c++03, c++11, c++14, c++17 - -// -// class day; - -// constexpr day& operator++() noexcept; -// constexpr day operator++(int) noexcept; - - -#include -#include -#include - -#include "test_macros.h" - -template -constexpr bool testConstexpr() -{ - D d1{1}; - if (static_cast(++d1) != 2) return false; - if (static_cast(d1++) != 2) return false; - if (static_cast(d1) != 3) return false; - return true; -} - -int main() -{ - using day = std::chrono::day; - ASSERT_NOEXCEPT(++(std::declval()) ); - ASSERT_NOEXCEPT( (std::declval())++); - - ASSERT_SAME_TYPE(day , decltype( std::declval()++)); - ASSERT_SAME_TYPE(day&, decltype(++std::declval() )); - - static_assert(testConstexpr(), ""); - - for (unsigned i = 10; i <= 20; ++i) - { - day day(i); - assert(static_cast(++day) == i + 1); - assert(static_cast(day++) == i + 1); - assert(static_cast(day) == i + 2); - } -} diff --git a/libcxx/test/std/utilities/time/time.cal/time.cal.day/time.cal.day.members/ok.pass.cpp b/libcxx/test/std/utilities/time/time.cal/time.cal.day/time.cal.day.members/ok.pass.cpp deleted file mode 100644 index c3510fee307b..000000000000 --- a/libcxx/test/std/utilities/time/time.cal/time.cal.day/time.cal.day.members/ok.pass.cpp +++ /dev/null @@ -1,37 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// -// UNSUPPORTED: c++03, c++11, c++14, c++17 - -// -// class day; - -// constexpr bool ok() const noexcept; -// Returns: 1 <= d_ && d_ <= 31 - -#include -#include -#include - -#include "test_macros.h" - -int main() -{ - using day = std::chrono::day; - ASSERT_NOEXCEPT( std::declval().ok()); - ASSERT_SAME_TYPE(bool, decltype(std::declval().ok())); - - static_assert(!day{0}.ok(), ""); - static_assert( day{1}.ok(), ""); - - assert(!day{0}.ok()); - for (unsigned i = 1; i <= 31; ++i) - assert(day{i}.ok()); - for (unsigned i = 32; i <= 255; ++i) - assert(!day{i}.ok()); -} diff --git a/libcxx/test/std/utilities/time/time.cal/time.cal.day/time.cal.day.members/plus_minus_equal.pass.cpp b/libcxx/test/std/utilities/time/time.cal/time.cal.day/time.cal.day.members/plus_minus_equal.pass.cpp deleted file mode 100644 index f8fd89aa8748..000000000000 --- a/libcxx/test/std/utilities/time/time.cal/time.cal.day/time.cal.day.members/plus_minus_equal.pass.cpp +++ /dev/null @@ -1,57 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// -// UNSUPPORTED: c++03, c++11, c++14, c++17 - -// -// class day; - -// constexpr day& operator+=(const days& d) noexcept; -// constexpr day& operator-=(const days& d) noexcept; - -#include -#include -#include - -#include "test_macros.h" - -template -constexpr bool testConstexpr() -{ - D d1{1}; - if (static_cast(d1 += Ds{ 1}) != 2) return false; - if (static_cast(d1 += Ds{ 2}) != 4) return false; - if (static_cast(d1 += Ds{22}) != 26) return false; - if (static_cast(d1 -= Ds{ 1}) != 25) return false; - if (static_cast(d1 -= Ds{ 2}) != 23) return false; - if (static_cast(d1 -= Ds{22}) != 1) return false; - return true; -} - -int main() -{ - using day = std::chrono::day; - using days = std::chrono::days; - - ASSERT_NOEXCEPT(std::declval() += std::declval()); - ASSERT_NOEXCEPT(std::declval() -= std::declval()); - - ASSERT_SAME_TYPE(day&, decltype(std::declval() += std::declval())); - ASSERT_SAME_TYPE(day&, decltype(std::declval() -= std::declval())); - - static_assert(testConstexpr(), ""); - - for (unsigned i = 0; i <= 10; ++i) - { - day day(i); - assert(static_cast(day += days{22}) == i + 22); - assert(static_cast(day) == i + 22); - assert(static_cast(day -= days{12}) == i + 10); - assert(static_cast(day) == i + 10); - } -} diff --git a/libcxx/test/std/utilities/time/time.cal/time.cal.day/time.cal.day.nonmembers/comparisons.pass.cpp b/libcxx/test/std/utilities/time/time.cal/time.cal.day/time.cal.day.nonmembers/comparisons.pass.cpp deleted file mode 100644 index a5a25b760068..000000000000 --- a/libcxx/test/std/utilities/time/time.cal/time.cal.day/time.cal.day.nonmembers/comparisons.pass.cpp +++ /dev/null @@ -1,44 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// -// UNSUPPORTED: c++03, c++11, c++14, c++17 - -// -// class day; - -// constexpr bool operator==(const day& x, const day& y) noexcept; -// Returns: unsigned{x} == unsigned{y}. -// constexpr bool operator<(const day& x, const day& y) noexcept; -// Returns: unsigned{x} < unsigned{y}. - - -#include -#include -#include - -#include "test_macros.h" -#include "test_comparisons.h" - -int main() -{ - using day = std::chrono::day; - - AssertComparisons6AreNoexcept(); - AssertComparisons6ReturnBool(); - - static_assert(testComparisons6Values(0U, 0U), ""); - static_assert(testComparisons6Values(0U, 1U), ""); - -// Some 'ok' values as well - static_assert(testComparisons6Values( 5U, 5U), ""); - static_assert(testComparisons6Values( 5U, 10U), ""); - - for (unsigned i = 1; i < 10; ++i) - for (unsigned j = 1; j < 10; ++j) - assert(testComparisons6Values(i, j)); -} diff --git a/libcxx/test/std/utilities/time/time.cal/time.cal.day/time.cal.day.nonmembers/literals.fail.cpp b/libcxx/test/std/utilities/time/time.cal/time.cal.day/time.cal.day.nonmembers/literals.fail.cpp deleted file mode 100644 index a33db2ec82f9..000000000000 --- a/libcxx/test/std/utilities/time/time.cal/time.cal.day/time.cal.day.nonmembers/literals.fail.cpp +++ /dev/null @@ -1,26 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// -// UNSUPPORTED: c++03, c++11, c++14, c++17 - -// -// class day; - -// constexpr day operator""d(unsigned long long d) noexcept; - -#include -#include -#include - -#include "test_macros.h" - -int main() -{ - using day = std::chrono::day; - day d1 = 4d; // expected-error-re {{no matching literal operator for call to 'operator""d' {{.*}}}} -} diff --git a/libcxx/test/std/utilities/time/time.cal/time.cal.day/time.cal.day.nonmembers/literals.pass.cpp b/libcxx/test/std/utilities/time/time.cal/time.cal.day/time.cal.day.nonmembers/literals.pass.cpp deleted file mode 100644 index 0911b43b54bc..000000000000 --- a/libcxx/test/std/utilities/time/time.cal/time.cal.day/time.cal.day.nonmembers/literals.pass.cpp +++ /dev/null @@ -1,47 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// -// UNSUPPORTED: c++03, c++11, c++14, c++17 -// UNSUPPORTED: clang-5, clang-6 -// UNSUPPORTED: apple-clang-6, apple-clang-7, apple-clang-8, apple-clang-9 - -// -// class day; - -// constexpr day operator""d(unsigned long long d) noexcept; - -#include -#include -#include - -#include "test_macros.h" - -int main() -{ - { - using namespace std::chrono; - ASSERT_NOEXCEPT( 4d); - ASSERT_SAME_TYPE(day, decltype(4d)); - - static_assert( 7d == day(7), ""); - day d1 = 4d; - assert (d1 == day(4)); -} - - { - using namespace std::literals; - ASSERT_NOEXCEPT( 4d); - ASSERT_SAME_TYPE(std::chrono::day, decltype(4d)); - - static_assert( 7d == std::chrono::day(7), ""); - - std::chrono::day d1 = 4d; - assert (d1 == std::chrono::day(4)); - } - -} diff --git a/libcxx/test/std/utilities/time/time.cal/time.cal.day/time.cal.day.nonmembers/minus.pass.cpp b/libcxx/test/std/utilities/time/time.cal/time.cal.day/time.cal.day.nonmembers/minus.pass.cpp deleted file mode 100644 index 53697c1013a1..000000000000 --- a/libcxx/test/std/utilities/time/time.cal/time.cal.day/time.cal.day.nonmembers/minus.pass.cpp +++ /dev/null @@ -1,58 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// -// UNSUPPORTED: c++03, c++11, c++14, c++17 - -// -// class day; - -// constexpr day operator-(const day& x, const days& y) noexcept; -// Returns: x + -y. -// -// constexpr days operator-(const day& x, const day& y) noexcept; -// Returns: days{int(unsigned{x}) - int(unsigned{y}). - - -#include -#include -#include - -#include "test_macros.h" - -template -constexpr bool testConstexpr() -{ - D d{23}; - Ds offset{6}; - if (d - offset != D{17}) return false; - if (d - D{17} != offset) return false; - return true; -} - -int main() -{ - using day = std::chrono::day; - using days = std::chrono::days; - - ASSERT_NOEXCEPT(std::declval() - std::declval()); - ASSERT_NOEXCEPT(std::declval() - std::declval()); - - ASSERT_SAME_TYPE(day, decltype(std::declval() - std::declval())); - ASSERT_SAME_TYPE(days, decltype(std::declval() - std::declval())); - - static_assert(testConstexpr(), ""); - - day dy{12}; - for (unsigned i = 0; i <= 10; ++i) - { - day d1 = dy - days{i}; - days off = dy - day {i}; - assert(static_cast(d1) == 12 - i); - assert(off.count() == static_cast(12 - i)); // days is signed - } -} diff --git a/libcxx/test/std/utilities/time/time.cal/time.cal.day/time.cal.day.nonmembers/plus.pass.cpp b/libcxx/test/std/utilities/time/time.cal/time.cal.day/time.cal.day.nonmembers/plus.pass.cpp deleted file mode 100644 index fb8f536127ed..000000000000 --- a/libcxx/test/std/utilities/time/time.cal/time.cal.day/time.cal.day.nonmembers/plus.pass.cpp +++ /dev/null @@ -1,59 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// -// UNSUPPORTED: c++03, c++11, c++14, c++17 - -// -// class day; - -// constexpr day operator+(const day& x, const days& y) noexcept; -// Returns: day(unsigned{x} + y.count()). -// -// constexpr day operator+(const days& x, const day& y) noexcept; -// Returns: y + x. - - -#include -#include -#include - -#include "test_macros.h" - -template -constexpr bool testConstexpr() -{ - D d{1}; - Ds offset{23}; - if (d + offset != D{24}) return false; - if (offset + d != D{24}) return false; - return true; -} - -int main() -{ - using day = std::chrono::day; - using days = std::chrono::days; - - ASSERT_NOEXCEPT(std::declval() + std::declval()); - ASSERT_NOEXCEPT(std::declval() + std::declval()); - - ASSERT_SAME_TYPE(day, decltype(std::declval() + std::declval())); - ASSERT_SAME_TYPE(day, decltype(std::declval() + std::declval())); - - static_assert(testConstexpr(), ""); - - day dy{12}; - for (unsigned i = 0; i <= 10; ++i) - { - day d1 = dy + days{i}; - day d2 = days{i} + dy; - assert(d1 == d2); - assert(static_cast(d1) == i + 12); - assert(static_cast(d2) == i + 12); - } -} diff --git a/libcxx/test/std/utilities/time/time.cal/time.cal.day/time.cal.day.nonmembers/streaming.pass.cpp b/libcxx/test/std/utilities/time/time.cal/time.cal.day/time.cal.day.nonmembers/streaming.pass.cpp deleted file mode 100644 index 3e859af176bc..000000000000 --- a/libcxx/test/std/utilities/time/time.cal/time.cal.day/time.cal.day.nonmembers/streaming.pass.cpp +++ /dev/null @@ -1,56 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// -// UNSUPPORTED: c++03, c++11, c++14, c++17 -// XFAIL: * - -// -// class day; - -// template -// basic_ostream& -// operator<<(basic_ostream& os, const day& d); -// -// Effects: Inserts format(fmt, d) where fmt is "%d" widened to charT. -// If !d.ok(), appends with " is not a valid day". -// -// template -// basic_ostream& -// to_stream(basic_ostream& os, const charT* fmt, const day& d); -// -// Effects: Streams d into os using the format specified by the NTCTS fmt. -// fmt encoding follows the rules specified in 25.11. -// -// template> -// basic_istream& -// from_stream(basic_istream& is, const charT* fmt, -// day& d, basic_string* abbrev = nullptr, -// minutes* offset = nullptr); -// -// Effects: Attempts to parse the input stream is into the day d using the format flags -// given in the NTCTS fmt as specified in 25.12. -// If the parse fails to decode a valid day, is.setstate(ios_base::failbit) -// shall be called and d shall not be modified. -// If %Z is used and successfully parsed, that value will be assigned to *abbrev -// if abbrev is non-null. If %z (or a modified variant) is used and -// successfully parsed, that value will be assigned to *offset if offset is non-null. -// - - -#include -#include -#include -#include - -#include "test_macros.h" - -int main() -{ - using day = std::chrono::day; - std::cout << day{1}; -} diff --git a/libcxx/test/std/utilities/time/time.cal/time.cal.day/types.pass.cpp b/libcxx/test/std/utilities/time/time.cal/time.cal.day/types.pass.cpp deleted file mode 100644 index 37c9c570f13d..000000000000 --- a/libcxx/test/std/utilities/time/time.cal/time.cal.day/types.pass.cpp +++ /dev/null @@ -1,26 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// -// UNSUPPORTED: c++03, c++11, c++14, c++17 - -// -// class day; - -#include -#include -#include - -#include "test_macros.h" - -int main() -{ - using day = std::chrono::day; - - static_assert(std::is_trivially_copyable_v, ""); - static_assert(std::is_standard_layout_v, ""); -} diff --git a/libcxx/test/std/utilities/time/time.cal/time.cal.last/types.pass.cpp b/libcxx/test/std/utilities/time/time.cal/time.cal.last/types.pass.cpp deleted file mode 100644 index f0d3e3cd25a3..000000000000 --- a/libcxx/test/std/utilities/time/time.cal/time.cal.last/types.pass.cpp +++ /dev/null @@ -1,33 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// -// UNSUPPORTED: c++03, c++11, c++14, c++17 - -// - -// struct last_spec { -// explicit last_spec() = default; -// }; -// -// inline constexpr last_spec last{}; - -#include -#include -#include - -#include "test_macros.h" - -int main() -{ - using last_spec = std::chrono::last_spec; - - ASSERT_SAME_TYPE(const last_spec, decltype(std::chrono::last)); - - static_assert(std::is_trivially_copyable_v, ""); - static_assert(std::is_standard_layout_v, ""); -} diff --git a/libcxx/test/std/utilities/time/time.cal/time.cal.md/time.cal.md.members/ctor.pass.cpp b/libcxx/test/std/utilities/time/time.cal/time.cal.md/time.cal.md.members/ctor.pass.cpp deleted file mode 100644 index 2a30bece387b..000000000000 --- a/libcxx/test/std/utilities/time/time.cal/time.cal.md/time.cal.md.members/ctor.pass.cpp +++ /dev/null @@ -1,47 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// -// UNSUPPORTED: c++03, c++11, c++14, c++17 - -// -// class month_day; - -// month_day() = default; -// constexpr month_day(const chrono::month& m, const chrono::day& d) noexcept; -// -// Effects: Constructs an object of type month_day by initializing m_ with m, and d_ with d. -// -// constexpr chrono::month month() const noexcept; -// constexpr chrono::day day() const noexcept; -// constexpr bool ok() const noexcept; - -#include -#include -#include - -#include "test_macros.h" - -int main() -{ - using day = std::chrono::day; - using month = std::chrono::month; - using month_day = std::chrono::month_day; - - ASSERT_NOEXCEPT(month_day{}); - ASSERT_NOEXCEPT(month_day{month{1}, day{1}}); - - constexpr month_day md0{}; - static_assert( md0.month() == month{}, ""); - static_assert( md0.day() == day{}, ""); - static_assert(!md0.ok(), ""); - - constexpr month_day md1{std::chrono::January, day{4}}; - static_assert( md1.month() == std::chrono::January, ""); - static_assert( md1.day() == day{4}, ""); - static_assert( md1.ok(), ""); -} diff --git a/libcxx/test/std/utilities/time/time.cal/time.cal.md/time.cal.md.members/day.pass.cpp b/libcxx/test/std/utilities/time/time.cal/time.cal.md/time.cal.md.members/day.pass.cpp deleted file mode 100644 index 69477a459331..000000000000 --- a/libcxx/test/std/utilities/time/time.cal/time.cal.md/time.cal.md.members/day.pass.cpp +++ /dev/null @@ -1,39 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// -// UNSUPPORTED: c++03, c++11, c++14, c++17 - -// -// class month_day; - -// constexpr chrono::day day() const noexcept; -// Returns: d_ - -#include -#include -#include - -#include "test_macros.h" - -int main() -{ - using day = std::chrono::day; - using month = std::chrono::month; - using month_day = std::chrono::month_day; - - ASSERT_NOEXCEPT( std::declval().day()); - ASSERT_SAME_TYPE(day, decltype(std::declval().day())); - - static_assert( month_day{}.day() == day{}, ""); - - for (unsigned i = 1; i <= 50; ++i) - { - month_day md(std::chrono::March, day{i}); - assert( static_cast(md.day()) == i); - } -} diff --git a/libcxx/test/std/utilities/time/time.cal/time.cal.md/time.cal.md.members/month.pass.cpp b/libcxx/test/std/utilities/time/time.cal/time.cal.md/time.cal.md.members/month.pass.cpp deleted file mode 100644 index 73ddb6416a6f..000000000000 --- a/libcxx/test/std/utilities/time/time.cal/time.cal.md/time.cal.md.members/month.pass.cpp +++ /dev/null @@ -1,39 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// -// UNSUPPORTED: c++03, c++11, c++14, c++17 - -// -// class month_day; - -// constexpr chrono::month month() const noexcept; -// Returns: wd_ - -#include -#include -#include - -#include "test_macros.h" - -int main() -{ - using day = std::chrono::day; - using month = std::chrono::month; - using month_day = std::chrono::month_day; - - ASSERT_NOEXCEPT( std::declval().month()); - ASSERT_SAME_TYPE(month, decltype(std::declval().month())); - - static_assert( month_day{}.month() == month{}, ""); - - for (unsigned i = 1; i <= 50; ++i) - { - month_day md(month{i}, day{1}); - assert( static_cast(md.month()) == i); - } -} diff --git a/libcxx/test/std/utilities/time/time.cal/time.cal.md/time.cal.md.members/ok.pass.cpp b/libcxx/test/std/utilities/time/time.cal/time.cal.md/time.cal.md.members/ok.pass.cpp deleted file mode 100644 index 6ee79caa1870..000000000000 --- a/libcxx/test/std/utilities/time/time.cal/time.cal.md/time.cal.md.members/ok.pass.cpp +++ /dev/null @@ -1,55 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// -// UNSUPPORTED: c++03, c++11, c++14, c++17 - -// -// class month_day; - -// constexpr bool ok() const noexcept; -// Returns: true if m_.ok() is true, 1d <= d_, and d_ is less than or equal to the -// number of days in month m_; otherwise returns false. -// When m_ == February, the number of days is considered to be 29. - -#include -#include -#include - -#include "test_macros.h" - -int main() -{ - using day = std::chrono::day; - using month = std::chrono::month; - using month_day = std::chrono::month_day; - - ASSERT_NOEXCEPT( std::declval().ok()); - ASSERT_SAME_TYPE(bool, decltype(std::declval().ok())); - - static_assert(!month_day{}.ok(), ""); - static_assert( month_day{std::chrono::May, day{2}}.ok(), ""); - - assert(!(month_day(std::chrono::April, day{0}).ok())); - - assert( (month_day{std::chrono::March, day{1}}.ok())); - for (unsigned i = 1; i <= 12; ++i) - { - const bool is31 = i == 1 || i == 3 || i == 5 || i == 7 || i == 8 || i == 10 || i == 12; - assert(!(month_day{month{i}, day{ 0}}.ok())); - assert( (month_day{month{i}, day{ 1}}.ok())); - assert( (month_day{month{i}, day{10}}.ok())); - assert( (month_day{month{i}, day{29}}.ok())); - assert( (month_day{month{i}, day{30}}.ok()) == (i != 2)); - assert( (month_day{month{i}, day{31}}.ok()) == is31); - assert(!(month_day{month{i}, day{32}}.ok())); - } - -// If the month is not ok, all the days are bad - for (unsigned i = 1; i <= 35; ++i) - assert(!(month_day{month{13}, day{i}}.ok())); -} diff --git a/libcxx/test/std/utilities/time/time.cal/time.cal.md/time.cal.md.nonmembers/comparisons.pass.cpp b/libcxx/test/std/utilities/time/time.cal/time.cal.md/time.cal.md.nonmembers/comparisons.pass.cpp deleted file mode 100644 index 4a5a6c9cb98e..000000000000 --- a/libcxx/test/std/utilities/time/time.cal/time.cal.md/time.cal.md.nonmembers/comparisons.pass.cpp +++ /dev/null @@ -1,70 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// -// UNSUPPORTED: c++03, c++11, c++14, c++17 - -// -// class month_day; - -// constexpr bool operator==(const month_day& x, const month_day& y) noexcept; -// Returns: x.month() == y.month() && x.day() == y.day(). -// -// constexpr bool operator< (const month_day& x, const month_day& y) noexcept; -// Returns: -// If x.month() < y.month() returns true. -// Otherwise, if x.month() > y.month() returns false. -// Otherwise, returns x.day() < y.day(). - -#include -#include -#include - -#include "test_macros.h" -#include "test_comparisons.h" - -int main() -{ - using day = std::chrono::day; - using month = std::chrono::month; - using month_day = std::chrono::month_day; - - AssertComparisons6AreNoexcept(); - AssertComparisons6ReturnBool(); - - static_assert( testComparisons6( - month_day{std::chrono::January, day{1}}, - month_day{std::chrono::January, day{1}}, - true, false), ""); - - static_assert( testComparisons6( - month_day{std::chrono::January, day{1}}, - month_day{std::chrono::January, day{2}}, - false, true), ""); - - static_assert( testComparisons6( - month_day{std::chrono::January, day{1}}, - month_day{std::chrono::February, day{1}}, - false, true), ""); - -// same day, different months - for (unsigned i = 1; i < 12; ++i) - for (unsigned j = 1; j < 12; ++j) - assert((testComparisons6( - month_day{month{i}, day{1}}, - month_day{month{j}, day{1}}, - i == j, i < j ))); - -// same month, different days - for (unsigned i = 1; i < 31; ++i) - for (unsigned j = 1; j < 31; ++j) - assert((testComparisons6( - month_day{month{2}, day{i}}, - month_day{month{2}, day{j}}, - i == j, i < j ))); - -} diff --git a/libcxx/test/std/utilities/time/time.cal/time.cal.md/time.cal.md.nonmembers/streaming.pass.cpp b/libcxx/test/std/utilities/time/time.cal/time.cal.md/time.cal.md.nonmembers/streaming.pass.cpp deleted file mode 100644 index a197a3e1e936..000000000000 --- a/libcxx/test/std/utilities/time/time.cal/time.cal.md/time.cal.md.nonmembers/streaming.pass.cpp +++ /dev/null @@ -1,41 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// -// UNSUPPORTED: c++03, c++11, c++14, c++17 -// XFAIL: * - -// -// class month_day; - -// template -// basic_ostream& -// operator<<(basic_ostream& os, const month_day& md); -// -// Returns: os << md.month() << '/' << md.day(). -// -// template -// basic_ostream& -// to_stream(basic_ostream& os, const charT* fmt, const month_day& md); -// -// Effects: Streams md into os using the format specified by the NTCTS fmt. -// fmt encoding follows the rules specified in 25.11. - - -#include -#include -#include -#include -#include "test_macros.h" - -int main() -{ - using month_day = std::chrono::month_day; - using month = std::chrono::month; - using day = std::chrono::day; - std::cout << month_day{month{1}, day{1}}; -} diff --git a/libcxx/test/std/utilities/time/time.cal/time.cal.md/types.pass.cpp b/libcxx/test/std/utilities/time/time.cal/time.cal.md/types.pass.cpp deleted file mode 100644 index 2a85c79feccb..000000000000 --- a/libcxx/test/std/utilities/time/time.cal/time.cal.md/types.pass.cpp +++ /dev/null @@ -1,26 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// -// UNSUPPORTED: c++03, c++11, c++14, c++17 - -// -// class month_day; - -#include -#include -#include - -#include "test_macros.h" - -int main() -{ - using month_day = std::chrono::month_day; - - static_assert(std::is_trivially_copyable_v, ""); - static_assert(std::is_standard_layout_v, ""); -} diff --git a/libcxx/test/std/utilities/time/time.cal/time.cal.mdlast/comparisons.pass.cpp b/libcxx/test/std/utilities/time/time.cal/time.cal.mdlast/comparisons.pass.cpp deleted file mode 100644 index f8c74bbd0ab4..000000000000 --- a/libcxx/test/std/utilities/time/time.cal/time.cal.mdlast/comparisons.pass.cpp +++ /dev/null @@ -1,43 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// -// UNSUPPORTED: c++03, c++11, c++14, c++17 - -// -// class month_day_last; - -// constexpr bool operator==(const month_day& x, const month_day& y) noexcept; -// Returns: x.month() == y.month() -// -// constexpr bool operator< (const month_day& x, const month_day& y) noexcept; -// Returns: x.month() < y.month() - - -#include -#include -#include - -#include "test_macros.h" -#include "test_comparisons.h" - -int main() -{ - using month = std::chrono::month; - using month_day_last = std::chrono::month_day_last; - - AssertComparisons6AreNoexcept(); - AssertComparisons6ReturnBool(); - - static_assert( testComparisons6Values(month{1}, month{1}), ""); - static_assert( testComparisons6Values(month{1}, month{2}), ""); - -// same day, different months - for (unsigned i = 1; i < 12; ++i) - for (unsigned j = 1; j < 12; ++j) - assert((testComparisons6Values(month{i}, month{j}))); -} diff --git a/libcxx/test/std/utilities/time/time.cal/time.cal.mdlast/ctor.pass.cpp b/libcxx/test/std/utilities/time/time.cal/time.cal.mdlast/ctor.pass.cpp deleted file mode 100644 index 3a16ca4d9730..000000000000 --- a/libcxx/test/std/utilities/time/time.cal/time.cal.mdlast/ctor.pass.cpp +++ /dev/null @@ -1,41 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// -// UNSUPPORTED: c++03, c++11, c++14, c++17 - -// -// class month_day_last; - -// constexpr month_day_last(const chrono::month& m) noexcept; -// -// Effects: Constructs an object of type month_day_last by initializing m_ with m -// -// constexpr chrono::month month() const noexcept; -// constexpr bool ok() const noexcept; - -#include -#include -#include - -#include "test_macros.h" - -int main() -{ - using month = std::chrono::month; - using month_day_last = std::chrono::month_day_last; - - ASSERT_NOEXCEPT(month_day_last{month{1}}); - - constexpr month_day_last md0{month{}}; - static_assert( md0.month() == month{}, ""); - static_assert(!md0.ok(), ""); - - constexpr month_day_last md1{std::chrono::January}; - static_assert( md1.month() == std::chrono::January, ""); - static_assert( md1.ok(), ""); -} diff --git a/libcxx/test/std/utilities/time/time.cal/time.cal.mdlast/month.pass.cpp b/libcxx/test/std/utilities/time/time.cal/time.cal.mdlast/month.pass.cpp deleted file mode 100644 index b81d799c2893..000000000000 --- a/libcxx/test/std/utilities/time/time.cal/time.cal.mdlast/month.pass.cpp +++ /dev/null @@ -1,38 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// -// UNSUPPORTED: c++03, c++11, c++14, c++17 - -// -// class month_day_last; - -// constexpr chrono::month month() const noexcept; -// Returns: m_ - -#include -#include -#include - -#include "test_macros.h" - -int main() -{ - using month = std::chrono::month; - using month_day_last = std::chrono::month_day_last; - - ASSERT_NOEXCEPT( std::declval().month()); - ASSERT_SAME_TYPE(month, decltype(std::declval().month())); - - static_assert( month_day_last{month{}}.month() == month{}, ""); - - for (unsigned i = 1; i <= 50; ++i) - { - month_day_last mdl(month{i}); - assert( static_cast(mdl.month()) == i); - } -} diff --git a/libcxx/test/std/utilities/time/time.cal/time.cal.mdlast/ok.pass.cpp b/libcxx/test/std/utilities/time/time.cal/time.cal.mdlast/ok.pass.cpp deleted file mode 100644 index 8d97eb601fdc..000000000000 --- a/libcxx/test/std/utilities/time/time.cal/time.cal.mdlast/ok.pass.cpp +++ /dev/null @@ -1,46 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// -// UNSUPPORTED: c++03, c++11, c++14, c++17 - -// -// class month_day_last; - -// constexpr bool ok() const noexcept; -// Returns: m_.ok() - -#include -#include -#include - -#include "test_macros.h" - -int main() -{ - using month = std::chrono::month; - using month_day_last = std::chrono::month_day_last; - - ASSERT_NOEXCEPT( std::declval().ok()); - ASSERT_SAME_TYPE(bool, decltype(std::declval().ok())); - - static_assert(!month_day_last{month{}}.ok(), ""); - static_assert( month_day_last{std::chrono::May}.ok(), ""); - - for (unsigned i = 1; i <= 12; ++i) - { - month_day_last mdl{month{i}}; - assert( mdl.ok()); - } - -// If the month is not ok, all the days are bad - for (unsigned i = 13; i <= 50; ++i) - { - month_day_last mdl{month{i}}; - assert(!mdl.ok()); - } -} diff --git a/libcxx/test/std/utilities/time/time.cal/time.cal.mdlast/streaming.pass.cpp b/libcxx/test/std/utilities/time/time.cal/time.cal.mdlast/streaming.pass.cpp deleted file mode 100644 index 693acd89eb1c..000000000000 --- a/libcxx/test/std/utilities/time/time.cal/time.cal.mdlast/streaming.pass.cpp +++ /dev/null @@ -1,34 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// -// UNSUPPORTED: c++03, c++11, c++14, c++17 -// XFAIL: * - -// -// class month_day_last; -// -// template -// basic_ostream& -// operator<<(basic_ostream& os, const month_day_last& mdl); -// -// Returns: os << mdl.month() << "/last". - - -#include -#include -#include -#include - -#include "test_macros.h" - -int main() -{ - using month_day_last = std::chrono::month_day_last; - using month = std::chrono::month; - std::cout << month_day_last{month{1}}; -} diff --git a/libcxx/test/std/utilities/time/time.cal/time.cal.mdlast/types.pass.cpp b/libcxx/test/std/utilities/time/time.cal/time.cal.mdlast/types.pass.cpp deleted file mode 100644 index f50d22affaf2..000000000000 --- a/libcxx/test/std/utilities/time/time.cal/time.cal.mdlast/types.pass.cpp +++ /dev/null @@ -1,27 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// -// UNSUPPORTED: c++03, c++11, c++14, c++17 - -// - -// class month_day_last; - -#include -#include -#include - -#include "test_macros.h" - -int main() -{ - using month_day_last = std::chrono::month_day_last; - - static_assert(std::is_trivially_copyable_v, ""); - static_assert(std::is_standard_layout_v, ""); -} diff --git a/libcxx/test/std/utilities/time/time.cal/time.cal.month/time.cal.month.members/ctor.pass.cpp b/libcxx/test/std/utilities/time/time.cal/time.cal.month/time.cal.month.members/ctor.pass.cpp deleted file mode 100644 index e9a7abce31b8..000000000000 --- a/libcxx/test/std/utilities/time/time.cal/time.cal.month/time.cal.month.members/ctor.pass.cpp +++ /dev/null @@ -1,46 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// -// UNSUPPORTED: c++03, c++11, c++14, c++17 - -// -// class month; - -// month() = default; -// explicit constexpr month(int m) noexcept; -// explicit constexpr operator int() const noexcept; - -// Effects: Constructs an object of type month by initializing m_ with m. -// The value held is unspecified if d is not in the range [0, 255]. - -#include -#include -#include - -#include "test_macros.h" - -int main() -{ - using month = std::chrono::month; - - ASSERT_NOEXCEPT(month{}); - ASSERT_NOEXCEPT(month(1)); - ASSERT_NOEXCEPT(static_cast(month(1))); - - constexpr month m0{}; - static_assert(static_cast(m0) == 0, ""); - - constexpr month m1{1}; - static_assert(static_cast(m1) == 1, ""); - - for (unsigned i = 0; i <= 255; ++i) - { - month m(i); - assert(static_cast(m) == i); - } -} diff --git a/libcxx/test/std/utilities/time/time.cal/time.cal.month/time.cal.month.members/decrement.pass.cpp b/libcxx/test/std/utilities/time/time.cal/time.cal.month/time.cal.month.members/decrement.pass.cpp deleted file mode 100644 index bc39bbc31bd5..000000000000 --- a/libcxx/test/std/utilities/time/time.cal/time.cal.month/time.cal.month.members/decrement.pass.cpp +++ /dev/null @@ -1,53 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// -// UNSUPPORTED: c++03, c++11, c++14, c++17 - -// -// class month; - -// constexpr month& operator--() noexcept; -// constexpr month operator--(int) noexcept; - - -#include -#include -#include - -#include "test_macros.h" - -template -constexpr bool testConstexpr() -{ - M m1{10}; - if (static_cast(--m1) != 9) return false; - if (static_cast(m1--) != 9) return false; - if (static_cast(m1) != 8) return false; - return true; -} - -int main() -{ - using month = std::chrono::month; - - ASSERT_NOEXCEPT(--(std::declval()) ); - ASSERT_NOEXCEPT( (std::declval())--); - - ASSERT_SAME_TYPE(month , decltype( std::declval()--)); - ASSERT_SAME_TYPE(month&, decltype(--std::declval() )); - - static_assert(testConstexpr(), ""); - - for (unsigned i = 10; i <= 20; ++i) - { - month month(i); - assert(static_cast(--month) == i - 1); - assert(static_cast(month--) == i - 1); - assert(static_cast(month) == i - 2); - } -} diff --git a/libcxx/test/std/utilities/time/time.cal/time.cal.month/time.cal.month.members/increment.pass.cpp b/libcxx/test/std/utilities/time/time.cal/time.cal.month/time.cal.month.members/increment.pass.cpp deleted file mode 100644 index bdedd6e65315..000000000000 --- a/libcxx/test/std/utilities/time/time.cal/time.cal.month/time.cal.month.members/increment.pass.cpp +++ /dev/null @@ -1,52 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// -// UNSUPPORTED: c++03, c++11, c++14, c++17 - -// -// class month; - -// constexpr month& operator++() noexcept; -// constexpr month operator++(int) noexcept; - - -#include -#include -#include - -#include "test_macros.h" - -template -constexpr bool testConstexpr() -{ - M m1{1}; - if (static_cast(++m1) != 2) return false; - if (static_cast(m1++) != 2) return false; - if (static_cast(m1) != 3) return false; - return true; -} - -int main() -{ - using month = std::chrono::month; - ASSERT_NOEXCEPT(++(std::declval()) ); - ASSERT_NOEXCEPT( (std::declval())++); - - ASSERT_SAME_TYPE(month , decltype( std::declval()++)); - ASSERT_SAME_TYPE(month&, decltype(++std::declval() )); - - static_assert(testConstexpr(), ""); - - for (unsigned i = 0; i <= 10; ++i) - { - month month(i); - assert(static_cast(++month) == i + 1); - assert(static_cast(month++) == i + 1); - assert(static_cast(month) == i + 2); - } -} diff --git a/libcxx/test/std/utilities/time/time.cal/time.cal.month/time.cal.month.members/ok.pass.cpp b/libcxx/test/std/utilities/time/time.cal/time.cal.month/time.cal.month.members/ok.pass.cpp deleted file mode 100644 index 3bf8f67f618d..000000000000 --- a/libcxx/test/std/utilities/time/time.cal/time.cal.month/time.cal.month.members/ok.pass.cpp +++ /dev/null @@ -1,38 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// -// UNSUPPORTED: c++03, c++11, c++14, c++17 - -// -// class month; - -// constexpr bool ok() const noexcept; -// Returns: 1 <= d_ && d_ <= 12 - -#include -#include -#include - -#include "test_macros.h" - -int main() -{ - using month = std::chrono::month; - - ASSERT_NOEXCEPT( std::declval().ok()); - ASSERT_SAME_TYPE(bool, decltype(std::declval().ok())); - - static_assert(!month{0}.ok(), ""); - static_assert( month{1}.ok(), ""); - - assert(!month{0}.ok()); - for (unsigned i = 1; i <= 12; ++i) - assert(month{i}.ok()); - for (unsigned i = 13; i <= 255; ++i) - assert(!month{i}.ok()); -} diff --git a/libcxx/test/std/utilities/time/time.cal/time.cal.month/time.cal.month.members/plus_minus_equal.pass.cpp b/libcxx/test/std/utilities/time/time.cal/time.cal.month/time.cal.month.members/plus_minus_equal.pass.cpp deleted file mode 100644 index 84d6e9c68375..000000000000 --- a/libcxx/test/std/utilities/time/time.cal/time.cal.month/time.cal.month.members/plus_minus_equal.pass.cpp +++ /dev/null @@ -1,67 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// -// UNSUPPORTED: c++03, c++11, c++14, c++17 - -// -// class month; - -// constexpr month& operator+=(const month& d) noexcept; -// constexpr month& operator-=(const month& d) noexcept; - -#include -#include -#include - -#include "test_macros.h" - -template -constexpr bool testConstexpr() -{ - M m1{1}; - if (static_cast(m1 += Ms{ 1}) != 2) return false; - if (static_cast(m1 += Ms{ 2}) != 4) return false; - if (static_cast(m1 += Ms{ 8}) != 12) return false; - if (static_cast(m1 -= Ms{ 1}) != 11) return false; - if (static_cast(m1 -= Ms{ 2}) != 9) return false; - if (static_cast(m1 -= Ms{ 8}) != 1) return false; - return true; -} - -int main() -{ - using month = std::chrono::month; - using months = std::chrono::months; - - ASSERT_NOEXCEPT(std::declval() += std::declval()); - ASSERT_NOEXCEPT(std::declval() -= std::declval()); - ASSERT_SAME_TYPE(month&, decltype(std::declval() += std::declval())); - ASSERT_SAME_TYPE(month&, decltype(std::declval() -= std::declval())); - - static_assert(testConstexpr(), ""); - - for (unsigned i = 1; i <= 10; ++i) - { - month month(i); - int exp = i + 10; - while (exp > 12) - exp -= 12; - assert(static_cast(month += months{10}) == static_cast(exp)); - assert(static_cast(month) == static_cast(exp)); - } - - for (unsigned i = 1; i <= 10; ++i) - { - month month(i); - int exp = i - 9; - while (exp < 1) - exp += 12; - assert(static_cast(month -= months{ 9}) == static_cast(exp)); - assert(static_cast(month) == static_cast(exp)); - } -} diff --git a/libcxx/test/std/utilities/time/time.cal/time.cal.month/time.cal.month.nonmembers/comparisons.pass.cpp b/libcxx/test/std/utilities/time/time.cal/time.cal.month/time.cal.month.nonmembers/comparisons.pass.cpp deleted file mode 100644 index 59c45d9ddd45..000000000000 --- a/libcxx/test/std/utilities/time/time.cal/time.cal.month/time.cal.month.nonmembers/comparisons.pass.cpp +++ /dev/null @@ -1,47 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// -// UNSUPPORTED: c++03, c++11, c++14, c++17 - -// -// class month; - -// constexpr bool operator==(const month& x, const month& y) noexcept; -// constexpr bool operator!=(const month& x, const month& y) noexcept; -// constexpr bool operator< (const month& x, const month& y) noexcept; -// constexpr bool operator> (const month& x, const month& y) noexcept; -// constexpr bool operator<=(const month& x, const month& y) noexcept; -// constexpr bool operator>=(const month& x, const month& y) noexcept; - - -#include -#include -#include - -#include "test_macros.h" -#include "test_comparisons.h" - - -int main() -{ - using month = std::chrono::month; - - AssertComparisons6AreNoexcept(); - AssertComparisons6ReturnBool(); - - static_assert(testComparisons6Values(0U ,0U), ""); - static_assert(testComparisons6Values(0U, 1U), ""); - -// Some 'ok' values as well - static_assert(testComparisons6Values( 5U, 5U), ""); - static_assert(testComparisons6Values( 5U, 10U), ""); - - for (unsigned i = 1; i < 10; ++i) - for (unsigned j = 10; j < 10; ++j) - assert(testComparisons6Values(i, j)); -} diff --git a/libcxx/test/std/utilities/time/time.cal/time.cal.month/time.cal.month.nonmembers/literals.pass.cpp b/libcxx/test/std/utilities/time/time.cal/time.cal.month/time.cal.month.nonmembers/literals.pass.cpp deleted file mode 100644 index e17852b58bbe..000000000000 --- a/libcxx/test/std/utilities/time/time.cal/time.cal.month/time.cal.month.nonmembers/literals.pass.cpp +++ /dev/null @@ -1,87 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// -// UNSUPPORTED: c++03, c++11, c++14, c++17 - -// - -// inline constexpr month January{1}; -// inline constexpr month February{2}; -// inline constexpr month March{3}; -// inline constexpr month April{4}; -// inline constexpr month May{5}; -// inline constexpr month June{6}; -// inline constexpr month July{7}; -// inline constexpr month August{8}; -// inline constexpr month September{9}; -// inline constexpr month October{10}; -// inline constexpr month November{11}; -// inline constexpr month December{12}; - - -#include -#include -#include - -#include "test_macros.h" - -int main() -{ - - ASSERT_SAME_TYPE(const std::chrono::month, decltype(std::chrono::January)); - ASSERT_SAME_TYPE(const std::chrono::month, decltype(std::chrono::February)); - ASSERT_SAME_TYPE(const std::chrono::month, decltype(std::chrono::March)); - ASSERT_SAME_TYPE(const std::chrono::month, decltype(std::chrono::April)); - ASSERT_SAME_TYPE(const std::chrono::month, decltype(std::chrono::May)); - ASSERT_SAME_TYPE(const std::chrono::month, decltype(std::chrono::June)); - ASSERT_SAME_TYPE(const std::chrono::month, decltype(std::chrono::July)); - ASSERT_SAME_TYPE(const std::chrono::month, decltype(std::chrono::August)); - ASSERT_SAME_TYPE(const std::chrono::month, decltype(std::chrono::September)); - ASSERT_SAME_TYPE(const std::chrono::month, decltype(std::chrono::October)); - ASSERT_SAME_TYPE(const std::chrono::month, decltype(std::chrono::November)); - ASSERT_SAME_TYPE(const std::chrono::month, decltype(std::chrono::December)); - - static_assert( std::chrono::January == std::chrono::month(1), ""); - static_assert( std::chrono::February == std::chrono::month(2), ""); - static_assert( std::chrono::March == std::chrono::month(3), ""); - static_assert( std::chrono::April == std::chrono::month(4), ""); - static_assert( std::chrono::May == std::chrono::month(5), ""); - static_assert( std::chrono::June == std::chrono::month(6), ""); - static_assert( std::chrono::July == std::chrono::month(7), ""); - static_assert( std::chrono::August == std::chrono::month(8), ""); - static_assert( std::chrono::September == std::chrono::month(9), ""); - static_assert( std::chrono::October == std::chrono::month(10), ""); - static_assert( std::chrono::November == std::chrono::month(11), ""); - static_assert( std::chrono::December == std::chrono::month(12), ""); - - assert(std::chrono::January == std::chrono::month(1)); - assert(std::chrono::February == std::chrono::month(2)); - assert(std::chrono::March == std::chrono::month(3)); - assert(std::chrono::April == std::chrono::month(4)); - assert(std::chrono::May == std::chrono::month(5)); - assert(std::chrono::June == std::chrono::month(6)); - assert(std::chrono::July == std::chrono::month(7)); - assert(std::chrono::August == std::chrono::month(8)); - assert(std::chrono::September == std::chrono::month(9)); - assert(std::chrono::October == std::chrono::month(10)); - assert(std::chrono::November == std::chrono::month(11)); - assert(std::chrono::December == std::chrono::month(12)); - - assert(static_cast(std::chrono::January) == 1); - assert(static_cast(std::chrono::February) == 2); - assert(static_cast(std::chrono::March) == 3); - assert(static_cast(std::chrono::April) == 4); - assert(static_cast(std::chrono::May) == 5); - assert(static_cast(std::chrono::June) == 6); - assert(static_cast(std::chrono::July) == 7); - assert(static_cast(std::chrono::August) == 8); - assert(static_cast(std::chrono::September) == 9); - assert(static_cast(std::chrono::October) == 10); - assert(static_cast(std::chrono::November) == 11); - assert(static_cast(std::chrono::December) == 12); -} diff --git a/libcxx/test/std/utilities/time/time.cal/time.cal.month/time.cal.month.nonmembers/minus.pass.cpp b/libcxx/test/std/utilities/time/time.cal/time.cal.month/time.cal.month.nonmembers/minus.pass.cpp deleted file mode 100644 index 055a28755268..000000000000 --- a/libcxx/test/std/utilities/time/time.cal/time.cal.month/time.cal.month.nonmembers/minus.pass.cpp +++ /dev/null @@ -1,72 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// -// UNSUPPORTED: c++03, c++11, c++14, c++17 - -// -// class month; - -// constexpr month operator-(const month& x, const months& y) noexcept; -// Returns: x + -y. -// -// constexpr months operator-(const month& x, const month& y) noexcept; -// Returns: If x.ok() == true and y.ok() == true, returns a value m in the range -// [months{0}, months{11}] satisfying y + m == x. -// Otherwise the value returned is unspecified. -// [Example: January - February == months{11}. —end example] - -extern "C" int printf(const char *, ...); - -#include -#include -#include - -#include "test_macros.h" - -template -constexpr bool testConstexpr() -{ - { - M m{5}; - Ms offset{3}; - if (m - offset != M{2}) return false; - if (m - M{2} != offset) return false; - } - -// Check the example - if (M{1} - M{2} != Ms{11}) return false; - return true; -} - -#include - -int main() -{ - using month = std::chrono::month; - using months = std::chrono::months; - - ASSERT_NOEXCEPT(std::declval() - std::declval()); - ASSERT_NOEXCEPT(std::declval() - std::declval()); - - ASSERT_SAME_TYPE(month , decltype(std::declval() - std::declval())); - ASSERT_SAME_TYPE(months, decltype(std::declval() - std::declval ())); - -static_assert(testConstexpr(), ""); - - month m{6}; - for (unsigned i = 1; i <= 12; ++i) - { - month m1 = m - months{i}; -// months off = m - month {i}; - int exp = 6 - i; - if (exp < 1) - exp += 12; - assert(static_cast(m1) == static_cast(exp)); -// assert(off.count() == static_cast(exp)); - } -} diff --git a/libcxx/test/std/utilities/time/time.cal/time.cal.month/time.cal.month.nonmembers/plus.pass.cpp b/libcxx/test/std/utilities/time/time.cal/time.cal.month/time.cal.month.nonmembers/plus.pass.cpp deleted file mode 100644 index 31fc277cb14c..000000000000 --- a/libcxx/test/std/utilities/time/time.cal/time.cal.month/time.cal.month.nonmembers/plus.pass.cpp +++ /dev/null @@ -1,72 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// -// UNSUPPORTED: c++03, c++11, c++14, c++17 - -// -// class month; - -// constexpr month operator+(const month& x, const months& y) noexcept; -// Returns: month(int{x} + y.count()). -// -// constexpr month operator+(const months& x, const month& y) noexcept; -// Returns: -// month{modulo(static_cast(int{x}) + (y.count() - 1), 12) + 1} -// where modulo(n, 12) computes the remainder of n divided by 12 using Euclidean division. -// [Note: Given a divisor of 12, Euclidean division truncates towards negative infinity -// and always produces a remainder in the range of [0, 11]. -// Assuming no overflow in the signed summation, this operation results in a month -// holding a value in the range [1, 12] even if !x.ok(). —end note] -// [Example: February + months{11} == January. —end example] - - - -#include -#include -#include - -#include "test_macros.h" - -template -constexpr bool testConstexpr() -{ - M m{1}; - Ms offset{4}; - if (m + offset != M{5}) return false; - if (offset + m != M{5}) return false; -// Check the example - if (M{2} + Ms{11} != M{1}) return false; - return true; -} - -int main() -{ - using month = std::chrono::month; - using months = std::chrono::months; - - ASSERT_NOEXCEPT(std::declval() + std::declval()); - ASSERT_NOEXCEPT(std::declval() + std::declval()); - - ASSERT_SAME_TYPE(month, decltype(std::declval() + std::declval())); - ASSERT_SAME_TYPE(month, decltype(std::declval() + std::declval() )); - - static_assert(testConstexpr(), ""); - - month my{2}; - for (unsigned i = 0; i <= 15; ++i) - { - month m1 = my + months{i}; - month m2 = months{i} + my; - assert(m1 == m2); - unsigned exp = i + 2; - while (exp > 12) - exp -= 12; - assert(static_cast(m1) == exp); - assert(static_cast(m2) == exp); - } -} diff --git a/libcxx/test/std/utilities/time/time.cal/time.cal.month/time.cal.month.nonmembers/streaming.pass.cpp b/libcxx/test/std/utilities/time/time.cal/time.cal.month/time.cal.month.nonmembers/streaming.pass.cpp deleted file mode 100644 index 274360de44aa..000000000000 --- a/libcxx/test/std/utilities/time/time.cal/time.cal.month/time.cal.month.nonmembers/streaming.pass.cpp +++ /dev/null @@ -1,53 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// -// UNSUPPORTED: c++03, c++11, c++14, c++17 -// XFAIL: * - -// -// class month; - -// template -// basic_ostream& -// operator<<(basic_ostream& os, const month& m); -// -// Effects: If m.ok() == true inserts format(os.getloc(), fmt, m) where fmt is "%b" widened to charT. -// Otherwise inserts int{m} << " is not a valid month". -// -// template -// basic_ostream& -// to_stream(basic_ostream& os, const charT* fmt, const month& m); -// -// Effects: Streams m into os using the format specified by the NTCTS fmt. -// fmt encoding follows the rules specified in 25.11. -// -// template> -// basic_istream& -// from_stream(basic_istream& is, const charT* fmt, -// month& m, basic_string* abbrev = nullptr, -// minutes* offset = nullptr); -// -// Effects: Attempts to parse the input stream is into the month m using the format flags -// given in the NTCTS fmt as specified in 25.12. If the parse fails to decode a valid month, -// is.setstate(ios_- base::failbit) shall be called and m shall not be modified. -// If %Z is used and successfully parsed, that value will be assigned to *abbrev if -// abbrev is non-null. If %z (or a modified variant) is used and successfully parsed, -// that value will be assigned to *offset if offset is non-null. - -#include -#include -#include -#include - -#include "test_macros.h" - -int main() -{ - using month = std::chrono::month; - std::cout << month{1}; -} diff --git a/libcxx/test/std/utilities/time/time.cal/time.cal.month/types.pass.cpp b/libcxx/test/std/utilities/time/time.cal/time.cal.month/types.pass.cpp deleted file mode 100644 index e0dc20e1100c..000000000000 --- a/libcxx/test/std/utilities/time/time.cal/time.cal.month/types.pass.cpp +++ /dev/null @@ -1,26 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// -// UNSUPPORTED: c++03, c++11, c++14, c++17 - -// -// class month; - -#include -#include -#include - -#include "test_macros.h" - -int main() -{ - using month = std::chrono::month; - - static_assert(std::is_trivially_copyable_v, ""); - static_assert(std::is_standard_layout_v, ""); -} diff --git a/libcxx/test/std/utilities/time/time.cal/time.cal.mwd/time.cal.mwd.members/ctor.pass.cpp b/libcxx/test/std/utilities/time/time.cal/time.cal.mwd/time.cal.mwd.members/ctor.pass.cpp deleted file mode 100644 index 9b952c4ad82c..000000000000 --- a/libcxx/test/std/utilities/time/time.cal/time.cal.mwd/time.cal.mwd.members/ctor.pass.cpp +++ /dev/null @@ -1,46 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// -// UNSUPPORTED: c++03, c++11, c++14, c++17 - -// -// class month_weekday; -// month_weekday represents the nth weekday of a month, of an as yet unspecified year. - -// constexpr month_weekday(const chrono::month& m, const chrono::weekday_indexed& wdi) noexcept; -// Effects: Constructs an object of type month_weekday by initializing m_ with m, and wdi_ with wdi. -// -// constexpr chrono::month month() const noexcept; -// constexpr chrono::weekday_indexed weekday_indexed() const noexcept; -// constexpr bool ok() const noexcept; - -#include -#include -#include - -#include "test_macros.h" - -int main() -{ - using month_weekday = std::chrono::month_weekday; - using month = std::chrono::month; - using weekday = std::chrono::weekday; - using weekday_indexed = std::chrono::weekday_indexed; - - ASSERT_NOEXCEPT(month_weekday{month{1}, weekday_indexed{weekday{}, 1}}); - - constexpr month_weekday md0{month{}, weekday_indexed{}}; - static_assert( md0.month() == month{}, ""); - static_assert( md0.weekday_indexed() == weekday_indexed{}, ""); - static_assert(!md0.ok(), ""); - - constexpr month_weekday md1{std::chrono::January, weekday_indexed{std::chrono::Friday, 4}}; - static_assert( md1.month() == std::chrono::January, ""); - static_assert( md1.weekday_indexed() == weekday_indexed{std::chrono::Friday, 4}, ""); - static_assert( md1.ok(), ""); -} diff --git a/libcxx/test/std/utilities/time/time.cal/time.cal.mwd/time.cal.mwd.members/month.pass.cpp b/libcxx/test/std/utilities/time/time.cal/time.cal.mwd/time.cal.mwd.members/month.pass.cpp deleted file mode 100644 index 21d2748f6b96..000000000000 --- a/libcxx/test/std/utilities/time/time.cal/time.cal.mwd/time.cal.mwd.members/month.pass.cpp +++ /dev/null @@ -1,42 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// -// UNSUPPORTED: c++03, c++11, c++14, c++17 - -// -// class month_weekday; - -// constexpr chrono::month month() const noexcept; -// Returns: wd_ - -#include -#include -#include - -#include "test_macros.h" - -int main() -{ - using month_weekday = std::chrono::month_weekday; - using month = std::chrono::month; - using weekday = std::chrono::weekday; - using weekday_indexed = std::chrono::weekday_indexed; - - constexpr weekday Sunday = std::chrono::Sunday; - - ASSERT_NOEXCEPT( std::declval().month()); - ASSERT_SAME_TYPE(month, decltype(std::declval().month())); - - static_assert( month_weekday{}.month() == month{}, ""); - - for (unsigned i = 1; i <= 50; ++i) - { - month_weekday md(month{i}, weekday_indexed{Sunday, 1}); - assert( static_cast(md.month()) == i); - } -} diff --git a/libcxx/test/std/utilities/time/time.cal/time.cal.mwd/time.cal.mwd.members/ok.pass.cpp b/libcxx/test/std/utilities/time/time.cal/time.cal.mwd/time.cal.mwd.members/ok.pass.cpp deleted file mode 100644 index bb1bd3566c2f..000000000000 --- a/libcxx/test/std/utilities/time/time.cal/time.cal.mwd/time.cal.mwd.members/ok.pass.cpp +++ /dev/null @@ -1,51 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// -// UNSUPPORTED: c++03, c++11, c++14, c++17 - -// -// class month_weekday; - -// constexpr bool ok() const noexcept; -// Returns: m_.ok() && wdi_.ok(). - -#include -#include -#include - -#include "test_macros.h" - -int main() -{ - using month_weekday = std::chrono::month_weekday; - using month = std::chrono::month; - using weekday = std::chrono::weekday; - using weekday_indexed = std::chrono::weekday_indexed; - - constexpr weekday Sunday = std::chrono::Sunday; - - ASSERT_NOEXCEPT( std::declval().ok()); - ASSERT_SAME_TYPE(bool, decltype(std::declval().ok())); - - static_assert(!month_weekday{month{}, weekday_indexed{}}.ok(), ""); - static_assert( month_weekday{std::chrono::May, weekday_indexed{Sunday, 2}}.ok(), ""); - - assert(!(month_weekday(std::chrono::April, weekday_indexed{Sunday, 0}).ok())); - assert( (month_weekday{std::chrono::March, weekday_indexed{Sunday, 1}}.ok())); - - for (unsigned i = 1; i <= 12; ++i) - for (unsigned j = 0; j <= 6; ++j) - { - month_weekday mwd{month{i}, weekday_indexed{Sunday, j}}; - assert(mwd.ok() == (j >= 1 && j <= 5)); - } - -// If the month is not ok, all the weekday_indexed are bad - for (unsigned i = 1; i <= 10; ++i) - assert(!(month_weekday{month{13}, weekday_indexed{Sunday, i}}.ok())); -} diff --git a/libcxx/test/std/utilities/time/time.cal/time.cal.mwd/time.cal.mwd.members/weekday_indexed.pass.cpp b/libcxx/test/std/utilities/time/time.cal/time.cal.mwd/time.cal.mwd.members/weekday_indexed.pass.cpp deleted file mode 100644 index 9aebab26f4b0..000000000000 --- a/libcxx/test/std/utilities/time/time.cal/time.cal.mwd/time.cal.mwd.members/weekday_indexed.pass.cpp +++ /dev/null @@ -1,43 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// -// UNSUPPORTED: c++03, c++11, c++14, c++17 - -// -// class month_weekday; - -// constexpr chrono::weekday_indexed weekday_indexed() const noexcept; -// Returns: wdi_ - -#include -#include -#include - -#include "test_macros.h" - -int main() -{ - using month_weekday = std::chrono::month_weekday; - using month = std::chrono::month; - using weekday = std::chrono::weekday; - using weekday_indexed = std::chrono::weekday_indexed; - - constexpr weekday Sunday = std::chrono::Sunday; - - ASSERT_NOEXCEPT( std::declval().weekday_indexed()); - ASSERT_SAME_TYPE(weekday_indexed, decltype(std::declval().weekday_indexed())); - - static_assert( month_weekday{month{}, weekday_indexed{}}.weekday_indexed() == weekday_indexed{}, ""); - - for (unsigned i = 1; i <= 10; ++i) - { - month_weekday md(std::chrono::March, weekday_indexed{Sunday, i}); - assert( static_cast(md.weekday_indexed().weekday() == Sunday)); - assert( static_cast(md.weekday_indexed().index() == i)); - } -} diff --git a/libcxx/test/std/utilities/time/time.cal/time.cal.mwd/time.cal.mwd.nonmembers/comparisons.pass.cpp b/libcxx/test/std/utilities/time/time.cal/time.cal.mwd/time.cal.mwd.nonmembers/comparisons.pass.cpp deleted file mode 100644 index 60361382d2ae..000000000000 --- a/libcxx/test/std/utilities/time/time.cal/time.cal.mwd/time.cal.mwd.nonmembers/comparisons.pass.cpp +++ /dev/null @@ -1,86 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// -// UNSUPPORTED: c++03, c++11, c++14, c++17 - -// -// class month_weekday; - -// constexpr bool operator==(const month_weekday& x, const month_weekday& y) noexcept; -// Returns: x.month() == y.month() && x.day() == y.day(). -// - -#include -#include -#include - -#include "test_macros.h" -#include "test_comparisons.h" - -int main() -{ - using month_weekday = std::chrono::month_weekday; - using month = std::chrono::month; - using weekday_indexed = std::chrono::weekday_indexed; - using weekday = std::chrono::weekday; - - constexpr weekday Sunday = std::chrono::Sunday; - constexpr weekday Monday = std::chrono::Monday; - - AssertComparisons2AreNoexcept(); - AssertComparisons2ReturnBool(); - - static_assert( testComparisons2( - month_weekday{std::chrono::January, weekday_indexed{Sunday, 1}}, - month_weekday{std::chrono::January, weekday_indexed{Sunday, 1}}, - true), ""); - - static_assert( testComparisons2( - month_weekday{std::chrono::January, weekday_indexed{Sunday, 1}}, - month_weekday{std::chrono::January, weekday_indexed{Sunday, 2}}, - false), ""); - - static_assert( testComparisons2( - month_weekday{std::chrono::January, weekday_indexed{Sunday, 1}}, - month_weekday{std::chrono::February, weekday_indexed{Sunday, 1}}, - false), ""); - - static_assert( testComparisons2( - month_weekday{std::chrono::January, weekday_indexed{Monday, 1}}, - month_weekday{std::chrono::January, weekday_indexed{Sunday, 2}}, - false), ""); - - static_assert( testComparisons2( - month_weekday{std::chrono::January, weekday_indexed{Monday, 1}}, - month_weekday{std::chrono::February, weekday_indexed{Sunday, 1}}, - false), ""); - -// same day, different months - for (unsigned i = 1; i < 12; ++i) - for (unsigned j = 1; j < 12; ++j) - assert((testComparisons2( - month_weekday{month{i}, weekday_indexed{Sunday, 1}}, - month_weekday{month{j}, weekday_indexed{Sunday, 1}}, - i == j))); - -// same month, different weeks - for (unsigned i = 1; i < 5; ++i) - for (unsigned j = 1; j < 5; ++j) - assert((testComparisons2( - month_weekday{month{2}, weekday_indexed{Sunday, i}}, - month_weekday{month{2}, weekday_indexed{Sunday, j}}, - i == j))); - -// same month, different days - for (unsigned i = 0; i < 6; ++i) - for (unsigned j = 0; j < 6; ++j) - assert((testComparisons2( - month_weekday{month{2}, weekday_indexed{weekday{i}, 2}}, - month_weekday{month{2}, weekday_indexed{weekday{j}, 2}}, - i == j))); -} diff --git a/libcxx/test/std/utilities/time/time.cal/time.cal.mwd/time.cal.mwd.nonmembers/streaming.pass.cpp b/libcxx/test/std/utilities/time/time.cal/time.cal.mwd/time.cal.mwd.nonmembers/streaming.pass.cpp deleted file mode 100644 index be2e46adda90..000000000000 --- a/libcxx/test/std/utilities/time/time.cal/time.cal.mwd/time.cal.mwd.nonmembers/streaming.pass.cpp +++ /dev/null @@ -1,36 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// -// UNSUPPORTED: c++03, c++11, c++14, c++17 -// XFAIL: * - -// -// class month_weekday; - -// template -// basic_ostream& -// operator<<(basic_ostream& os, const month_weekday& mwd); -// -// Returns: os << mwd.month() << '/' << mwd.weekday_indexed(). - -#include -#include -#include -#include - -#include "test_macros.h" - -int main() -{ - using month_weekday = std::chrono::month_weekday; - using month = std::chrono::month; - using weekday_indexed = std::chrono::weekday_indexed; - using weekday = std::chrono::weekday; - - std::cout << month_weekday{month{1}, weekday_indexed{weekday{3}, 3}}; -} diff --git a/libcxx/test/std/utilities/time/time.cal/time.cal.mwd/types.pass.cpp b/libcxx/test/std/utilities/time/time.cal/time.cal.mwd/types.pass.cpp deleted file mode 100644 index 2fcf9b0feaf8..000000000000 --- a/libcxx/test/std/utilities/time/time.cal/time.cal.mwd/types.pass.cpp +++ /dev/null @@ -1,26 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// -// UNSUPPORTED: c++03, c++11, c++14, c++17 - -// -// class month_weekday; - -#include -#include -#include - -#include "test_macros.h" - -int main() -{ - using month_weekday = std::chrono::month_weekday; - - static_assert(std::is_trivially_copyable_v, ""); - static_assert(std::is_standard_layout_v, ""); -} diff --git a/libcxx/test/std/utilities/time/time.cal/time.cal.mwdlast/time.cal.mwdlast.members/ctor.pass.cpp b/libcxx/test/std/utilities/time/time.cal/time.cal.mwdlast/time.cal.mwdlast.members/ctor.pass.cpp deleted file mode 100644 index 25cfed69bab4..000000000000 --- a/libcxx/test/std/utilities/time/time.cal/time.cal.mwdlast/time.cal.mwdlast.members/ctor.pass.cpp +++ /dev/null @@ -1,60 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// -// UNSUPPORTED: c++03, c++11, c++14, c++17 - -// -// class month_weekday_last; - -// constexpr month_weekday_last(const chrono::month& m, -// const chrono::weekday_last& wdl) noexcept; -// -// Effects: Constructs an object of type month_weekday_last by -// initializing m_ with m, and wdl_ with wdl. -// -// constexpr chrono::month month() const noexcept; -// constexpr chrono::weekday_last weekday_last() const noexcept; -// constexpr bool ok() const noexcept; - - -#include -#include -#include - -#include "test_macros.h" - -int main() -{ - using month = std::chrono::month; - using weekday = std::chrono::weekday; - using weekday_last = std::chrono::weekday_last; - using month_weekday_last = std::chrono::month_weekday_last; - - constexpr month January = std::chrono::January; - constexpr weekday Tuesday = std::chrono::Tuesday; - - ASSERT_NOEXCEPT(month_weekday_last{January, weekday_last{Tuesday}}); - -// bad month - constexpr month_weekday_last mwdl1{month{}, weekday_last{Tuesday}}; - static_assert( mwdl1.month() == month{}, ""); - static_assert( mwdl1.weekday_last() == weekday_last{Tuesday}, ""); - static_assert(!mwdl1.ok(), ""); - -// bad weekday_last - constexpr month_weekday_last mwdl2{January, weekday_last{weekday{16}}}; - static_assert( mwdl2.month() == January, ""); - static_assert( mwdl2.weekday_last() == weekday_last{weekday{16}}, ""); - static_assert(!mwdl2.ok(), ""); - -// Good month and weekday_last - constexpr month_weekday_last mwdl3{January, weekday_last{weekday{4}}}; - static_assert( mwdl3.month() == January, ""); - static_assert( mwdl3.weekday_last() == weekday_last{weekday{4}}, ""); - static_assert( mwdl3.ok(), ""); -} diff --git a/libcxx/test/std/utilities/time/time.cal/time.cal.mwdlast/time.cal.mwdlast.members/month.pass.cpp b/libcxx/test/std/utilities/time/time.cal/time.cal.mwdlast/time.cal.mwdlast.members/month.pass.cpp deleted file mode 100644 index fb3fa5de17b9..000000000000 --- a/libcxx/test/std/utilities/time/time.cal/time.cal.mwdlast/time.cal.mwdlast.members/month.pass.cpp +++ /dev/null @@ -1,42 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// -// UNSUPPORTED: c++03, c++11, c++14, c++17 - -// -// class month_weekday_last; - -// constexpr chrono::month month() const noexcept; -// Returns: m_ - -#include -#include -#include - -#include "test_macros.h" - -int main() -{ - using month = std::chrono::month; - using weekday = std::chrono::weekday; - using weekday_last = std::chrono::weekday_last; - using month_weekday_last = std::chrono::month_weekday_last; - - constexpr weekday Tuesday = std::chrono::Tuesday; - - ASSERT_NOEXCEPT( std::declval().month()); - ASSERT_SAME_TYPE(month, decltype(std::declval().month())); - - static_assert( month_weekday_last{month{}, weekday_last{Tuesday}}.month() == month{}, ""); - - for (unsigned i = 1; i <= 50; ++i) - { - month_weekday_last mdl(month{i}, weekday_last{Tuesday}); - assert( static_cast(mdl.month()) == i); - } -} diff --git a/libcxx/test/std/utilities/time/time.cal/time.cal.mwdlast/time.cal.mwdlast.members/ok.pass.cpp b/libcxx/test/std/utilities/time/time.cal/time.cal.mwdlast/time.cal.mwdlast.members/ok.pass.cpp deleted file mode 100644 index c55a0f66320b..000000000000 --- a/libcxx/test/std/utilities/time/time.cal/time.cal.mwdlast/time.cal.mwdlast.members/ok.pass.cpp +++ /dev/null @@ -1,52 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// -// UNSUPPORTED: c++03, c++11, c++14, c++17 - -// -// class month_weekday_last; - -// constexpr bool ok() const noexcept; -// Returns: m_.ok() && wdl_.ok(). - -#include -#include -#include - -#include "test_macros.h" - -int main() -{ - using month = std::chrono::month; - using weekday = std::chrono::weekday; - using weekday_last = std::chrono::weekday_last; - using month_weekday_last = std::chrono::month_weekday_last; - - constexpr month January = std::chrono::January; - constexpr weekday Tuesday = std::chrono::Tuesday; - constexpr weekday_last lastTuesday = weekday_last{Tuesday}; - - ASSERT_NOEXCEPT( std::declval().ok()); - ASSERT_SAME_TYPE(bool, decltype(std::declval().ok())); - - static_assert(!month_weekday_last{month{}, lastTuesday}.ok(), ""); // Bad month - static_assert(!month_weekday_last{January, weekday_last{weekday{12}}}.ok(), ""); // Bad month - static_assert( month_weekday_last{January, lastTuesday}.ok(), ""); // Both OK - - for (unsigned i = 0; i <= 50; ++i) - { - month_weekday_last mwdl{month{i}, lastTuesday}; - assert( mwdl.ok() == month{i}.ok()); - } - - for (unsigned i = 0; i <= 50; ++i) - { - month_weekday_last mwdl{January, weekday_last{weekday{i}}}; - assert( mwdl.ok() == weekday_last{weekday{i}}.ok()); - } -} diff --git a/libcxx/test/std/utilities/time/time.cal/time.cal.mwdlast/time.cal.mwdlast.members/weekday_last.pass.cpp b/libcxx/test/std/utilities/time/time.cal/time.cal.mwdlast/time.cal.mwdlast.members/weekday_last.pass.cpp deleted file mode 100644 index bf3a44c3fdbf..000000000000 --- a/libcxx/test/std/utilities/time/time.cal/time.cal.mwdlast/time.cal.mwdlast.members/weekday_last.pass.cpp +++ /dev/null @@ -1,44 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// -// UNSUPPORTED: c++03, c++11, c++14, c++17 - -// -// class month_weekday_last; - -// constexpr chrono::weekday_last weekday_last() const noexcept; -// Returns: wdl_ - -#include -#include -#include - -#include "test_macros.h" - -int main() -{ - using month = std::chrono::month; - using weekday = std::chrono::weekday; - using weekday_last = std::chrono::weekday_last; - using month_weekday_last = std::chrono::month_weekday_last; - - constexpr month January = std::chrono::January; - constexpr weekday Tuesday = std::chrono::Tuesday; - constexpr weekday_last lastTuesday = weekday_last{Tuesday}; - - ASSERT_NOEXCEPT( std::declval().weekday_last()); - ASSERT_SAME_TYPE(weekday_last, decltype(std::declval().weekday_last())); - - static_assert( month_weekday_last{month{}, lastTuesday}.weekday_last() == lastTuesday, ""); - - for (unsigned i = 1; i <= 50; ++i) - { - month_weekday_last mdl(January, weekday_last{weekday{i}}); - assert( static_cast(mdl.weekday_last().weekday()) == i); - } -} diff --git a/libcxx/test/std/utilities/time/time.cal/time.cal.mwdlast/time.cal.mwdlast.nonmembers/comparisons.pass.cpp b/libcxx/test/std/utilities/time/time.cal/time.cal.mwdlast/time.cal.mwdlast.nonmembers/comparisons.pass.cpp deleted file mode 100644 index 2c4153494963..000000000000 --- a/libcxx/test/std/utilities/time/time.cal/time.cal.mwdlast/time.cal.mwdlast.nonmembers/comparisons.pass.cpp +++ /dev/null @@ -1,73 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// -// UNSUPPORTED: c++03, c++11, c++14, c++17 - -// -// class month_weekday_last; - -// constexpr bool operator==(const month_weekday_last& x, const month_weekday_last& y) noexcept; -// Returns: x.month() == y.month() -// -// constexpr bool operator< (const month_weekday_last& x, const month_weekday_last& y) noexcept; -// Returns: x.month() < y.month() - - -#include -#include -#include - -#include "test_macros.h" -#include "test_comparisons.h" - -int main() -{ - using month = std::chrono::month; - using weekday_last = std::chrono::weekday_last; - using weekday = std::chrono::weekday; - using month_weekday_last = std::chrono::month_weekday_last; - - constexpr month January = std::chrono::January; - constexpr weekday Tuesday = std::chrono::Tuesday; - constexpr weekday Wednesday = std::chrono::Wednesday; - - AssertComparisons2AreNoexcept(); - AssertComparisons2ReturnBool(); - - static_assert( testComparisons2( - month_weekday_last{std::chrono::January, weekday_last{Tuesday}}, - month_weekday_last{std::chrono::January, weekday_last{Tuesday}}, - true), ""); - - static_assert( testComparisons2( - month_weekday_last{std::chrono::January, weekday_last{Tuesday}}, - month_weekday_last{std::chrono::January, weekday_last{Wednesday}}, - false), ""); - -// vary the months - for (unsigned i = 1; i < 12; ++i) - for (unsigned j = 1; j < 12; ++j) - assert((testComparisons2( - month_weekday_last{month{i}, weekday_last{Tuesday}}, - month_weekday_last{month{j}, weekday_last{Tuesday}}, - i == j))); - -// vary the weekday - for (unsigned i = 0; i < 6; ++i) - for (unsigned j = 0; j < 6; ++j) - assert((testComparisons2( - month_weekday_last{January, weekday_last{weekday{i}}}, - month_weekday_last{January, weekday_last{weekday{j}}}, - i == j))); - -// both different - assert((testComparisons2( - month_weekday_last{month{1}, weekday_last{weekday{1}}}, - month_weekday_last{month{2}, weekday_last{weekday{2}}}, - false))); -} diff --git a/libcxx/test/std/utilities/time/time.cal/time.cal.mwdlast/time.cal.mwdlast.nonmembers/streaming.pass.cpp b/libcxx/test/std/utilities/time/time.cal/time.cal.mwdlast/time.cal.mwdlast.nonmembers/streaming.pass.cpp deleted file mode 100644 index b8c22cc8f372..000000000000 --- a/libcxx/test/std/utilities/time/time.cal/time.cal.mwdlast/time.cal.mwdlast.nonmembers/streaming.pass.cpp +++ /dev/null @@ -1,37 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// -// UNSUPPORTED: c++03, c++11, c++14, c++17 -// XFAIL: * - -// -// class month_weekday_last; -// -// template -// basic_ostream& -// operator<<(basic_ostream& os, const month_weekday_last& mdl); -// -// Returns: os << mdl.month() << "/last". - - -#include -#include -#include -#include - -#include "test_macros.h" - -int main() -{ - using month_weekday_last = std::chrono::month_weekday_last; - using month = std::chrono::month; - using weekday = std::chrono::weekday; - using weekday_last = std::chrono::weekday_last; - - std::cout << month_weekday_last{month{1}, weekday_last{weekday{3}}}; -} diff --git a/libcxx/test/std/utilities/time/time.cal/time.cal.mwdlast/types.pass.cpp b/libcxx/test/std/utilities/time/time.cal/time.cal.mwdlast/types.pass.cpp deleted file mode 100644 index b8ffe35e2b2c..000000000000 --- a/libcxx/test/std/utilities/time/time.cal/time.cal.mwdlast/types.pass.cpp +++ /dev/null @@ -1,27 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// -// UNSUPPORTED: c++03, c++11, c++14, c++17 - -// - -// class month_weekday_last; - -#include -#include -#include - -#include "test_macros.h" - -int main() -{ - using month_weekday_last = std::chrono::month_weekday_last; - - static_assert(std::is_trivially_copyable_v, ""); - static_assert(std::is_standard_layout_v, ""); -} diff --git a/libcxx/test/std/utilities/time/time.cal/time.cal.operators/month_day.pass.cpp b/libcxx/test/std/utilities/time/time.cal/time.cal.operators/month_day.pass.cpp deleted file mode 100644 index 679e6c4b8266..000000000000 --- a/libcxx/test/std/utilities/time/time.cal/time.cal.operators/month_day.pass.cpp +++ /dev/null @@ -1,108 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// -// UNSUPPORTED: c++03, c++11, c++14, c++17 - -// -// class month_day; - -// constexpr month_day -// operator/(const month& m, const day& d) noexcept; -// Returns: {m, d}. -// -// constexpr month_day -// operator/(const day& d, const month& m) noexcept; -// Returns: m / d. - -// constexpr month_day -// operator/(const month& m, int d) noexcept; -// Returns: m / day(d). -// -// constexpr month_day -// operator/(int m, const day& d) noexcept; -// Returns: month(m) / d. -// -// constexpr month_day -// operator/(const day& d, int m) noexcept; -// Returns: month(m) / d. - - -#include -#include -#include - -#include "test_macros.h" -#include "test_comparisons.h" - -int main() -{ - using month_day = std::chrono::month_day; - using month = std::chrono::month; - using day = std::chrono::day; - - constexpr month February = std::chrono::February; - - { // operator/(const month& m, const day& d) (and switched) - ASSERT_NOEXCEPT ( February/day{1}); - ASSERT_SAME_TYPE(month_day, decltype(February/day{1})); - ASSERT_NOEXCEPT ( day{1}/February); - ASSERT_SAME_TYPE(month_day, decltype(day{1}/February)); - - for (int i = 1; i <= 12; ++i) - for (unsigned j = 0; j <= 30; ++j) - { - month m(i); - day d{j}; - month_day md1 = m/d; - month_day md2 = d/m; - assert(md1.month() == m); - assert(md1.day() == d); - assert(md2.month() == m); - assert(md2.day() == d); - assert(md1 == md2); - } - } - - - { // operator/(const month& m, int d) (NOT switched) - ASSERT_NOEXCEPT ( February/2); - ASSERT_SAME_TYPE(month_day, decltype(February/2)); - - for (int i = 1; i <= 12; ++i) - for (unsigned j = 0; j <= 30; ++j) - { - month m(i); - day d(j); - month_day md1 = m/j; - assert(md1.month() == m); - assert(md1.day() == d); - } - } - - - { // operator/(const day& d, int m) (and switched) - ASSERT_NOEXCEPT ( day{2}/2); - ASSERT_SAME_TYPE(month_day, decltype(day{2}/2)); - ASSERT_NOEXCEPT ( 2/day{2}); - ASSERT_SAME_TYPE(month_day, decltype(2/day{2})); - - for (int i = 1; i <= 12; ++i) - for (unsigned j = 0; j <= 30; ++j) - { - month m(i); - day d(j); - month_day md1 = d/i; - month_day md2 = i/d; - assert(md1.month() == m); - assert(md1.day() == d); - assert(md2.month() == m); - assert(md2.day() == d); - assert(md1 == md2); - } - } -} diff --git a/libcxx/test/std/utilities/time/time.cal/time.cal.operators/month_day_last.pass.cpp b/libcxx/test/std/utilities/time/time.cal/time.cal.operators/month_day_last.pass.cpp deleted file mode 100644 index fdba305c9e88..000000000000 --- a/libcxx/test/std/utilities/time/time.cal/time.cal.operators/month_day_last.pass.cpp +++ /dev/null @@ -1,107 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// -// UNSUPPORTED: c++03, c++11, c++14, c++17 - -// -// class month_day_last; - -// constexpr month_day_last -// operator/(const month& m, last_spec) noexcept; -// Returns: month_day_last{m}. -// -// constexpr month_day_last -// operator/(int m, last_spec) noexcept; -// Returns: month(m) / last. -// -// constexpr month_day_last -// operator/(last_spec, const month& m) noexcept; -// Returns: m / last. -// -// constexpr month_day_last -// operator/(last_spec, int m) noexcept; -// Returns: month(m) / last. -// -// -// [Note: A month_day_last object can be constructed using the expression m/last or last/m, -// where m is an expression of type month. — end note] -// [Example: -// constexpr auto mdl = February/last; // mdl is the last day of February of an as yet unspecified year -// static_assert(mdl.month() == February); -// --end example] - - - - - - -#include -#include -#include - -#include "test_macros.h" -#include "test_comparisons.h" - -int main() -{ - using month = std::chrono::month; - using month_day_last = std::chrono::month_day_last; - - constexpr month February = std::chrono::February; - constexpr std::chrono::last_spec last = std::chrono::last; - - ASSERT_SAME_TYPE(month_day_last, decltype(last/February)); - ASSERT_SAME_TYPE(month_day_last, decltype(February/last)); - -// Run the example - { - constexpr auto mdl = February/std::chrono::last; - static_assert(mdl.month() == February, ""); - } - - { // operator/(const month& m, last_spec) and switched - ASSERT_NOEXCEPT ( last/February); - ASSERT_SAME_TYPE(month_day_last, decltype(last/February)); - ASSERT_NOEXCEPT ( February/last); - ASSERT_SAME_TYPE(month_day_last, decltype(February/last)); - - static_assert((last/February).month() == February, ""); - static_assert((February/last).month() == February, ""); - - for (unsigned i = 1; i < 12; ++i) - { - month m{i}; - month_day_last mdl1 = last/m; - month_day_last mdl2 = m/last; - assert(mdl1.month() == m); - assert(mdl2.month() == m); - assert(mdl1 == mdl2); - } - } - - { // operator/(int, last_spec) and switched - ASSERT_NOEXCEPT ( last/2); - ASSERT_SAME_TYPE(month_day_last, decltype(last/2)); - ASSERT_NOEXCEPT ( 2/last); - ASSERT_SAME_TYPE(month_day_last, decltype(2/last)); - - static_assert((last/2).month() == February, ""); - static_assert((2/last).month() == February, ""); - - for (unsigned i = 1; i < 12; ++i) - { - month m{i}; - month_day_last mdl1 = last/i; - month_day_last mdl2 = i/last; - assert(mdl1.month() == m); - assert(mdl2.month() == m); - assert(mdl1 == mdl2); - } - } - -} diff --git a/libcxx/test/std/utilities/time/time.cal/time.cal.operators/month_weekday.pass.cpp b/libcxx/test/std/utilities/time/time.cal/time.cal.operators/month_weekday.pass.cpp deleted file mode 100644 index e23dfef84723..000000000000 --- a/libcxx/test/std/utilities/time/time.cal/time.cal.operators/month_weekday.pass.cpp +++ /dev/null @@ -1,115 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// -// UNSUPPORTED: c++03, c++11, c++14, c++17 - -// -// class month_weekday; - -// constexpr month_weekday -// operator/(const month& m, const weekday_indexed& wdi) noexcept; -// Returns: {m, wdi}. -// -// constexpr month_weekday -// operator/(int m, const weekday_indexed& wdi) noexcept; -// Returns: month(m) / wdi. -// -// constexpr month_weekday -// operator/(const weekday_indexed& wdi, const month& m) noexcept; -// Returns: m / wdi. constexpr month_weekday -// -// constexpr month_weekday -// operator/(const weekday_indexed& wdi, int m) noexcept; -// Returns: month(m) / wdi. - - -// -// [Example: -// constexpr auto mwd = February/Tuesday[3]; // mwd is the third Tuesday of February of an as yet unspecified year -// static_assert(mwd.month() == February); -// static_assert(mwd.weekday_indexed() == Tuesday[3]); -// —end example] - - - - -#include -#include -#include - -#include "test_macros.h" -#include "test_comparisons.h" - -int main() -{ - using month_weekday = std::chrono::month_weekday; - using month = std::chrono::month; - using weekday = std::chrono::weekday; - using weekday_indexed = std::chrono::weekday_indexed; - - constexpr weekday Tuesday = std::chrono::Tuesday; - constexpr month February = std::chrono::February; - - { // operator/(const month& m, const weekday_indexed& wdi) (and switched) - ASSERT_NOEXCEPT (February/Tuesday[2]); - ASSERT_SAME_TYPE(month_weekday, decltype(February/Tuesday[2])); - ASSERT_NOEXCEPT (Tuesday[2]/February); - ASSERT_SAME_TYPE(month_weekday, decltype(Tuesday[2]/February)); - - // Run the example - { - constexpr month_weekday wdi = February/Tuesday[3]; - static_assert(wdi.month() == February, ""); - static_assert(wdi.weekday_indexed() == Tuesday[3], ""); - } - - for (int i = 1; i <= 12; ++i) - for (unsigned j = 0; j <= 6; ++j) - for (unsigned k = 1; k <= 5; ++k) - { - month m(i); - weekday_indexed wdi = weekday{j}[k]; - month_weekday mwd1 = m/wdi; - month_weekday mwd2 = wdi/m; - assert(mwd1.month() == m); - assert(mwd1.weekday_indexed() == wdi); - assert(mwd2.month() == m); - assert(mwd2.weekday_indexed() == wdi); - assert(mwd1 == mwd2); - } - } - - - { // operator/(int m, const weekday_indexed& wdi) (and switched) - ASSERT_NOEXCEPT (2/Tuesday[2]); - ASSERT_SAME_TYPE(month_weekday, decltype(2/Tuesday[2])); - ASSERT_NOEXCEPT (Tuesday[2]/2); - ASSERT_SAME_TYPE(month_weekday, decltype(Tuesday[2]/2)); - - // Run the example - { - constexpr month_weekday wdi = 2/Tuesday[3]; - static_assert(wdi.month() == February, ""); - static_assert(wdi.weekday_indexed() == Tuesday[3], ""); - } - - for (int i = 1; i <= 12; ++i) - for (unsigned j = 0; j <= 6; ++j) - for (unsigned k = 1; k <= 5; ++k) - { - weekday_indexed wdi = weekday{j}[k]; - month_weekday mwd1 = i/wdi; - month_weekday mwd2 = wdi/i; - assert(mwd1.month() == month(i)); - assert(mwd1.weekday_indexed() == wdi); - assert(mwd2.month() == month(i)); - assert(mwd2.weekday_indexed() == wdi); - assert(mwd1 == mwd2); - } - } -} diff --git a/libcxx/test/std/utilities/time/time.cal/time.cal.operators/month_weekday_last.pass.cpp b/libcxx/test/std/utilities/time/time.cal/time.cal.operators/month_weekday_last.pass.cpp deleted file mode 100644 index f3a0233cbd31..000000000000 --- a/libcxx/test/std/utilities/time/time.cal/time.cal.operators/month_weekday_last.pass.cpp +++ /dev/null @@ -1,107 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// -// UNSUPPORTED: c++03, c++11, c++14, c++17 - -// -// class month_weekday_last; - -// constexpr month_weekday_last -// operator/(const month& m, const weekday_last& wdl) noexcept; -// Returns: {m, wdl}. -// -// constexpr month_weekday_last -// operator/(int m, const weekday_last& wdl) noexcept; -// Returns: month(m) / wdl. -// -// constexpr month_weekday_last -// operator/(const weekday_last& wdl, const month& m) noexcept; -// Returns: m / wdl. -// -// constexpr month_weekday_last -// operator/(const weekday_last& wdl, int m) noexcept; -// Returns: month(m) / wdl. - - - - -#include -#include -#include - -#include "test_macros.h" -#include "test_comparisons.h" - -int main() -{ - using month_weekday = std::chrono::month_weekday; - using month = std::chrono::month; - using weekday = std::chrono::weekday; - using weekday_last = std::chrono::weekday_last; - using month_weekday_last = std::chrono::month_weekday_last; - - constexpr weekday Tuesday = std::chrono::Tuesday; - constexpr month February = std::chrono::February; - constexpr std::chrono::last_spec last = std::chrono::last; - - { // operator/(const month& m, const weekday_last& wdi) (and switched) - ASSERT_NOEXCEPT (February/Tuesday[last]); - ASSERT_SAME_TYPE(month_weekday_last, decltype(February/Tuesday[last])); - ASSERT_NOEXCEPT (Tuesday[last]/February); - ASSERT_SAME_TYPE(month_weekday_last, decltype(Tuesday[last]/February)); - - // Run the example - { - constexpr month_weekday_last wdi = February/Tuesday[last]; - static_assert(wdi.month() == February, ""); - static_assert(wdi.weekday_last() == Tuesday[last], ""); - } - - for (int i = 1; i <= 12; ++i) - for (unsigned j = 0; j <= 6; ++j) - { - month m(i); - weekday_last wdi = weekday{j}[last]; - month_weekday_last mwd1 = m/wdi; - month_weekday_last mwd2 = wdi/m; - assert(mwd1.month() == m); - assert(mwd1.weekday_last() == wdi); - assert(mwd2.month() == m); - assert(mwd2.weekday_last() == wdi); - assert(mwd1 == mwd2); - } - } - - - { // operator/(int m, const weekday_last& wdi) (and switched) - ASSERT_NOEXCEPT (2/Tuesday[2]); - ASSERT_SAME_TYPE(month_weekday_last, decltype(2/Tuesday[last])); - ASSERT_NOEXCEPT (Tuesday[2]/2); - ASSERT_SAME_TYPE(month_weekday_last, decltype(Tuesday[last]/2)); - - // Run the example - { - constexpr month_weekday wdi = 2/Tuesday[3]; - static_assert(wdi.month() == February, ""); - static_assert(wdi.weekday_indexed() == Tuesday[3], ""); - } - - for (int i = 1; i <= 12; ++i) - for (unsigned j = 0; j <= 6; ++j) - { - weekday_last wdi = weekday{j}[last]; - month_weekday_last mwd1 = i/wdi; - month_weekday_last mwd2 = wdi/i; - assert(mwd1.month() == month(i)); - assert(mwd1.weekday_last() == wdi); - assert(mwd2.month() == month(i)); - assert(mwd2.weekday_last() == wdi); - assert(mwd1 == mwd2); - } - } -} diff --git a/libcxx/test/std/utilities/time/time.cal/time.cal.operators/year_month.pass.cpp b/libcxx/test/std/utilities/time/time.cal/time.cal.operators/year_month.pass.cpp deleted file mode 100644 index 3a85c1a59bd1..000000000000 --- a/libcxx/test/std/utilities/time/time.cal/time.cal.operators/year_month.pass.cpp +++ /dev/null @@ -1,68 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// -// UNSUPPORTED: c++03, c++11, c++14, c++17 - -// -// class year_month; - -// constexpr year_month operator/(const year& y, const month& m) noexcept; -// Returns: {y, m}. -// -// constexpr year_month operator/(const year& y, int m) noexcept; -// Returns: y / month(m). - - - -#include -#include -#include - -#include "test_macros.h" -#include "test_comparisons.h" - -int main() -{ - using month = std::chrono::month; - using year = std::chrono::year; - using year_month = std::chrono::year_month; - - constexpr month February = std::chrono::February; - - { // operator/(const year& y, const month& m) - ASSERT_NOEXCEPT ( year{2018}/February); - ASSERT_SAME_TYPE(year_month, decltype(year{2018}/February)); - - static_assert((year{2018}/February).year() == year{2018}, ""); - static_assert((year{2018}/February).month() == month{2}, ""); - for (int i = 1000; i <= 1030; ++i) - for (unsigned j = 1; j <= 12; ++j) - { - year_month ym = year{i}/month{j}; - assert(static_cast(ym.year()) == i); - assert(static_cast(ym.month()) == j); - } - } - - - { // operator/(const year& y, const int m) - ASSERT_NOEXCEPT ( year{2018}/4); - ASSERT_SAME_TYPE(year_month, decltype(year{2018}/4)); - - static_assert((year{2018}/2).year() == year{2018}, ""); - static_assert((year{2018}/2).month() == month{2}, ""); - - for (int i = 1000; i <= 1030; ++i) - for (unsigned j = 1; j <= 12; ++j) - { - year_month ym = year{i}/j; - assert(static_cast(ym.year()) == i); - assert(static_cast(ym.month()) == j); - } - } -} diff --git a/libcxx/test/std/utilities/time/time.cal/time.cal.operators/year_month_day.pass.cpp b/libcxx/test/std/utilities/time/time.cal/time.cal.operators/year_month_day.pass.cpp deleted file mode 100644 index b34103a567ca..000000000000 --- a/libcxx/test/std/utilities/time/time.cal/time.cal.operators/year_month_day.pass.cpp +++ /dev/null @@ -1,192 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// -// UNSUPPORTED: c++03, c++11, c++14, c++17 - -// -// class year_month_day; - -// constexpr year_month_day -// operator/(const year_month& ym, const day& d) noexcept; -// Returns: {ym.year(), ym.month(), d}. -// -// constexpr year_month_day -// operator/(const year_month& ym, int d) noexcept; -// Returns: ym / day(d). -// -// constexpr year_month_day -// operator/(const year& y, const month_day& md) noexcept; -// Returns: y / md.month() / md.day(). -// -// constexpr year_month_day -// operator/(int y, const month_day& md) noexcept; -// Returns: year(y) / md. -// -// constexpr year_month_day -// operator/(const month_day& md, const year& y) noexcept; -// Returns: y / md. -// -// constexpr year_month_day -// operator/(const month_day& md, int y) noexcept; -// Returns: year(y) / md. - - -#include -#include -#include - -#include "test_macros.h" -#include "test_comparisons.h" - -int main() -{ - using year = std::chrono::year; - using month = std::chrono::month; - using day = std::chrono::day; - using year_month = std::chrono::year_month; - using month_day = std::chrono::month_day; - using year_month_day = std::chrono::year_month_day; - using weekday = std::chrono::weekday; - - constexpr month February = std::chrono::February; - constexpr year_month Feb2018{year{2018}, February}; - - { // operator/(const year_month& ym, const day& d) - ASSERT_NOEXCEPT ( Feb2018/day{2}); - ASSERT_SAME_TYPE(year_month_day, decltype(Feb2018/day{2})); - - static_assert((Feb2018/day{2}).month() == February, ""); - static_assert((Feb2018/day{2}).day() == day{2}, ""); - - for (int i = 1000; i < 1010; ++i) - for (int j = 1; j <= 12; ++j) - for (unsigned k = 0; k <= 28; ++k) - { - year y(i); - month m(j); - day d(k); - year_month ym(y, m); - year_month_day ymd = ym/d; - assert(ymd.year() == y); - assert(ymd.month() == m); - assert(ymd.day() == d); - } - } - - - { // operator/(const year_month& ym, int d) - ASSERT_NOEXCEPT ( Feb2018/2); - ASSERT_SAME_TYPE(year_month_day, decltype(Feb2018/2)); - - static_assert((Feb2018/2).month() == February, ""); - static_assert((Feb2018/2).day() == day{2}, ""); - - for (int i = 1000; i < 1010; ++i) - for (int j = 1; j <= 12; ++j) - for (unsigned k = 0; k <= 28; ++k) - { - year y(i); - month m(j); - day d(k); - year_month ym(y, m); - year_month_day ymd = ym/k; - assert(ymd.year() == y); - assert(ymd.month() == m); - assert(ymd.day() == d); - } - } - - - { // operator/(const year_month& ym, int d) - ASSERT_NOEXCEPT ( Feb2018/2); - ASSERT_SAME_TYPE(year_month_day, decltype(Feb2018/2)); - - static_assert((Feb2018/2).month() == February, ""); - static_assert((Feb2018/2).day() == day{2}, ""); - - for (int i = 1000; i < 1010; ++i) - for (int j = 1; j <= 12; ++j) - for (unsigned k = 0; k <= 28; ++k) - { - year y(i); - month m(j); - day d(k); - year_month ym(y, m); - year_month_day ymd = ym/k; - assert(ymd.year() == y); - assert(ymd.month() == m); - assert(ymd.day() == d); - } - } - - - - - { // operator/(const year& y, const month_day& md) (and switched) - ASSERT_NOEXCEPT ( year{2018}/month_day{February, day{2}}); - ASSERT_SAME_TYPE(year_month_day, decltype(year{2018}/month_day{February, day{2}})); - ASSERT_NOEXCEPT ( month_day{February, day{2}}/year{2018}); - ASSERT_SAME_TYPE(year_month_day, decltype(month_day{February, day{2}}/year{2018})); - - static_assert((year{2018}/month_day{February, day{2}}).month() == February, "" ); - static_assert((year{2018}/month_day{February, day{2}}).day() == day{2}, "" ); - static_assert((month_day{February, day{2}}/year{2018}).month() == February, "" ); - static_assert((month_day{February, day{2}}/year{2018}).day() == day{2}, "" ); - - for (int i = 1000; i < 1010; ++i) - for (int j = 1; j <= 12; ++j) - for (unsigned k = 0; k <= 28; ++k) - { - year y(i); - month m(j); - day d(k); - month_day md(m, d); - year_month_day ymd1 = y/md; - year_month_day ymd2 = md/y; - assert(ymd1.year() == y); - assert(ymd2.year() == y); - assert(ymd1.month() == m); - assert(ymd2.month() == m); - assert(ymd1.day() == d); - assert(ymd2.day() == d); - assert(ymd1 == ymd2); - } - } - - { // operator/(const month_day& md, int y) (and switched) - ASSERT_NOEXCEPT ( 2018/month_day{February, day{2}}); - ASSERT_SAME_TYPE(year_month_day, decltype(2018/month_day{February, day{2}})); - ASSERT_NOEXCEPT ( month_day{February, day{2}}/2018); - ASSERT_SAME_TYPE(year_month_day, decltype(month_day{February, day{2}}/2018)); - - static_assert((2018/month_day{February, day{2}}).month() == February, "" ); - static_assert((2018/month_day{February, day{2}}).day() == day{2}, "" ); - static_assert((month_day{February, day{2}}/2018).month() == February, "" ); - static_assert((month_day{February, day{2}}/2018).day() == day{2}, "" ); - - for (int i = 1000; i < 1010; ++i) - for (int j = 1; j <= 12; ++j) - for (unsigned k = 0; k <= 28; ++k) - { - year y(i); - month m(j); - day d(k); - month_day md(m, d); - year_month_day ymd1 = i/md; - year_month_day ymd2 = md/i; - assert(ymd1.year() == y); - assert(ymd2.year() == y); - assert(ymd1.month() == m); - assert(ymd2.month() == m); - assert(ymd1.day() == d); - assert(ymd2.day() == d); - assert(ymd1 == ymd2); - } - } - -} diff --git a/libcxx/test/std/utilities/time/time.cal/time.cal.operators/year_month_day_last.pass.cpp b/libcxx/test/std/utilities/time/time.cal/time.cal.operators/year_month_day_last.pass.cpp deleted file mode 100644 index a237842ed9b4..000000000000 --- a/libcxx/test/std/utilities/time/time.cal/time.cal.operators/year_month_day_last.pass.cpp +++ /dev/null @@ -1,129 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// -// UNSUPPORTED: c++03, c++11, c++14, c++17 -// -// class year_month_day_last; - -// constexpr year_month_day_last -// operator/(const year_month& ym, last_spec) noexcept; -// Returns: {ym.year(), month_day_last{ym.month()}}. - - -// constexpr year_month_day_last -// operator/(const year& y, const month_day_last& mdl) noexcept; -// Returns: {y, mdl}. -// -// constexpr year_month_day_last -// operator/(int y, const month_day_last& mdl) noexcept; -// Returns: year(y) / mdl. -// -// constexpr year_month_day_last -// operator/(const month_day_last& mdl, const year& y) noexcept; -// Returns: y / mdl. -// -// constexpr year_month_day_last -// operator/(const month_day_last& mdl, int y) noexcept; -// Returns: year(y) / mdl. - - -#include -#include -#include - -#include "test_macros.h" -#include "test_comparisons.h" - -int main() -{ - using month_weekday = std::chrono::month_weekday; - using month = std::chrono::month; - using year_month = std::chrono::year_month; - using year = std::chrono::year; - using weekday_last = std::chrono::weekday_last; - using weekday = std::chrono::weekday; - using month_weekday_last = std::chrono::month_weekday_last; - using month_day_last = std::chrono::month_day_last; - using year_month_day_last = std::chrono::year_month_day_last; - - constexpr month February = std::chrono::February; - constexpr std::chrono::last_spec last = std::chrono::last; - - { // operator/(const year_month& ym, last_spec) - constexpr year_month Feb2018{year{2018}, February}; - - ASSERT_NOEXCEPT ( Feb2018/last); - ASSERT_SAME_TYPE(year_month_day_last, decltype(Feb2018/last)); - - static_assert((Feb2018/last).year() == year{2018}, ""); - static_assert((Feb2018/last).month() == February, ""); - - for (int i = 1000; i < 1010; ++i) - for (unsigned j = 1; j <= 12; ++j) - { - year y{i}; - month m{j}; - year_month_day_last ymdl = year_month{y,m}/last; - assert(ymdl.year() == y); - assert(ymdl.month() == m); - } - } - - - { // operator/(const year& y, const month_day_last& mdl) (and switched) - ASSERT_NOEXCEPT ( year{2018}/month_day_last{February}); - ASSERT_SAME_TYPE(year_month_day_last, decltype(year{2018}/month_day_last{February})); - ASSERT_NOEXCEPT ( month_day_last{February}/year{2018}); - ASSERT_SAME_TYPE(year_month_day_last, decltype(month_day_last{February}/year{2018})); - - static_assert((year{2018}/month_day_last{February}).month() == February, ""); - static_assert((year{2018}/month_day_last{February}).year() == year{2018}, ""); - static_assert((month_day_last{February}/year{2018}).month() == February, ""); - static_assert((month_day_last{February}/year{2018}).year() == year{2018}, ""); - - for (int i = 1000; i < 1010; ++i) - for (unsigned j = 1; j <= 12; ++j) - { - year y{i}; - month m{j}; - year_month_day_last ymdl1 = y/month_day_last{m}; - year_month_day_last ymdl2 = month_day_last{m}/y; - assert(ymdl1.month() == m); - assert(ymdl2.month() == m); - assert(ymdl2.year() == y); - assert(ymdl1.year() == y); - assert(ymdl1 == ymdl2); - } - } - - { // operator/(int y, const month_day_last& mdl) (and switched) - ASSERT_NOEXCEPT ( 2018/month_day_last{February}); - ASSERT_SAME_TYPE(year_month_day_last, decltype(2018/month_day_last{February})); - ASSERT_NOEXCEPT ( month_day_last{February}/2018); - ASSERT_SAME_TYPE(year_month_day_last, decltype(month_day_last{February}/2018)); - - static_assert((2018/month_day_last{February}).month() == February, ""); - static_assert((2018/month_day_last{February}).year() == year{2018}, ""); - static_assert((month_day_last{February}/2018).month() == February, ""); - static_assert((month_day_last{February}/2018).year() == year{2018}, ""); - - for (int i = 1000; i < 1010; ++i) - for (unsigned j = 1; j <= 12; ++j) - { - year y{i}; - month m{j}; - year_month_day_last ymdl1 = i/month_day_last{m}; - year_month_day_last ymdl2 = month_day_last{m}/i; - assert(ymdl1.month() == m); - assert(ymdl2.month() == m); - assert(ymdl2.year() == y); - assert(ymdl1.year() == y); - assert(ymdl1 == ymdl2); - } - } -} diff --git a/libcxx/test/std/utilities/time/time.cal/time.cal.operators/year_month_weekday.pass.cpp b/libcxx/test/std/utilities/time/time.cal/time.cal.operators/year_month_weekday.pass.cpp deleted file mode 100644 index 5299b5b37287..000000000000 --- a/libcxx/test/std/utilities/time/time.cal/time.cal.operators/year_month_weekday.pass.cpp +++ /dev/null @@ -1,145 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// -// UNSUPPORTED: c++03, c++11, c++14, c++17 - -// -// class year_month_weekday; - -// constexpr year_month_weekday -// operator/(const year_month& ym, const weekday_indexed& wdi) noexcept; -// Returns: {ym.year(), ym.month(), wdi}. -// -// constexpr year_month_weekday -// operator/(const year& y, const month_weekday& mwd) noexcept; -// Returns: {y, mwd.month(), mwd.weekday_indexed()}. -// -// constexpr year_month_weekday -// operator/(int y, const month_weekday& mwd) noexcept; -// Returns: year(y) / mwd. -// -// constexpr year_month_weekday -// operator/(const month_weekday& mwd, const year& y) noexcept; -// Returns: y / mwd. -// -// constexpr year_month_weekday -// operator/(const month_weekday& mwd, int y) noexcept; -// Returns: year(y) / mwd. - -#include -#include -#include - -#include "test_macros.h" -#include "test_comparisons.h" - -int main() -{ - using year = std::chrono::year; - using year_month = std::chrono::year_month; - using month_weekday = std::chrono::month_weekday; - using year_month_weekday = std::chrono::year_month_weekday; - using month = std::chrono::month; - using weekday = std::chrono::weekday; - using weekday = std::chrono::weekday; - using weekday_indexed = std::chrono::weekday_indexed; - - constexpr weekday Tuesday = std::chrono::Tuesday; - constexpr month February = std::chrono::February; - - - { // operator/(const year_month& ym, const weekday_indexed& wdi) - constexpr year_month Feb2018{year{2018}, February}; - - ASSERT_NOEXCEPT ( Feb2018/weekday_indexed{Tuesday, 2}); - ASSERT_SAME_TYPE(year_month_weekday, decltype(Feb2018/weekday_indexed{Tuesday, 2})); - - static_assert((Feb2018/weekday_indexed{Tuesday, 2}).year() == year{2018}, "" ); - static_assert((Feb2018/weekday_indexed{Tuesday, 2}).month() == February, "" ); - static_assert((Feb2018/weekday_indexed{Tuesday, 2}).weekday() == Tuesday, "" ); - - for (int i = 1000; i < 1010; ++i) - for (int j = 1; j <= 12; ++j) - for (unsigned k = 0; k <= 6; ++k) - for (unsigned l = 1; l <= 5; ++l) - { - year y(i); - month m(j); - weekday wd{k}; - year_month_weekday ymd = year_month{y,m}/weekday_indexed{wd,l}; - assert(ymd.year() == y); - assert(ymd.month() == m); - assert(ymd.weekday() == wd); - } - } - - { // operator/(const year& y, const month_weekday& mwd) (and switched) - constexpr month_weekday Feb1stTues{February, weekday_indexed{Tuesday, 1}}; - ASSERT_NOEXCEPT ( year{2018}/Feb1stTues); - ASSERT_SAME_TYPE(year_month_weekday, decltype(year{2018}/Feb1stTues)); - ASSERT_NOEXCEPT ( Feb1stTues/year{2018}); - ASSERT_SAME_TYPE(year_month_weekday, decltype(Feb1stTues/year{2018})); - - static_assert((year{2018}/Feb1stTues).year() == year{2018}, "" ); - static_assert((year{2018}/Feb1stTues).month() == February, "" ); - static_assert((year{2018}/Feb1stTues).weekday() == Tuesday, "" ); - - for (int i = 1000; i < 1010; ++i) - for (int j = 1; j <= 12; ++j) - for (unsigned k = 0; k <= 6; ++k) - for (unsigned l = 1; l <= 5; ++l) - { - year y(i); - month m(j); - weekday wd{k}; - month_weekday mwd{m, weekday_indexed{weekday{k}, l}}; - year_month_weekday ymd1 = y/mwd; - year_month_weekday ymd2 = mwd/y; - assert(ymd1.year() == y); - assert(ymd2.year() == y); - assert(ymd1.month() == m); - assert(ymd2.month() == m); - assert(ymd1.weekday() == wd); - assert(ymd2.weekday() == wd); - assert(ymd1 == ymd2); - } - } - - - { // operator/(int y, const month_weekday& mwd) (and switched) - constexpr month_weekday Feb1stTues{February, weekday_indexed{Tuesday, 1}}; - ASSERT_NOEXCEPT ( 2018/Feb1stTues); - ASSERT_SAME_TYPE(year_month_weekday, decltype(2018/Feb1stTues)); - ASSERT_NOEXCEPT ( Feb1stTues/2018); - ASSERT_SAME_TYPE(year_month_weekday, decltype(Feb1stTues/2018)); - - static_assert((2018/Feb1stTues).year() == year{2018}, "" ); - static_assert((2018/Feb1stTues).month() == February, "" ); - static_assert((2018/Feb1stTues).weekday() == Tuesday, "" ); - - for (int i = 1000; i < 1010; ++i) - for (int j = 1; j <= 12; ++j) - for (unsigned k = 0; k <= 6; ++k) - for (unsigned l = 1; l <= 5; ++l) - { - year y(i); - month m(j); - weekday wd{k}; - month_weekday mwd{m, weekday_indexed{weekday{k}, l}}; - year_month_weekday ymd1 = i/mwd; - year_month_weekday ymd2 = mwd/i; - assert(ymd1.year() == y); - assert(ymd2.year() == y); - assert(ymd1.month() == m); - assert(ymd2.month() == m); - assert(ymd1.weekday() == wd); - assert(ymd2.weekday() == wd); - assert(ymd1 == ymd2); - } - } -} diff --git a/libcxx/test/std/utilities/time/time.cal/time.cal.operators/year_month_weekday_last.pass.cpp b/libcxx/test/std/utilities/time/time.cal/time.cal.operators/year_month_weekday_last.pass.cpp deleted file mode 100644 index 7ceaffaabf88..000000000000 --- a/libcxx/test/std/utilities/time/time.cal/time.cal.operators/year_month_weekday_last.pass.cpp +++ /dev/null @@ -1,154 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// -// UNSUPPORTED: c++03, c++11, c++14, c++17 - -// -// class year_month_weekday_last; - -// constexpr year_month_weekday_last -// operator/(const year_month& ym, const weekday_last& wdl) noexcept; -// Returns: {ym.year(), ym.month(), wdl}. -// -// constexpr year_month_weekday_last -// operator/(const year& y, const month_weekday_last& mwdl) noexcept; -// Returns: {y, mwdl.month(), mwdl.weekday_last()}. -// -// constexpr year_month_weekday_last -// operator/(int y, const month_weekday_last& mwdl) noexcept; -// Returns: year(y) / mwdl. -// -// constexpr year_month_weekday_last -// operator/(const month_weekday_last& mwdl, const year& y) noexcept; -// Returns: y / mwdl. -// -// constexpr year_month_weekday_last -// operator/(const month_weekday_last& mwdl, int y) noexcept; -// Returns: year(y) / mwdl. - - - -#include -#include -#include - -#include "test_macros.h" -#include "test_comparisons.h" - -int main() -{ - using year_month = std::chrono::year_month; - using month_weekday = std::chrono::month_weekday; - using year = std::chrono::year; - using month = std::chrono::month; - using weekday = std::chrono::weekday; - using weekday_last = std::chrono::weekday_last; - using month_weekday_last = std::chrono::month_weekday_last; - using year_month_weekday_last = std::chrono::year_month_weekday_last; - - constexpr weekday Tuesday = std::chrono::Tuesday; - constexpr month February = std::chrono::February; - - { // operator/(const year_month& ym, const weekday_last& wdl) (and switched) - constexpr year_month Feb2018{year{2018}, February}; - - ASSERT_NOEXCEPT ( Feb2018/weekday_last{Tuesday}); - ASSERT_SAME_TYPE(year_month_weekday_last, decltype(Feb2018/weekday_last{Tuesday})); - - static_assert((Feb2018/weekday_last{Tuesday}).year() == year{2018}, ""); - static_assert((Feb2018/weekday_last{Tuesday}).month() == February, ""); - static_assert((Feb2018/weekday_last{Tuesday}).weekday() == Tuesday, ""); - - for (int i = 1000; i < 1010; ++i) - for (unsigned j = 1; j <= 12; ++j) - for (unsigned k = 0; k <= 6; ++k) - { - year y{i}; - month m{j}; - weekday wd{k}; - year_month_weekday_last ymwdl = year_month{y,m}/weekday_last{wd}; - assert(ymwdl.year() == y); - assert(ymwdl.month() == m); - assert(ymwdl.weekday() == wd); - } - } - - - { // operator/(const year& y, const month_weekday_last& mwdl) (and switched) - constexpr month_weekday_last FebLastTues{February, weekday_last{Tuesday}}; - - ASSERT_NOEXCEPT ( year{2018}/FebLastTues); - ASSERT_SAME_TYPE(year_month_weekday_last, decltype(year{2018}/FebLastTues)); - ASSERT_NOEXCEPT ( FebLastTues/year{2018}); - ASSERT_SAME_TYPE(year_month_weekday_last, decltype(FebLastTues/year{2018})); - - - static_assert((year{2018}/FebLastTues).year() == year{2018}, ""); - static_assert((year{2018}/FebLastTues).month() == February, ""); - static_assert((year{2018}/FebLastTues).weekday() == Tuesday, ""); - static_assert((FebLastTues/year{2018}).year() == year{2018}, ""); - static_assert((FebLastTues/year{2018}).month() == February, ""); - static_assert((FebLastTues/year{2018}).weekday() == Tuesday, ""); - - - for (int i = 1000; i < 1010; ++i) - for (unsigned j = 1; j <= 12; ++j) - for (unsigned k = 0; k <= 6; ++k) - { - year y{i}; - month m{j}; - weekday wd{k}; - year_month_weekday_last ymwdl1 = y/month_weekday_last{m, weekday_last{wd}}; - year_month_weekday_last ymwdl2 = month_weekday_last{m, weekday_last{wd}}/y; - assert(ymwdl1.year() == y); - assert(ymwdl2.year() == y); - assert(ymwdl1.month() == m); - assert(ymwdl2.month() == m); - assert(ymwdl1.weekday() == wd); - assert(ymwdl2.weekday() == wd); - assert(ymwdl1 == ymwdl2); - } - } - - - { // operator/(int y, const month_weekday_last& mwdl) (and switched) - constexpr month_weekday_last FebLastTues{February, weekday_last{Tuesday}}; - - ASSERT_NOEXCEPT ( 2018/FebLastTues); - ASSERT_SAME_TYPE(year_month_weekday_last, decltype(2018/FebLastTues)); - ASSERT_NOEXCEPT ( FebLastTues/2018); - ASSERT_SAME_TYPE(year_month_weekday_last, decltype(FebLastTues/2018)); - - - static_assert((2018/FebLastTues).year() == year{2018}, ""); - static_assert((2018/FebLastTues).month() == February, ""); - static_assert((2018/FebLastTues).weekday() == Tuesday, ""); - static_assert((FebLastTues/2018).year() == year{2018}, ""); - static_assert((FebLastTues/2018).month() == February, ""); - static_assert((FebLastTues/2018).weekday() == Tuesday, ""); - - - for (int i = 1000; i < 1010; ++i) - for (unsigned j = 1; j <= 12; ++j) - for (unsigned k = 0; k <= 6; ++k) - { - year y{i}; - month m{j}; - weekday wd{k}; - year_month_weekday_last ymwdl1 = i/month_weekday_last{m, weekday_last{wd}}; - year_month_weekday_last ymwdl2 = month_weekday_last{m, weekday_last{wd}}/i; - assert(ymwdl1.year() == y); - assert(ymwdl2.year() == y); - assert(ymwdl1.month() == m); - assert(ymwdl2.month() == m); - assert(ymwdl1.weekday() == wd); - assert(ymwdl2.weekday() == wd); - assert(ymwdl1 == ymwdl2); - } - } -} diff --git a/libcxx/test/std/utilities/time/time.cal/time.cal.wdidx/time.cal.wdidx.members/ctor.pass.cpp b/libcxx/test/std/utilities/time/time.cal/time.cal.wdidx/time.cal.wdidx.members/ctor.pass.cpp deleted file mode 100644 index 4c13bdef83d1..000000000000 --- a/libcxx/test/std/utilities/time/time.cal/time.cal.wdidx/time.cal.wdidx.members/ctor.pass.cpp +++ /dev/null @@ -1,61 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// -// UNSUPPORTED: c++03, c++11, c++14, c++17 - -// -// class weekday_indexed; - -// weekday_indexed() = default; -// constexpr weekday_indexed(const chrono::weekday& wd, unsigned index) noexcept; -// -// Effects: Constructs an object of type weekday_indexed by initializing wd_ with wd and index_ with index. -// The values held are unspecified if !wd.ok() or index is not in the range [1, 5]. -// -// constexpr chrono::weekday weekday() const noexcept; -// constexpr unsigned index() const noexcept; -// constexpr bool ok() const noexcept; - -#include -#include -#include - -#include "test_macros.h" - -int main() -{ - using weekday = std::chrono::weekday; - using weekday_indexed = std::chrono::weekday_indexed; - - ASSERT_NOEXCEPT(weekday_indexed{}); - ASSERT_NOEXCEPT(weekday_indexed(weekday{1}, 1)); - - constexpr weekday_indexed wdi0{}; - static_assert( wdi0.weekday() == weekday{}, ""); - static_assert( wdi0.index() == 0, ""); - static_assert(!wdi0.ok(), ""); - - constexpr weekday_indexed wdi1{std::chrono::Sunday, 2}; - static_assert( wdi1.weekday() == std::chrono::Sunday, ""); - static_assert( wdi1.index() == 2, ""); - static_assert( wdi1.ok(), ""); - - for (unsigned i = 1; i <= 5; ++i) - { - weekday_indexed wdi(std::chrono::Tuesday, i); - assert( wdi.weekday() == std::chrono::Tuesday); - assert( wdi.index() == i); - assert( wdi.ok()); - } - - for (unsigned i = 6; i <= 20; ++i) - { - weekday_indexed wdi(std::chrono::Tuesday, i); - assert(!wdi.ok()); - } -} diff --git a/libcxx/test/std/utilities/time/time.cal/time.cal.wdidx/time.cal.wdidx.members/index.pass.cpp b/libcxx/test/std/utilities/time/time.cal/time.cal.wdidx/time.cal.wdidx.members/index.pass.cpp deleted file mode 100644 index 0d03dbbcb5dd..000000000000 --- a/libcxx/test/std/utilities/time/time.cal/time.cal.wdidx/time.cal.wdidx.members/index.pass.cpp +++ /dev/null @@ -1,38 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// -// UNSUPPORTED: c++03, c++11, c++14, c++17 - -// -// class weekday_indexed; - -// constexpr unsigned index() const noexcept; -// Returns: index_ - -#include -#include -#include - -#include "test_macros.h" - -int main() -{ - using weekday = std::chrono::weekday; - using weekday_indexed = std::chrono::weekday_indexed; - - ASSERT_NOEXCEPT( std::declval().index()); - ASSERT_SAME_TYPE(unsigned, decltype(std::declval().index())); - - static_assert( weekday_indexed{}.index() == 0, ""); - - for (unsigned i = 1; i <= 5; ++i) - { - weekday_indexed wdi(weekday{2}, i); - assert( static_cast(wdi.index()) == i); - } -} diff --git a/libcxx/test/std/utilities/time/time.cal/time.cal.wdidx/time.cal.wdidx.members/ok.pass.cpp b/libcxx/test/std/utilities/time/time.cal/time.cal.wdidx/time.cal.wdidx.members/ok.pass.cpp deleted file mode 100644 index e0277f656709..000000000000 --- a/libcxx/test/std/utilities/time/time.cal/time.cal.wdidx/time.cal.wdidx.members/ok.pass.cpp +++ /dev/null @@ -1,49 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// -// UNSUPPORTED: c++03, c++11, c++14, c++17 - -// -// class weekday_indexed; - -// constexpr bool ok() const noexcept; -// Returns: wd_.ok() && 1 <= index_ && index_ <= 5 - -#include -#include -#include - -#include "test_macros.h" - -int main() -{ - using weekday = std::chrono::weekday; - using weekday_indexed = std::chrono::weekday_indexed; - - ASSERT_NOEXCEPT( std::declval().ok()); - ASSERT_SAME_TYPE(bool, decltype(std::declval().ok())); - - static_assert(!weekday_indexed{}.ok(), ""); - static_assert( weekday_indexed{std::chrono::Sunday, 2}.ok(), ""); - - assert(!(weekday_indexed(std::chrono::Tuesday, 0).ok())); - for (unsigned i = 1; i <= 5; ++i) - { - weekday_indexed wdi(std::chrono::Tuesday, i); - assert( wdi.ok()); - } - - for (unsigned i = 6; i <= 20; ++i) - { - weekday_indexed wdi(std::chrono::Tuesday, i); - assert(!wdi.ok()); - } - -// Not a valid weekday - assert(!(weekday_indexed(weekday{9U}, 1).ok())); -} diff --git a/libcxx/test/std/utilities/time/time.cal/time.cal.wdidx/time.cal.wdidx.members/weekday.pass.cpp b/libcxx/test/std/utilities/time/time.cal/time.cal.wdidx/time.cal.wdidx.members/weekday.pass.cpp deleted file mode 100644 index 484c19cca9b0..000000000000 --- a/libcxx/test/std/utilities/time/time.cal/time.cal.wdidx/time.cal.wdidx.members/weekday.pass.cpp +++ /dev/null @@ -1,39 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// -// UNSUPPORTED: c++03, c++11, c++14, c++17 - -// -// class weekday_indexed; - -// constexpr chrono::weekday weekday() const noexcept; -// Returns: wd_ - -#include -#include -#include - -#include "test_macros.h" - -int main() -{ - using weekday = std::chrono::weekday; - using weekday_indexed = std::chrono::weekday_indexed; - - ASSERT_NOEXCEPT( std::declval().weekday()); - ASSERT_SAME_TYPE(std::chrono::weekday, decltype(std::declval().weekday())); - - static_assert( weekday_indexed{}.weekday() == weekday{}, ""); - static_assert( weekday_indexed{std::chrono::Tuesday, 0}.weekday() == std::chrono::Tuesday, ""); - - for (unsigned i = 0; i <= 6; ++i) - { - weekday_indexed wdi(weekday{i}, 2); - assert( static_cast(wdi.weekday()) == i); - } -} diff --git a/libcxx/test/std/utilities/time/time.cal/time.cal.wdidx/time.cal.wdidx.nonmembers/comparisons.pass.cpp b/libcxx/test/std/utilities/time/time.cal/time.cal.wdidx/time.cal.wdidx.nonmembers/comparisons.pass.cpp deleted file mode 100644 index acaca806a21d..000000000000 --- a/libcxx/test/std/utilities/time/time.cal/time.cal.wdidx/time.cal.wdidx.nonmembers/comparisons.pass.cpp +++ /dev/null @@ -1,48 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// -// UNSUPPORTED: c++03, c++11, c++14, c++17 - -// -// class weekday_indexed; - -// constexpr bool operator==(const weekday_indexed& x, const weekday_indexed& y) noexcept; -// Returns: x.weekday() == y.weekday() && x.index() == y.index(). -// constexpr bool operator!=(const weekday_indexed& x, const weekday_indexed& y) noexcept; -// Returns: !(x == y) - -#include -#include -#include - -#include "test_macros.h" -#include "test_comparisons.h" - -int main() -{ - using weekday = std::chrono::weekday; - using weekday_indexed = std::chrono::weekday_indexed; - - AssertComparisons2AreNoexcept(); - AssertComparisons2ReturnBool(); - - static_assert( (weekday_indexed{} == weekday_indexed{}), ""); - static_assert(!(weekday_indexed{} != weekday_indexed{}), ""); - - static_assert(!(weekday_indexed{} == weekday_indexed{std::chrono::Tuesday, 1}), ""); - static_assert( (weekday_indexed{} != weekday_indexed{std::chrono::Tuesday, 1}), ""); - -// Some 'ok' values as well - static_assert( (weekday_indexed{weekday{1}, 2} == weekday_indexed{weekday{1}, 2}), ""); - static_assert(!(weekday_indexed{weekday{1}, 2} != weekday_indexed{weekday{1}, 2}), ""); - - static_assert(!(weekday_indexed{weekday{1}, 2} == weekday_indexed{weekday{1}, 1}), ""); - static_assert( (weekday_indexed{weekday{1}, 2} != weekday_indexed{weekday{1}, 1}), ""); - static_assert(!(weekday_indexed{weekday{1}, 2} == weekday_indexed{weekday{2}, 2}), ""); - static_assert( (weekday_indexed{weekday{1}, 2} != weekday_indexed{weekday{2}, 2}), ""); -} diff --git a/libcxx/test/std/utilities/time/time.cal/time.cal.wdidx/time.cal.wdidx.nonmembers/streaming.pass.cpp b/libcxx/test/std/utilities/time/time.cal/time.cal.wdidx/time.cal.wdidx.nonmembers/streaming.pass.cpp deleted file mode 100644 index 9938b8a6865e..000000000000 --- a/libcxx/test/std/utilities/time/time.cal/time.cal.wdidx/time.cal.wdidx.nonmembers/streaming.pass.cpp +++ /dev/null @@ -1,36 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// -// UNSUPPORTED: c++03, c++11, c++14, c++17 -// XFAIL: * - -// -// class weekday_indexed; - -// template -// basic_ostream& -// operator<<(basic_ostream& os, const weekday_indexed& wdi); -// -// Effects: os << wdi.weekday() << '[' << wdi.index(). -// If wdi.index() is in the range [1, 5], appends with ']', -// otherwise appends with " is not a valid index]". - - -#include -#include -#include - -#include "test_macros.h" - -int main() -{ - using weekday_indexed = std::chrono::weekday_indexed; - using weekday = std::chrono::weekday; - - std::cout << weekday_indexed{weekday{3}}; -} diff --git a/libcxx/test/std/utilities/time/time.cal/time.cal.wdidx/types.pass.cpp b/libcxx/test/std/utilities/time/time.cal/time.cal.wdidx/types.pass.cpp deleted file mode 100644 index 8b2e70e5e3ee..000000000000 --- a/libcxx/test/std/utilities/time/time.cal/time.cal.wdidx/types.pass.cpp +++ /dev/null @@ -1,26 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// -// UNSUPPORTED: c++03, c++11, c++14, c++17 - -// -// class weekday_indexed; - -#include -#include -#include - -#include "test_macros.h" - -int main() -{ - using weekday_indexed = std::chrono::weekday_indexed; - - static_assert(std::is_trivially_copyable_v, ""); - static_assert(std::is_standard_layout_v, ""); -} diff --git a/libcxx/test/std/utilities/time/time.cal/time.cal.wdlast/time.cal.wdlast.members/ctor.pass.cpp b/libcxx/test/std/utilities/time/time.cal/time.cal.wdlast/time.cal.wdlast.members/ctor.pass.cpp deleted file mode 100644 index facc1dc087df..000000000000 --- a/libcxx/test/std/utilities/time/time.cal/time.cal.wdlast/time.cal.wdlast.members/ctor.pass.cpp +++ /dev/null @@ -1,47 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// -// UNSUPPORTED: c++03, c++11, c++14, c++17 - -// -// class weekday_last; - -// explicit constexpr weekday_last(const chrono::weekday& wd) noexcept; -// -// Effects: Constructs an object of type weekday_last by initializing wd_ with wd. -// -// constexpr chrono::weekday weekday() const noexcept; -// constexpr bool ok() const noexcept; - -#include -#include -#include - -#include "test_macros.h" - -int main() -{ - using weekday = std::chrono::weekday; - using weekday_last = std::chrono::weekday_last; - - ASSERT_NOEXCEPT(weekday_last{weekday{}}); - - constexpr weekday_last wdl0{weekday{}}; - static_assert( wdl0.weekday() == weekday{}, ""); - static_assert( wdl0.ok(), ""); - - constexpr weekday_last wdl1 {weekday{1}}; - static_assert( wdl1.weekday() == weekday{1}, ""); - static_assert( wdl1.ok(), ""); - - for (unsigned i = 0; i <= 255; ++i) - { - weekday_last wdl{weekday{i}}; - assert(wdl.weekday() == weekday{i}); - } -} diff --git a/libcxx/test/std/utilities/time/time.cal/time.cal.wdlast/time.cal.wdlast.members/ok.pass.cpp b/libcxx/test/std/utilities/time/time.cal/time.cal.wdlast/time.cal.wdlast.members/ok.pass.cpp deleted file mode 100644 index 7c842b150e82..000000000000 --- a/libcxx/test/std/utilities/time/time.cal/time.cal.wdlast/time.cal.wdlast.members/ok.pass.cpp +++ /dev/null @@ -1,37 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// -// UNSUPPORTED: c++03, c++11, c++14, c++17 - -// -// class weekday_last; - -// constexpr bool ok() const noexcept; -// Returns: wd_.ok() - -#include -#include -#include - -#include "test_macros.h" - -int main() -{ - using weekday = std::chrono::weekday; - using weekday_last = std::chrono::weekday_last; - - ASSERT_NOEXCEPT( std::declval().ok()); - ASSERT_SAME_TYPE(bool, decltype(std::declval().ok())); - - static_assert( weekday_last{weekday{0}}.ok(), ""); - static_assert( weekday_last{weekday{1}}.ok(), ""); - static_assert(!weekday_last{weekday{7}}.ok(), ""); - - for (unsigned i = 0; i <= 255; ++i) - assert(weekday_last{weekday{i}}.ok() == weekday{i}.ok()); -} diff --git a/libcxx/test/std/utilities/time/time.cal/time.cal.wdlast/time.cal.wdlast.members/weekday.pass.cpp b/libcxx/test/std/utilities/time/time.cal/time.cal.wdlast/time.cal.wdlast.members/weekday.pass.cpp deleted file mode 100644 index 191f23e923f3..000000000000 --- a/libcxx/test/std/utilities/time/time.cal/time.cal.wdlast/time.cal.wdlast.members/weekday.pass.cpp +++ /dev/null @@ -1,33 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// -// UNSUPPORTED: c++03, c++11, c++14, c++17 - -// -// class weekday_last; - -// constexpr chrono::weekday weekday() const noexcept; -// Returns: wd_ - -#include -#include -#include - -#include "test_macros.h" - -int main() -{ - using weekday = std::chrono::weekday; - using weekday_last = std::chrono::weekday_last; - - ASSERT_NOEXCEPT( std::declval().weekday()); - ASSERT_SAME_TYPE(weekday, decltype(std::declval().weekday())); - - for (unsigned i = 0; i <= 255; ++i) - assert(weekday_last{weekday{i}}.weekday() == weekday{i}); -} diff --git a/libcxx/test/std/utilities/time/time.cal/time.cal.wdlast/time.cal.wdlast.nonmembers/comparisons.pass.cpp b/libcxx/test/std/utilities/time/time.cal/time.cal.wdlast/time.cal.wdlast.nonmembers/comparisons.pass.cpp deleted file mode 100644 index 180a0a3c39cd..000000000000 --- a/libcxx/test/std/utilities/time/time.cal/time.cal.wdlast/time.cal.wdlast.nonmembers/comparisons.pass.cpp +++ /dev/null @@ -1,43 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// -// UNSUPPORTED: c++03, c++11, c++14, c++17 - -// -// class weekday_last; - -// constexpr bool operator==(const weekday& x, const weekday& y) noexcept; -// constexpr bool operator!=(const weekday& x, const weekday& y) noexcept; - - -#include -#include -#include - -#include "test_macros.h" -#include "test_comparisons.h" - -int main() -{ - using weekday = std::chrono::weekday; - using weekday_last = std::chrono::weekday_last; - - AssertComparisons2AreNoexcept(); - AssertComparisons2ReturnBool(); - - static_assert(testComparisons2Values(weekday{0}, weekday{0}), ""); - static_assert(testComparisons2Values(weekday{0}, weekday{1}), ""); - -// Some 'ok' values as well - static_assert(testComparisons2Values(weekday{2}, weekday{2}), ""); - static_assert(testComparisons2Values(weekday{2}, weekday{3}), ""); - - for (unsigned i = 0; i < 6; ++i) - for (unsigned j = 0; j < 6; ++j) - assert(testComparisons2Values(weekday{i}, weekday{j})); -} diff --git a/libcxx/test/std/utilities/time/time.cal/time.cal.wdlast/time.cal.wdlast.nonmembers/streaming.pass.cpp b/libcxx/test/std/utilities/time/time.cal/time.cal.wdlast/time.cal.wdlast.nonmembers/streaming.pass.cpp deleted file mode 100644 index 6185443446e3..000000000000 --- a/libcxx/test/std/utilities/time/time.cal/time.cal.wdlast/time.cal.wdlast.nonmembers/streaming.pass.cpp +++ /dev/null @@ -1,34 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// -// UNSUPPORTED: c++03, c++11, c++14, c++17 -// XFAIL: * - -// -// class weekday_last; - -// template -// basic_ostream& -// operator<<(basic_ostream& os, const weekday_last& wdl); -// -// Returns: os << wdl.weekday() << "[last]". - -#include -#include -#include -#include - -#include "test_macros.h" - -int main() -{ - using weekday_last = std::chrono::weekday_last; - using weekday = std::chrono::weekday; - - std::cout << weekday_last{weekday{3}}; -} diff --git a/libcxx/test/std/utilities/time/time.cal/time.cal.wdlast/types.pass.cpp b/libcxx/test/std/utilities/time/time.cal/time.cal.wdlast/types.pass.cpp deleted file mode 100644 index 51bc8f96527e..000000000000 --- a/libcxx/test/std/utilities/time/time.cal/time.cal.wdlast/types.pass.cpp +++ /dev/null @@ -1,26 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// -// UNSUPPORTED: c++03, c++11, c++14, c++17 - -// -// class weekday_last; - -#include -#include -#include - -#include "test_macros.h" - -int main() -{ - using weekday_last = std::chrono::weekday_last; - - static_assert(std::is_trivially_copyable_v, ""); - static_assert(std::is_standard_layout_v, ""); -} diff --git a/libcxx/test/std/utilities/time/time.cal/time.cal.weekday/time.cal.weekday.members/ctor.pass.cpp b/libcxx/test/std/utilities/time/time.cal/time.cal.weekday/time.cal.weekday.members/ctor.pass.cpp deleted file mode 100644 index 95e498549a4c..000000000000 --- a/libcxx/test/std/utilities/time/time.cal/time.cal.weekday/time.cal.weekday.members/ctor.pass.cpp +++ /dev/null @@ -1,51 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// -// UNSUPPORTED: c++03, c++11, c++14, c++17 - -// -// class weekday; - -// weekday() = default; -// explicit constexpr weekday(unsigned wd) noexcept; -// constexpr weekday(const sys_days& dp) noexcept; -// explicit constexpr weekday(const local_days& dp) noexcept; -// -// explicit constexpr operator unsigned() const noexcept; - -// Effects: Constructs an object of type weekday by initializing m_ with m. -// The value held is unspecified if d is not in the range [0, 255]. - -#include -#include -#include - -#include "test_macros.h" - -int main() -{ - using weekday = std::chrono::weekday; - - ASSERT_NOEXCEPT(weekday{}); - ASSERT_NOEXCEPT(weekday(1)); - ASSERT_NOEXCEPT(static_cast(weekday(1))); - - constexpr weekday m0{}; - static_assert(static_cast(m0) == 0, ""); - - constexpr weekday m1{1}; - static_assert(static_cast(m1) == 1, ""); - - for (unsigned i = 0; i <= 255; ++i) - { - weekday m(i); - assert(static_cast(m) == i); - } - -// TODO - sys_days and local_days ctor tests -} diff --git a/libcxx/test/std/utilities/time/time.cal/time.cal.weekday/time.cal.weekday.members/decrement.pass.cpp b/libcxx/test/std/utilities/time/time.cal/time.cal.weekday/time.cal.weekday.members/decrement.pass.cpp deleted file mode 100644 index 213e7282db20..000000000000 --- a/libcxx/test/std/utilities/time/time.cal/time.cal.weekday/time.cal.weekday.members/decrement.pass.cpp +++ /dev/null @@ -1,53 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// -// UNSUPPORTED: c++03, c++11, c++14, c++17 - -// -// class weekday; - -// constexpr weekday& operator--() noexcept; -// constexpr weekday operator--(int) noexcept; - - -#include -#include -#include - -#include "test_macros.h" -#include "../../euclidian.h" - -template -constexpr bool testConstexpr() -{ - WD wd{1}; - if (static_cast(--wd) != 0) return false; - if (static_cast(wd--) != 0) return false; - if (static_cast(wd) != 6) return false; - return true; -} - -int main() -{ - using weekday = std::chrono::weekday; - ASSERT_NOEXCEPT(--(std::declval()) ); - ASSERT_NOEXCEPT( (std::declval())--); - - ASSERT_SAME_TYPE(weekday , decltype( std::declval()--)); - ASSERT_SAME_TYPE(weekday&, decltype(--std::declval() )); - - static_assert(testConstexpr(), ""); - - for (unsigned i = 0; i <= 6; ++i) - { - weekday wd(i); - assert((static_cast(--wd) == euclidian_subtraction(i, 1))); - assert((static_cast(wd--) == euclidian_subtraction(i, 1))); - assert((static_cast(wd) == euclidian_subtraction(i, 2))); - } -} diff --git a/libcxx/test/std/utilities/time/time.cal/time.cal.weekday/time.cal.weekday.members/increment.pass.cpp b/libcxx/test/std/utilities/time/time.cal/time.cal.weekday/time.cal.weekday.members/increment.pass.cpp deleted file mode 100644 index 171053a94c67..000000000000 --- a/libcxx/test/std/utilities/time/time.cal/time.cal.weekday/time.cal.weekday.members/increment.pass.cpp +++ /dev/null @@ -1,53 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// -// UNSUPPORTED: c++03, c++11, c++14, c++17 - -// -// class weekday; - -// constexpr weekday& operator++() noexcept; -// constexpr weekday operator++(int) noexcept; - - -#include -#include -#include - -#include "test_macros.h" -#include "../../euclidian.h" - -template -constexpr bool testConstexpr() -{ - WD wd{5}; - if (static_cast(++wd) != 6) return false; - if (static_cast(wd++) != 6) return false; - if (static_cast(wd) != 0) return false; - return true; -} - -int main() -{ - using weekday = std::chrono::weekday; - ASSERT_NOEXCEPT(++(std::declval()) ); - ASSERT_NOEXCEPT( (std::declval())++); - - ASSERT_SAME_TYPE(weekday , decltype( std::declval()++)); - ASSERT_SAME_TYPE(weekday&, decltype(++std::declval() )); - - static_assert(testConstexpr(), ""); - - for (unsigned i = 0; i <= 6; ++i) - { - weekday wd(i); - assert((static_cast(++wd) == euclidian_addition(i, 1))); - assert((static_cast(wd++) == euclidian_addition(i, 1))); - assert((static_cast(wd) == euclidian_addition(i, 2))); - } -} diff --git a/libcxx/test/std/utilities/time/time.cal/time.cal.weekday/time.cal.weekday.members/ok.pass.cpp b/libcxx/test/std/utilities/time/time.cal/time.cal.weekday/time.cal.weekday.members/ok.pass.cpp deleted file mode 100644 index 82ae2b3b5b90..000000000000 --- a/libcxx/test/std/utilities/time/time.cal/time.cal.weekday/time.cal.weekday.members/ok.pass.cpp +++ /dev/null @@ -1,38 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// -// UNSUPPORTED: c++03, c++11, c++14, c++17 - -// -// class weekday; - -// constexpr bool ok() const noexcept; -// Returns: wd_ <= 6 - -#include -#include -#include - -#include "test_macros.h" - -int main() -{ - using weekday = std::chrono::weekday; - - ASSERT_NOEXCEPT( std::declval().ok()); - ASSERT_SAME_TYPE(bool, decltype(std::declval().ok())); - - static_assert( weekday{0}.ok(), ""); - static_assert( weekday{1}.ok(), ""); - static_assert(!weekday{7}.ok(), ""); - - for (unsigned i = 0; i <= 6; ++i) - assert(weekday{i}.ok()); - for (unsigned i = 7; i <= 255; ++i) - assert(!weekday{i}.ok()); -} diff --git a/libcxx/test/std/utilities/time/time.cal/time.cal.weekday/time.cal.weekday.members/operator[].pass.cpp b/libcxx/test/std/utilities/time/time.cal/time.cal.weekday/time.cal.weekday.members/operator[].pass.cpp deleted file mode 100644 index 4b66e7ad8033..000000000000 --- a/libcxx/test/std/utilities/time/time.cal/time.cal.weekday/time.cal.weekday.members/operator[].pass.cpp +++ /dev/null @@ -1,59 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// -// UNSUPPORTED: c++03, c++11, c++14, c++17 - -// -// class weekday; - -// constexpr weekday_indexed operator[](unsigned index) const noexcept; -// constexpr weekday_last operator[](last_spec) const noexcept; - - -#include -#include -#include - -#include "test_macros.h" -#include "../../euclidian.h" - -int main() -{ - using weekday = std::chrono::weekday; - using weekday_last = std::chrono::weekday_last; - using weekday_indexed = std::chrono::weekday_indexed; - - constexpr weekday Sunday = std::chrono::Sunday; - - ASSERT_NOEXCEPT( std::declval()[1U]); - ASSERT_SAME_TYPE(weekday_indexed, decltype(std::declval()[1U])); - - ASSERT_NOEXCEPT( std::declval()[std::chrono::last]); - ASSERT_SAME_TYPE(weekday_last, decltype(std::declval()[std::chrono::last])); - - static_assert(Sunday[2].weekday() == Sunday, ""); - static_assert(Sunday[2].index () == 2, ""); - - for (unsigned i = 0; i <= 6; ++i) - { - weekday wd(i); - weekday_last wdl = wd[std::chrono::last]; - assert(wdl.weekday() == wd); - assert(wdl.ok()); - } - - for (unsigned i = 0; i <= 6; ++i) - for (unsigned j = 1; j <= 5; ++j) - { - weekday wd(i); - weekday_indexed wdi = wd[j]; - assert(wdi.weekday() == wd); - assert(wdi.index() == j); - assert(wdi.ok()); - } -} diff --git a/libcxx/test/std/utilities/time/time.cal/time.cal.weekday/time.cal.weekday.members/plus_minus_equal.pass.cpp b/libcxx/test/std/utilities/time/time.cal/time.cal.weekday/time.cal.weekday.members/plus_minus_equal.pass.cpp deleted file mode 100644 index 32d2289f1072..000000000000 --- a/libcxx/test/std/utilities/time/time.cal/time.cal.weekday/time.cal.weekday.members/plus_minus_equal.pass.cpp +++ /dev/null @@ -1,63 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// -// UNSUPPORTED: c++03, c++11, c++14, c++17 - -// -// class weekday; - -// constexpr weekday& operator+=(const days& d) noexcept; -// constexpr weekday& operator-=(const days& d) noexcept; - -#include -#include -#include - -#include "test_macros.h" -#include "../../euclidian.h" - -template -constexpr bool testConstexpr() -{ - M m1{1}; - if (static_cast(m1 += Ms{ 1}) != 2) return false; - if (static_cast(m1 += Ms{ 2}) != 4) return false; - if (static_cast(m1 += Ms{ 4}) != 1) return false; - if (static_cast(m1 -= Ms{ 1}) != 0) return false; - if (static_cast(m1 -= Ms{ 2}) != 5) return false; - if (static_cast(m1 -= Ms{ 4}) != 1) return false; - return true; -} - -int main() -{ - using weekday = std::chrono::weekday; - using days = std::chrono::days; - - ASSERT_NOEXCEPT( std::declval() += std::declval()); - ASSERT_SAME_TYPE(weekday&, decltype(std::declval() += std::declval())); - - ASSERT_NOEXCEPT( std::declval() -= std::declval()); - ASSERT_SAME_TYPE(weekday&, decltype(std::declval() -= std::declval())); - - static_assert(testConstexpr(), ""); - - for (unsigned i = 0; i <= 6; ++i) - { - weekday wd(i); - assert((static_cast(wd += days{3}) == euclidian_addition(i, 3))); - assert((static_cast(wd) == euclidian_addition(i, 3))); - } - - for (unsigned i = 0; i <= 6; ++i) - { - weekday wd(i); - assert((static_cast(wd -= days{4}) == euclidian_subtraction(i, 4))); - assert((static_cast(wd) == euclidian_subtraction(i, 4))); - } -} diff --git a/libcxx/test/std/utilities/time/time.cal/time.cal.weekday/time.cal.weekday.nonmembers/comparisons.pass.cpp b/libcxx/test/std/utilities/time/time.cal/time.cal.weekday/time.cal.weekday.nonmembers/comparisons.pass.cpp deleted file mode 100644 index 65df8aee1c20..000000000000 --- a/libcxx/test/std/utilities/time/time.cal/time.cal.weekday/time.cal.weekday.nonmembers/comparisons.pass.cpp +++ /dev/null @@ -1,42 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// -// UNSUPPORTED: c++03, c++11, c++14, c++17 - -// -// class weekday; - -// constexpr bool operator==(const weekday& x, const weekday& y) noexcept; -// constexpr bool operator!=(const weekday& x, const weekday& y) noexcept; - - -#include -#include -#include - -#include "test_macros.h" -#include "test_comparisons.h" - -int main() -{ - using weekday = std::chrono::weekday; - - AssertComparisons2AreNoexcept(); - AssertComparisons2ReturnBool(); - - static_assert(testComparisons2Values(0U ,0U), ""); - static_assert(testComparisons2Values(0U, 1U), ""); - -// Some 'ok' values as well - static_assert(testComparisons2Values(5U, 5U), ""); - static_assert(testComparisons2Values(5U, 2U), ""); - - for (unsigned i = 0; i < 6; ++i) - for (unsigned j = 0; j < 6; ++j) - assert(testComparisons2Values(i, j)); -} diff --git a/libcxx/test/std/utilities/time/time.cal/time.cal.weekday/time.cal.weekday.nonmembers/literals.pass.cpp b/libcxx/test/std/utilities/time/time.cal/time.cal.weekday/time.cal.weekday.nonmembers/literals.pass.cpp deleted file mode 100644 index 2bf676c7cbf0..000000000000 --- a/libcxx/test/std/utilities/time/time.cal/time.cal.weekday/time.cal.weekday.nonmembers/literals.pass.cpp +++ /dev/null @@ -1,62 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// -// UNSUPPORTED: c++03, c++11, c++14, c++17 - -// - -// inline constexpr weekday Sunday{0}; -// inline constexpr weekday Monday{1}; -// inline constexpr weekday Tuesday{2}; -// inline constexpr weekday Wednesday{3}; -// inline constexpr weekday Thursday{4}; -// inline constexpr weekday Friday{5}; -// inline constexpr weekday Saturday{6}; - - -#include -#include -#include - -#include "test_macros.h" - -int main() -{ - - ASSERT_SAME_TYPE(const std::chrono::weekday, decltype(std::chrono::Sunday)); - ASSERT_SAME_TYPE(const std::chrono::weekday, decltype(std::chrono::Monday)); - ASSERT_SAME_TYPE(const std::chrono::weekday, decltype(std::chrono::Tuesday)); - ASSERT_SAME_TYPE(const std::chrono::weekday, decltype(std::chrono::Wednesday)); - ASSERT_SAME_TYPE(const std::chrono::weekday, decltype(std::chrono::Thursday)); - ASSERT_SAME_TYPE(const std::chrono::weekday, decltype(std::chrono::Friday)); - ASSERT_SAME_TYPE(const std::chrono::weekday, decltype(std::chrono::Saturday)); - - static_assert( std::chrono::Sunday == std::chrono::weekday(0), ""); - static_assert( std::chrono::Monday == std::chrono::weekday(1), ""); - static_assert( std::chrono::Tuesday == std::chrono::weekday(2), ""); - static_assert( std::chrono::Wednesday == std::chrono::weekday(3), ""); - static_assert( std::chrono::Thursday == std::chrono::weekday(4), ""); - static_assert( std::chrono::Friday == std::chrono::weekday(5), ""); - static_assert( std::chrono::Saturday == std::chrono::weekday(6), ""); - - assert(std::chrono::Sunday == std::chrono::weekday(0)); - assert(std::chrono::Monday == std::chrono::weekday(1)); - assert(std::chrono::Tuesday == std::chrono::weekday(2)); - assert(std::chrono::Wednesday == std::chrono::weekday(3)); - assert(std::chrono::Thursday == std::chrono::weekday(4)); - assert(std::chrono::Friday == std::chrono::weekday(5)); - assert(std::chrono::Saturday == std::chrono::weekday(6)); - - assert(static_cast(std::chrono::Sunday) == 0); - assert(static_cast(std::chrono::Monday) == 1); - assert(static_cast(std::chrono::Tuesday) == 2); - assert(static_cast(std::chrono::Wednesday) == 3); - assert(static_cast(std::chrono::Thursday) == 4); - assert(static_cast(std::chrono::Friday) == 5); - assert(static_cast(std::chrono::Saturday) == 6); -} diff --git a/libcxx/test/std/utilities/time/time.cal/time.cal.weekday/time.cal.weekday.nonmembers/minus.pass.cpp b/libcxx/test/std/utilities/time/time.cal/time.cal.weekday/time.cal.weekday.nonmembers/minus.pass.cpp deleted file mode 100644 index 78734e504e6c..000000000000 --- a/libcxx/test/std/utilities/time/time.cal/time.cal.weekday/time.cal.weekday.nonmembers/minus.pass.cpp +++ /dev/null @@ -1,76 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// -// UNSUPPORTED: c++03, c++11, c++14, c++17 - -// -// class weekday; - -// constexpr weekday operator-(const weekday& x, const days& y) noexcept; -// Returns: x + -y. -// -// constexpr days operator-(const weekday& x, const weekday& y) noexcept; -// Returns: If x.ok() == true and y.ok() == true, returns a value d in the range -// [days{0}, days{6}] satisfying y + d == x. -// Otherwise the value returned is unspecified. -// [Example: Sunday - Monday == days{6}. —end example] - - -extern "C" int printf(const char *, ...); - -#include -#include -#include - -#include "test_macros.h" -#include "../../euclidian.h" - -template -constexpr bool testConstexpr() -{ - { - WD wd{5}; - Ds offset{3}; - if (wd - offset != WD{2}) return false; - if (wd - WD{2} != offset) return false; - } - -// Check the example - if (WD{0} - WD{1} != Ds{6}) return false; - return true; -} - -int main() -{ - using weekday = std::chrono::weekday; - using days = std::chrono::days; - - ASSERT_NOEXCEPT( std::declval() - std::declval()); - ASSERT_SAME_TYPE(weekday, decltype(std::declval() - std::declval())); - - ASSERT_NOEXCEPT( std::declval() - std::declval()); - ASSERT_SAME_TYPE(days, decltype(std::declval() - std::declval())); - - static_assert(testConstexpr(), ""); - - for (unsigned i = 0; i <= 6; ++i) - for (unsigned j = 0; j <= 6; ++j) - { - weekday wd = weekday{i} - days{j}; - assert(wd + days{j} == weekday{i}); - assert((static_cast(wd) == euclidian_subtraction(i, j))); - } - - for (unsigned i = 0; i <= 6; ++i) - for (unsigned j = 0; j <= 6; ++j) - { - days d = weekday{j} - weekday{i}; - assert(weekday{i} + d == weekday{j}); - } - -} diff --git a/libcxx/test/std/utilities/time/time.cal/time.cal.weekday/time.cal.weekday.nonmembers/plus.pass.cpp b/libcxx/test/std/utilities/time/time.cal/time.cal.weekday/time.cal.weekday.nonmembers/plus.pass.cpp deleted file mode 100644 index b7ef53f80a7f..000000000000 --- a/libcxx/test/std/utilities/time/time.cal/time.cal.weekday/time.cal.weekday.nonmembers/plus.pass.cpp +++ /dev/null @@ -1,70 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// -// UNSUPPORTED: c++03, c++11, c++14, c++17 - -// -// class weekday; - -// constexpr weekday operator+(const days& x, const weekday& y) noexcept; -// Returns: weekday(int{x} + y.count()). -// -// constexpr weekday operator+(const weekday& x, const days& y) noexcept; -// Returns: -// weekday{modulo(static_cast(unsigned{x}) + y.count(), 7)} -// where modulo(n, 7) computes the remainder of n divided by 7 using Euclidean division. -// [Note: Given a divisor of 12, Euclidean division truncates towards negative infinity -// and always produces a remainder in the range of [0, 6]. -// Assuming no overflow in the signed summation, this operation results in a weekday -// holding a value in the range [0, 6] even if !x.ok(). —end note] -// [Example: Monday + days{6} == Sunday. —end example] - - - -#include -#include -#include - -#include "test_macros.h" -#include "../../euclidian.h" - -template -constexpr bool testConstexpr() -{ - M m{1}; - Ms offset{4}; - if (m + offset != M{5}) return false; - if (offset + m != M{5}) return false; -// Check the example - if (M{1} + Ms{6} != M{0}) return false; - return true; -} - -int main() -{ - using weekday = std::chrono::weekday; - using days = std::chrono::days; - - ASSERT_NOEXCEPT( std::declval() + std::declval()); - ASSERT_SAME_TYPE(weekday, decltype(std::declval() + std::declval())); - - ASSERT_NOEXCEPT( std::declval() + std::declval()); - ASSERT_SAME_TYPE(weekday, decltype(std::declval() + std::declval())); - - static_assert(testConstexpr(), ""); - - for (unsigned i = 0; i <= 6; ++i) - for (unsigned j = 0; j <= 6; ++j) - { - weekday wd1 = weekday{i} + days{j}; - weekday wd2 = days{j} + weekday{i}; - assert(wd1 == wd2); - assert((static_cast(wd1) == euclidian_addition(i, j))); - assert((static_cast(wd2) == euclidian_addition(i, j))); - } -} diff --git a/libcxx/test/std/utilities/time/time.cal/time.cal.weekday/time.cal.weekday.nonmembers/streaming.pass.cpp b/libcxx/test/std/utilities/time/time.cal/time.cal.weekday/time.cal.weekday.nonmembers/streaming.pass.cpp deleted file mode 100644 index 39cc3b81b5bc..000000000000 --- a/libcxx/test/std/utilities/time/time.cal/time.cal.weekday/time.cal.weekday.nonmembers/streaming.pass.cpp +++ /dev/null @@ -1,56 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// -// UNSUPPORTED: c++03, c++11, c++14, c++17 -// XFAIL: * - -// -// class weekday; - -// template -// basic_ostream& -// operator<<(basic_ostream& os, const weekday& wd); -// -// Effects: If wd.ok() == true inserts format(os.getloc(), fmt, wd) where fmt is "%a" widened to charT. -// Otherwise inserts unsigned{wd} << " is not a valid weekday". -// -// template -// basic_ostream& -// to_stream(basic_ostream& os, const charT* fmt, const weekday& wd); -// -// Effects: Streams wd into os using the format specified by the NTCTS fmt. -// fmt encoding follows the rules specified in 25.11. -// -// template> -// basic_istream& -// from_stream(basic_istream& is, const charT* fmt, -// weekday& wd, basic_string* abbrev = nullptr, -// minutes* offset = nullptr); -// -// Effects: Attempts to parse the input stream is into the weekday wd using -// the format flags given in the NTCTS fmt as specified in 25.12. -// If the parse fails to decode a valid weekday, is.setstate(ios_- base::failbit) -// shall be called and wd shall not be modified. -// If %Z is used and successfully parsed, that value will be assigned -// to *abbrev if abbrev is non-null. -// If %z (or a modified variant) is used and successfully parsed, -// that value will be assigned to *offset if offset is non-null. - -#include -#include -#include -#include - -#include "test_macros.h" - -int main() -{ - using weekday = std::chrono::weekday; - - std::cout << weekday{3}; -} diff --git a/libcxx/test/std/utilities/time/time.cal/time.cal.weekday/types.pass.cpp b/libcxx/test/std/utilities/time/time.cal/time.cal.weekday/types.pass.cpp deleted file mode 100644 index 7fad10dc943d..000000000000 --- a/libcxx/test/std/utilities/time/time.cal/time.cal.weekday/types.pass.cpp +++ /dev/null @@ -1,26 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// -// UNSUPPORTED: c++03, c++11, c++14, c++17 - -// -// class weekday; - -#include -#include -#include - -#include "test_macros.h" - -int main() -{ - using weekday = std::chrono::weekday; - - static_assert(std::is_trivially_copyable_v, ""); - static_assert(std::is_standard_layout_v, ""); -} diff --git a/libcxx/test/std/utilities/time/time.cal/time.cal.year/time.cal.year.members/ctor.pass.cpp b/libcxx/test/std/utilities/time/time.cal/time.cal.year/time.cal.year.members/ctor.pass.cpp deleted file mode 100644 index 615258910aeb..000000000000 --- a/libcxx/test/std/utilities/time/time.cal/time.cal.year/time.cal.year.members/ctor.pass.cpp +++ /dev/null @@ -1,46 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// -// UNSUPPORTED: c++03, c++11, c++14, c++17 - -// -// class year; - -// year() = default; -// explicit constexpr year(int m) noexcept; -// explicit constexpr operator int() const noexcept; - -// Effects: Constructs an object of type year by initializing y_ with y. -// The value held is unspecified if d is not in the range [0, 255]. - -#include -#include -#include - -#include "test_macros.h" - -int main() -{ - using year = std::chrono::year; - - ASSERT_NOEXCEPT(year{}); - ASSERT_NOEXCEPT(year(0U)); - ASSERT_NOEXCEPT(static_cast(year(0U))); - - constexpr year y0{}; - static_assert(static_cast(y0) == 0, ""); - - constexpr year y1{1}; - static_assert(static_cast(y1) == 1, ""); - - for (int i = 0; i <= 2550; i += 7) - { - year year(i); - assert(static_cast(year) == i); - } -} diff --git a/libcxx/test/std/utilities/time/time.cal/time.cal.year/time.cal.year.members/decrement.pass.cpp b/libcxx/test/std/utilities/time/time.cal/time.cal.year/time.cal.year.members/decrement.pass.cpp deleted file mode 100644 index 61d5617ed0e4..000000000000 --- a/libcxx/test/std/utilities/time/time.cal/time.cal.year/time.cal.year.members/decrement.pass.cpp +++ /dev/null @@ -1,52 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// -// UNSUPPORTED: c++03, c++11, c++14, c++17 - -// -// class year; - -// constexpr year& operator--() noexcept; -// constexpr year operator--(int) noexcept; - - -#include -#include -#include - -#include "test_macros.h" - -template -constexpr bool testConstexpr() -{ - Y y1{10}; - if (static_cast(--y1) != 9) return false; - if (static_cast(y1--) != 9) return false; - if (static_cast(y1) != 8) return false; - return true; -} - -int main() -{ - using year = std::chrono::year; - ASSERT_NOEXCEPT(--(std::declval()) ); - ASSERT_NOEXCEPT( (std::declval())--); - - ASSERT_SAME_TYPE(year , decltype( std::declval()--)); - ASSERT_SAME_TYPE(year&, decltype(--std::declval() )); - - static_assert(testConstexpr(), ""); - - for (int i = 11000; i <= 11020; ++i) - { - year year(i); - assert(static_cast(--year) == i - 1); - assert(static_cast(year--) == i - 1); - assert(static_cast(year) == i - 2); - } -} diff --git a/libcxx/test/std/utilities/time/time.cal/time.cal.year/time.cal.year.members/increment.pass.cpp b/libcxx/test/std/utilities/time/time.cal/time.cal.year/time.cal.year.members/increment.pass.cpp deleted file mode 100644 index ec21990c0194..000000000000 --- a/libcxx/test/std/utilities/time/time.cal/time.cal.year/time.cal.year.members/increment.pass.cpp +++ /dev/null @@ -1,52 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// -// UNSUPPORTED: c++03, c++11, c++14, c++17 - -// -// class year; - -// constexpr year& operator++() noexcept; -// constexpr year operator++(int) noexcept; - - -#include -#include -#include - -#include "test_macros.h" - -template -constexpr bool testConstexpr() -{ - Y y1{10}; - if (static_cast(++y1) != 11) return false; - if (static_cast(y1++) != 11) return false; - if (static_cast(y1) != 12) return false; - return true; -} - -int main() -{ - using year = std::chrono::year; - ASSERT_NOEXCEPT(++(std::declval()) ); - ASSERT_NOEXCEPT( (std::declval())++); - - ASSERT_SAME_TYPE(year , decltype( std::declval()++)); - ASSERT_SAME_TYPE(year&, decltype(++std::declval() )); - - static_assert(testConstexpr(), ""); - - for (int i = 11000; i <= 11020; ++i) - { - year year(i); - assert(static_cast(++year) == i + 1); - assert(static_cast(year++) == i + 1); - assert(static_cast(year) == i + 2); - } -} diff --git a/libcxx/test/std/utilities/time/time.cal/time.cal.year/time.cal.year.members/is_leap.pass.cpp b/libcxx/test/std/utilities/time/time.cal/time.cal.year/time.cal.year.members/is_leap.pass.cpp deleted file mode 100644 index 2cd493a6f55c..000000000000 --- a/libcxx/test/std/utilities/time/time.cal/time.cal.year/time.cal.year.members/is_leap.pass.cpp +++ /dev/null @@ -1,53 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// -// UNSUPPORTED: c++03, c++11, c++14, c++17 - -// -// class year; - -// constexpr bool is_is_leap() const noexcept; -// y_ % 4 == 0 && (y_ % 100 != 0 || y_ % 400 == 0) -// - -#include -#include -#include - -#include "test_macros.h" - -int main() -{ - using year = std::chrono::year; - - ASSERT_NOEXCEPT( year(1).is_leap()); - ASSERT_SAME_TYPE(bool, decltype(year(1).is_leap())); - - static_assert(!year{1}.is_leap(), ""); - static_assert(!year{2}.is_leap(), ""); - static_assert(!year{3}.is_leap(), ""); - static_assert( year{4}.is_leap(), ""); - - assert( year{-2000}.is_leap()); - assert( year{ -400}.is_leap()); - assert(!year{ -300}.is_leap()); - assert(!year{ -200}.is_leap()); - - assert(!year{ 200}.is_leap()); - assert(!year{ 300}.is_leap()); - assert( year{ 400}.is_leap()); - assert(!year{ 1997}.is_leap()); - assert(!year{ 1998}.is_leap()); - assert(!year{ 1999}.is_leap()); - assert( year{ 2000}.is_leap()); - assert(!year{ 2001}.is_leap()); - assert(!year{ 2002}.is_leap()); - assert(!year{ 2003}.is_leap()); - assert( year{ 2004}.is_leap()); - assert(!year{ 2100}.is_leap()); -} diff --git a/libcxx/test/std/utilities/time/time.cal/time.cal.year/time.cal.year.members/ok.pass.cpp b/libcxx/test/std/utilities/time/time.cal/time.cal.year/time.cal.year.members/ok.pass.cpp deleted file mode 100644 index 98a7dec5f180..000000000000 --- a/libcxx/test/std/utilities/time/time.cal/time.cal.year/time.cal.year.members/ok.pass.cpp +++ /dev/null @@ -1,53 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// -// UNSUPPORTED: c++03, c++11, c++14, c++17 - -// -// class year; - -// constexpr bool ok() const noexcept; -// Returns: min() <= y_ && y_ <= max(). -// -// static constexpr year min() noexcept; -// Returns year{ 32767}; -// static constexpr year max() noexcept; -// Returns year{-32767}; - -#include -#include -#include - -#include "test_macros.h" - -int main() -{ - using year = std::chrono::year; - - ASSERT_NOEXCEPT( std::declval().ok()); - ASSERT_SAME_TYPE(bool, decltype(std::declval().ok())); - - ASSERT_NOEXCEPT( year::max()); - ASSERT_SAME_TYPE(year, decltype(year::max())); - - ASSERT_NOEXCEPT( year::min()); - ASSERT_SAME_TYPE(year, decltype(year::min())); - - static_assert(static_cast(year::min()) == -32767, ""); - static_assert(static_cast(year::max()) == 32767, ""); - - assert(year{-20001}.ok()); - assert(year{ -2000}.ok()); - assert(year{ -1}.ok()); - assert(year{ 0}.ok()); - assert(year{ 1}.ok()); - assert(year{ 2000}.ok()); - assert(year{ 20001}.ok()); - - static_assert(!year{-32768}.ok(), ""); -} diff --git a/libcxx/test/std/utilities/time/time.cal/time.cal.year/time.cal.year.members/plus_minus.pass.cpp b/libcxx/test/std/utilities/time/time.cal/time.cal.year/time.cal.year.members/plus_minus.pass.cpp deleted file mode 100644 index 9d96b3ffbbea..000000000000 --- a/libcxx/test/std/utilities/time/time.cal/time.cal.year/time.cal.year.members/plus_minus.pass.cpp +++ /dev/null @@ -1,51 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// -// UNSUPPORTED: c++03, c++11, c++14, c++17 - -// -// class year; - -// constexpr year operator+() const noexcept; -// constexpr year operator-() const noexcept; - -#include -#include -#include - -#include "test_macros.h" - -template -constexpr bool testConstexpr() -{ - Y y1{1}; - if (static_cast(+y1) != 1) return false; - if (static_cast(-y1) != -1) return false; - return true; -} - -int main() -{ - using year = std::chrono::year; - using years = std::chrono::years; - - ASSERT_NOEXCEPT(+std::declval()); - ASSERT_NOEXCEPT(-std::declval()); - - ASSERT_SAME_TYPE(year, decltype(+std::declval())); - ASSERT_SAME_TYPE(year, decltype(-std::declval())); - - static_assert(testConstexpr(), ""); - - for (int i = 10000; i <= 10020; ++i) - { - year year(i); - assert(static_cast(+year) == i); - assert(static_cast(-year) == -i); - } -} diff --git a/libcxx/test/std/utilities/time/time.cal/time.cal.year/time.cal.year.members/plus_minus_equal.pass.cpp b/libcxx/test/std/utilities/time/time.cal/time.cal.year/time.cal.year.members/plus_minus_equal.pass.cpp deleted file mode 100644 index 0ebd2d668c37..000000000000 --- a/libcxx/test/std/utilities/time/time.cal/time.cal.year/time.cal.year.members/plus_minus_equal.pass.cpp +++ /dev/null @@ -1,57 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// -// UNSUPPORTED: c++03, c++11, c++14, c++17 - -// -// class year; - -// constexpr year& operator+=(const years& d) noexcept; -// constexpr year& operator-=(const years& d) noexcept; - -#include -#include -#include - -#include "test_macros.h" - -template -constexpr bool testConstexpr() -{ - Y y1{1}; - if (static_cast(y1 += Ys{ 1}) != 2) return false; - if (static_cast(y1 += Ys{ 2}) != 4) return false; - if (static_cast(y1 += Ys{ 8}) != 12) return false; - if (static_cast(y1 -= Ys{ 1}) != 11) return false; - if (static_cast(y1 -= Ys{ 2}) != 9) return false; - if (static_cast(y1 -= Ys{ 8}) != 1) return false; - return true; -} - -int main() -{ - using year = std::chrono::year; - using years = std::chrono::years; - - ASSERT_NOEXCEPT(std::declval() += std::declval()); - ASSERT_NOEXCEPT(std::declval() -= std::declval()); - - ASSERT_SAME_TYPE(year&, decltype(std::declval() += std::declval())); - ASSERT_SAME_TYPE(year&, decltype(std::declval() -= std::declval())); - - static_assert(testConstexpr(), ""); - - for (int i = 10000; i <= 10020; ++i) - { - year year(i); - assert(static_cast(year += years{10}) == i + 10); - assert(static_cast(year) == i + 10); - assert(static_cast(year -= years{ 9}) == i + 1); - assert(static_cast(year) == i + 1); - } -} diff --git a/libcxx/test/std/utilities/time/time.cal/time.cal.year/time.cal.year.nonmembers/comparisons.pass.cpp b/libcxx/test/std/utilities/time/time.cal/time.cal.year/time.cal.year.nonmembers/comparisons.pass.cpp deleted file mode 100644 index a158c5e4ba95..000000000000 --- a/libcxx/test/std/utilities/time/time.cal/time.cal.year/time.cal.year.nonmembers/comparisons.pass.cpp +++ /dev/null @@ -1,47 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// -// UNSUPPORTED: c++03, c++11, c++14, c++17 - -// -// class year; - -// constexpr bool operator==(const year& x, const year& y) noexcept; -// constexpr bool operator!=(const year& x, const year& y) noexcept; -// constexpr bool operator< (const year& x, const year& y) noexcept; -// constexpr bool operator> (const year& x, const year& y) noexcept; -// constexpr bool operator<=(const year& x, const year& y) noexcept; -// constexpr bool operator>=(const year& x, const year& y) noexcept; - - -#include -#include -#include - -#include "test_macros.h" -#include "test_comparisons.h" - - -int main() -{ - using year = std::chrono::year; - - AssertComparisons6AreNoexcept(); - AssertComparisons6ReturnBool(); - - static_assert(testComparisons6Values(0,0), ""); - static_assert(testComparisons6Values(0,1), ""); - -// Some 'ok' values as well - static_assert(testComparisons6Values( 5, 5), ""); - static_assert(testComparisons6Values( 5,10), ""); - - for (int i = 1; i < 10; ++i) - for (int j = 1; j < 10; ++j) - assert(testComparisons6Values(i, j)); -} diff --git a/libcxx/test/std/utilities/time/time.cal/time.cal.year/time.cal.year.nonmembers/literals.fail.cpp b/libcxx/test/std/utilities/time/time.cal/time.cal.year/time.cal.year.nonmembers/literals.fail.cpp deleted file mode 100644 index 593ce6254352..000000000000 --- a/libcxx/test/std/utilities/time/time.cal/time.cal.year/time.cal.year.nonmembers/literals.fail.cpp +++ /dev/null @@ -1,26 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// -// UNSUPPORTED: c++03, c++11, c++14, c++17 - -// -// class year; - -// constexpr year operator""y(unsigned long long y) noexcept; - -#include -#include -#include - -#include "test_macros.h" - -int main() -{ - using std::chrono::year; - year d1 = 1234y; // expected-error-re {{no matching literal operator for call to 'operator""y' {{.*}}}} -} diff --git a/libcxx/test/std/utilities/time/time.cal/time.cal.year/time.cal.year.nonmembers/literals.pass.cpp b/libcxx/test/std/utilities/time/time.cal/time.cal.year/time.cal.year.nonmembers/literals.pass.cpp deleted file mode 100644 index 6ace29324244..000000000000 --- a/libcxx/test/std/utilities/time/time.cal/time.cal.year/time.cal.year.nonmembers/literals.pass.cpp +++ /dev/null @@ -1,44 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// -// UNSUPPORTED: c++03, c++11, c++14, c++17 -// UNSUPPORTED: clang-5, clang-6 -// UNSUPPORTED: apple-clang-6, apple-clang-7, apple-clang-8, apple-clang-9 - -// -// class year; - -// constexpr year operator""y(unsigned long long y) noexcept; - -#include -#include -#include - -#include "test_macros.h" - -int main() -{ - { - using namespace std::chrono; - ASSERT_NOEXCEPT(4y); - - static_assert( 2017y == year(2017), ""); - year y1 = 2018y; - assert (y1 == year(2018)); - } - - { - using namespace std::literals; - ASSERT_NOEXCEPT(4d); - - static_assert( 2017y == std::chrono::year(2017), ""); - - std::chrono::year y1 = 2020y; - assert (y1 == std::chrono::year(2020)); - } -} diff --git a/libcxx/test/std/utilities/time/time.cal/time.cal.year/time.cal.year.nonmembers/minus.pass.cpp b/libcxx/test/std/utilities/time/time.cal/time.cal.year/time.cal.year.nonmembers/minus.pass.cpp deleted file mode 100644 index 788b95896883..000000000000 --- a/libcxx/test/std/utilities/time/time.cal/time.cal.year/time.cal.year.nonmembers/minus.pass.cpp +++ /dev/null @@ -1,62 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// -// UNSUPPORTED: c++03, c++11, c++14, c++17 - -// -// class year; - -// constexpr year operator-(const year& x, const years& y) noexcept; -// Returns: x + -y. -// -// constexpr years operator-(const year& x, const year& y) noexcept; -// Returns: If x.ok() == true and y.ok() == true, returns a value m in the range -// [years{0}, years{11}] satisfying y + m == x. -// Otherwise the value returned is unspecified. -// [Example: January - February == years{11}. —end example] - -extern "C" int printf(const char *, ...); - -#include -#include -#include - -#include "test_macros.h" - -template -constexpr bool testConstexpr() -{ - Y y{2313}; - Ys offset{1006}; - if (y - offset != Y{1307}) return false; - if (y - Y{1307} != offset) return false; - return true; -} - -int main() -{ - using year = std::chrono::year; - using years = std::chrono::years; - - ASSERT_NOEXCEPT( std::declval() - std::declval()); - ASSERT_SAME_TYPE(year , decltype(std::declval() - std::declval())); - - ASSERT_NOEXCEPT( std::declval() - std::declval()); - ASSERT_SAME_TYPE(years, decltype(std::declval() - std::declval())); - - static_assert(testConstexpr(), ""); - - year y{1223}; - for (int i = 1100; i <= 1110; ++i) - { - year y1 = y - years{i}; - years ys1 = y - year{i}; - assert(static_cast(y1) == 1223 - i); - assert(ys1.count() == 1223 - i); - } -} diff --git a/libcxx/test/std/utilities/time/time.cal/time.cal.year/time.cal.year.nonmembers/plus.pass.cpp b/libcxx/test/std/utilities/time/time.cal/time.cal.year/time.cal.year.nonmembers/plus.pass.cpp deleted file mode 100644 index 9d71c953fe97..000000000000 --- a/libcxx/test/std/utilities/time/time.cal/time.cal.year/time.cal.year.nonmembers/plus.pass.cpp +++ /dev/null @@ -1,59 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// -// UNSUPPORTED: c++03, c++11, c++14, c++17 - -// -// class year; - -// constexpr year operator+(const year& x, const years& y) noexcept; -// Returns: year(int{x} + y.count()). -// -// constexpr year operator+(const years& x, const year& y) noexcept; -// Returns: y + x - - -#include -#include -#include - -#include "test_macros.h" - -template -constexpr bool testConstexpr() -{ - Y y{1001}; - Ys offset{23}; - if (y + offset != Y{1024}) return false; - if (offset + y != Y{1024}) return false; - return true; -} - -int main() -{ - using year = std::chrono::year; - using years = std::chrono::years; - - ASSERT_NOEXCEPT( std::declval() + std::declval()); - ASSERT_SAME_TYPE(year, decltype(std::declval() + std::declval())); - - ASSERT_NOEXCEPT( std::declval() + std::declval()); - ASSERT_SAME_TYPE(year, decltype(std::declval() + std::declval())); - - static_assert(testConstexpr(), ""); - - year y{1223}; - for (int i = 1100; i <= 1110; ++i) - { - year y1 = y + years{i}; - year y2 = years{i} + y; - assert(y1 == y2); - assert(static_cast(y1) == i + 1223); - assert(static_cast(y2) == i + 1223); - } -} diff --git a/libcxx/test/std/utilities/time/time.cal/time.cal.year/time.cal.year.nonmembers/streaming.pass.cpp b/libcxx/test/std/utilities/time/time.cal/time.cal.year/time.cal.year.nonmembers/streaming.pass.cpp deleted file mode 100644 index 120c2a15a6fd..000000000000 --- a/libcxx/test/std/utilities/time/time.cal/time.cal.year/time.cal.year.nonmembers/streaming.pass.cpp +++ /dev/null @@ -1,55 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// -// UNSUPPORTED: c++03, c++11, c++14, c++17 -// XFAIL: * - -// -// class year; - -// template -// basic_ostream& -// operator<<(basic_ostream& os, const year& y); -// -// Effects: Inserts format(fmt, y) where fmt is "%Y" widened to charT. -// If !y.ok(), appends with " is not a valid year". -// -// template -// basic_ostream& -// to_stream(basic_ostream& os, const charT* fmt, const year& y); -// -// Effects: Streams y into os using the format specified by the NTCTS fmt. -// fmt encoding follows the rules specified in 25.11. -// -// template> -// basic_istream& -// from_stream(basic_istream& is, const charT* fmt, -// year& y, basic_string* abbrev = nullptr, -// minutes* offset = nullptr); -// -// Effects: Attempts to parse the input stream is into the year y using the format flags -// given in the NTCTS fmt as specified in 25.12. If the parse fails to decode a valid year, -// is.setstate(ios_base::failbit) shall be called and y shall not be modified. If %Z is used -// and successfully parsed, that value will be assigned to *abbrev if abbrev is non-null. -// If %z (or a modified variant) is used and successfully parsed, that value will be -// assigned to *offset if offset is non-null. - - -#include -#include -#include -#include - -#include "test_macros.h" - -int main() -{ - using year = std::chrono::year; - - std::cout << year{2018}; -} diff --git a/libcxx/test/std/utilities/time/time.cal/time.cal.year/types.pass.cpp b/libcxx/test/std/utilities/time/time.cal/time.cal.year/types.pass.cpp deleted file mode 100644 index 24f2d773ab1b..000000000000 --- a/libcxx/test/std/utilities/time/time.cal/time.cal.year/types.pass.cpp +++ /dev/null @@ -1,26 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// -// UNSUPPORTED: c++03, c++11, c++14, c++17 - -// -// class year; - -#include -#include -#include - -#include "test_macros.h" - -int main() -{ - using year = std::chrono::year; - - static_assert(std::is_trivially_copyable_v, ""); - static_assert(std::is_standard_layout_v, ""); -} diff --git a/libcxx/test/std/utilities/time/time.cal/time.cal.ym/time.cal.ym.members/ctor.pass.cpp b/libcxx/test/std/utilities/time/time.cal/time.cal.ym/time.cal.ym.members/ctor.pass.cpp deleted file mode 100644 index bfd1f531a634..000000000000 --- a/libcxx/test/std/utilities/time/time.cal/time.cal.ym/time.cal.ym.members/ctor.pass.cpp +++ /dev/null @@ -1,52 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// -// UNSUPPORTED: c++03, c++11, c++14, c++17 - -// -// class year_month; - -// year_month() = default; -// constexpr year_month(const chrono::year& y, const chrono::month& m) noexcept; -// -// Effects: Constructs an object of type year_month by initializing y_ with y, and m_ with m. -// -// constexpr chrono::year year() const noexcept; -// constexpr chrono::month month() const noexcept; -// constexpr bool ok() const noexcept; - -#include -#include -#include - -#include "test_macros.h" - -int main() -{ - using year = std::chrono::year; - using month = std::chrono::month; - using year_month = std::chrono::year_month; - - ASSERT_NOEXCEPT(year_month{}); - ASSERT_NOEXCEPT(year_month{year{1}, month{1}}); - - constexpr year_month ym0{}; - static_assert( ym0.year() == year{}, ""); - static_assert( ym0.month() == month{}, ""); - static_assert(!ym0.ok(), ""); - - constexpr year_month ym1{year{2018}, std::chrono::January}; - static_assert( ym1.year() == year{2018}, ""); - static_assert( ym1.month() == std::chrono::January, ""); - static_assert( ym1.ok(), ""); - - constexpr year_month ym2{year{2018}, month{}}; - static_assert( ym2.year() == year{2018}, ""); - static_assert( ym2.month() == month{}, ""); - static_assert(!ym2.ok(), ""); -} diff --git a/libcxx/test/std/utilities/time/time.cal/time.cal.ym/time.cal.ym.members/month.pass.cpp b/libcxx/test/std/utilities/time/time.cal/time.cal.ym/time.cal.ym.members/month.pass.cpp deleted file mode 100644 index a747f52b653a..000000000000 --- a/libcxx/test/std/utilities/time/time.cal/time.cal.ym/time.cal.ym.members/month.pass.cpp +++ /dev/null @@ -1,39 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// -// UNSUPPORTED: c++03, c++11, c++14, c++17 - -// -// class year_month; - -// constexpr chrono::month month() const noexcept; -// Returns: wd_ - -#include -#include -#include - -#include "test_macros.h" - -int main() -{ - using year = std::chrono::year; - using month = std::chrono::month; - using year_month = std::chrono::year_month; - - ASSERT_NOEXCEPT( std::declval().month()); - ASSERT_SAME_TYPE(month, decltype(std::declval().month())); - - static_assert( year_month{}.month() == month{}, ""); - - for (unsigned i = 1; i <= 50; ++i) - { - year_month ym(year{1234}, month{i}); - assert( static_cast(ym.month()) == i); - } -} diff --git a/libcxx/test/std/utilities/time/time.cal/time.cal.ym/time.cal.ym.members/ok.pass.cpp b/libcxx/test/std/utilities/time/time.cal/time.cal.ym/time.cal.ym.members/ok.pass.cpp deleted file mode 100644 index f6a9376e1672..000000000000 --- a/libcxx/test/std/utilities/time/time.cal/time.cal.ym/time.cal.ym.members/ok.pass.cpp +++ /dev/null @@ -1,50 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// -// UNSUPPORTED: c++03, c++11, c++14, c++17 - -// -// class year_month; - -// constexpr bool ok() const noexcept; -// Returns: m_.ok() && y_.ok(). - -#include -#include -#include - -#include "test_macros.h" - -int main() -{ - using month = std::chrono::month; - using year = std::chrono::year; - using year_month = std::chrono::year_month; - - constexpr month January = std::chrono::January; - - ASSERT_NOEXCEPT( std::declval().ok()); - ASSERT_SAME_TYPE(bool, decltype(std::declval().ok())); - - static_assert(!year_month{year{-32768}, January}.ok(), ""); // Bad year - static_assert(!year_month{year{2019}, month{}}.ok(), ""); // Bad month - static_assert( year_month{year{2019}, January}.ok(), ""); // Both OK - - for (unsigned i = 0; i <= 50; ++i) - { - year_month ym{year{2019}, month{i}}; - assert( ym.ok() == month{i}.ok()); - } - - const int ymax = static_cast(year::max()); - for (int i = ymax - 100; i <= ymax + 100; ++i) - { - year_month ym{year{i}, January}; - assert( ym.ok() == year{i}.ok()); - } -} diff --git a/libcxx/test/std/utilities/time/time.cal/time.cal.ym/time.cal.ym.members/plus_minus_equal_month.pass.cpp b/libcxx/test/std/utilities/time/time.cal/time.cal.ym/time.cal.ym.members/plus_minus_equal_month.pass.cpp deleted file mode 100644 index 837eab76939b..000000000000 --- a/libcxx/test/std/utilities/time/time.cal/time.cal.ym/time.cal.ym.members/plus_minus_equal_month.pass.cpp +++ /dev/null @@ -1,64 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// -// UNSUPPORTED: c++03, c++11, c++14, c++17 - -// -// class year_month; - -// constexpr year_month& operator+=(const months& d) noexcept; -// constexpr year_month& operator-=(const months& d) noexcept; - -#include -#include -#include - -#include "test_macros.h" - -template -constexpr bool testConstexpr(D d1) -{ - if (static_cast((d1 ).month()) != 1) return false; - if (static_cast((d1 += Ds{ 1}).month()) != 2) return false; - if (static_cast((d1 += Ds{ 2}).month()) != 4) return false; - if (static_cast((d1 += Ds{12}).month()) != 4) return false; - if (static_cast((d1 -= Ds{ 1}).month()) != 3) return false; - if (static_cast((d1 -= Ds{ 2}).month()) != 1) return false; - if (static_cast((d1 -= Ds{12}).month()) != 1) return false; - return true; -} - -int main() -{ - using month = std::chrono::month; - using months = std::chrono::months; - using year = std::chrono::year; - using year_month = std::chrono::year_month; - - ASSERT_NOEXCEPT( std::declval() += std::declval()); - ASSERT_SAME_TYPE(year_month&, decltype(std::declval() += std::declval())); - - ASSERT_NOEXCEPT( std::declval() -= std::declval()); - ASSERT_SAME_TYPE(year_month&, decltype(std::declval() -= std::declval())); - - static_assert(testConstexpr(year_month{year{1234}, month{1}}), ""); - - for (unsigned i = 0; i <= 10; ++i) - { - year y{1234}; - year_month ym(y, month{i}); - assert(static_cast((ym += months{2}).month()) == i + 2); - assert(ym.year() == y); - assert(static_cast((ym ).month()) == i + 2); - assert(ym.year() == y); - assert(static_cast((ym -= months{1}).month()) == i + 1); - assert(ym.year() == y); - assert(static_cast((ym ).month()) == i + 1); - assert(ym.year() == y); - } -} diff --git a/libcxx/test/std/utilities/time/time.cal/time.cal.ym/time.cal.ym.members/plus_minus_equal_year.pass.cpp b/libcxx/test/std/utilities/time/time.cal/time.cal.ym/time.cal.ym.members/plus_minus_equal_year.pass.cpp deleted file mode 100644 index f5d8e327ef43..000000000000 --- a/libcxx/test/std/utilities/time/time.cal/time.cal.ym/time.cal.ym.members/plus_minus_equal_year.pass.cpp +++ /dev/null @@ -1,65 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// -// UNSUPPORTED: c++03, c++11, c++14, c++17 - -// -// class year_month; - -// constexpr year_month& operator+=(const years& d) noexcept; -// constexpr year_month& operator-=(const years& d) noexcept; - -#include -#include -#include - -#include "test_macros.h" - -template -constexpr bool testConstexpr(D d1) -{ - if (static_cast((d1 ).year()) != 1) return false; - if (static_cast((d1 += Ds{ 1}).year()) != 2) return false; - if (static_cast((d1 += Ds{ 2}).year()) != 4) return false; - if (static_cast((d1 += Ds{12}).year()) != 16) return false; - if (static_cast((d1 -= Ds{ 1}).year()) != 15) return false; - if (static_cast((d1 -= Ds{ 2}).year()) != 13) return false; - if (static_cast((d1 -= Ds{12}).year()) != 1) return false; - return true; -} - -int main() -{ - using month = std::chrono::month; - using year = std::chrono::year; - using years = std::chrono::years; - using year_month = std::chrono::year_month; - - - ASSERT_NOEXCEPT( std::declval() += std::declval()); - ASSERT_SAME_TYPE(year_month&, decltype(std::declval() += std::declval())); - - ASSERT_NOEXCEPT( std::declval() -= std::declval()); - ASSERT_SAME_TYPE(year_month&, decltype(std::declval() -= std::declval())); - - static_assert(testConstexpr(year_month{year{1}, month{1}}), ""); - - for (int i = 1000; i <= 1010; ++i) - { - month m{2}; - year_month ym(year{i}, m); - assert(static_cast((ym += years{2}).year()) == i + 2); - assert(ym.month() == m); - assert(static_cast((ym ).year()) == i + 2); - assert(ym.month() == m); - assert(static_cast((ym -= years{1}).year()) == i + 1); - assert(ym.month() == m); - assert(static_cast((ym ).year()) == i + 1); - assert(ym.month() == m); - } -} diff --git a/libcxx/test/std/utilities/time/time.cal/time.cal.ym/time.cal.ym.members/year.pass.cpp b/libcxx/test/std/utilities/time/time.cal/time.cal.ym/time.cal.ym.members/year.pass.cpp deleted file mode 100644 index 96fda2796263..000000000000 --- a/libcxx/test/std/utilities/time/time.cal/time.cal.ym/time.cal.ym.members/year.pass.cpp +++ /dev/null @@ -1,39 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// -// UNSUPPORTED: c++03, c++11, c++14, c++17 - -// -// class year_month; - -// constexpr chrono::day day() const noexcept; -// Returns: d_ - -#include -#include -#include - -#include "test_macros.h" - -int main() -{ - using year = std::chrono::year; - using month = std::chrono::month; - using year_month = std::chrono::year_month; - - ASSERT_NOEXCEPT( std::declval().year()); - ASSERT_SAME_TYPE(year, decltype(std::declval().year())); - - static_assert( year_month{}.year() == year{}, ""); - - for (int i = 1; i <= 50; ++i) - { - year_month ym(year{i}, month{}); - assert( static_cast(ym.year()) == i); - } -} diff --git a/libcxx/test/std/utilities/time/time.cal/time.cal.ym/time.cal.ym.nonmembers/comparisons.pass.cpp b/libcxx/test/std/utilities/time/time.cal/time.cal.ym/time.cal.ym.nonmembers/comparisons.pass.cpp deleted file mode 100644 index 9761078b24cd..000000000000 --- a/libcxx/test/std/utilities/time/time.cal/time.cal.ym/time.cal.ym.nonmembers/comparisons.pass.cpp +++ /dev/null @@ -1,69 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// -// UNSUPPORTED: c++03, c++11, c++14, c++17 - -// -// class year_month; - -// constexpr bool operator==(const year_month& x, const year_month& y) noexcept; -// Returns: x.year() == y.year() && x.month() == y.month(). -// -// constexpr bool operator< (const year_month& x, const year_month& y) noexcept; -// Returns: -// If x.year() < y.year() returns true. -// Otherwise, if x.year() > y.year() returns false. -// Otherwise, returns x.month() < y.month(). - -#include -#include -#include - -#include "test_macros.h" -#include "test_comparisons.h" - -int main() -{ - using year = std::chrono::year; - using month = std::chrono::month; - using year_month = std::chrono::year_month; - - AssertComparisons6AreNoexcept(); - AssertComparisons6ReturnBool(); - - static_assert( testComparisons6( - year_month{year{1234}, std::chrono::January}, - year_month{year{1234}, std::chrono::January}, - true, false), ""); - - static_assert( testComparisons6( - year_month{year{1234}, std::chrono::January}, - year_month{year{1234}, std::chrono::February}, - false, true), ""); - - static_assert( testComparisons6( - year_month{year{1234}, std::chrono::January}, - year_month{year{1235}, std::chrono::January}, - false, true), ""); - -// same year, different months - for (unsigned i = 1; i < 12; ++i) - for (unsigned j = 1; j < 12; ++j) - assert((testComparisons6( - year_month{year{1234}, month{i}}, - year_month{year{1234}, month{j}}, - i == j, i < j ))); - -// same month, different years - for (int i = 1000; i < 20; ++i) - for (int j = 1000; j < 20; ++j) - assert((testComparisons6( - year_month{year{i}, std::chrono::January}, - year_month{year{j}, std::chrono::January}, - i == j, i < j ))); -} diff --git a/libcxx/test/std/utilities/time/time.cal/time.cal.ym/time.cal.ym.nonmembers/minus.pass.cpp b/libcxx/test/std/utilities/time/time.cal/time.cal.ym/time.cal.ym.nonmembers/minus.pass.cpp deleted file mode 100644 index e443c50e7fdb..000000000000 --- a/libcxx/test/std/utilities/time/time.cal/time.cal.ym/time.cal.ym.nonmembers/minus.pass.cpp +++ /dev/null @@ -1,90 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// -// UNSUPPORTED: c++03, c++11, c++14, c++17 - -// -// class year_month; - -// constexpr year_month operator-(const year_month& ym, const years& dy) noexcept; -// Returns: ym + -dy. -// -// constexpr year_month operator-(const year_month& ym, const months& dm) noexcept; -// Returns: ym + -dm. -// -// constexpr months operator-(const year_month& x, const year_month& y) noexcept; -// Returns: x.year() - y.year() + months{static_cast(unsigned{x.month()}) - -// static_cast(unsigned{y.month()})} - - -#include -#include -#include - -#include "test_macros.h" - -#include - -int main() -{ - using year = std::chrono::year; - using years = std::chrono::years; - using month = std::chrono::month; - using months = std::chrono::months; - using year_month = std::chrono::year_month; - - { // year_month - years - ASSERT_NOEXCEPT( std::declval() - std::declval()); - ASSERT_SAME_TYPE(year_month, decltype(std::declval() - std::declval())); - -// static_assert(testConstexprYears (year_month{year{1}, month{1}}), ""); - - year_month ym{year{1234}, std::chrono::January}; - for (int i = 0; i <= 10; ++i) - { - year_month ym1 = ym - years{i}; - assert(static_cast(ym1.year()) == 1234 - i); - assert(ym1.month() == std::chrono::January); - } - } - - { // year_month - months - ASSERT_NOEXCEPT( std::declval() - std::declval()); - ASSERT_SAME_TYPE(year_month, decltype(std::declval() - std::declval())); - -// static_assert(testConstexprMonths(year_month{year{1}, month{1}}), ""); - - year_month ym{year{1234}, std::chrono::November}; - for (int i = 0; i <= 10; ++i) // TODO test wrap-around - { - year_month ym1 = ym - months{i}; - assert(static_cast(ym1.year()) == 1234); - assert(ym1.month() == month(11 - i)); - } - } - - { // year_month - year_month - ASSERT_NOEXCEPT( std::declval() - std::declval()); - ASSERT_SAME_TYPE(months, decltype(std::declval() - std::declval())); - -// static_assert(testConstexprMonths(year_month{year{1}, month{1}}), ""); - -// Same year - year y{2345}; - for (int i = 1; i <= 12; ++i) - for (int j = 1; j <= 12; ++j) - { - months diff = year_month{y, month(i)} - year_month{y, month(j)}; - std::cout << "i: " << i << " j: " << j << " -> " << diff.count() << std::endl; - assert(diff.count() == i - j); - } - -// TODO: different year - - } -} diff --git a/libcxx/test/std/utilities/time/time.cal/time.cal.ym/time.cal.ym.nonmembers/plus.pass.cpp b/libcxx/test/std/utilities/time/time.cal/time.cal.ym/time.cal.ym.nonmembers/plus.pass.cpp deleted file mode 100644 index acf93ef1883e..000000000000 --- a/libcxx/test/std/utilities/time/time.cal/time.cal.ym/time.cal.ym.nonmembers/plus.pass.cpp +++ /dev/null @@ -1,106 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// -// UNSUPPORTED: c++03, c++11, c++14, c++17 - -// -// class year_month; - -// constexpr year_month operator+(const year_month& ym, const years& dy) noexcept; -// Returns: (ym.year() + dy) / ym.month(). -// -// constexpr year_month operator+(const years& dy, const year_month& ym) noexcept; -// Returns: ym + dy. -// -// constexpr year_month operator+(const year_month& ym, const months& dm) noexcept; -// Returns: A year_month value z such that z - ym == dm. -// Complexity: O(1) with respect to the value of dm. -// -// constexpr year_month operator+(const months& dm, const year_month& ym) noexcept; -// Returns: ym + dm. - - - -#include -#include -#include - -#include "test_macros.h" - -constexpr bool testConstexprYears(std::chrono::year_month ym) -{ - std::chrono::years offset{23}; - if (static_cast((ym ).year()) != 1) return false; - if (static_cast((ym + offset).year()) != 24) return false; - if (static_cast((offset + ym).year()) != 24) return false; - return true; -} - - -constexpr bool testConstexprMonths(std::chrono::year_month ym) -{ - std::chrono::months offset{6}; - if (static_cast((ym ).month()) != 1) return false; - if (static_cast((ym + offset).month()) != 7) return false; - if (static_cast((offset + ym).month()) != 7) return false; - return true; -} - - -int main() -{ - using year = std::chrono::year; - using years = std::chrono::years; - using month = std::chrono::month; - using months = std::chrono::months; - using year_month = std::chrono::year_month; - - { // year_month + years - ASSERT_NOEXCEPT(std::declval() + std::declval()); - ASSERT_NOEXCEPT(std::declval() + std::declval()); - - ASSERT_SAME_TYPE(year_month, decltype(std::declval() + std::declval())); - ASSERT_SAME_TYPE(year_month, decltype(std::declval() + std::declval())); - - static_assert(testConstexprYears (year_month{year{1}, month{1}}), ""); - - year_month ym{year{1234}, std::chrono::January}; - for (int i = 0; i <= 10; ++i) - { - year_month ym1 = ym + years{i}; - year_month ym2 = years{i} + ym; - assert(static_cast(ym1.year()) == i + 1234); - assert(static_cast(ym2.year()) == i + 1234); - assert(ym1.month() == std::chrono::January); - assert(ym2.month() == std::chrono::January); - assert(ym1 == ym2); - } - } - - { // year_month + months - ASSERT_NOEXCEPT(std::declval() + std::declval()); - ASSERT_NOEXCEPT(std::declval() + std::declval()); - - ASSERT_SAME_TYPE(year_month, decltype(std::declval() + std::declval())); - ASSERT_SAME_TYPE(year_month, decltype(std::declval() + std::declval())); - - static_assert(testConstexprMonths(year_month{year{1}, month{1}}), ""); - - year_month ym{year{1234}, std::chrono::January}; - for (int i = 0; i <= 10; ++i) // TODO test wrap-around - { - year_month ym1 = ym + months{i}; - year_month ym2 = months{i} + ym; - assert(static_cast(ym1.year()) == 1234); - assert(static_cast(ym2.year()) == 1234); - assert(ym1.month() == month(1 + i)); - assert(ym2.month() == month(1 + i)); - assert(ym1 == ym2); - } - } -} diff --git a/libcxx/test/std/utilities/time/time.cal/time.cal.ym/time.cal.ym.nonmembers/streaming.pass.cpp b/libcxx/test/std/utilities/time/time.cal/time.cal.ym/time.cal.ym.nonmembers/streaming.pass.cpp deleted file mode 100644 index 2a94d4ffd519..000000000000 --- a/libcxx/test/std/utilities/time/time.cal/time.cal.ym/time.cal.ym.nonmembers/streaming.pass.cpp +++ /dev/null @@ -1,57 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// -// UNSUPPORTED: c++03, c++11, c++14, c++17 -// XFAIL: * - -// -// class year_month; - -// template -// basic_ostream& -// operator<<(basic_ostream& os, const year_month& ym); -// -// Returns: os << ym.year() << '/' << ym.month(). -// -// -// template -// basic_ostream& -// to_stream(basic_ostream& os, const charT* fmt, const year_month& ym); -// -// Effects: Streams ym into os using the format specified by the NTCTS fmt. fmt encoding follows the rules specified in 25.11. -// -// template> -// basic_istream& -// from_stream(basic_istream& is, const charT* fmt, -// year_month& ym, basic_string* abbrev = nullptr, -// minutes* offset = nullptr); -// -// Effects: Attempts to parse the input stream is into the year_month ym using the format -// flags given in the NTCTS fmt as specified in 25.12. If the parse fails to decode -// a valid year_month, is.setstate(ios_- base::failbit) shall be called and ym shall -// not be modified. If %Z is used and successfully parsed, that value will be assigned -// to *abbrev if abbrev is non-null. If %z (or a modified variant) is used and -// successfully parsed, that value will be assigned to *offset if offset is non-null. - - - -#include -#include -#include -#include - -#include "test_macros.h" - -int main() -{ - using year_month = std::chrono::year_month; - using year = std::chrono::year; - using month = std::chrono::month; - - std::cout << year_month{year{2018}, month{3}}; -} diff --git a/libcxx/test/std/utilities/time/time.cal/time.cal.ym/types.pass.cpp b/libcxx/test/std/utilities/time/time.cal/time.cal.ym/types.pass.cpp deleted file mode 100644 index c888dd5fe5c8..000000000000 --- a/libcxx/test/std/utilities/time/time.cal/time.cal.ym/types.pass.cpp +++ /dev/null @@ -1,26 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// -// UNSUPPORTED: c++03, c++11, c++14, c++17 - -// -// class year_month; - -#include -#include -#include - -#include "test_macros.h" - -int main() -{ - using year_month = std::chrono::year_month; - - static_assert(std::is_trivially_copyable_v, ""); - static_assert(std::is_standard_layout_v, ""); -} diff --git a/libcxx/test/std/utilities/time/time.cal/time.cal.ymd/time.cal.ymd.members/ctor.local_days.pass.cpp b/libcxx/test/std/utilities/time/time.cal/time.cal.ymd/time.cal.ymd.members/ctor.local_days.pass.cpp deleted file mode 100644 index c95ba36aa3b0..000000000000 --- a/libcxx/test/std/utilities/time/time.cal/time.cal.ymd/time.cal.ymd.members/ctor.local_days.pass.cpp +++ /dev/null @@ -1,44 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// -// UNSUPPORTED: c++03, c++11, c++14, c++17 -// XFAIL: * - -// -// class year_month_day; - -// explicit constexpr year_month_day(const local_days& dp) noexcept; -// -// -// Effects: Constructs an object of type year_month_day that corresponds -// to the date represented by dp -// -// Remarks: Equivalent to constructing with sys_days{dp.time_since_epoch()}. -// -// constexpr chrono::year year() const noexcept; -// constexpr chrono::month month() const noexcept; -// constexpr chrono::day day() const noexcept; -// constexpr bool ok() const noexcept; - -#include -#include -#include - -#include "test_macros.h" - -int main() -{ - using year = std::chrono::year; - using month = std::chrono::month; - using day = std::chrono::day; -// using local_days = std::chrono::local_days; - using year_month_day = std::chrono::year_month_day; - -// ASSERT_NOEXCEPT(year_month_day{std::declval()}); - assert(false); -} diff --git a/libcxx/test/std/utilities/time/time.cal/time.cal.ymd/time.cal.ymd.members/ctor.pass.cpp b/libcxx/test/std/utilities/time/time.cal/time.cal.ymd/time.cal.ymd.members/ctor.pass.cpp deleted file mode 100644 index dd2b1e133c29..000000000000 --- a/libcxx/test/std/utilities/time/time.cal/time.cal.ymd/time.cal.ymd.members/ctor.pass.cpp +++ /dev/null @@ -1,56 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// -// UNSUPPORTED: c++03, c++11, c++14, c++17 - -// -// class year_month_day; - -// year_month_day() = default; -// constexpr year_month_day(const chrono::year& y, const chrono::month& m, -// const chrono::day& d) noexcept; -// -// Effects: Constructs an object of type year_month_day by initializing -// y_ with y, m_ with m, and d_ with d. -// -// constexpr chrono::year year() const noexcept; -// constexpr chrono::month month() const noexcept; -// constexpr chrono::day day() const noexcept; -// constexpr bool ok() const noexcept; - -#include -#include -#include - -#include "test_macros.h" - -int main() -{ - using year = std::chrono::year; - using month = std::chrono::month; - using day = std::chrono::day; - using year_month_day = std::chrono::year_month_day; - - ASSERT_NOEXCEPT(year_month_day{}); - ASSERT_NOEXCEPT(year_month_day{year{1}, month{1}, day{1}}); - - constexpr month January = std::chrono::January; - - constexpr year_month_day ym0{}; - static_assert( ym0.year() == year{}, ""); - static_assert( ym0.month() == month{}, ""); - static_assert( ym0.day() == day{}, ""); - static_assert(!ym0.ok(), ""); - - constexpr year_month_day ym1{year{2019}, January, day{12}}; - static_assert( ym1.year() == year{2019}, ""); - static_assert( ym1.month() == January, ""); - static_assert( ym1.day() == day{12}, ""); - static_assert( ym1.ok(), ""); - -} diff --git a/libcxx/test/std/utilities/time/time.cal/time.cal.ymd/time.cal.ymd.members/ctor.sys_days.pass.cpp b/libcxx/test/std/utilities/time/time.cal/time.cal.ymd/time.cal.ymd.members/ctor.sys_days.pass.cpp deleted file mode 100644 index 38c9d68eacb8..000000000000 --- a/libcxx/test/std/utilities/time/time.cal/time.cal.ymd/time.cal.ymd.members/ctor.sys_days.pass.cpp +++ /dev/null @@ -1,44 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// -// UNSUPPORTED: c++03, c++11, c++14, c++17 -// XFAIL: * - -// -// class year_month_day; - -// constexpr year_month_day(const sys_days& dp) noexcept; -// -// Effects: Constructs an object of type year_month_day that corresponds -// to the date represented by dp -// -// Remarks: For any value ymd of type year_month_day for which ymd.ok() is true, -// ymd == year_month_day{sys_days{ymd}} is true. -// -// constexpr chrono::year year() const noexcept; -// constexpr chrono::month month() const noexcept; -// constexpr bool ok() const noexcept; - -#include -#include -#include - -#include "test_macros.h" - -int main() -{ - using year = std::chrono::year; - using month = std::chrono::month; - using day = std::chrono::day; -// using sys_days = std::chrono::sys_days; - using year_month_day = std::chrono::year_month_day; - -// ASSERT_NOEXCEPT(year_month_day{std::declval()}); - assert(false); - -} diff --git a/libcxx/test/std/utilities/time/time.cal/time.cal.ymd/time.cal.ymd.members/ctor.year_month_day_last.pass.cpp b/libcxx/test/std/utilities/time/time.cal/time.cal.ymd/time.cal.ymd.members/ctor.year_month_day_last.pass.cpp deleted file mode 100644 index e1211c0765a4..000000000000 --- a/libcxx/test/std/utilities/time/time.cal/time.cal.ymd/time.cal.ymd.members/ctor.year_month_day_last.pass.cpp +++ /dev/null @@ -1,42 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// -// UNSUPPORTED: c++03, c++11, c++14, c++17 -// XFAIL: * - -// -// class year_month_day; - -// constexpr year_month_day(const year_month_day_last& ymdl) noexcept; -// -// Effects: Constructs an object of type year_month_day by initializing -// y_ with ymdl.year(), m_ with ymdl.month(), and d_ with ymdl.day(). -// -// constexpr chrono::year year() const noexcept; -// constexpr chrono::month month() const noexcept; -// constexpr chrono::day day() const noexcept; -// constexpr bool ok() const noexcept; - -#include -#include -#include - -#include "test_macros.h" - -int main() -{ - using year = std::chrono::year; - using month = std::chrono::month; - using day = std::chrono::day; -// using year_month_day_last = std::chrono::year_month_day_last; - using year_month_day = std::chrono::year_month_day; - -// ASSERT_NOEXCEPT(year_month_day{std::declval()}); - assert(false); - -} diff --git a/libcxx/test/std/utilities/time/time.cal/time.cal.ymd/time.cal.ymd.members/day.pass.cpp b/libcxx/test/std/utilities/time/time.cal/time.cal.ymd/time.cal.ymd.members/day.pass.cpp deleted file mode 100644 index 603a01676224..000000000000 --- a/libcxx/test/std/utilities/time/time.cal/time.cal.ymd/time.cal.ymd.members/day.pass.cpp +++ /dev/null @@ -1,40 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// -// UNSUPPORTED: c++03, c++11, c++14, c++17 - -// -// class year_month_day; - -// constexpr chrono::day day() const noexcept; -// Returns: wd_ - -#include -#include -#include - -#include "test_macros.h" - -int main() -{ - using year = std::chrono::year; - using month = std::chrono::month; - using day = std::chrono::day; - using year_month_day = std::chrono::year_month_day; - - ASSERT_NOEXCEPT( std::declval().day()); - ASSERT_SAME_TYPE(day, decltype(std::declval().day())); - - static_assert( year_month_day{}.day() == day{}, ""); - - for (unsigned i = 1; i <= 50; ++i) - { - year_month_day ymd(year{1234}, month{2}, day{i}); - assert( static_cast(ymd.day()) == i); - } -} diff --git a/libcxx/test/std/utilities/time/time.cal/time.cal.ymd/time.cal.ymd.members/month.pass.cpp b/libcxx/test/std/utilities/time/time.cal/time.cal.ymd/time.cal.ymd.members/month.pass.cpp deleted file mode 100644 index 40dd733cf2e2..000000000000 --- a/libcxx/test/std/utilities/time/time.cal/time.cal.ymd/time.cal.ymd.members/month.pass.cpp +++ /dev/null @@ -1,40 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// -// UNSUPPORTED: c++03, c++11, c++14, c++17 - -// -// class year_month_day; - -// constexpr chrono::month month() const noexcept; -// Returns: wd_ - -#include -#include -#include - -#include "test_macros.h" - -int main() -{ - using year = std::chrono::year; - using month = std::chrono::month; - using day = std::chrono::day; - using year_month_day = std::chrono::year_month_day; - - ASSERT_NOEXCEPT( std::declval().month()); - ASSERT_SAME_TYPE(month, decltype(std::declval().month())); - - static_assert( year_month_day{}.month() == month{}, ""); - - for (unsigned i = 1; i <= 50; ++i) - { - year_month_day ymd(year{1234}, month{i}, day{12}); - assert( static_cast(ymd.month()) == i); - } -} diff --git a/libcxx/test/std/utilities/time/time.cal/time.cal.ymd/time.cal.ymd.members/ok.pass.cpp b/libcxx/test/std/utilities/time/time.cal/time.cal.ymd/time.cal.ymd.members/ok.pass.cpp deleted file mode 100644 index c5c6e3e70ca2..000000000000 --- a/libcxx/test/std/utilities/time/time.cal/time.cal.ymd/time.cal.ymd.members/ok.pass.cpp +++ /dev/null @@ -1,65 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// -// UNSUPPORTED: c++03, c++11, c++14, c++17 - -// -// class year_month_day; - -// constexpr bool ok() const noexcept; -// Returns: m_.ok() && y_.ok(). - -#include -#include -#include - -#include "test_macros.h" - -int main() -{ - using year = std::chrono::year; - using month = std::chrono::month; - using day = std::chrono::day; - using year_month_day = std::chrono::year_month_day; - - constexpr month January = std::chrono::January; - - ASSERT_NOEXCEPT( std::declval().ok()); - ASSERT_SAME_TYPE(bool, decltype(std::declval().ok())); - - static_assert(!year_month_day{year{-32768}, month{}, day{}}.ok(), ""); // All three bad - - static_assert(!year_month_day{year{-32768}, January, day{1}}.ok(), ""); // Bad year - static_assert(!year_month_day{year{2019}, month{}, day{1}}.ok(), ""); // Bad month - static_assert(!year_month_day{year{2019}, January, day{} }.ok(), ""); // Bad day - - static_assert(!year_month_day{year{-32768}, month{}, day{1}}.ok(), ""); // Bad year & month - static_assert(!year_month_day{year{2019}, month{}, day{} }.ok(), ""); // Bad month & day - static_assert(!year_month_day{year{-32768}, January, day{} }.ok(), ""); // Bad year & day - - static_assert( year_month_day{year{2019}, January, day{1}}.ok(), ""); // All OK - - for (unsigned i = 0; i <= 50; ++i) - { - year_month_day ym{year{2019}, January, day{i}}; - assert( ym.ok() == day{i}.ok()); - } - - for (unsigned i = 0; i <= 50; ++i) - { - year_month_day ym{year{2019}, month{i}, day{12}}; - assert( ym.ok() == month{i}.ok()); - } - - const int ymax = static_cast(year::max()); - for (int i = ymax - 100; i <= ymax + 100; ++i) - { - year_month_day ym{year{i}, January, day{12}}; - assert( ym.ok() == year{i}.ok()); - } -} diff --git a/libcxx/test/std/utilities/time/time.cal/time.cal.ymd/time.cal.ymd.members/plus_minus_equal_month.pass.cpp b/libcxx/test/std/utilities/time/time.cal/time.cal.ymd/time.cal.ymd.members/plus_minus_equal_month.pass.cpp deleted file mode 100644 index 2249d91f94bf..000000000000 --- a/libcxx/test/std/utilities/time/time.cal/time.cal.ymd/time.cal.ymd.members/plus_minus_equal_month.pass.cpp +++ /dev/null @@ -1,70 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// -// UNSUPPORTED: c++03, c++11, c++14, c++17 - -// -// class year_month_day; - -// constexpr year_month_day& operator+=(const months& m) noexcept; -// constexpr year_month_day& operator-=(const months& m) noexcept; - -#include -#include -#include - -#include "test_macros.h" - -template -constexpr bool testConstexpr(D d1) -{ - if (static_cast((d1 ).month()) != 1) return false; - if (static_cast((d1 += Ds{ 1}).month()) != 2) return false; - if (static_cast((d1 += Ds{ 2}).month()) != 4) return false; - if (static_cast((d1 += Ds{12}).month()) != 4) return false; - if (static_cast((d1 -= Ds{ 1}).month()) != 3) return false; - if (static_cast((d1 -= Ds{ 2}).month()) != 1) return false; - if (static_cast((d1 -= Ds{12}).month()) != 1) return false; - return true; -} - -int main() -{ - using year = std::chrono::year; - using month = std::chrono::month; - using day = std::chrono::day; - using year_month_day = std::chrono::year_month_day; - using months = std::chrono::months; - - ASSERT_NOEXCEPT(std::declval() += std::declval()); - ASSERT_NOEXCEPT(std::declval() -= std::declval()); - - ASSERT_SAME_TYPE(year_month_day&, decltype(std::declval() += std::declval())); - ASSERT_SAME_TYPE(year_month_day&, decltype(std::declval() -= std::declval())); - - static_assert(testConstexpr(year_month_day{year{1234}, month{1}, day{1}}), ""); - - for (unsigned i = 0; i <= 10; ++i) - { - year y{1234}; - day d{23}; - year_month_day ym(y, month{i}, d); - assert(static_cast((ym += months{2}).month()) == i + 2); - assert(ym.year() == y); - assert(ym.day() == d); - assert(static_cast((ym ).month()) == i + 2); - assert(ym.year() == y); - assert(ym.day() == d); - assert(static_cast((ym -= months{1}).month()) == i + 1); - assert(ym.year() == y); - assert(ym.day() == d); - assert(static_cast((ym ).month()) == i + 1); - assert(ym.year() == y); - assert(ym.day() == d); - } -} diff --git a/libcxx/test/std/utilities/time/time.cal/time.cal.ymd/time.cal.ymd.members/plus_minus_equal_year.pass.cpp b/libcxx/test/std/utilities/time/time.cal/time.cal.ymd/time.cal.ymd.members/plus_minus_equal_year.pass.cpp deleted file mode 100644 index f9973c105179..000000000000 --- a/libcxx/test/std/utilities/time/time.cal/time.cal.ymd/time.cal.ymd.members/plus_minus_equal_year.pass.cpp +++ /dev/null @@ -1,70 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// -// UNSUPPORTED: c++03, c++11, c++14, c++17 - -// -// class year_month_day; - -// constexpr year_month_day& operator+=(const years& d) noexcept; -// constexpr year_month_day& operator-=(const years& d) noexcept; - -#include -#include -#include - -#include "test_macros.h" - -template -constexpr bool testConstexpr(D d1) -{ - if (static_cast((d1 ).year()) != 1) return false; - if (static_cast((d1 += Ds{ 1}).year()) != 2) return false; - if (static_cast((d1 += Ds{ 2}).year()) != 4) return false; - if (static_cast((d1 += Ds{12}).year()) != 16) return false; - if (static_cast((d1 -= Ds{ 1}).year()) != 15) return false; - if (static_cast((d1 -= Ds{ 2}).year()) != 13) return false; - if (static_cast((d1 -= Ds{12}).year()) != 1) return false; - return true; -} - -int main() -{ - using year = std::chrono::year; - using month = std::chrono::month; - using day = std::chrono::day; - using year_month_day = std::chrono::year_month_day; - using years = std::chrono::years; - - ASSERT_NOEXCEPT(std::declval() += std::declval()); - ASSERT_NOEXCEPT(std::declval() -= std::declval()); - - ASSERT_SAME_TYPE(year_month_day&, decltype(std::declval() += std::declval())); - ASSERT_SAME_TYPE(year_month_day&, decltype(std::declval() -= std::declval())); - - static_assert(testConstexpr(year_month_day{year{1}, month{1}, day{1}}), ""); - - for (int i = 1000; i <= 1010; ++i) - { - month m{2}; - day d{23}; - year_month_day ym(year{i}, m, d); - assert(static_cast((ym += years{2}).year()) == i + 2); - assert(ym.month() == m); - assert(ym.day() == d); - assert(static_cast((ym ).year()) == i + 2); - assert(ym.month() == m); - assert(ym.day() == d); - assert(static_cast((ym -= years{1}).year()) == i + 1); - assert(ym.month() == m); - assert(ym.day() == d); - assert(static_cast((ym ).year()) == i + 1); - assert(ym.month() == m); - assert(ym.day() == d); - } -} diff --git a/libcxx/test/std/utilities/time/time.cal/time.cal.ymd/time.cal.ymd.members/year.pass.cpp b/libcxx/test/std/utilities/time/time.cal/time.cal.ymd/time.cal.ymd.members/year.pass.cpp deleted file mode 100644 index 54dbd832c8b2..000000000000 --- a/libcxx/test/std/utilities/time/time.cal/time.cal.ymd/time.cal.ymd.members/year.pass.cpp +++ /dev/null @@ -1,40 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// -// UNSUPPORTED: c++03, c++11, c++14, c++17 - -// -// class year_month_day; - -// constexpr chrono::day day() const noexcept; -// Returns: d_ - -#include -#include -#include - -#include "test_macros.h" - -int main() -{ - using year = std::chrono::year; - using month = std::chrono::month; - using day = std::chrono::day; - using year_month_day = std::chrono::year_month_day; - - ASSERT_NOEXCEPT( std::declval().year()); - ASSERT_SAME_TYPE(year, decltype(std::declval().year())); - - static_assert( year_month_day{}.year() == year{}, ""); - - for (int i = 1; i <= 50; ++i) - { - year_month_day ym(year{i}, month{}, day{}); - assert( static_cast(ym.year()) == i); - } -} diff --git a/libcxx/test/std/utilities/time/time.cal/time.cal.ymd/time.cal.ymd.nonmembers/comparisons.pass.cpp b/libcxx/test/std/utilities/time/time.cal/time.cal.ymd/time.cal.ymd.nonmembers/comparisons.pass.cpp deleted file mode 100644 index e686d9a42ae6..000000000000 --- a/libcxx/test/std/utilities/time/time.cal/time.cal.ymd/time.cal.ymd.nonmembers/comparisons.pass.cpp +++ /dev/null @@ -1,118 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// -// UNSUPPORTED: c++03, c++11, c++14, c++17 - -// -// class year_month_day; - -// constexpr bool operator==(const year_month_day& x, const year_month_day& y) noexcept; -// Returns: x.year() == y.year() && x.month() == y.month(). -// -// constexpr bool operator< (const year_month_day& x, const year_month_day& y) noexcept; -// Returns: -// If x.year() < y.year() returns true. -// Otherwise, if x.year() > y.year() returns false. -// Otherwise, if x.month() < y.month() returns true. -// Otherwise, if x.month() > y.month() returns false. -// Otherwise, returns x.day() < y.day() - - -#include -#include -#include - -#include "test_macros.h" -#include "test_comparisons.h" - -int main() -{ - using day = std::chrono::day; - using year = std::chrono::year; - using month = std::chrono::month; - using year_month_day = std::chrono::year_month_day; - - AssertComparisons6AreNoexcept(); - AssertComparisons6ReturnBool(); - - constexpr month January = std::chrono::January; - constexpr month February = std::chrono::February; - - static_assert( testComparisons6( - year_month_day{year{1234}, January, day{1}}, - year_month_day{year{1234}, January, day{1}}, - true, false), ""); - -// different day - static_assert( testComparisons6( - year_month_day{year{1234}, January, day{1}}, - year_month_day{year{1234}, January, day{2}}, - false, true), ""); - -// different month - static_assert( testComparisons6( - year_month_day{year{1234}, January, day{1}}, - year_month_day{year{1234}, February, day{1}}, - false, true), ""); - -// different year - static_assert( testComparisons6( - year_month_day{year{1234}, January, day{1}}, - year_month_day{year{1235}, January, day{1}}, - false, true), ""); - - -// different month and day - static_assert( testComparisons6( - year_month_day{year{1234}, January, day{2}}, - year_month_day{year{1234}, February, day{1}}, - false, true), ""); - -// different year and month - static_assert( testComparisons6( - year_month_day{year{1234}, February, day{1}}, - year_month_day{year{1235}, January, day{1}}, - false, true), ""); - -// different year and day - static_assert( testComparisons6( - year_month_day{year{1234}, January, day{2}}, - year_month_day{year{1235}, January, day{1}}, - false, true), ""); - -// different year, month and day - static_assert( testComparisons6( - year_month_day{year{1234}, February, day{2}}, - year_month_day{year{1235}, January, day{1}}, - false, true), ""); - - -// same year, different days - for (unsigned i = 1; i < 28; ++i) - for (unsigned j = 1; j < 28; ++j) - assert((testComparisons6( - year_month_day{year{1234}, January, day{i}}, - year_month_day{year{1234}, January, day{j}}, - i == j, i < j ))); - -// same year, different months - for (unsigned i = 1; i < 12; ++i) - for (unsigned j = 1; j < 12; ++j) - assert((testComparisons6( - year_month_day{year{1234}, month{i}, day{12}}, - year_month_day{year{1234}, month{j}, day{12}}, - i == j, i < j ))); - -// same month, different years - for (int i = 1000; i < 20; ++i) - for (int j = 1000; j < 20; ++j) - assert((testComparisons6( - year_month_day{year{i}, January, day{12}}, - year_month_day{year{j}, January, day{12}}, - i == j, i < j ))); -} diff --git a/libcxx/test/std/utilities/time/time.cal/time.cal.ymd/time.cal.ymd.nonmembers/minus.pass.cpp b/libcxx/test/std/utilities/time/time.cal/time.cal.ymd/time.cal.ymd.nonmembers/minus.pass.cpp deleted file mode 100644 index 3f60120436f8..000000000000 --- a/libcxx/test/std/utilities/time/time.cal/time.cal.ymd/time.cal.ymd.nonmembers/minus.pass.cpp +++ /dev/null @@ -1,60 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// -// UNSUPPORTED: c++03, c++11, c++14, c++17 - -// -// class year_month_day; - -// constexpr year_month_day operator-(const year_month_day& ymd, const years& dy) noexcept; -// Returns: ymd + (-dy) - - -#include -#include -#include - -#include "test_macros.h" - -#include - -constexpr bool test_constexpr () -{ - std::chrono::year_month_day ym0{std::chrono::year{1234}, std::chrono::January, std::chrono::day{12}}; - std::chrono::year_month_day ym1 = ym0 - std::chrono::years{10}; - return - ym1.year() == std::chrono::year{1234-10} - && ym1.month() == std::chrono::January - && ym1.day() == std::chrono::day{12} - ; -} - -int main() -{ - using year = std::chrono::year; - using month = std::chrono::month; - using day = std::chrono::day; - using year_month_day = std::chrono::year_month_day; - using years = std::chrono::years; - - ASSERT_NOEXCEPT( std::declval() - std::declval()); - ASSERT_SAME_TYPE(year_month_day, decltype(std::declval() - std::declval())); - - constexpr month January = std::chrono::January; - - static_assert(test_constexpr(), ""); - - year_month_day ym{year{1234}, January, day{10}}; - for (int i = 0; i <= 10; ++i) - { - year_month_day ym1 = ym - years{i}; - assert(static_cast(ym1.year()) == 1234 - i); - assert(ym1.month() == January); - assert(ym1.day() == day{10}); - } -} diff --git a/libcxx/test/std/utilities/time/time.cal/time.cal.ymd/time.cal.ymd.nonmembers/plus.pass.cpp b/libcxx/test/std/utilities/time/time.cal/time.cal.ymd/time.cal.ymd.nonmembers/plus.pass.cpp deleted file mode 100644 index bc7649d942ff..000000000000 --- a/libcxx/test/std/utilities/time/time.cal/time.cal.ymd/time.cal.ymd.nonmembers/plus.pass.cpp +++ /dev/null @@ -1,112 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// -// UNSUPPORTED: c++03, c++11, c++14, c++17 - -// -// class year_month_day; - -// constexpr year_month_day operator+(const year_month_day& ymd, const months& dm) noexcept; -// Returns: (ymd.year() / ymd.month() + dm) / ymd.day(). -// -// constexpr year_month_day operator+(const months& dm, const year_month_day& ymd) noexcept; -// Returns: ymd + dm. -// -// -// constexpr year_month_day operator+(const year_month_day& ymd, const years& dy) noexcept; -// Returns: (ymd.year() + dy) / ymd.month() / ymd.day(). -// -// constexpr year_month_day operator+(const years& dy, const year_month_day& ymd) noexcept; -// Returns: ym + dm. - - - -#include -#include -#include - -#include "test_macros.h" - -constexpr bool testConstexprYears(std::chrono::year_month_day ym) -{ - std::chrono::years offset{23}; - if (static_cast((ym ).year()) != 1) return false; - if (static_cast((ym + offset).year()) != 24) return false; - if (static_cast((offset + ym).year()) != 24) return false; - return true; -} - - -constexpr bool testConstexprMonths(std::chrono::year_month_day ym) -{ - std::chrono::months offset{6}; - if (static_cast((ym ).month()) != 1) return false; - if (static_cast((ym + offset).month()) != 7) return false; - if (static_cast((offset + ym).month()) != 7) return false; - return true; -} - - -int main() -{ - using day = std::chrono::day; - using year = std::chrono::year; - using years = std::chrono::years; - using month = std::chrono::month; - using months = std::chrono::months; - using year_month_day = std::chrono::year_month_day; - - { // year_month_day + months - ASSERT_NOEXCEPT(std::declval() + std::declval()); - ASSERT_NOEXCEPT(std::declval() + std::declval()); - - ASSERT_SAME_TYPE(year_month_day, decltype(std::declval() + std::declval())); - ASSERT_SAME_TYPE(year_month_day, decltype(std::declval() + std::declval())); - - static_assert(testConstexprMonths(year_month_day{year{1}, month{1}, day{1}}), ""); - - year_month_day ym{year{1234}, std::chrono::January, day{12}}; - for (int i = 0; i <= 10; ++i) // TODO test wrap-around - { - year_month_day ym1 = ym + months{i}; - year_month_day ym2 = months{i} + ym; - assert(static_cast(ym1.year()) == 1234); - assert(static_cast(ym2.year()) == 1234); - assert(ym1.month() == month(1 + i)); - assert(ym2.month() == month(1 + i)); - assert(ym1.day() == day{12}); - assert(ym2.day() == day{12}); - assert(ym1 == ym2); - } - } - - { // year_month_day + years - ASSERT_NOEXCEPT(std::declval() + std::declval()); - ASSERT_NOEXCEPT(std::declval() + std::declval()); - - ASSERT_SAME_TYPE(year_month_day, decltype(std::declval() + std::declval())); - ASSERT_SAME_TYPE(year_month_day, decltype(std::declval() + std::declval())); - - static_assert(testConstexprYears (year_month_day{year{1}, month{1}, day{1}}), ""); - - year_month_day ym{year{1234}, std::chrono::January, day{12}}; - for (int i = 0; i <= 10; ++i) - { - year_month_day ym1 = ym + years{i}; - year_month_day ym2 = years{i} + ym; - assert(static_cast(ym1.year()) == i + 1234); - assert(static_cast(ym2.year()) == i + 1234); - assert(ym1.month() == std::chrono::January); - assert(ym2.month() == std::chrono::January); - assert(ym1.day() == day{12}); - assert(ym2.day() == day{12}); - assert(ym1 == ym2); - } - } - -} diff --git a/libcxx/test/std/utilities/time/time.cal/time.cal.ymd/time.cal.ymd.nonmembers/streaming.pass.cpp b/libcxx/test/std/utilities/time/time.cal/time.cal.ymd/time.cal.ymd.nonmembers/streaming.pass.cpp deleted file mode 100644 index 063073c484cc..000000000000 --- a/libcxx/test/std/utilities/time/time.cal/time.cal.ymd/time.cal.ymd.nonmembers/streaming.pass.cpp +++ /dev/null @@ -1,58 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// -// UNSUPPORTED: c++03, c++11, c++14, c++17 -// XFAIL: * - -// -// class year_month_day; - -// template -// basic_ostream& -// operator<<(basic_ostream& os, const year_month_day& ym); -// -// Returns: os << ym.year() << '/' << ym.month(). -// -// -// template -// basic_ostream& -// to_stream(basic_ostream& os, const charT* fmt, const year_month_day& ym); -// -// Effects: Streams ym into os using the format specified by the NTCTS fmt. fmt encoding follows the rules specified in 25.11. -// -// template> -// basic_istream& -// from_stream(basic_istream& is, const charT* fmt, -// year_month_day& ym, basic_string* abbrev = nullptr, -// minutes* offset = nullptr); -// -// Effects: Attempts to parse the input stream is into the year_month_day ym using the format -// flags given in the NTCTS fmt as specified in 25.12. If the parse fails to decode -// a valid year_month_day, is.setstate(ios_- base::failbit) shall be called and ym shall -// not be modified. If %Z is used and successfully parsed, that value will be assigned -// to *abbrev if abbrev is non-null. If %z (or a modified variant) is used and -// successfully parsed, that value will be assigned to *offset if offset is non-null. - - - -#include -#include -#include -#include - -#include "test_macros.h" - -int main() -{ - using year_month_day = std::chrono::year_month_day; - using year = std::chrono::year; - using month = std::chrono::month; - using day = std::chrono::day; - - std::cout << year_month_day{year{2018}, month{3}, day{12}}; -} diff --git a/libcxx/test/std/utilities/time/time.cal/time.cal.ymd/types.pass.cpp b/libcxx/test/std/utilities/time/time.cal/time.cal.ymd/types.pass.cpp deleted file mode 100644 index 5ad4df53ecd3..000000000000 --- a/libcxx/test/std/utilities/time/time.cal/time.cal.ymd/types.pass.cpp +++ /dev/null @@ -1,26 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// -// UNSUPPORTED: c++03, c++11, c++14, c++17 - -// -// class year_month_day; - -#include -#include -#include - -#include "test_macros.h" - -int main() -{ - using year_month_day = std::chrono::year_month_day; - - static_assert(std::is_trivially_copyable_v, ""); - static_assert(std::is_standard_layout_v, ""); -} diff --git a/libcxx/test/std/utilities/time/time.cal/time.cal.ymdlast/time.cal.ymdlast.members/ctor.pass.cpp b/libcxx/test/std/utilities/time/time.cal/time.cal.ymdlast/time.cal.ymdlast.members/ctor.pass.cpp deleted file mode 100644 index d61bdbeda719..000000000000 --- a/libcxx/test/std/utilities/time/time.cal/time.cal.ymdlast/time.cal.ymdlast.members/ctor.pass.cpp +++ /dev/null @@ -1,54 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// -// UNSUPPORTED: c++03, c++11, c++14, c++17 - -// -// class year_month_day_last; - -// constexpr year_month_day_last(const chrono::year& y, -// const chrono::month_day_last& mdl) noexcept; -// -// Effects: Constructs an object of type year_month_day_last by initializing -// initializing y_ with y and mdl_ with mdl. -// -// constexpr chrono::year year() const noexcept; -// constexpr chrono::month month() const noexcept; -// constexpr chrono::month_day_last month_day_last() const noexcept; -// constexpr bool ok() const noexcept; - -#include -#include -#include - -#include "test_macros.h" - -int main() -{ - using year = std::chrono::year; - using month = std::chrono::month; - using day = std::chrono::day; - using month_day_last = std::chrono::month_day_last; - using year_month_day_last = std::chrono::year_month_day_last; - - ASSERT_NOEXCEPT(year_month_day_last{year{1}, month_day_last{month{1}}}); - - constexpr month January = std::chrono::January; - - constexpr year_month_day_last ymdl0{year{}, month_day_last{month{}}}; - static_assert( ymdl0.year() == year{}, ""); - static_assert( ymdl0.month() == month{}, ""); - static_assert( ymdl0.month_day_last() == month_day_last{month{}}, ""); - static_assert(!ymdl0.ok(), ""); - - constexpr year_month_day_last ymdl1{year{2019}, month_day_last{January}}; - static_assert( ymdl1.year() == year{2019}, ""); - static_assert( ymdl1.month() == January, ""); - static_assert( ymdl1.month_day_last() == month_day_last{January}, ""); - static_assert( ymdl1.ok(), ""); -} diff --git a/libcxx/test/std/utilities/time/time.cal/time.cal.ymdlast/time.cal.ymdlast.members/day.pass.cpp b/libcxx/test/std/utilities/time/time.cal/time.cal.ymdlast/time.cal.ymdlast.members/day.pass.cpp deleted file mode 100644 index 202b5af27d1c..000000000000 --- a/libcxx/test/std/utilities/time/time.cal/time.cal.ymdlast/time.cal.ymdlast.members/day.pass.cpp +++ /dev/null @@ -1,43 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// -// UNSUPPORTED: c++03, c++11, c++14, c++17 -// XFAIL: * - -// -// class year_month_day_last; - -// constexpr chrono::day day() const noexcept; -// Returns: wd_ - -#include -#include -#include - -#include "test_macros.h" - -int main() -{ - using year = std::chrono::year; - using month = std::chrono::month; - using day = std::chrono::day; - using month_day_last = std::chrono::month_day_last; - using year_month_day_last = std::chrono::year_month_day_last; - -// TODO: wait for calendar -// ASSERT_NOEXCEPT( std::declval().day()); -// ASSERT_SAME_TYPE(day, decltype(std::declval().day())); -// -// static_assert( year_month_day_last{}.day() == day{}, ""); - - for (unsigned i = 1; i <= 12; ++i) - { - year_month_day_last ymd(year{1234}, month_day_last{month{i}}); - assert( static_cast(ymd.day()) == i); - } -} diff --git a/libcxx/test/std/utilities/time/time.cal/time.cal.ymdlast/time.cal.ymdlast.members/month.pass.cpp b/libcxx/test/std/utilities/time/time.cal/time.cal.ymdlast/time.cal.ymdlast.members/month.pass.cpp deleted file mode 100644 index 36fa9f4f62b2..000000000000 --- a/libcxx/test/std/utilities/time/time.cal/time.cal.ymdlast/time.cal.ymdlast.members/month.pass.cpp +++ /dev/null @@ -1,39 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// -// UNSUPPORTED: c++03, c++11, c++14, c++17 - -// -// class year_month_day_last; - -// constexpr chrono::month month() const noexcept; -// Returns: wd_ - -#include -#include -#include - -#include "test_macros.h" - -int main() -{ - using year = std::chrono::year; - using month = std::chrono::month; - using day = std::chrono::day; - using month_day_last = std::chrono::month_day_last; - using year_month_day_last = std::chrono::year_month_day_last; - - ASSERT_NOEXCEPT( std::declval().month()); - ASSERT_SAME_TYPE(month, decltype(std::declval().month())); - - for (unsigned i = 1; i <= 50; ++i) - { - year_month_day_last ymd(year{1234}, month_day_last{month{i}}); - assert( static_cast(ymd.month()) == i); - } -} diff --git a/libcxx/test/std/utilities/time/time.cal/time.cal.ymdlast/time.cal.ymdlast.members/month_day_last.pass.cpp b/libcxx/test/std/utilities/time/time.cal/time.cal.ymdlast/time.cal.ymdlast.members/month_day_last.pass.cpp deleted file mode 100644 index 6121713e57ed..000000000000 --- a/libcxx/test/std/utilities/time/time.cal/time.cal.ymdlast/time.cal.ymdlast.members/month_day_last.pass.cpp +++ /dev/null @@ -1,39 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// -// UNSUPPORTED: c++03, c++11, c++14, c++17 - -// -// class year_month_day_last; - -// constexpr chrono::day day() const noexcept; -// Returns: wd_ - -#include -#include -#include - -#include "test_macros.h" - -int main() -{ - using year = std::chrono::year; - using month = std::chrono::month; - using day = std::chrono::day; - using month_day_last = std::chrono::month_day_last; - using year_month_day_last = std::chrono::year_month_day_last; - - ASSERT_NOEXCEPT( std::declval().month_day_last()); - ASSERT_SAME_TYPE(month_day_last, decltype(std::declval().month_day_last())); - - for (unsigned i = 1; i <= 50; ++i) - { - year_month_day_last ymdl(year{1234}, month_day_last{month{i}}); - assert( static_cast(ymdl.month_day_last().month()) == i); - } -} diff --git a/libcxx/test/std/utilities/time/time.cal/time.cal.ymdlast/time.cal.ymdlast.members/ok.pass.cpp b/libcxx/test/std/utilities/time/time.cal/time.cal.ymdlast/time.cal.ymdlast.members/ok.pass.cpp deleted file mode 100644 index 8f37cd143316..000000000000 --- a/libcxx/test/std/utilities/time/time.cal/time.cal.ymdlast/time.cal.ymdlast.members/ok.pass.cpp +++ /dev/null @@ -1,53 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// -// UNSUPPORTED: c++03, c++11, c++14, c++17 - -// -// class year_month_day_last; - -// constexpr bool ok() const noexcept; -// Returns: m_.ok() && y_.ok(). - -#include -#include -#include - -#include "test_macros.h" - -int main() -{ - using year = std::chrono::year; - using month = std::chrono::month; - using day = std::chrono::day; - using month_day_last = std::chrono::month_day_last; - using year_month_day_last = std::chrono::year_month_day_last; - - constexpr month January = std::chrono::January; - - ASSERT_NOEXCEPT( std::declval().ok()); - ASSERT_SAME_TYPE(bool, decltype(std::declval().ok())); - - static_assert(!year_month_day_last{year{-32768}, month_day_last{month{}}}.ok(), ""); // both bad - static_assert(!year_month_day_last{year{-32768}, month_day_last{January}}.ok(), ""); // Bad year - static_assert(!year_month_day_last{year{2019}, month_day_last{month{}}}.ok(), ""); // Bad month - static_assert( year_month_day_last{year{2019}, month_day_last{January}}.ok(), ""); // All OK - - for (unsigned i = 0; i <= 50; ++i) - { - year_month_day_last ym{year{2019}, month_day_last{month{i}}}; - assert( ym.ok() == month{i}.ok()); - } - - const int ymax = static_cast(year::max()); - for (int i = ymax - 100; i <= ymax + 100; ++i) - { - year_month_day_last ym{year{i}, month_day_last{January}}; - assert( ym.ok() == year{i}.ok()); - } -} diff --git a/libcxx/test/std/utilities/time/time.cal/time.cal.ymdlast/time.cal.ymdlast.members/op_local_days.pass.cpp b/libcxx/test/std/utilities/time/time.cal/time.cal.ymdlast/time.cal.ymdlast.members/op_local_days.pass.cpp deleted file mode 100644 index 845018dda55e..000000000000 --- a/libcxx/test/std/utilities/time/time.cal/time.cal.ymdlast/time.cal.ymdlast.members/op_local_days.pass.cpp +++ /dev/null @@ -1,36 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// -// UNSUPPORTED: c++03, c++11, c++14, c++17 -// XFAIL: * - -// -// class year_month_day_last; - -// constexpr operator local_days() const noexcept; -// Returns: local_days{sys_days{*this}.time_since_epoch()}. - -#include -#include -#include - -#include "test_macros.h" - -int main() -{ - using year = std::chrono::year; - using month = std::chrono::month; - using day = std::chrono::day; - using month_day_last = std::chrono::month_day_last; - using year_month_day_last = std::chrono::year_month_day_last; -// using sys_days = std::chrono::local_days; - -// ASSERT_NOEXCEPT( static_cast(std::declval().year())); -// ASSERT_SAME_TYPE(year, decltype(static_cast(std::declval().year())); - assert(false); -} diff --git a/libcxx/test/std/utilities/time/time.cal/time.cal.ymdlast/time.cal.ymdlast.members/op_sys_days.pass.cpp b/libcxx/test/std/utilities/time/time.cal/time.cal.ymdlast/time.cal.ymdlast.members/op_sys_days.pass.cpp deleted file mode 100644 index acb948f3aff2..000000000000 --- a/libcxx/test/std/utilities/time/time.cal/time.cal.ymdlast/time.cal.ymdlast.members/op_sys_days.pass.cpp +++ /dev/null @@ -1,36 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// -// UNSUPPORTED: c++03, c++11, c++14, c++17 -// XFAIL: * - -// -// class year_month_day_last; - -// constexpr operator sys_days() const noexcept; -// Returns: sys_days{year()/month()/day()}. - -#include -#include -#include - -#include "test_macros.h" - -int main() -{ - using year = std::chrono::year; - using month = std::chrono::month; - using day = std::chrono::day; - using month_day_last = std::chrono::month_day_last; - using year_month_day_last = std::chrono::year_month_day_last; -// using sys_days = std::chrono::sys_days; - -// ASSERT_NOEXCEPT( static_cast(std::declval().year())); -// ASSERT_SAME_TYPE(year, decltype(static_cast(std::declval().year())); - assert(false); -} diff --git a/libcxx/test/std/utilities/time/time.cal/time.cal.ymdlast/time.cal.ymdlast.members/plus_minus_equal_month.pass.cpp b/libcxx/test/std/utilities/time/time.cal/time.cal.ymdlast/time.cal.ymdlast.members/plus_minus_equal_month.pass.cpp deleted file mode 100644 index 0f89b24dec2e..000000000000 --- a/libcxx/test/std/utilities/time/time.cal/time.cal.ymdlast/time.cal.ymdlast.members/plus_minus_equal_month.pass.cpp +++ /dev/null @@ -1,67 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// -// UNSUPPORTED: c++03, c++11, c++14, c++17 - -// -// class year_month_day_last; - -// constexpr year_month_day_last& operator+=(const months& m) noexcept; -// constexpr year_month_day_last& operator-=(const months& m) noexcept; - -#include -#include -#include - -#include "test_macros.h" - -template -constexpr bool testConstexpr(D d1) -{ - if (static_cast((d1 ).month()) != 1) return false; - if (static_cast((d1 += Ds{ 1}).month()) != 2) return false; - if (static_cast((d1 += Ds{ 2}).month()) != 4) return false; - if (static_cast((d1 += Ds{12}).month()) != 4) return false; - if (static_cast((d1 -= Ds{ 1}).month()) != 3) return false; - if (static_cast((d1 -= Ds{ 2}).month()) != 1) return false; - if (static_cast((d1 -= Ds{12}).month()) != 1) return false; - return true; -} - -int main() -{ - using year = std::chrono::year; - using month = std::chrono::month; - using day = std::chrono::day; - using month_day_last = std::chrono::month_day_last; - using year_month_day_last = std::chrono::year_month_day_last; - using months = std::chrono::months; - - ASSERT_NOEXCEPT(std::declval() += std::declval()); - ASSERT_NOEXCEPT(std::declval() -= std::declval()); - - ASSERT_SAME_TYPE(year_month_day_last&, decltype(std::declval() += std::declval())); - ASSERT_SAME_TYPE(year_month_day_last&, decltype(std::declval() -= std::declval())); - - static_assert(testConstexpr(year_month_day_last{year{1234}, month_day_last{month{1}}}), ""); - - for (unsigned i = 0; i <= 10; ++i) - { - year y{1234}; - month_day_last mdl{month{i}}; - year_month_day_last ym(y, mdl); - assert(static_cast((ym += months{2}).month()) == i + 2); - assert(ym.year() == y); - assert(static_cast((ym ).month()) == i + 2); - assert(ym.year() == y); - assert(static_cast((ym -= months{1}).month()) == i + 1); - assert(ym.year() == y); - assert(static_cast((ym ).month()) == i + 1); - assert(ym.year() == y); - } -} diff --git a/libcxx/test/std/utilities/time/time.cal/time.cal.ymdlast/time.cal.ymdlast.members/plus_minus_equal_year.pass.cpp b/libcxx/test/std/utilities/time/time.cal/time.cal.ymdlast/time.cal.ymdlast.members/plus_minus_equal_year.pass.cpp deleted file mode 100644 index e38eb956607e..000000000000 --- a/libcxx/test/std/utilities/time/time.cal/time.cal.ymdlast/time.cal.ymdlast.members/plus_minus_equal_year.pass.cpp +++ /dev/null @@ -1,66 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// -// UNSUPPORTED: c++03, c++11, c++14, c++17 - -// -// class year_month_day_last; - -// constexpr year_month_day_last& operator+=(const years& d) noexcept; -// constexpr year_month_day_last& operator-=(const years& d) noexcept; - -#include -#include -#include - -#include "test_macros.h" - -template -constexpr bool testConstexpr(D d1) -{ - if (static_cast((d1 ).year()) != 1) return false; - if (static_cast((d1 += Ds{ 1}).year()) != 2) return false; - if (static_cast((d1 += Ds{ 2}).year()) != 4) return false; - if (static_cast((d1 += Ds{12}).year()) != 16) return false; - if (static_cast((d1 -= Ds{ 1}).year()) != 15) return false; - if (static_cast((d1 -= Ds{ 2}).year()) != 13) return false; - if (static_cast((d1 -= Ds{12}).year()) != 1) return false; - return true; -} - -int main() -{ - using year = std::chrono::year; - using month = std::chrono::month; - using day = std::chrono::day; - using month_day_last = std::chrono::month_day_last; - using year_month_day_last = std::chrono::year_month_day_last; - using years = std::chrono::years; - - ASSERT_NOEXCEPT(std::declval() += std::declval()); - ASSERT_NOEXCEPT(std::declval() -= std::declval()); - - ASSERT_SAME_TYPE(year_month_day_last&, decltype(std::declval() += std::declval())); - ASSERT_SAME_TYPE(year_month_day_last&, decltype(std::declval() -= std::declval())); - - static_assert(testConstexpr(year_month_day_last{year{1}, month_day_last{month{1}}}), ""); - - for (int i = 1000; i <= 1010; ++i) - { - month_day_last mdl{month{2}}; - year_month_day_last ymdl(year{i}, mdl); - assert(static_cast((ymdl += years{2}).year()) == i + 2); - assert(ymdl.month_day_last() == mdl); - assert(static_cast((ymdl ).year()) == i + 2); - assert(ymdl.month_day_last() == mdl); - assert(static_cast((ymdl -= years{1}).year()) == i + 1); - assert(ymdl.month_day_last() == mdl); - assert(static_cast((ymdl ).year()) == i + 1); - assert(ymdl.month_day_last() == mdl); - } -} diff --git a/libcxx/test/std/utilities/time/time.cal/time.cal.ymdlast/time.cal.ymdlast.members/year.pass.cpp b/libcxx/test/std/utilities/time/time.cal/time.cal.ymdlast/time.cal.ymdlast.members/year.pass.cpp deleted file mode 100644 index 0e79d781b5b9..000000000000 --- a/libcxx/test/std/utilities/time/time.cal/time.cal.ymdlast/time.cal.ymdlast.members/year.pass.cpp +++ /dev/null @@ -1,39 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// -// UNSUPPORTED: c++03, c++11, c++14, c++17 - -// -// class year_month_day_last; - -// constexpr chrono::day day() const noexcept; -// Returns: d_ - -#include -#include -#include - -#include "test_macros.h" - -int main() -{ - using year = std::chrono::year; - using month = std::chrono::month; - using day = std::chrono::day; - using month_day_last = std::chrono::month_day_last; - using year_month_day_last = std::chrono::year_month_day_last; - - ASSERT_NOEXCEPT( std::declval().year()); - ASSERT_SAME_TYPE(year, decltype(std::declval().year())); - - for (int i = 1; i <= 50; ++i) - { - year_month_day_last ym(year{i}, month_day_last{month{}}); - assert( static_cast(ym.year()) == i); - } -} diff --git a/libcxx/test/std/utilities/time/time.cal/time.cal.ymdlast/time.cal.ymdlast.nonmembers/comparisons.pass.cpp b/libcxx/test/std/utilities/time/time.cal/time.cal.ymdlast/time.cal.ymdlast.nonmembers/comparisons.pass.cpp deleted file mode 100644 index 303f286468c4..000000000000 --- a/libcxx/test/std/utilities/time/time.cal/time.cal.ymdlast/time.cal.ymdlast.nonmembers/comparisons.pass.cpp +++ /dev/null @@ -1,88 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// -// UNSUPPORTED: c++03, c++11, c++14, c++17 - -// -// class year_month_day_last; - -// constexpr bool operator==(const year_month_day_last& x, const year_month_day_last& y) noexcept; -// Returns: x.year() == y.year() && x.month_day_last() == y.month_day_last(). -// -// constexpr bool operator< (const year_month_day_last& x, const year_month_day_last& y) noexcept; -// Returns: -// If x.year() < y.year(), returns true. -// Otherwise, if x.year() > y.year(), returns false. -// Otherwise, returns x.month_day_last() < y.month_day_last() - -#include -#include -#include - -#include "test_macros.h" -#include "test_comparisons.h" - -int main() -{ - using year = std::chrono::year; - using month = std::chrono::month; - using day = std::chrono::day; - using month_day_last = std::chrono::month_day_last; - using year_month_day_last = std::chrono::year_month_day_last; - - AssertComparisons6AreNoexcept(); - AssertComparisons6ReturnBool(); - - constexpr month January = std::chrono::January; - constexpr month February = std::chrono::February; - - static_assert( testComparisons6( - year_month_day_last{year{1234}, month_day_last{January}}, - year_month_day_last{year{1234}, month_day_last{January}}, - true, false), ""); - -// different month - static_assert( testComparisons6( - year_month_day_last{year{1234}, month_day_last{January}}, - year_month_day_last{year{1234}, month_day_last{February}}, - false, true), ""); - -// different year - static_assert( testComparisons6( - year_month_day_last{year{1234}, month_day_last{January}}, - year_month_day_last{year{1235}, month_day_last{January}}, - false, true), ""); - -// different month - static_assert( testComparisons6( - year_month_day_last{year{1234}, month_day_last{January}}, - year_month_day_last{year{1234}, month_day_last{February}}, - false, true), ""); - -// different year and month - static_assert( testComparisons6( - year_month_day_last{year{1234}, month_day_last{February}}, - year_month_day_last{year{1235}, month_day_last{January}}, - false, true), ""); - -// same year, different months - for (unsigned i = 1; i < 12; ++i) - for (unsigned j = 1; j < 12; ++j) - assert((testComparisons6( - year_month_day_last{year{1234}, month_day_last{month{i}}}, - year_month_day_last{year{1234}, month_day_last{month{j}}}, - i == j, i < j ))); - -// same month, different years - for (int i = 1000; i < 20; ++i) - for (int j = 1000; j < 20; ++j) - assert((testComparisons6( - year_month_day_last{year{i}, month_day_last{January}}, - year_month_day_last{year{j}, month_day_last{January}}, - i == j, i < j ))); -} diff --git a/libcxx/test/std/utilities/time/time.cal/time.cal.ymdlast/time.cal.ymdlast.nonmembers/minus.pass.cpp b/libcxx/test/std/utilities/time/time.cal/time.cal.ymdlast/time.cal.ymdlast.nonmembers/minus.pass.cpp deleted file mode 100644 index 950b1005b246..000000000000 --- a/libcxx/test/std/utilities/time/time.cal/time.cal.ymdlast/time.cal.ymdlast.nonmembers/minus.pass.cpp +++ /dev/null @@ -1,92 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// -// UNSUPPORTED: c++03, c++11, c++14, c++17 - -// -// class year_month_day_last; - -// constexpr year_month_day_last -// operator-(const year_month_day_last& ymdl, const months& dm) noexcept; -// -// Returns: ymdl + (-dm). -// -// constexpr year_month_day_last -// operator-(const year_month_day_last& ymdl, const years& dy) noexcept; -// -// Returns: ymdl + (-dy). - - -#include -#include -#include - -#include "test_macros.h" - -#include - -constexpr bool testConstexprYears (std::chrono::year_month_day_last ymdl) -{ - std::chrono::year_month_day_last ym1 = ymdl - std::chrono::years{10}; - return - ym1.year() == std::chrono::year{static_cast(ymdl.year()) - 10} - && ym1.month() == ymdl.month() - ; -} - -constexpr bool testConstexprMonths (std::chrono::year_month_day_last ymdl) -{ - std::chrono::year_month_day_last ym1 = ymdl - std::chrono::months{6}; - return - ym1.year() == ymdl.year() - && ym1.month() == std::chrono::month{static_cast(ymdl.month()) - 6} - ; -} - -int main() -{ - using year = std::chrono::year; - using month = std::chrono::month; - using day = std::chrono::day; - using month_day_last = std::chrono::month_day_last; - using year_month_day_last = std::chrono::year_month_day_last; - using months = std::chrono::months; - using years = std::chrono::years; - - constexpr month December = std::chrono::December; - - { // year_month_day_last - years - ASSERT_NOEXCEPT( std::declval() - std::declval()); - ASSERT_SAME_TYPE(year_month_day_last, decltype(std::declval() - std::declval())); - - static_assert(testConstexprYears(year_month_day_last{year{1234}, month_day_last{December}}), ""); - year_month_day_last ym{year{1234}, month_day_last{December}}; - for (int i = 0; i <= 10; ++i) - { - year_month_day_last ym1 = ym - years{i}; - assert(static_cast(ym1.year()) == 1234 - i); - assert(ym1.month() == December); - } - } - - { // year_month_day_last - months - ASSERT_NOEXCEPT( std::declval() - std::declval()); - ASSERT_SAME_TYPE(year_month_day_last, decltype(std::declval() - std::declval())); - - static_assert(testConstexprMonths(year_month_day_last{year{1234}, month_day_last{December}}), ""); -// TODO test wrapping - year_month_day_last ym{year{1234}, month_day_last{December}}; - for (unsigned i = 0; i <= 10; ++i) - { - year_month_day_last ym1 = ym - months{i}; - assert(static_cast(ym1.year()) == 1234); - assert(static_cast(ym1.month()) == 12U-i); - } - } - -} diff --git a/libcxx/test/std/utilities/time/time.cal/time.cal.ymdlast/time.cal.ymdlast.nonmembers/plus.pass.cpp b/libcxx/test/std/utilities/time/time.cal/time.cal.ymdlast/time.cal.ymdlast.nonmembers/plus.pass.cpp deleted file mode 100644 index 5cf3151ec011..000000000000 --- a/libcxx/test/std/utilities/time/time.cal/time.cal.ymdlast/time.cal.ymdlast.nonmembers/plus.pass.cpp +++ /dev/null @@ -1,123 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// -// UNSUPPORTED: c++03, c++11, c++14, c++17 - -// -// class year_month_day_last; - -// constexpr year_month_day_last -// operator+(const year_month_day_last& ymdl, const months& dm) noexcept; -// -// Returns: (ymdl.year() / ymdl.month() + dm) / last. -// -// constexpr year_month_day_last -// operator+(const months& dm, const year_month_day_last& ymdl) noexcept; -// -// Returns: ymdl + dm. -// -// -// constexpr year_month_day_last -// operator+(const year_month_day_last& ymdl, const years& dy) noexcept; -// -// Returns: {ymdl.year()+dy, ymdl.month_day_last()}. -// -// constexpr year_month_day_last -// operator+(const years& dy, const year_month_day_last& ymdl) noexcept; -// -// Returns: ymdl + dy - - - -#include -#include -#include - -#include "test_macros.h" - -constexpr bool testConstexprYears(std::chrono::year_month_day_last ymdl) -{ - std::chrono::years offset{23}; - if (static_cast((ymdl ).year()) != 1) return false; - if (static_cast((ymdl + offset).year()) != 24) return false; - if ( (ymdl + offset).month() != ymdl.month()) return false; - if (static_cast((offset + ymdl).year()) != 24) return false; - if ( (offset + ymdl).month() != ymdl.month()) return false; - return true; -} - - -constexpr bool testConstexprMonths(std::chrono::year_month_day_last ymdl) -{ - std::chrono::months offset{6}; - if (static_cast((ymdl ).month()) != 1) return false; - if ( (ymdl + offset).year() != ymdl.year()) return false; - if (static_cast((ymdl + offset).month()) != 7) return false; - if (static_cast((offset + ymdl).month()) != 7) return false; - if ( (offset + ymdl).year() != ymdl.year()) return false; - return true; -} - - -int main() -{ - using year = std::chrono::year; - using month = std::chrono::month; - using day = std::chrono::day; - using month_day_last = std::chrono::month_day_last; - using year_month_day_last = std::chrono::year_month_day_last; - using months = std::chrono::months; - using years = std::chrono::years; - - constexpr month January = std::chrono::January; - - { // year_month_day_last + months - ASSERT_NOEXCEPT(std::declval() + std::declval()); - ASSERT_NOEXCEPT(std::declval() + std::declval()); - - ASSERT_SAME_TYPE(year_month_day_last, decltype(std::declval() + std::declval())); - ASSERT_SAME_TYPE(year_month_day_last, decltype(std::declval() + std::declval())); - - static_assert(testConstexprMonths(year_month_day_last{year{1}, month_day_last{January}}), ""); - - year_month_day_last ym{year{1234}, month_day_last{January}}; - for (int i = 0; i <= 10; ++i) // TODO test wrap-around - { - year_month_day_last ym1 = ym + months{i}; - year_month_day_last ym2 = months{i} + ym; - assert(static_cast(ym1.year()) == 1234); - assert(static_cast(ym2.year()) == 1234); - assert(ym1.month() == month(1 + i)); - assert(ym2.month() == month(1 + i)); - assert(ym1 == ym2); - } - } - - { // year_month_day_last + years - ASSERT_NOEXCEPT(std::declval() + std::declval()); - ASSERT_NOEXCEPT(std::declval() + std::declval()); - - ASSERT_SAME_TYPE(year_month_day_last, decltype(std::declval() + std::declval())); - ASSERT_SAME_TYPE(year_month_day_last, decltype(std::declval() + std::declval())); - - static_assert(testConstexprYears(year_month_day_last{year{1}, month_day_last{January}}), ""); - - year_month_day_last ym{year{1234}, month_day_last{January}}; - for (int i = 0; i <= 10; ++i) - { - year_month_day_last ym1 = ym + years{i}; - year_month_day_last ym2 = years{i} + ym; - assert(static_cast(ym1.year()) == i + 1234); - assert(static_cast(ym2.year()) == i + 1234); - assert(ym1.month() == std::chrono::January); - assert(ym2.month() == std::chrono::January); - assert(ym1 == ym2); - } - } - -} diff --git a/libcxx/test/std/utilities/time/time.cal/time.cal.ymdlast/time.cal.ymdlast.nonmembers/streaming.pass.cpp b/libcxx/test/std/utilities/time/time.cal/time.cal.ymdlast/time.cal.ymdlast.nonmembers/streaming.pass.cpp deleted file mode 100644 index 3d218d125a17..000000000000 --- a/libcxx/test/std/utilities/time/time.cal/time.cal.ymdlast/time.cal.ymdlast.nonmembers/streaming.pass.cpp +++ /dev/null @@ -1,37 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// -// UNSUPPORTED: c++03, c++11, c++14, c++17 -// XFAIL: * - -// -// class year_month_day_last; - -// template -// basic_ostream& -// operator<<(basic_ostream& os, const year_month_day_last& ymdl); -// -// Returns: os << ymdl.year() << '/' << ymdl.month_day_last(). - - -#include -#include -#include -#include - -#include "test_macros.h" - -int main() -{ - using year_month_day_last = std::chrono::year_month_day_last; - using year = std::chrono::year; - using month = std::chrono::month; - using month_day_last = std::chrono::month_day_last; - - std::cout << year_month_day_last{year{2018}, month_day_last{month{3}}}; -} diff --git a/libcxx/test/std/utilities/time/time.cal/time.cal.ymwd/time.cal.ymwd.members/ctor.local_days.pass.cpp b/libcxx/test/std/utilities/time/time.cal/time.cal.ymwd/time.cal.ymwd.members/ctor.local_days.pass.cpp deleted file mode 100644 index a13e7c7724d8..000000000000 --- a/libcxx/test/std/utilities/time/time.cal/time.cal.ymwd/time.cal.ymwd.members/ctor.local_days.pass.cpp +++ /dev/null @@ -1,44 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// -// UNSUPPORTED: c++03, c++11, c++14, c++17 -// XFAIL: * - -// -// class year_month_weekday; - -// explicit constexpr year_month_weekday(const local_days& dp) noexcept; -// -// -// Effects: Constructs an object of type year_month_weekday that corresponds -// to the date represented by dp -// -// Remarks: Equivalent to constructing with sys_days{dp.time_since_epoch()}. -// -// constexpr chrono::year year() const noexcept; -// constexpr chrono::month month() const noexcept; -// constexpr chrono::day day() const noexcept; -// constexpr bool ok() const noexcept; - -#include -#include -#include - -#include "test_macros.h" - -int main() -{ - using year = std::chrono::year; - using month = std::chrono::month; - using day = std::chrono::day; -// using local_days = std::chrono::local_days; - using year_month_weekday = std::chrono::year_month_weekday; - -// ASSERT_NOEXCEPT(year_month_weekday{std::declval()}); - assert(false); -} diff --git a/libcxx/test/std/utilities/time/time.cal/time.cal.ymwd/time.cal.ymwd.members/ctor.pass.cpp b/libcxx/test/std/utilities/time/time.cal/time.cal.ymwd/time.cal.ymwd.members/ctor.pass.cpp deleted file mode 100644 index a7ee7b2756b6..000000000000 --- a/libcxx/test/std/utilities/time/time.cal/time.cal.ymwd/time.cal.ymwd.members/ctor.pass.cpp +++ /dev/null @@ -1,65 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// -// UNSUPPORTED: c++03, c++11, c++14, c++17 - -// -// class year_month_weekday; - -// year_month_weekday() = default; -// constexpr year_month_weekday(const chrono::year& y, const chrono::month& m, -// const chrono::weekday_indexed& wdi) noexcept; -// -// Effects: Constructs an object of type year_month_weekday by initializing -// y_ with y, m_ with m, and wdi_ with wdi. -// -// constexpr chrono::year year() const noexcept; -// constexpr chrono::month month() const noexcept; -// constexpr chrono::weekday weekday() const noexcept; -// constexpr unsigned index() const noexcept; -// constexpr chrono::weekday_indexed weekday_indexed() const noexcept; -// constexpr bool ok() const noexcept; - -#include -#include -#include - -#include "test_macros.h" - -int main() -{ - using year = std::chrono::year; - using month = std::chrono::month; - using day = std::chrono::day; - using weekday = std::chrono::weekday; - using weekday_indexed = std::chrono::weekday_indexed; - using year_month_weekday = std::chrono::year_month_weekday; - - constexpr month January = std::chrono::January; - constexpr weekday Tuesday = std::chrono::Tuesday; - - ASSERT_NOEXCEPT(year_month_weekday{}); - ASSERT_NOEXCEPT(year_month_weekday{year{1}, month{1}, weekday_indexed{Tuesday, 1}}); - - constexpr year_month_weekday ym0{}; - static_assert( ym0.year() == year{}, ""); - static_assert( ym0.month() == month{}, ""); - static_assert( ym0.weekday() == weekday{}, ""); - static_assert( ym0.index() == 0, ""); - static_assert( ym0.weekday_indexed() == weekday_indexed{}, ""); - static_assert(!ym0.ok(), ""); - - constexpr year_month_weekday ym1{year{2019}, January, weekday_indexed{Tuesday, 1}}; - static_assert( ym1.year() == year{2019}, ""); - static_assert( ym1.month() == January, ""); - static_assert( ym1.weekday() == Tuesday, ""); - static_assert( ym1.index() == 1, ""); - static_assert( ym1.weekday_indexed() == weekday_indexed{Tuesday, 1}, ""); - static_assert( ym1.ok(), ""); - -} diff --git a/libcxx/test/std/utilities/time/time.cal/time.cal.ymwd/time.cal.ymwd.members/ctor.sys_days.pass.cpp b/libcxx/test/std/utilities/time/time.cal/time.cal.ymwd/time.cal.ymwd.members/ctor.sys_days.pass.cpp deleted file mode 100644 index e3ae2235e23a..000000000000 --- a/libcxx/test/std/utilities/time/time.cal/time.cal.ymwd/time.cal.ymwd.members/ctor.sys_days.pass.cpp +++ /dev/null @@ -1,43 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// -// UNSUPPORTED: c++03, c++11, c++14, c++17 -// XFAIL: * - -// -// class year_month_weekday; - -// constexpr year_month_weekday(const sys_days& dp) noexcept; -// -// Effects: Constructs an object of type year_month_weekday that corresponds -// to the date represented by dp -// -// Remarks: For any value ymd of type year_month_weekday for which ymd.ok() is true, -// ymd == year_month_weekday{sys_days{ymd}} is true. -// -// constexpr chrono::year year() const noexcept; -// constexpr chrono::month month() const noexcept; -// constexpr bool ok() const noexcept; - -#include -#include -#include - -#include "test_macros.h" - -int main() -{ - using year = std::chrono::year; - using month = std::chrono::month; - using day = std::chrono::day; -// using sys_days = std::chrono::sys_days; - using year_month_weekday = std::chrono::year_month_weekday; - -// ASSERT_NOEXCEPT(year_month_weekday{std::declval()}); - assert(false); -} diff --git a/libcxx/test/std/utilities/time/time.cal/time.cal.ymwd/time.cal.ymwd.members/ctor.year_month_day_last.pass.cpp b/libcxx/test/std/utilities/time/time.cal/time.cal.ymwd/time.cal.ymwd.members/ctor.year_month_day_last.pass.cpp deleted file mode 100644 index 20e48cb77c7b..000000000000 --- a/libcxx/test/std/utilities/time/time.cal/time.cal.ymwd/time.cal.ymwd.members/ctor.year_month_day_last.pass.cpp +++ /dev/null @@ -1,41 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// -// UNSUPPORTED: c++03, c++11, c++14, c++17 -// XFAIL: * - -// -// class year_month_weekday; - -// constexpr year_month_weekday(const year_month_weekday_last& ymdl) noexcept; -// -// Effects: Constructs an object of type year_month_weekday by initializing -// y_ with ymdl.year(), m_ with ymdl.month(), and d_ with ymdl.day(). -// -// constexpr chrono::year year() const noexcept; -// constexpr chrono::month month() const noexcept; -// constexpr chrono::day day() const noexcept; -// constexpr bool ok() const noexcept; - -#include -#include -#include - -#include "test_macros.h" - -int main() -{ - using year = std::chrono::year; - using month = std::chrono::month; - using day = std::chrono::day; - using year_month_weekday_last = std::chrono::year_month_weekday_last; - using year_month_weekday = std::chrono::year_month_weekday; - - ASSERT_NOEXCEPT(year_month_weekday{std::declval()}); - -} diff --git a/libcxx/test/std/utilities/time/time.cal/time.cal.ymwd/time.cal.ymwd.members/index.pass.cpp b/libcxx/test/std/utilities/time/time.cal/time.cal.ymwd/time.cal.ymwd.members/index.pass.cpp deleted file mode 100644 index 6fbac7f683fe..000000000000 --- a/libcxx/test/std/utilities/time/time.cal/time.cal.ymwd/time.cal.ymwd.members/index.pass.cpp +++ /dev/null @@ -1,42 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// -// UNSUPPORTED: c++03, c++11, c++14, c++17 - -// -// class year_month_weekday; - -// constexpr unsigned index() const noexcept; -// Returns: wdi_.index() - -#include -#include -#include - -#include "test_macros.h" - -int main() -{ - using year = std::chrono::year; - using month = std::chrono::month; - using day = std::chrono::day; - using weekday = std::chrono::weekday; - using weekday_indexed = std::chrono::weekday_indexed; - using year_month_weekday = std::chrono::year_month_weekday; - - ASSERT_NOEXCEPT( std::declval().index()); - ASSERT_SAME_TYPE(unsigned, decltype(std::declval().index())); - - static_assert( year_month_weekday{}.index() == 0, ""); - - for (unsigned i = 1; i <= 50; ++i) - { - year_month_weekday ymwd0(year{1234}, month{2}, weekday_indexed{weekday{2}, i}); - assert(ymwd0.index() == i); - } -} diff --git a/libcxx/test/std/utilities/time/time.cal/time.cal.ymwd/time.cal.ymwd.members/month.pass.cpp b/libcxx/test/std/utilities/time/time.cal/time.cal.ymwd/time.cal.ymwd.members/month.pass.cpp deleted file mode 100644 index 67f9217e0081..000000000000 --- a/libcxx/test/std/utilities/time/time.cal/time.cal.ymwd/time.cal.ymwd.members/month.pass.cpp +++ /dev/null @@ -1,42 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// -// UNSUPPORTED: c++03, c++11, c++14, c++17 - -// -// class year_month_weekday; - -// constexpr chrono::month month() const noexcept; -// Returns: wd_ - -#include -#include -#include - -#include "test_macros.h" - -int main() -{ - using year = std::chrono::year; - using month = std::chrono::month; - using day = std::chrono::day; - using weekday = std::chrono::weekday; - using weekday_indexed = std::chrono::weekday_indexed; - using year_month_weekday = std::chrono::year_month_weekday; - - ASSERT_NOEXCEPT( std::declval().month()); - ASSERT_SAME_TYPE(month, decltype(std::declval().month())); - - static_assert( year_month_weekday{}.month() == month{}, ""); - - for (unsigned i = 1; i <= 50; ++i) - { - year_month_weekday ymd(year{1234}, month{i}, weekday_indexed{}); - assert( static_cast(ymd.month()) == i); - } -} diff --git a/libcxx/test/std/utilities/time/time.cal/time.cal.ymwd/time.cal.ymwd.members/ok.pass.cpp b/libcxx/test/std/utilities/time/time.cal/time.cal.ymwd/time.cal.ymwd.members/ok.pass.cpp deleted file mode 100644 index e2776f885efe..000000000000 --- a/libcxx/test/std/utilities/time/time.cal/time.cal.ymwd/time.cal.ymwd.members/ok.pass.cpp +++ /dev/null @@ -1,76 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// -// UNSUPPORTED: c++03, c++11, c++14, c++17 - -// -// class year_month_weekday; - -// constexpr bool ok() const noexcept; -// Returns: m_.ok() && y_.ok(). - -#include -#include -#include - -#include "test_macros.h" - -int main() -{ - using year = std::chrono::year; - using month = std::chrono::month; - using day = std::chrono::day; - using weekday = std::chrono::weekday; - using weekday_indexed = std::chrono::weekday_indexed; - using year_month_weekday = std::chrono::year_month_weekday; - - constexpr month January = std::chrono::January; - constexpr weekday Tuesday = std::chrono::Tuesday; - - ASSERT_NOEXCEPT( std::declval().ok()); - ASSERT_SAME_TYPE(bool, decltype(std::declval().ok())); - - static_assert(!year_month_weekday{}.ok(), ""); - - static_assert(!year_month_weekday{year{-32768}, month{}, weekday_indexed{}}.ok(), ""); // All three bad - - static_assert(!year_month_weekday{year{-32768}, January, weekday_indexed{Tuesday, 1}}.ok(), ""); // Bad year - static_assert(!year_month_weekday{year{2019}, month{}, weekday_indexed{Tuesday, 1}}.ok(), ""); // Bad month - static_assert(!year_month_weekday{year{2019}, January, weekday_indexed{} }.ok(), ""); // Bad day - - static_assert(!year_month_weekday{year{-32768}, month{}, weekday_indexed{Tuesday, 1}}.ok(), ""); // Bad year & month - static_assert(!year_month_weekday{year{2019}, month{}, weekday_indexed{} }.ok(), ""); // Bad month & day - static_assert(!year_month_weekday{year{-32768}, January, weekday_indexed{} }.ok(), ""); // Bad year & day - - static_assert( year_month_weekday{year{2019}, January, weekday_indexed{Tuesday, 1}}.ok(), ""); // All OK - - for (unsigned i = 0; i <= 50; ++i) - { - year_month_weekday ym{year{2019}, January, weekday_indexed{Tuesday, i}}; - assert((ym.ok() == weekday_indexed{Tuesday, i}.ok())); - } - - for (unsigned i = 0; i <= 50; ++i) - { - year_month_weekday ym{year{2019}, January, weekday_indexed{weekday{i}, 1}}; - assert((ym.ok() == weekday_indexed{weekday{i}, 1}.ok())); - } - - for (unsigned i = 0; i <= 50; ++i) - { - year_month_weekday ym{year{2019}, month{i}, weekday_indexed{Tuesday, 1}}; - assert((ym.ok() == month{i}.ok())); - } - - const int ymax = static_cast(year::max()); - for (int i = ymax - 100; i <= ymax + 100; ++i) - { - year_month_weekday ym{year{i}, January, weekday_indexed{Tuesday, 1}}; - assert((ym.ok() == year{i}.ok())); - } -} diff --git a/libcxx/test/std/utilities/time/time.cal/time.cal.ymwd/time.cal.ymwd.members/plus_minus_equal_month.pass.cpp b/libcxx/test/std/utilities/time/time.cal/time.cal.ymwd/time.cal.ymwd.members/plus_minus_equal_month.pass.cpp deleted file mode 100644 index 55aa86d8943a..000000000000 --- a/libcxx/test/std/utilities/time/time.cal/time.cal.ymwd/time.cal.ymwd.members/plus_minus_equal_month.pass.cpp +++ /dev/null @@ -1,82 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// -// UNSUPPORTED: c++03, c++11, c++14, c++17 - -// -// class year_month_weekday; - -// constexpr year_month_weekday& operator+=(const months& m) noexcept; -// constexpr year_month_weekday& operator-=(const months& m) noexcept; - -#include -#include -#include - -#include "test_macros.h" - -template -constexpr bool testConstexpr(D d1) -{ - if (static_cast((d1 ).month()) != 1) return false; - if (static_cast((d1 += Ds{ 1}).month()) != 2) return false; - if (static_cast((d1 += Ds{ 2}).month()) != 4) return false; - if (static_cast((d1 += Ds{12}).month()) != 4) return false; - if (static_cast((d1 -= Ds{ 1}).month()) != 3) return false; - if (static_cast((d1 -= Ds{ 2}).month()) != 1) return false; - if (static_cast((d1 -= Ds{12}).month()) != 1) return false; - return true; -} - -int main() -{ - using year = std::chrono::year; - using month = std::chrono::month; - using day = std::chrono::day; - using weekday = std::chrono::weekday; - using weekday_indexed = std::chrono::weekday_indexed; - using year_month_weekday = std::chrono::year_month_weekday; - using years = std::chrono::years; - using months = std::chrono::months; - - - ASSERT_NOEXCEPT( std::declval() += std::declval()); - ASSERT_SAME_TYPE(year_month_weekday&, decltype(std::declval() += std::declval())); - - ASSERT_NOEXCEPT( std::declval() -= std::declval()); - ASSERT_SAME_TYPE(year_month_weekday&, decltype(std::declval() -= std::declval())); - - constexpr weekday Tuesday = std::chrono::Tuesday; - static_assert(testConstexpr(year_month_weekday{year{1234}, month{1}, weekday_indexed{Tuesday, 2}}), ""); - - for (unsigned i = 0; i <= 10; ++i) - { - year y{1234}; - year_month_weekday ymwd(y, month{i}, weekday_indexed{Tuesday, 2}); - - assert(static_cast((ymwd += months{2}).month()) == i + 2); - assert(ymwd.year() == y); - assert(ymwd.weekday() == Tuesday); - assert(ymwd.index() == 2); - - assert(static_cast((ymwd ).month()) == i + 2); - assert(ymwd.year() == y); - assert(ymwd.weekday() == Tuesday); - assert(ymwd.index() == 2); - - assert(static_cast((ymwd -= months{1}).month()) == i + 1); - assert(ymwd.year() == y); - assert(ymwd.weekday() == Tuesday); - assert(ymwd.index() == 2); - - assert(static_cast((ymwd ).month()) == i + 1); - assert(ymwd.year() == y); - assert(ymwd.weekday() == Tuesday); - assert(ymwd.index() == 2); - } -} diff --git a/libcxx/test/std/utilities/time/time.cal/time.cal.ymwd/time.cal.ymwd.members/plus_minus_equal_year.pass.cpp b/libcxx/test/std/utilities/time/time.cal/time.cal.ymwd/time.cal.ymwd.members/plus_minus_equal_year.pass.cpp deleted file mode 100644 index 10ba6c64ba24..000000000000 --- a/libcxx/test/std/utilities/time/time.cal/time.cal.ymwd/time.cal.ymwd.members/plus_minus_equal_year.pass.cpp +++ /dev/null @@ -1,82 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// -// UNSUPPORTED: c++03, c++11, c++14, c++17 - -// -// class year_month_weekday; - -// constexpr year_month_weekday& operator+=(const years& d) noexcept; -// constexpr year_month_weekday& operator-=(const years& d) noexcept; - -#include -#include -#include - -#include "test_macros.h" - -template -constexpr bool testConstexpr(D d1) -{ - if (static_cast((d1 ).year()) != 1) return false; - if (static_cast((d1 += Ds{ 1}).year()) != 2) return false; - if (static_cast((d1 += Ds{ 2}).year()) != 4) return false; - if (static_cast((d1 += Ds{12}).year()) != 16) return false; - if (static_cast((d1 -= Ds{ 1}).year()) != 15) return false; - if (static_cast((d1 -= Ds{ 2}).year()) != 13) return false; - if (static_cast((d1 -= Ds{12}).year()) != 1) return false; - return true; -} - -int main() -{ - using year = std::chrono::year; - using month = std::chrono::month; - using day = std::chrono::day; - using weekday = std::chrono::weekday; - using weekday_indexed = std::chrono::weekday_indexed; - using year_month_weekday = std::chrono::year_month_weekday; - using years = std::chrono::years; - using months = std::chrono::months; - - ASSERT_NOEXCEPT( std::declval() += std::declval()); - ASSERT_SAME_TYPE(year_month_weekday&, decltype(std::declval() += std::declval())); - - ASSERT_NOEXCEPT( std::declval() -= std::declval()); - ASSERT_SAME_TYPE(year_month_weekday&, decltype(std::declval() -= std::declval())); - - constexpr weekday Tuesday = std::chrono::Tuesday; - constexpr month January = std::chrono::January; - - static_assert(testConstexpr(year_month_weekday{year{1}, January, weekday_indexed{Tuesday, 2}}), ""); - - for (int i = 1000; i <= 1010; ++i) - { - year_month_weekday ymwd(year{i}, January, weekday_indexed{Tuesday, 2}); - - assert(static_cast((ymwd += years{2}).year()) == i + 2); - assert(ymwd.month() == January); - assert(ymwd.weekday() == Tuesday); - assert(ymwd.index() == 2); - - assert(static_cast((ymwd ).year()) == i + 2); - assert(ymwd.month() == January); - assert(ymwd.weekday() == Tuesday); - assert(ymwd.index() == 2); - - assert(static_cast((ymwd -= years{1}).year()) == i + 1); - assert(ymwd.month() == January); - assert(ymwd.weekday() == Tuesday); - assert(ymwd.index() == 2); - - assert(static_cast((ymwd ).year()) == i + 1); - assert(ymwd.month() == January); - assert(ymwd.weekday() == Tuesday); - assert(ymwd.index() == 2); - } -} diff --git a/libcxx/test/std/utilities/time/time.cal/time.cal.ymwd/time.cal.ymwd.members/weekday.pass.cpp b/libcxx/test/std/utilities/time/time.cal/time.cal.ymwd/time.cal.ymwd.members/weekday.pass.cpp deleted file mode 100644 index 6241a076858a..000000000000 --- a/libcxx/test/std/utilities/time/time.cal/time.cal.ymwd/time.cal.ymwd.members/weekday.pass.cpp +++ /dev/null @@ -1,42 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// -// UNSUPPORTED: c++03, c++11, c++14, c++17 - -// -// class year_month_weekday; - -// constexpr chrono::weekday weekday() const noexcept; -// Returns: wdi_.weekday() - -#include -#include -#include - -#include "test_macros.h" - -int main() -{ - using year = std::chrono::year; - using month = std::chrono::month; - using day = std::chrono::day; - using weekday = std::chrono::weekday; - using weekday_indexed = std::chrono::weekday_indexed; - using year_month_weekday = std::chrono::year_month_weekday; - - ASSERT_NOEXCEPT( std::declval().weekday()); - ASSERT_SAME_TYPE(weekday, decltype(std::declval().weekday())); - - static_assert( year_month_weekday{}.weekday() == weekday{}, ""); - - for (unsigned i = 1; i <= 50; ++i) - { - year_month_weekday ymwd0(year{1234}, month{2}, weekday_indexed{weekday{i}, 1}); - assert(static_cast(ymwd0.weekday()) == i); - } -} diff --git a/libcxx/test/std/utilities/time/time.cal/time.cal.ymwd/time.cal.ymwd.members/weekday_indexed.pass.cpp b/libcxx/test/std/utilities/time/time.cal/time.cal.ymwd/time.cal.ymwd.members/weekday_indexed.pass.cpp deleted file mode 100644 index da096135e222..000000000000 --- a/libcxx/test/std/utilities/time/time.cal/time.cal.ymwd/time.cal.ymwd.members/weekday_indexed.pass.cpp +++ /dev/null @@ -1,46 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// -// UNSUPPORTED: c++03, c++11, c++14, c++17 - -// -// class year_month_weekday; - -// constexpr chrono::weekday_indexed weekday_indexed() const noexcept; -// Returns: wd_ - -#include -#include -#include - -#include "test_macros.h" - -int main() -{ - using year = std::chrono::year; - using month = std::chrono::month; - using day = std::chrono::day; - using weekday = std::chrono::weekday; - using weekday_indexed = std::chrono::weekday_indexed; - using year_month_weekday = std::chrono::year_month_weekday; - - ASSERT_NOEXCEPT( std::declval().weekday_indexed()); - ASSERT_SAME_TYPE(weekday_indexed, decltype(std::declval().weekday_indexed())); - - static_assert( year_month_weekday{}.weekday_indexed() == weekday_indexed{}, ""); - - for (unsigned i = 1; i <= 50; ++i) - { - year_month_weekday ymwd0(year{1234}, month{2}, weekday_indexed{weekday{i}, 1}); - assert( static_cast(ymwd0.weekday_indexed().weekday()) == i); - assert( static_cast(ymwd0.weekday_indexed().index()) == 1); - year_month_weekday ymwd1(year{1234}, month{2}, weekday_indexed{weekday{2}, i}); - assert( static_cast(ymwd1.weekday_indexed().weekday()) == 2); - assert( static_cast(ymwd1.weekday_indexed().index()) == i); - } -} diff --git a/libcxx/test/std/utilities/time/time.cal/time.cal.ymwd/time.cal.ymwd.members/year.pass.cpp b/libcxx/test/std/utilities/time/time.cal/time.cal.ymwd/time.cal.ymwd.members/year.pass.cpp deleted file mode 100644 index 7db843959540..000000000000 --- a/libcxx/test/std/utilities/time/time.cal/time.cal.ymwd/time.cal.ymwd.members/year.pass.cpp +++ /dev/null @@ -1,42 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// -// UNSUPPORTED: c++03, c++11, c++14, c++17 - -// -// class year_month_weekday; - -// constexpr chrono::year year() const noexcept; -// Returns: d_ - -#include -#include -#include - -#include "test_macros.h" - -int main() -{ - using year = std::chrono::year; - using month = std::chrono::month; - using day = std::chrono::day; - using weekday = std::chrono::weekday; - using weekday_indexed = std::chrono::weekday_indexed; - using year_month_weekday = std::chrono::year_month_weekday; - - ASSERT_NOEXCEPT( std::declval().year()); - ASSERT_SAME_TYPE(year, decltype(std::declval().year())); - - static_assert( year_month_weekday{}.year() == year{}, ""); - - for (int i = 1; i <= 50; ++i) - { - year_month_weekday ym(year{i}, month{1}, weekday_indexed{}); - assert( static_cast(ym.year()) == i); - } -} diff --git a/libcxx/test/std/utilities/time/time.cal/time.cal.ymwd/time.cal.ymwd.nonmembers/comparisons.pass.cpp b/libcxx/test/std/utilities/time/time.cal/time.cal.ymwd/time.cal.ymwd.nonmembers/comparisons.pass.cpp deleted file mode 100644 index 6e8f7c03dbe1..000000000000 --- a/libcxx/test/std/utilities/time/time.cal/time.cal.ymwd/time.cal.ymwd.nonmembers/comparisons.pass.cpp +++ /dev/null @@ -1,114 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// -// UNSUPPORTED: c++03, c++11, c++14, c++17 - -// -// class year_month_weekday; - -// constexpr bool operator==(const year_month_weekday& x, const year_month_weekday& y) noexcept; -// Returns: x.year() == y.year() && x.month() == y.month() && x.weekday_indexed() == y.weekday_indexed() -// - - -#include -#include -#include - -#include "test_macros.h" -#include "test_comparisons.h" - -int main() -{ - using year = std::chrono::year; - using month = std::chrono::month; - using day = std::chrono::day; - using weekday_indexed = std::chrono::weekday_indexed; - using weekday = std::chrono::weekday; - using year_month_weekday = std::chrono::year_month_weekday; - - AssertComparisons2AreNoexcept(); - AssertComparisons2ReturnBool(); - - constexpr month January = std::chrono::January; - constexpr month February = std::chrono::February; - constexpr weekday Tuesday = std::chrono::Tuesday; - - static_assert( testComparisons2( - year_month_weekday{year{1234}, January, weekday_indexed{Tuesday, 1}}, - year_month_weekday{year{1234}, January, weekday_indexed{Tuesday, 1}}, - true), ""); - -// different day - static_assert( testComparisons2( - year_month_weekday{year{1234}, January, weekday_indexed{Tuesday, 1}}, - year_month_weekday{year{1234}, January, weekday_indexed{Tuesday, 2}}, - false), ""); - -// different month - static_assert( testComparisons2( - year_month_weekday{year{1234}, January, weekday_indexed{Tuesday, 1}}, - year_month_weekday{year{1234}, February, weekday_indexed{Tuesday, 1}}, - false), ""); - -// different year - static_assert( testComparisons2( - year_month_weekday{year{1234}, January, weekday_indexed{Tuesday, 1}}, - year_month_weekday{year{1235}, January, weekday_indexed{Tuesday, 1}}, - false), ""); - - -// different month and day - static_assert( testComparisons2( - year_month_weekday{year{1234}, January, weekday_indexed{Tuesday, 1}}, - year_month_weekday{year{1234}, February, weekday_indexed{Tuesday, 2}}, - false), ""); - -// different year and month - static_assert( testComparisons2( - year_month_weekday{year{1234}, February, weekday_indexed{Tuesday, 1}}, - year_month_weekday{year{1235}, January, weekday_indexed{Tuesday, 1}}, - false), ""); - -// different year and day - static_assert( testComparisons2( - year_month_weekday{year{1234}, January, weekday_indexed{Tuesday, 2}}, - year_month_weekday{year{1235}, January, weekday_indexed{Tuesday, 1}}, - false), ""); - -// different year, month and day - static_assert( testComparisons2( - year_month_weekday{year{1234}, February, weekday_indexed{Tuesday, 2}}, - year_month_weekday{year{1235}, January, weekday_indexed{Tuesday, 1}}, - false), ""); - - -// same year, different days - for (unsigned i = 1; i < 28; ++i) - for (unsigned j = 1; j < 28; ++j) - assert((testComparisons2( - year_month_weekday{year{1234}, January, weekday_indexed{Tuesday, i}}, - year_month_weekday{year{1234}, January, weekday_indexed{Tuesday, j}}, - i == j))); - -// same year, different months - for (unsigned i = 1; i < 12; ++i) - for (unsigned j = 1; j < 12; ++j) - assert((testComparisons2( - year_month_weekday{year{1234}, month{i}, weekday_indexed{Tuesday, 1}}, - year_month_weekday{year{1234}, month{j}, weekday_indexed{Tuesday, 1}}, - i == j))); - -// same month, different years - for (int i = 1000; i < 20; ++i) - for (int j = 1000; j < 20; ++j) - assert((testComparisons2( - year_month_weekday{year{i}, January, weekday_indexed{Tuesday, 1}}, - year_month_weekday{year{j}, January, weekday_indexed{Tuesday, 1}}, - i == j))); -} diff --git a/libcxx/test/std/utilities/time/time.cal/time.cal.ymwd/time.cal.ymwd.nonmembers/minus.pass.cpp b/libcxx/test/std/utilities/time/time.cal/time.cal.ymwd/time.cal.ymwd.nonmembers/minus.pass.cpp deleted file mode 100644 index a92811cc3185..000000000000 --- a/libcxx/test/std/utilities/time/time.cal/time.cal.ymwd/time.cal.ymwd.nonmembers/minus.pass.cpp +++ /dev/null @@ -1,101 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// -// UNSUPPORTED: c++03, c++11, c++14, c++17 - -// -// class year_month_weekday; - -// constexpr year_month_weekday operator-(const year_month_weekday& ymwd, const months& dm) noexcept; -// Returns: ymwd + (-dm). -// -// constexpr year_month_weekday operator-(const year_month_weekday& ymwd, const years& dy) noexcept; -// Returns: ymwd + (-dy). - - -#include -#include -#include - -#include "test_macros.h" - -#include - -constexpr bool testConstexprYears () -{ - std::chrono::year_month_weekday ym0{std::chrono::year{1234}, std::chrono::January, std::chrono::weekday_indexed{std::chrono::Tuesday, 1}}; - std::chrono::year_month_weekday ym1 = ym0 - std::chrono::years{10}; - return - ym1.year() == std::chrono::year{1234-10} - && ym1.month() == std::chrono::January - && ym1.weekday() == std::chrono::Tuesday - && ym1.index() == 1 - ; -} - -constexpr bool testConstexprMonths () -{ - std::chrono::year_month_weekday ym0{std::chrono::year{1234}, std::chrono::November, std::chrono::weekday_indexed{std::chrono::Tuesday, 1}}; - std::chrono::year_month_weekday ym1 = ym0 - std::chrono::months{6}; - return - ym1.year() == std::chrono::year{1234} - && ym1.month() == std::chrono::May - && ym1.weekday() == std::chrono::Tuesday - && ym1.index() == 1 - ; -} - - -int main() -{ - using year = std::chrono::year; - using month = std::chrono::month; - using day = std::chrono::day; - using weekday = std::chrono::weekday; - using weekday_indexed = std::chrono::weekday_indexed; - using year_month_weekday = std::chrono::year_month_weekday; - using years = std::chrono::years; - using months = std::chrono::months; - - constexpr month November = std::chrono::November; - constexpr weekday Tuesday = std::chrono::Tuesday; - - { // year_month_weekday - years - ASSERT_NOEXCEPT( std::declval() - std::declval()); - ASSERT_SAME_TYPE(year_month_weekday, decltype(std::declval() - std::declval())); - - static_assert(testConstexprYears(), ""); - - year_month_weekday ym{year{1234}, November, weekday_indexed{Tuesday, 1}}; - for (int i = 0; i <= 10; ++i) - { - year_month_weekday ym1 = ym - years{i}; - assert(static_cast(ym1.year()) == 1234 - i); - assert(ym1.month() == November); - assert(ym1.weekday() == Tuesday); - assert(ym1.index() == 1); - } - } - - { // year_month_weekday - months - ASSERT_NOEXCEPT( std::declval() - std::declval()); - ASSERT_SAME_TYPE(year_month_weekday, decltype(std::declval() - std::declval())); - - static_assert(testConstexprMonths(), ""); - - year_month_weekday ym{year{1234}, November, weekday_indexed{Tuesday, 2}}; - for (unsigned i = 1; i <= 10; ++i) - { - year_month_weekday ym1 = ym - months{i}; - assert(ym1.year() == year{1234}); - assert(ym1.month() == month{11-i}); - assert(ym1.weekday() == Tuesday); - assert(ym1.index() == 2); - } - } -} diff --git a/libcxx/test/std/utilities/time/time.cal/time.cal.ymwd/time.cal.ymwd.nonmembers/plus.pass.cpp b/libcxx/test/std/utilities/time/time.cal/time.cal.ymwd/time.cal.ymwd.nonmembers/plus.pass.cpp deleted file mode 100644 index 38838fb6944c..000000000000 --- a/libcxx/test/std/utilities/time/time.cal/time.cal.ymwd/time.cal.ymwd.nonmembers/plus.pass.cpp +++ /dev/null @@ -1,121 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// -// UNSUPPORTED: c++03, c++11, c++14, c++17 - -// -// class year_month_weekday; - -// constexpr year_month_weekday operator+(const year_month_weekday& ymd, const months& dm) noexcept; -// Returns: (ymd.year() / ymd.month() + dm) / ymd.day(). -// -// constexpr year_month_weekday operator+(const months& dm, const year_month_weekday& ymd) noexcept; -// Returns: ymd + dm. -// -// -// constexpr year_month_weekday operator+(const year_month_weekday& ymd, const years& dy) noexcept; -// Returns: (ymd.year() + dy) / ymd.month() / ymd.day(). -// -// constexpr year_month_weekday operator+(const years& dy, const year_month_weekday& ymd) noexcept; -// Returns: ym + dm. - - - -#include -#include -#include - -#include "test_macros.h" - -constexpr bool testConstexprYears(std::chrono::year_month_weekday ym) -{ - std::chrono::years offset{23}; - if (static_cast((ym ).year()) != 1) return false; - if (static_cast((ym + offset).year()) != 24) return false; - if (static_cast((offset + ym).year()) != 24) return false; - return true; -} - - -constexpr bool testConstexprMonths(std::chrono::year_month_weekday ym) -{ - std::chrono::months offset{6}; - if (static_cast((ym ).month()) != 1) return false; - if (static_cast((ym + offset).month()) != 7) return false; - if (static_cast((offset + ym).month()) != 7) return false; - return true; -} - - -int main() -{ - using year = std::chrono::year; - using month = std::chrono::month; - using day = std::chrono::day; - using weekday = std::chrono::weekday; - using weekday_indexed = std::chrono::weekday_indexed; - using year_month_weekday = std::chrono::year_month_weekday; - using years = std::chrono::years; - using months = std::chrono::months; - - constexpr weekday Tuesday = std::chrono::Tuesday; - constexpr month January = std::chrono::January; - - { // year_month_weekday + months (and switched) - ASSERT_NOEXCEPT(std::declval() + std::declval()); - ASSERT_NOEXCEPT(std::declval() + std::declval()); - - ASSERT_SAME_TYPE(year_month_weekday, decltype(std::declval() + std::declval())); - ASSERT_SAME_TYPE(year_month_weekday, decltype(std::declval() + std::declval())); - - static_assert(testConstexprMonths(year_month_weekday{year{1}, January, weekday_indexed{Tuesday, 1}}), ""); - - year_month_weekday ym{year{1234}, January, weekday_indexed{Tuesday, 3}}; - for (int i = 0; i <= 10; ++i) // TODO test wrap-around - { - year_month_weekday ym1 = ym + months{i}; - year_month_weekday ym2 = months{i} + ym; - assert(static_cast(ym1.year()) == 1234); - assert(static_cast(ym2.year()) == 1234); - assert(ym1.month() == month(1 + i)); - assert(ym2.month() == month(1 + i)); - assert(ym1.weekday() == Tuesday); - assert(ym2.weekday() == Tuesday); - assert(ym1.index() == 3); - assert(ym2.index() == 3); - assert(ym1 == ym2); - } - } - - { // year_month_weekday + years (and switched) - ASSERT_NOEXCEPT(std::declval() + std::declval()); - ASSERT_NOEXCEPT(std::declval() + std::declval()); - - ASSERT_SAME_TYPE(year_month_weekday, decltype(std::declval() + std::declval())); - ASSERT_SAME_TYPE(year_month_weekday, decltype(std::declval() + std::declval())); - - static_assert(testConstexprYears (year_month_weekday{year{1}, January, weekday_indexed{Tuesday, 1}}), ""); - - year_month_weekday ym{year{1234}, std::chrono::January, weekday_indexed{Tuesday, 3}}; - for (int i = 0; i <= 10; ++i) - { - year_month_weekday ym1 = ym + years{i}; - year_month_weekday ym2 = years{i} + ym; - assert(static_cast(ym1.year()) == i + 1234); - assert(static_cast(ym2.year()) == i + 1234); - assert(ym1.month() == January); - assert(ym2.month() == January); - assert(ym1.weekday() == Tuesday); - assert(ym2.weekday() == Tuesday); - assert(ym1.index() == 3); - assert(ym2.index() == 3); - assert(ym1 == ym2); - } - } - -} diff --git a/libcxx/test/std/utilities/time/time.cal/time.cal.ymwd/time.cal.ymwd.nonmembers/streaming.pass.cpp b/libcxx/test/std/utilities/time/time.cal/time.cal.ymwd/time.cal.ymwd.nonmembers/streaming.pass.cpp deleted file mode 100644 index da000744e7fb..000000000000 --- a/libcxx/test/std/utilities/time/time.cal/time.cal.ymwd/time.cal.ymwd.nonmembers/streaming.pass.cpp +++ /dev/null @@ -1,57 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// -// UNSUPPORTED: c++03, c++11, c++14, c++17 -// XFAIL: * - -// -// class year_month_weekday; - -// template -// basic_ostream& -// operator<<(basic_ostream& os, const year_month_weekday& ym); -// -// Returns: os << ym.year() << '/' << ym.month(). -// -// -// template -// basic_ostream& -// to_stream(basic_ostream& os, const charT* fmt, const year_month_weekday& ym); -// -// Effects: Streams ym into os using the format specified by the NTCTS fmt. fmt encoding follows the rules specified in 25.11. -// -// template> -// basic_istream& -// from_stream(basic_istream& is, const charT* fmt, -// year_month_weekday& ym, basic_string* abbrev = nullptr, -// minutes* offset = nullptr); -// -// Effects: Attempts to parse the input stream is into the year_month_weekday ym using the format -// flags given in the NTCTS fmt as specified in 25.12. If the parse fails to decode -// a valid year_month_weekday, is.setstate(ios_- base::failbit) shall be called and ym shall -// not be modified. If %Z is used and successfully parsed, that value will be assigned -// to *abbrev if abbrev is non-null. If %z (or a modified variant) is used and -// successfully parsed, that value will be assigned to *offset if offset is non-null. - - - -#include -#include -#include -#include -#include "test_macros.h" - -int main() -{ - using year_month_weekday = std::chrono::year_month_weekday; - using year = std::chrono::year; - using month = std::chrono::month; - using weekday = std::chrono::weekday; - - std::cout << year_month_weekday{year{2018}, month{3}, weekday{4}}; -} diff --git a/libcxx/test/std/utilities/time/time.cal/time.cal.ymwd/types.pass.cpp b/libcxx/test/std/utilities/time/time.cal/time.cal.ymwd/types.pass.cpp deleted file mode 100644 index cd7a0b997ce1..000000000000 --- a/libcxx/test/std/utilities/time/time.cal/time.cal.ymwd/types.pass.cpp +++ /dev/null @@ -1,26 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// -// UNSUPPORTED: c++03, c++11, c++14, c++17 - -// -// class year_month_weekday; - -#include -#include -#include - -#include "test_macros.h" - -int main() -{ - using year_month_weekday = std::chrono::year_month_weekday; - - static_assert(std::is_trivially_copyable_v, ""); - static_assert(std::is_standard_layout_v, ""); -} diff --git a/libcxx/test/std/utilities/time/time.cal/time.cal.ymwdlast/time.cal.ymwdlast.members/ctor.pass.cpp b/libcxx/test/std/utilities/time/time.cal/time.cal.ymwdlast/time.cal.ymwdlast.members/ctor.pass.cpp deleted file mode 100644 index 2bc4038cde71..000000000000 --- a/libcxx/test/std/utilities/time/time.cal/time.cal.ymwdlast/time.cal.ymwdlast.members/ctor.pass.cpp +++ /dev/null @@ -1,52 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// -// UNSUPPORTED: c++03, c++11, c++14, c++17 - -// -// class year_month_weekday_last; - -// constexpr year_month_weekday_last(const chrono::year& y, const chrono::month& m, -// const chrono::weekday_last& wdl) noexcept; -// -// Effects: Constructs an object of type year_month_weekday_last by initializing -// y_ with y, m_ with m, and wdl_ with wdl. -// -// constexpr chrono::year year() const noexcept; -// constexpr chrono::month month() const noexcept; -// constexpr chrono::weekday weekday() const noexcept; -// constexpr chrono::weekday_last weekday_last() const noexcept; -// constexpr bool ok() const noexcept; - -#include -#include -#include - -#include "test_macros.h" - -int main() -{ - using year = std::chrono::year; - using month = std::chrono::month; - using weekday = std::chrono::weekday; - using weekday_last = std::chrono::weekday_last; - using year_month_weekday_last = std::chrono::year_month_weekday_last; - - constexpr month January = std::chrono::January; - constexpr weekday Tuesday = std::chrono::Tuesday; - - ASSERT_NOEXCEPT(year_month_weekday_last{year{1}, month{1}, weekday_last{Tuesday}}); - - constexpr year_month_weekday_last ym1{year{2019}, January, weekday_last{Tuesday}}; - static_assert( ym1.year() == year{2019}, ""); - static_assert( ym1.month() == January, ""); - static_assert( ym1.weekday() == Tuesday, ""); - static_assert( ym1.weekday_last() == weekday_last{Tuesday}, ""); - static_assert( ym1.ok(), ""); - -} diff --git a/libcxx/test/std/utilities/time/time.cal/time.cal.ymwdlast/time.cal.ymwdlast.members/month.pass.cpp b/libcxx/test/std/utilities/time/time.cal/time.cal.ymwdlast/time.cal.ymwdlast.members/month.pass.cpp deleted file mode 100644 index 5602d259d0d9..000000000000 --- a/libcxx/test/std/utilities/time/time.cal/time.cal.ymwdlast/time.cal.ymwdlast.members/month.pass.cpp +++ /dev/null @@ -1,41 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// -// UNSUPPORTED: c++03, c++11, c++14, c++17 - -// -// class year_month_weekday_last; - -// constexpr chrono::month month() const noexcept; -// Returns: wd_ - -#include -#include -#include - -#include "test_macros.h" - -int main() -{ - using year = std::chrono::year; - using month = std::chrono::month; - using weekday = std::chrono::weekday; - using weekday_last = std::chrono::weekday_last; - using year_month_weekday_last = std::chrono::year_month_weekday_last; - - ASSERT_NOEXCEPT( std::declval().month()); - ASSERT_SAME_TYPE(month, decltype(std::declval().month())); - - static_assert( year_month_weekday_last{year{}, month{}, weekday_last{weekday{}}}.month() == month{}, ""); - - for (unsigned i = 1; i <= 50; ++i) - { - year_month_weekday_last ymd(year{1234}, month{i}, weekday_last{weekday{}}); - assert( static_cast(ymd.month()) == i); - } -} diff --git a/libcxx/test/std/utilities/time/time.cal/time.cal.ymwdlast/time.cal.ymwdlast.members/ok.pass.cpp b/libcxx/test/std/utilities/time/time.cal/time.cal.ymwdlast/time.cal.ymwdlast.members/ok.pass.cpp deleted file mode 100644 index 2c431848e10e..000000000000 --- a/libcxx/test/std/utilities/time/time.cal/time.cal.ymwdlast/time.cal.ymwdlast.members/ok.pass.cpp +++ /dev/null @@ -1,73 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// -// UNSUPPORTED: c++03, c++11, c++14, c++17 - -// -// class year_month_weekday_last; - -// constexpr bool ok() const noexcept; -// Returns: y_.ok() && m_.ok() && wdl_.ok(). - -#include -#include -#include - -#include "test_macros.h" - -int main() -{ - using year = std::chrono::year; - using month = std::chrono::month; - using weekday = std::chrono::weekday; - using weekday_last = std::chrono::weekday_last; - using year_month_weekday_last = std::chrono::year_month_weekday_last; - - constexpr month January = std::chrono::January; - constexpr weekday Tuesday = std::chrono::Tuesday; - - ASSERT_NOEXCEPT( std::declval().ok()); - ASSERT_SAME_TYPE(bool, decltype(std::declval().ok())); - - static_assert(!year_month_weekday_last{year{-32768}, month{}, weekday_last{weekday{}}}.ok(), ""); // All three bad - - static_assert(!year_month_weekday_last{year{-32768}, January, weekday_last{Tuesday}}.ok(), ""); // Bad year - static_assert(!year_month_weekday_last{year{2019}, month{}, weekday_last{Tuesday}}.ok(), ""); // Bad month - static_assert(!year_month_weekday_last{year{2019}, January, weekday_last{weekday{7}}}.ok(), ""); // Bad day - - static_assert(!year_month_weekday_last{year{-32768}, month{}, weekday_last{Tuesday}}.ok(), ""); // Bad year & month - static_assert(!year_month_weekday_last{year{2019}, month{}, weekday_last{weekday{7}}}.ok(), ""); // Bad month & day - static_assert(!year_month_weekday_last{year{-32768}, January, weekday_last{weekday{7}}}.ok(), ""); // Bad year & day - - static_assert( year_month_weekday_last{year{2019}, January, weekday_last{Tuesday}}.ok(), ""); // All OK - - for (unsigned i = 0; i <= 50; ++i) - { - year_month_weekday_last ym{year{2019}, January, weekday_last{Tuesday}}; - assert((ym.ok() == weekday_last{Tuesday}.ok())); - } - - for (unsigned i = 0; i <= 50; ++i) - { - year_month_weekday_last ym{year{2019}, January, weekday_last{weekday{i}}}; - assert((ym.ok() == weekday_last{weekday{i}}.ok())); - } - - for (unsigned i = 0; i <= 50; ++i) - { - year_month_weekday_last ym{year{2019}, month{i}, weekday_last{Tuesday}}; - assert((ym.ok() == month{i}.ok())); - } - - const int ymax = static_cast(year::max()); - for (int i = ymax - 100; i <= ymax + 100; ++i) - { - year_month_weekday_last ym{year{i}, January, weekday_last{Tuesday}}; - assert((ym.ok() == year{i}.ok())); - } -} diff --git a/libcxx/test/std/utilities/time/time.cal/time.cal.ymwdlast/time.cal.ymwdlast.members/op_local_days.pass.cpp b/libcxx/test/std/utilities/time/time.cal/time.cal.ymwdlast/time.cal.ymwdlast.members/op_local_days.pass.cpp deleted file mode 100644 index 48b87cbd8b88..000000000000 --- a/libcxx/test/std/utilities/time/time.cal/time.cal.ymwdlast/time.cal.ymwdlast.members/op_local_days.pass.cpp +++ /dev/null @@ -1,35 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// -// UNSUPPORTED: c++03, c++11, c++14, c++17 -// XFAIL: * - -// -// class year_month_day_last; - -// constexpr operator local_days() const noexcept; -// Returns: local_days{sys_days{*this}.time_since_epoch()}. - -#include -#include -#include - -#include "test_macros.h" - -int main() -{ - using year = std::chrono::year; - using month = std::chrono::month; - using day = std::chrono::day; - using month_day_last = std::chrono::month_day_last; - using year_month_day_last = std::chrono::year_month_day_last; - using sys_days = std::chrono::local_days; - - ASSERT_NOEXCEPT( static_cast(std::declval().year())); - ASSERT_SAME_TYPE(year, decltype(static_cast(std::declval().year())); -} diff --git a/libcxx/test/std/utilities/time/time.cal/time.cal.ymwdlast/time.cal.ymwdlast.members/op_sys_days.pass.cpp b/libcxx/test/std/utilities/time/time.cal/time.cal.ymwdlast/time.cal.ymwdlast.members/op_sys_days.pass.cpp deleted file mode 100644 index a89f71faefac..000000000000 --- a/libcxx/test/std/utilities/time/time.cal/time.cal.ymwdlast/time.cal.ymwdlast.members/op_sys_days.pass.cpp +++ /dev/null @@ -1,36 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// -// UNSUPPORTED: c++03, c++11, c++14, c++17 -// XFAIL: * - -// -// class year_month_day_last; - -// constexpr operator sys_days() const noexcept; -// Returns: sys_days{year()/month()/day()}. - -#include -#include -#include - -#include "test_macros.h" - -int main() -{ - using year = std::chrono::year; - using month = std::chrono::month; - using day = std::chrono::day; - using month_day_last = std::chrono::month_day_last; - using year_month_day_last = std::chrono::year_month_day_last; - using sys_days = std::chrono::sys_days; - - ASSERT_NOEXCEPT( static_cast(std::declval().year())); - ASSERT_SAME_TYPE(year, decltype(static_cast(std::declval().year())); - -} diff --git a/libcxx/test/std/utilities/time/time.cal/time.cal.ymwdlast/time.cal.ymwdlast.members/plus_minus_equal_month.pass.cpp b/libcxx/test/std/utilities/time/time.cal/time.cal.ymwdlast/time.cal.ymwdlast.members/plus_minus_equal_month.pass.cpp deleted file mode 100644 index 0785befc2dc3..000000000000 --- a/libcxx/test/std/utilities/time/time.cal/time.cal.ymwdlast/time.cal.ymwdlast.members/plus_minus_equal_month.pass.cpp +++ /dev/null @@ -1,75 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// -// UNSUPPORTED: c++03, c++11, c++14, c++17 - -// -// class year_month_weekday_last; - -// constexpr year_month_weekday_last& operator+=(const months& m) noexcept; -// constexpr year_month_weekday_last& operator-=(const months& m) noexcept; - -#include -#include -#include - -#include "test_macros.h" - -template -constexpr bool testConstexpr(D d1) -{ - if (static_cast((d1 ).month()) != 1) return false; - if (static_cast((d1 += Ds{ 1}).month()) != 2) return false; - if (static_cast((d1 += Ds{ 2}).month()) != 4) return false; - if (static_cast((d1 += Ds{12}).month()) != 4) return false; - if (static_cast((d1 -= Ds{ 1}).month()) != 3) return false; - if (static_cast((d1 -= Ds{ 2}).month()) != 1) return false; - if (static_cast((d1 -= Ds{12}).month()) != 1) return false; - return true; -} - -int main() -{ - using year = std::chrono::year; - using month = std::chrono::month; - using weekday = std::chrono::weekday; - using weekday_last = std::chrono::weekday_last; - using year_month_weekday_last = std::chrono::year_month_weekday_last; - using months = std::chrono::months; - - ASSERT_NOEXCEPT(std::declval() += std::declval()); - ASSERT_NOEXCEPT(std::declval() -= std::declval()); - - ASSERT_SAME_TYPE(year_month_weekday_last&, decltype(std::declval() += std::declval())); - ASSERT_SAME_TYPE(year_month_weekday_last&, decltype(std::declval() -= std::declval())); - - constexpr weekday Tuesday = std::chrono::Tuesday; - static_assert(testConstexpr(year_month_weekday_last{year{1234}, month{1}, weekday_last{Tuesday}}), ""); - - for (unsigned i = 0; i <= 10; ++i) - { - year y{1234}; - year_month_weekday_last ymwd(y, month{i}, weekday_last{Tuesday}); - - assert(static_cast((ymwd += months{2}).month()) == i + 2); - assert(ymwd.year() == y); - assert(ymwd.weekday() == Tuesday); - - assert(static_cast((ymwd ).month()) == i + 2); - assert(ymwd.year() == y); - assert(ymwd.weekday() == Tuesday); - - assert(static_cast((ymwd -= months{1}).month()) == i + 1); - assert(ymwd.year() == y); - assert(ymwd.weekday() == Tuesday); - - assert(static_cast((ymwd ).month()) == i + 1); - assert(ymwd.year() == y); - assert(ymwd.weekday() == Tuesday); - } -} diff --git a/libcxx/test/std/utilities/time/time.cal/time.cal.ymwdlast/time.cal.ymwdlast.members/plus_minus_equal_year.pass.cpp b/libcxx/test/std/utilities/time/time.cal/time.cal.ymwdlast/time.cal.ymwdlast.members/plus_minus_equal_year.pass.cpp deleted file mode 100644 index 3a2a70009eca..000000000000 --- a/libcxx/test/std/utilities/time/time.cal/time.cal.ymwdlast/time.cal.ymwdlast.members/plus_minus_equal_year.pass.cpp +++ /dev/null @@ -1,76 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// -// UNSUPPORTED: c++03, c++11, c++14, c++17 - -// -// class year_month_weekday_last; - -// constexpr year_month_weekday_last& operator+=(const years& d) noexcept; -// constexpr year_month_weekday_last& operator-=(const years& d) noexcept; - -#include -#include -#include - -#include "test_macros.h" - -template -constexpr bool testConstexpr(D d1) -{ - if (static_cast((d1 ).year()) != 1) return false; - if (static_cast((d1 += Ds{ 1}).year()) != 2) return false; - if (static_cast((d1 += Ds{ 2}).year()) != 4) return false; - if (static_cast((d1 += Ds{12}).year()) != 16) return false; - if (static_cast((d1 -= Ds{ 1}).year()) != 15) return false; - if (static_cast((d1 -= Ds{ 2}).year()) != 13) return false; - if (static_cast((d1 -= Ds{12}).year()) != 1) return false; - return true; -} - -int main() -{ - using year = std::chrono::year; - using month = std::chrono::month; - using weekday = std::chrono::weekday; - using weekday_last = std::chrono::weekday_last; - using year_month_weekday_last = std::chrono::year_month_weekday_last; - using years = std::chrono::years; - - ASSERT_NOEXCEPT(std::declval() += std::declval()); - ASSERT_NOEXCEPT(std::declval() -= std::declval()); - - ASSERT_SAME_TYPE(year_month_weekday_last&, decltype(std::declval() += std::declval())); - ASSERT_SAME_TYPE(year_month_weekday_last&, decltype(std::declval() -= std::declval())); - - constexpr weekday Tuesday = std::chrono::Tuesday; - constexpr month January = std::chrono::January; - - static_assert(testConstexpr(year_month_weekday_last{year{1}, January, weekday_last{Tuesday}}), ""); - - for (int i = 1000; i <= 1010; ++i) - { - year_month_weekday_last ymwd(year{i}, January, weekday_last{Tuesday}); - - assert(static_cast((ymwd += years{2}).year()) == i + 2); - assert(ymwd.month() == January); - assert(ymwd.weekday() == Tuesday); - - assert(static_cast((ymwd ).year()) == i + 2); - assert(ymwd.month() == January); - assert(ymwd.weekday() == Tuesday); - - assert(static_cast((ymwd -= years{1}).year()) == i + 1); - assert(ymwd.month() == January); - assert(ymwd.weekday() == Tuesday); - - assert(static_cast((ymwd ).year()) == i + 1); - assert(ymwd.month() == January); - assert(ymwd.weekday() == Tuesday); - } -} diff --git a/libcxx/test/std/utilities/time/time.cal/time.cal.ymwdlast/time.cal.ymwdlast.members/weekday.pass.cpp b/libcxx/test/std/utilities/time/time.cal/time.cal.ymwdlast/time.cal.ymwdlast.members/weekday.pass.cpp deleted file mode 100644 index a88257677fc6..000000000000 --- a/libcxx/test/std/utilities/time/time.cal/time.cal.ymwdlast/time.cal.ymwdlast.members/weekday.pass.cpp +++ /dev/null @@ -1,41 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// -// UNSUPPORTED: c++03, c++11, c++14, c++17 - -// -// class year_month_weekday_last; - -// constexpr chrono::weekday weekday() const noexcept; -// Returns: wdi_.weekday() - -#include -#include -#include - -#include "test_macros.h" - -int main() -{ - using year = std::chrono::year; - using month = std::chrono::month; - using weekday = std::chrono::weekday; - using weekday_last = std::chrono::weekday_last; - using year_month_weekday_last = std::chrono::year_month_weekday_last; - - ASSERT_NOEXCEPT( std::declval().weekday()); - ASSERT_SAME_TYPE(weekday, decltype(std::declval().weekday())); - - static_assert( year_month_weekday_last{year{}, month{}, weekday_last{weekday{}}}.weekday() == weekday{}, ""); - - for (unsigned i = 1; i <= 50; ++i) - { - year_month_weekday_last ymwdl(year{1}, month{1}, weekday_last{weekday{i}}); - assert(static_cast(ymwdl.weekday()) == i); - } -} diff --git a/libcxx/test/std/utilities/time/time.cal/time.cal.ymwdlast/time.cal.ymwdlast.members/year.pass.cpp b/libcxx/test/std/utilities/time/time.cal/time.cal.ymwdlast/time.cal.ymwdlast.members/year.pass.cpp deleted file mode 100644 index 86e2985b4ec9..000000000000 --- a/libcxx/test/std/utilities/time/time.cal/time.cal.ymwdlast/time.cal.ymwdlast.members/year.pass.cpp +++ /dev/null @@ -1,41 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// -// UNSUPPORTED: c++03, c++11, c++14, c++17 - -// -// class year_month_weekday_last; - -// constexpr chrono::year year() const noexcept; -// Returns: d_ - -#include -#include -#include - -#include "test_macros.h" - -int main() -{ - using year = std::chrono::year; - using month = std::chrono::month; - using weekday = std::chrono::weekday; - using weekday_last = std::chrono::weekday_last; - using year_month_weekday_last = std::chrono::year_month_weekday_last; - - ASSERT_NOEXCEPT( std::declval().year()); - ASSERT_SAME_TYPE(year, decltype(std::declval().year())); - - static_assert( year_month_weekday_last{year{}, month{}, weekday_last{weekday{}}}.year() == year{}, ""); - - for (int i = 1; i <= 50; ++i) - { - year_month_weekday_last ymwdl(year{i}, month{1}, weekday_last{weekday{}}); - assert(static_cast(ymwdl.year()) == i); - } -} diff --git a/libcxx/test/std/utilities/time/time.cal/time.cal.ymwdlast/time.cal.ymwdlast.nonmembers/comparisons.pass.cpp b/libcxx/test/std/utilities/time/time.cal/time.cal.ymwdlast/time.cal.ymwdlast.nonmembers/comparisons.pass.cpp deleted file mode 100644 index 4ddfed6f188e..000000000000 --- a/libcxx/test/std/utilities/time/time.cal/time.cal.ymwdlast/time.cal.ymwdlast.nonmembers/comparisons.pass.cpp +++ /dev/null @@ -1,114 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// -// UNSUPPORTED: c++03, c++11, c++14, c++17 - -// -// class year_month_weekday_last; - -// constexpr bool operator==(const year_month_weekday_last& x, const year_month_weekday_last& y) noexcept; -// Returns: x.year() == y.year() && x.month() == y.month() && x.weekday_last() == y.weekday_last() -// - - -#include -#include -#include - -#include "test_macros.h" -#include "test_comparisons.h" - -int main() -{ - using year = std::chrono::year; - using month = std::chrono::month; - using weekday = std::chrono::weekday; - using weekday_last = std::chrono::weekday_last; - using year_month_weekday_last = std::chrono::year_month_weekday_last; - - AssertComparisons2AreNoexcept(); - AssertComparisons2ReturnBool(); - - constexpr month January = std::chrono::January; - constexpr month February = std::chrono::February; - constexpr weekday Tuesday = std::chrono::Tuesday; - constexpr weekday Wednesday = std::chrono::Wednesday; - - static_assert( testComparisons2( - year_month_weekday_last{year{1234}, January, weekday_last{Tuesday}}, - year_month_weekday_last{year{1234}, January, weekday_last{Tuesday}}, - true), ""); - -// different day - static_assert( testComparisons2( - year_month_weekday_last{year{1234}, January, weekday_last{Tuesday}}, - year_month_weekday_last{year{1234}, January, weekday_last{Wednesday}}, - false), ""); - -// different month - static_assert( testComparisons2( - year_month_weekday_last{year{1234}, January, weekday_last{Tuesday}}, - year_month_weekday_last{year{1234}, February, weekday_last{Tuesday}}, - false), ""); - -// different year - static_assert( testComparisons2( - year_month_weekday_last{year{1234}, January, weekday_last{Tuesday}}, - year_month_weekday_last{year{1235}, January, weekday_last{Tuesday}}, - false), ""); - - -// different month and day - static_assert( testComparisons2( - year_month_weekday_last{year{1234}, January, weekday_last{Tuesday}}, - year_month_weekday_last{year{1234}, February, weekday_last{Wednesday}}, - false), ""); - -// different year and month - static_assert( testComparisons2( - year_month_weekday_last{year{1234}, February, weekday_last{Tuesday}}, - year_month_weekday_last{year{1235}, January, weekday_last{Tuesday}}, - false), ""); - -// different year and day - static_assert( testComparisons2( - year_month_weekday_last{year{1234}, January, weekday_last{Wednesday}}, - year_month_weekday_last{year{1235}, January, weekday_last{Tuesday}}, - false), ""); - -// different year, month and day - static_assert( testComparisons2( - year_month_weekday_last{year{1234}, February, weekday_last{Wednesday}}, - year_month_weekday_last{year{1235}, January, weekday_last{Tuesday}}, - false), ""); - - -// same year, different days - for (unsigned i = 1; i < 28; ++i) - for (unsigned j = 1; j < 28; ++j) - assert((testComparisons2( - year_month_weekday_last{year{1234}, January, weekday_last{weekday{i}}}, - year_month_weekday_last{year{1234}, January, weekday_last{weekday{j}}}, - i == j))); - -// same year, different months - for (unsigned i = 1; i < 12; ++i) - for (unsigned j = 1; j < 12; ++j) - assert((testComparisons2( - year_month_weekday_last{year{1234}, month{i}, weekday_last{Tuesday}}, - year_month_weekday_last{year{1234}, month{j}, weekday_last{Tuesday}}, - i == j))); - -// same month, different years - for (int i = 1000; i < 20; ++i) - for (int j = 1000; j < 20; ++j) - assert((testComparisons2( - year_month_weekday_last{year{i}, January, weekday_last{Tuesday}}, - year_month_weekday_last{year{j}, January, weekday_last{Tuesday}}, - i == j))); -} diff --git a/libcxx/test/std/utilities/time/time.cal/time.cal.ymwdlast/time.cal.ymwdlast.nonmembers/minus.pass.cpp b/libcxx/test/std/utilities/time/time.cal/time.cal.ymwdlast/time.cal.ymwdlast.nonmembers/minus.pass.cpp deleted file mode 100644 index 2b58c03ef236..000000000000 --- a/libcxx/test/std/utilities/time/time.cal/time.cal.ymwdlast/time.cal.ymwdlast.nonmembers/minus.pass.cpp +++ /dev/null @@ -1,93 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// -// UNSUPPORTED: c++03, c++11, c++14, c++17 - -// -// class year_month_weekday_last; - -// constexpr year_month_weekday_last operator-(const year_month_weekday_last& ymwdl, const months& dm) noexcept; -// Returns: ymwdl + (-dm). -// -// constexpr year_month_weekday_last operator-(const year_month_weekday_last& ymwdl, const years& dy) noexcept; -// Returns: ymwdl + (-dy). - -#include -#include -#include - -#include "test_macros.h" - -#include - -constexpr bool testConstexprYears(std::chrono::year_month_weekday_last ym) -{ - std::chrono::years offset{14}; - if (static_cast((ym ).year()) != 66) return false; - if (static_cast((ym - offset).year()) != 52) return false; - return true; -} - -constexpr bool testConstexprMonths(std::chrono::year_month_weekday_last ym) -{ - std::chrono::months offset{6}; - if (static_cast((ym ).month()) != 10) return false; - if (static_cast((ym - offset).month()) != 4) return false; - return true; -} - -int main() -{ - using year = std::chrono::year; - using month = std::chrono::month; - using weekday = std::chrono::weekday; - using weekday_last = std::chrono::weekday_last; - using year_month_weekday_last = std::chrono::year_month_weekday_last; - using years = std::chrono::years; - using months = std::chrono::months; - - constexpr month October = std::chrono::October; - constexpr weekday Tuesday = std::chrono::Tuesday; - - { // year_month_weekday_last - years - - ASSERT_NOEXCEPT( std::declval() - std::declval()); - ASSERT_SAME_TYPE(year_month_weekday_last, decltype(std::declval() - std::declval())); - - static_assert(testConstexprYears(year_month_weekday_last{year{66}, October, weekday_last{Tuesday}}), ""); - - year_month_weekday_last ym{year{1234}, October, weekday_last{Tuesday}}; - for (int i = 0; i <= 10; ++i) - { - year_month_weekday_last ym1 = ym - years{i}; - assert(ym1.year() == year{1234 - i}); - assert(ym1.month() == October); - assert(ym1.weekday() == Tuesday); - assert(ym1.weekday_last() == weekday_last{Tuesday}); - } - } - - { // year_month_weekday_last - months - - ASSERT_NOEXCEPT( std::declval() - std::declval()); - ASSERT_SAME_TYPE(year_month_weekday_last, decltype(std::declval() - std::declval())); - - static_assert(testConstexprMonths(year_month_weekday_last{year{66}, October, weekday_last{Tuesday}}), ""); - - year_month_weekday_last ym{year{1234}, October, weekday_last{Tuesday}}; - for (unsigned i = 0; i < 10; ++i) - { - year_month_weekday_last ym1 = ym - months{i}; - assert(ym1.year() == year{1234}); - assert(ym1.month() == month{10 - i}); - assert(ym1.weekday() == Tuesday); - assert(ym1.weekday_last() == weekday_last{Tuesday}); - } - } - -} diff --git a/libcxx/test/std/utilities/time/time.cal/time.cal.ymwdlast/time.cal.ymwdlast.nonmembers/plus.pass.cpp b/libcxx/test/std/utilities/time/time.cal/time.cal.ymwdlast/time.cal.ymwdlast.nonmembers/plus.pass.cpp deleted file mode 100644 index 59ae592a0895..000000000000 --- a/libcxx/test/std/utilities/time/time.cal/time.cal.ymwdlast/time.cal.ymwdlast.nonmembers/plus.pass.cpp +++ /dev/null @@ -1,116 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// -// UNSUPPORTED: c++03, c++11, c++14, c++17 - -// -// class year_month_weekday_last; - -// constexpr year_month_weekday_last operator+(const year_month_weekday_last& ymwdl, const months& dm) noexcept; -// Returns: (ymwdl.year() / ymwdl.month() + dm) / ymwdl.weekday_last(). -// -// constexpr year_month_weekday_last operator+(const months& dm, const year_month_weekday_last& ymwdl) noexcept; -// Returns: ymwdl + dm. -// -// constexpr year_month_weekday_last operator+(const year_month_weekday_last& ymwdl, const years& dy) noexcept; -// Returns: {ymwdl.year()+dy, ymwdl.month(), ymwdl.weekday_last()}. -// -// constexpr year_month_weekday_last operator+(const years& dy, const year_month_weekday_last& ymwdl) noexcept; -// Returns: ymwdl + dy. - -#include -#include -#include - -#include "test_macros.h" - -constexpr bool testConstexprYears(std::chrono::year_month_weekday_last ym) -{ - std::chrono::years offset{23}; - if (static_cast((ym ).year()) != 1) return false; - if (static_cast((ym + offset).year()) != 24) return false; - if (static_cast((offset + ym).year()) != 24) return false; - return true; -} - -constexpr bool testConstexprMonths(std::chrono::year_month_weekday_last ym) -{ - std::chrono::months offset{6}; - if (static_cast((ym ).month()) != 1) return false; - if (static_cast((ym + offset).month()) != 7) return false; - if (static_cast((offset + ym).month()) != 7) return false; - return true; -} - - -int main() -{ - using year = std::chrono::year; - using month = std::chrono::month; - using weekday = std::chrono::weekday; - using weekday_last = std::chrono::weekday_last; - using year_month_weekday_last = std::chrono::year_month_weekday_last; - using years = std::chrono::years; - using months = std::chrono::months; - - constexpr weekday Tuesday = std::chrono::Tuesday; - constexpr month January = std::chrono::January; - - { // year_month_weekday_last + months - ASSERT_NOEXCEPT(std::declval() + std::declval()); - ASSERT_NOEXCEPT(std::declval() + std::declval()); - - ASSERT_SAME_TYPE(year_month_weekday_last, decltype(std::declval() + std::declval())); - ASSERT_SAME_TYPE(year_month_weekday_last, decltype(std::declval() + std::declval())); - - static_assert(testConstexprMonths(year_month_weekday_last{year{1}, January, weekday_last{Tuesday}}), ""); - - year_month_weekday_last ym{year{1234}, January, weekday_last{Tuesday}}; - for (int i = 0; i <= 10; ++i) // TODO test wrap-around - { - year_month_weekday_last ym1 = ym + months{i}; - year_month_weekday_last ym2 = months{i} + ym; - assert(ym1.year() == year(1234)); - assert(ym2.year() == year(1234)); - assert(ym1.month() == month(1 + i)); - assert(ym2.month() == month(1 + i)); - assert(ym1.weekday() == Tuesday); - assert(ym2.weekday() == Tuesday); - assert(ym1.weekday_last() == weekday_last{Tuesday}); - assert(ym2.weekday_last() == weekday_last{Tuesday}); - assert(ym1 == ym2); - } - } - - { // year_month_weekday_last + years - ASSERT_NOEXCEPT(std::declval() + std::declval()); - ASSERT_NOEXCEPT(std::declval() + std::declval()); - - ASSERT_SAME_TYPE(year_month_weekday_last, decltype(std::declval() + std::declval())); - ASSERT_SAME_TYPE(year_month_weekday_last, decltype(std::declval() + std::declval())); - - static_assert(testConstexprYears (year_month_weekday_last{year{1}, January, weekday_last{Tuesday}}), ""); - - year_month_weekday_last ym{year{1234}, std::chrono::January, weekday_last{Tuesday}}; - for (int i = 0; i <= 10; ++i) - { - year_month_weekday_last ym1 = ym + years{i}; - year_month_weekday_last ym2 = years{i} + ym; - assert(ym1.year() == year(1234 + i)); - assert(ym2.year() == year(1234 + i)); - assert(ym1.month() == January); - assert(ym2.month() == January); - assert(ym1.weekday() == Tuesday); - assert(ym2.weekday() == Tuesday); - assert(ym1.weekday_last() == weekday_last{Tuesday}); - assert(ym2.weekday_last() == weekday_last{Tuesday}); - assert(ym1 == ym2); - } - } - -} diff --git a/libcxx/test/std/utilities/time/time.cal/time.cal.ymwdlast/time.cal.ymwdlast.nonmembers/streaming.pass.cpp b/libcxx/test/std/utilities/time/time.cal/time.cal.ymwdlast/time.cal.ymwdlast.nonmembers/streaming.pass.cpp deleted file mode 100644 index d23cb3cf132d..000000000000 --- a/libcxx/test/std/utilities/time/time.cal/time.cal.ymwdlast/time.cal.ymwdlast.nonmembers/streaming.pass.cpp +++ /dev/null @@ -1,38 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// -// UNSUPPORTED: c++03, c++11, c++14, c++17 -// XFAIL: * - -// -// class year_month_weekday_last; - -// template -// basic_ostream& -// operator<<(basic_ostream& os, const year_month_weekday_last& ymwdl); -// -// Returns: os << ymwdl.year() << '/' << ymwdl.month() << '/' << ymwdl.weekday_last(). - - -#include -#include -#include -#include - -#include "test_macros.h" - -int main() -{ - using year_month_weekday_last = std::chrono::year_month_weekday_last; - using year = std::chrono::year; - using month = std::chrono::month; - using weekday = std::chrono::weekday; - using weekday_last = std::chrono::weekday_last; - - std::cout << year_month_weekday_last{year{2018}, month{3}, weekday_last{weekday{4}}}; -} diff --git a/libcxx/test/std/utilities/time/time.cal/time.cal.ymwdlast/types.pass.cpp b/libcxx/test/std/utilities/time/time.cal/time.cal.ymwdlast/types.pass.cpp deleted file mode 100644 index 198af651f45e..000000000000 --- a/libcxx/test/std/utilities/time/time.cal/time.cal.ymwdlast/types.pass.cpp +++ /dev/null @@ -1,26 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// -// UNSUPPORTED: c++03, c++11, c++14, c++17 - -// -// class year_month_weekday_last_last; - -#include -#include -#include - -#include "test_macros.h" - -int main() -{ - using year_month_weekday_last = std::chrono::year_month_weekday_last; - - static_assert(std::is_trivially_copyable_v, ""); - static_assert(std::is_standard_layout_v, ""); -} diff --git a/libcxx/test/std/utilities/time/time.duration/time.duration.literals/literals.pass.cpp b/libcxx/test/std/utilities/time/time.duration/time.duration.literals/literals.pass.cpp index 5d5fb2ad4bc9..d5c0207c0ee7 100644 --- a/libcxx/test/std/utilities/time/time.duration/time.duration.literals/literals.pass.cpp +++ b/libcxx/test/std/utilities/time/time.duration/time.duration.literals/literals.pass.cpp @@ -14,8 +14,6 @@ #include #include -#include "test_macros.h" - int main() { using namespace std::literals::chrono_literals; @@ -27,31 +25,6 @@ int main() static_assert ( std::is_same::value, "" ); static_assert ( std::is_same::value, "" ); static_assert ( std::is_same::value, "" ); -#if TEST_STD_VER > 17 -// static_assert ( std::is_same::value, "" ); -// static_assert ( std::is_same::value, "" ); -// static_assert ( std::is_same::value, "" ); -// static_assert ( std::is_same::value, "" ); -// static_assert ( std::is_same::value, "" ); -// static_assert ( std::is_same::value, "" ); -// static_assert ( std::is_same::value, "" ); -// -// static_assert ( std::is_same::value, "" ); -// static_assert ( std::is_same::value, "" ); -// static_assert ( std::is_same::value, "" ); -// static_assert ( std::is_same::value, "" ); -// static_assert ( std::is_same::value, "" ); -// static_assert ( std::is_same::value, "" ); -// static_assert ( std::is_same::value, "" ); -// static_assert ( std::is_same::value, "" ); -// static_assert ( std::is_same::value, "" ); -// static_assert ( std::is_same::value, "" ); -// static_assert ( std::is_same::value, "" ); -// static_assert ( std::is_same::value, "" ); - -// static_assert ( std::is_same::value, "" ); -// static_assert ( std::is_same::value, "" ); -#endif std::chrono::hours h = 4h; assert ( h == std::chrono::hours(4)); @@ -82,32 +55,4 @@ int main() assert ( ns == std::chrono::nanoseconds(645)); auto ns2 = 645.ns; assert ( ns == ns2 ); - - -#if TEST_STD_VER > 17 -// assert(std::chrono::Sunday == std::chrono::weekday(0)); -// assert(std::chrono::Monday == std::chrono::weekday(1)); -// assert(std::chrono::Tuesday == std::chrono::weekday(2)); -// assert(std::chrono::Wednesday == std::chrono::weekday(3)); -// assert(std::chrono::Thursday == std::chrono::weekday(4)); -// assert(std::chrono::Friday == std::chrono::weekday(5)); -// assert(std::chrono::Saturday == std::chrono::weekday(6)); - - assert(std::chrono::January == std::chrono::month(1)); - assert(std::chrono::February == std::chrono::month(2)); - assert(std::chrono::March == std::chrono::month(3)); - assert(std::chrono::April == std::chrono::month(4)); - assert(std::chrono::May == std::chrono::month(5)); - assert(std::chrono::June == std::chrono::month(6)); - assert(std::chrono::July == std::chrono::month(7)); - assert(std::chrono::August == std::chrono::month(8)); - assert(std::chrono::September == std::chrono::month(9)); - assert(std::chrono::October == std::chrono::month(10)); - assert(std::chrono::November == std::chrono::month(11)); - assert(std::chrono::December == std::chrono::month(12)); - - std::chrono::year y1 = 2018y; - assert (y1 == std::chrono::year(2018)); -// No conversion from floating point for years -#endif } diff --git a/libcxx/test/std/utilities/time/time.duration/time.duration.literals/literals1.pass.cpp b/libcxx/test/std/utilities/time/time.duration/time.duration.literals/literals1.pass.cpp index 33a89bf06746..5e59e1153787 100644 --- a/libcxx/test/std/utilities/time/time.duration/time.duration.literals/literals1.pass.cpp +++ b/libcxx/test/std/utilities/time/time.duration/time.duration.literals/literals1.pass.cpp @@ -45,31 +45,4 @@ int main() assert ( ns == nanoseconds(645)); auto ns2 = 645.ns; assert ( ns == ns2 ); - -#if TEST_STD_VER > 17 - assert(Sunday == weekday(0)); - assert(Monday == weekday(1)); - assert(Tuesday == weekday(2)); - assert(Wednesday == weekday(3)); - assert(Thursday == weekday(4)); - assert(Friday == weekday(5)); - assert(Saturday == weekday(6)); - - assert(January == month(1)); - assert(February == month(2)); - assert(March == month(3)); - assert(April == month(4)); - assert(May == month(5)); - assert(June == month(6)); - assert(July == month(7)); - assert(August == month(8)); - assert(September == month(9)); - assert(October == month(10)); - assert(November == month(11)); - assert(December == month(12)); - - year y1 = 2018y; - assert (y1 == year(2018)); -// No conversion from floating point for years -#endif } diff --git a/libcxx/test/std/utilities/time/time.duration/time.duration.literals/literals2.pass.cpp b/libcxx/test/std/utilities/time/time.duration/time.duration.literals/literals2.pass.cpp index 1d2b5ad23485..282b1c6572e2 100644 --- a/libcxx/test/std/utilities/time/time.duration/time.duration.literals/literals2.pass.cpp +++ b/libcxx/test/std/utilities/time/time.duration/time.duration.literals/literals2.pass.cpp @@ -47,10 +47,4 @@ int main() assert ( ns == std::chrono::nanoseconds(645)); auto ns2 = 645.ns; assert ( ns == ns2 ); - -#if TEST_STD_VER > 17 - std::chrono::year y1 = 2018y; - assert (y1 == std::chrono::year(2018)); -// No conversion from floating point for years -#endif } diff --git a/libcxx/test/std/utilities/time/weeks.pass.cpp b/libcxx/test/std/utilities/time/weeks.pass.cpp deleted file mode 100644 index 6099d55b7c6b..000000000000 --- a/libcxx/test/std/utilities/time/weeks.pass.cpp +++ /dev/null @@ -1,28 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// -// UNSUPPORTED: c++03, c++11, c++14, c++17 - -// - -// using weeks = duration, days::period>>; - -#include -#include -#include - -int main() -{ - typedef std::chrono::weeks D; - typedef D::rep Rep; - typedef D::period Period; - static_assert(std::is_signed::value, ""); - static_assert(std::is_integral::value, ""); - static_assert(std::numeric_limits::digits >= 22, ""); - static_assert(std::is_same_v, std::chrono::days::period>>, ""); -} diff --git a/libcxx/test/std/utilities/time/years.pass.cpp b/libcxx/test/std/utilities/time/years.pass.cpp deleted file mode 100644 index ad68e648a918..000000000000 --- a/libcxx/test/std/utilities/time/years.pass.cpp +++ /dev/null @@ -1,28 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// -// UNSUPPORTED: c++03, c++11, c++14, c++17 - -// - -// using years = duration, days::period>> - -#include -#include -#include - -int main() -{ - typedef std::chrono::years D; - typedef D::rep Rep; - typedef D::period Period; - static_assert(std::is_signed::value, ""); - static_assert(std::is_integral::value, ""); - static_assert(std::numeric_limits::digits >= 17, ""); - static_assert(std::is_same_v, std::chrono::days::period>>, ""); -} diff --git a/libcxx/test/std/utilities/variant/variant.variant/variant.status/index.pass.cpp b/libcxx/test/std/utilities/variant/variant.variant/variant.status/index.pass.cpp index 7ab828eb0bfb..8025b9e0774e 100644 --- a/libcxx/test/std/utilities/variant/variant.variant/variant.status/index.pass.cpp +++ b/libcxx/test/std/utilities/variant/variant.variant/variant.status/index.pass.cpp @@ -34,13 +34,11 @@ #include "variant_test_helpers.hpp" int main() { -#if TEST_STD_VER == 17 - { // This test does not pass on C++20 or later; see https://bugs.llvm.org/show_bug.cgi?id=39232 + { using V = std::variant; constexpr V v; static_assert(v.index() == 0, ""); } -#endif { using V = std::variant; constexpr V v(std::in_place_index<1>); diff --git a/libcxx/test/std/utilities/variant/variant.variant/variant.status/valueless_by_exception.pass.cpp b/libcxx/test/std/utilities/variant/variant.variant/variant.status/valueless_by_exception.pass.cpp index be021917d6dd..660a21c4f31d 100644 --- a/libcxx/test/std/utilities/variant/variant.variant/variant.status/valueless_by_exception.pass.cpp +++ b/libcxx/test/std/utilities/variant/variant.variant/variant.status/valueless_by_exception.pass.cpp @@ -34,13 +34,11 @@ #include "variant_test_helpers.hpp" int main() { -#if TEST_STD_VER == 17 - { // This test does not pass on C++20 or later; see https://bugs.llvm.org/show_bug.cgi?id=39232 + { using V = std::variant; constexpr V v; static_assert(!v.valueless_by_exception(), ""); } -#endif { using V = std::variant; const V v("abc");