From 0f5fc39694db9755e8f65086f60b5cf9a10b90a4 Mon Sep 17 00:00:00 2001 From: Heinz Mauelshagen Date: Wed, 23 Jan 2013 14:04:34 +0100 Subject: [PATCH] buffer_t.cc --- unit-tests/buffer_t.cc | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/unit-tests/buffer_t.cc b/unit-tests/buffer_t.cc index 9386761..248ad0a 100644 --- a/unit-tests/buffer_t.cc +++ b/unit-tests/buffer_t.cc @@ -49,15 +49,13 @@ namespace { //---------------------------------------------------------------- -BOOST_AUTO_TEST_CASE(buffer_copy) +BOOST_AUTO_TEST_CASE(buffer_copy_fails) { uint32_t const sz = 8, align = 8; buffer::ptr b1 = create_buffer(); - buffer::ptr b2 = b1; + buffer::ptr b2; - BOOST_CHECK(b1); - BOOST_CHECK(b2); - BOOST_CHECK(b1 == b2); + // *b2 = *b1; // Compile time failure } BOOST_AUTO_TEST_CASE(buffer_8_a_8_raw_access) @@ -80,8 +78,8 @@ BOOST_AUTO_TEST_CASE(buffer_8_a_8_access) uint32_t const sz = 8, align = 8; buffer::ptr b = create_buffer(); - // b[0] = 0; // no match for operator [] ! - // BOOST_CHECK_EQUAL(b[0], '\0'); + (*b)[0] = 0; + BOOST_CHECK_EQUAL((*b)[0], '\0'); } BOOST_AUTO_TEST_CASE(buffer_8_a_8_const_access) @@ -89,8 +87,7 @@ BOOST_AUTO_TEST_CASE(buffer_8_a_8_const_access) uint32_t const sz = 8, align = 8; buffer::ptr const b = create_buffer(); - // b[0] = 0; // no match for operator [] ! - // BOOST_CHECK_EQUAL(b[0], '\0'); + (*b)[0] = 0; // Compile time error accessing read-only location } // 8 byte buffer size, varying alignment from 1 - 7