diff options
Diffstat (limited to 'test/ByteBufferTest.cpp')
-rw-r--r-- | test/ByteBufferTest.cpp | 30 |
1 files changed, 12 insertions, 18 deletions
diff --git a/test/ByteBufferTest.cpp b/test/ByteBufferTest.cpp index 4c51bcc..ed842f2 100644 --- a/test/ByteBufferTest.cpp +++ b/test/ByteBufferTest.cpp @@ -10,9 +10,9 @@ #define checkBuffer(buffer, size, capacity, cursor) \ D << "size=" << buffer.getSize() << ", capacity=" << buffer.getCapacity() << ", cursor=" << buffer.getCursor(); \ - BOOST_REQUIRE_EQUAL(buffer.getSize(), size); \ - BOOST_REQUIRE_EQUAL(buffer.getCapacity(), capacity); \ - BOOST_REQUIRE_EQUAL(buffer.getCursor(), cursor) + BOOST_CHECK_EQUAL(buffer.getSize(), size); \ + BOOST_CHECK_EQUAL(buffer.getCapacity(), capacity); \ + BOOST_CHECK_EQUAL(buffer.getCursor(), cursor) using namespace std; @@ -50,34 +50,31 @@ BOOST_AUTO_TEST_CASE(empty_buffer) { } */ -#include <iostream> BOOST_AUTO_TEST_CASE(basic) { Bytes b(1000); - ByteBuffer buffer(b.bytes, 1000); + ByteBuffer buffer(b.bytes, 1000, 0, 1000); checkBuffer(buffer, 1000, 1000, 0); - BOOST_REQUIRE_EQUAL(buffer.get8(), 0); + BOOST_CHECK_EQUAL(buffer.get8(), 0); checkBuffer(buffer, 1000, 1000, 1); for (int i = 1; i < b.capacity; i++) { - cout << "i=" << i << endl; - BOOST_REQUIRE_EQUAL(buffer.get8(), b.bytes[i]); + BOOST_CHECK_EQUAL(buffer.get8(), b.bytes[i]); } } -/* BOOST_AUTO_TEST_CASE(setCursor) { Bytes b(1000); ByteBuffer buffer(b.bytes, 1000, 0, 10); checkBuffer(buffer, 10, 1000, 0); - BOOST_REQUIRE_EQUAL(buffer.get8(), 0); + BOOST_CHECK_EQUAL(buffer.get8(), 0); checkBuffer(buffer, 10, 1000, 1); buffer.setCursor(0); checkBuffer(buffer, 10, 1000, 0); - BOOST_REQUIRE_EQUAL(buffer.get8(), 0); + BOOST_CHECK_EQUAL(buffer.get8(), 0); checkBuffer(buffer, 10, 1000, 1); buffer.setCursor(9); @@ -88,18 +85,15 @@ BOOST_AUTO_TEST_CASE(view) { Bytes b(1000); ByteBuffer buffer(b.bytes, b.capacity, 0, 10); - BOOST_REQUIRE_EQUAL(buffer.get8(), 0); - checkBuffer(buffer, 10, 1000, 1); - + BOOST_CHECK_EQUAL(buffer.get8(), 0); ByteBuffer view1 = buffer.view(); checkBuffer(view1, 9, 9, 0); - BOOST_REQUIRE_EQUAL(view1.get8(), 1); - BOOST_REQUIRE_EQUAL(view1.get8(), 2); + BOOST_CHECK_EQUAL(view1.get8(), 1); + BOOST_CHECK_EQUAL(view1.get8(), 2); ByteBuffer view2 = view1.view(); checkBuffer(view2, 7, 7, 0); - BOOST_REQUIRE_EQUAL(view1.get8(), 3); + BOOST_CHECK_EQUAL(view1.get8(), 3); } -*/ |