//===----------------------------------------------------------------------===// // // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. // See https://llvm.org/LICENSE.txt for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // //===----------------------------------------------------------------------===// // UNSUPPORTED: c++98, c++03, c++11, c++14, c++17 // // template // class hh_mm_ss // // constexpr bool is_negative() const noexcept; #include #include #include "test_macros.h" template constexpr bool check_neg(Duration d) { ASSERT_SAME_TYPE(bool, decltype(std::declval>().is_negative())); ASSERT_NOEXCEPT( std::declval>().is_negative()); return std::chrono::hh_mm_ss(d).is_negative(); } int main(int, char**) { using microfortnights = std::chrono::duration>; static_assert(!check_neg(std::chrono::minutes( 1)), ""); static_assert( check_neg(std::chrono::minutes(-1)), ""); assert(!check_neg(std::chrono::seconds( 5000))); assert( check_neg(std::chrono::seconds(-5000))); assert(!check_neg(std::chrono::minutes( 5000))); assert( check_neg(std::chrono::minutes(-5000))); assert(!check_neg(std::chrono::hours( 11))); assert( check_neg(std::chrono::hours(-11))); assert(!check_neg(std::chrono::milliseconds( 123456789LL))); assert( check_neg(std::chrono::milliseconds(-123456789LL))); assert(!check_neg(std::chrono::microseconds( 123456789LL))); assert( check_neg(std::chrono::microseconds(-123456789LL))); assert(!check_neg(std::chrono::nanoseconds( 123456789LL))); assert( check_neg(std::chrono::nanoseconds(-123456789LL))); assert(!check_neg(microfortnights( 10000))); assert( check_neg(microfortnights(-10000))); return 0; }