Debian Codegraph @

libcxx/test/std/time/time.cal/time.cal.weekday/time.cal.weekday.nonmembers/comparisons.pass.cpp

raw
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
9
10 // <chrono>
11 // class weekday;
12
13 // constexpr bool operator==(const weekday& x, const weekday& y) noexcept;
14 // constexpr bool operator!=(const weekday& x, const weekday& y) noexcept;
15
16
17 #include <chrono>
18 #include <type_traits>
19 #include <cassert>
20 #include <concepts>
21
22 #include "test_macros.h"
23 #include "test_comparisons.h"
24
25 static_assert(!std::totally_ordered<std::chrono::weekday>);
26
27 int main(int, char**)
28 {
29 using weekday = std::chrono::weekday;
30
31 AssertEqualityAreNoexcept<weekday>();
32 AssertEqualityReturnBool<weekday>();
33
34 static_assert(testEqualityValues<weekday>(0U ,0U), "");
35 static_assert(testEqualityValues<weekday>(0U, 1U), "");
36
37 // Some 'ok' values as well
38 static_assert(testEqualityValues<weekday>(5U, 5U), "");
39 static_assert(testEqualityValues<weekday>(5U, 2U), "");
40
41 for (unsigned i = 0; i < 6; ++i)
42 for (unsigned j = 0; j < 6; ++j)
43 assert(testEqualityValues<weekday>(i, j));
44
45 return 0;
46 }