38 using ::std::tr1::get;
40 using ::std::tr1::tuple;
41 using ::std::tr1::tuple_element;
42 using ::std::tr1::tuple_size;
46 TEST(tuple_element_Test, ReturnsElementType) {
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>();
54 TEST(tuple_size_Test, ReturnsNumberOfFields) {
64 TEST(ComparisonTest, ComparesWithSelf) {
72 TEST(ComparisonTest, ComparesEqualTuples) {
80 TEST(ComparisonTest, ComparesUnequalTuplesWithoutReferenceFields) {
83 const FooTuple
a(0,
'x');
84 const FooTuple
b(1,
'a');
89 const FooTuple
c(1,
'b');
96 TEST(ComparisonTest, ComparesUnequalTuplesWithReferenceFields) {
101 const FooTuple
a(i, ch);
104 const FooTuple
b(j, ch);
110 const char ch2 =
'b';
111 const FooTuple
c(j, ch2);
119 TEST(ReferenceFieldTest, IsAliasOfReferencedVariable) {
125 <<
"Changing a underlying variable should update the reference field.";
130 <<
"The address of a reference field should equal the address of "
131 <<
"the underlying variable.";
135 <<
"Changing a reference field should update the underlying variable.";
140 TEST(TupleConstructorTest, DefaultConstructorDefaultInitializesEachField) {
164 tuple<int, int, int, int, int, int, int, int, int, int> a10, b10;
179 TEST(TupleConstructorTest, ConstructsFromFields) {
198 TEST(TupleConstructorTest, CopyConstructor) {
208 TEST(TupleConstructorTest, ConstructsFromDifferentTupleType) {
218 TEST(TupleConstructorTest, ConstructsFromPair) {
219 ::std::pair<int, char>
a(1,
'a');
225 TEST(TupleAssignmentTest, AssignsToSameTupleType) {
235 TEST(TupleAssignmentTest, AssignsToDifferentTupleType) {
245 TEST(TupleAssignmentTest, AssignsFromPair) {
246 const ::std::pair<int, bool>
a(5,
true);
264 a_(1, 0, 0, 0, 0, 0, 0, 0, 0, 2),
265 b_(1, 0, 0, 0, 0, 0, 0, 0, 0, 3) {}
271 TEST_F(BigTupleTest, Construction) {
277 TEST_F(BigTupleTest,
get) {
282 const BigTuple
a(
a_);
288 TEST_F(BigTupleTest, Comparisons) {
296 TEST(MakeTupleTest, WorksForScalarTypes) {
309 TEST(MakeTupleTest, WorksForPointers) {
310 int a[] = { 1, 2, 3, 4 };
311 const char*
const str =
"hi";