More tests for LWG#2156

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@253257 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Marshall Clow
2015-11-16 22:18:36 +00:00
parent 7b7c9ec355
commit 15a326c525
4 changed files with 64 additions and 0 deletions

View File

@@ -33,6 +33,21 @@ void test(const C& c)
assert(c.find(4)->second == "four");
}
void reserve_invariant(size_t n) // LWG #2156
{
for (size_t i = 0; i < n; ++i)
{
std::unordered_multimap<size_t, size_t> c;
c.reserve(n);
size_t buckets = c.bucket_count();
for (size_t j = 0; j < i; ++j)
{
c[i] = i;
assert(buckets == c.bucket_count());
}
}
}
int main()
{
{
@@ -90,4 +105,5 @@ int main()
test(c);
}
#endif
reserve_invariant(20);
}