Commit 02c38b82 authored by JINMEI Tatuya's avatar JINMEI Tatuya
Browse files

[2107] test refactoring: create test zone data in the test ctor.

so we can reuse the same data for each fixture.
parent ea17ff0d
......@@ -32,20 +32,24 @@ namespace {
class ZoneDataTest : public ::testing::Test {
protected:
ZoneDataTest() : zname_("example.com") {}
ZoneDataTest() : zname_("example.com"),
zone_data_(ZoneData::create(mem_sgmt_, zname_))
{}
void TearDown() {
if (zone_data_ != NULL) {
ZoneData::destroy(mem_sgmt_, zone_data_);
}
// detect any memory leak in the test memory segment
EXPECT_TRUE(mem_sgmt_.allMemoryDeallocated());
}
const Name zname_;
isc::util::MemorySegmentLocal mem_sgmt_;
const Name zname_;
ZoneData* zone_data_;
RdataEncoder encoder_;
};
TEST_F(ZoneDataTest, create) {
ZoneData* zone_data = ZoneData::create(mem_sgmt_, zname_);
EXPECT_EQ(LabelSequence(zname_), zone_data->getOriginNode()->getLabels());
ZoneData::destroy(mem_sgmt_, zone_data);
TEST_F(ZoneDataTest, getOriginNode) {
EXPECT_EQ(LabelSequence(zname_), zone_data_->getOriginNode()->getLabels());
}
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment