Lines Matching full:tuple
32 #include "gtest/internal/gtest-tuple.h"
40 using ::std::tr1::tuple;
45 // Tests that tuple_element<K, tuple<T0, T1, ..., TN> >::type returns TK.
47 StaticAssertTypeEq<int, tuple_element<0, tuple<int, char> >::type>();
48 StaticAssertTypeEq<int&, tuple_element<1, tuple<double, int&> >::type>();
49 StaticAssertTypeEq<bool, tuple_element<2, tuple<double, int, bool> >::type>();
52 // Tests that tuple_size<T>::value gives the number of fields in tuple
55 EXPECT_EQ(0, +tuple_size<tuple<> >::value);
56 EXPECT_EQ(1, +tuple_size<tuple<void*> >::value);
57 EXPECT_EQ(1, +tuple_size<tuple<char> >::value);
58 EXPECT_EQ(1, +(tuple_size<tuple<tuple<int, double> > >::value));
59 EXPECT_EQ(2, +(tuple_size<tuple<int&, const char> >::value));
60 EXPECT_EQ(3, +(tuple_size<tuple<char*, void, const bool&> >::value));
63 // Tests comparing a tuple with itself.
65 const tuple<int, char, bool> a(5, 'a', false);
73 const tuple<int, bool> a(5, true), b(5, true);
81 typedef tuple<const int, char> FooTuple;
97 typedef tuple<int&, const char&> FooTuple;
117 // Tests that a tuple field with a reference type is an alias of the
121 tuple<bool, int&> t(true, n);
138 // Tests that tuple's default constructor default initializes each field.
141 // The TR1 report requires that tuple's default constructor default
147 tuple<> empty;
149 tuple<int> a1, b1;
153 tuple<int, double> a2, b2;
158 tuple<double, char, bool*> a3, b3;
164 tuple<int, int, int, int, int, int, int, int, int, int> a10, b10;
178 // Tests constructing a tuple from its fields.
182 tuple<int&> a(n);
186 tuple<int, char> b(5, 'a');
192 tuple<bool, const int&> c(true, m);
197 // Tests tuple's copy constructor.
199 tuple<double, bool> a(0.0, true);
200 tuple<double, bool> b(a);
206 // Tests constructing a tuple from another tuple that has a compatible
209 tuple<int, int, char> a(0, 1, 'a');
210 tuple<double, long, int> b(a);
217 // Tests constructing a 2-tuple from an std::pair.
220 tuple<int, char> b(a);
221 tuple<int, const char&> c(a);
224 // Tests assigning a tuple to another tuple with the same type.
226 const tuple<int, long> a(5, 7L);
227 tuple<int, long> b;
233 // Tests assigning a tuple to another tuple with a different but
236 const tuple<int, long, bool> a(1, 7L, true);
237 tuple<long, int, bool> b;
244 // Tests assigning an std::pair to a 2-tuple.
247 tuple<int, bool> b;
252 tuple<long, bool> c;
261 typedef tuple<int, int, int, int, int, int, int, int, int, int> BigTuple;
276 // Tests that get<N>(t) returns the N-th (0-based) field of tuple t.
281 // Tests that get() works on a const tuple too.
297 tuple<bool, int> a;
302 tuple<char, int, long> b;
314 tuple<const char*, int*> t;