Skip to content

Commit

Permalink
Verify that the "conventional syntax operators" are noexcept.
Browse files Browse the repository at this point in the history
  • Loading branch information
StephanTLavavej committed Jan 27, 2021
1 parent f1b69e7 commit 72b2583
Showing 1 changed file with 58 additions and 0 deletions.
58 changes: 58 additions & 0 deletions tests/std/tests/P0355R7_calendars_and_time_zones_dates/test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -902,6 +902,63 @@ constexpr void year_month_weekday_last_test() {
assert(ymwdl - years{2} == 2018y / January / Monday[last]);
}

constexpr void operator_noexcept_test() {
constexpr year y{2021};
constexpr int y_int{2021};
constexpr month m{1};
constexpr int m_int{1};
constexpr day d{27};
constexpr int d_int{27};
constexpr weekday_indexed wdi{Wednesday[4]};
constexpr weekday_last wdl{Wednesday[last]};
constexpr year_month ym{y / m};
constexpr month_day md{m / d};
constexpr month_day_last mdl{m / last};
constexpr month_weekday mwd{m / wdi};
constexpr month_weekday_last mwdl{m / wdl};

static_assert(noexcept(y / m));
static_assert(noexcept(y / m_int));
static_assert(noexcept(m / d));
static_assert(noexcept(m / d_int));
static_assert(noexcept(m_int / d));
static_assert(noexcept(d / m));
static_assert(noexcept(d / m_int));
static_assert(noexcept(m / last));
static_assert(noexcept(m_int / last));
static_assert(noexcept(last / m));
static_assert(noexcept(last / m_int));
static_assert(noexcept(m / wdi));
static_assert(noexcept(m_int / wdi));
static_assert(noexcept(wdi / m));
static_assert(noexcept(wdi / m_int));
static_assert(noexcept(m / wdl));
static_assert(noexcept(m_int / wdl));
static_assert(noexcept(wdl / m));
static_assert(noexcept(wdl / m_int));
static_assert(noexcept(ym / d));
static_assert(noexcept(ym / d_int));
static_assert(noexcept(y / md));
static_assert(noexcept(y_int / md));
static_assert(noexcept(md / y));
static_assert(noexcept(md / y_int));
static_assert(noexcept(ym / last));
static_assert(noexcept(y / mdl));
static_assert(noexcept(y_int / mdl));
static_assert(noexcept(mdl / y));
static_assert(noexcept(mdl / y_int));
static_assert(noexcept(ym / wdi));
static_assert(noexcept(y / mwd));
static_assert(noexcept(y_int / mwd));
static_assert(noexcept(mwd / y));
static_assert(noexcept(mwd / y_int));
static_assert(noexcept(ym / wdl));
static_assert(noexcept(y / mwdl));
static_assert(noexcept(y_int / mwdl));
static_assert(noexcept(mwdl / y));
static_assert(noexcept(mwdl / y_int));
}

constexpr bool test() {
day_test();
month_test();
Expand All @@ -918,6 +975,7 @@ constexpr bool test() {
year_month_day_last_test();
year_month_weekday_test();
year_month_weekday_last_test();
operator_noexcept_test();
return true;
}

Expand Down

0 comments on commit 72b2583

Please sign in to comment.