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

[2432] Add zero-argument RRsetCollection constructor

parent e6c05e21
...@@ -30,6 +30,10 @@ namespace dns { ...@@ -30,6 +30,10 @@ namespace dns {
/// container. /// container.
class RRsetCollection : public RRsetCollectionBase { class RRsetCollection : public RRsetCollectionBase {
public: public:
/// \brief Constructor.
RRsetCollection()
{}
/// \brief Constructor. /// \brief Constructor.
/// ///
/// The \c origin and \c rrclass arguments are required for the zone /// The \c origin and \c rrclass arguments are required for the zone
......
...@@ -126,6 +126,9 @@ doAddAndRemove(RRsetCollection& collection, const RRClass& rrclass) { ...@@ -126,6 +126,9 @@ doAddAndRemove(RRsetCollection& collection, const RRClass& rrclass) {
EXPECT_EQ(RRClass("IN"), rrset_found->getClass()); EXPECT_EQ(RRClass("IN"), rrset_found->getClass());
EXPECT_EQ(Name("foo.example.org"), rrset_found->getName()); EXPECT_EQ(Name("foo.example.org"), rrset_found->getName());
// The collection must not be empty.
EXPECT_NE(collection.end(), collection.begin());
// Remove foo.example.org/A // Remove foo.example.org/A
collection.removeRRset(Name("foo.example.org"), rrclass, RRType::A()); collection.removeRRset(Name("foo.example.org"), rrclass, RRType::A());
...@@ -139,6 +142,19 @@ TEST_F(RRsetCollectionTest, addAndRemove) { ...@@ -139,6 +142,19 @@ TEST_F(RRsetCollectionTest, addAndRemove) {
doAddAndRemove(collection, rrclass); doAddAndRemove(collection, rrclass);
} }
TEST_F(RRsetCollectionTest, empty) {
RRsetCollection cln;
// Here, cln is empty.
EXPECT_EQ(cln.end(), cln.begin());
doAddAndRemove(cln, rrclass);
// cln should be empty again here, after the add and remove
// operations.
EXPECT_EQ(cln.end(), cln.begin());
}
TEST_F(RRsetCollectionTest, iteratorTest) { TEST_F(RRsetCollectionTest, iteratorTest) {
// The collection must not be empty. // The collection must not be empty.
EXPECT_NE(collection.end(), collection.begin()); EXPECT_NE(collection.end(), collection.begin());
......
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