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 day;
12
13// constexpr day& operator++() noexcept;
14// constexpr day operator++(int) noexcept;
15
16#include <chrono>
17#include <cassert>
18#include <type_traits>
19#include <utility>
20
21#include "test_macros.h"
22
23using day = std::chrono::day;
24
25constexpr bool test() {
26 for (unsigned i = 10; i <= 20; ++i) {
27 day d(i);
28 assert(static_cast<unsigned>(++d) == i + 1);
29 assert(static_cast<unsigned>(d++) == i + 1);
30 assert(static_cast<unsigned>(d) == i + 2);
31 }
32
33 return true;
34}
35
36int main(int, char**) {
37 ASSERT_NOEXCEPT(++(std::declval<day&>()));
38 ASSERT_NOEXCEPT((std::declval<day&>())++);
39
40 ASSERT_SAME_TYPE(day, decltype(std::declval<day&>()++));
41 ASSERT_SAME_TYPE(day&, decltype(++std::declval<day&>()));
42
43 test();
44 static_assert(test());
45
46 return 0;
47}
48

source code of libcxx/test/std/time/time.cal/time.cal.day/time.cal.day.members/increment.pass.cpp