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 // <tuple>
10
11 // template <class... Types> class tuple;
12
13 // template<class... TTypes, class... UTypes>
14 // bool
15 // operator==(const tuple<TTypes...>& t, const tuple<UTypes...>& u);
16
17 // UNSUPPORTED: c++03
18
19 #include <tuple>
20 #include <string>
21 #include <cassert>
22
23 #include "test_macros.h"
24
main(int,char **)25 int main(int, char**)
26 {
27 {
28 typedef std::tuple<> T1;
29 typedef std::tuple<> T2;
30 const T1 t1;
31 const T2 t2;
32 assert(t1 == t2);
33 assert(!(t1 != t2));
34 }
35 {
36 typedef std::tuple<int> T1;
37 typedef std::tuple<double> T2;
38 const T1 t1(1);
39 const T2 t2(1.1);
40 assert(!(t1 == t2));
41 assert(t1 != t2);
42 }
43 {
44 typedef std::tuple<int> T1;
45 typedef std::tuple<double> T2;
46 const T1 t1(1);
47 const T2 t2(1);
48 assert(t1 == t2);
49 assert(!(t1 != t2));
50 }
51 {
52 typedef std::tuple<int, double> T1;
53 typedef std::tuple<double, long> T2;
54 const T1 t1(1, 2);
55 const T2 t2(1, 2);
56 assert(t1 == t2);
57 assert(!(t1 != t2));
58 }
59 {
60 typedef std::tuple<int, double> T1;
61 typedef std::tuple<double, long> T2;
62 const T1 t1(1, 2);
63 const T2 t2(1, 3);
64 assert(!(t1 == t2));
65 assert(t1 != t2);
66 }
67 {
68 typedef std::tuple<int, double> T1;
69 typedef std::tuple<double, long> T2;
70 const T1 t1(1, 2);
71 const T2 t2(1.1, 2);
72 assert(!(t1 == t2));
73 assert(t1 != t2);
74 }
75 {
76 typedef std::tuple<int, double> T1;
77 typedef std::tuple<double, long> T2;
78 const T1 t1(1, 2);
79 const T2 t2(1.1, 3);
80 assert(!(t1 == t2));
81 assert(t1 != t2);
82 }
83 {
84 typedef std::tuple<long, int, double> T1;
85 typedef std::tuple<double, long, int> T2;
86 const T1 t1(1, 2, 3);
87 const T2 t2(1, 2, 3);
88 assert(t1 == t2);
89 assert(!(t1 != t2));
90 }
91 {
92 typedef std::tuple<long, int, double> T1;
93 typedef std::tuple<double, long, int> T2;
94 const T1 t1(1, 2, 3);
95 const T2 t2(1.1, 2, 3);
96 assert(!(t1 == t2));
97 assert(t1 != t2);
98 }
99 {
100 typedef std::tuple<long, int, double> T1;
101 typedef std::tuple<double, long, int> T2;
102 const T1 t1(1, 2, 3);
103 const T2 t2(1, 3, 3);
104 assert(!(t1 == t2));
105 assert(t1 != t2);
106 }
107 {
108 typedef std::tuple<long, int, double> T1;
109 typedef std::tuple<double, long, int> T2;
110 const T1 t1(1, 2, 3);
111 const T2 t2(1, 2, 4);
112 assert(!(t1 == t2));
113 assert(t1 != t2);
114 }
115 {
116 typedef std::tuple<long, int, double> T1;
117 typedef std::tuple<double, long, int> T2;
118 const T1 t1(1, 2, 3);
119 const T2 t2(1, 3, 2);
120 assert(!(t1 == t2));
121 assert(t1 != t2);
122 }
123 {
124 typedef std::tuple<long, int, double> T1;
125 typedef std::tuple<double, long, int> T2;
126 const T1 t1(1, 2, 3);
127 const T2 t2(1.1, 2, 2);
128 assert(!(t1 == t2));
129 assert(t1 != t2);
130 }
131 {
132 typedef std::tuple<long, int, double> T1;
133 typedef std::tuple<double, long, int> T2;
134 const T1 t1(1, 2, 3);
135 const T2 t2(1.1, 3, 3);
136 assert(!(t1 == t2));
137 assert(t1 != t2);
138 }
139 {
140 typedef std::tuple<long, int, double> T1;
141 typedef std::tuple<double, long, int> T2;
142 const T1 t1(1, 2, 3);
143 const T2 t2(1.1, 3, 2);
144 assert(!(t1 == t2));
145 assert(t1 != t2);
146 }
147 #if TEST_STD_VER > 11
148 {
149 typedef std::tuple<long, int, double> T1;
150 typedef std::tuple<double, long, int> T2;
151 constexpr T1 t1(1, 2, 3);
152 constexpr T2 t2(1.1, 3, 2);
153 static_assert(!(t1 == t2), "");
154 static_assert(t1 != t2, "");
155 }
156 #endif
157
158 return 0;
159 }
160