1 //===----------------------------------------------------------------------===//
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
7 //===----------------------------------------------------------------------===//
13 // template <class Rep1, class Period1, class Rep2, class Period2>
16 // operator==(const duration<Rep1, Period1>& lhs, const duration<Rep2, Period2>& rhs);
18 // template <class Rep1, class Period1, class Rep2, class Period2>
21 // operator!=(const duration<Rep1, Period1>& lhs, const duration<Rep2, Period2>& rhs);
27 #include "test_macros.h"
32 std::chrono::seconds
s1(3);
33 std::chrono::seconds
s2(3);
38 std::chrono::seconds
s1(3);
39 std::chrono::seconds
s2(4);
44 std::chrono::milliseconds
s1(3);
45 std::chrono::microseconds
s2(3000);
50 std::chrono::milliseconds
s1(3);
51 std::chrono::microseconds
s2(4000);
56 std::chrono::duration
<int, std::ratio
<2, 3> > s1(9);
57 std::chrono::duration
<int, std::ratio
<3, 5> > s2(10);
62 std::chrono::duration
<int, std::ratio
<2, 3> > s1(10);
63 std::chrono::duration
<int, std::ratio
<3, 5> > s2(9);
68 std::chrono::duration
<int, std::ratio
<2, 3> > s1(9);
69 std::chrono::duration
<double, std::ratio
<3, 5> > s2(10);
73 #if TEST_STD_VER >= 11
75 constexpr std::chrono::seconds
s1(3);
76 constexpr std::chrono::seconds
s2(3);
77 static_assert(s1
== s2
, "");
78 static_assert(!(s1
!= s2
), "");
81 constexpr std::chrono::seconds
s1(3);
82 constexpr std::chrono::seconds
s2(4);
83 static_assert(!(s1
== s2
), "");
84 static_assert(s1
!= s2
, "");
87 constexpr std::chrono::milliseconds
s1(3);
88 constexpr std::chrono::microseconds
s2(3000);
89 static_assert(s1
== s2
, "");
90 static_assert(!(s1
!= s2
), "");
93 constexpr std::chrono::milliseconds
s1(3);
94 constexpr std::chrono::microseconds
s2(4000);
95 static_assert(!(s1
== s2
), "");
96 static_assert(s1
!= s2
, "");
99 constexpr std::chrono::duration
<int, std::ratio
<2, 3> > s1(9);
100 constexpr std::chrono::duration
<int, std::ratio
<3, 5> > s2(10);
101 static_assert(s1
== s2
, "");
102 static_assert(!(s1
!= s2
), "");
105 constexpr std::chrono::duration
<int, std::ratio
<2, 3> > s1(10);
106 constexpr std::chrono::duration
<int, std::ratio
<3, 5> > s2(9);
107 static_assert(!(s1
== s2
), "");
108 static_assert(s1
!= s2
, "");
111 constexpr std::chrono::duration
<int, std::ratio
<2, 3> > s1(9);
112 constexpr std::chrono::duration
<double, std::ratio
<3, 5> > s2(10);
113 static_assert(s1
== s2
, "");
114 static_assert(!(s1
!= s2
), "");