diff options
author | Andrew Stitcher <astitcher@apache.org> | 2007-02-14 16:22:38 +0000 |
---|---|---|
committer | Andrew Stitcher <astitcher@apache.org> | 2007-02-14 16:22:38 +0000 |
commit | b4b64a31a12cfd7578baab35d5036169825b53c1 (patch) | |
tree | a9dac4bad43e395a762e0780d696abd7be5871aa | |
parent | 8189a1f1f3d27d9ad7e0de50ed9e924e63d74aec (diff) | |
download | qpid-python-b4b64a31a12cfd7578baab35d5036169825b53c1.tar.gz |
r1127@fuschia: andrew | 2007-02-14 16:15:34 +0000
Fixed tests, and fixed an exposed bug
git-svn-id: https://svn.apache.org/repos/asf/incubator/qpid/branches/qpid.0-9@507602 13f79535-47bb-0310-9956-ffa450edef68
-rw-r--r-- | cpp/lib/broker/AccumulatedAck.cpp | 7 | ||||
-rw-r--r-- | cpp/tests/AccumulatedAckTest.cpp | 16 |
2 files changed, 13 insertions, 10 deletions
diff --git a/cpp/lib/broker/AccumulatedAck.cpp b/cpp/lib/broker/AccumulatedAck.cpp index 2f2a7464c1..5f66adb2b9 100644 --- a/cpp/lib/broker/AccumulatedAck.cpp +++ b/cpp/lib/broker/AccumulatedAck.cpp @@ -18,14 +18,17 @@ * under the License. * */ -#include <AccumulatedAck.h> +#include "AccumulatedAck.h" + +#include <assert.h> using std::less_equal; using std::bind2nd; using namespace qpid::broker; void AccumulatedAck::update(u_int64_t firstTag, u_int64_t lastTag){ - if (firstTag-1 == range) { + assert(firstTag<=lastTag); + if (firstTag <= range+1) { range = lastTag; } else { for (u_int64_t tag = firstTag; tag<=lastTag; tag++) diff --git a/cpp/tests/AccumulatedAckTest.cpp b/cpp/tests/AccumulatedAckTest.cpp index bfd9358422..da984d3e69 100644 --- a/cpp/tests/AccumulatedAckTest.cpp +++ b/cpp/tests/AccumulatedAckTest.cpp @@ -58,14 +58,14 @@ class AccumulatedAckTest : public CppUnit::TestCase { AccumulatedAck ack; ack.clear(); - ack.update(1, false); - ack.update(3, false); - ack.update(10, false); - ack.update(8, false); - ack.update(6, false); - ack.update(3, true); - ack.update(2, true); - ack.update(5, true); + ack.update(1, 1); + ack.update(3, 3); + ack.update(10, 10); + ack.update(8, 8); + ack.update(6, 6); + ack.update(3, 3); + ack.update(2, 2); + ack.update(0, 5); ack.consolidate(); CPPUNIT_ASSERT_EQUAL((u_int64_t) 5, ack.range); CPPUNIT_ASSERT_EQUAL((size_t) 3, ack.individual.size()); |