]> git.ipfire.org Git - thirdparty/gcc.git/blobdiff - libstdc++-v3/testsuite/23_containers/unordered_multiset/insert/multiset_single.cc
Update copyright years.
[thirdparty/gcc.git] / libstdc++-v3 / testsuite / 23_containers / unordered_multiset / insert / multiset_single.cc
index f275e9a9bdde29041207e585181c60946d020eda..ca3ca369aecf09238e7fe966b0b4a33f308a6f81 100644 (file)
@@ -1,6 +1,6 @@
-// { 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");
@@ -41,8 +53,6 @@ void test01()
 
 void test02()
 {
-  bool test __attribute__((unused)) = true;
-
   typedef std::unordered_multiset<std::string> Set;
   Set s;
   VERIFY(s.empty());
@@ -50,6 +60,7 @@ void test02()
   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");