[llvm] r264412 - Disable counting the number of move in the unittest, it seems to rely on move-construction elision
Mehdi Amini via llvm-commits
llvm-commits at lists.llvm.org
Fri Mar 25 08:46:14 PDT 2016
Author: mehdi_amini
Date: Fri Mar 25 10:46:14 2016
New Revision: 264412
URL: http://llvm.org/viewvc/llvm-project?rev=264412&view=rev
Log:
Disable counting the number of move in the unittest, it seems to rely on move-construction elision
From: Mehdi Amini <mehdi.amini at apple.com>
Modified:
llvm/trunk/unittests/ADT/DenseMapTest.cpp
llvm/trunk/unittests/ADT/StringMapTest.cpp
Modified: llvm/trunk/unittests/ADT/DenseMapTest.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/unittests/ADT/DenseMapTest.cpp?rev=264412&r1=264411&r2=264412&view=diff
==============================================================================
--- llvm/trunk/unittests/ADT/DenseMapTest.cpp (original)
+++ llvm/trunk/unittests/ADT/DenseMapTest.cpp Fri Mar 25 10:46:14 2016
@@ -392,7 +392,8 @@ TEST(DenseMapCustomTest, DefaultMinReser
// Check that we grew
EXPECT_NE(MemorySize, Map.getMemorySize());
// Check that move was called the expected number of times
- EXPECT_EQ(ExpectedMaxInitialEntries + 2, CountCopyAndMove::Move);
+ // This relies on move-construction elision, and cannot be reliably tested.
+ // EXPECT_EQ(ExpectedMaxInitialEntries + 2, CountCopyAndMove::Move);
// Check that no copy occured
EXPECT_EQ(0, CountCopyAndMove::Copy);
}
@@ -415,7 +416,8 @@ TEST(DenseMapCustomTest, InitialSizeTest
// Check that we didn't grow
EXPECT_EQ(MemorySize, Map.getMemorySize());
// Check that move was called the expected number of times
- EXPECT_EQ(Size * 2, CountCopyAndMove::Move);
+ // This relies on move-construction elision, and cannot be reliably tested.
+ // EXPECT_EQ(Size * 2, CountCopyAndMove::Move);
// Check that no copy occured
EXPECT_EQ(0, CountCopyAndMove::Copy);
}
@@ -457,7 +459,8 @@ TEST(DenseMapCustomTest, ReserveTest) {
// Check that we didn't grow
EXPECT_EQ(MemorySize, Map.getMemorySize());
// Check that move was called the expected number of times
- EXPECT_EQ(Size * 2, CountCopyAndMove::Move);
+ // This relies on move-construction elision, and cannot be reliably tested.
+ // EXPECT_EQ(Size * 2, CountCopyAndMove::Move);
// Check that no copy occured
EXPECT_EQ(0, CountCopyAndMove::Copy);
}
Modified: llvm/trunk/unittests/ADT/StringMapTest.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/unittests/ADT/StringMapTest.cpp?rev=264412&r1=264411&r2=264412&view=diff
==============================================================================
--- llvm/trunk/unittests/ADT/StringMapTest.cpp (original)
+++ llvm/trunk/unittests/ADT/StringMapTest.cpp Fri Mar 25 10:46:14 2016
@@ -394,7 +394,9 @@ TEST(StringMapCustomTest, InitialSizeTes
CountCtorCopyAndMove::Copy = 0;
for (int i = 0; i < Size; ++i)
Map.insert(std::make_pair(Twine(i).str(), CountCtorCopyAndMove()));
- EXPECT_EQ((unsigned)Size * 3, CountCtorCopyAndMove::Move);
+ // This relies on move-construction elision, and cannot be reliably tested.
+ // EXPECT_EQ((unsigned)Size * 3, CountCtorCopyAndMove::Move);
+ // No copy is expected.
EXPECT_EQ(0u, CountCtorCopyAndMove::Copy);
}
}
More information about the llvm-commits
mailing list