[RISCV] Fix mgather -> riscv.masked.strided.load combine not extending indices (...
[llvm-project.git] / libcxx / test / std / time / time.point / time.point.nonmember / op_+.pass.cpp
blob7d78f7f43290a919b0f4cc7d1b60b6df39494838
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 // time_point
13 // template <class Clock, class Duration1, class Rep2, class Period2>
14 // time_point<Clock, typename common_type<Duration1, duration<Rep2, Period2>>::type>
15 // operator+(const time_point<Clock, Duration1>& lhs, const duration<Rep2, Period2>& rhs);
17 // template <class Rep1, class Period1, class Clock, class Duration2>
18 // time_point<Clock, typename common_type<duration<Rep1, Period1>, Duration2>::type>
19 // operator+(const duration<Rep1, Period1>& lhs, const time_point<Clock, Duration2>& rhs);
21 #include <chrono>
22 #include <cassert>
24 #include "test_macros.h"
26 int main(int, char**)
28 typedef std::chrono::system_clock Clock;
29 typedef std::chrono::milliseconds Duration1;
30 typedef std::chrono::microseconds Duration2;
32 std::chrono::time_point<Clock, Duration1> t1(Duration1(3));
33 std::chrono::time_point<Clock, Duration2> t2 = t1 + Duration2(5);
34 assert(t2.time_since_epoch() == Duration2(3005));
35 t2 = Duration2(6) + t1;
36 assert(t2.time_since_epoch() == Duration2(3006));
38 #if TEST_STD_VER > 11
40 constexpr std::chrono::time_point<Clock, Duration1> t1(Duration1(3));
41 constexpr std::chrono::time_point<Clock, Duration2> t2 = t1 + Duration2(5);
42 static_assert(t2.time_since_epoch() == Duration2(3005), "");
43 constexpr std::chrono::time_point<Clock, Duration2> t3 = Duration2(6) + t1;
44 static_assert(t3.time_since_epoch() == Duration2(3006), "");
46 #endif
48 return 0;