1 // { dg-do run { target c++11 } }
2 
3 // 2010-03-25  Paolo Carlini  <paolo.carlini@oracle.com>
4 
5 // Copyright (C) 2010-2018 Free Software Foundation, Inc.
6 //
7 // This file is part of the GNU ISO C++ Library.  This library is free
8 // software; you can redistribute it and/or modify it under the
9 // terms of the GNU General Public License as published by the
10 // Free Software Foundation; either version 3, or (at your option)
11 // any later version.
12 //
13 // This library is distributed in the hope that it will be useful,
14 // but WITHOUT ANY WARRANTY; without even the implied warranty of
15 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16 // GNU General Public License for more details.
17 //
18 // You should have received a copy of the GNU General Public License along
19 // with this library; see the file COPYING3.  If not see
20 // <http://www.gnu.org/licenses/>.
21 
22 #include <unordered_map>
23 #include <algorithm>
24 #include <testsuite_hooks.h>
25 
test01()26 void test01()
27 {
28   typedef std::pair<const int, int> Pair;
29   std::unordered_multimap<int, int> umm1, umm2;
30   VERIFY( umm1 == umm2 );
31   VERIFY( !(umm1 != umm2) );
32 
33   int second1[] = { -1, -2, -3, -4, -5 };
34   int second2[] = { -1, -2, -3, -4, -5 };
35   const unsigned size = sizeof(second1) / sizeof(int);
36 
37   for (unsigned perm1 = 0; perm1 < 120; ++perm1)
38     {
39       umm1.clear();
40       std::next_permutation(second1, second1 + size);
41       for (unsigned i1 = 0; i1 < size; ++i1)
42 	umm1.insert(Pair(0, second1[i1]));
43 
44       for (unsigned perm2 = 0; perm2 < 120; ++perm2)
45 	{
46 	  umm2.clear();
47 	  std::next_permutation(second2, second2 + size);
48 	  for (unsigned i2 = 0; i2 < size; ++i2)
49 	    umm2.insert(Pair(0, second2[i2]));
50 
51 	  VERIFY( umm1 == umm2 );
52 	  VERIFY( !(umm1 != umm2) );
53 	}
54     }
55 }
56 
main()57 int main()
58 {
59   test01();
60   return 0;
61 }
62