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_indexed;
12
13// constexpr bool operator==(const weekday_indexed& x, const weekday_indexed& y) noexcept;
14// Returns: x.weekday() == y.weekday() && x.index() == y.index().
15// constexpr bool operator!=(const weekday_indexed& x, const weekday_indexed& y) noexcept;
16// Returns: !(x == y)
17
18#include <chrono>
19#include <type_traits>
20#include <cassert>
21
22#include "test_macros.h"
23#include "test_comparisons.h"
24
25int main(int, char**)
26{
27 using weekday = std::chrono::weekday;
28 using weekday_indexed = std::chrono::weekday_indexed;
29
30 AssertEqualityAreNoexcept<weekday_indexed>();
31 AssertEqualityReturnBool<weekday_indexed>();
32
33 static_assert( (weekday_indexed{} == weekday_indexed{}), "");
34 static_assert(!(weekday_indexed{} != weekday_indexed{}), "");
35
36 static_assert(!(weekday_indexed{} == weekday_indexed{std::chrono::Tuesday, 1}), "");
37 static_assert( (weekday_indexed{} != weekday_indexed{std::chrono::Tuesday, 1}), "");
38
39 // Some 'ok' values as well
40 static_assert( (weekday_indexed{weekday{1}, 2} == weekday_indexed{weekday{1}, 2}), "");
41 static_assert(!(weekday_indexed{weekday{1}, 2} != weekday_indexed{weekday{1}, 2}), "");
42
43 static_assert(!(weekday_indexed{weekday{1}, 2} == weekday_indexed{weekday{1}, 1}), "");
44 static_assert( (weekday_indexed{weekday{1}, 2} != weekday_indexed{weekday{1}, 1}), "");
45 static_assert(!(weekday_indexed{weekday{1}, 2} == weekday_indexed{weekday{2}, 2}), "");
46 static_assert( (weekday_indexed{weekday{1}, 2} != weekday_indexed{weekday{2}, 2}), "");
47
48 return 0;
49}
50

source code of libcxx/test/std/time/time.cal/time.cal.wdidx/time.cal.wdidx.nonmembers/comparisons.pass.cpp