Fix RingBuf tests to not miss bugs. Fix RingBuf iterator bugs.

This was SVN commit r7511.
This commit is contained in:
Ykkrosh 2010-05-07 20:24:42 +00:00
parent e144ef03a2
commit c611bf6613
2 changed files with 8 additions and 8 deletions

View File

@ -446,19 +446,19 @@ public:
iterator begin()
{
return iterator(data, (size_ < n)? 0 : head);
return iterator(data, head);
}
const_iterator begin() const
{
return const_iterator(data, (size_ < n)? 0 : head);
return const_iterator(data, head);
}
iterator end()
{
return iterator(data, (size_ < n)? size_ : head+n);
return iterator(data, head+size_);
}
const_iterator end() const
{
return const_iterator(data, (size_ < n)? size_ : head+n);
return const_iterator(data, head+size_);
}
};

View File

@ -89,10 +89,10 @@ public:
buf.pop_front();
deq.pop_front();
}
}
TS_ASSERT_EQUALS(buf.size(), deq.size());
RingBuf<int, N>::iterator begin = buf.begin(), end = buf.end();
TS_ASSERT(equal(begin, end, deq.begin()));
TS_ASSERT_EQUALS(buf.size(), deq.size());
RingBuf<int, N>::iterator begin = buf.begin(), end = buf.end();
TS_ASSERT(equal(begin, end, deq.begin()));
}
}
};