[flang][cuda] Do not apply implicit data attribute on dummy arg with VALUE (#119927)
[llvm-project.git] / libcxx / test / std / time / time.duration / time.duration.nonmember / op_mod_duration.pass.cpp
blobdf637e1c23e30bd3ccab1949f1f885bd0255d3be
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 //===----------------------------------------------------------------------===//
9 // <chrono>
11 // duration
13 // template <class Rep1, class Period1, class Rep2, class Period2>
14 // constexpr
15 // typename common_type<duration<Rep1, Period1>, duration<Rep2, Period2>>::type
16 // operator%(const duration<Rep1, Period1>& lhs, const duration<Rep2, Period2>& rhs);
18 #include <chrono>
19 #include <cassert>
20 #include <ratio>
21 #include "../../rep.h"
23 #include "test_macros.h"
25 int main(int, char**)
28 std::chrono::nanoseconds ns1(15);
29 std::chrono::nanoseconds ns2(6);
30 std::chrono::nanoseconds r = ns1 % ns2;
31 assert(r.count() == 3);
34 std::chrono::microseconds us1(15);
35 std::chrono::nanoseconds ns2(28);
36 std::chrono::nanoseconds r = us1 % ns2;
37 assert(r.count() == 20);
40 std::chrono::duration<int, std::ratio<3, 5> > s1(6);
41 std::chrono::duration<int, std::ratio<2, 3> > s2(3);
42 std::chrono::duration<int, std::ratio<1, 15> > r = s1 % s2;
43 assert(r.count() == 24);
45 #if TEST_STD_VER >= 11
47 constexpr std::chrono::nanoseconds ns1(15);
48 constexpr std::chrono::nanoseconds ns2(6);
49 constexpr std::chrono::nanoseconds r = ns1 % ns2;
50 static_assert(r.count() == 3, "");
53 constexpr std::chrono::microseconds us1(15);
54 constexpr std::chrono::nanoseconds ns2(28);
55 constexpr std::chrono::nanoseconds r = us1 % ns2;
56 static_assert(r.count() == 20, "");
59 constexpr std::chrono::duration<int, std::ratio<3, 5> > s1(6);
60 constexpr std::chrono::duration<int, std::ratio<2, 3> > s2(3);
61 constexpr std::chrono::duration<int, std::ratio<1, 15> > r = s1 % s2;
62 static_assert(r.count() == 24, "");
65 std::chrono::duration<int> d(5);
66 RepConstConvertibleLWG3050 x;
69 auto r = d % x;
70 assert(r.count() == 1);
71 ASSERT_SAME_TYPE(std::chrono::duration<long>, decltype(r));
74 #endif // TEST_STD_VER >= 11
76 return 0;