1// { dg-options "-std=gnu++0x" } 2 3// 2010-03-25 Paolo Carlini <paolo.carlini@oracle.com> 4 5// Copyright (C) 2010 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 26void test01() 27{ 28 bool test __attribute__((unused)) = true; 29 30 typedef std::pair<const int, int> Pair; 31 std::unordered_multimap<int, int> umm1, umm2; 32 VERIFY( umm1 == umm2 ); 33 VERIFY( !(umm1 != umm2) ); 34 35 int second1[] = { -1, -2, -3, -4, -5 }; 36 int second2[] = { -1, -2, -3, -4, -5 }; 37 const unsigned size = sizeof(second1) / sizeof(int); 38 39 for (unsigned perm1 = 0; perm1 < 120; ++perm1) 40 { 41 umm1.clear(); 42 std::next_permutation(second1, second1 + size); 43 for (unsigned i1 = 0; i1 < size; ++i1) 44 umm1.insert(Pair(0, second1[i1])); 45 46 for (unsigned perm2 = 0; perm2 < 120; ++perm2) 47 { 48 umm2.clear(); 49 std::next_permutation(second2, second2 + size); 50 for (unsigned i2 = 0; i2 < size; ++i2) 51 umm2.insert(Pair(0, second2[i2])); 52 53 VERIFY( umm1 == umm2 ); 54 VERIFY( !(umm1 != umm2) ); 55 } 56 } 57} 58 59int main() 60{ 61 test01(); 62 return 0; 63} 64