[RISCV] Fix mgather -> riscv.masked.strided.load combine not extending indices (...
[llvm-project.git] / libcxx / test / std / time / time.hms / time.hms.members / minutes.pass.cpp
blob570b2727626b7309726e334ea4a23a2a3ef363f6
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 chrono::minutes minutes() const noexcept;
16 // See the table in hours.pass.cpp for correspondence between the magic values used below
18 #include <chrono>
19 #include <cassert>
20 #include <ratio>
21 #include <utility>
23 #include "test_macros.h"
25 template <typename Duration>
26 constexpr long check_minutes(Duration d)
28 using HMS = std::chrono::hh_mm_ss<Duration>;
29 ASSERT_SAME_TYPE(std::chrono::minutes, decltype(std::declval<HMS>().minutes()));
30 ASSERT_NOEXCEPT( std::declval<HMS>().minutes());
31 return HMS(d).minutes().count();
34 int main(int, char**)
36 using microfortnights = std::chrono::duration<int, std::ratio<756, 625>>;
38 static_assert( check_minutes(std::chrono::minutes( 1)) == 1, "");
39 static_assert( check_minutes(std::chrono::minutes(-1)) == 1, "");
41 assert( check_minutes(std::chrono::seconds( 5000)) == 23);
42 assert( check_minutes(std::chrono::seconds(-5000)) == 23);
43 assert( check_minutes(std::chrono::minutes( 5000)) == 20);
44 assert( check_minutes(std::chrono::minutes(-5000)) == 20);
45 assert( check_minutes(std::chrono::hours( 11)) == 0);
46 assert( check_minutes(std::chrono::hours(-11)) == 0);
48 assert( check_minutes(std::chrono::milliseconds( 123456789LL)) == 17);
49 assert( check_minutes(std::chrono::milliseconds(-123456789LL)) == 17);
50 assert( check_minutes(std::chrono::microseconds( 123456789LL)) == 2);
51 assert( check_minutes(std::chrono::microseconds(-123456789LL)) == 2);
52 assert( check_minutes(std::chrono::nanoseconds( 123456789LL)) == 0);
53 assert( check_minutes(std::chrono::nanoseconds(-123456789LL)) == 0);
55 assert( check_minutes(microfortnights( 1000)) == 20);
56 assert( check_minutes(microfortnights( -1000)) == 20);
57 assert( check_minutes(microfortnights( 10000)) == 21);
58 assert( check_minutes(microfortnights(-10000)) == 21);
60 return 0;