]> git.ipfire.org Git - thirdparty/kea.git/commitdiff
[2209] Test ZoneTableSegmentLocal
authorMichal 'vorner' Vaner <michal.vaner@nic.cz>
Fri, 26 Oct 2012 18:09:21 +0000 (20:09 +0200)
committerMichal 'vorner' Vaner <michal.vaner@nic.cz>
Fri, 26 Oct 2012 18:09:21 +0000 (20:09 +0200)
And not ZoneTableSegmentTest like before. Testing a mock class (and not
testing the real class) makes no sense.

src/lib/datasrc/memory/zone_table_segment_local.cc
src/lib/datasrc/tests/memory/zone_table_segment_unittest.cc

index fcb25f9cd322f2d7ee3c115a81d2bde40df1fcb3..ca46b126f29377de4200ba086eb94053bf05f071 100644 (file)
@@ -30,6 +30,7 @@ ZoneTableSegmentLocal::ZoneTableSegmentLocal(const RRClass& rrclass) :
 
 ZoneTableSegmentLocal::~ZoneTableSegmentLocal() {
     ZoneTable::destroy(mem_sgmt_, header_.getTable());
+    assert(mem_sgmt_.allMemoryDeallocated());
 }
 
 // After more methods' definitions are added here, it would be a good
index 16793fcbb4822c675aef6d67e14320730457c7fb..ac114e282ca10262fd065a4e9b83bc287849b98b 100644 (file)
@@ -12,7 +12,6 @@
 // OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
 // PERFORMANCE OF THIS SOFTWARE.
 
-#include "zone_table_segment_test.h"
 #include <datasrc/memory/zone_writer_local.h>
 #include <datasrc/memory/zone_table_segment_local.h>
 #include <util/memory_segment_local.h>
@@ -32,23 +31,15 @@ namespace {
 class ZoneTableSegmentTest : public ::testing::Test {
 protected:
     ZoneTableSegmentTest() :
-        ztable_segment_(new test::ZoneTableSegmentTest(RRClass::IN(),
-                                                       mem_sgmt_))
+        ztable_segment_(ZoneTableSegment::create(isc::data::NullElement(),
+                                                 RRClass::IN()))
     {}
 
-    ~ZoneTableSegmentTest() {
-        delete ztable_segment_;
-    }
-
     void TearDown() {
         ZoneTableSegment::destroy(ztable_segment_);
         ztable_segment_ = NULL;
-
-        // Catch any future leaks here.
-        EXPECT_TRUE(mem_sgmt_.allMemoryDeallocated());
     }
 
-    MemorySegmentLocal mem_sgmt_;
     ZoneTableSegment* ztable_segment_;
 };