| 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 |
|
| 9 |
// <chrono> |
| 10 |
|
| 11 |
// duration_values::max // noexcept after C++17 |
| 12 |
|
| 13 |
#include <chrono> |
| 14 |
#include <limits> |
| 15 |
#include <cassert> |
| 16 |
|
| 17 |
#include "test_macros.h" |
| 18 |
#include "../../rep.h" |
| 19 |
|
| 20 |
int main(int, char**) |
| 21 |
{ |
| 22 |
assert(std::chrono::duration_values<int>::max() == |
| 23 |
std::numeric_limits<int>::max()); |
| 24 |
assert(std::chrono::duration_values<double>::max() == |
| 25 |
std::numeric_limits<double>::max()); |
| 26 |
assert(std::chrono::duration_values<Rep>::max() == |
| 27 |
std::numeric_limits<Rep>::max()); |
| 28 |
#if TEST_STD_VER >= 11 |
| 29 |
static_assert(std::chrono::duration_values<int>::max() == |
| 30 |
std::numeric_limits<int>::max(), ""); |
| 31 |
static_assert(std::chrono::duration_values<double>::max() == |
| 32 |
std::numeric_limits<double>::max(), ""); |
| 33 |
static_assert(std::chrono::duration_values<Rep>::max() == |
| 34 |
std::numeric_limits<Rep>::max(), ""); |
| 35 |
#endif |
| 36 |
|
| 37 |
LIBCPP_ASSERT_NOEXCEPT(std::chrono::duration_values<int>::max()); |
| 38 |
LIBCPP_ASSERT_NOEXCEPT(std::chrono::duration_values<double>::max()); |
| 39 |
LIBCPP_ASSERT_NOEXCEPT(std::chrono::duration_values<Rep>::max()); |
| 40 |
#if TEST_STD_VER > 17 |
| 41 |
ASSERT_NOEXCEPT(std::chrono::duration_values<int>::max()); |
| 42 |
ASSERT_NOEXCEPT(std::chrono::duration_values<double>::max()); |
| 43 |
ASSERT_NOEXCEPT(std::chrono::duration_values<Rep>::max()); |
| 44 |
#endif |
| 45 |
|
| 46 |
return 0; |
| 47 |
} |