1 //===----------------------------------------------------------------------===//
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
7 //===----------------------------------------------------------------------===//
8 // UNSUPPORTED: c++03, c++11, c++14, c++17
13 // constexpr bool operator==(const year& x, const year& y) noexcept;
14 // constexpr strong_ordering operator<=>(const year& x, const year& y) noexcept;
17 #include <type_traits>
20 #include "test_macros.h"
21 #include "test_comparisons.h"
23 constexpr bool test() {
24 using year
= std::chrono::year
;
26 // Validate valid value. The range [-32768, 32767] is guaranteed to be allowed.
27 assert(testOrderValues
<year
>(-32768, -32768));
28 assert(testOrderValues
<year
>(-32768, -32767));
30 assert(testOrderValues
<year
>(32767, 32766));
31 assert(testOrderValues
<year
>(32767, 32767));
33 // Validate some valid values.
34 for (int i
= 1; i
< 10; ++i
)
35 for (int j
= 1; j
< 10; ++j
)
36 assert(testOrderValues
<year
>(i
, j
));
41 int main(int, char**) {
42 using year
= std::chrono::year
;
43 AssertOrderAreNoexcept
<year
>();
44 AssertOrderReturn
<std::strong_ordering
, year
>();
47 static_assert(test());