STL_MSFT created this revision.
STL_MSFT added reviewers: EricWF, mclow.lists.
STL_MSFT added a subscriber: cfe-commits.

Make bucket_count() greater-equal assertions portable.

The Standard provides a guarantee here, but these assertions were going beyond 
that guarantee. These containers have 8 elements, so the bucket count is 
guaranteed to be at least 8, but may not be as large as 11 (and isn't in MSVC's 
implementation).

http://reviews.llvm.org/D22165

Files:
  test/std/containers/unord/unord.map/bucket_count.pass.cpp
  test/std/containers/unord/unord.multimap/bucket_count.pass.cpp
  test/std/containers/unord/unord.multiset/bucket_count.pass.cpp
  test/std/containers/unord/unord.set/bucket_count.pass.cpp

Index: test/std/containers/unord/unord.set/bucket_count.pass.cpp
===================================================================
--- test/std/containers/unord/unord.set/bucket_count.pass.cpp
+++ test/std/containers/unord/unord.set/bucket_count.pass.cpp
@@ -46,7 +46,7 @@
             P(80)
         };
         const C c(std::begin(a), std::end(a));
-        assert(c.bucket_count() >= 11);
+        assert(c.bucket_count() >= 8);
     }
 #if TEST_STD_VER >= 11
     {
@@ -72,7 +72,7 @@
             P(80)
         };
         const C c(std::begin(a), std::end(a));
-        assert(c.bucket_count() >= 11);
+        assert(c.bucket_count() >= 8);
     }
 #endif
 }
Index: test/std/containers/unord/unord.multiset/bucket_count.pass.cpp
===================================================================
--- test/std/containers/unord/unord.multiset/bucket_count.pass.cpp
+++ test/std/containers/unord/unord.multiset/bucket_count.pass.cpp
@@ -46,7 +46,7 @@
             P(80)
         };
         const C c(std::begin(a), std::end(a));
-        assert(c.bucket_count() >= 11);
+        assert(c.bucket_count() >= 8);
     }
 #if TEST_STD_VER >= 11
     {
@@ -74,7 +74,7 @@
             P(80)
         };
         const C c(std::begin(a), std::end(a));
-        assert(c.bucket_count() >= 11);
+        assert(c.bucket_count() >= 8);
     }
 #endif
 }
Index: test/std/containers/unord/unord.multimap/bucket_count.pass.cpp
===================================================================
--- test/std/containers/unord/unord.multimap/bucket_count.pass.cpp
+++ test/std/containers/unord/unord.multimap/bucket_count.pass.cpp
@@ -46,6 +46,6 @@
             P(80, "eighty"),
         };
         const C c(std::begin(a), std::end(a));
-        assert(c.bucket_count() >= 11);
+        assert(c.bucket_count() >= 8);
     }
 }
Index: test/std/containers/unord/unord.map/bucket_count.pass.cpp
===================================================================
--- test/std/containers/unord/unord.map/bucket_count.pass.cpp
+++ test/std/containers/unord/unord.map/bucket_count.pass.cpp
@@ -44,7 +44,7 @@
             P(80, "eighty"),
         };
         const C c(std::begin(a), std::end(a));
-        assert(c.bucket_count() >= 11);
+        assert(c.bucket_count() >= 8);
     }
 #if TEST_STD_VER >= 11
     {
@@ -69,7 +69,7 @@
             P(80, "eighty"),
         };
         const C c(std::begin(a), std::end(a));
-        assert(c.bucket_count() >= 11);
+        assert(c.bucket_count() >= 8);
     }
 #endif
 }


Index: test/std/containers/unord/unord.set/bucket_count.pass.cpp
===================================================================
--- test/std/containers/unord/unord.set/bucket_count.pass.cpp
+++ test/std/containers/unord/unord.set/bucket_count.pass.cpp
@@ -46,7 +46,7 @@
             P(80)
         };
         const C c(std::begin(a), std::end(a));
-        assert(c.bucket_count() >= 11);
+        assert(c.bucket_count() >= 8);
     }
 #if TEST_STD_VER >= 11
     {
@@ -72,7 +72,7 @@
             P(80)
         };
         const C c(std::begin(a), std::end(a));
-        assert(c.bucket_count() >= 11);
+        assert(c.bucket_count() >= 8);
     }
 #endif
 }
Index: test/std/containers/unord/unord.multiset/bucket_count.pass.cpp
===================================================================
--- test/std/containers/unord/unord.multiset/bucket_count.pass.cpp
+++ test/std/containers/unord/unord.multiset/bucket_count.pass.cpp
@@ -46,7 +46,7 @@
             P(80)
         };
         const C c(std::begin(a), std::end(a));
-        assert(c.bucket_count() >= 11);
+        assert(c.bucket_count() >= 8);
     }
 #if TEST_STD_VER >= 11
     {
@@ -74,7 +74,7 @@
             P(80)
         };
         const C c(std::begin(a), std::end(a));
-        assert(c.bucket_count() >= 11);
+        assert(c.bucket_count() >= 8);
     }
 #endif
 }
Index: test/std/containers/unord/unord.multimap/bucket_count.pass.cpp
===================================================================
--- test/std/containers/unord/unord.multimap/bucket_count.pass.cpp
+++ test/std/containers/unord/unord.multimap/bucket_count.pass.cpp
@@ -46,6 +46,6 @@
             P(80, "eighty"),
         };
         const C c(std::begin(a), std::end(a));
-        assert(c.bucket_count() >= 11);
+        assert(c.bucket_count() >= 8);
     }
 }
Index: test/std/containers/unord/unord.map/bucket_count.pass.cpp
===================================================================
--- test/std/containers/unord/unord.map/bucket_count.pass.cpp
+++ test/std/containers/unord/unord.map/bucket_count.pass.cpp
@@ -44,7 +44,7 @@
             P(80, "eighty"),
         };
         const C c(std::begin(a), std::end(a));
-        assert(c.bucket_count() >= 11);
+        assert(c.bucket_count() >= 8);
     }
 #if TEST_STD_VER >= 11
     {
@@ -69,7 +69,7 @@
             P(80, "eighty"),
         };
         const C c(std::begin(a), std::end(a));
-        assert(c.bucket_count() >= 11);
+        assert(c.bucket_count() >= 8);
     }
 #endif
 }
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to