From: Mukund Sivaraman Date: Sun, 7 Oct 2012 17:32:57 +0000 (+0530) Subject: [2268] Remove redundant MemorySegmentTest definition X-Git-Tag: trac2402_base~54 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=83a27d452c13b468d2103b0314ecf2bae17cd6b1;p=thirdparty%2Fkea.git [2268] Remove redundant MemorySegmentTest definition --- diff --git a/src/lib/datasrc/tests/memory/zone_table_unittest.cc b/src/lib/datasrc/tests/memory/zone_table_unittest.cc index 359df4923f..a8ee6144e2 100644 --- a/src/lib/datasrc/tests/memory/zone_table_unittest.cc +++ b/src/lib/datasrc/tests/memory/zone_table_unittest.cc @@ -12,6 +12,8 @@ // OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR // PERFORMANCE OF THIS SOFTWARE. +#include "memory_segment_test.h" + #include #include @@ -32,27 +34,6 @@ using namespace isc::datasrc; using namespace isc::datasrc::memory; namespace { -// Memory segment specified for tests. It normally behaves like a "local" -// memory segment. If "throw count" is set to non 0 via setThrowCount(), -// it continues the normal behavior up to the specified number of calls to -// allocate(), and throws an exception at the next call. -class TestMemorySegment : public isc::util::MemorySegmentLocal { -public: - TestMemorySegment() : throw_count_(0) {} - virtual void* allocate(size_t size) { - if (throw_count_ > 0) { - if (--throw_count_ == 0) { - throw std::bad_alloc(); - } - } - return (isc::util::MemorySegmentLocal::allocate(size)); - } - void setThrowCount(size_t count) { throw_count_ = count; } - -private: - size_t throw_count_; -}; - class ZoneTableTest : public ::testing::Test { protected: ZoneTableTest() : zclass_(RRClass::IN()), @@ -73,7 +54,7 @@ protected: } const RRClass zclass_; const Name zname1, zname2, zname3; - TestMemorySegment mem_sgmt_; + test::MemorySegmentTest mem_sgmt_; ZoneTable* zone_table; };