[RISCV] Fix mgather -> riscv.masked.strided.load combine not extending indices (...
[llvm-project.git] / libcxx / test / std / time / time.hms / time.hms.members / is_negative.pass.cpp
blob51fa2d9a0e05170ee1ab6fc0ede5ce75c7bcdb28
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 // <chrono>
11 // template <class Duration>
12 // class hh_mm_ss
14 // constexpr bool is_negative() const noexcept;
16 #include <chrono>
17 #include <cassert>
18 #include <ratio>
19 #include <utility>
21 #include "test_macros.h"
23 template <typename Duration>
24 constexpr bool check_neg(Duration d)
26 ASSERT_SAME_TYPE(bool, decltype(std::declval<std::chrono::hh_mm_ss<Duration>>().is_negative()));
27 ASSERT_NOEXCEPT( std::declval<std::chrono::hh_mm_ss<Duration>>().is_negative());
28 return std::chrono::hh_mm_ss<Duration>(d).is_negative();
31 int main(int, char**)
33 using microfortnights = std::chrono::duration<int, std::ratio<756, 625>>;
35 static_assert(!check_neg(std::chrono::minutes( 1)), "");
36 static_assert( check_neg(std::chrono::minutes(-1)), "");
38 assert(!check_neg(std::chrono::seconds( 5000)));
39 assert( check_neg(std::chrono::seconds(-5000)));
40 assert(!check_neg(std::chrono::minutes( 5000)));
41 assert( check_neg(std::chrono::minutes(-5000)));
42 assert(!check_neg(std::chrono::hours( 11)));
43 assert( check_neg(std::chrono::hours(-11)));
45 assert(!check_neg(std::chrono::milliseconds( 123456789LL)));
46 assert( check_neg(std::chrono::milliseconds(-123456789LL)));
47 assert(!check_neg(std::chrono::microseconds( 123456789LL)));
48 assert( check_neg(std::chrono::microseconds(-123456789LL)));
49 assert(!check_neg(std::chrono::nanoseconds( 123456789LL)));
50 assert( check_neg(std::chrono::nanoseconds(-123456789LL)));
52 assert(!check_neg(microfortnights( 10000)));
53 assert( check_neg(microfortnights(-10000)));
55 return 0;