diff options
author | Max Kellermann <max@duempel.org> | 2014-03-15 23:11:13 +0100 |
---|---|---|
committer | Max Kellermann <max@duempel.org> | 2014-03-16 00:27:18 +0100 |
commit | 89ac111853eb4bae2fc358087c4c4657939321c0 (patch) | |
tree | 735bd12a1896ff049d58d1138eaa1ec99457561d /test/TestCircularBuffer.hxx | |
parent | 3d4f588a7ff6b3c0953d706c526f4f391db9dfd2 (diff) | |
download | mpd-89ac111853eb4bae2fc358087c4c4657939321c0.tar.gz mpd-89ac111853eb4bae2fc358087c4c4657939321c0.tar.xz mpd-89ac111853eb4bae2fc358087c4c4657939321c0.zip |
util/CircularBuffer: add method GetSize()
Diffstat (limited to '')
-rw-r--r-- | test/TestCircularBuffer.hxx | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/test/TestCircularBuffer.hxx b/test/TestCircularBuffer.hxx index f8fb95418..88b0a9ea8 100644 --- a/test/TestCircularBuffer.hxx +++ b/test/TestCircularBuffer.hxx @@ -32,6 +32,7 @@ public: /* [.......X] */ CPPUNIT_ASSERT_EQUAL(true, buffer.IsEmpty()); CPPUNIT_ASSERT_EQUAL(false, buffer.IsFull()); + CPPUNIT_ASSERT_EQUAL(size_t(0), buffer.GetSize()); CPPUNIT_ASSERT_EQUAL(true, buffer.Read().IsEmpty()); CPPUNIT_ASSERT_EQUAL(false, buffer.Write().IsEmpty()); CPPUNIT_ASSERT_EQUAL(&data[0], buffer.Write().data); @@ -43,6 +44,7 @@ public: CPPUNIT_ASSERT_EQUAL(false, buffer.IsEmpty()); CPPUNIT_ASSERT_EQUAL(false, buffer.IsFull()); CPPUNIT_ASSERT_EQUAL(false, buffer.Read().IsEmpty()); + CPPUNIT_ASSERT_EQUAL(size_t(1), buffer.GetSize()); CPPUNIT_ASSERT_EQUAL(size_t(1), buffer.Read().size); CPPUNIT_ASSERT_EQUAL(&data[0], buffer.Read().data); CPPUNIT_ASSERT_EQUAL(false, buffer.Write().IsEmpty()); @@ -55,6 +57,7 @@ public: CPPUNIT_ASSERT_EQUAL(false, buffer.IsEmpty()); CPPUNIT_ASSERT_EQUAL(true, buffer.IsFull()); CPPUNIT_ASSERT_EQUAL(false, buffer.Read().IsEmpty()); + CPPUNIT_ASSERT_EQUAL(size_t(7), buffer.GetSize()); CPPUNIT_ASSERT_EQUAL(size_t(7), buffer.Read().size); CPPUNIT_ASSERT_EQUAL(&data[0], buffer.Read().data); CPPUNIT_ASSERT_EQUAL(true, buffer.Write().IsEmpty()); @@ -65,6 +68,7 @@ public: CPPUNIT_ASSERT_EQUAL(false, buffer.IsEmpty()); CPPUNIT_ASSERT_EQUAL(false, buffer.IsFull()); CPPUNIT_ASSERT_EQUAL(false, buffer.Read().IsEmpty()); + CPPUNIT_ASSERT_EQUAL(size_t(6), buffer.GetSize()); CPPUNIT_ASSERT_EQUAL(size_t(6), buffer.Read().size); CPPUNIT_ASSERT_EQUAL(&data[1], buffer.Read().data); CPPUNIT_ASSERT_EQUAL(false, buffer.Write().IsEmpty()); @@ -78,6 +82,7 @@ public: CPPUNIT_ASSERT_EQUAL(false, buffer.IsEmpty()); CPPUNIT_ASSERT_EQUAL(true, buffer.IsFull()); CPPUNIT_ASSERT_EQUAL(false, buffer.Read().IsEmpty()); + CPPUNIT_ASSERT_EQUAL(size_t(7), buffer.GetSize()); CPPUNIT_ASSERT_EQUAL(size_t(7), buffer.Read().size); CPPUNIT_ASSERT_EQUAL(&data[1], buffer.Read().data); CPPUNIT_ASSERT_EQUAL(true, buffer.Write().IsEmpty()); @@ -88,6 +93,7 @@ public: CPPUNIT_ASSERT_EQUAL(false, buffer.IsEmpty()); CPPUNIT_ASSERT_EQUAL(false, buffer.IsFull()); CPPUNIT_ASSERT_EQUAL(false, buffer.Read().IsEmpty()); + CPPUNIT_ASSERT_EQUAL(size_t(4), buffer.GetSize()); CPPUNIT_ASSERT_EQUAL(size_t(4), buffer.Read().size); CPPUNIT_ASSERT_EQUAL(&data[4], buffer.Read().data); CPPUNIT_ASSERT_EQUAL(false, buffer.Write().IsEmpty()); @@ -100,6 +106,7 @@ public: CPPUNIT_ASSERT_EQUAL(false, buffer.IsEmpty()); CPPUNIT_ASSERT_EQUAL(false, buffer.IsFull()); CPPUNIT_ASSERT_EQUAL(false, buffer.Read().IsEmpty()); + CPPUNIT_ASSERT_EQUAL(size_t(6), buffer.GetSize()); CPPUNIT_ASSERT_EQUAL(size_t(4), buffer.Read().size); CPPUNIT_ASSERT_EQUAL(&data[4], buffer.Read().data); CPPUNIT_ASSERT_EQUAL(false, buffer.Write().IsEmpty()); @@ -112,6 +119,7 @@ public: CPPUNIT_ASSERT_EQUAL(false, buffer.IsEmpty()); CPPUNIT_ASSERT_EQUAL(true, buffer.IsFull()); CPPUNIT_ASSERT_EQUAL(false, buffer.Read().IsEmpty()); + CPPUNIT_ASSERT_EQUAL(size_t(7), buffer.GetSize()); CPPUNIT_ASSERT_EQUAL(size_t(4), buffer.Read().size); CPPUNIT_ASSERT_EQUAL(&data[4], buffer.Read().data); CPPUNIT_ASSERT_EQUAL(true, buffer.Write().IsEmpty()); @@ -122,6 +130,7 @@ public: CPPUNIT_ASSERT_EQUAL(false, buffer.IsEmpty()); CPPUNIT_ASSERT_EQUAL(false, buffer.IsFull()); CPPUNIT_ASSERT_EQUAL(false, buffer.Read().IsEmpty()); + CPPUNIT_ASSERT_EQUAL(size_t(3), buffer.GetSize()); CPPUNIT_ASSERT_EQUAL(size_t(3), buffer.Read().size); CPPUNIT_ASSERT_EQUAL(&data[0], buffer.Read().data); CPPUNIT_ASSERT_EQUAL(false, buffer.Write().IsEmpty()); @@ -135,6 +144,7 @@ public: buffer.Consume(3); CPPUNIT_ASSERT_EQUAL(true, buffer.IsEmpty()); CPPUNIT_ASSERT_EQUAL(false, buffer.IsFull()); + CPPUNIT_ASSERT_EQUAL(size_t(0), buffer.GetSize()); CPPUNIT_ASSERT_EQUAL(true, buffer.Read().IsEmpty()); CPPUNIT_ASSERT_EQUAL(false, buffer.Write().IsEmpty()); CPPUNIT_ASSERT_EQUAL(&data[3], buffer.Write().data); |