| 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 month_day_last; |
| 12 |
|
| 13 |
// constexpr bool operator==(const month_day& x, const month_day& y) noexcept; |
| 14 |
// Returns: x.month() == y.month() |
| 15 |
// |
| 16 |
// constexpr bool operator< (const month_day& x, const month_day& y) noexcept; |
| 17 |
// Returns: x.month() < y.month() |
| 18 |
|
| 19 |
|
| 20 |
#include <chrono> |
| 21 |
#include <type_traits> |
| 22 |
#include <cassert> |
| 23 |
|
| 24 |
#include "test_macros.h" |
| 25 |
#include "test_comparisons.h" |
| 26 |
|
| 27 |
int main(int, char**) |
| 28 |
{ |
| 29 |
using month = std::chrono::month; |
| 30 |
using month_day_last = std::chrono::month_day_last; |
| 31 |
|
| 32 |
AssertComparisonsAreNoexcept<month_day_last>(); |
| 33 |
AssertComparisonsReturnBool<month_day_last>(); |
| 34 |
|
| 35 |
static_assert( testComparisonsValues<month_day_last>(month{1}, month{1}), ""); |
| 36 |
static_assert( testComparisonsValues<month_day_last>(month{1}, month{2}), ""); |
| 37 |
|
| 38 |
// same day, different months |
| 39 |
for (unsigned i = 1; i <= 12; ++i) |
| 40 |
for (unsigned j = 1; j <= 12; ++j) |
| 41 |
assert(testComparisonsValues<month_day_last>(month{i}, month{j})); |
| 42 |
|
| 43 |
return 0; |
| 44 |
} |