Get unit-tests building with g++ 4.8.1

This commit is contained in:
Joe Thornber 2013-06-25 14:18:38 +01:00
parent eb8d4c6f0b
commit 730f3b9f9a
5 changed files with 15 additions and 8 deletions

View File

@ -51,6 +51,10 @@ namespace persistent_data {
typedef boost::shared_ptr<buffer> ptr;
typedef boost::shared_ptr<buffer const> const_ptr;
size_t size() const {
return Size;
}
unsigned char &operator[](unsigned index) {
check_index(index);

View File

@ -21,6 +21,9 @@ GMOCK_INCLUDES=\
-Igmock-1.6.0/include \
-Igmock-1.6.0/gtest/include
GMOCK_FLAGS=\
-Wno-unused-local-typedefs
GMOCK_LIBS=\
-Llib -lpdata -lgmock -lpthread
@ -67,7 +70,7 @@ TEST_OBJECTS=$(subst .cc,.gmo,$(TEST_SOURCE))
%.gmo: %.cc
@echo " [CXX] $<"
$(V) $(CXX) -c $(INCLUDES) $(GMOCK_INCLUDES) $(CXXFLAGS) -o $@ $<
$(CXX) -c $(INCLUDES) $(GMOCK_INCLUDES) $(CXXFLAGS) $(GMOCK_FLAGS) -o $@ $<
unit-tests/unit_tests: $(TEST_OBJECTS) lib/libgmock.a lib/libpdata.a
@echo " [LD] $<"
@ -76,4 +79,4 @@ unit-tests/unit_tests: $(TEST_OBJECTS) lib/libgmock.a lib/libpdata.a
.PHONEY: unit-test
unit-test: unit-tests/unit_tests
unit-tests/unit_tests
unit-tests/unit_tests

View File

@ -141,7 +141,7 @@ TEST(BlockTests, write_validator_works)
{
bm4096::write_ref wr = bm->write_lock(0, v);
::memset(wr.data().raw(), 23, sizeof(wr.data().raw()));
::memset(wr.data().raw(), 23, sizeof(wr.data().size()));
}
bm->flush(); // force the prepare method to be called

View File

@ -93,7 +93,7 @@ TEST(BufferTest, buffer_128_a_2_succeeds)
uint32_t const sz = 128, align = 2;
buffer<sz, align>::ptr b = create_buffer<sz, align>();
ASSERT_TRUE(b);
ASSERT_TRUE(static_cast<bool>(b));
}
TEST(BufferTest, buffer_128_a_4_succeeds)
@ -101,7 +101,7 @@ TEST(BufferTest, buffer_128_a_4_succeeds)
uint32_t const sz = 128, align = 4;
buffer<sz, align>::ptr b = create_buffer<sz, align>();
ASSERT_TRUE(b);
ASSERT_TRUE(static_cast<bool>(b));
}
// Varying buffer size, alignment 8

View File

@ -108,7 +108,7 @@ namespace {
ASSERT_THAT(sm->get_nr_free(), Eq(NR_BLOCKS));
for (unsigned i = 0; i < NR_BLOCKS; i++) {
optional<block_address> mb = sm->new_block();
boost::optional<block_address> mb = sm->new_block();
ASSERT_TRUE(mb);
ASSERT_THAT(sm->get_nr_free(), Eq(NR_BLOCKS - i - 1));
}
@ -121,7 +121,7 @@ namespace {
void test_runs_out_of_space(space_map::ptr sm)
{
optional<block_address> mb;
boost::optional<block_address> mb;
for (unsigned i = 0; i < NR_BLOCKS; i++)
mb = sm->new_block();
@ -147,7 +147,7 @@ namespace {
void test_not_allocated_twice(space_map::ptr sm)
{
optional<block_address> mb = sm->new_block();
boost::optional<block_address> mb = sm->new_block();
ASSERT_TRUE(mb);
for (;;) {