[RISCV] Fix mgather -> riscv.masked.strided.load combine not extending indices (...
[llvm-project.git] / libcxx / test / std / time / time.cal / time.cal.mwdlast / time.cal.mwdlast.members / ok.pass.cpp
blob9833757d63598797ec03d0ba64ce54a44eea9bb6
1 //===----------------------------------------------------------------------===//
2 //
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 //
7 //===----------------------------------------------------------------------===//
8 // UNSUPPORTED: c++03, c++11, c++14, c++17
10 // <chrono>
11 // class month_weekday_last;
13 // constexpr bool ok() const noexcept;
14 // Returns: m_.ok() && wdl_.ok().
16 #include <chrono>
17 #include <type_traits>
18 #include <cassert>
20 #include "test_macros.h"
22 int main(int, char**)
24 using month = std::chrono::month;
25 using weekday = std::chrono::weekday;
26 using weekday_last = std::chrono::weekday_last;
27 using month_weekday_last = std::chrono::month_weekday_last;
29 constexpr month January = std::chrono::January;
30 constexpr weekday Tuesday = std::chrono::Tuesday;
31 constexpr weekday_last lastTuesday = weekday_last{Tuesday};
33 ASSERT_NOEXCEPT( std::declval<const month_weekday_last>().ok());
34 ASSERT_SAME_TYPE(bool, decltype(std::declval<const month_weekday_last>().ok()));
36 static_assert(!month_weekday_last{month{}, lastTuesday}.ok(), ""); // Bad month
37 static_assert(!month_weekday_last{January, weekday_last{weekday{12}}}.ok(), ""); // Bad month
38 static_assert( month_weekday_last{January, lastTuesday}.ok(), ""); // Both OK
40 for (unsigned i = 0; i <= 50; ++i)
42 month_weekday_last mwdl{month{i}, lastTuesday};
43 assert( mwdl.ok() == month{i}.ok());
46 for (unsigned i = 0; i <= 50; ++i)
48 month_weekday_last mwdl{January, weekday_last{weekday{i}}};
49 assert( mwdl.ok() == weekday_last{weekday{i}}.ok());
52 return 0;