OSDN Git Service

Index: gcc/ChangeLog
[pf3gnuchains/gcc-fork.git] / libstdc++-v3 / testsuite / tr1 / 6_containers / unordered / hash / 24799.cc
1 // 2005-11-11  Paolo Carlini  <pcarlini@suse.de>
2 //
3 // Copyright (C) 2005 Free Software Foundation, Inc.
4 //
5 // This file is part of the GNU ISO C++ Library.  This library is free
6 // software; you can redistribute it and/or modify it under the
7 // terms of the GNU General Public License as published by the
8 // Free Software Foundation; either version 2, or (at your option)
9 // any later version.
10 //
11 // This library is distributed in the hope that it will be useful,
12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14 // GNU General Public License for more details.
15 //
16 // You should have received a copy of the GNU General Public License along
17 // with this library; see the file COPYING.  If not, write to the Free
18 // Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
19 // USA.
20
21 // 6.3.3 Class template hash
22
23 #include <tr1/functional>
24 #include <string>
25 #include <tr1/type_traits>
26 #include <testsuite_tr1.h>
27 #include <testsuite_hooks.h>
28
29 template<typename T>
30   void
31   do_test()
32   {
33     bool test __attribute__((unused)) = true;
34
35     using std::tr1::is_same;
36     using __gnu_test::test_relationship;
37     
38     typedef typename std::tr1::hash<T>::argument_type  argument_type;
39     typedef typename std::tr1::hash<T>::result_type    result_type;
40     
41     VERIFY( (test_relationship<is_same, argument_type, T>(true)) );
42     VERIFY( (test_relationship<is_same, result_type, std::size_t>(true)) );
43   }
44   
45 // libstdc++/24799
46 void test01()
47 {
48   do_test<bool>();
49   do_test<char>();
50   do_test<signed char>();
51   do_test<unsigned char>();
52   do_test<short>();
53   do_test<int>();
54   do_test<long>();
55   do_test<unsigned short>();
56   do_test<unsigned int>();
57   do_test<unsigned long>();
58   do_test<int*>();
59   do_test<std::string>();
60   do_test<float>();
61   do_test<double>();
62   do_test<long double>();
63
64 #ifdef _GLIBCXX_USE_WCHAR_T
65   do_test<wchar_t>();
66   do_test<std::wstring>();
67 #endif
68 }
69
70 int main()
71 {
72   test01();
73   return 0;
74 }