diff options
author | Trygve Laugstøl <trygvis@inamo.no> | 2015-02-17 16:20:30 +0100 |
---|---|---|
committer | Trygve Laugstøl <trygvis@inamo.no> | 2015-02-17 16:20:30 +0100 |
commit | 0d0749ff0f842f10fea6929dc466e4e1be458234 (patch) | |
tree | 6d1198f23da97c65c5b1936484c9dae6126ed654 /test | |
parent | 076fbdda4477b87deb322e43925e010d24d9fa5d (diff) | |
download | ble-toys-0d0749ff0f842f10fea6929dc466e4e1be458234.tar.gz ble-toys-0d0749ff0f842f10fea6929dc466e4e1be458234.tar.bz2 ble-toys-0d0749ff0f842f10fea6929dc466e4e1be458234.tar.xz ble-toys-0d0749ff0f842f10fea6929dc466e4e1be458234.zip |
o More tests, more passing tests.
Diffstat (limited to 'test')
-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); } -*/ |