llvm.org GIT mirror llvm / 3f5e915
Update BitVectorTest.cpp to stay in sync with SmallBitVectorTest.cpp, and fix a bug in BitVector's reference proxy class which this exposed. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@102768 91177308-0d34-0410-b5e6-96231b3b80d8 Dan Gohman 9 years ago
3 changed file(s) with 21 addition(s) and 3 deletion(s). Raw diff Collapse all Expand all
4747 }
4848
4949 ~reference() {}
50
51 reference &operator=(reference t) {
52 *this = bool(t);
53 return *this;
54 }
5055
5156 reference& operator=(bool t) {
5257 if (t)
66 //
77 //===----------------------------------------------------------------------===//
88
9 #ifndef XFAIL
9 // Some of these tests fail on PowerPC for unknown reasons.
10 #ifndef __ppc__
11
1012 #include "llvm/ADT/BitVector.h"
1113 #include "gtest/gtest.h"
1214
5557 Vec.resize(26, true);
5658 Vec.resize(29, false);
5759 Vec.resize(33, true);
58 Vec.resize(61, false);
60 Vec.resize(57, false);
5961 unsigned Count = 0;
6062 for (unsigned i = Vec.find_first(); i != -1u; i = Vec.find_next(i)) {
6163 ++Count;
6668 EXPECT_EQ(Count, 23u);
6769 EXPECT_FALSE(Vec[0]);
6870 EXPECT_TRUE(Vec[32]);
69 EXPECT_FALSE(Vec[60]);
71 EXPECT_FALSE(Vec[56]);
72 Vec.resize(61, false);
7073
7174 BitVector Copy = Vec;
7275 BitVector Alt(3, false);
176179 EXPECT_EQ(100U, A.size());
177180 }
178181
182 TEST(BitVectorTest, ProxyIndex) {
183 BitVector Vec(3);
184 EXPECT_TRUE(Vec.none());
185 Vec[0] = Vec[1] = Vec[2] = true;
186 EXPECT_EQ(Vec.size(), Vec.count());
187 Vec[2] = Vec[1] = Vec[0] = false;
188 EXPECT_TRUE(Vec.none());
189 }
190
179191 }
180192
181193 #endif
184184 Vec[2] = Vec[1] = Vec[0] = false;
185185 EXPECT_TRUE(Vec.none());
186186 }
187
187188 }