mirror of
https://github.com/RPCS3/llvm.git
synced 2024-11-29 14:40:39 +00:00
Fixed one small stupid, but critical bug.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@156810 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
c2c52a6470
commit
661f760320
@ -162,10 +162,10 @@ namespace llvm {
|
||||
}
|
||||
|
||||
iterator end() {
|
||||
return iterator(Array + MaxArraySize);
|
||||
return iterator(Array + NumElements);
|
||||
}
|
||||
const_iterator end() const {
|
||||
return const_iterator(Array + MaxArraySize);
|
||||
return const_iterator(Array + NumElements);
|
||||
}
|
||||
|
||||
// Modifiers
|
||||
|
@ -144,4 +144,19 @@ TEST(SmallMapTest, GeneralTest) {
|
||||
(i->first == &buf[1] && i->second == 1) ||
|
||||
(i->first == &buf[2] && i->second == 2));
|
||||
}
|
||||
|
||||
// Check that iteration only visits elements that actually exist.
|
||||
SmallMap<int, int, 8> d;
|
||||
d[0] = 2;
|
||||
d[1] = 3;
|
||||
unsigned counts[2] = { 0, 0 };
|
||||
for (SmallMap<int, int, 8>::iterator I = d.begin(), E = d.end(); I != E;
|
||||
++I) {
|
||||
EXPECT_TRUE(I->first == 0 || I->first == 1);
|
||||
EXPECT_TRUE(I->second == 2 || I->second == 3);
|
||||
EXPECT_EQ(I->second, I->first + 2);
|
||||
++counts[I->first];
|
||||
}
|
||||
EXPECT_EQ(counts[0], 1);
|
||||
EXPECT_EQ(counts[1], 1);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user