1 //===----------------------------------------------------------------------===//
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
7 //===----------------------------------------------------------------------===//
8 // UNSUPPORTED: c++03, c++11, c++14, c++17
11 // constexpr bool is_pm(const hours& h) noexcept;
12 // Returns: 12h <= h && h <= 23
18 #include "test_macros.h"
22 using hours
= std::chrono::hours
;
23 ASSERT_SAME_TYPE(bool, decltype(std::chrono::is_pm(std::declval
<hours
>())));
24 ASSERT_NOEXCEPT( std::chrono::is_pm(std::declval
<hours
>()));
26 static_assert(!std::chrono::is_pm(hours( 0)), "");
27 static_assert(!std::chrono::is_pm(hours(11)), "");
28 static_assert( std::chrono::is_pm(hours(12)), "");
29 static_assert( std::chrono::is_pm(hours(23)), "");
31 for (int i
= 0; i
< 12; ++i
)
32 assert(!std::chrono::is_pm(hours(i
)));
33 for (int i
= 12; i
< 24; ++i
)
34 assert( std::chrono::is_pm(hours(i
)));