[llvm] r259152 - SmallPtrSetTest: More checks for the swap() testing
Matthias Braun via llvm-commits
llvm-commits at lists.llvm.org
Thu Jan 28 19:34:37 PST 2016
Author: matze
Date: Thu Jan 28 21:34:36 2016
New Revision: 259152
URL: http://llvm.org/viewvc/llvm-project?rev=259152&view=rev
Log:
SmallPtrSetTest: More checks for the swap() testing
Modified:
llvm/trunk/unittests/ADT/SmallPtrSetTest.cpp
Modified: llvm/trunk/unittests/ADT/SmallPtrSetTest.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/unittests/ADT/SmallPtrSetTest.cpp?rev=259152&r1=259151&r2=259152&view=diff
==============================================================================
--- llvm/trunk/unittests/ADT/SmallPtrSetTest.cpp (original)
+++ llvm/trunk/unittests/ADT/SmallPtrSetTest.cpp Thu Jan 28 21:34:36 2016
@@ -167,13 +167,29 @@ TEST(SmallPtrSetTest, SwapTest) {
a.insert(&buf[1]);
b.insert(&buf[2]);
+ EXPECT_EQ(2U, a.size());
+ EXPECT_EQ(1U, b.size());
+ EXPECT_TRUE(a.count(&buf[0]));
+ EXPECT_TRUE(a.count(&buf[1]));
+ EXPECT_FALSE(a.count(&buf[2]));
+ EXPECT_FALSE(a.count(&buf[3]));
+ EXPECT_FALSE(b.count(&buf[0]));
+ EXPECT_FALSE(b.count(&buf[1]));
+ EXPECT_TRUE(b.count(&buf[2]));
+ EXPECT_FALSE(b.count(&buf[3]));
+
std::swap(a, b);
EXPECT_EQ(1U, a.size());
EXPECT_EQ(2U, b.size());
+ EXPECT_FALSE(a.count(&buf[0]));
+ EXPECT_FALSE(a.count(&buf[1]));
EXPECT_TRUE(a.count(&buf[2]));
+ EXPECT_FALSE(a.count(&buf[3]));
EXPECT_TRUE(b.count(&buf[0]));
EXPECT_TRUE(b.count(&buf[1]));
+ EXPECT_FALSE(b.count(&buf[2]));
+ EXPECT_FALSE(b.count(&buf[3]));
b.insert(&buf[3]);
std::swap(a, b);
@@ -182,16 +198,24 @@ TEST(SmallPtrSetTest, SwapTest) {
EXPECT_EQ(1U, b.size());
EXPECT_TRUE(a.count(&buf[0]));
EXPECT_TRUE(a.count(&buf[1]));
+ EXPECT_FALSE(a.count(&buf[2]));
EXPECT_TRUE(a.count(&buf[3]));
+ EXPECT_FALSE(b.count(&buf[0]));
+ EXPECT_FALSE(b.count(&buf[1]));
EXPECT_TRUE(b.count(&buf[2]));
+ EXPECT_FALSE(b.count(&buf[3]));
std::swap(a, b);
EXPECT_EQ(1U, a.size());
EXPECT_EQ(3U, b.size());
+ EXPECT_FALSE(a.count(&buf[0]));
+ EXPECT_FALSE(a.count(&buf[1]));
EXPECT_TRUE(a.count(&buf[2]));
+ EXPECT_FALSE(a.count(&buf[3]));
EXPECT_TRUE(b.count(&buf[0]));
EXPECT_TRUE(b.count(&buf[1]));
+ EXPECT_FALSE(b.count(&buf[2]));
EXPECT_TRUE(b.count(&buf[3]));
a.insert(&buf[4]);
More information about the llvm-commits
mailing list