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//===----------------------------------------------------------------------===//
8
9// <deque>
10
11// template<class T, class Alloc>
12// bool operator==(const std::deque<T, Alloc>& lhs,
13// const std::deque<T,Alloc>& rhs);
14
15// template<class T, class Alloc>
16// bool operator!=(const std::deque<T,Alloc>& lhs,
17// const std::deque<T,Alloc>& rhs);
18
19// template<class T, class Alloc>
20// bool operator<(const std::deque<T,Alloc>& lhs,
21// const std::deque<T,Alloc>& rhs);
22
23// template<class T, class Alloc>
24// bool operator<=(const std::deque<T,Alloc>& lhs,
25// const std::deque<T,Alloc>& rhs);
26
27// template<class T, class Alloc>
28// bool operator>(const std::deque<T,Alloc>& lhs,
29// const std::deque<T,Alloc>& rhs);
30
31// template<class T, class Alloc>
32// bool operator>=(const std::deque<T,Alloc>& lhs,
33// const std::deque<T,Alloc>& rhs);
34
35#include <deque>
36#include <cassert>
37
38#include "test_comparisons.h"
39
40int main(int, char**) {
41 {
42 const std::deque<int> d1, d2;
43 assert(testComparisons(d1, d2, true, false));
44 }
45 {
46 const std::deque<int> d1(1, 1), d2(1, 1);
47 assert(testComparisons(d1, d2, true, false));
48 }
49 {
50 int items[3] = {1, 2, 3};
51 const std::deque<int> d1(items, items + 3);
52 const std::deque<int> d2(items, items + 3);
53 assert(testComparisons(d1, d2, true, false));
54 }
55 {
56 const std::deque<int> d1(1, 1), d2;
57 assert(testComparisons(d1, d2, false, false));
58 }
59 {
60 const std::deque<int> d1(1, 1), d2(1, 2);
61 assert(testComparisons(d1, d2, false, true));
62 }
63 {
64 int items1[2] = {1, 2};
65 int items2[2] = {1, 3};
66 const std::deque<int> d1(items1, items1 + 2);
67 const std::deque<int> d2(items2, items2 + 2);
68 assert(testComparisons(d1, d2, false, true));
69 }
70 {
71 int items1[2] = {2, 2};
72 int items2[2] = {1, 3};
73 const std::deque<int> d1(items1, items1 + 2);
74 const std::deque<int> d2(items2, items2 + 2);
75 assert(testComparisons(d1, d2, false, false));
76 }
77 {
78 const std::deque<LessAndEqComp> d1, d2;
79 assert(testComparisons(d1, d2, true, false));
80 }
81 {
82 const std::deque<LessAndEqComp> d1(1, LessAndEqComp(1));
83 const std::deque<LessAndEqComp> d2(1, LessAndEqComp(1));
84 assert(testComparisons(d1, d2, true, false));
85 }
86 {
87 LessAndEqComp items[3] = {LessAndEqComp(1), LessAndEqComp(2), LessAndEqComp(3)};
88 const std::deque<LessAndEqComp> d1(items, items + 3);
89 const std::deque<LessAndEqComp> d2(items, items + 3);
90 assert(testComparisons(d1, d2, true, false));
91 }
92 {
93 const std::deque<LessAndEqComp> d1(1, LessAndEqComp(1));
94 const std::deque<LessAndEqComp> d2;
95 assert(testComparisons(d1, d2, false, false));
96 }
97 {
98 const std::deque<LessAndEqComp> d1(1, LessAndEqComp(1));
99 const std::deque<LessAndEqComp> d2(1, LessAndEqComp(2));
100 assert(testComparisons(d1, d2, false, true));
101 }
102 {
103 LessAndEqComp items1[2] = {LessAndEqComp(1), LessAndEqComp(2)};
104 LessAndEqComp items2[2] = {LessAndEqComp(1), LessAndEqComp(3)};
105 const std::deque<LessAndEqComp> d1(items1, items1 + 2);
106 const std::deque<LessAndEqComp> d2(items2, items2 + 2);
107 assert(testComparisons(d1, d2, false, true));
108 }
109 {
110 LessAndEqComp items1[2] = {LessAndEqComp(2), LessAndEqComp(2)};
111 LessAndEqComp items2[2] = {LessAndEqComp(1), LessAndEqComp(3)};
112 const std::deque<LessAndEqComp> d1(items1, items1 + 2);
113 const std::deque<LessAndEqComp> d2(items2, items2 + 2);
114 assert(testComparisons(d1, d2, false, false));
115 }
116
117 return 0;
118}
119

source code of libcxx/test/std/containers/sequences/deque/compare.pass.cpp