Revert "[libc] Use best-fit binary trie to make malloc logarithmic" (#117065)
[llvm-project.git] / libcxx / test / std / time / time.point / time.point.comparisons / op_less.pass.cpp
blob3b4aa6abecf9a2c54936effc93b287f22fe3f0fe
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 Duration2>
14 // bool
15 // operator< (const time_point<Clock, Duration1>& lhs, const time_point<Clock, Duration2>& rhs);
17 // template <class Clock, class Duration1, class Duration2>
18 // bool
19 // operator> (const time_point<Clock, Duration1>& lhs, const time_point<Clock, Duration2>& rhs);
21 // template <class Clock, class Duration1, class Duration2>
22 // bool
23 // operator<=(const time_point<Clock, Duration1>& lhs, const time_point<Clock, Duration2>& rhs);
25 // template <class Clock, class Duration1, class Duration2>
26 // bool
27 // operator>=(const time_point<Clock, Duration1>& lhs, const time_point<Clock, Duration2>& rhs);
29 #include <chrono>
30 #include <cassert>
32 #include "test_macros.h"
34 int main(int, char**)
36 typedef std::chrono::system_clock Clock;
37 typedef std::chrono::milliseconds Duration1;
38 typedef std::chrono::microseconds Duration2;
39 typedef std::chrono::time_point<Clock, Duration1> T1;
40 typedef std::chrono::time_point<Clock, Duration2> T2;
43 T1 t1(Duration1(3));
44 T1 t2(Duration1(3));
45 assert(!(t1 < t2));
46 assert(!(t1 > t2));
47 assert( (t1 <= t2));
48 assert( (t1 >= t2));
51 T1 t1(Duration1(3));
52 T1 t2(Duration1(4));
53 assert( (t1 < t2));
54 assert(!(t1 > t2));
55 assert( (t1 <= t2));
56 assert(!(t1 >= t2));
59 T1 t1(Duration1(3));
60 T2 t2(Duration2(3000));
61 assert(!(t1 < t2));
62 assert(!(t1 > t2));
63 assert( (t1 <= t2));
64 assert( (t1 >= t2));
67 T1 t1(Duration1(3));
68 T2 t2(Duration2(3001));
69 assert( (t1 < t2));
70 assert(!(t1 > t2));
71 assert( (t1 <= t2));
72 assert(!(t1 >= t2));
75 #if TEST_STD_VER > 11
77 constexpr T1 t1(Duration1(3));
78 constexpr T1 t2(Duration1(3));
79 static_assert(!(t1 < t2), "");
80 static_assert(!(t1 > t2), "");
81 static_assert( (t1 <= t2), "");
82 static_assert( (t1 >= t2), "");
85 constexpr T1 t1(Duration1(3));
86 constexpr T1 t2(Duration1(4));
87 static_assert( (t1 < t2), "");
88 static_assert(!(t1 > t2), "");
89 static_assert( (t1 <= t2), "");
90 static_assert(!(t1 >= t2), "");
93 constexpr T1 t1(Duration1(3));
94 constexpr T2 t2(Duration2(3000));
95 static_assert(!(t1 < t2), "");
96 static_assert(!(t1 > t2), "");
97 static_assert( (t1 <= t2), "");
98 static_assert( (t1 >= t2), "");
101 constexpr T1 t1(Duration1(3));
102 constexpr T2 t2(Duration2(3001));
103 static_assert( (t1 < t2), "");
104 static_assert(!(t1 > t2), "");
105 static_assert( (t1 <= t2), "");
106 static_assert(!(t1 >= t2), "");
108 #endif
110 return 0;