Revert "[libc] Use best-fit binary trie to make malloc logarithmic" (#117065)
[llvm-project.git] / libcxx / test / std / containers / sequences / deque / compare.pass.cpp
blobfc7c07e2d0d48d7afdd86f1db6438a113f10e2d6
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 // <deque>
11 // template<class T, class Alloc>
12 // bool operator==(const std::deque<T, Alloc>& lhs,
13 // const std::deque<T,Alloc>& rhs);
15 // template<class T, class Alloc>
16 // bool operator!=(const std::deque<T,Alloc>& lhs,
17 // const std::deque<T,Alloc>& rhs);
19 // template<class T, class Alloc>
20 // bool operator<(const std::deque<T,Alloc>& lhs,
21 // const std::deque<T,Alloc>& rhs);
23 // template<class T, class Alloc>
24 // bool operator<=(const std::deque<T,Alloc>& lhs,
25 // const std::deque<T,Alloc>& rhs);
27 // template<class T, class Alloc>
28 // bool operator>(const std::deque<T,Alloc>& lhs,
29 // const std::deque<T,Alloc>& rhs);
31 // template<class T, class Alloc>
32 // bool operator>=(const std::deque<T,Alloc>& lhs,
33 // const std::deque<T,Alloc>& rhs);
35 #include <deque>
36 #include <cassert>
38 #include "test_comparisons.h"
40 int main(int, char**)
43 const std::deque<int> d1, d2;
44 assert(testComparisons(d1, d2, true, false));
47 const std::deque<int> d1(1, 1), d2(1, 1);
48 assert(testComparisons(d1, d2, true, false));
51 int items[3] = {1, 2, 3};
52 const std::deque<int> d1(items, items + 3);
53 const std::deque<int> d2(items, items + 3);
54 assert(testComparisons(d1, d2, true, false));
57 const std::deque<int> d1(1, 1), d2;
58 assert(testComparisons(d1, d2, false, false));
61 const std::deque<int> d1(1, 1), d2(1, 2);
62 assert(testComparisons(d1, d2, false, true));
65 int items1[2] = {1, 2};
66 int items2[2] = {1, 3};
67 const std::deque<int> d1(items1, items1 + 2);
68 const std::deque<int> d2(items2, items2 + 2);
69 assert(testComparisons(d1, d2, false, true));
72 int items1[2] = {2, 2};
73 int items2[2] = {1, 3};
74 const std::deque<int> d1(items1, items1 + 2);
75 const std::deque<int> d2(items2, items2 + 2);
76 assert(testComparisons(d1, d2, false, false));
79 const std::deque<LessAndEqComp> d1, d2;
80 assert(testComparisons(d1, d2, true, false));
83 const std::deque<LessAndEqComp> d1(1, LessAndEqComp(1));
84 const std::deque<LessAndEqComp> d2(1, LessAndEqComp(1));
85 assert(testComparisons(d1, d2, true, false));
88 LessAndEqComp items[3] = {LessAndEqComp(1), LessAndEqComp(2), LessAndEqComp(3)};
89 const std::deque<LessAndEqComp> d1(items, items + 3);
90 const std::deque<LessAndEqComp> d2(items, items + 3);
91 assert(testComparisons(d1, d2, true, false));
94 const std::deque<LessAndEqComp> d1(1, LessAndEqComp(1));
95 const std::deque<LessAndEqComp> d2;
96 assert(testComparisons(d1, d2, false, false));
99 const std::deque<LessAndEqComp> d1(1, LessAndEqComp(1));
100 const std::deque<LessAndEqComp> d2(1, LessAndEqComp(2));
101 assert(testComparisons(d1, d2, false, true));
104 LessAndEqComp items1[2] = {LessAndEqComp(1), LessAndEqComp(2)};
105 LessAndEqComp items2[2] = {LessAndEqComp(1), LessAndEqComp(3)};
106 const std::deque<LessAndEqComp> d1(items1, items1 + 2);
107 const std::deque<LessAndEqComp> d2(items2, items2 + 2);
108 assert(testComparisons(d1, d2, false, true));
111 LessAndEqComp items1[2] = {LessAndEqComp(2), LessAndEqComp(2)};
112 LessAndEqComp items2[2] = {LessAndEqComp(1), LessAndEqComp(3)};
113 const std::deque<LessAndEqComp> d1(items1, items1 + 2);
114 const std::deque<LessAndEqComp> d2(items2, items2 + 2);
115 assert(testComparisons(d1, d2, false, false));
118 return 0;