-// { dg-options "-std=gnu++0x" }
+// { dg-do run { target c++11 } }
-// Copyright (C) 2010 Free Software Foundation, Inc.
+// Copyright (C) 2010-2020 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
#include <unordered_set>
#include <testsuite_hooks.h>
-void test01()
+namespace
{
- bool test __attribute__((unused)) = true;
+ std::size_t
+ get_nb_bucket_elems(const std::unordered_multiset<std::string>& us)
+ {
+ std::size_t nb = 0;
+ for (std::size_t b = 0; b != us.bucket_count(); ++b)
+ nb += us.bucket_size(b);
+ return nb;
+ }
+}
+
+void test01()
+{
typedef std::unordered_multiset<std::string> Set;
Set s;
VERIFY(s.empty());
Set::iterator i = s.insert("abcde");
- VERIFY(s.size() == 1);
+ VERIFY( s.size() == 1 );
+ VERIFY( get_nb_bucket_elems(s) == 1 );
VERIFY(std::distance(s.begin(), s.end()) == 1);
VERIFY(i == s.begin());
VERIFY(*i == "abcde");
void test02()
{
- bool test __attribute__((unused)) = true;
-
typedef std::unordered_multiset<std::string> Set;
Set s;
VERIFY(s.empty());
s.insert("abcde");
Set::iterator i = s.insert("abcde");
VERIFY(s.size() == 2);
+ VERIFY( get_nb_bucket_elems(s) == 2 );
VERIFY(std::distance(s.begin(), s.end()) == 2);
VERIFY(*i == "abcde");