1 //===----------------------------------------------------------------------===//
2 //
3 // The LLVM Compiler Infrastructure
4 //
5 // This file is dual licensed under the MIT and the University of Illinois Open
6 // Source Licenses. See LICENSE.TXT for details.
7 //
8 //===----------------------------------------------------------------------===//
9
10 // <tuple>
11
12 // template <class... Types> class tuple;
13
14 // template<class... TTypes, class... UTypes>
15 // bool
16 // operator<(const tuple<TTypes...>& t, const tuple<UTypes...>& u);
17 //
18 // template<class... TTypes, class... UTypes>
19 // bool
20 // operator>(const tuple<TTypes...>& t, const tuple<UTypes...>& u);
21 //
22 // template<class... TTypes, class... UTypes>
23 // bool
24 // operator<=(const tuple<TTypes...>& t, const tuple<UTypes...>& u);
25 //
26 // template<class... TTypes, class... UTypes>
27 // bool
28 // operator>=(const tuple<TTypes...>& t, const tuple<UTypes...>& u);
29
30 #include <tuple>
31 #include <string>
32 #include <cassert>
33
main()34 int main()
35 {
36 {
37 typedef std::tuple<> T1;
38 typedef std::tuple<> T2;
39 const T1 t1;
40 const T2 t2;
41 assert(!(t1 < t2));
42 assert( (t1 <= t2));
43 assert(!(t1 > t2));
44 assert( (t1 >= t2));
45 }
46 {
47 typedef std::tuple<char> T1;
48 typedef std::tuple<double> T2;
49 const T1 t1(1);
50 const T2 t2(1);
51 assert(!(t1 < t2));
52 assert( (t1 <= t2));
53 assert(!(t1 > t2));
54 assert( (t1 >= t2));
55 }
56 {
57 typedef std::tuple<char> T1;
58 typedef std::tuple<double> T2;
59 const T1 t1(1);
60 const T2 t2(0.9);
61 assert(!(t1 < t2));
62 assert(!(t1 <= t2));
63 assert( (t1 > t2));
64 assert( (t1 >= t2));
65 }
66 {
67 typedef std::tuple<char> T1;
68 typedef std::tuple<double> T2;
69 const T1 t1(1);
70 const T2 t2(1.1);
71 assert( (t1 < t2));
72 assert( (t1 <= t2));
73 assert(!(t1 > t2));
74 assert(!(t1 >= t2));
75 }
76 {
77 typedef std::tuple<char, int> T1;
78 typedef std::tuple<double, char> T2;
79 const T1 t1(1, 2);
80 const T2 t2(1, 2);
81 assert(!(t1 < t2));
82 assert( (t1 <= t2));
83 assert(!(t1 > t2));
84 assert( (t1 >= t2));
85 }
86 {
87 typedef std::tuple<char, int> T1;
88 typedef std::tuple<double, char> T2;
89 const T1 t1(1, 2);
90 const T2 t2(0.9, 2);
91 assert(!(t1 < t2));
92 assert(!(t1 <= t2));
93 assert( (t1 > t2));
94 assert( (t1 >= t2));
95 }
96 {
97 typedef std::tuple<char, int> T1;
98 typedef std::tuple<double, char> T2;
99 const T1 t1(1, 2);
100 const T2 t2(1.1, 2);
101 assert( (t1 < t2));
102 assert( (t1 <= t2));
103 assert(!(t1 > t2));
104 assert(!(t1 >= t2));
105 }
106 {
107 typedef std::tuple<char, int> T1;
108 typedef std::tuple<double, char> T2;
109 const T1 t1(1, 2);
110 const T2 t2(1, 1);
111 assert(!(t1 < t2));
112 assert(!(t1 <= t2));
113 assert( (t1 > t2));
114 assert( (t1 >= t2));
115 }
116 {
117 typedef std::tuple<char, int> T1;
118 typedef std::tuple<double, char> T2;
119 const T1 t1(1, 2);
120 const T2 t2(1, 3);
121 assert( (t1 < t2));
122 assert( (t1 <= t2));
123 assert(!(t1 > t2));
124 assert(!(t1 >= t2));
125 }
126 {
127 typedef std::tuple<char, int, double> T1;
128 typedef std::tuple<double, char, int> T2;
129 const T1 t1(1, 2, 3);
130 const T2 t2(1, 2, 3);
131 assert(!(t1 < t2));
132 assert( (t1 <= t2));
133 assert(!(t1 > t2));
134 assert( (t1 >= t2));
135 }
136 {
137 typedef std::tuple<char, int, double> T1;
138 typedef std::tuple<double, char, int> T2;
139 const T1 t1(1, 2, 3);
140 const T2 t2(0.9, 2, 3);
141 assert(!(t1 < t2));
142 assert(!(t1 <= t2));
143 assert( (t1 > t2));
144 assert( (t1 >= t2));
145 }
146 {
147 typedef std::tuple<char, int, double> T1;
148 typedef std::tuple<double, char, int> T2;
149 const T1 t1(1, 2, 3);
150 const T2 t2(1.1, 2, 3);
151 assert( (t1 < t2));
152 assert( (t1 <= t2));
153 assert(!(t1 > t2));
154 assert(!(t1 >= t2));
155 }
156 {
157 typedef std::tuple<char, int, double> T1;
158 typedef std::tuple<double, char, int> T2;
159 const T1 t1(1, 2, 3);
160 const T2 t2(1, 1, 3);
161 assert(!(t1 < t2));
162 assert(!(t1 <= t2));
163 assert( (t1 > t2));
164 assert( (t1 >= t2));
165 }
166 {
167 typedef std::tuple<char, int, double> T1;
168 typedef std::tuple<double, char, int> T2;
169 const T1 t1(1, 2, 3);
170 const T2 t2(1, 3, 3);
171 assert( (t1 < t2));
172 assert( (t1 <= t2));
173 assert(!(t1 > t2));
174 assert(!(t1 >= t2));
175 }
176 {
177 typedef std::tuple<char, int, double> T1;
178 typedef std::tuple<double, char, int> T2;
179 const T1 t1(1, 2, 3);
180 const T2 t2(1, 2, 2);
181 assert(!(t1 < t2));
182 assert(!(t1 <= t2));
183 assert( (t1 > t2));
184 assert( (t1 >= t2));
185 }
186 {
187 typedef std::tuple<char, int, double> T1;
188 typedef std::tuple<double, char, int> T2;
189 const T1 t1(1, 2, 3);
190 const T2 t2(1, 2, 4);
191 assert( (t1 < t2));
192 assert( (t1 <= t2));
193 assert(!(t1 > t2));
194 assert(!(t1 >= t2));
195 }
196 #if _LIBCPP_STD_VER > 11
197 {
198 typedef std::tuple<char, int, double> T1;
199 typedef std::tuple<double, char, int> T2;
200 constexpr T1 t1(1, 2, 3);
201 constexpr T2 t2(1, 2, 4);
202 static_assert( (t1 < t2), "");
203 static_assert( (t1 <= t2), "");
204 static_assert(!(t1 > t2), "");
205 static_assert(!(t1 >= t2), "");
206 }
207 #endif
208 }
209