mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-07-25 13:24:46 +00:00
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
This commit is contained in:
@@ -49,6 +49,11 @@ public:
|
|||||||
|
|
||||||
~reference() {}
|
~reference() {}
|
||||||
|
|
||||||
|
reference &operator=(reference t) {
|
||||||
|
*this = bool(t);
|
||||||
|
return *this;
|
||||||
|
}
|
||||||
|
|
||||||
reference& operator=(bool t) {
|
reference& operator=(bool t) {
|
||||||
if (t)
|
if (t)
|
||||||
*WordRef |= 1L << BitPos;
|
*WordRef |= 1L << BitPos;
|
||||||
|
@@ -7,7 +7,9 @@
|
|||||||
//
|
//
|
||||||
//===----------------------------------------------------------------------===//
|
//===----------------------------------------------------------------------===//
|
||||||
|
|
||||||
#ifndef XFAIL
|
// Some of these tests fail on PowerPC for unknown reasons.
|
||||||
|
#ifndef __ppc__
|
||||||
|
|
||||||
#include "llvm/ADT/BitVector.h"
|
#include "llvm/ADT/BitVector.h"
|
||||||
#include "gtest/gtest.h"
|
#include "gtest/gtest.h"
|
||||||
|
|
||||||
@@ -56,7 +58,7 @@ TEST(BitVectorTest, TrivialOperation) {
|
|||||||
Vec.resize(26, true);
|
Vec.resize(26, true);
|
||||||
Vec.resize(29, false);
|
Vec.resize(29, false);
|
||||||
Vec.resize(33, true);
|
Vec.resize(33, true);
|
||||||
Vec.resize(61, false);
|
Vec.resize(57, false);
|
||||||
unsigned Count = 0;
|
unsigned Count = 0;
|
||||||
for (unsigned i = Vec.find_first(); i != -1u; i = Vec.find_next(i)) {
|
for (unsigned i = Vec.find_first(); i != -1u; i = Vec.find_next(i)) {
|
||||||
++Count;
|
++Count;
|
||||||
@@ -67,7 +69,8 @@ TEST(BitVectorTest, TrivialOperation) {
|
|||||||
EXPECT_EQ(Count, 23u);
|
EXPECT_EQ(Count, 23u);
|
||||||
EXPECT_FALSE(Vec[0]);
|
EXPECT_FALSE(Vec[0]);
|
||||||
EXPECT_TRUE(Vec[32]);
|
EXPECT_TRUE(Vec[32]);
|
||||||
EXPECT_FALSE(Vec[60]);
|
EXPECT_FALSE(Vec[56]);
|
||||||
|
Vec.resize(61, false);
|
||||||
|
|
||||||
BitVector Copy = Vec;
|
BitVector Copy = Vec;
|
||||||
BitVector Alt(3, false);
|
BitVector Alt(3, false);
|
||||||
@@ -177,6 +180,15 @@ TEST(BitVectorTest, CompoundAssignment) {
|
|||||||
EXPECT_EQ(100U, A.size());
|
EXPECT_EQ(100U, A.size());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
TEST(BitVectorTest, ProxyIndex) {
|
||||||
|
BitVector Vec(3);
|
||||||
|
EXPECT_TRUE(Vec.none());
|
||||||
|
Vec[0] = Vec[1] = Vec[2] = true;
|
||||||
|
EXPECT_EQ(Vec.size(), Vec.count());
|
||||||
|
Vec[2] = Vec[1] = Vec[0] = false;
|
||||||
|
EXPECT_TRUE(Vec.none());
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@@ -185,4 +185,5 @@ TEST(SmallBitVectorTest, ProxyIndex) {
|
|||||||
Vec[2] = Vec[1] = Vec[0] = false;
|
Vec[2] = Vec[1] = Vec[0] = false;
|
||||||
EXPECT_TRUE(Vec.none());
|
EXPECT_TRUE(Vec.none());
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user