1// 2004-09-23 Chris Jefferson <chris@bubblescope.net>
2
3// Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009
4// Free Software Foundation, Inc.
5//
6// This file is part of the GNU ISO C++ Library.  This library is free
7// software; you can redistribute it and/or modify it under the
8// terms of the GNU General Public License as published by the
9// Free Software Foundation; either version 3, or (at your option)
10// any later version.
11
12// This library is distributed in the hope that it will be useful,
13// but WITHOUT ANY WARRANTY; without even the implied warranty of
14// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15// GNU General Public License for more details.
16
17// You should have received a copy of the GNU General Public License along
18// with this library; see the file COPYING3.  If not see
19// <http://www.gnu.org/licenses/>.
20
21// Tuple
22
23#include <tr1/tuple>
24#include <testsuite_hooks.h>
25
26using namespace std::tr1;
27using std::pair;
28
29int
30main()
31{
32  bool test __attribute__((unused)) = true;
33
34  int x1=0,x2=0;
35  const int &z1=x1;
36
37  // Test empty constructor
38  tuple<> ta __attribute__((unused));
39  tuple<int,int> tb;
40  // Test construction from values
41  tuple<int,int> tc(x1,x2);
42  tuple<int,int&> td(x1,x2);
43  tuple<const int&> te(z1);
44  x1=1;
45  x2=1;
46  VERIFY(get<0>(td) == 0 && get<1>(td) == 1 && get<0>(te) == 1);
47
48  // Test identical tuple copy constructor
49  tuple<int,int> tf(tc);
50  tuple<int,int> tg(td);
51  tuple<const int&> th(te);
52  // Test different tuple copy constructor
53  tuple<int,double> ti(tc);
54  tuple<int,double> tj(td);
55  //tuple<int&, int&> tk(tc);
56  tuple<const int&, const int&> tl(tc);
57  tuple<const int&, const int&> tm(tl);
58  // Test constructing from a pair
59  pair<int,int> pair1(1,1);
60  const pair<int,int> pair2(pair1);
61  tuple<int,int> tn(pair1);
62  tuple<int,const int&> to(pair1);
63  tuple<int,int> tp(pair2);
64  tuple<int,const int&> tq(pair2);
65  return 0;
66}
67
68