diff options
author | Trygve Laugstøl <trygvis@inamo.no> | 2018-11-22 23:23:38 +0100 |
---|---|---|
committer | Trygve Laugstøl <trygvis@inamo.no> | 2018-11-22 23:23:38 +0100 |
commit | 0e2228fae626ec617a6a1f042ceb6dbdbd774558 (patch) | |
tree | af9ca3948b37538f474987ec7e0cda5d554e7e9d /test | |
parent | b6c6fdf032ff76f31ae37e3f0f20895684f9e9f0 (diff) | |
download | ble-toys-0e2228fae626ec617a6a1f042ceb6dbdbd774558.tar.gz ble-toys-0e2228fae626ec617a6a1f042ceb6dbdbd774558.tar.bz2 ble-toys-0e2228fae626ec617a6a1f042ceb6dbdbd774558.tar.xz ble-toys-0e2228fae626ec617a6a1f042ceb6dbdbd774558.zip |
o Compiling everything again.
Diffstat (limited to 'test')
-rw-r--r-- | test/ByteBufferTest.cpp | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/test/ByteBufferTest.cpp b/test/ByteBufferTest.cpp index f8190c5..9f26971 100644 --- a/test/ByteBufferTest.cpp +++ b/test/ByteBufferTest.cpp @@ -8,12 +8,12 @@ using namespace std; -static void checkBuffer(const ByteBuffer& buffer, size_t size, size_t cursor) { +static void checkBuffer(const ByteBuffer& buffer, size_t size, size_t position) { if (false) { - cout << "size=" << buffer.getSize() << ", cursor=" << buffer.getCursor(); + cout << "size=" << buffer.getSize() << ", position=" << buffer.getPosition(); } BOOST_CHECK_EQUAL(buffer.getSize(), size); - BOOST_CHECK_EQUAL(buffer.getCursor(), cursor); + BOOST_CHECK_EQUAL(buffer.getPosition(), position); } class Bytes { @@ -70,13 +70,13 @@ BOOST_AUTO_TEST_CASE(setCursor) { BOOST_CHECK_EQUAL(buffer.read8(), 0); checkBuffer(buffer, 1000, 1); - buffer.setCursor(0); + buffer.setPosition(0); checkBuffer(buffer, 1000, 0); BOOST_CHECK_EQUAL(buffer.read8(), 0); checkBuffer(buffer, 1000, 1); - buffer.setCursor(9); + buffer.setPosition(9); checkBuffer(buffer, 1000, 9); } @@ -85,13 +85,13 @@ BOOST_AUTO_TEST_CASE(view) { ByteBuffer buffer(b.bytes, b.capacity); BOOST_CHECK_EQUAL(buffer.read8(), 0); - ByteBuffer view1 = buffer.viewRest(); + ByteBuffer view1 = buffer.viewCursorToEnd(); checkBuffer(view1, 999, 0); BOOST_CHECK_EQUAL(view1.read8(), 1); BOOST_CHECK_EQUAL(view1.read8(), 2); - ByteBuffer view2 = view1.viewRest(); + ByteBuffer view2 = view1.viewCursorToEnd(); checkBuffer(view2, 997, 0); BOOST_CHECK_EQUAL(view1.read8(), 3); @@ -102,7 +102,7 @@ BOOST_AUTO_TEST_CASE(ieee_11073_20601_float_1_0d) { ByteBuffer buffer(b.bytes, b.capacity); buffer.writeFLOAT(1.0); - buffer.setCursor(0); + buffer.setPosition(0); BOOST_CHECK_EQUAL(buffer.readFLOAT(), 1.0); } @@ -112,7 +112,7 @@ BOOST_AUTO_TEST_CASE(ieee_11073_20601_float_nan) { BOOST_CHECK_EQUAL(std::isnan(stof("NaN")), true); buffer.writeFLOAT(stof("NaN")); - buffer.setCursor(0); + buffer.setPosition(0); BOOST_CHECK_EQUAL(std::isnan(buffer.readFLOAT()), true); } @@ -120,7 +120,7 @@ void c(double input, uint32_t hx, double sigma = 0.00001) { Bytes b(1000); ByteBuffer buffer(b.bytes, b.capacity); buffer.writeFLOAT(input); - buffer.setCursor(0); + buffer.setPosition(0); double output = buffer.readFLOAT(); stringstream str; |