[RISCV] Fix mgather -> riscv.masked.strided.load combine not extending indices (...
[llvm-project.git] / libcxx / test / std / time / time.cal / time.cal.month / time.cal.month.members / decrement.pass.cpp
blob9299d9e297218fcdbdaf7a8695048268bd56e5fd
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;
13 // constexpr month& operator--() noexcept;
14 // constexpr month operator--(int) noexcept;
16 #include <chrono>
17 #include <type_traits>
18 #include <cassert>
20 #include "test_macros.h"
22 constexpr bool test() {
23 using month = std::chrono::month;
24 for (unsigned i = 0; i <= 15; ++i) {
25 month m1(i);
26 month m2 = m1--;
27 assert(m1.ok());
28 assert(m1 != m2);
30 unsigned exp = i == 0 ? 11 : i == 1 ? 12 : i - 1;
31 while (exp > 12)
32 exp -= 12;
33 assert(static_cast<unsigned>(m1) == exp);
35 for (unsigned i = 0; i <= 15; ++i) {
36 month m1(i);
37 month m2 = --m1;
38 assert(m1.ok());
39 assert(m2.ok());
40 assert(m1 == m2);
42 unsigned exp = i == 0 ? 11 : i == 1 ? 12 : i - 1;
43 while (exp > 12)
44 exp -= 12;
45 assert(static_cast<unsigned>(m1) == exp);
48 return true;
51 int main(int, char**) {
52 using month = std::chrono::month;
54 ASSERT_NOEXCEPT(--(std::declval<month&>()));
55 ASSERT_NOEXCEPT((std::declval<month&>())--);
57 ASSERT_SAME_TYPE(month, decltype(std::declval<month&>()--));
58 ASSERT_SAME_TYPE(month&, decltype(--std::declval<month&>()));
60 test();
61 static_assert(test());
63 return 0;