Ensure that the StringMap does not grow during the test for pre-allocation/reserve

From: Mehdi Amini <mehdi.amini@apple.com>

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@264416 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Mehdi Amini 2016-03-25 16:09:34 +00:00
parent 7a9b28aa44
commit df98afd142

View File

@ -390,6 +390,7 @@ TEST(StringMapCustomTest, InitialSizeTest) {
// arbitrary prime, picked without any good reason.
for (auto Size : {1, 32, 67}) {
StringMap<CountCtorCopyAndMove> Map(Size);
auto NumBuckets = Map.getNumBuckets();
CountCtorCopyAndMove::Move = 0;
CountCtorCopyAndMove::Copy = 0;
for (int i = 0; i < Size; ++i)
@ -398,6 +399,8 @@ TEST(StringMapCustomTest, InitialSizeTest) {
// EXPECT_EQ((unsigned)Size * 3, CountCtorCopyAndMove::Move);
// No copy is expected.
EXPECT_EQ(0u, CountCtorCopyAndMove::Copy);
// Check that the map didn't grow
EXPECT_EQ(Map.getNumBuckets(), NumBuckets);
}
}