Skip to content
Snippets Groups Projects
Commit 5867ee86 authored by Pietro Incardona's avatar Pietro Incardona
Browse files

reinforced test

parent 4a065a93
No related branches found
No related tags found
No related merge requests found
......@@ -133,6 +133,16 @@ public:
{
return HeapMemory::size();
}
/*! \brief Destroy the internal memory
*
*
*/
void destroy()
{
HeapMemory::destroy();
buf_sz = 0;
}
};
......
......@@ -54,9 +54,8 @@ void HeapMemory::setAlignment(size_t align)
this->alignement = align;
}
/*! \brief destroy a chunk of memory
/*! \brief Destroy the internal memory
*
* Destroy a chunk of memory
*
*/
void HeapMemory::destroy()
......
......@@ -28,6 +28,8 @@ template<typename T> void test()
//! [Allocate some memory and fill with data]
T mem;
BOOST_REQUIRE_EQUAL(mem.size(),0ul);
mem.allocate(FIRST_ALLOCATION);
BOOST_REQUIRE_EQUAL(mem.size(),FIRST_ALLOCATION);
......@@ -107,6 +109,14 @@ template<typename T> void test()
BOOST_REQUIRE_EQUAL(ptr2[i],c);
}
mem.destroy();
BOOST_REQUIRE_EQUAL(mem.size(),0ul);
mem.allocate(FIRST_ALLOCATION);
BOOST_REQUIRE_EQUAL(mem.size(),FIRST_ALLOCATION);
}
}
......@@ -150,6 +160,14 @@ template<typename T> void Btest()
BOOST_REQUIRE_EQUAL(mem.size(),1ul);
//! [BShrink memory]
mem.destroy();
BOOST_REQUIRE_EQUAL(mem.size(),0ul);
mem.allocate(FIRST_ALLOCATION);
BOOST_REQUIRE_EQUAL(mem.size(),FIRST_ALLOCATION);
}
BOOST_AUTO_TEST_CASE( use_heap_memory )
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment