buffer_t.cc

This commit is contained in:
Heinz Mauelshagen 2013-01-23 14:04:34 +01:00
parent 78563e1709
commit 0f5fc39694

View File

@ -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<sz, align>::ptr b1 = create_buffer<sz, align>();
buffer<sz, align>::ptr b2 = b1;
buffer<sz, align>::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<sz, align>::ptr b = create_buffer<sz, align>();
// 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<sz, align>::ptr const b = create_buffer<sz, align>();
// 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