Commit cea0d105 authored by Mukund Sivaraman's avatar Mukund Sivaraman
Browse files

[2850] Add a test for clear() on an uninitialized segment

parent 3ebd4b03
......@@ -375,6 +375,21 @@ TEST_F(ZoneTableSegmentMappedTest, resetReadOnly) {
MemorySegmentError);
}
TEST_F(ZoneTableSegmentMappedTest, clearUninitialized) {
// Clearing a segment that has not been reset() is a nop, as clear()
// returns it to a fresh uninitialized state anyway.
EXPECT_NO_THROW(ztable_segment_->clear());
// The following should still throw, because the segment has not
// been successfully reset() yet.
EXPECT_THROW(ztable_segment_->getHeader(), isc::InvalidOperation);
EXPECT_THROW(ztable_segment_->getMemorySegment(), isc::InvalidOperation);
// isWritable() must still return false, because the segment has not
// been successfully reset() yet.
EXPECT_FALSE(ztable_segment_->isWritable());
}
TEST_F(ZoneTableSegmentMappedTest, clear) {
// First, open an underlying mapped file in read+write mode (doesn't
// exist yet)
......
Supports Markdown
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