From patchwork Fri Aug 13 13:09:19 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paolo Carlini X-Patchwork-Id: 61681 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) by ozlabs.org (Postfix) with SMTP id 9C5ECB70D0 for ; Fri, 13 Aug 2010 23:09:33 +1000 (EST) Received: (qmail 17811 invoked by alias); 13 Aug 2010 13:09:30 -0000 Received: (qmail 17622 invoked by uid 22791); 13 Aug 2010 13:09:28 -0000 X-SWARE-Spam-Status: No, hits=-1.6 required=5.0 tests=AWL, BAYES_00, RCVD_IN_DNSWL_NONE X-Spam-Check-By: sourceware.org Received: from vsmtp21.tin.it (HELO vsmtp21.tin.it) (212.216.176.109) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Fri, 13 Aug 2010 13:09:22 +0000 Received: from [192.168.0.4] (79.43.213.160) by vsmtp21.tin.it (8.5.113) id 4BC86A4909344AD2; Fri, 13 Aug 2010 15:09:19 +0200 Message-ID: <4C6543FF.6080008@oracle.com> Date: Fri, 13 Aug 2010 15:09:19 +0200 From: Paolo Carlini User-Agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.1.11) Gecko/20100714 SUSE/3.0.6 Thunderbird/3.0.6 MIME-Version: 1.0 To: "gcc-patches@gcc.gnu.org" CC: libstdc++ Subject: [v3] Move around some unordered_* tests X-IsSubscribed: yes Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Delivered-To: mailing list gcc-patches@gcc.gnu.org Hi, committed to mainline. Paolo. /////////////////// 2010-08-13 Paolo Carlini * testsuite/23_containers/unordered_map/dr1189.cc: Move to... * testsuite/23_containers/unordered_map/hash_policy/dr1189.cc: ... here. * testsuite/23_containers/unordered_set/dr1189.cc: Move to... * testsuite/23_containers/unordered_set/hash_policy/dr1189.cc: ... here. * testsuite/23_containers/unordered_multimap/dr1189.cc: Move to... * testsuite/23_containers/unordered_multimap/hash_policy/dr1189.cc: ... here. * testsuite/23_containers/unordered_multiset/dr1189.cc: Move to... * testsuite/23_containers/unordered_multiset/hash_policy/dr1189.cc: ... here. * testsuite/23_containers/unordered_set/hash_policy/26132.cc: New. Index: testsuite/23_containers/unordered_map/dr1189.cc =================================================================== --- testsuite/23_containers/unordered_map/dr1189.cc (revision 163221) +++ testsuite/23_containers/unordered_map/dr1189.cc (working copy) @@ -1,48 +0,0 @@ -// { dg-options "-std=gnu++0x" } -// 2010-03-10 Paolo Carlini -// -// Copyright (C) 2010 Free Software Foundation, Inc. -// -// This file is part of the GNU ISO C++ Library. This library is free -// software; you can redistribute it and/or modify it under the -// terms of the GNU General Public License as published by the -// Free Software Foundation; either version 3, or (at your option) -// any later version. -// -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License along -// with this library; see the file COPYING3. If not see -// . - -#include -#include - -// DR 1189. Awkward interface for changing the number of buckets -// in an unordered associative container -void test01() -{ - bool test __attribute__((unused)) = true; - - std::unordered_map m1; - m1.reserve(10); - VERIFY( m1.bucket_count() >= 10 ); - - m1.reserve(100); - VERIFY( m1.bucket_count() >= 100 ); - - std::unordered_map m2(100); - VERIFY( m2.bucket_count() >= 100 ); - - m2.reserve(1000); - VERIFY( m2.bucket_count() >= 1000 ); -} - -int main() -{ - test01(); - return 0; -} Index: testsuite/23_containers/unordered_multimap/dr1189.cc =================================================================== --- testsuite/23_containers/unordered_multimap/dr1189.cc (revision 163221) +++ testsuite/23_containers/unordered_multimap/dr1189.cc (working copy) @@ -1,48 +0,0 @@ -// { dg-options "-std=gnu++0x" } -// 2010-03-10 Paolo Carlini -// -// Copyright (C) 2010 Free Software Foundation, Inc. -// -// This file is part of the GNU ISO C++ Library. This library is free -// software; you can redistribute it and/or modify it under the -// terms of the GNU General Public License as published by the -// Free Software Foundation; either version 3, or (at your option) -// any later version. -// -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License along -// with this library; see the file COPYING3. If not see -// . - -#include -#include - -// DR 1189. Awkward interface for changing the number of buckets -// in an unordered associative container -void test01() -{ - bool test __attribute__((unused)) = true; - - std::unordered_multimap mm1; - mm1.reserve(10); - VERIFY( mm1.bucket_count() >= 10 ); - - mm1.reserve(100); - VERIFY( mm1.bucket_count() >= 100 ); - - std::unordered_map mm2(100); - VERIFY( mm2.bucket_count() >= 100 ); - - mm2.reserve(1000); - VERIFY( mm2.bucket_count() >= 1000 ); -} - -int main() -{ - test01(); - return 0; -} Index: testsuite/23_containers/unordered_set/hash_policy/26132.cc =================================================================== --- testsuite/23_containers/unordered_set/hash_policy/26132.cc (revision 0) +++ testsuite/23_containers/unordered_set/hash_policy/26132.cc (revision 0) @@ -0,0 +1,57 @@ +// { dg-options "-std=gnu++0x" } + +// 2010-08-13 Paolo Carlini +// +// Copyright (C) 2010 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING3. If not see +// . + +#include +#include + +// libstdc++/26132 +void test01() +{ + bool test __attribute__((unused)) = true; + + for (float lf = 1.0; lf < 101.0; lf *= 10.0) + for (int size = 1; size <= 6561; size *= 3) + { + std::unordered_set us1; + typedef std::unordered_set::size_type size_type; + + us1.max_load_factor(10.0); + + for (int i = 0; i < size; ++i) + us1.insert(i); + + us1.max_load_factor(lf); + + for (int i = 1; i <= 6561; i *= 81) + { + const size_type n = size * 81 / i; + us1.rehash(n); + VERIFY( us1.bucket_count() > us1.size() / us1.max_load_factor() ); + VERIFY( us1.bucket_count() >= n ); + } + } +} + +int main() +{ + test01(); + return 0; +} Index: testsuite/23_containers/unordered_set/dr1189.cc =================================================================== --- testsuite/23_containers/unordered_set/dr1189.cc (revision 163221) +++ testsuite/23_containers/unordered_set/dr1189.cc (working copy) @@ -1,48 +0,0 @@ -// { dg-options "-std=gnu++0x" } -// 2010-03-10 Paolo Carlini -// -// Copyright (C) 2010 Free Software Foundation, Inc. -// -// This file is part of the GNU ISO C++ Library. This library is free -// software; you can redistribute it and/or modify it under the -// terms of the GNU General Public License as published by the -// Free Software Foundation; either version 3, or (at your option) -// any later version. -// -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License along -// with this library; see the file COPYING3. If not see -// . - -#include -#include - -// DR 1189. Awkward interface for changing the number of buckets -// in an unordered associative container -void test01() -{ - bool test __attribute__((unused)) = true; - - std::unordered_set s1; - s1.reserve(10); - VERIFY( s1.bucket_count() >= 10 ); - - s1.reserve(100); - VERIFY( s1.bucket_count() >= 100 ); - - std::unordered_set s2(100); - VERIFY( s2.bucket_count() >= 100 ); - - s2.reserve(1000); - VERIFY( s2.bucket_count() >= 1000 ); -} - -int main() -{ - test01(); - return 0; -} Index: testsuite/23_containers/unordered_multiset/dr1189.cc =================================================================== --- testsuite/23_containers/unordered_multiset/dr1189.cc (revision 163221) +++ testsuite/23_containers/unordered_multiset/dr1189.cc (working copy) @@ -1,48 +0,0 @@ -// { dg-options "-std=gnu++0x" } -// 2010-03-10 Paolo Carlini -// -// Copyright (C) 2010 Free Software Foundation, Inc. -// -// This file is part of the GNU ISO C++ Library. This library is free -// software; you can redistribute it and/or modify it under the -// terms of the GNU General Public License as published by the -// Free Software Foundation; either version 3, or (at your option) -// any later version. -// -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License along -// with this library; see the file COPYING3. If not see -// . - -#include -#include - -// DR 1189. Awkward interface for changing the number of buckets -// in an unordered associative container -void test01() -{ - bool test __attribute__((unused)) = true; - - std::unordered_multiset ms1; - ms1.reserve(10); - VERIFY( ms1.bucket_count() >= 10 ); - - ms1.reserve(100); - VERIFY( ms1.bucket_count() >= 100 ); - - std::unordered_multiset ms2(100); - VERIFY( ms2.bucket_count() >= 100 ); - - ms2.reserve(1000); - VERIFY( ms2.bucket_count() >= 1000 ); -} - -int main() -{ - test01(); - return 0; -}